forked from maplibre/maplibre-native
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtile_server_options.hpp
306 lines (262 loc) · 8.99 KB
/
tile_server_options.hpp
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
#pragma once
#include <mbgl/util/default_style.hpp>
#include <memory>
#include <optional>
#include <string>
#include <vector>
namespace mbgl {
/**
* @brief Holds values for tile server options.
*/
class TileServerOptions final {
public:
/**
* @brief Constructs a TileServerOptions object with default values.
*/
explicit TileServerOptions();
~TileServerOptions();
// movable
TileServerOptions(TileServerOptions&& options) noexcept;
TileServerOptions& operator=(TileServerOptions&& options) noexcept;
// copyable
TileServerOptions(const TileServerOptions&);
TileServerOptions clone() const;
/**
* @brief Sets the API base URL.
*
* @param baseURL API base URL.
* @return TileServerOptions for chaining options together.
*/
TileServerOptions& withBaseURL(std::string baseURL);
/**
* @brief Gets the previously set (or default) API base URL.
*
* @return const std::string& API base URL.
*/
const std::string& baseURL() const;
/**
* @brief Sets the scheme alias for the tile server. For example maptiler:// for MapTiler.
*
* @param alias The URI alias.
* @return TileServerOptions for chaining options together.
*/
TileServerOptions& withUriSchemeAlias(std::string alias);
/**
* @brief Gets the previously set (or default) tile server URI alias.
*
* @return const std::string& scheme alias.
*/
const std::string& uriSchemeAlias() const;
/**
* @brief Sets the template for sources.
*
* @param sourceTemplate The source template.
* @param domainName The domain name.
* @return TileServerOptions for chaining options together.
*/
TileServerOptions& withSourceTemplate(std::string sourceTemplate,
std::string domainName,
std::optional<std::string> versionPrefix);
/**
* @brief Gets the previously set (or default) source template.
*
* @return const std::string& source template.
*/
const std::string& sourceTemplate() const;
/**
* @brief Gets the previously set (or default) source domain name
*
* @return const std::string& source domain name.
*/
const std::string& sourceDomainName() const;
/**
* @brief Gets the previously set (or default) version prefix
*
* @return const optional<std::string>& version prefix.
*/
const std::optional<std::string>& sourceVersionPrefix() const;
/**
* @brief Sets the template for styles.
*
* @param styleTemplate The style template.
* @param domainName If set, the URL domain must contain the specified
* string to be matched as canonical style URL .
*
* @return TileServerOptions for chaining options together.
*/
TileServerOptions& withStyleTemplate(std::string styleTemplate,
std::string domainName,
std::optional<std::string> versionPrefix);
/**
* @brief Gets the previously set (or default) style template.
*
* @return const std::string& style template.
*/
const std::string& styleTemplate() const;
/**
* @brief Gets the previously set (or default) style domain name.
*
* @return const std::string& domain name.
*/
const std::string& styleDomainName() const;
/**
* @brief Gets the previously set (or default) version prefix
*
* @return const optional<std::string>& version prefix.
*/
const std::optional<std::string>& styleVersionPrefix() const;
/**
* @brief Sets the template for sprites.
* @param domainName If set, the URL domain must contain the specified
* string to be matched as canonical sprite URL
* .
*
* @param spritesTemplate The sprites template.
* @return TileServerOptions for chaining options together.
*/
TileServerOptions& withSpritesTemplate(std::string spritesTemplate,
std::string domainName,
std::optional<std::string> versionPrefix);
/**
* @brief Gets the previously set (or default) sprites template.
*
* @return const std::string& sprites template.
*/
const std::string& spritesTemplate() const;
/**
* @brief Gets the previously set (or default) sprites domain name.
*
* @return const std::string& domain name.
*/
const std::string& spritesDomainName() const;
/**
* @brief Gets the previously set (or default) version prefix
*
* @return const optional<std::string>& version prefix.
*/
const std::optional<std::string>& spritesVersionPrefix() const;
/**
* @brief Sets the template for glyphs.
*
* @param glyphsTemplate The glyphs template.
* @param domainName If set, the URL domain must contain the specified
* string to be matched as canonical glyphs URL
* .
*
* @return TileServerOptions for chaining options together.
*/
TileServerOptions& withGlyphsTemplate(std::string glyphsTemplate,
std::string domainName,
std::optional<std::string> versionPrefix);
/**
* @brief Gets the previously set (or default) glyphs template.
*
* @return const std::string& glyphs template.
*/
const std::string& glyphsTemplate() const;
/**
* @brief Gets the previously set (or default) glyphs domain name.
*
* @return const std::string& domain name.
*/
const std::string& glyphsDomainName() const;
/**
* @brief Gets the previously set (or default) version prefix
*
* @return const optional<std::string>& version prefix.
*/
const std::optional<std::string>& glyphsVersionPrefix() const;
/**
* @brief Sets the template for tiles.
*
* @param tileTemplate The tile template.
* @param domainName If set, the URL domain must contain the specified
* string to be matched as canonical tile URL .
*
* @return TileServerOptions for chaining options together.
*/
TileServerOptions& withTileTemplate(std::string tileTemplate,
std::string domainName,
std::optional<std::string> versionPrefix);
/**
* @brief Gets the previously set (or default) tile template.
*
* @return const std::string& tile template.
*/
const std::string& tileTemplate() const;
/**
* @brief Gets the previously set (or default) tile domain name.
*
* @return const std::string& domain name.
*/
const std::string& tileDomainName() const;
/**
* @brief Gets the previously set (or default) version prefix
*
* @return const optional<std::string>& version prefix.
*/
const std::optional<std::string>& tileVersionPrefix() const;
/**
* @brief Sets the access token parameter name.
*
* @param apiKeyParameterName The parameter name.
* @return TileServerOptions for chaining options together.
*/
TileServerOptions& withApiKeyParameterName(std::string apiKeyParameterName);
/**
* @brief Gets the previously set (or default) apiKeyParameterName.
*
* @return const std::string& apiKeyParameterName.
*/
const std::string& apiKeyParameterName() const;
TileServerOptions& setRequiresApiKey(bool apiKeyRequired);
/**
* @brief Whether the tile server requires API key
*
* @return const bool true if API key is required
*/
bool requiresApiKey() const;
/**
* @brief Gets the default styles.
*/
const std::vector<mbgl::util::DefaultStyle> defaultStyles() const;
/**
* @brief Sets the collection default styles.
*
* @param styles The style set.
* @return TileServerOptions for chaining options together.
*/
TileServerOptions& withDefaultStyles(std::vector<mbgl::util::DefaultStyle> styles);
/**
* @brief Sets the default style by name. The style name must exist in
* defaultStyles collection
*
* @param defaultStyle The style name
* @return TileServerOptions for chaining options together.
*/
TileServerOptions& withDefaultStyle(std::string defaultStyle);
/**
* @brief Get the default style name
*/
const std::string& defaultStyle() const;
/**
* @brief Get the default configuration
*/
static TileServerOptions DefaultConfiguration();
/**
* @brief Get the tile server options configured for MapLibre.
*/
static TileServerOptions MapLibreConfiguration();
/**
* @brief Get the tile server options configured for Mapbox.
*/
static TileServerOptions MapboxConfiguration();
/**
* @brief Get the tile server options configured for MapTiler.
*/
static TileServerOptions MapTilerConfiguration();
private:
class Impl;
std::unique_ptr<Impl> impl_;
};
} // namespace mbgl