From 400c7fa8e767c65aab4b8a1d5161b5259080cec9 Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Mon, 7 Apr 2014 11:36:00 +0200 Subject: Ignore invalid center coordinates on maps This causes undefined behavior and plenty of painter errors due to the occurrence of NaN. At the same time we change the default center to London. Previously it was in the middle of the Atlantic. This led to confusions because the all-blue display was mistaken for nothing/empty/invalid tiles (which is represented by grey). By showing the city of London we ensure that the default shows an easily recognisable area. Change-Id: I65a99d69d961b00a899120e190030e08a5ca0498 Reviewed-by: Robin Burchell Reviewed-by: Gunnar Sletta --- src/imports/location/qdeclarativegeomap.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/imports/location/qdeclarativegeomap.cpp b/src/imports/location/qdeclarativegeomap.cpp index 9e2e4ebb..b627da29 100644 --- a/src/imports/location/qdeclarativegeomap.cpp +++ b/src/imports/location/qdeclarativegeomap.cpp @@ -187,7 +187,7 @@ QDeclarativeGeoMap::QDeclarativeGeoMap(QQuickItem *parent) serviceProvider_(0), mappingManager_(0), zoomLevel_(8.0), - center_(0,0), + center_(51.5073,-0.1277), //London city center activeMapType_(0), componentCompleted_(false), mappingManagerInitialized_(false), @@ -656,10 +656,10 @@ qreal QDeclarativeGeoMap::zoomLevel() const } /*! -\qmlproperty coordinate QtLocation::Map::center + \qmlproperty coordinate QtLocation::Map::center This property holds the coordinate which occupies the center of the - mapping viewport. + mapping viewport. Invalid center coordinates are ignored. The default value is an arbitrary valid coordinate. */ @@ -668,6 +668,9 @@ void QDeclarativeGeoMap::setCenter(const QGeoCoordinate ¢er) if (!mappingManagerInitialized_ && center == center_) return; + if (!center.isValid()) + return; + center_ = center; if (center_.isValid() && mappingManagerInitialized_) { -- cgit v1.2.1