예제 #1
0
        public static TwitterBoundingBox Parse(JsonObject obj)
        {
            // Check whether "obj" is NULL
            if (obj == null)
            {
                return(null);
            }

            // Get the array
            JsonArray coordinates = obj.GetArray("coordinates");

            // Initialize the bounding box
            TwitterBoundingBox boundingBox = new TwitterBoundingBox {
                Type        = obj.GetString("type"),
                Coordinates = new TwitterCoordinates[coordinates.Length][]
            };

            // Parse the coordinates
            for (int i = 0; i < coordinates.Length; i++)
            {
                boundingBox.Coordinates[i] = TwitterCoordinates.ParseMultiple(coordinates.GetArray(i));
            }

            // Return the building box
            return(boundingBox);
        }
예제 #2
0
 private TwitterPlace(JObject obj) : base(obj)
 {
     Id          = obj.GetString("id");
     Url         = obj.GetString("url");
     Type        = obj.GetString("place_type");
     Name        = obj.GetString("name");
     FullName    = obj.GetString("full_name");
     CountryCode = obj.GetString("country_code");
     Country     = obj.GetString("country");
     BoundingBox = obj.GetObject("bounding_box", TwitterBoundingBox.Parse);
 }
예제 #3
0
 /// <summary>
 /// Gets a place from the specified <var>JsonObject</var>.
 /// </summary>
 /// <param name="obj">The instance of <var>JsonObject</var> to parse.</param>
 public static TwitterPlace Parse(JsonObject obj)
 {
     if (obj == null)
     {
         return(null);
     }
     return(new TwitterPlace(obj)
     {
         Id = obj.GetString("id"),
         Url = obj.GetString("url"),
         Type = obj.GetString("place_type"),
         Name = obj.GetString("name"),
         FullName = obj.GetString("full_name"),
         CountryCode = obj.GetString("country_code"),
         Country = obj.GetString("country"),
         BoundingBox = TwitterBoundingBox.Parse(obj.GetObject("bounding_box"))
     });
 }
        public static TwitterBoundingBox Parse(JsonObject obj) {

            // Check whether "obj" is NULL
            if (obj == null) return null;

            // Get the array
            JsonArray coordinates = obj.GetArray("coordinates");

            // Initialize the bounding box
            TwitterBoundingBox boundingBox = new TwitterBoundingBox {
                Type = obj.GetString("type"),
                Coordinates = new TwitterCoordinates[coordinates.Length][]
            };

            // Parse the coordinates
            for (int i = 0; i < coordinates.Length; i++) {
                boundingBox.Coordinates[i] = TwitterCoordinates.ParseMultiple(coordinates.GetArray(i));
            }

            // Return the building box
            return boundingBox;
        
        }