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/util | |
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/util')
-rw-r--r-- | src/mbgl/util/intersection_tests.cpp | 9 | ||||
-rw-r--r-- | src/mbgl/util/intersection_tests.hpp | 1 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/mbgl/util/intersection_tests.cpp b/src/mbgl/util/intersection_tests.cpp index e6ce245c0e..780fce98f9 100644 --- a/src/mbgl/util/intersection_tests.cpp +++ b/src/mbgl/util/intersection_tests.cpp @@ -82,11 +82,16 @@ bool lineIntersectsBufferedLine(const GeometryCoordinates& lineA, const Geometry return false; } +bool polygonIntersectsBufferedPoint(const GeometryCoordinates& polygon, const GeometryCoordinate& point, float radius) { + if (polygonContainsPoint(polygon, point)) return true; + if (pointIntersectsBufferedLine(point, polygon, radius)) return true; + return false; +} + bool polygonIntersectsBufferedMultiPoint(const GeometryCoordinates& polygon, const GeometryCollection& rings, float radius) { for (auto& ring : rings) { for (auto& point : ring) { - if (polygonContainsPoint(polygon, point)) return true; - if (pointIntersectsBufferedLine(point, polygon, radius)) return true; + if (polygonIntersectsBufferedPoint(polygon, point, radius)) return true; } } return false; diff --git a/src/mbgl/util/intersection_tests.hpp b/src/mbgl/util/intersection_tests.hpp index 5bcb29c767..c105fe4dd0 100644 --- a/src/mbgl/util/intersection_tests.hpp +++ b/src/mbgl/util/intersection_tests.hpp @@ -9,6 +9,7 @@ bool polygonIntersectsBufferedMultiPoint(const GeometryCoordinates&, const Geome bool polygonIntersectsBufferedMultiLine(const GeometryCoordinates&, const GeometryCollection&, float radius); bool polygonIntersectsPolygon(const GeometryCoordinates&, const GeometryCoordinates&); bool polygonIntersectsMultiPolygon(const GeometryCoordinates&, const GeometryCollection&); +bool polygonIntersectsBufferedPoint(const GeometryCoordinates& polygon, const GeometryCoordinate& point, float radius); } // namespace util } // namespace mbgl |