namespace Mapbox.Platform.TilesetTileJSON { using Mapbox.Json; using Mapbox.Utils; using System; public class TileJSONResponse { [JsonProperty("attribution")] public string Attribution { get; set; } [JsonProperty("autoscale")] public bool AutoScale { get; set; } private double[] _bounds; [JsonProperty("bounds")] public double[] Bounds { get { return _bounds; } set { _bounds = value; BoundsParsed = new Vector2dBounds( new Vector2d(Bounds[1], Bounds[0]) , new Vector2d(Bounds[3], Bounds[2]) ); } } [JsonIgnore] public Vector2dBounds BoundsParsed { get; private set; } private double[] _center; [JsonProperty("center")] public double[] Center { get { return _center; } set { _center = value; CenterParsed = new Vector2d(_center[1], _center[0]); } } [JsonIgnore] public Vector2d CenterParsed { get; private set; } private long? _created; /// Concatenated tilesets don't have a created property [JsonProperty("created")] public long? Created { get { return _created; } set { _created = value; if (_created.HasValue) { CreatedUtc = UnixTimestampUtils.From(_created.Value); } else { CreatedUtc = null; } } } /// Concatenated tilesets don't have a created property [JsonIgnore] public DateTime? CreatedUtc { get; private set; } [JsonProperty("description")] public string Description { get; set; } /// Can be empty [JsonProperty("format")] public string Format { get; set; } /// Can be empty (for concatenated tilesets) [JsonProperty("id")] public string Id { get; set; } [JsonProperty("maxzoom")] public int MaxZoom { get; set; } [JsonProperty("minzoom")] public int MinZoom { get; set; } private long? _modified; /// Unmodified tilesets don't have a modfied property [JsonProperty("modified")] public long? Modified { get { return _modified; } set { _modified = value; if (_modified.HasValue) { ModifiedUtc = UnixTimestampUtils.From(_modified.Value); } else { ModifiedUtc = null; } } } /// Unmodified tilesets don't have a modfied property [JsonIgnore] public DateTime? ModifiedUtc { get; private set; } [JsonProperty("name")] public string Name { get; set; } [JsonProperty("private")] public bool Private { get; set; } [JsonProperty("scheme")] public string Scheme { get; set; } /// Can be empty [JsonProperty("source")] public string Source { get; set; } [JsonProperty("tilejson")] public string TileJSONVersion { get; set; } [JsonProperty("tiles")] public string[] Tiles { get; set; } [JsonProperty("vector_layers")] public TileJSONObjectVectorLayer[] VectorLayers { get; set; } /// Can be empty (for concatenated tilesets) [JsonProperty("webpage")] public string WebPage { get; set; } } }