[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,10 +28,15 @@ 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);
|
||||||
|
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++),
|
grid.insert(IndexedSubfeature(index, sourceLayerName, bucketName, sortIndex++),
|
||||||
{convertPoint<float>(envelope.min), convertPoint<float>(envelope.max)});
|
{convertPoint<float>(envelope.min), convertPoint<float>(envelope.max)});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void FeatureIndex::query(
|
void FeatureIndex::query(
|
||||||
std::unordered_map<std::string, std::vector<Feature>>& result,
|
std::unordered_map<std::string, std::vector<Feature>>& result,
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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