diff options
author | Ansis Brammanis <ansis@mapbox.com> | 2018-03-30 16:28:05 -0400 |
---|---|---|
committer | Ansis Brammanis <ansis.brammanis@gmail.com> | 2018-04-26 18:03:17 -0400 |
commit | 0ca53ea5a83efcc44abbf1c2a4b3001001e6d14e (patch) | |
tree | 1aa0b18e04b2f0d44c3084fe18f850f2879959d0 /src/mbgl/geometry | |
parent | f86fe44dbd4de44c9fc8cb364521f966039289d7 (diff) | |
download | qtlocation-mapboxgl-0ca53ea5a83efcc44abbf1c2a4b3001001e6d14e.tar.gz |
[core] only index features within tile boundaries
Previously we relied on tile buffers for querying features who's
rendered representations cross tile boundaries. Now we query multiple
tiles making it unnecessary to index features that are completely
outside a tile's boundaries.
Diffstat (limited to 'src/mbgl/geometry')
-rw-r--r-- | src/mbgl/geometry/feature_index.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/mbgl/geometry/feature_index.cpp b/src/mbgl/geometry/feature_index.cpp index e7759b0868..520fd313a2 100644 --- a/src/mbgl/geometry/feature_index.cpp +++ b/src/mbgl/geometry/feature_index.cpp @@ -28,8 +28,13 @@ void FeatureIndex::insert(const GeometryCollection& geometries, const std::string& bucketName) { for (const auto& ring : geometries) { auto envelope = mapbox::geometry::envelope(ring); - grid.insert(IndexedSubfeature(index, sourceLayerName, bucketName, sortIndex++), - {convertPoint<float>(envelope.min), convertPoint<float>(envelope.max)}); + if (envelope.min.x < util::EXTENT && + envelope.min.y < util::EXTENT && + envelope.max.x >= 0 && + envelope.max.y >= 0) { + grid.insert(IndexedSubfeature(index, sourceLayerName, bucketName, sortIndex++), + {convertPoint<float>(envelope.min), convertPoint<float>(envelope.max)}); + } } } @@ -106,7 +111,8 @@ std::unordered_map<std::string, std::vector<Feature>> FeatureIndex::lookupSymbol }); for (const auto& symbolFeature : sortedFeatures) { - addFeature(result, symbolFeature, queryOptions, tileID.canonical, layers, GeometryCoordinates(), {}, 0, {}); + mat4 unusedMatrix; + addFeature(result, symbolFeature, queryOptions, tileID.canonical, layers, GeometryCoordinates(), {}, 0, unusedMatrix); } return result; } |