summaryrefslogtreecommitdiff
path: root/tests
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 /tests
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 'tests')
-rw-r--r--tests/auto/qgeomapscene/tst_qgeomapscene.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/auto/qgeomapscene/tst_qgeomapscene.cpp b/tests/auto/qgeomapscene/tst_qgeomapscene.cpp
index 57fc474d..4303dd0f 100644
--- a/tests/auto/qgeomapscene/tst_qgeomapscene.cpp
+++ b/tests/auto/qgeomapscene/tst_qgeomapscene.cpp
@@ -346,7 +346,7 @@ class tst_QGeoMapScene : public QObject
mapGeometry.setCameraData(camera);
mapGeometry.setVisibleTiles(ct.tiles());
- QPointF point(screenX,screenY);
+ QDoubleVector2D point(screenX,screenY);
QDoubleVector2D mecartorPos = mapGeometry.screenPositionToMercator(point);
QCOMPARE(mecartorPos.x(),mercatorX);
@@ -387,7 +387,7 @@ class tst_QGeoMapScene : public QObject
mapGeometry.setVisibleTiles(ct.tiles());
QDoubleVector2D mercatorPos(mercatorX, mercatorY);
- QPointF point = mapGeometry.mercatorToScreenPosition(mercatorPos);
+ QPointF point = mapGeometry.mercatorToScreenPosition(mercatorPos).toPointF();
QCOMPARE(point.x(), screenX);
QCOMPARE(point.y(), screenY);