summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2014-11-26 17:58:23 +0100
committerKonstantin Käfer <mail@kkaefer.com>2014-11-26 17:58:23 +0100
commit1f067f1e9dfca44722b79815997bc6886b65b18c (patch)
tree21458ff230874cc526bea1db726501161794ddad /src
parent84551d93490071a970ef4aace7935097a8effc2e (diff)
downloadqtlocation-mapboxgl-1f067f1e9dfca44722b79815997bc6886b65b18c.tar.gz
add {prefix} to tile URL replacement token scheme
prefix is a 2 character hex code derived from the tile x/y
Diffstat (limited to 'src')
-rw-r--r--src/map/tile_data.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/map/tile_data.cpp b/src/map/tile_data.cpp
index 9ff694bf3a..0a59bdc62b 100644
--- a/src/map/tile_data.cpp
+++ b/src/map/tile_data.cpp
@@ -37,6 +37,12 @@ void TileData::request(FileSource& fileSource) {
if (token == "z") return std::to_string(id.z);
if (token == "x") return std::to_string(id.x);
if (token == "y") return std::to_string(id.y);
+ if (token == "prefix") {
+ std::string prefix { 2 };
+ prefix[0] = "0123456789abcdef"[id.x % 16];
+ prefix[1] = "0123456789abcdef"[id.y % 16];
+ return prefix;
+ }
if (token == "ratio") return (map.getState().getPixelRatio() > 1.0 ? "@2x" : "");
return "";
});