-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Conversation
ef5d4ca
to
04012e4
Compare
src/mbgl/geometry/feature_index.cpp
Outdated
for (const auto& ring : geometries) { | ||
auto envelope = mapbox::geometry::envelope(ring); | ||
if (envelope.min.x < util::EXTENT && | ||
envelope.min.y < util::EXTENT && | ||
envelope.max.x >= 0 && | ||
envelope.max.y >= 0) { | ||
grid.insert(IndexedSubfeature(index, sourceLayerName, bucketLeaderID, featureSortIndex++), | ||
grid.insert(IndexedSubfeature(index, sourceLayerName, bucketLeaderID, sortIndex++), |
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.
Why it is important to change approach (featureSortIndex -> sortIndex change) for other than polygon features - was the removed code 04012e4#diff-c7acc1b0aee2a0628aac4613e46fa727L74 used only for polygons?
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.
AFAIK the logic for keeping the same sorting index makes sense for polygon features only, @ansis could you confirm on that?
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.
It looks like there's a unit test missing here.
04012e4
to
9d48747
Compare
The latest patch is different from the initial version: after offline talk to @ansis decided to follow a safer approach and still add geometries for inner rings to the grid and just keep the same sort id for them. |
9d48747
to
d44373c
Compare
Thanks for adding changelog entries, @pozdnyakov! Whoops, this did make |
The bug was caused by an issue with the
sortIndex
calculation, i.e. after a polygon geometry was added to the feature index, its inner rings happened to have the same sort indexes as the features added at the next calls |=> the features added after the polygon were dropped from thequery()
result.Fixes #14722