summaryrefslogtreecommitdiff
path: root/src/positioning
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2016-12-01 12:50:30 +0100
committerPaolo Angelelli <paolo.angelelli@qt.io>2016-12-07 11:48:10 +0000
commit7656821275de8b932c75063adfcdf8deb968db84 (patch)
tree993adbf164d02349b88d3308f7a8df629921562c /src/positioning
parent9e71adaf31fe50e9966a6b09619968ae2b1176b6 (diff)
downloadqtlocation-7656821275de8b932c75063adfcdf8deb968db84.tar.gz
Deprecate QGeoShape::extendShape
As the collection of QGeoShapes grows, this method loses its scope, as it would have undefined behavior for certain shapes (polygon, or polyline, for example). Therefore the base class virtual method is now deprecated, with the documentation pointing to the specific implementations instead. Change-Id: I9717df092b8686b5413556858e9dfe7eaa92dd80 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/positioning')
-rw-r--r--src/positioning/qgeocircle.cpp11
-rw-r--r--src/positioning/qgeocircle.h1
-rw-r--r--src/positioning/qgeorectangle.cpp11
-rw-r--r--src/positioning/qgeoshape.cpp12
-rw-r--r--src/positioning/qgeoshape.h1
5 files changed, 35 insertions, 1 deletions
diff --git a/src/positioning/qgeocircle.cpp b/src/positioning/qgeocircle.cpp
index 17263a42..4b4370bf 100644
--- a/src/positioning/qgeocircle.cpp
+++ b/src/positioning/qgeocircle.cpp
@@ -423,6 +423,17 @@ QGeoCircle QGeoCircle::translated(double degreesLatitude, double degreesLongitud
}
/*!
+ Extends the geo circle to also cover the coordinate \a coordinate
+
+ \since 5.9
+*/
+void QGeoCircle::extendCircle(const QGeoCoordinate &coordinate)
+{
+ Q_D(QGeoCircle);
+ d->extendShape(coordinate);
+}
+
+/*!
Returns the geo circle properties as a string.
\since 5.5
diff --git a/src/positioning/qgeocircle.h b/src/positioning/qgeocircle.h
index e8632fe9..dc10ccf9 100644
--- a/src/positioning/qgeocircle.h
+++ b/src/positioning/qgeocircle.h
@@ -77,6 +77,7 @@ public:
Q_INVOKABLE void translate(double degreesLatitude, double degreesLongitude);
Q_INVOKABLE QGeoCircle translated(double degreesLatitude, double degreesLongitude) const;
+ Q_INVOKABLE void extendCircle(const QGeoCoordinate &coordinate);
Q_INVOKABLE QString toString() const;
diff --git a/src/positioning/qgeorectangle.cpp b/src/positioning/qgeorectangle.cpp
index e74beee3..1453a6a8 100644
--- a/src/positioning/qgeorectangle.cpp
+++ b/src/positioning/qgeorectangle.cpp
@@ -782,6 +782,17 @@ QGeoRectangle QGeoRectangle::translated(double degreesLatitude, double degreesLo
}
/*!
+ Extends the geo rectangle to also cover the coordinate \a coordinate
+
+ \since 5.9
+*/
+void QGeoRectangle::extendRectangle(const QGeoCoordinate &coordinate)
+{
+ Q_D(QGeoRectangle);
+ d->extendShape(coordinate);
+}
+
+/*!
Returns the smallest geo rectangle which contains both this geo rectangle and \a rectangle.
If the centers of the two geo rectangles are separated by exactly 180.0 degrees then the
diff --git a/src/positioning/qgeoshape.cpp b/src/positioning/qgeoshape.cpp
index c1f7bd9d..60ef18a4 100644
--- a/src/positioning/qgeoshape.cpp
+++ b/src/positioning/qgeoshape.cpp
@@ -260,7 +260,17 @@ QGeoCoordinate QGeoShape::center() const
}
/*!
- Extends the geo shape to also cover the coordinate \a coordinate
+ \deprecated
+
+ This method used to extend the geo shape to also cover the coordinate \a coordinate.
+
+ It currently only works for \l QGeoCircle and \l QGeoRectangle, on which the functionality remains,
+ now also accessible through QGeoCircle::extendCircle and QGeoRectangle::extendRectangle.
+
+ This method should therefore not be called on a generic QGeoShape any longer, as the behavior for
+ other shape types is undefined.
+
+ \sa QGeoRectangle::extendRectangle, QGeoCircle::extendCircle
*/
void QGeoShape::extendShape(const QGeoCoordinate &coordinate)
{
diff --git a/src/positioning/qgeoshape.h b/src/positioning/qgeoshape.h
index 40123f88..441c9ebb 100644
--- a/src/positioning/qgeoshape.h
+++ b/src/positioning/qgeoshape.h
@@ -167,6 +167,7 @@ public:
Q_INVOKABLE void translate(double degreesLatitude, double degreesLongitude);
Q_INVOKABLE QGeoRectangle translated(double degreesLatitude, double degreesLongitude) const;
+ Q_INVOKABLE void extendRectangle(const QGeoCoordinate &coordinate);
Q_INVOKABLE QGeoRectangle united(const QGeoRectangle &rectangle) const;
QGeoRectangle operator|(const QGeoRectangle &rectangle) const;