예제 #1
0
        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);
 }