[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.
(cherry picked from commit 0ca53ea)
This commit is contained in:
committed by
Łukasz Paczos
parent
9616c408a5
commit
90f6c531f3
@@ -27,8 +27,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)});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +110,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;
|
||||
}
|
||||
|
||||
@@ -146,7 +146,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
|
||||
|
||||
@@ -204,7 +204,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));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user