diff options
Diffstat (limited to 'src/positioning/qgeopolygon.cpp')
-rw-r--r-- | src/positioning/qgeopolygon.cpp | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/positioning/qgeopolygon.cpp b/src/positioning/qgeopolygon.cpp index 1dafd1e0..1cbbc06e 100644 --- a/src/positioning/qgeopolygon.cpp +++ b/src/positioning/qgeopolygon.cpp @@ -178,7 +178,7 @@ bool QGeoPolygon::operator!=(const QGeoPolygon &other) const } /*! - Sets the \a polygon from a list of coordinates. + Sets the \a polygon's boundary from a list of coordinates. */ void QGeoPolygon::setPath(const QList<QGeoCoordinate> &path) { @@ -187,7 +187,7 @@ void QGeoPolygon::setPath(const QList<QGeoCoordinate> &path) } /*! - Returns all the elements. + Returns all the elements of the polygon's boundary. */ const QList<QGeoCoordinate> &QGeoPolygon::path() const { @@ -196,6 +196,36 @@ const QList<QGeoCoordinate> &QGeoPolygon::path() const } /*! + Sets all the elements of the polygon's perimeter. + + \since QtPositioning 5.12 +*/ +void QGeoPolygon::setPerimeter(const QVariantList &path) +{ + Q_D(QGeoPolygon); + QList<QGeoCoordinate> p; + for (const auto &c: path) { + if (c.canConvert<QGeoCoordinate>()) + p << c.value<QGeoCoordinate>(); + } + d->setPath(p); +} + +/*! + Returns all the elements of the polygon's perimeter. + + \since QtPositioning 5.12 +*/ +QVariantList QGeoPolygon::perimeter() const +{ + Q_D(const QGeoPolygon); + QVariantList p; + for (const auto &c: d->path()) + p << QVariant::fromValue(c); + return p; +} + +/*! Translates this geo polygon by \a degreesLatitude northwards and \a degreesLongitude eastwards. Negative values of \a degreesLatitude and \a degreesLongitude correspond to |