[core] Port global symbol query from GL JS:

- Symbol querying is now global instead of per-tile
 - Symbols that bleed over tile boundaries no longer missed in queries
 - Symbol results now sorted based on rendering order (ie overlapping symbols change their sort order when a bearing change causes their render order to change)
 - Placement::retainedQueryData now responsible for maintaining symbol querying data for buckets that may no longer be in the TilePyramid.
This commit is contained in:
Chris Loer
2018-04-18 16:33:37 -07:00
committed by Chris Loer
parent ed4538bb30
commit 661b4e0558
35 changed files with 219 additions and 196 deletions

View File

@@ -132,7 +132,7 @@ void GeometryTile::onLayout(LayoutResult result, const uint64_t resultCorrelatio
buckets = std::move(result.buckets);
featureIndexPendingCommit = { std::move(result.featureIndex) };
latestFeatureIndex = std::move(result.featureIndex);
if (result.glyphAtlasImage) {
glyphAtlasImage = std::move(*result.glyphAtlasImage);
@@ -200,22 +200,12 @@ Bucket* GeometryTile::getBucket(const Layer::Impl& layer) const {
return it->second.get();
}
void GeometryTile::commitFeatureIndex() {
// We commit our pending FeatureIndex when a global placement has run,
// synchronizing the global CollisionIndex with the latest buckets/FeatureIndex
if (featureIndexPendingCommit) {
featureIndex = std::move(*featureIndexPendingCommit);
featureIndexPendingCommit = nullopt;
}
}
void GeometryTile::queryRenderedFeatures(
std::unordered_map<std::string, std::vector<Feature>>& result,
const GeometryCoordinates& queryGeometry,
const TransformState& transformState,
const std::vector<const RenderLayer*>& layers,
const RenderedQueryOptions& options,
const CollisionIndex& collisionIndex) {
const RenderedQueryOptions& options) {
if (!getData()) return;
@@ -228,17 +218,15 @@ void GeometryTile::queryRenderedFeatures(
}
}
featureIndex->query(result,
queryGeometry,
transformState.getAngle(),
util::tileSize * id.overscaleFactor(),
std::pow(2, transformState.getZoom() - id.overscaledZ),
options,
id.toUnwrapped(),
sourceID,
layers,
collisionIndex,
additionalRadius);
latestFeatureIndex->query(result,
queryGeometry,
transformState.getAngle(),
util::tileSize * id.overscaleFactor(),
std::pow(2, transformState.getZoom() - id.overscaledZ),
options,
id.toUnwrapped(),
layers,
additionalRadius);
}
void GeometryTile::querySourceFeatures(