summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortobrun <tobrun.van.nuland@gmail.com>2019-02-07 15:36:21 +0100
committertobrun <tobrun.van.nuland@gmail.com>2019-02-07 15:55:32 +0100
commitb1ed80775dc729818326f63aaa0442b7bed8261c (patch)
treeb134439d3367020904b21f4c4307d2d704d39de7
parent007393abdcc65d52b64eb44dae2ed0eac0c57fb1 (diff)
downloadqtlocation-mapboxgl-upstream/tvn-bounds-across-idl.tar.gz
[core] - add optional limit maximum degreesupstream/tvn-bounds-across-idl
-rw-r--r--include/mbgl/util/geo.hpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/mbgl/util/geo.hpp b/include/mbgl/util/geo.hpp
index 033114f8c2..6e626d6d8a 100644
--- a/include/mbgl/util/geo.hpp
+++ b/include/mbgl/util/geo.hpp
@@ -59,9 +59,9 @@ public:
// If the distance from start to end longitudes is between half and full
// world, unwrap the start longitude to ensure the shortest path is taken.
- void unwrapForShortestPath(const LatLng& end) {
+ void unwrapForShortestPath(const LatLng& end, bool limitMaxDegrees = true) {
const double delta = std::abs(end.lon - lon);
- if (delta <= util::LONGITUDE_MAX) return;
+ if (delta <= util::LONGITUDE_MAX || (limitMaxDegrees && delta >= util::DEGREES_MAX)) return;
if (lon > 0 && end.lon < 0) lon -= util::DEGREES_MAX;
else if (lon < 0 && end.lon > 0) lon += util::DEGREES_MAX;
}
@@ -133,7 +133,7 @@ public:
}
LatLng latLng = p;
if (crossesAntimeridian()) {
- latLng.unwrapForShortestPath(ne);
+ latLng.unwrapForShortestPath(ne, false);
}
return LatLng {
util::clamp(latLng.latitude(), sw.latitude(), ne.latitude()),