summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2016-10-07 13:44:28 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2016-10-11 09:55:32 +0300
commit22b7436acf3162b13aad1e9eb31eb91d794ac5fd (patch)
tree7902bd5e1866484062dc9bf27a3df20ee7df41e8 /src
parentabdf7b1199af0a190a5f9e0c2f670b97975210a3 (diff)
downloadqtlocation-mapboxgl-22b7436acf3162b13aad1e9eb31eb91d794ac5fd.tar.gz
[core] Skip placement scale for features that ignore placement
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/text/collision_tile.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/mbgl/text/collision_tile.cpp b/src/mbgl/text/collision_tile.cpp
index 32a1a5474a..84c3f87a76 100644
--- a/src/mbgl/text/collision_tile.cpp
+++ b/src/mbgl/text/collision_tile.cpp
@@ -20,7 +20,6 @@ CollisionTile::CollisionTile(PlacementConfig config_) : config(std::move(config_
// bottom
CollisionBox(Point<float>(0, util::EXTENT), -infinity, 0, infinity, 0, infinity),
}}) {
- tree.clear();
// Compute the transformation matrix.
const float angle_sin = std::sin(config.angle);
@@ -162,25 +161,32 @@ std::vector<IndexedSubfeature> CollisionTile::queryRenderedSymbols(const mapbox:
CollisionBox queryBox(anchor, 0, 0, box.max.x - box.min.x, box.max.y - box.min.y, scale);
auto predicates = bgi::intersects(getTreeBox(anchor, queryBox));
- auto fn = [&] (const Tree& tree_) {
+ auto fn = [&] (const Tree& tree_, bool ignorePlacement) {
for (auto it = tree_.qbegin(predicates); it != tree_.qend(); ++it) {
const CollisionBox& blocking = std::get<1>(*it);
const IndexedSubfeature& indexedFeature = std::get<2>(*it);
auto& seenFeatures = sourceLayerFeatures[indexedFeature.sourceLayerName];
if (seenFeatures.find(indexedFeature.index) == seenFeatures.end()) {
- auto blockingAnchor = util::matrixMultiply(rotationMatrix, blocking.anchor);
- float minPlacementScale = findPlacementScale(minScale, anchor, queryBox, blockingAnchor, blocking);
- if (minPlacementScale >= scale) {
+ if (ignorePlacement) {
seenFeatures.insert(indexedFeature.index);
result.push_back(indexedFeature);
+ } else {
+ auto blockingAnchor = util::matrixMultiply(rotationMatrix, blocking.anchor);
+ float minPlacementScale = findPlacementScale(minScale, anchor, queryBox, blockingAnchor, blocking);
+ if (minPlacementScale >= scale) {
+ seenFeatures.insert(indexedFeature.index);
+ result.push_back(indexedFeature);
+ }
}
}
}
};
- fn(tree);
- fn(ignoredTree);
+ bool ignorePlacement = false;
+ fn(tree, ignorePlacement);
+ ignorePlacement = true;
+ fn(ignoredTree, ignorePlacement);
return result;
}