summaryrefslogtreecommitdiff
path: root/src/mbgl/geometry/feature_index.cpp
diff options
context:
space:
mode:
authorChris Loer <chris.loer@gmail.com>2017-10-31 14:46:33 -0700
committerChris Loer <chris.loer@mapbox.com>2017-11-01 10:49:07 -0700
commit56c34e6b9c89efa37cd6d8eb763eae5451672ab6 (patch)
treee12773ac932f7c7f68acc2363dc7b4bbcbc34919 /src/mbgl/geometry/feature_index.cpp
parentfd606bbad3cbf876692b5646afdcce89e9847a61 (diff)
downloadqtlocation-mapboxgl-56c34e6b9c89efa37cd6d8eb763eae5451672ab6.tar.gz
GridIndex: add separate "query" method that doesn't return bounding boxes, for use by unit test and FeatureIndex.
Also: fix a bug that would cause results to be duplicated for query boxes that completely contained the index.
Diffstat (limited to 'src/mbgl/geometry/feature_index.cpp')
-rw-r--r--src/mbgl/geometry/feature_index.cpp8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/mbgl/geometry/feature_index.cpp b/src/mbgl/geometry/feature_index.cpp
index 5ddba511df..1d80c055b0 100644
--- a/src/mbgl/geometry/feature_index.cpp
+++ b/src/mbgl/geometry/feature_index.cpp
@@ -61,15 +61,9 @@ void FeatureIndex::query(
// Query the grid index
mapbox::geometry::box<int16_t> box = mapbox::geometry::envelope(queryGeometry);
- typedef std::pair<IndexedSubfeature, GridIndex<IndexedSubfeature>::BBox> QueryResult;
- std::vector<QueryResult> queryResults = grid.query({ convertPoint<float>(box.min - additionalRadius),
+ std::vector<IndexedSubfeature> features = grid.query({ convertPoint<float>(box.min - additionalRadius),
convertPoint<float>(box.max + additionalRadius) });
- // TODO: clumsy way to discard this data
- std::vector<IndexedSubfeature> features;
- for (auto& queryResult : queryResults) {
- features.push_back(queryResult.first);
- }
std::sort(features.begin(), features.end(), topDown);
size_t previousSortIndex = std::numeric_limits<size_t>::max();