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 Tileset(std::vector<std::string> tiles_=std::vector<std::string> (),Range<uint8_t> zoomRange_={ 0, util::DEFAULT_MAX_ZOOM },std::string attribution_={},Scheme scheme_=Scheme::XYZ,DEMEncoding encoding_=DEMEncoding::Mapbox)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 operator ==(const Tileset & lhs,const Tileset & rhs)42 friend bool operator==(const Tileset& lhs, const Tileset& rhs) { 43 return std::tie(lhs.tiles, lhs.zoomRange, lhs.attribution, lhs.scheme, lhs.bounds) 44 == std::tie(rhs.tiles, rhs.zoomRange, rhs.attribution, rhs.scheme, rhs.bounds); 45 } 46 operator !=(const Tileset & lhs,const Tileset & rhs)47 friend bool operator!=(const Tileset& lhs, const Tileset& rhs) { 48 return !(lhs == rhs); 49 } 50 }; 51 52 } // namespace mbgl 53