From 1f067f1e9dfca44722b79815997bc6886b65b18c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Wed, 26 Nov 2014 17:58:23 +0100 Subject: [PATCH] add {prefix} to tile URL replacement token scheme prefix is a 2 character hex code derived from the tile x/y --- src/map/tile_data.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/map/tile_data.cpp b/src/map/tile_data.cpp index 9ff694bf3..0a59bdc62 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 ""; });