summaryrefslogtreecommitdiff
path: root/src/imports
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-12-01 13:45:41 +0000
commite568470c6409febdb5187e3f53af32164c63169f (patch)
tree6e93b51f86750740a276464b92253e0ad3a9a0bf /src/imports
parent6ac41c0f58f34606afaa289243d762afd5f879d4 (diff)
downloadqtlocation-e568470c6409febdb5187e3f53af32164c63169f.tar.gz
Add support for QGeoPath
This patch adds an addition qgeoshapes, QGeoPath. This represents a geographical path where each consecutive geopoints are connected along the shortest line of constant bearing (rhumb line). The path has a width, in meters, that is used in the contains() method to decide whether a coordinate is or not on the path, based on shortest distance to the rhumb line segments. Change-Id: Ia02780e3c8ac6c6d63a6083f53ea0677f8a21a1d Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/positioning/locationsingleton.cpp26
-rw-r--r--src/imports/positioning/locationsingleton.h4
-rw-r--r--src/imports/positioning/positioning.cpp3
3 files changed, 33 insertions, 0 deletions
diff --git a/src/imports/positioning/locationsingleton.cpp b/src/imports/positioning/locationsingleton.cpp
index f12486b0..a48c1a96 100644
--- a/src/imports/positioning/locationsingleton.cpp
+++ b/src/imports/positioning/locationsingleton.cpp
@@ -179,6 +179,19 @@ QGeoCircle LocationSingleton::circle(const QGeoCoordinate &center, qreal radius)
}
/*!
+ \qmlmethod geopath QtPositioning::path() const
+
+ Constructs an empty geopath.
+
+ \sa {geopath}
+ \since 5.9
+*/
+QGeoPath LocationSingleton::path() const
+{
+ return QGeoPath();
+}
+
+/*!
\qmlmethod geocircle QtPositioning::shapeToCircle(geoshape shape) const
Converts \a shape to a geocircle.
@@ -204,3 +217,16 @@ QGeoRectangle LocationSingleton::shapeToRectangle(const QGeoShape &shape) const
return QGeoRectangle(shape);
}
+/*!
+ \qmlmethod geopath QtPositioning::shapeToPath(geoshape shape) const
+
+ Converts \a shape to a geopath.
+
+ \sa {geopath}
+ \since 5.9
+*/
+QGeoPath LocationSingleton::shapeToPath(const QGeoShape &shape) const
+{
+ return QGeoPath(shape);
+}
+
diff --git a/src/imports/positioning/locationsingleton.h b/src/imports/positioning/locationsingleton.h
index cc4ea5ce..9a5320e0 100644
--- a/src/imports/positioning/locationsingleton.h
+++ b/src/imports/positioning/locationsingleton.h
@@ -46,6 +46,7 @@
#include <QtPositioning/QGeoShape>
#include <QtPositioning/QGeoRectangle>
#include <QtPositioning/QGeoCircle>
+#include <QtPositioning/QGeoPath>
#include <QVariant>
class LocationSingleton : public QObject
@@ -71,8 +72,11 @@ public:
Q_INVOKABLE QGeoCircle circle() const;
Q_INVOKABLE QGeoCircle circle(const QGeoCoordinate &center, qreal radius = -1.0) const;
+ Q_INVOKABLE QGeoPath path() const;
+
Q_INVOKABLE QGeoCircle shapeToCircle(const QGeoShape &shape) const;
Q_INVOKABLE QGeoRectangle shapeToRectangle(const QGeoShape &shape) const;
+ Q_INVOKABLE QGeoPath shapeToPath(const QGeoShape &shape) const;
};
#endif // LOCATIONSINGLETON_H
diff --git a/src/imports/positioning/positioning.cpp b/src/imports/positioning/positioning.cpp
index 4c54c211..b7914e5d 100644
--- a/src/imports/positioning/positioning.cpp
+++ b/src/imports/positioning/positioning.cpp
@@ -55,6 +55,7 @@
#include <QtPositioning/QGeoRectangle>
#include <QtPositioning/QGeoCircle>
+#include <QtPositioning/QGeoPath>
#include <QtPositioning/QGeoLocation>
#include <QtCore/QDebug>
@@ -527,6 +528,8 @@ public:
QMetaType::registerEqualsComparator<QGeoRectangle>();
qRegisterMetaType<QGeoCircle>();
QMetaType::registerEqualsComparator<QGeoCircle>();
+ qRegisterMetaType<QGeoPath>();
+ QMetaType::registerEqualsComparator<QGeoPath>();
qRegisterMetaType<QGeoLocation>();
qRegisterMetaType<QGeoShape>();
QMetaType::registerEqualsComparator<QGeoShape>();