summaryrefslogtreecommitdiff
path: root/src/positioning/qlocationutils_p.h
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2016-08-05 22:21:12 +0200
committerPaolo Angelelli <paolo.angelelli@qt.io>2016-11-30 08:54:11 +0000
commitcd8880cc04b22610e835e6cc02cc16ac22ec9fae (patch)
tree37a5569c4eca55f70d5584f54fa2479dcf9dad3c /src/positioning/qlocationutils_p.h
parent0a552f285fdc3760d9755109ceef3b87392a308d (diff)
downloadqtlocation-cd8880cc04b22610e835e6cc02cc16ac22ec9fae.tar.gz
Add support for boundingGeoRectangle to QGeoShape
this patch introduces QGeoShape::boundingGeoRectangle, which returns a QGeoRectangle containing the latitudinal/longitudinal bounds of a geoshape. The bounding geo rectangle is projection independent, as it returns a georectangle containing the min/max latitudes/longitudes of the shape. Change-Id: Ie3a83ec41f87ea3753899d2278e664fe2469f778 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/positioning/qlocationutils_p.h')
-rw-r--r--src/positioning/qlocationutils_p.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/positioning/qlocationutils_p.h b/src/positioning/qlocationutils_p.h
index 00c4d3e3..32addb63 100644
--- a/src/positioning/qlocationutils_p.h
+++ b/src/positioning/qlocationutils_p.h
@@ -53,6 +53,14 @@
#include <QtCore/QtGlobal>
#include <math.h>
+#ifndef M_1_180
+#define M_1_180 0.0055555555555555555555555555555555555555556
+#endif
+
+#ifndef M_1_PI
+#define M_1_PI 0.31830988618379067154
+#endif
+
QT_BEGIN_NAMESPACE
class QTime;
class QByteArray;
@@ -176,6 +184,47 @@ public:
return CardinalNNW;
}
+ // For values exceeding +- 720.0
+ inline static double wrapLongExt(double lng) {
+ double remainder = fmod(lng + 180.0, 360.0);
+ return fmod(remainder + 360.0, 360.0) - 180.0;
+ }
+
+ // Mirrors the azimuth against the X axis. Azimuth assumed to be in [0,360[
+ inline static double mirrorAzimuthX(double azimuth) {
+ if (azimuth <= 90.0)
+ return 180.0 - azimuth;
+ else
+ return 180.0 + (360.0 - azimuth);
+ }
+
+ // Mirrors the azimuth against the Y axis. Azimuth assumed to be in [0,360[
+ inline static double mirrorAzimuthY(double azimuth) {
+ if (azimuth == 0.0)
+ return 0.0;
+ return 360.0 - azimuth;
+ }
+
+ inline static double radians(double degrees)
+ {
+ return degrees * M_PI * M_1_180;
+ }
+
+ inline static double degrees(double radians)
+ {
+ return radians * 180.0 * M_1_PI;
+ }
+
+ inline static double earthMeanRadius()
+ {
+ return 6371007.2;
+ }
+
+ inline static double mercatorMaxLatitude()
+ {
+ return 85.05113;
+ }
+
/*
Creates a QGeoPositionInfo from a GGA, GLL, RMC, VTG or ZDA sentence.