diff options
author | Juha Alanen <juha.alanen@mapbox.com> | 2019-08-21 15:27:01 +0300 |
---|---|---|
committer | Juha Alanen <19551460+jmalanen@users.noreply.github.com> | 2019-09-18 14:29:15 +0300 |
commit | 1ac8e3c16145b4ec4ee341ad8d407f389575e52c (patch) | |
tree | d03ebae2aa2bf3b3c7ce4fc7c8538437501c52f0 /src/mbgl/tile | |
parent | 413278ca20de77f7025b5304493dca6d1863fbb3 (diff) | |
download | qtlocation-mapboxgl-1ac8e3c16145b4ec4ee341ad8d407f389575e52c.tar.gz |
[core] Add setFeatureState API to Tile classes
Diffstat (limited to 'src/mbgl/tile')
-rw-r--r-- | src/mbgl/tile/geometry_tile.cpp | 23 | ||||
-rw-r--r-- | src/mbgl/tile/geometry_tile.hpp | 2 | ||||
-rw-r--r-- | src/mbgl/tile/tile.hpp | 4 |
3 files changed, 28 insertions, 1 deletions
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; |