summaryrefslogtreecommitdiff
path: root/src/location/quickmapitems/qdeclarativecirclemapitem_p_p.h
diff options
context:
space:
mode:
authorMatthias Rauter <matthias.rauter@qt.io>2023-02-22 18:23:44 +0100
committerMatthias Rauter <matthias.rauter@qt.io>2023-04-11 07:59:01 +0100
commitbd3ca9bd2158c2271cc76173fd747679d7fbd76c (patch)
tree9fee399b8d4d8ff084fc5e42d86086741b1087eb /src/location/quickmapitems/qdeclarativecirclemapitem_p_p.h
parentfbe6f3f4b9456467baa772c6efe40b80aefd1414 (diff)
downloadqtlocation-bd3ca9bd2158c2271cc76173fd747679d7fbd76c.tar.gz
Polygons/lines can now be rendered following the shortest path on the globe
This is enabled by interpolating the lines of polygons and paths. The interpolating is done following the greater circle navigation and the connection between corners of the polygon appear curved on the projected map. This behavior can be turned on by setting a new property, called referenceSurface. It can be set to ReferenceSurface.Map, drawing paths as lines on the map or to ReferenceSurface.Globe, drawing path on the globe leading to curves on the map. It is set to ReferenceSurface.Map on default, reproducing the old implementation for polygons, polylines and rectangles. The circle item was already using the great circle path before this change. Its standard implementation was changed to draw a circle in map coordinates with approximated radius. This should be sufficient for many cases. To get the old implementation, referenceSurface has to be set to ReferenceSurface.Map. Fixes: QTBUG-94785 Change-Id: Ifdd1597a7116c3d220462f063656b04becb6422f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/location/quickmapitems/qdeclarativecirclemapitem_p_p.h')
-rw-r--r--src/location/quickmapitems/qdeclarativecirclemapitem_p_p.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/location/quickmapitems/qdeclarativecirclemapitem_p_p.h b/src/location/quickmapitems/qdeclarativecirclemapitem_p_p.h
index 117dcb63..ee6e8d57 100644
--- a/src/location/quickmapitems/qdeclarativecirclemapitem_p_p.h
+++ b/src/location/quickmapitems/qdeclarativecirclemapitem_p_p.h
@@ -62,7 +62,10 @@ public:
m_circlePath.clear();
const QGeoProjectionWebMercator &p = static_cast<const QGeoProjectionWebMercator&>(m_circle.map()->geoProjection());
- calculatePeripheralPoints(m_circlePath, m_circle.center(), m_circle.radius(), p, CircleSamples);
+ if (m_circle.referenceSurface() == QLocation::ReferenceSurface::Map)
+ calculatePeripheralPointsSimple(m_circlePath, m_circle.center(), m_circle.radius(), p, CircleSamples);
+ else
+ calculatePeripheralPointsGreatCircle(m_circlePath, m_circle.center(), m_circle.radius(), p, CircleSamples);
}
static int crossEarthPole(const QGeoCoordinate &center, qreal distance);
@@ -70,7 +73,10 @@ public:
static void includeOnePoleInPath(QList<QDoubleVector2D> &path, const QGeoCoordinate &center,
qreal distance, const QGeoProjectionWebMercator &p);
- static void calculatePeripheralPoints(QList<QDoubleVector2D> &path, const QGeoCoordinate &center,
+ static void calculatePeripheralPointsSimple(QList<QDoubleVector2D> &path, const QGeoCoordinate &center,
+ qreal distance, const QGeoProjectionWebMercator &p, int steps);
+
+ static void calculatePeripheralPointsGreatCircle(QList<QDoubleVector2D> &path, const QGeoCoordinate &center,
qreal distance, const QGeoProjectionWebMercator &p, int steps);
QDeclarativeCircleMapItem &m_circle;