summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnsis Brammanis <ansis@mapbox.com>2018-03-30 16:28:05 -0400
committerAnsis Brammanis <ansis.brammanis@gmail.com>2018-04-26 18:03:17 -0400
commit0ca53ea5a83efcc44abbf1c2a4b3001001e6d14e (patch)
tree1aa0b18e04b2f0d44c3084fe18f850f2879959d0 /src
parentf86fe44dbd4de44c9fc8cb364521f966039289d7 (diff)
downloadqtlocation-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')
-rw-r--r--src/mbgl/geometry/feature_index.cpp12
-rw-r--r--src/mbgl/renderer/layers/render_circle_layer.cpp2
-rw-r--r--src/mbgl/tile/geometry_tile.cpp2
3 files changed, 11 insertions, 5 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;
}
diff --git a/src/mbgl/renderer/layers/render_circle_layer.cpp b/src/mbgl/renderer/layers/render_circle_layer.cpp
index 6e1c867a30..56fccfe071 100644
--- a/src/mbgl/renderer/layers/render_circle_layer.cpp
+++ b/src/mbgl/renderer/layers/render_circle_layer.cpp
@@ -131,7 +131,7 @@ bool RenderCircleLayer::queryIntersectsFeature(
auto stroke = evaluated.evaluate<style::CircleStrokeWidth>(zoom, feature);
auto size = radius + stroke;
- // For pitch-alignment: map, compare feature geometry to query geometry in the plane of the tile
+ // For pitch-alignment: map, compare feature geometry to query geometry in the plane of the tile
// Otherwise, compare geometry in the plane of the viewport
// A circle with fixed scaling relative to the viewport gets larger in tile space as it moves into the distance
// A circle with fixed scaling relative to the map gets smaller in viewport space as it moves into the distance
diff --git a/src/mbgl/tile/geometry_tile.cpp b/src/mbgl/tile/geometry_tile.cpp
index cb4b6aa39c..8efe12d54f 100644
--- a/src/mbgl/tile/geometry_tile.cpp
+++ b/src/mbgl/tile/geometry_tile.cpp
@@ -205,7 +205,7 @@ float GeometryTile::getQueryPadding(const std::vector<const RenderLayer*>& layer
float queryPadding = 0;
for (const RenderLayer* layer : layers) {
auto bucket = getBucket(*layer->baseImpl);
- if (bucket) {
+ if (bucket && bucket->hasData()) {
queryPadding = std::max(queryPadding, bucket->getQueryRadius(*layer));
}
}