[core] Add setFeatureState API to Tile classes
This commit is contained in:
@@ -227,4 +227,8 @@ void RenderTile::finishRender(PaintParameters& parameters) const {
|
||||
}
|
||||
}
|
||||
|
||||
void RenderTile::setFeatureState(const LayerFeatureStates& states) {
|
||||
tile.setFeatureState(states);
|
||||
}
|
||||
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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&);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user