diff options
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/location/location.cpp | 7 | ||||
-rw-r--r-- | src/imports/positioning/locationsingleton.cpp | 43 | ||||
-rw-r--r-- | src/imports/positioning/locationsingleton.h | 5 |
3 files changed, 54 insertions, 1 deletions
diff --git a/src/imports/location/location.cpp b/src/imports/location/location.cpp index 0a20e5ad..9c89d3b8 100644 --- a/src/imports/location/location.cpp +++ b/src/imports/location/location.cpp @@ -100,7 +100,7 @@ public: int minor = 0; // Register the 5.0 types - // 5.0 is siltent and not advertised + // 5.0 is silent and not advertised qmlRegisterType<QDeclarativeGeoServiceProvider >(uri, major, minor, "Plugin"); qmlRegisterType<QDeclarativeGeoServiceProviderParameter >(uri, major, minor, "PluginParameter"); @@ -175,6 +175,11 @@ public: qmlRegisterType<QDeclarativeGeoMapCopyrightNotice>(uri, major, minor, "MapCopyrightNotice"); qmlRegisterType<QDeclarativeGeoMapItemGroup>(uri, major, minor, "MapItemGroup"); + // Register the 5.10 types + minor = 10; + qmlRegisterUncreatableType<QDeclarativeGeoCameraCapabilities>(uri, major, minor, "CameraCapabilities" + , QStringLiteral("CameraCapabilities is not intended instantiable by developer.")); + //registrations below are version independent qRegisterMetaType<QPlaceCategory>(); qRegisterMetaType<QPlace>(); diff --git a/src/imports/positioning/locationsingleton.cpp b/src/imports/positioning/locationsingleton.cpp index 19b05761..e9b58834 100644 --- a/src/imports/positioning/locationsingleton.cpp +++ b/src/imports/positioning/locationsingleton.cpp @@ -234,6 +234,37 @@ QGeoPath LocationSingleton::path(const QJSValue &value, qreal width) const } /*! + \qmlmethod geopolygon QtPositioning::polygon() const + + Constructs an empty geopolygon. + + \sa {geopolygon} + \since 5.10 +*/ +QGeoPath LocationSingleton::polygon() const +{ + return QGeoPolygon(); +} + +/*! + \qmlmethod geopolygon QtPositioning::polygon(list<coordinate> coordinates) const + + Constructs a geopolygon from coordinates. + + \sa {geopolygon} + \since 5.10 +*/ +QGeoPath LocationSingleton::polygon(const QVariantList &coordinates) const +{ + QList<QGeoCoordinate> internalCoordinates; + for (int i = 0; i < coordinates.size(); i++) { + if (coordinates.at(i).canConvert<QGeoCoordinate>()) + internalCoordinates << coordinates.at(i).value<QGeoCoordinate>(); + } + return QGeoPolygon(internalCoordinates); +} + +/*! \qmlmethod geocircle QtPositioning::shapeToCircle(geoshape shape) const Converts \a shape to a geocircle. @@ -272,3 +303,15 @@ QGeoPath LocationSingleton::shapeToPath(const QGeoShape &shape) const return QGeoPath(shape); } +/*! + \qmlmethod geopath QtPositioning::shapeToPolygon(geoshape shape) const + + Converts \a shape to a geopolygon. + + \sa {geopolygon} + \since 5.10 +*/ +QGeoPolygon LocationSingleton::shapeToPolygon(const QGeoShape &shape) const +{ + return QGeoPolygon(shape); +} diff --git a/src/imports/positioning/locationsingleton.h b/src/imports/positioning/locationsingleton.h index 4faf2738..6a560fa8 100644 --- a/src/imports/positioning/locationsingleton.h +++ b/src/imports/positioning/locationsingleton.h @@ -47,6 +47,7 @@ #include <QtPositioning/QGeoRectangle> #include <QtPositioning/QGeoCircle> #include <QtPositioning/QGeoPath> +#include <QtPositioning/QGeoPolygon> #include <QtQml/QJSValue> #include <QVariant> @@ -76,9 +77,13 @@ public: Q_INVOKABLE QGeoPath path() const; Q_INVOKABLE QGeoPath path(const QJSValue &value, qreal width = 0.0) const; + Q_INVOKABLE QGeoPath polygon() const; + Q_INVOKABLE QGeoPath polygon(const QVariantList &value) 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; + Q_INVOKABLE QGeoPolygon shapeToPolygon(const QGeoShape &shape) const; }; #endif // LOCATIONSINGLETON_H |