summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-10-22 12:51:15 (GMT)
committerFriedrich W. H. Kossebau <kossebau@kde.org>2016-11-05 16:47:11 (GMT)
commite697a6824a516d584272df7be3381cb26a41512a (patch)
treeca5ded65a17d5c6dd3b10bc04f63d7f439059631
parent4dd642a49e3b9fd725b433485d0b9a5916858c07 (diff)
Simplify bounds check
-rw-r--r--src/lib/marble/projections/MercatorProjection.cpp22
1 files changed, 4 insertions, 18 deletions
diff --git a/src/lib/marble/projections/MercatorProjection.cpp b/src/lib/marble/projections/MercatorProjection.cpp
index 3091cd2..72beb86 100644
--- a/src/lib/marble/projections/MercatorProjection.cpp
+++ b/src/lib/marble/projections/MercatorProjection.cpp
@@ -71,25 +71,11 @@ bool MercatorProjection::screenCoordinates( const GeoDataCoordinates &geopoint,
{
globeHidesPoint = false;
qreal lon;
- qreal lat;
+ qreal originalLat;
- geopoint.geoCoordinates( lon, lat );
-
- const bool isLatValid = minLat() <= lat && lat <= maxLat();
-
- if (!isLatValid) {
- if ( lat > maxLat() ) {
- GeoDataCoordinates approxCoords( geopoint );
- approxCoords.setLatitude( maxLat() );
- approxCoords.geoCoordinates( lon, lat );
- }
-
- if ( lat < minLat() ) {
- GeoDataCoordinates approxCoords( geopoint );
- approxCoords.setLatitude( minLat() );
- approxCoords.geoCoordinates( lon, lat );
- }
- }
+ geopoint.geoCoordinates( lon, originalLat );
+ qreal const lat = qBound(minLat(), originalLat, maxLat());
+ const bool isLatValid = lat == originalLat;
// Convenience variables
int radius = viewport->radius();