private GeocoderResult ParseGeocoderResult(JSONNode resultNode)
        {
            BoundingBox bbox = null;
            string[] bboxArray = resultNode["boundingbox"].Value.Split(',');
            if (bboxArray.Length == 4)
            {
                bbox = new BoundingBox(ParseGeoCoordinate(bboxArray[0], bboxArray[2]),
                    ParseGeoCoordinate(bboxArray[1], bboxArray[3]));
            }

            return new GeocoderResult()
            {
                PlaceId = long.Parse(resultNode["place_id"].Value),
                OsmId = long.Parse(resultNode["osm_id"].Value),
                OsmType = resultNode["osm_type"].Value,
                DisplayName = resultNode["display_name"].Value,
                Class = resultNode["class"].Value,
                Type = resultNode["type"].Value,
                Coordinate = ParseGeoCoordinate(resultNode["lat"].Value, resultNode["lon"].Value),
                BoundginBox = bbox,
            };
        }
示例#2
0
 public override void Add (string aKey, JSONNode aItem)
 {
     var tmp = new JSONClass();
     tmp.Add(aKey, aItem);
     Set(tmp);
 }
示例#3
0
 public override void Add (JSONNode aItem)
 {
     var tmp = new JSONArray();
     tmp.Add(aItem);
     Set(tmp);
 }
示例#4
0
 private void Set(JSONNode aVal)
 {
     if (_key == null)
     {
         _node.Add(aVal);
     }
     else
     {
         _node.Add(_key, aVal);
     }
     _node = null; // Be GC friendly.
 }
示例#5
0
 public JSONLazyCreator(JSONNode aNode, string aKey)
 {
     _node = aNode;
     _key = aKey;
 }
示例#6
0
 public JSONLazyCreator(JSONNode aNode)
 {
     _node = aNode;
     _key  = null;
 }
示例#7
0
 public virtual JSONNode Remove(JSONNode aNode) { return aNode; }
示例#8
0
 public virtual void Add(JSONNode aItem)
 {
     Add("", aItem);
 }
示例#9
0
 public override JSONNode Remove(JSONNode aNode)
 {
     try
     {
         var item = _dict.First(k => k.Value == aNode);
         _dict.Remove(item.Key);
         return aNode;
     }
     catch
     {
         return null;
     }
 }
示例#10
0
 public override void Add(string aKey, JSONNode aItem)
 {
     if (!string.IsNullOrEmpty(aKey))
     {
         if (_dict.ContainsKey(aKey))
             _dict[aKey] = aItem;
         else
             _dict.Add(aKey, aItem);
     }
     else
         _dict.Add(Guid.NewGuid().ToString(), aItem);
 }
示例#11
0
 public virtual void Add(string aKey, JSONNode aItem){ }
示例#12
0
 public override JSONNode Remove(JSONNode aNode)
 {
     _list.Remove(aNode);
     return aNode;
 }
示例#13
0
 public override void Add(string aKey, JSONNode aItem)
 {
     _list.Add(aItem);
 }