-
Notifications
You must be signed in to change notification settings - Fork 1.3k
CollisionTile::queryRenderedSymbols should receive the query geometry #6627
CollisionTile::queryRenderedSymbols should receive the query geometry #6627
Conversation
@brunoabinader, thanks for your PR! By analyzing the history of the files in this pull request, we identified @jfirebaugh, @ansis and @kkaefer to be potential reviewers. |
std::unordered_map<std::string, std::unordered_set<std::size_t>> sourceLayerFeatures; | ||
|
||
auto anchor = util::matrixMultiply(rotationMatrix, convertPoint<float>(box.min)); | ||
mapbox::geometry::box<float> box { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be more clearly expressed as a rotating transform (using a for loop, std::transform
, or a geometry.hpp specific version) followed by mapbox::geometry::envelope
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Intuit was to avoid traversing through the geometries twice - first for transforming each point, and then later for obtaining the bounding box. However, I acknowledge the need for readability in complex code like this, so doing as suggested.
@@ -153,12 +155,27 @@ Box CollisionTile::getTreeBox(const Point<float>& anchor, const CollisionBox& bo | |||
}; | |||
} | |||
|
|||
std::vector<IndexedSubfeature> CollisionTile::queryRenderedSymbols(const mapbox::geometry::box<int16_t>& box, const float scale) { | |||
std::vector<IndexedSubfeature> CollisionTile::queryRenderedSymbols(const GeometryCollection& queryGeometry, const float scale) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can simplify the parameter here, and various other places, to const GeometryCoordinates& queryGeometry
. There's no need to support multipolygon query geometries: d7a816d.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I perceived this too, though didn't wanted to change behavior - good to know 👍
cc1192a
to
5f524bc
Compare
Addressed @jfirebaugh review comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good; CI failures need investigation of course.
83d8653
to
c956030
Compare
This provides a means of testing cases where an updated geometry tile would return wrong results for `queryRenderedFeatures`.
This gives the ability to pan and/or rotate the map in a posterior step after initial render for testing purposes.
c956030
to
7dbc302
Compare
Render test failures were caused by rebasing the newly-added query tests |
As per @ansis comments in #6055: