diff options
author | Paolo Angelelli <paolo.angelelli@qt.io> | 2016-08-08 16:19:10 +0200 |
---|---|---|
committer | Paolo Angelelli <paolo.angelelli@qt.io> | 2016-11-30 12:20:59 +0000 |
commit | 720d637494f3cc6493a2b5f2a3405d9fb4ed464c (patch) | |
tree | 1d04f463a438dd272544b2c2198b0dfa326a5b6a /src/imports | |
parent | 4ed9e84d5933a3eeaf55ac2f39fec826f0cadad0 (diff) | |
download | qtlocation-720d637494f3cc6493a2b5f2a3405d9fb4ed464c.tar.gz |
Use QLocationUtils::wrapLong thoughout the code
This patch remove if-else used to wrap longitude in the codebase,
replacing with the existing utility method wrapLong
Change-Id: I7a6eefa6f40b3dd0f47fec987c9197e294303873
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/location/qdeclarativecirclemapitem.cpp | 9 | ||||
-rw-r--r-- | src/imports/location/qquickgeomapgesturearea.cpp | 1 |
2 files changed, 4 insertions, 6 deletions
diff --git a/src/imports/location/qdeclarativecirclemapitem.cpp b/src/imports/location/qdeclarativecirclemapitem.cpp index f6b3c14f..5e33a1c5 100644 --- a/src/imports/location/qdeclarativecirclemapitem.cpp +++ b/src/imports/location/qdeclarativecirclemapitem.cpp @@ -46,6 +46,7 @@ #include <QPainter> #include "qdoublevector2d_p.h" +#include "qlocationutils_p.h" /* poly2tri triangulator includes */ #include "../../3rdparty/poly2tri/common/shapes.h" @@ -294,12 +295,8 @@ static void calculatePeripheralPoints(QList<QGeoCoordinate> &path, qreal resultLonRad = lonRad + std::atan2(std::sin(azimuthRad) * cosLatRad_x_sinRatio, cosRatio - sinLatRad * std::sin(resultLatRad)); qreal lat2 = qgeocoordinate_radToDeg(resultLatRad); - qreal lon2 = qgeocoordinate_radToDeg(resultLonRad); - if (lon2 < -180.0) { - lon2 += 360.0; - } else if (lon2 > 180.0) { - lon2 -= 360.0; - } + qreal lon2 = QLocationUtils::wrapLong(qgeocoordinate_radToDeg(resultLonRad)); + path << QGeoCoordinate(lat2, lon2, center.altitude()); // Consider only points in the left half of the circle for the left bound. if (azimuthRad > M_PI) { diff --git a/src/imports/location/qquickgeomapgesturearea.cpp b/src/imports/location/qquickgeomapgesturearea.cpp index ccf360aa..c115ce49 100644 --- a/src/imports/location/qquickgeomapgesturearea.cpp +++ b/src/imports/location/qquickgeomapgesturearea.cpp @@ -1017,6 +1017,7 @@ void QQuickGeoMapGestureArea::updatePinch() // Add to starting zoom level. Sign of (dist-pinchstartdist) takes care of zoom in / out m_pinch.m_zoom.m_start; } + m_pinch.m_event.setCenter(mapFromScene(m_sceneCenter)); m_pinch.m_event.setAngle(m_twoTouchAngle); |