[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.
This commit is contained in:
committed by
Ansis Brammanis
parent
f86fe44dbd
commit
0ca53ea5a8
@@ -28,8 +28,13 @@ void FeatureIndex::insert(const GeometryCollection& geometries,
|
|||||||
const std::string& bucketName) {
|
const std::string& bucketName) {
|
||||||
for (const auto& ring : geometries) {
|
for (const auto& ring : geometries) {
|
||||||
auto envelope = mapbox::geometry::envelope(ring);
|
auto envelope = mapbox::geometry::envelope(ring);
|
||||||
grid.insert(IndexedSubfeature(index, sourceLayerName, bucketName, sortIndex++),
|
if (envelope.min.x < util::EXTENT &&
|
||||||
{convertPoint<float>(envelope.min), convertPoint<float>(envelope.max)});
|
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) {
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ bool RenderCircleLayer::queryIntersectsFeature(
|
|||||||
auto stroke = evaluated.evaluate<style::CircleStrokeWidth>(zoom, feature);
|
auto stroke = evaluated.evaluate<style::CircleStrokeWidth>(zoom, feature);
|
||||||
auto size = radius + stroke;
|
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
|
// 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 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
|
// A circle with fixed scaling relative to the map gets smaller in viewport space as it moves into the distance
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ float GeometryTile::getQueryPadding(const std::vector<const RenderLayer*>& layer
|
|||||||
float queryPadding = 0;
|
float queryPadding = 0;
|
||||||
for (const RenderLayer* layer : layers) {
|
for (const RenderLayer* layer : layers) {
|
||||||
auto bucket = getBucket(*layer->baseImpl);
|
auto bucket = getBucket(*layer->baseImpl);
|
||||||
if (bucket) {
|
if (bucket && bucket->hasData()) {
|
||||||
queryPadding = std::max(queryPadding, bucket->getQueryRadius(*layer));
|
queryPadding = std::max(queryPadding, bucket->getQueryRadius(*layer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user