summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJuha Alanen <juha.alanen@mapbox.com>2019-08-21 15:27:01 +0300
committerJuha Alanen <19551460+jmalanen@users.noreply.github.com>2019-09-18 14:29:15 +0300
commit1ac8e3c16145b4ec4ee341ad8d407f389575e52c (patch)
treed03ebae2aa2bf3b3c7ce4fc7c8538437501c52f0 /src
parent413278ca20de77f7025b5304493dca6d1863fbb3 (diff)
downloadqtlocation-mapboxgl-1ac8e3c16145b4ec4ee341ad8d407f389575e52c.tar.gz
[core] Add setFeatureState API to Tile classes
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/renderer/render_tile.cpp4
-rw-r--r--src/mbgl/renderer/render_tile.hpp3
-rw-r--r--src/mbgl/tile/geometry_tile.cpp23
-rw-r--r--src/mbgl/tile/geometry_tile.hpp2
-rw-r--r--src/mbgl/tile/tile.hpp4
5 files changed, 35 insertions, 1 deletions
diff --git a/src/mbgl/renderer/render_tile.cpp b/src/mbgl/renderer/render_tile.cpp
index 65a6cb9f30..0d63e5b265 100644
--- a/src/mbgl/renderer/render_tile.cpp
+++ b/src/mbgl/renderer/render_tile.cpp
@@ -227,4 +227,8 @@ void RenderTile::finishRender(PaintParameters& parameters) const {
}
}
+void RenderTile::setFeatureState(const LayerFeatureStates& states) {
+ tile.setFeatureState(states);
+}
+
} // namespace mbgl
diff --git a/src/mbgl/renderer/render_tile.hpp b/src/mbgl/renderer/render_tile.hpp
index 34d027cae5..483dbf7413 100644
--- a/src/mbgl/renderer/render_tile.hpp
+++ b/src/mbgl/renderer/render_tile.hpp
@@ -68,6 +68,9 @@ public:
style::TranslateAnchorType anchor,
const TransformState& state,
const bool inViewportPixelUnits) const;
+
+ void setFeatureState(const LayerFeatureStates&);
+
private:
Tile& tile;
// The following members are reset at placement stage.
diff --git a/src/mbgl/tile/geometry_tile.cpp b/src/mbgl/tile/geometry_tile.cpp
index 3087b4fc6a..8f624f21dc 100644
--- a/src/mbgl/tile/geometry_tile.cpp
+++ b/src/mbgl/tile/geometry_tile.cpp
@@ -387,4 +387,27 @@ void GeometryTile::performedFadePlacement() {
}
}
+void GeometryTile::setFeatureState(const LayerFeatureStates& states) {
+ auto layers = getData();
+ if (!layers || states.empty() || !layoutResult) return;
+
+ auto& layerIdToLayerRenderData = layoutResult->layerRenderData;
+ for (auto& layer : layerIdToLayerRenderData) {
+ const auto& layerID = layer.first;
+ const auto sourceLayer = layers->getLayer(layerID);
+ if (sourceLayer) {
+ const auto& sourceLayerID = sourceLayer->getName();
+ auto entry = states.find(sourceLayerID);
+ if (entry == states.end()) continue;
+ const auto& featureStates = entry->second;
+ if (featureStates.empty()) continue;
+
+ auto bucket = layer.second.bucket;
+ if (bucket && bucket->hasData()) {
+ bucket->update(featureStates, *sourceLayer, layerID, layoutResult->iconAtlas.patternPositions);
+ }
+ }
+ }
+}
+
} // namespace mbgl
diff --git a/src/mbgl/tile/geometry_tile.hpp b/src/mbgl/tile/geometry_tile.hpp
index 8682c8c76b..ca9e33218c 100644
--- a/src/mbgl/tile/geometry_tile.hpp
+++ b/src/mbgl/tile/geometry_tile.hpp
@@ -94,6 +94,8 @@ public:
const std::string sourceID;
+ void setFeatureState(const LayerFeatureStates&) override;
+
protected:
const GeometryTileData* getData() const;
LayerRenderData* getLayerRenderData(const style::Layer::Impl&);
diff --git a/src/mbgl/tile/tile.hpp b/src/mbgl/tile/tile.hpp
index 7a7d246aa6..65bff305a3 100644
--- a/src/mbgl/tile/tile.hpp
+++ b/src/mbgl/tile/tile.hpp
@@ -125,7 +125,9 @@ public:
// We hold onto a tile for two placements: fading starts with the first placement
// and will have time to finish by the second placement.
virtual void performedFadePlacement() {}
-
+
+ virtual void setFeatureState(const LayerFeatureStates&) {}
+
void dumpDebugLogs() const;
const Kind kind;