summaryrefslogtreecommitdiff
path: root/src/mbgl/tile
diff options
context:
space:
mode:
authorAlexander Shalamov <alexander.shalamov@mapbox.com>2019-06-17 15:04:10 +0300
committerAlexander Shalamov <alexander.shalamov@mapbox.com>2019-07-09 11:43:46 +0300
commit57402314e1be3180ce6f67d8ba29c17aceba6b60 (patch)
treeefe5a01b6a2ced775726c0407528230166365a71 /src/mbgl/tile
parentd6c1c838eb0c612aa971740fc58cc2a2e1086f77 (diff)
downloadqtlocation-mapboxgl-57402314e1be3180ce6f67d8ba29c17aceba6b60.tar.gz
[core] Improve performance for query rendered features
- query rendered symbols only from layers that support it - remove unnecessary iterations over vectors
Diffstat (limited to 'src/mbgl/tile')
-rw-r--r--src/mbgl/tile/geometry_tile.cpp10
-rw-r--r--src/mbgl/tile/geometry_tile.hpp4
-rw-r--r--src/mbgl/tile/tile.cpp4
-rw-r--r--src/mbgl/tile/tile.hpp4
4 files changed, 11 insertions, 11 deletions
diff --git a/src/mbgl/tile/geometry_tile.cpp b/src/mbgl/tile/geometry_tile.cpp
index e87d21503a..7f1bed49f4 100644
--- a/src/mbgl/tile/geometry_tile.cpp
+++ b/src/mbgl/tile/geometry_tile.cpp
@@ -291,12 +291,12 @@ LayerRenderData* GeometryTile::getLayerRenderData(const style::Layer::Impl& laye
return layoutResult ? layoutResult->getLayerRenderData(layerImpl) : nullptr;
}
-float GeometryTile::getQueryPadding(const std::vector<const RenderLayer*>& layers) {
+float GeometryTile::getQueryPadding(const std::unordered_map<std::string, const RenderLayer*>& layers) {
float queryPadding = 0;
- for (const RenderLayer* layer : layers) {
- const LayerRenderData* data = getLayerRenderData(*layer->baseImpl);
+ for (const auto& pair : layers) {
+ const LayerRenderData* data = getLayerRenderData(*pair.second->baseImpl);
if (data && data->bucket && data->bucket->hasData()) {
- queryPadding = std::max(queryPadding, data->bucket->getQueryRadius(*layer));
+ queryPadding = std::max(queryPadding, data->bucket->getQueryRadius(*pair.second));
}
}
return queryPadding;
@@ -306,7 +306,7 @@ 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 std::unordered_map<std::string, const RenderLayer*>& layers,
const RenderedQueryOptions& options,
const mat4& projMatrix) {
diff --git a/src/mbgl/tile/geometry_tile.hpp b/src/mbgl/tile/geometry_tile.hpp
index 3d75dfc456..7c46edfc1d 100644
--- a/src/mbgl/tile/geometry_tile.hpp
+++ b/src/mbgl/tile/geometry_tile.hpp
@@ -52,7 +52,7 @@ public:
std::unordered_map<std::string, std::vector<Feature>>& result,
const GeometryCoordinates& queryGeometry,
const TransformState&,
- const std::vector<const RenderLayer*>& layers,
+ const std::unordered_map<std::string, const RenderLayer*>& layers,
const RenderedQueryOptions& options,
const mat4& projMatrix) override;
@@ -60,7 +60,7 @@ public:
std::vector<Feature>& result,
const SourceQueryOptions&) override;
- float getQueryPadding(const std::vector<const RenderLayer*>&) override;
+ float getQueryPadding(const std::unordered_map<std::string, const RenderLayer*>&) override;
void cancel() override;
diff --git a/src/mbgl/tile/tile.cpp b/src/mbgl/tile/tile.cpp
index 5e31898caf..2f342c092d 100644
--- a/src/mbgl/tile/tile.cpp
+++ b/src/mbgl/tile/tile.cpp
@@ -43,11 +43,11 @@ void Tile::queryRenderedFeatures(
std::unordered_map<std::string, std::vector<Feature>>&,
const GeometryCoordinates&,
const TransformState&,
- const std::vector<const RenderLayer*>&,
+ const std::unordered_map<std::string, const RenderLayer*>&,
const RenderedQueryOptions&,
const mat4&) {}
-float Tile::getQueryPadding(const std::vector<const RenderLayer*>&) {
+float Tile::getQueryPadding(const std::unordered_map<std::string, const RenderLayer*>&) {
return 0;
}
diff --git a/src/mbgl/tile/tile.hpp b/src/mbgl/tile/tile.hpp
index 4ba8bc1160..7a7d246aa6 100644
--- a/src/mbgl/tile/tile.hpp
+++ b/src/mbgl/tile/tile.hpp
@@ -71,7 +71,7 @@ public:
std::unordered_map<std::string, std::vector<Feature>>& result,
const GeometryCoordinates& queryGeometry,
const TransformState&,
- const std::vector<const RenderLayer*>&,
+ const std::unordered_map<std::string, const RenderLayer*>&,
const RenderedQueryOptions& options,
const mat4& projMatrix);
@@ -79,7 +79,7 @@ public:
std::vector<Feature>& result,
const SourceQueryOptions&);
- virtual float getQueryPadding(const std::vector<const RenderLayer*>&);
+ virtual float getQueryPadding(const std::unordered_map<std::string, const RenderLayer*>&);
void setTriedCache();