diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-07-17 15:52:39 -0700 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-07-17 15:52:39 -0700 |
commit | 9ed0ca59832ed59ea8f391a8e1db1c6b9406b453 (patch) | |
tree | f9360ef8da3fc9c015eaf6e773be13e64f8b10ac /src/map/tile_data.cpp | |
parent | 3141b8b1f744f414da28d73a1a695e113a3d06f2 (diff) | |
download | qtlocation-mapboxgl-9ed0ca59832ed59ea8f391a8e1db1c6b9406b453.tar.gz |
pass SourceInfo object to TileData so that we can not skip buckets that appear later than the source maxzoom
Diffstat (limited to 'src/map/tile_data.cpp')
-rw-r--r-- | src/map/tile_data.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/map/tile_data.cpp b/src/map/tile_data.cpp index 82f8fdedfc..556a2e6079 100644 --- a/src/map/tile_data.cpp +++ b/src/map/tile_data.cpp @@ -1,15 +1,23 @@ #include <mbgl/map/tile_data.hpp> #include <mbgl/map/map.hpp> +#include <mbgl/util/token.hpp> #include <mbgl/util/string.hpp> using namespace mbgl; -TileData::TileData(Tile::ID id, Map &map, const std::string url) +TileData::TileData(Tile::ID id, Map &map, const SourceInfo &source) : id(id), state(State::initial), map(map), - url(url), + source(source), + url(util::replaceTokens(source.url, [&](const std::string &token) -> std::string { + 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 == "ratio") return (map.getState().getPixelRatio() > 1.0 ? "@2x" : ""); + return ""; + })), debugBucket(debugFontBuffer) { // Initialize tile debug coordinates const std::string str = util::sprintf<32>("%d/%d/%d", id.z, id.x, id.y); |