Beispiel #1
0
        private IAggregation GetGeoBoundsMetricAggregation(JsonReader reader, JsonSerializer serializer)
        {
            reader.Read();
            var o = JObject.Load(reader);

            if (o == null)
            {
                return(null);
            }
            var    geoBoundsMetric = new GeoBoundsMetric();
            JToken topLeftToken;

            o.TryGetValue("top_left", out topLeftToken);
            if (topLeftToken != null)
            {
                var topLeft = topLeftToken.ToObject <LatLon>();
                if (topLeft != null)
                {
                    geoBoundsMetric.Bounds.TopLeft = topLeft;
                }
            }
            JToken bottomRightToken;

            o.TryGetValue("bottom_right", out bottomRightToken);
            if (bottomRightToken != null)
            {
                var bottomRight = bottomRightToken.ToObject <LatLon>();
                if (bottomRight != null)
                {
                    geoBoundsMetric.Bounds.BottomRight = bottomRight;
                }
            }
            return(geoBoundsMetric);
        }
		private IAggregation GetGeoBoundsMetricAggregation(JsonReader reader, JsonSerializer serializer)
		{
			reader.Read();
			var o = JObject.Load(reader);
			if (o == null)
				return null;
			var geoBoundsMetric = new GeoBoundsMetric();
			JToken topLeftToken;
			o.TryGetValue("top_left", out topLeftToken);
			if (topLeftToken != null)
			{
				var topLeft = topLeftToken.ToObject<LatLon>();
				if (topLeft != null)
					geoBoundsMetric.Bounds.TopLeft = topLeft;
			}
			JToken bottomRightToken;
			o.TryGetValue("bottom_right", out bottomRightToken);
			if (bottomRightToken != null)
			{
				var bottomRight = bottomRightToken.ToObject<LatLon>();
				if (bottomRight != null)
					geoBoundsMetric.Bounds.BottomRight = bottomRight;
			}
			return geoBoundsMetric;
		}