summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLauri Laanmets <lauri.laanmets@eesti.ee>2021-09-30 16:06:43 +0300
committerIvan Solovev <ivan.solovev@qt.io>2021-11-09 10:28:48 +0100
commit6ae370ac2e2a894f5181df9d5b027896812afaa5 (patch)
tree37b1d4e3f4d5fd7b9f16216bd8f323a38a337a46
parentb9f167d7aea56a1ea4b5cafb4bcda763bf7a0e5e (diff)
downloadqtlocation-6ae370ac2e2a894f5181df9d5b027896812afaa5.tar.gz
Change QGeoPolygon 'path' to 'perimeter'
https://doc.qt.io/qt-6/qtpositioning-changes-qt6.html#rename-qgeopolygon-path This is part of a bigger work to port QtLocation maps to Qt6. Task-number: QTBUG-96795 Change-Id: I34f27f7e21a3e4243b7fc08a93bc6e95d0541814 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
-rw-r--r--src/location/declarativemaps/qdeclarativepolygonmapitem.cpp16
-rw-r--r--src/location/declarativemaps/qdeclarativepolygonmapitem_p_p.h8
-rw-r--r--src/location/declarativemaps/qdeclarativepolylinemapitem.cpp8
-rw-r--r--src/location/labs/qgeojson.cpp10
-rw-r--r--src/location/labs/qmappolygonobject.cpp10
-rw-r--r--src/location/labs/qsg/qmappolygonobjectqsg.cpp2
-rw-r--r--src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp2
7 files changed, 28 insertions, 28 deletions
diff --git a/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp b/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp
index 8917dedb..507c5d66 100644
--- a/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp
+++ b/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp
@@ -358,7 +358,7 @@ static void wrapPath(const QGeoPolygon &poly
for (int i = 0; i < 1+poly.holesCount(); ++i) {
QList<QDoubleVector2D> path;
if (!i) {
- for (const QGeoCoordinate &c : poly.path())
+ for (const QGeoCoordinate &c : poly.perimeter())
path << p.geoToMapProjection(c);
} else {
for (const QGeoCoordinate &c : poly.holePath(i-1))
@@ -478,7 +478,7 @@ void QGeoMapPolygonGeometryOpenGL::updateSourcePoints(const QGeoMap &map,
// 1.1) do the same for the bbox
QList<QDoubleVector2D> wrappedBbox, wrappedBboxPlus1, wrappedBboxMinus1;
QGeoPolygon bbox(QGeoPath(perimeter).boundingGeoRectangle());
- QDeclarativeGeoMapItemUtils::wrapPath(bbox.path(), bbox.boundingGeoRectangle().topLeft(), p,
+ QDeclarativeGeoMapItemUtils::wrapPath(bbox.perimeter(), bbox.boundingGeoRectangle().topLeft(), p,
wrappedBbox, wrappedBboxMinus1, wrappedBboxPlus1, &m_bboxLeftBoundWrapped);
// 2) Store the triangulated polygon, and the wrapped bbox paths.
@@ -513,7 +513,7 @@ void QGeoMapPolygonGeometryOpenGL::updateSourcePoints(const QGeoMap &map, const
// 1.1) do the same for the bbox
QList<QDoubleVector2D> wrappedBbox, wrappedBboxPlus1, wrappedBboxMinus1;
QGeoPolygon bbox(poly.boundingGeoRectangle());
- QDeclarativeGeoMapItemUtils::wrapPath(bbox.path(), bbox.boundingGeoRectangle().topLeft(), p,
+ QDeclarativeGeoMapItemUtils::wrapPath(bbox.perimeter(), bbox.boundingGeoRectangle().topLeft(), p,
wrappedBbox, wrappedBboxMinus1, wrappedBboxPlus1, &m_bboxLeftBoundWrapped);
// 2) Store the triangulated polygon, and the wrapped bbox paths.
@@ -729,7 +729,7 @@ void QDeclarativePolygonMapItem::setMap(QDeclarativeGeoMap *quickMap, QGeoMap *m
*/
QJSValue QDeclarativePolygonMapItem::path() const
{
- return fromList(this, m_geopoly.path());
+ return fromList(this, m_geopoly.perimeter());
}
void QDeclarativePolygonMapItem::setPath(const QJSValue &value)
@@ -740,10 +740,10 @@ void QDeclarativePolygonMapItem::setPath(const QJSValue &value)
QList<QGeoCoordinate> pathList = toList(this, value);
// Equivalent to QDeclarativePolylineMapItem::setPathFromGeoList
- if (m_geopoly.path() == pathList)
+ if (m_geopoly.perimeter() == pathList)
return;
- m_geopoly.setPath(pathList);
+ m_geopoly.setPerimeter(pathList);
m_d->onGeoGeometryChanged();
emit pathChanged();
@@ -779,9 +779,9 @@ void QDeclarativePolygonMapItem::addCoordinate(const QGeoCoordinate &coordinate)
*/
void QDeclarativePolygonMapItem::removeCoordinate(const QGeoCoordinate &coordinate)
{
- int length = m_geopoly.path().length();
+ int length = m_geopoly.perimeter().length();
m_geopoly.removeCoordinate(coordinate);
- if (m_geopoly.path().length() == length)
+ if (m_geopoly.perimeter().length() == length)
return;
m_d->onGeoGeometryChanged();
diff --git a/src/location/declarativemaps/qdeclarativepolygonmapitem_p_p.h b/src/location/declarativemaps/qdeclarativepolygonmapitem_p_p.h
index 5b237310..60f32758 100644
--- a/src/location/declarativemaps/qdeclarativepolygonmapitem_p_p.h
+++ b/src/location/declarativemaps/qdeclarativepolygonmapitem_p_p.h
@@ -346,7 +346,7 @@ public:
const QGeoProjectionWebMercator &p = static_cast<const QGeoProjectionWebMercator&>(m_poly.map()->geoProjection());
m_geopathProjected.clear();
m_geopathProjected.reserve(m_poly.m_geopoly.size());
- for (const QGeoCoordinate &c : m_poly.m_geopoly.path())
+ for (const QGeoCoordinate &c : m_poly.m_geopoly.perimeter())
m_geopathProjected << p.geoToMapProjection(c);
}
void updateCache()
@@ -354,7 +354,7 @@ public:
if (!m_poly.map() || m_poly.map()->geoProjection().projectionType() != QGeoProjection::ProjectionWebMercator)
return;
const QGeoProjectionWebMercator &p = static_cast<const QGeoProjectionWebMercator&>(m_poly.map()->geoProjection());
- m_geopathProjected << p.geoToMapProjection(m_poly.m_geopoly.path().last());
+ m_geopathProjected << p.geoToMapProjection(m_poly.m_geopoly.perimeter().last());
}
void preserveGeometry()
{
@@ -390,7 +390,7 @@ public:
}
void updatePolish() override
{
- if (m_poly.m_geopoly.path().length() == 0) { // Possibly cleared
+ if (m_poly.m_geopoly.perimeter().length() == 0) { // Possibly cleared
m_geometry.clear();
m_borderGeometry.clear();
m_poly.setWidth(0);
@@ -557,7 +557,7 @@ public:
}
void updatePolish() override
{
- if (m_poly.m_geopoly.path().length() == 0) { // Possibly cleared
+ if (m_poly.m_geopoly.perimeter().length() == 0) { // Possibly cleared
m_geometry.clear();
m_borderGeometry.clear();
m_poly.setWidth(0);
diff --git a/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp b/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp
index 88ebef25..ee05503e 100644
--- a/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp
+++ b/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp
@@ -751,9 +751,9 @@ void QGeoMapPolylineGeometryOpenGL::updateSourcePoints(const QGeoMap &map, const
{
if (!sourceDirty_)
return;
- QGeoPath p(poly.path());
- if (poly.path().size() && poly.path().last() != poly.path().first())
- p.addCoordinate(poly.path().first());
+ QGeoPath p(poly.perimeter());
+ if (poly.perimeter().size() && poly.perimeter().last() != poly.perimeter().first())
+ p.addCoordinate(poly.perimeter().first());
updateSourcePoints(map, p);
}
@@ -798,7 +798,7 @@ void QGeoMapPolylineGeometryOpenGL::updateSourcePoints(const QGeoProjectionWebMe
}
QGeoPolygon bbox(QGeoRectangle(topLeft, bottomRight));
QList<QDoubleVector2D> wrappedBbox, wrappedBboxPlus1, wrappedBboxMinus1;
- QDeclarativeGeoMapItemUtils::wrapPath(bbox.path(), bbox.boundingGeoRectangle().topLeft(), p,
+ QDeclarativeGeoMapItemUtils::wrapPath(bbox.perimeter(), bbox.boundingGeoRectangle().topLeft(), p,
wrappedBbox, wrappedBboxMinus1, wrappedBboxPlus1, &m_bboxLeftBoundWrapped);
// New pointers, some old LOD task might still be running and operating on the old pointers.
diff --git a/src/location/labs/qgeojson.cpp b/src/location/labs/qgeojson.cpp
index 163a140f..f5995d9c 100644
--- a/src/location/labs/qgeojson.cpp
+++ b/src/location/labs/qgeojson.cpp
@@ -587,7 +587,7 @@ static QGeoPolygon importPolygon(const QVariantMap &inputMap)
QList<QList<QGeoCoordinate>> perimeters = importArrayOfArrayOfPositions(valueCoordinates);
for (int i = 0; i < perimeters.size(); ++i) { // Import an array of QList<QGeocoordinates>
if (i == 0)
- returnedObject.setPath(perimeters.at(i)); // External perimeter
+ returnedObject.setPerimeter(perimeters.at(i)); // External perimeter
else
returnedObject.addHole(perimeters.at(i)); // Inner perimeters
}
@@ -640,7 +640,7 @@ static QVariantList importMultiPolygon(const QVariantMap &inputMap)
for (int j = 0; j < coordinatesList.size(); ++j) {
if (j == 0)
- singlePoly.setPath(coordinatesList.at(j));
+ singlePoly.setPerimeter(coordinatesList.at(j));
else
singlePoly.addHole(coordinatesList.at(j));
}
@@ -816,7 +816,7 @@ static QJsonObject exportPolygon(const QVariantMap &polygonMap)
QJsonValue polyCoordinates;
QList<QList<QGeoCoordinate>> obtainedCoordinatesPoly;
QGeoPolygon parsedPoly = polygonVariant.value<QGeoPolygon>();
- obtainedCoordinatesPoly << parsedPoly.path();
+ obtainedCoordinatesPoly << parsedPoly.perimeter();
if (parsedPoly.holesCount()!=0)
for (int i = 0; i < parsedPoly.holesCount(); ++i) {
obtainedCoordinatesPoly << parsedPoly.holePath(i);
@@ -867,7 +867,7 @@ static QJsonObject exportMultiPolygon(const QVariantMap &multiPolygonMap)
int polyHoles = 0;
int currentHole;
for (int i = 0; i < multiPolygonList.size(); ++i) { // Start parsing Polygon list
- extractedCoordinatesValue << multiPolygonList.at(i).value<QVariantMap>().value(QStringLiteral("data")).value<QGeoPolygon>().path(); // Extract external polygon path
+ extractedCoordinatesValue << multiPolygonList.at(i).value<QVariantMap>().value(QStringLiteral("data")).value<QGeoPolygon>().perimeter(); // Extract external polygon path
polyHoles = multiPolygonList.at(i).value<QVariantMap>().value(QStringLiteral("data")).value<QGeoPolygon>().holesCount();
if (polyHoles) // Check if the polygon has holes
for (currentHole = 0 ; currentHole < polyHoles; currentHole++)
@@ -1158,7 +1158,7 @@ QTextStream &operator << (QTextStream &stream, const QGeoShape &shape)
case QGeoShape::PolygonType: {
QGeoPolygon poly(shape);
stream << "QGeoPolygon(";
- for (auto c: poly.path())
+ for (auto c: poly.perimeter())
stream << c << ", ";
stream << ")";
break;
diff --git a/src/location/labs/qmappolygonobject.cpp b/src/location/labs/qmappolygonobject.cpp
index 9d679f31..b6415d5c 100644
--- a/src/location/labs/qmappolygonobject.cpp
+++ b/src/location/labs/qmappolygonobject.cpp
@@ -70,7 +70,7 @@ QMapPolygonObjectPrivateDefault::QMapPolygonObjectPrivateDefault(QGeoMapObject *
QMapPolygonObjectPrivateDefault::QMapPolygonObjectPrivateDefault(const QMapPolygonObjectPrivate &other) : QMapPolygonObjectPrivate(other.q)
{
- m_path.setPath(other.path()); // to stay on the safe side
+ m_path.setPerimeter(other.path()); // to stay on the safe side
QGeoPolygon poly(other.geoShape()); // to handle holes
for (int i = 0; i < poly.holesCount(); i++)
m_path.addHole(poly.holePath(i));
@@ -91,12 +91,12 @@ QGeoMapObject::Type QMapPolygonObjectPrivate::type() const
QList<QGeoCoordinate> QMapPolygonObjectPrivateDefault::path() const
{
- return m_path.path();
+ return m_path.perimeter();
}
void QMapPolygonObjectPrivateDefault::setPath(const QList<QGeoCoordinate> &path)
{
- m_path.setPath(path);
+ m_path.setPerimeter(path);
}
QColor QMapPolygonObjectPrivateDefault::fillColor() const
@@ -147,7 +147,7 @@ void QMapPolygonObjectPrivateDefault::setGeoShape(const QGeoShape &shape)
const QGeoPolygon poly(shape);
for (int i = 0; i < poly.holesCount(); i++)
m_path.addHole(poly.holePath(i));
- setPath(poly.path()); // to handle overrides. Last as it normally emits static_cast<QMapPolygonObject *>(q)->pathChanged();
+ setPath(poly.perimeter()); // to handle overrides. Last as it normally emits static_cast<QMapPolygonObject *>(q)->pathChanged();
}
bool QMapPolygonObjectPrivate::equals(const QGeoMapObjectPrivate &other) const
@@ -174,7 +174,7 @@ void QMapPolygonObjectPrivate::setGeoShape(const QGeoShape &shape)
return;
const QGeoPolygon poly(shape);
- setPath(poly.path()); // to handle overrides
+ setPath(poly.perimeter()); // to handle overrides
emit static_cast<QMapPolygonObject *>(q)->pathChanged();
}
diff --git a/src/location/labs/qsg/qmappolygonobjectqsg.cpp b/src/location/labs/qsg/qmappolygonobjectqsg.cpp
index a8a1cb4b..5a40a4ef 100644
--- a/src/location/labs/qsg/qmappolygonobjectqsg.cpp
+++ b/src/location/labs/qsg/qmappolygonobjectqsg.cpp
@@ -126,7 +126,7 @@ void QMapPolygonObjectPrivateQSG::updateGeometry()
if (!m_map || m_map->geoProjection().projectionType() != QGeoProjection::ProjectionWebMercator)
return;
- if (m_path.path().length() == 0) { // Possibly cleared
+ if (m_path.perimeter().length() == 0) { // Possibly cleared
m_geometry.clear();
m_borderGeometry.clear();
return;
diff --git a/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp b/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp
index 483f8f6d..520fedb3 100644
--- a/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp
+++ b/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp
@@ -135,7 +135,7 @@ QMapbox::Feature featureFromMapPolygon(QDeclarativePolygonMapItem *mapItem)
const bool crossesDateline = geoRectangleCrossesDateLine(polygon->boundingGeoRectangle());
QMapbox::CoordinatesCollections geometry;
QMapbox::CoordinatesCollection poly;
- QMapbox::Coordinates coordinates = qgeocoordinate2mapboxcoordinate(polygon->path(), crossesDateline, true);
+ QMapbox::Coordinates coordinates = qgeocoordinate2mapboxcoordinate(polygon->perimeter(), crossesDateline, true);
poly.push_back(coordinates);
for (int i = 0; i < polygon->holesCount(); ++i) {
coordinates = qgeocoordinate2mapboxcoordinate(polygon->holePath(i), crossesDateline, true);