diff options
author | Asheem Mamoowala <asheem.mamoowala@mapbox.com> | 2018-01-05 06:35:31 -0800 |
---|---|---|
committer | Asheem Mamoowala <asheem.mamoowala@mapbox.com> | 2018-02-08 12:39:30 -0800 |
commit | 64374711a09f27c41c93eb6b72d0f6a560234083 (patch) | |
tree | c96aece37da9d5a17dc6029bb89d1e6047a2eac6 /include/mbgl/util/tileset.hpp | |
parent | aeba621573d77e1ce4f72b1e9b39bde92bf174a2 (diff) | |
download | qtlocation-mapboxgl-64374711a09f27c41c93eb6b72d0f6a560234083.tar.gz |
Support TileJSON bounds property (#10701)
* [core] Parse TileJSON bounds property
* [core] Add TileRange and LatLngBounds::contains(CanonicalTileID)
Move LatLngBounds::contains impl to cpp file
* [core] Skip tile creation outside of tileset bounds
* [core] Fix TileRange for wrapped bounds and use for CustomTileLoader instead of LatLngBounds comparisons for tiles.
Diffstat (limited to 'include/mbgl/util/tileset.hpp')
-rw-r--r-- | include/mbgl/util/tileset.hpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/include/mbgl/util/tileset.hpp b/include/mbgl/util/tileset.hpp index 61aa47d4ea..7bef0e89ed 100644 --- a/include/mbgl/util/tileset.hpp +++ b/include/mbgl/util/tileset.hpp @@ -2,7 +2,9 @@ #include <mbgl/util/range.hpp> #include <mbgl/util/constants.hpp> - +#include <mbgl/util/optional.hpp> +#include <mbgl/util/geo.hpp> +#include <tuple> #include <vector> #include <string> #include <cstdint> @@ -17,6 +19,7 @@ public: Range<uint8_t> zoomRange; std::string attribution; Scheme scheme; + optional<LatLngBounds> bounds; Tileset(std::vector<std::string> tiles_ = std::vector<std::string>(), Range<uint8_t> zoomRange_ = { 0, util::DEFAULT_MAX_ZOOM }, @@ -25,13 +28,14 @@ public: : tiles(std::move(tiles_)), zoomRange(std::move(zoomRange_)), attribution(std::move(attribution_)), - scheme(scheme_) {} + scheme(scheme_), + bounds() {} - // TileJSON also includes center, zoom, and bounds, but they are not used by mbgl. + // TileJSON also includes center and zoom but they are not used by mbgl. friend bool operator==(const Tileset& lhs, const Tileset& rhs) { - return std::tie(lhs.tiles, lhs.zoomRange, lhs.attribution, lhs.scheme) - == std::tie(rhs.tiles, rhs.zoomRange, rhs.attribution, rhs.scheme); + return std::tie(lhs.tiles, lhs.zoomRange, lhs.attribution, lhs.scheme, lhs.bounds) + == std::tie(rhs.tiles, rhs.zoomRange, rhs.attribution, rhs.scheme, rhs.bounds); } }; |