Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[core][tile mode] Fix assertion at line-center placement handling #16293

Merged
merged 2 commits into from
Mar 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@

Resources that belong to an offline region, should not contribute to the amount of space available in the ambient cache.

- [core][tile mode] Fix assertion at `line-center` placement handling ([#16293](https://github.com/mapbox/mapbox-gl-native/pull/16293))

The `Symbol Intersects Tile Edges` placement algorithm should not be applied to the symbols with `line-center` placement.

### 🧩 Architectural changes

- Changes to `MapSnapshotter` threading model ([#16268](https://github.com/mapbox/mapbox-gl-native/pull/16268))
Expand Down
14 changes: 8 additions & 6 deletions src/mbgl/text/placement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,12 @@ void Placement::placeSymbolBucket(const BucketPlacementData& params, std::set<ui

optional<CollisionBoundaries> tileBorders;
optional<CollisionBoundaries> avoidEdges;
if (mapMode == MapMode::Tile) tileBorders = collisionIndex.projectTileBoundaries(posMatrix);

if (tileBorders && (layout.get<style::SymbolAvoidEdges>() ||
layout.get<style::SymbolPlacement>() == style::SymbolPlacementType::Line)) {
avoidEdges = tileBorders;
if (mapMode == MapMode::Tile) {
tileBorders = collisionIndex.projectTileBoundaries(posMatrix);
if (layout.get<style::SymbolAvoidEdges>() ||
layout.get<style::SymbolPlacement>() == style::SymbolPlacementType::Line) {
avoidEdges = tileBorders;
}
}

const bool textAllowOverlap = layout.get<style::TextAllowOverlap>();
Expand Down Expand Up @@ -559,7 +560,8 @@ void Placement::placeSymbolBucket(const BucketPlacementData& params, std::set<ui
for (auto it = sortedSymbols.rbegin(); it != sortedSymbols.rend(); ++it) {
placeSymbol(*it);
}
} else if (mapMode == MapMode::Tile && !avoidEdges) {
} else if (mapMode == MapMode::Tile && !avoidEdges &&
layout.get<style::SymbolPlacement>() == style::SymbolPlacementType::Point) {
// In this case we first try to place symbols, which intersects the tile borders, so that
// those symbols will remain even if each tile is handled independently.
SymbolInstanceReferences symbolInstances = bucket.getSymbols(params.sortKeyRange);
Expand Down