summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvo van Dongen <info@ivovandongen.nl>2016-08-30 10:46:37 +0200
committerIvo van Dongen <info@ivovandongen.nl>2016-08-30 10:46:37 +0200
commitf9f6e353779d6893d0e3745fb9dd1f3257b804ea (patch)
tree0eee5110e2e9223bb424551ed088b3d6b195e0cd
parent1a88c0d17d6e8a7065ee164678b4dfcf4ad823b2 (diff)
downloadqtlocation-mapboxgl-upstream/ivovandongen-6055.tar.gz
[core] #6055 - naive attempt to rotate query boxupstream/ivovandongen-6055
-rw-r--r--src/mbgl/text/collision_tile.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/mbgl/text/collision_tile.cpp b/src/mbgl/text/collision_tile.cpp
index 982dff1688..272d8834b9 100644
--- a/src/mbgl/text/collision_tile.cpp
+++ b/src/mbgl/text/collision_tile.cpp
@@ -159,8 +159,23 @@ std::vector<IndexedSubfeature> CollisionTile::queryRenderedSymbols(const mapbox:
std::unordered_map<std::string, std::set<std::size_t>> sourceLayerFeatures;
auto anchor = util::matrixMultiply(rotationMatrix, convertPoint<float>(box.min));
- 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));
+
+ const Point<float> tl = { 0, 0 };
+ const Point<float> tr = { float(box.max.x - box.min.x), 0 };
+ const Point<float> bl = { 0, float(box.max.y - box.min.y) };
+ const Point<float> br = { float(box.max.x - box.min.x), float(box.max.y - box.min.y) };
+ const Point<float> rtl = util::matrixMultiply(rotationMatrix, tl);
+ const Point<float> rtr = util::matrixMultiply(rotationMatrix, tr);
+ const Point<float> rbl = util::matrixMultiply(rotationMatrix, bl);
+ const Point<float> rbr = util::matrixMultiply(rotationMatrix, br);
+ CollisionBox queryBox(anchor,
+ ::fmin(::fmin(rtl.x, rtr.x), ::fmin(rbl.x, rbr.x)),
+ ::fmin(::fmin(rtl.y, rtr.y), ::fmin(rbl.y, rbr.y)),
+ ::fmax(::fmax(rtl.x, rtr.x), ::fmax(rbl.x, rbr.x)),
+ ::fmax(::fmax(rtl.y, rtr.y), ::fmax(rbl.y, rbr.y)),
+ scale);
+ Box treeBox = getTreeBox(anchor, queryBox);
+ auto predicates = bgi::intersects(treeBox);
auto fn = [&] (const Tree& tree_) {
for (auto it = tree_.qbegin(predicates); it != tree_.qend(); ++it) {