diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-01-22 19:18:25 -0800 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-01-29 14:50:15 -0800 |
commit | 849e8b32b4b2febc63ad3df8539b483ccc67ac63 (patch) | |
tree | 46909ab1caca2baab375ad2ac4bbec6faeda04dd /src/mbgl/map/raster_tile_data.cpp | |
parent | 4dc7ec02020e0c9856eb60ff06b2a70372e44324 (diff) | |
download | qtlocation-mapboxgl-849e8b32b4b2febc63ad3df8539b483ccc67ac63.tar.gz |
[core] Ensure that FileSource has access to tile URL, pixelRatio, x, y, z
Diffstat (limited to 'src/mbgl/map/raster_tile_data.cpp')
-rw-r--r-- | src/mbgl/map/raster_tile_data.cpp | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/src/mbgl/map/raster_tile_data.cpp b/src/mbgl/map/raster_tile_data.cpp index 92ffb451b0..fa0bd298b1 100644 --- a/src/mbgl/map/raster_tile_data.cpp +++ b/src/mbgl/map/raster_tile_data.cpp @@ -5,27 +5,35 @@ #include <mbgl/storage/file_source.hpp> #include <mbgl/util/worker.hpp> #include <mbgl/util/work_request.hpp> +#include <mbgl/util/url.hpp> using namespace mbgl; RasterTileData::RasterTileData(const TileID& id_, + float pixelRatio, + const std::string& urlTemplate, TexturePool &texturePool_, - Worker& worker_) + Worker& worker_, + const std::function<void(std::exception_ptr)>& callback) : TileData(id_), texturePool(texturePool_), worker(worker_) { -} + state = State::loading; -RasterTileData::~RasterTileData() { - cancel(); -} + Resource resource { + Resource::Kind::Tile, + util::templateTileURL(urlTemplate, id, pixelRatio) + }; -void RasterTileData::request(const std::string& url, - const RasterTileData::Callback& callback) { - state = State::loading; + resource.tileData = Resource::TileData { + urlTemplate, + pixelRatio, + id.x, + id.y, + id.z + }; - FileSource* fs = util::ThreadContext::getFileSource(); - req = fs->request({ Resource::Kind::Tile, url }, [url, callback, this](Response res) { + req = util::ThreadContext::getFileSource()->request(resource, [callback, this](Response res) { if (res.error) { std::exception_ptr error; if (res.error->reason == Response::Error::Reason::NotFound) { @@ -76,6 +84,10 @@ void RasterTileData::request(const std::string& url, }); } +RasterTileData::~RasterTileData() { + cancel(); +} + Bucket* RasterTileData::getBucket(StyleLayer const&) { return bucket.get(); } |