diff options
author | danswick <dan.swick@gmail.com> | 2019-09-18 11:39:43 -0700 |
---|---|---|
committer | danswick <dan.swick@gmail.com> | 2019-09-18 11:39:43 -0700 |
commit | 46914ecff8b3f2a1945b33358a879c2aac074f17 (patch) | |
tree | 697cf276a43ae4c18c0ad7029c00e7d771448822 /src/mbgl/tile/geometry_tile.cpp | |
parent | 47ea84ad1a5fed3431d026c5765c17c507d4623e (diff) | |
parent | 8805defe57aa0d8886c7828d39b1b9b1f17f21b8 (diff) | |
download | qtlocation-mapboxgl-upstream/android-docs-automation.tar.gz |
Merge branch 'master' into android-docs-automationupstream/android-docs-automation
Diffstat (limited to 'src/mbgl/tile/geometry_tile.cpp')
-rw-r--r-- | src/mbgl/tile/geometry_tile.cpp | 56 |
1 files changed, 38 insertions, 18 deletions
diff --git a/src/mbgl/tile/geometry_tile.cpp b/src/mbgl/tile/geometry_tile.cpp index 3087b4fc6a..9f9c41d229 100644 --- a/src/mbgl/tile/geometry_tile.cpp +++ b/src/mbgl/tile/geometry_tile.cpp @@ -302,14 +302,11 @@ float GeometryTile::getQueryPadding(const std::unordered_map<std::string, const return queryPadding; } -void GeometryTile::queryRenderedFeatures( - std::unordered_map<std::string, std::vector<Feature>>& result, - const GeometryCoordinates& queryGeometry, - const TransformState& transformState, - const std::unordered_map<std::string, const RenderLayer*>& layers, - const RenderedQueryOptions& options, - const mat4& projMatrix) { - +void GeometryTile::queryRenderedFeatures(std::unordered_map<std::string, std::vector<Feature>>& result, + const GeometryCoordinates& queryGeometry, const TransformState& transformState, + const std::unordered_map<std::string, const RenderLayer*>& layers, + const RenderedQueryOptions& options, const mat4& projMatrix, + const SourceFeatureState& featureState) { if (!getData()) return; const float queryPadding = getQueryPadding(layers); @@ -318,16 +315,10 @@ void GeometryTile::queryRenderedFeatures( transformState.matrixFor(posMatrix, id.toUnwrapped()); matrix::multiply(posMatrix, projMatrix, posMatrix); - layoutResult->featureIndex->query(result, - queryGeometry, - transformState, - posMatrix, - util::tileSize * id.overscaleFactor(), - std::pow(2, transformState.getZoom() - id.overscaledZ), - options, - id.toUnwrapped(), - layers, - queryPadding * transformState.maxPitchScaleFactor()); + layoutResult->featureIndex->query(result, queryGeometry, transformState, posMatrix, + util::tileSize * id.overscaleFactor(), + std::pow(2, transformState.getZoom() - id.overscaledZ), options, id.toUnwrapped(), + layers, queryPadding * transformState.maxPitchScaleFactor(), featureState); } void GeometryTile::querySourceFeatures( @@ -387,4 +378,33 @@ void GeometryTile::performedFadePlacement() { } } +void GeometryTile::setFeatureState(const LayerFeatureStates& states) { + auto layers = getData(); + if ((layers == nullptr) || states.empty() || !layoutResult) { + return; + } + + auto& layerIdToLayerRenderData = layoutResult->layerRenderData; + for (auto& layer : layerIdToLayerRenderData) { + const auto& layerID = layer.first; + const auto sourceLayer = layers->getLayer(layerID); + if (sourceLayer) { + const auto& sourceLayerID = sourceLayer->getName(); + auto entry = states.find(sourceLayerID); + if (entry == states.end()) { + continue; + } + const auto& featureStates = entry->second; + if (featureStates.empty()) { + continue; + } + + auto bucket = layer.second.bucket; + if (bucket && bucket->hasData()) { + bucket->update(featureStates, *sourceLayer, layerID, layoutResult->iconAtlas.patternPositions); + } + } + } +} + } // namespace mbgl |