-
Notifications
You must be signed in to change notification settings - Fork 149
/
RasterArraySource.swift
138 lines (115 loc) · 6.17 KB
/
RasterArraySource.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
// This file is generated.
import Foundation
/// A raster array source
///
/// - SeeAlso: [Mapbox Style Specification](https://docs.mapbox.com/mapbox-gl-js/style-spec/sources/#raster_array)
@_documentation(visibility: public)
@_spi(Experimental) public struct RasterArraySource: Source {
@_documentation(visibility: public)
public let type: SourceType
@_documentation(visibility: public)
public let id: String
/// A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://<Tileset ID>`.
@_documentation(visibility: public)
public var url: String?
/// An array of one or more tile source URLs, as in the TileJSON spec.
@_documentation(visibility: public)
public var tiles: [String]?
/// An array containing the longitude and latitude of the southwest and northeast corners of the source's bounding box in the following order: `[sw.lng, sw.lat, ne.lng, ne.lat]`. When this property is included in a source, no tiles outside of the given bounds are requested by Mapbox GL.
@_documentation(visibility: public)
public private(set) var bounds: [Double]?
/// Minimum zoom level for which tiles are available, as in the TileJSON spec.
@_documentation(visibility: public)
public var minzoom: Double?
/// Maximum zoom level for which tiles are available, as in the TileJSON spec. Data from tiles at the maxzoom are used when displaying the map at higher zoom levels.
@_documentation(visibility: public)
public var maxzoom: Double?
/// The minimum visual size to display tiles for this layer. Only configurable for raster layers.
@_documentation(visibility: public)
public private(set) var tileSize: Double?
/// Contains an attribution to be displayed when the map is shown to a user.
@_documentation(visibility: public)
public private(set) var attribution: String?
/// Contains the description of the raster data layers and the bands contained within the tiles.
@_documentation(visibility: public)
public private(set) var rasterLayers: [RasterArraySource.RasterDataLayer]?
/// This property defines a source-specific resource budget, either in tile units or in megabytes. Whenever the tile cache goes over the defined limit, the least recently used tile will be evicted from the in-memory cache. Note that the current implementation does not take into account resources allocated by the visible tiles.
@_documentation(visibility: public)
public var tileCacheBudget: TileCacheBudgetSize?
@_documentation(visibility: public)
public init(id: String) {
self.id = id
self.type = .rasterArray
}
}
extension RasterArraySource {
enum CodingKeys: String, CodingKey {
case id = "id"
case type = "type"
case url = "url"
case tiles = "tiles"
case bounds = "bounds"
case minzoom = "minzoom"
case maxzoom = "maxzoom"
case tileSize = "tileSize"
case attribution = "attribution"
case rasterLayers = "rasterLayers"
case tileCacheBudget = "tile-cache-budget"
}
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
if encoder.userInfo[.volatilePropertiesOnly] as? Bool == true {
try encodeVolatile(to: encoder, into: &container)
} else if encoder.userInfo[.nonVolatilePropertiesOnly] as? Bool == true {
try encodeNonVolatile(to: encoder, into: &container)
} else {
try encodeVolatile(to: encoder, into: &container)
try encodeNonVolatile(to: encoder, into: &container)
}
}
private func encodeVolatile(to encoder: Encoder, into container: inout KeyedEncodingContainer<CodingKeys>) throws {
try container.encodeIfPresent(tileCacheBudget, forKey: .tileCacheBudget)
}
private func encodeNonVolatile(to encoder: Encoder, into container: inout KeyedEncodingContainer<CodingKeys>) throws {
try container.encodeIfPresent(id, forKey: .id)
try container.encodeIfPresent(type, forKey: .type)
try container.encodeIfPresent(url, forKey: .url)
try container.encodeIfPresent(tiles, forKey: .tiles)
try container.encodeIfPresent(bounds, forKey: .bounds)
try container.encodeIfPresent(minzoom, forKey: .minzoom)
try container.encodeIfPresent(maxzoom, forKey: .maxzoom)
try container.encodeIfPresent(tileSize, forKey: .tileSize)
try container.encodeIfPresent(attribution, forKey: .attribution)
try container.encodeIfPresent(rasterLayers, forKey: .rasterLayers)
}
}
@_documentation(visibility: public)
@_spi(Experimental)
extension RasterArraySource {
/// A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://<Tileset ID>`.
@_documentation(visibility: public)
public func url(_ newValue: String) -> Self {
with(self, setter(\.url, newValue))
}
/// An array of one or more tile source URLs, as in the TileJSON spec.
@_documentation(visibility: public)
public func tiles(_ newValue: [String]) -> Self {
with(self, setter(\.tiles, newValue))
}
/// Minimum zoom level for which tiles are available, as in the TileJSON spec.
@_documentation(visibility: public)
public func minzoom(_ newValue: Double) -> Self {
with(self, setter(\.minzoom, newValue))
}
/// Maximum zoom level for which tiles are available, as in the TileJSON spec. Data from tiles at the maxzoom are used when displaying the map at higher zoom levels.
@_documentation(visibility: public)
public func maxzoom(_ newValue: Double) -> Self {
with(self, setter(\.maxzoom, newValue))
}
/// This property defines a source-specific resource budget, either in tile units or in megabytes. Whenever the tile cache goes over the defined limit, the least recently used tile will be evicted from the in-memory cache. Note that the current implementation does not take into account resources allocated by the visible tiles.
@_documentation(visibility: public)
public func tileCacheBudget(_ newValue: TileCacheBudgetSize) -> Self {
with(self, setter(\.tileCacheBudget, newValue))
}
}
// End of generated file.