diff options
author | Paolo Angelelli <paolo.angelelli@qt.io> | 2016-10-11 13:36:06 +0200 |
---|---|---|
committer | Paolo Angelelli <paolo.angelelli@qt.io> | 2017-01-25 13:25:38 +0000 |
commit | a66306d3d8eab810b769a536095dbfa2a0eb6ce2 (patch) | |
tree | 61843e32114732b10c238d25535c89c95911d0c1 /src/positioning | |
parent | be13464a488ccc2837b0c178ff16086be341e570 (diff) | |
download | qtlocation-a66306d3d8eab810b769a536095dbfa2a0eb6ce2.tar.gz |
Add rotation and tilt controls to QDeclarativeGeoMap
QDeclarativeGeoMap currently does not provide any mean to set bearing
and tilt into qgeocameradata.
It has been not a problem since QGeoTiledMap and sons did not support
it.
External renderers however support it, so this patch adds QML api
calls to control these parameters, and adapt the existing logic
to take them into consideration in camera-related
calls, as well as in the afterViewportChange handlers of the Map
Items.
This patch also sligthly modifies the QML api to make the handling
of all the bounded camera property more homogeneous.
Minimum and maximum zoom levels prior plugin initialization
aren't -1 anymore, but are some valid lower and upper bounds
for this property, that is 0 and 30.
in this way all the 2 bounded properties (zoomLevel and
tilt) behave the same, in that they can be freely set before plugin
initialization, within reasonable predefined bounds, and, after that,
they may be clamped depending on the actual plugin capabilities.
Autotests for the QML part of the API included.
Change-Id: I9d09e32698a7330388e465e8ea7523ee39577d34
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/positioning')
-rw-r--r-- | src/positioning/qlocationutils_p.h | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/positioning/qlocationutils_p.h b/src/positioning/qlocationutils_p.h index 552ec33f..704a57f8 100644 --- a/src/positioning/qlocationutils_p.h +++ b/src/positioning/qlocationutils_p.h @@ -53,17 +53,11 @@ #include <QtCore/QtGlobal> #include <math.h> -#ifndef M_PI -#define M_PI 3.14159265358979323846264338327950288 -#endif - -#ifndef M_1_180 -#define M_1_180 0.0055555555555555555555555555555555555555556 -#endif - -#ifndef M_1_PI -#define M_1_PI 0.31830988618379067154 -#endif +static const double M_PID = 3.14159265358979323846264338327950288; // to get more precision than float +static const double M_1_180D = 0.0055555555555555555555555555555555555555556; +static const double M_1_PID = 1.0 / M_PID; +static const double M_PI_180D = M_PID / 180.0; //0.0174532925199432954743716805978692718781530857086181640625; +static const double M_180_PID = 180.0 / M_PID; // 57.29577951308232286464772187173366546630859375 QT_BEGIN_NAMESPACE class QTime; @@ -211,14 +205,13 @@ public: inline static double radians(double degrees) { - return degrees * M_PI * M_1_180; + return degrees * M_PI_180D; } inline static double degrees(double radians) { - return radians * 180.0 * M_1_PI; + return radians * M_180_PID; } - inline static double earthMeanRadius() { return 6371007.2; |