diff options
author | Chris Loer <chris.loer@gmail.com> | 2018-04-02 17:41:55 -0700 |
---|---|---|
committer | Ansis Brammanis <ansis.brammanis@gmail.com> | 2018-04-26 18:03:17 -0400 |
commit | f86fe44dbd4de44c9fc8cb364521f966039289d7 (patch) | |
tree | 5fa9b4dd9b039640407c5ede97a4d7b94a25c230 /src/mbgl/geometry | |
parent | f7d20a587199ccee42469ecea2299ae73bfaae49 (diff) | |
download | qtlocation-mapboxgl-f86fe44dbd4de44c9fc8cb364521f966039289d7.tar.gz |
[core] fix circle querying for scale and alignment
This fixes circle querying for cases where either
circle-pitch-alignment=map
or
circle-pitch-scaling=viewport
Diffstat (limited to 'src/mbgl/geometry')
-rw-r--r-- | src/mbgl/geometry/feature_index.cpp | 14 | ||||
-rw-r--r-- | src/mbgl/geometry/feature_index.hpp | 10 |
2 files changed, 15 insertions, 9 deletions
diff --git a/src/mbgl/geometry/feature_index.cpp b/src/mbgl/geometry/feature_index.cpp index 728996a2eb..e7759b0868 100644 --- a/src/mbgl/geometry/feature_index.cpp +++ b/src/mbgl/geometry/feature_index.cpp @@ -36,7 +36,8 @@ void FeatureIndex::insert(const GeometryCollection& geometries, void FeatureIndex::query( std::unordered_map<std::string, std::vector<Feature>>& result, const GeometryCoordinates& queryGeometry, - const float bearing, + const TransformState& transformState, + const mat4& posMatrix, const double tileSize, const double scale, const RenderedQueryOptions& queryOptions, @@ -68,7 +69,7 @@ void FeatureIndex::query( if (indexedFeature.sortIndex == previousSortIndex) continue; previousSortIndex = indexedFeature.sortIndex; - addFeature(result, indexedFeature, queryOptions, tileID.canonical, layers, queryGeometry, bearing, pixelsToTileUnits); + addFeature(result, indexedFeature, queryOptions, tileID.canonical, layers, queryGeometry, transformState, pixelsToTileUnits, posMatrix); } } @@ -105,7 +106,7 @@ std::unordered_map<std::string, std::vector<Feature>> FeatureIndex::lookupSymbol }); for (const auto& symbolFeature : sortedFeatures) { - addFeature(result, symbolFeature, queryOptions, tileID.canonical, layers, GeometryCoordinates(), 0, 0); + addFeature(result, symbolFeature, queryOptions, tileID.canonical, layers, GeometryCoordinates(), {}, 0, {}); } return result; } @@ -117,8 +118,9 @@ void FeatureIndex::addFeature( const CanonicalTileID& tileID, const std::vector<const RenderLayer*>& layers, const GeometryCoordinates& queryGeometry, - const float bearing, - const float pixelsToTileUnits) const { + const TransformState& transformState, + const float pixelsToTileUnits, + const mat4& posMatrix) const { auto getRenderLayer = [&] (const std::string& layerID) -> const RenderLayer* { for (const auto& layer : layers) { @@ -148,7 +150,7 @@ void FeatureIndex::addFeature( } if (!renderLayer->is<RenderSymbolLayer>() && - !renderLayer->queryIntersectsFeature(queryGeometry, *geometryTileFeature, tileID.z, bearing, pixelsToTileUnits)) { + !renderLayer->queryIntersectsFeature(queryGeometry, *geometryTileFeature, tileID.z, transformState, pixelsToTileUnits, posMatrix)) { continue; } diff --git a/src/mbgl/geometry/feature_index.hpp b/src/mbgl/geometry/feature_index.hpp index f105260c0c..cc91791d36 100644 --- a/src/mbgl/geometry/feature_index.hpp +++ b/src/mbgl/geometry/feature_index.hpp @@ -5,6 +5,7 @@ #include <mbgl/tile/tile_id.hpp> #include <mbgl/util/grid_index.hpp> #include <mbgl/util/feature.hpp> +#include <mbgl/util/mat4.hpp> #include <vector> #include <string> @@ -14,6 +15,7 @@ namespace mbgl { class RenderedQueryOptions; class RenderLayer; +class TransformState; class CollisionIndex; @@ -56,7 +58,8 @@ public: void query( std::unordered_map<std::string, std::vector<Feature>>& result, const GeometryCoordinates& queryGeometry, - const float bearing, + const TransformState&, + const mat4& posMatrix, const double tileSize, const double scale, const RenderedQueryOptions& options, @@ -88,8 +91,9 @@ private: const CanonicalTileID&, const std::vector<const RenderLayer*>&, const GeometryCoordinates& queryGeometry, - const float bearing, - const float pixelsToTileUnits) const; + const TransformState& transformState, + const float pixelsToTileUnits, + const mat4& posMatrix) const; GridIndex<IndexedSubfeature> grid; unsigned int sortIndex = 0; |