summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2021-02-02 17:04:31 +0100
committerIvan Solovev <ivan.solovev@qt.io>2021-02-03 17:10:39 +0100
commitec00d74a0207feaf406773b940621c18eae86182 (patch)
treeeb577711df69fc2b0d103d569e72153bc58cf907
parentaaed86d898842d3e6e499ea9c145e4ec1020c7b2 (diff)
QtPositioning: remove deprecated QGeoShape::extendShape() method
This method was deprecated in Qt 5.9. We can remove it in Qt 6. [ChangeLog][QtPositioning][QGeoShape] Remove QGeoShape::extendShape() method. Use QGeoCircle::extendCircle() and QGeoRectangle::extendRectangle() for these specific shapes. Task-number: QTBUG-90491 Change-Id: I72cda208ae9555d86836230b57ccc1ed0fb1bd55 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r--src/positioning/qgeocircle.cpp4
-rw-r--r--src/positioning/qgeocircle_p.h2
-rw-r--r--src/positioning/qgeopath.cpp7
-rw-r--r--src/positioning/qgeopath_p.h2
-rw-r--r--src/positioning/qgeorectangle.cpp6
-rw-r--r--src/positioning/qgeorectangle_p.h2
-rw-r--r--src/positioning/qgeoshape.cpp22
-rw-r--r--src/positioning/qgeoshape.h2
-rw-r--r--src/positioning/qgeoshape_p.h2
-rw-r--r--tests/auto/qgeopath/tst_qgeopath.cpp45
-rw-r--r--tests/auto/qgeopolygon/tst_qgeopolygon.cpp43
11 files changed, 7 insertions, 130 deletions
diff --git a/src/positioning/qgeocircle.cpp b/src/positioning/qgeocircle.cpp
index 140f78aa..b466c713 100644
--- a/src/positioning/qgeocircle.cpp
+++ b/src/positioning/qgeocircle.cpp
@@ -359,7 +359,7 @@ bool QGeoCirclePrivate::crossSouthPole() const
/*
Extends the circle to include \a coordinate.
*/
-void QGeoCirclePrivate::extendShape(const QGeoCoordinate &coordinate)
+void QGeoCirclePrivate::extendCircle(const QGeoCoordinate &coordinate)
{
if (!isValid() || !coordinate.isValid() || contains(coordinate))
return;
@@ -430,7 +430,7 @@ QGeoCircle QGeoCircle::translated(double degreesLatitude, double degreesLongitud
void QGeoCircle::extendCircle(const QGeoCoordinate &coordinate)
{
Q_D(QGeoCircle);
- d->extendShape(coordinate);
+ d->extendCircle(coordinate);
}
/*!
diff --git a/src/positioning/qgeocircle_p.h b/src/positioning/qgeocircle_p.h
index ca3f86e2..5e957f6f 100644
--- a/src/positioning/qgeocircle_p.h
+++ b/src/positioning/qgeocircle_p.h
@@ -78,7 +78,7 @@ public:
void setCenter(const QGeoCoordinate &c);
void setRadius(const qreal r);
- void extendShape(const QGeoCoordinate &coordinate) override;
+ void extendCircle(const QGeoCoordinate &coordinate);
QGeoShapePrivate *clone() const override;
diff --git a/src/positioning/qgeopath.cpp b/src/positioning/qgeopath.cpp
index 01e41ab2..c4028642 100644
--- a/src/positioning/qgeopath.cpp
+++ b/src/positioning/qgeopath.cpp
@@ -438,13 +438,6 @@ QGeoCoordinate QGeoPathPrivate::center() const
return boundingGeoRectangle().center();
}
-void QGeoPathPrivate::extendShape(const QGeoCoordinate &coordinate)
-{
- if (!coordinate.isValid() || contains(coordinate))
- return;
- addCoordinate(coordinate);
-}
-
bool QGeoPathPrivate::operator==(const QGeoShapePrivate &other) const
{
if (!QGeoShapePrivate::operator==(other))
diff --git a/src/positioning/qgeopath_p.h b/src/positioning/qgeopath_p.h
index 152b8e40..18cd3ab1 100644
--- a/src/positioning/qgeopath_p.h
+++ b/src/positioning/qgeopath_p.h
@@ -185,8 +185,6 @@ public:
virtual bool contains(const QGeoCoordinate &coordinate) const override;
virtual QGeoRectangle boundingGeoRectangle() const override;
- virtual void extendShape(const QGeoCoordinate &coordinate) override;
-
// QGeoPathPrivate API
virtual const QList<QGeoCoordinate> &path() const;
virtual bool lineContains(const QGeoCoordinate &coordinate) const;
diff --git a/src/positioning/qgeorectangle.cpp b/src/positioning/qgeorectangle.cpp
index 80dd41b4..928b1509 100644
--- a/src/positioning/qgeorectangle.cpp
+++ b/src/positioning/qgeorectangle.cpp
@@ -251,7 +251,7 @@ QGeoRectangle::QGeoRectangle(const QList<QGeoCoordinate> &coordinates)
d_ptr = new QGeoRectanglePrivate(startCoordinate, startCoordinate);
foreach (const QGeoCoordinate &coordinate, coordinates) {
- d_ptr->extendShape(coordinate);
+ d_func()->extendRectangle(coordinate);
}
}
}
@@ -789,7 +789,7 @@ QGeoRectangle QGeoRectangle::translated(double degreesLatitude, double degreesLo
void QGeoRectangle::extendRectangle(const QGeoCoordinate &coordinate)
{
Q_D(QGeoRectangle);
- d->extendShape(coordinate);
+ d->extendRectangle(coordinate);
}
/*!
@@ -817,7 +817,7 @@ QGeoRectangle QGeoRectangle::united(const QGeoRectangle &rectangle) const
the coordinate noting happens.
*/
-void QGeoRectanglePrivate::extendShape(const QGeoCoordinate &coordinate)
+void QGeoRectanglePrivate::extendRectangle(const QGeoCoordinate &coordinate)
{
if (!isValid() || !coordinate.isValid() || contains(coordinate))
return;
diff --git a/src/positioning/qgeorectangle_p.h b/src/positioning/qgeorectangle_p.h
index ec3a2b53..632fdaa4 100644
--- a/src/positioning/qgeorectangle_p.h
+++ b/src/positioning/qgeorectangle_p.h
@@ -72,7 +72,7 @@ public:
QGeoRectangle boundingGeoRectangle() const override;
- void extendShape(const QGeoCoordinate &coordinate) override;
+ void extendRectangle(const QGeoCoordinate &coordinate);
QGeoShapePrivate *clone() const override;
diff --git a/src/positioning/qgeoshape.cpp b/src/positioning/qgeoshape.cpp
index c459ba61..859df96e 100644
--- a/src/positioning/qgeoshape.cpp
+++ b/src/positioning/qgeoshape.cpp
@@ -263,28 +263,6 @@ QGeoCoordinate QGeoShape::center() const
}
/*!
- \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)
-{
- Q_D(QGeoShape);
-
- if (d)
- d->extendShape(coordinate);
-}
-
-
-/*!
Returns true if the \a other geo shape is equivalent to this geo shape, otherwise returns
false.
*/
diff --git a/src/positioning/qgeoshape.h b/src/positioning/qgeoshape.h
index c0bc658b..00aead8a 100644
--- a/src/positioning/qgeoshape.h
+++ b/src/positioning/qgeoshape.h
@@ -78,8 +78,6 @@ public:
Q_INVOKABLE QGeoRectangle boundingGeoRectangle() const;
Q_INVOKABLE QGeoCoordinate center() const;
- Q_INVOKABLE void extendShape(const QGeoCoordinate &coordinate);
-
bool operator==(const QGeoShape &other) const;
bool operator!=(const QGeoShape &other) const;
diff --git a/src/positioning/qgeoshape_p.h b/src/positioning/qgeoshape_p.h
index f8380654..fcc8f8b6 100644
--- a/src/positioning/qgeoshape_p.h
+++ b/src/positioning/qgeoshape_p.h
@@ -71,8 +71,6 @@ public:
virtual QGeoRectangle boundingGeoRectangle() const = 0;
- virtual void extendShape(const QGeoCoordinate &coordinate) = 0;
-
virtual QGeoShapePrivate *clone() const = 0;
virtual bool operator==(const QGeoShapePrivate &other) const;
diff --git a/tests/auto/qgeopath/tst_qgeopath.cpp b/tests/auto/qgeopath/tst_qgeopath.cpp
index 47badf73..4d71130c 100644
--- a/tests/auto/qgeopath/tst_qgeopath.cpp
+++ b/tests/auto/qgeopath/tst_qgeopath.cpp
@@ -60,9 +60,6 @@ private slots:
void boundingGeoRectangle_data();
void boundingGeoRectangle();
-
- void extendShape();
- void extendShape_data();
};
void tst_QGeoPath::defaultConstructor()
@@ -371,47 +368,5 @@ void tst_QGeoPath::boundingGeoRectangle()
QCOMPARE(box.contains(probe), result);
}
-void tst_QGeoPath::extendShape()
-{
- QFETCH(QGeoCoordinate, c1);
- QFETCH(QGeoCoordinate, c2);
- QFETCH(QGeoCoordinate, c3);
- QFETCH(qreal, width);
- QFETCH(QGeoCoordinate, probe);
- QFETCH(bool, before);
- QFETCH(bool, after);
-
- QList<QGeoCoordinate> coords;
- coords.append(c1);
- coords.append(c2);
- coords.append(c3);
- QGeoPath p(coords, width);
-
-
- QCOMPARE(p.contains(probe), before);
- p.extendShape(probe);
- QCOMPARE(p.contains(probe), after);
-}
-
-void tst_QGeoPath::extendShape_data()
-{
- QTest::addColumn<QGeoCoordinate>("c1");
- QTest::addColumn<QGeoCoordinate>("c2");
- QTest::addColumn<QGeoCoordinate>("c3");
- QTest::addColumn<qreal>("width");
- QTest::addColumn<QGeoCoordinate>("probe");
- QTest::addColumn<bool>("before");
- QTest::addColumn<bool>("after");
-
- QList<QGeoCoordinate> c;
- c.append(QGeoCoordinate(1,1));
- c.append(QGeoCoordinate(2,2));
- c.append(QGeoCoordinate(3,0));
-
- QTest::newRow("One of the points") << c[0] << c[1] << c[2] << 0.0 << QGeoCoordinate(2, 2) << true << true;
- QTest::newRow("Not so far away") << c[0] << c[1] << c[2] << 0.0 << QGeoCoordinate(0, 0) << false << true;
- QTest::newRow("Not so far away and large line") << c[0] << c[1] << c[2] << 100000.0 << QGeoCoordinate(0.8, 0.8) << true << true;
-}
-
QTEST_MAIN(tst_QGeoPath)
#include "tst_qgeopath.moc"
diff --git a/tests/auto/qgeopolygon/tst_qgeopolygon.cpp b/tests/auto/qgeopolygon/tst_qgeopolygon.cpp
index e8f6f983..1f2b015a 100644
--- a/tests/auto/qgeopolygon/tst_qgeopolygon.cpp
+++ b/tests/auto/qgeopolygon/tst_qgeopolygon.cpp
@@ -59,9 +59,6 @@ private slots:
void boundingGeoRectangle_data();
void boundingGeoRectangle();
-
- void extendShape();
- void extendShape_data();
};
void tst_QGeoPolygon::defaultConstructor()
@@ -358,45 +355,5 @@ void tst_QGeoPolygon::boundingGeoRectangle()
QCOMPARE(box.contains(probe), result);
}
-void tst_QGeoPolygon::extendShape()
-{
- QFETCH(QGeoCoordinate, c1);
- QFETCH(QGeoCoordinate, c2);
- QFETCH(QGeoCoordinate, c3);
- QFETCH(QGeoCoordinate, probe);
- QFETCH(bool, before);
- QFETCH(bool, after);
-
- QList<QGeoCoordinate> coords;
- coords.append(c1);
- coords.append(c2);
- coords.append(c3);
- QGeoPolygon p(coords);
-
-
- QCOMPARE(p.contains(probe), before);
- p.extendShape(probe);
- QCOMPARE(p.contains(probe), after);
-}
-
-void tst_QGeoPolygon::extendShape_data()
-{
- QTest::addColumn<QGeoCoordinate>("c1");
- QTest::addColumn<QGeoCoordinate>("c2");
- QTest::addColumn<QGeoCoordinate>("c3");
- QTest::addColumn<QGeoCoordinate>("probe");
- QTest::addColumn<bool>("before");
- QTest::addColumn<bool>("after");
-
- QList<QGeoCoordinate> c;
- c.append(QGeoCoordinate(1,1));
- c.append(QGeoCoordinate(2,2));
- c.append(QGeoCoordinate(3,0));
-
- QTest::newRow("One of the points") << c[0] << c[1] << c[2] << QGeoCoordinate(2, 2) << true << true;
- QTest::newRow("Not so far away") << c[0] << c[1] << c[2] << QGeoCoordinate(0, 0) << false << true;
- QTest::newRow("Contained point") << c[0] << c[1] << c[2] << QGeoCoordinate(2.0, 1.0) << true << true;
-}
-
QTEST_MAIN(tst_QGeoPolygon)
#include "tst_qgeopolygon.moc"