diff options
author | Ian Chen <ian.1.chen@nokia.com> | 2012-05-18 15:50:43 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-25 04:54:05 +0200 |
commit | fc4cfe109ea6b558f3722d92939645ddcdc628aa (patch) | |
tree | aebf51607f8e9586c63064b3948565181a30753c /src/location | |
parent | 965d2e6fb81658d4441bfe7c43ce46ab827de86c (diff) | |
download | qtlocation-fc4cfe109ea6b558f3722d92939645ddcdc628aa.tar.gz |
Fix dragging of map rectangle, polygon, polyline items
Now works when dragged across dateline, over min/max latitdues,
and into the screen from screen edges (in which case items were
previous clipped by viewport).
Also made MapRectangle a geographic element, and updated
declarative_ui test to reflect this change. Docs are also updated.
One behaviora1 change - calling x(), y() on map items now returns
the true top left point of map item (which makes more sense)
as opposed to the clipped top left point.
Task-number: QTBUG-25776, QTBUG-25400, QTBUG-25794
Change-Id: I5f8d05103bdcc6ee396dabd0c787ac61861dd9cb
Reviewed-by: Thomas Lowe <thomas.lowe@nokia.com>
Reviewed-by: Alex Wilson <alex.wilson@nokia.com>
Diffstat (limited to 'src/location')
-rw-r--r-- | src/location/qlocationutils_p.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/location/qlocationutils_p.h b/src/location/qlocationutils_p.h index 54710e42..af63faf3 100644 --- a/src/location/qlocationutils_p.h +++ b/src/location/qlocationutils_p.h @@ -69,6 +69,22 @@ public: return lng >= -180 && lng <= 180; } + inline static double clipLat(double lat) { + if (lat > 90) + lat = 90; + else if (lat < -90) + lat = -90; + return lat; + } + + inline static double wrapLong(double lng) { + if (lng > 180) + lng -= 360; + else if (lng < -180) + lng += 360; + return lng; + } + /* Creates a QGeoPositionInfo from a GGA, GLL, RMC, VTG or ZDA sentence. |