summaryrefslogtreecommitdiff
path: root/include/mbgl
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-08-15 18:34:45 +0200
committerKonstantin Käfer <mail@kkaefer.com>2016-08-16 11:04:30 +0200
commit18176605f65ce90c973e0b61a1a2b563471b0ba5 (patch)
tree4570f3dd8d213c96e4591c5d989d427120f16fb6 /include/mbgl
parentc34130ac6d968a3ff636af71e19893d22c2faa99 (diff)
downloadqtlocation-mapboxgl-18176605f65ce90c973e0b61a1a2b563471b0ba5.tar.gz
[core] support "scheme": "tms" in TileJSON files
Diffstat (limited to 'include/mbgl')
-rw-r--r--include/mbgl/storage/resource.hpp2
-rw-r--r--include/mbgl/style/conversion/tileset.hpp8
-rw-r--r--include/mbgl/util/tileset.hpp3
3 files changed, 13 insertions, 0 deletions
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 <mbgl/storage/response.hpp>
#include <mbgl/util/optional.hpp>
#include <mbgl/util/font_stack.hpp>
+#include <mbgl/util/tileset.hpp>
#include <string>
@@ -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<std::string> scheme = toString(*schemeValue);
+ if (scheme && *scheme == "tms") {
+ result.scheme = Tileset::Scheme::TMS;
+ }
+ }
+
auto minzoomValue = objectMember(value, "minzoom");
if (minzoomValue) {
optional<float> 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<std::string> tiles;
Range<uint8_t> zoomRange { 0, 22 };
std::string attribution;
+ Scheme scheme = Scheme::XYZ;
// TileJSON also includes center, zoom, and bounds, but they are not used by mbgl.
};