diff options
author | Matthias Rauter <matthias.rauter@qt.io> | 2023-01-26 17:18:50 +0100 |
---|---|---|
committer | Matthias Rauter <matthias.rauter@qt.io> | 2023-02-14 16:31:13 +0100 |
commit | 8b9ecad4bed0150adcbdf91db3f5f9507a156fd6 (patch) | |
tree | 6cd08872c366a32ed041701654d15559325fd464 /src/location/quickmapitems/qdeclarativepolylinemapitem_p_p.h | |
parent | b842a6cdcce0ee43a48ec084180d9dc065b599a1 (diff) | |
download | qtlocation-8b9ecad4bed0150adcbdf91db3f5f9507a156fd6.tar.gz |
Correct and improve the rendering of QuickMapItems
Various MapItems were not rendered correctly, especially in corner cases.
This change ensures that MapItems are rendered correctly in the vast
majority of cases.
All MapItems are shown correctly if they wrap around the globe and
appear twice on the map.
Circles that span around the globe or are located near poles are shown
correclty and filled all the way to the border of the map.
Polygons are shown correctly including their holes.
The code was simplified and some artefacts of previous implementations
were removed.
Fixes: QTBUG-110701
Fixes: QTBUG-110511
Pick-to: 6.5
Change-Id: I1110659989436cd5a93f6ec26f75caa06d5f2b71
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/location/quickmapitems/qdeclarativepolylinemapitem_p_p.h')
-rw-r--r-- | src/location/quickmapitems/qdeclarativepolylinemapitem_p_p.h | 43 |
1 files changed, 2 insertions, 41 deletions
diff --git a/src/location/quickmapitems/qdeclarativepolylinemapitem_p_p.h b/src/location/quickmapitems/qdeclarativepolylinemapitem_p_p.h index 4ade0fba..ef482f3c 100644 --- a/src/location/quickmapitems/qdeclarativepolylinemapitem_p_p.h +++ b/src/location/quickmapitems/qdeclarativepolylinemapitem_p_p.h @@ -31,47 +31,15 @@ QT_BEGIN_NAMESPACE class QQuickShape; class QQuickShapePath; -class Q_LOCATION_PRIVATE_EXPORT QGeoMapPolylineGeometry : public QGeoMapItemGeometry +struct QGeoMapPolylineGeometry : QGeoMapItemGeometry { -public: - QGeoMapPolylineGeometry(); - void updateSourcePoints(const QGeoMap &map, - const QList<QDoubleVector2D> &path, - const QGeoCoordinate geoLeftBound); - - void updateScreenPoints(const QGeoMap &map, - qreal strokeWidth, - bool adjustTranslation = true); - - void clearSource(); - - bool contains(const QPointF &point) const override; - - QList<QList<QDoubleVector2D> > clipPath(const QGeoMap &map, - const QList<QDoubleVector2D> &path, - QDoubleVector2D &leftBoundWrapped); - - void pathToScreen(const QGeoMap &map, - const QList<QList<QDoubleVector2D> > &clippedPaths, - const QDoubleVector2D &leftBoundWrapped); + const QList<QDoubleVector2D> &basePath); QPainterPath srcPath() const { return srcPath_; } -public: - QList<qreal> srcPoints_; - QList<QPainterPath::ElementType> srcPointTypes_; QPainterPath srcPath_; qreal maxCoord_ = 0.0; - -#ifdef QT_LOCATION_DEBUG - QList<QDoubleVector2D> m_wrappedPath; - QList<QList<QDoubleVector2D>> m_clippedPaths; -#endif - - friend class QDeclarativeCircleMapItem; - friend class QDeclarativePolygonMapItem; - friend class QDeclarativeRectangleMapItem; }; class Q_LOCATION_PRIVATE_EXPORT QDeclarativePolylineMapItemPrivate @@ -116,14 +84,9 @@ public: } void regenerateCache(); void updateCache(); - void preserveGeometry() - { - m_geometry.setPreserveGeometry(true, m_poly.m_geopath.boundingGeoRectangle().topLeft()); - } void afterViewportChanged() override { // preserveGeometry is cleared in updateMapItemPaintNode - preserveGeometry(); markSourceDirtyAndUpdate(); } void onMapSet() override @@ -134,13 +97,11 @@ public: void onGeoGeometryChanged() override { regenerateCache(); - preserveGeometry(); markSourceDirtyAndUpdate(); } void onGeoGeometryUpdated() override { updateCache(); - preserveGeometry(); markSourceDirtyAndUpdate(); } void onItemGeometryChanged() override |