1 | #pragma once |
2 | |
3 | #include <mbgl/util/range.hpp> |
4 | #include <mbgl/util/constants.hpp> |
5 | #include <mbgl/util/optional.hpp> |
6 | #include <mbgl/util/geo.hpp> |
7 | #include <tuple> |
8 | #include <vector> |
9 | #include <string> |
10 | #include <cstdint> |
11 | |
12 | namespace mbgl { |
13 | |
14 | class Tileset { |
15 | public: |
16 | enum class Scheme : bool { XYZ, TMS }; |
17 | enum class DEMEncoding : bool { Mapbox, Terrarium }; |
18 | |
19 | std::vector<std::string> tiles; |
20 | Range<uint8_t> zoomRange; |
21 | std::string attribution; |
22 | Scheme scheme; |
23 | // DEMEncoding is not supported by the TileJSON spec |
24 | DEMEncoding encoding; |
25 | optional<LatLngBounds> bounds; |
26 | |
27 | |
28 | Tileset(std::vector<std::string> tiles_ = std::vector<std::string>(), |
29 | Range<uint8_t> zoomRange_ = { 0, util::DEFAULT_MAX_ZOOM }, |
30 | std::string attribution_ = {}, |
31 | Scheme scheme_ = Scheme::XYZ, |
32 | DEMEncoding encoding_ = DEMEncoding::Mapbox) |
33 | : tiles(std::move(tiles_)), |
34 | zoomRange(std::move(zoomRange_)), |
35 | attribution(std::move(attribution_)), |
36 | scheme(scheme_), |
37 | encoding(encoding_), |
38 | bounds() {}; |
39 | |
40 | // TileJSON also includes center and zoom but they are not used by mbgl. |
41 | |
42 | friend bool operator==(const Tileset& lhs, const Tileset& rhs) { |
43 | return std::tie(args: lhs.tiles, args: lhs.zoomRange, args: lhs.attribution, args: lhs.scheme, args: lhs.bounds) |
44 | == std::tie(args: rhs.tiles, args: rhs.zoomRange, args: rhs.attribution, args: rhs.scheme, args: rhs.bounds); |
45 | } |
46 | |
47 | friend bool operator!=(const Tileset& lhs, const Tileset& rhs) { |
48 | return !(lhs == rhs); |
49 | } |
50 | }; |
51 | |
52 | } // namespace mbgl |
53 | |