From 6ae370ac2e2a894f5181df9d5b027896812afaa5 Mon Sep 17 00:00:00 2001 From: Lauri Laanmets Date: Thu, 30 Sep 2021 16:06:43 +0300 Subject: 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 Reviewed-by: Alex Blasche Reviewed-by: Andreas Buhr --- .../declarativemaps/qdeclarativepolygonmapitem.cpp | 16 ++++++++-------- .../declarativemaps/qdeclarativepolygonmapitem_p_p.h | 8 ++++---- .../declarativemaps/qdeclarativepolylinemapitem.cpp | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-) (limited to 'src/location/declarativemaps') 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 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 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 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 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(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(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 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. -- cgit v1.2.1