diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2015-06-18 18:33:29 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2015-07-01 16:12:12 -0700 |
commit | c0af683f2eaa8963103721284dbf0a08b3d10f77 (patch) | |
tree | 556559dd233ebfdbf0977216e1f4e37d4ff7878f /src | |
parent | fc64e97bce3e082b0396e68bd6493457defe4ec7 (diff) | |
download | qtlocation-mapboxgl-c0af683f2eaa8963103721284dbf0a08b3d10f77.tar.gz |
Reapply style layer copy technique
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/map/tile_worker.cpp | 8 | ||||
-rw-r--r-- | src/mbgl/map/tile_worker.hpp | 7 | ||||
-rw-r--r-- | src/mbgl/map/vector_tile_data.cpp | 3 |
3 files changed, 13 insertions, 5 deletions
diff --git a/src/mbgl/map/tile_worker.cpp b/src/mbgl/map/tile_worker.cpp index b69698689a..790a34cf5c 100644 --- a/src/mbgl/map/tile_worker.cpp +++ b/src/mbgl/map/tile_worker.cpp @@ -13,10 +13,12 @@ using namespace mbgl; TileWorker::TileWorker(const TileID& id_, Style& style_, + std::vector<util::ptr<StyleLayer>> layers_, const uint16_t maxZoom_, const std::atomic<TileData::State>& state_, std::unique_ptr<CollisionTile> collision_) - : style(style_), + : layers(std::move(layers_)), + style(style_), id(id_), maxZoom(maxZoom_), state(state_), @@ -48,7 +50,7 @@ size_t TileWorker::countBuckets() const { TileParseResult TileWorker::parse(const GeometryTile& geometryTile) { partialParse = false; - for (const auto& layer : style.layers) { + for (const auto& layer : layers) { parseLayer(*layer, geometryTile); } @@ -58,7 +60,7 @@ TileParseResult TileWorker::parse(const GeometryTile& geometryTile) { void TileWorker::redoPlacement(float angle, bool collisionDebug) { collision->reset(angle, 0); collision->setDebug(collisionDebug); - for (const auto& layer_desc : style.layers) { + for (const auto& layer_desc : layers) { auto bucket = getBucket(*layer_desc); if (bucket) { bucket->placeFeatures(); diff --git a/src/mbgl/map/tile_worker.hpp b/src/mbgl/map/tile_worker.hpp index 7fb474a5ee..d8c8aa3e00 100644 --- a/src/mbgl/map/tile_worker.hpp +++ b/src/mbgl/map/tile_worker.hpp @@ -7,6 +7,7 @@ #include <mbgl/geometry/fill_buffer.hpp> #include <mbgl/geometry/line_buffer.hpp> #include <mbgl/util/noncopyable.hpp> +#include <mbgl/util/ptr.hpp> #include <mbgl/style/filter_expression.hpp> #include <string> @@ -20,6 +21,7 @@ class CollisionTile; class GeometryTile; class Style; class Bucket; +class StyleLayer; class StyleBucket; class GeometryTileLayer; @@ -31,6 +33,7 @@ class TileWorker : public util::noncopyable { public: TileWorker(const TileID&, Style&, + std::vector<util::ptr<StyleLayer>>, const uint16_t maxZoom, const std::atomic<TileData::State>&, std::unique_ptr<CollisionTile>); @@ -42,7 +45,7 @@ public: TileParseResult parse(const GeometryTile&); void redoPlacement(float angle, bool collisionDebug); - Style& style; + std::vector<util::ptr<StyleLayer>> layers; private: void parseLayer(const StyleLayer&, const GeometryTile&); @@ -54,6 +57,8 @@ private: template <class Bucket> void addBucketGeometries(Bucket&, const GeometryTileLayer&, const FilterExpression&); + Style& style; + const TileID id; const uint16_t maxZoom; const std::atomic<TileData::State>& state; diff --git a/src/mbgl/map/vector_tile_data.cpp b/src/mbgl/map/vector_tile_data.cpp index 9b04ab371a..04ef339c43 100644 --- a/src/mbgl/map/vector_tile_data.cpp +++ b/src/mbgl/map/vector_tile_data.cpp @@ -21,6 +21,7 @@ VectorTileData::VectorTileData(const TileID& id_, worker(style_.workers), tileWorker(id_, style_, + style_.layers, source_.max_zoom, state, std::make_unique<CollisionTile>(id_.z, 4096, @@ -115,7 +116,7 @@ void VectorTileData::redoPlacement(float angle, bool collisionDebug) { currentCollisionDebug = collisionDebug; workRequest = worker.redoPlacement(tileWorker, angle, collisionDebug, [this] { - for (const auto& layer : tileWorker.style.layers) { + for (const auto& layer : tileWorker.layers) { auto bucket = getBucket(*layer); if (bucket) { bucket->swapRenderData(); |