From 18176605f65ce90c973e0b61a1a2b563471b0ba5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Mon, 15 Aug 2016 18:34:45 +0200 Subject: [core] support "scheme": "tms" in TileJSON files --- include/mbgl/storage/resource.hpp | 2 ++ include/mbgl/style/conversion/tileset.hpp | 8 ++++++++ include/mbgl/util/tileset.hpp | 3 +++ 3 files changed, 13 insertions(+) (limited to 'include/mbgl') diff --git a/include/mbgl/storage/resource.hpp b/include/mbgl/storage/resource.hpp index 31df069952..c05f40b65c 100644 --- a/include/mbgl/storage/resource.hpp +++ b/include/mbgl/storage/resource.hpp @@ -3,6 +3,7 @@ #include #include #include +#include #include @@ -47,6 +48,7 @@ public: int32_t x, int32_t y, int8_t z, + Tileset::Scheme scheme, Necessity = Required); static Resource glyphs(const std::string& urlTemplate, const FontStack& fontStack, diff --git a/include/mbgl/style/conversion/tileset.hpp b/include/mbgl/style/conversion/tileset.hpp index 46425597af..1955cc16cf 100644 --- a/include/mbgl/style/conversion/tileset.hpp +++ b/include/mbgl/style/conversion/tileset.hpp @@ -31,6 +31,14 @@ public: result.tiles.push_back(std::move(*urlTemplate)); } + auto schemeValue = objectMember(value, "scheme"); + if (schemeValue) { + optional scheme = toString(*schemeValue); + if (scheme && *scheme == "tms") { + result.scheme = Tileset::Scheme::TMS; + } + } + auto minzoomValue = objectMember(value, "minzoom"); if (minzoomValue) { optional minzoom = toNumber(*minzoomValue); diff --git a/include/mbgl/util/tileset.hpp b/include/mbgl/util/tileset.hpp index 8a7fbe9b73..1f28a5039a 100644 --- a/include/mbgl/util/tileset.hpp +++ b/include/mbgl/util/tileset.hpp @@ -10,9 +10,12 @@ namespace mbgl { class Tileset { public: + enum class Scheme : bool { XYZ, TMS }; + std::vector tiles; Range zoomRange { 0, 22 }; std::string attribution; + Scheme scheme = Scheme::XYZ; // TileJSON also includes center, zoom, and bounds, but they are not used by mbgl. }; -- cgit v1.2.1