[core] Regression fix in LatLng::unwrapForShortestPath

When porting this from Transform::unwrapLatLng, I forgot to check for
the second alternative.

Fixes #4174.
This commit is contained in:
Bruno de Oliveira Abinader
2016-03-03 00:35:05 +02:00
parent 2b0749e3c6
commit fd123de8ad

View File

@@ -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;
}
}
}