diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2016-03-03 00:35:05 +0200 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2016-03-03 00:38:21 +0200 |
commit | fd123de8ad060441cdd318091531653df4cbcc79 (patch) | |
tree | 329aa90e3985706ae18945fc06cddffce8f1af1b /include/mbgl/util/geo.hpp | |
parent | 2b0749e3c6a4e87b6ad4a9978b1be93f1d57fc21 (diff) | |
download | qtlocation-mapboxgl-fd123de8ad060441cdd318091531653df4cbcc79.tar.gz |
[core] Regression fix in LatLng::unwrapForShortestPath
When porting this from Transform::unwrapLatLng, I forgot to check for
the second alternative.
Fixes #4174.
Diffstat (limited to 'include/mbgl/util/geo.hpp')
-rw-r--r-- | include/mbgl/util/geo.hpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/include/mbgl/util/geo.hpp b/include/mbgl/util/geo.hpp index 755abeda21..56d575ceaa 100644 --- a/include/mbgl/util/geo.hpp +++ b/include/mbgl/util/geo.hpp @@ -33,7 +33,11 @@ public: coordinate so that interpolating between the two endpoints will cross it. */ void unwrapForShortestPath(const LatLng& start) { if (std::abs(start.longitude) + std::abs(longitude) > util::LONGITUDE_MAX) { - longitude += (start.longitude > 0 && longitude < 0) ? util::DEGREES_MAX : -util::DEGREES_MAX; + if (start.longitude > 0 && longitude < 0) { + longitude += util::DEGREES_MAX; + } else if (start.longitude < 0 && longitude > 0) { + longitude -= util::DEGREES_MAX; + } } } |