summaryrefslogtreecommitdiff
path: root/src/location/maps/qgeomap.cpp
diff options
context:
space:
mode:
authorErik Mattsson <erik.mattsson@appello.com>2013-11-04 14:52:22 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-06 01:18:02 +0100
commite63de105fe71a0d825f8c82c75f17f65614aeb03 (patch)
tree4bcd1bfdb12431d21179d5bfd2495630a1203fe6 /src/location/maps/qgeomap.cpp
parent3fa4c43b5285d628084c74354e82ea0ee981d3f1 (diff)
downloadqtlocation-e63de105fe71a0d825f8c82c75f17f65614aeb03.tar.gz
Always use double point precision for geo lookups internally
This patch is to remedy rounding errors on ARM devices where qreal is defined as a float instead of double. The main change is to replace QPointF with QDoubleVector2D when using screenPositionToCoordinate and coordinateToScreenPosition. In many cases the QDoubleVector2D is converted to QPointF when the increased precision is not used. This because many of the surounding classes uses qreal so the precsision would be lost anyway. These classes include QVectorPath, QPainterPath and QQuickItem. The most important change is in polyline and polygon map item in the updateSourcePoints methods. Using floating point precision here resulted in many precision errors that caused for example route lines to be chopped of as the method erroneously thought it needed to wrap to the other side of the datum line. The external uses of the coordinate lookup functions in declarative geo map has been left untouched so they still use QPointF for compatibility reasons. Not sure how the process goes when updating externally visible parts of the API Change-Id: I01ed67a0563cfb5c4ff2db6395b7a62eaa8e4a19 Reviewed-by: Aaron McCarthy <mccarthy.aaron@gmail.com>
Diffstat (limited to 'src/location/maps/qgeomap.cpp')
-rw-r--r--src/location/maps/qgeomap.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/location/maps/qgeomap.cpp b/src/location/maps/qgeomap.cpp
index f27e2ffa..1f2b6e9b 100644
--- a/src/location/maps/qgeomap.cpp
+++ b/src/location/maps/qgeomap.cpp
@@ -49,7 +49,6 @@
#include "qgeomapcontroller_p.h"
#include <QtPositioning/private/qgeoprojection_p.h>
-#include <QtPositioning/private/qdoublevector2d_p.h>
#include <QtPositioning/private/qdoublevector3d_p.h>
#include "qgeocameratiles_p.h"
@@ -141,12 +140,12 @@ QGeoCameraData QGeoMap::cameraData() const
return mapData_->cameraData();
}
-QGeoCoordinate QGeoMap::screenPositionToCoordinate(const QPointF &pos, bool clipToViewport) const
+QGeoCoordinate QGeoMap::screenPositionToCoordinate(const QDoubleVector2D &pos, bool clipToViewport) const
{
return mapData_->screenPositionToCoordinate(pos, clipToViewport);
}
-QPointF QGeoMap::coordinateToScreenPosition(const QGeoCoordinate &coordinate, bool clipToViewport) const
+QDoubleVector2D QGeoMap::coordinateToScreenPosition(const QGeoCoordinate &coordinate, bool clipToViewport) const
{
return mapData_->coordinateToScreenPosition(coordinate, clipToViewport);
}