Пример #1
0
 private GeoCoordinatesPropertyGroup(JArray jcoordinates)
 {
     if (jcoordinates != null && jcoordinates.HasValues)
     {
         var jprimary = jcoordinates.FirstOrDefault(c => c["primary"] != null);
         if (jprimary != null)
         {
             PrimaryCoordinate = MediaWikiHelper.GeoCoordinateFromJson((JObject)jcoordinates.First);
             PrimaryDistance   = (int?)jcoordinates.First["dist"] ?? 0;
         }
         if (jprimary == null || jcoordinates.Count > 1)
         {
             var coordinates = jcoordinates.Select(c => MediaWikiHelper.GeoCoordinateFromJson((JObject)c)).ToArray();
             _Coordinates = new ReadOnlyCollection <GeoCoordinate>(coordinates);
         }
     }
 }
Пример #2
0
 /// <inheritdoc />
 protected override GeoSearchResultItem ItemFromJson(JToken json)
 {
     return(new GeoSearchResultItem(MediaWikiHelper.PageStubFromJson((JObject)json),
                                    MediaWikiHelper.GeoCoordinateFromJson((JObject)json),
                                    json["primary"] != null, (double)json["dist"]));
 }