diff options
author | Ansis Brammanis <ansis@mapbox.com> | 2017-10-27 13:13:07 -0400 |
---|---|---|
committer | Chris Loer <chris.loer@gmail.com> | 2017-10-31 10:25:57 -0700 |
commit | 7d41c0255625c316a833a0f4b3e97896bd101775 (patch) | |
tree | 7cd6183f43055b2f5a0f8d5bacb61886d183adf7 | |
parent | 2fd2c2d37ca5e13018cb033f81aa1e4f899659a4 (diff) | |
download | qtlocation-mapboxgl-7d41c0255625c316a833a0f4b3e97896bd101775.tar.gz |
fix collisions in overscaled tiles [skip ci]
-rw-r--r-- | src/mbgl/text/placement.cpp | 8 | ||||
-rw-r--r-- | src/mbgl/text/placement.hpp | 1 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/mbgl/text/placement.cpp b/src/mbgl/text/placement.cpp index 5fe2b1afe6..fa277b2b8b 100644 --- a/src/mbgl/text/placement.cpp +++ b/src/mbgl/text/placement.cpp @@ -51,6 +51,8 @@ void Placement::placeLayer(RenderSymbolLayer& symbolLayer, const mat4& projMatri const float scale = std::pow(2, state.getZoom() - renderTile.id.canonical.z); + const float pixelRatio = util::EXTENT / (util::tileSize * renderTile.tile.id.overscaleFactor()); + mat4 posMatrix; state.matrixFor(posMatrix, renderTile.id); matrix::multiply(posMatrix, projMatrix, posMatrix); @@ -67,7 +69,7 @@ void Placement::placeLayer(RenderSymbolLayer& symbolLayer, const mat4& projMatri state, pixelsToTileUnits); - placeLayerBucket(symbolBucket, posMatrix, textLabelPlaneMatrix, iconLabelPlaneMatrix, scale, showCollisionBoxes); + placeLayerBucket(symbolBucket, posMatrix, textLabelPlaneMatrix, iconLabelPlaneMatrix, scale, pixelRatio, showCollisionBoxes); } } @@ -77,6 +79,7 @@ void Placement::placeLayerBucket( const mat4& textLabelPlaneMatrix, const mat4& iconLabelPlaneMatrix, const float scale, + const float pixelRatio, const bool showCollisionBoxes) { // TODO collision debug array clearing @@ -86,7 +89,6 @@ void Placement::placeLayerBucket( const bool iconWithoutText = !bucket.hasTextData() || bucket.layout.get<TextOptional>(); const bool textWithoutIcon = !bucket.hasIconData() || bucket.layout.get<IconOptional>(); - float pixelRatio = util::EXTENT / util::tileSize; for (auto& symbolInstance : bucket.symbolInstances) { @@ -108,7 +110,7 @@ void Placement::placeLayerBucket( placeText = collisionIndex.placeFeature(symbolInstance.textCollisionFeature, posMatrix, textLabelPlaneMatrix, pixelRatio, - placedSymbol,scale, fontSize, + placedSymbol, scale, fontSize, bucket.layout.get<TextAllowOverlap>(), bucket.layout.get<TextPitchAlignment>() == style::AlignmentType::Map, showCollisionBoxes); diff --git a/src/mbgl/text/placement.hpp b/src/mbgl/text/placement.hpp index c694e8ef98..9802ad546b 100644 --- a/src/mbgl/text/placement.hpp +++ b/src/mbgl/text/placement.hpp @@ -54,6 +54,7 @@ namespace mbgl { const mat4& textLabelPlaneMatrix, const mat4& iconLabelPlaneMatrix, const float scale, + const float pixelRatio, const bool showCollisionBoxes); void updateBucketOpacities(SymbolBucket&); |