[core, node] Re-implement "avoid edges" behavior for MapMode::Tile

- Fixes issue #12461.
 - Only implement "avoid edges" in MapMode::Tile since it's no longer relevant in Static or Continuous mode.
 - New: Force "avoid edges" to "true" for line labels, since in tile mode they'll always clip poorly at tile boundaries.
 - Remove unused "withinPlus0/inside" logic.
This commit is contained in:
Chris Loer
2018-07-30 15:22:28 -07:00
committed by Chris Loer
parent bded6c65d5
commit b0fcca5879
4 changed files with 59 additions and 40 deletions

View File

@@ -110,6 +110,13 @@ void Placement::placeLayerBucket(
auto partiallyEvaluatedTextSize = bucket.textSizeBinder->evaluateForZoom(state.getZoom());
auto partiallyEvaluatedIconSize = bucket.iconSizeBinder->evaluateForZoom(state.getZoom());
optional<CollisionTileBoundaries> avoidEdges;
if (mapMode == MapMode::Tile &&
(bucket.layout.get<style::SymbolAvoidEdges>() ||
bucket.layout.get<style::SymbolPlacement>() == style::SymbolPlacementType::Line)) {
avoidEdges = collisionIndex.projectTileBoundaries(posMatrix);
}
for (auto& symbolInstance : bucket.symbolInstances) {
if (seenCrossTileIDs.count(symbolInstance.crossTileID) == 0) {
@@ -133,7 +140,7 @@ void Placement::placeLayerBucket(
placedSymbol, scale, fontSize,
bucket.layout.get<style::TextAllowOverlap>(),
bucket.layout.get<style::TextPitchAlignment>() == style::AlignmentType::Map,
showCollisionBoxes);
showCollisionBoxes, avoidEdges);
placeText = placed.first;
offscreen &= placed.second;
}
@@ -147,7 +154,7 @@ void Placement::placeLayerBucket(
placedSymbol, scale, fontSize,
bucket.layout.get<style::IconAllowOverlap>(),
bucket.layout.get<style::IconPitchAlignment>() == style::AlignmentType::Map,
showCollisionBoxes);
showCollisionBoxes, avoidEdges);
placeIcon = placed.first;
offscreen &= placed.second;
}