diff options
Diffstat (limited to 'src/mbgl/text')
-rw-r--r-- | src/mbgl/text/placement.cpp | 45 | ||||
-rw-r--r-- | src/mbgl/text/placement.hpp | 4 |
2 files changed, 15 insertions, 34 deletions
diff --git a/src/mbgl/text/placement.cpp b/src/mbgl/text/placement.cpp index 0b888211b6..8a6b21717c 100644 --- a/src/mbgl/text/placement.cpp +++ b/src/mbgl/text/placement.cpp @@ -72,27 +72,17 @@ Placement::Placement(const TransformState& state_, MapMode mapMode_, style::Tran } } -void Placement::placeLayer(const RenderLayerSymbolInterface& symbolInterface, const mat4& projMatrix, bool showCollisionBoxes) { +void Placement::placeLayer(const RenderLayer& layer, const mat4& projMatrix, bool showCollisionBoxes) { std::unordered_set<uint32_t> seenCrossTileIDs; - for (const RenderTile& renderTile : symbolInterface.getRenderTiles()) { - assert(renderTile.tile.isRenderable()); + for (const auto& item : layer.getPlacementData()) { + RenderTile& renderTile = item.tile; assert(renderTile.tile.kind == Tile::Kind::Geometry); auto& geometryTile = static_cast<GeometryTile&>(renderTile.tile); - auto bucket = symbolInterface.getSymbolBucket(renderTile); - if (!bucket) { - continue; - } - SymbolBucket& symbolBucket = *bucket; - - if (symbolBucket.bucketLeaderID != symbolInterface.layerID()) { - // Only place this layer if it's the "group leader" for the bucket - continue; - } - - auto& layout = symbolBucket.layout; + Bucket& bucket = item.bucket; + auto& symbolBucket = static_cast<SymbolBucket&>(bucket); const float pixelsToTileUnits = renderTile.id.pixelsToTileUnits(1, state.getZoom()); @@ -104,14 +94,14 @@ void Placement::placeLayer(const RenderLayerSymbolInterface& symbolInterface, co matrix::multiply(posMatrix, projMatrix, posMatrix); mat4 textLabelPlaneMatrix = getLabelPlaneMatrix(posMatrix, - layout.get<style::TextPitchAlignment>() == style::AlignmentType::Map, - layout.get<style::TextRotationAlignment>() == style::AlignmentType::Map, + item.pitchWithMap, + item.rotateWithMap, state, pixelsToTileUnits); mat4 iconLabelPlaneMatrix = getLabelPlaneMatrix(posMatrix, - layout.get<style::IconPitchAlignment>() == style::AlignmentType::Map, - layout.get<style::IconRotationAlignment>() == style::AlignmentType::Map, + item.pitchWithMap, + item.rotateWithMap, state, pixelsToTileUnits); @@ -406,21 +396,12 @@ void Placement::commit(TimePoint now) { fadeStartTime = placementChanged ? commitTime : prevPlacement->fadeStartTime; } -void Placement::updateLayerOpacities(const RenderLayerSymbolInterface& symbolInterface) { +void Placement::updateLayerOpacities(const RenderLayer& layer) { std::set<uint32_t> seenCrossTileIDs; - for (const RenderTile& renderTile : symbolInterface.getRenderTiles()) { - assert(renderTile.tile.isRenderable()); + for (const auto& item : layer.getPlacementData()) { + Bucket& bucket = item.bucket; + auto& symbolBucket = static_cast<SymbolBucket&>(bucket); - auto bucket = symbolInterface.getSymbolBucket(renderTile); - if (!bucket) { - continue; - } - SymbolBucket& symbolBucket = *bucket; - - if (symbolBucket.bucketLeaderID != symbolInterface.layerID()) { - // Only update opacities this layer if it's the "group leader" for the bucket - continue; - } updateBucketOpacities(symbolBucket, seenCrossTileIDs); } } diff --git a/src/mbgl/text/placement.hpp b/src/mbgl/text/placement.hpp index 10ed642c4e..96af27a89e 100644 --- a/src/mbgl/text/placement.hpp +++ b/src/mbgl/text/placement.hpp @@ -92,9 +92,9 @@ private: class Placement { public: Placement(const TransformState&, MapMode, style::TransitionOptions, const bool crossSourceCollisions, std::unique_ptr<Placement> prevPlacementOrNull = nullptr); - void placeLayer(const RenderLayerSymbolInterface&, const mat4&, bool showCollisionBoxes); + void placeLayer(const RenderLayer&, const mat4&, bool showCollisionBoxes); void commit(TimePoint); - void updateLayerOpacities(const RenderLayerSymbolInterface&); + void updateLayerOpacities(const RenderLayer&); float symbolFadeChange(TimePoint now) const; bool hasTransitions(TimePoint now) const; |