summaryrefslogtreecommitdiff
path: root/src/mbgl/util/mapbox.cpp
diff options
context:
space:
mode:
authorYoung Hahn <young@mapbox.com>2016-02-02 04:29:27 -0500
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-02-11 11:28:35 -0800
commit43c44eccdc56c50e41e8efbe5f7a34b57eed756f (patch)
tree65d39c01c1e3281a8d292049029fffa75e912cbc /src/mbgl/util/mapbox.cpp
parent7ca602b7394160a472f143a13f9ee2b725098e51 (diff)
downloadqtlocation-mapboxgl-43c44eccdc56c50e41e8efbe5f7a34b57eed756f.tar.gz
Allow using tileSize: 512 as a switch to trade retina support for 512px raster tiles
Diffstat (limited to 'src/mbgl/util/mapbox.cpp')
-rw-r--r--src/mbgl/util/mapbox.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/mbgl/util/mapbox.cpp b/src/mbgl/util/mapbox.cpp
index 93b2b8521c..7ee0f279b6 100644
--- a/src/mbgl/util/mapbox.cpp
+++ b/src/mbgl/util/mapbox.cpp
@@ -119,7 +119,7 @@ std::string normalizeTileURL(const std::string& url, const std::string& accessTo
return baseURL + "v4/" + url.substr(sizeof("mapbox://tiles/") - 1) + "?access_token=" + accessToken;
}
-std::string canonicalizeTileURL(const std::string& url, SourceType type) {
+std::string canonicalizeTileURL(const std::string& url, SourceType type, uint16_t tileSize) {
auto tilesetStartIdx = url.find("/v4/");
if (tilesetStartIdx == std::string::npos) {
return url;
@@ -159,8 +159,14 @@ std::string canonicalizeTileURL(const std::string& url, SourceType type) {
}
#endif // !defined(__ANDROID__) && !defined(__APPLE__)
- return "mapbox://tiles/" + tileset + "/{z}/{x}/{y}" +
- (type == SourceType::Raster ? "{ratio}" : "") + "." + extension;
+ std::string result = "mapbox://tiles/" + tileset + "/{z}/{x}/{y}";
+
+ if (type == SourceType::Raster) {
+ result += tileSize == 512 ? "@2x" : "{ratio}";
+ }
+
+ result += "." + extension;
+ return result;
}
} // end namespace mapbox