Skip to content

Commit

Permalink
Added IsLocationAvailable to Coordinate to indicate when coordinates …
Browse files Browse the repository at this point in the history
…are null or not provided.
  • Loading branch information
JoeMayo committed Feb 8, 2016
1 parent 8e6be51 commit f5ea2e7
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/LinqToTwitter/LinqToTwitter.Shared/Geo/Coordinate.cs
Expand Up @@ -16,10 +16,17 @@ public class Coordinate
public Coordinate() { }
internal Coordinate(JsonData coord)
{
if (coord == null) return;
var jsonLatitude = coord[LatitudePos];
if (coord == null)
{
IsLocationAvailable = false;
return;
}

IsLocationAvailable = true;

JsonData jsonLatitude = coord[LatitudePos];
Latitude = jsonLatitude.IsDouble ? (double)jsonLatitude : (int)jsonLatitude;
var jsonLongitude = coord[LongitudePos];
JsonData jsonLongitude = coord[LongitudePos];
Longitude = jsonLongitude.IsDouble ? (double)jsonLongitude : (int)jsonLongitude;
}

Expand All @@ -37,5 +44,7 @@ internal Coordinate(JsonData coord)
/// Longitude
/// </summary>
public double Longitude { get; set; }

public bool IsLocationAvailable { get; set; }
}
}

0 comments on commit f5ea2e7

Please sign in to comment.