summaryrefslogtreecommitdiff
path: root/src/location/labs/qsg/qmapcircleobjectqsg_p_p.h
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli.qt@gmail.com>2019-12-27 22:39:47 +0100
committerpaolo <paolo.angelelli.qt@gmail.com>2020-02-11 19:35:35 +0100
commita4469cad4041f21e640efa9ca5d0b192dd702955 (patch)
treea6f40549c8679410f65ad84446a69b19b918d75d /src/location/labs/qsg/qmapcircleobjectqsg_p_p.h
parente82c41d35ddd6ef0d14e1d01ea1dfd46742bc0fe (diff)
downloadqtlocation-a4469cad4041f21e640efa9ca5d0b192dd702955.tar.gz
Port Map*ObjectPrivateQSG to the shader-based projection geometriesv5.15.0-alpha1
This patch changes the implementation of the scenegraph-based mapobjects (those created by QGeoTiledMap) to be the recently introduced one sporting shader-based map projection. This is much faster than the previous, but may introduce small glitches at this time (mostly on minified polylines). Adding polyline LOD simplification will solve this problem. Compared to equivalent Map Items (that is, Map Items backed by the same underlying implementation), map objects now are approximately 1.5x faster. This measure has been gathered using medium-size polygons (contained in the file 10_countries.json from the geojson_viewer example). The difference is caused by the additional QtQuick geometry related operations (essentially projecting the bounding box for each item) present in MapItems. Smaller polygons may therefore yield larger improvements, larger polygons the opposite. Change-Id: I3fc92b02b74a3a4d001e69755949a98f80d8a3d3 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/location/labs/qsg/qmapcircleobjectqsg_p_p.h')
-rw-r--r--src/location/labs/qsg/qmapcircleobjectqsg_p_p.h40
1 files changed, 38 insertions, 2 deletions
diff --git a/src/location/labs/qsg/qmapcircleobjectqsg_p_p.h b/src/location/labs/qsg/qmapcircleobjectqsg_p_p.h
index 6bbeb397..dc057c0b 100644
--- a/src/location/labs/qsg/qmapcircleobjectqsg_p_p.h
+++ b/src/location/labs/qsg/qmapcircleobjectqsg_p_p.h
@@ -68,14 +68,22 @@ public:
QMapCircleObjectPrivateQSG(const QMapCircleObjectPrivate &other);
~QMapCircleObjectPrivateQSG() override;
- void updateCirclePath();
-
// QQSGMapObject
void updateGeometry() override;
+ void updateGeometryCPU();
+ void updateGeometryGL();
QSGNode *updateMapObjectNode(QSGNode *oldNode,
VisibleNode **visibleNode,
QSGNode *root,
QQuickWindow *window) override;
+ QSGNode *updateMapObjectNodeCPU(QSGNode *oldNode,
+ VisibleNode **visibleNode,
+ QSGNode *root,
+ QQuickWindow *window);
+ QSGNode *updateMapObjectNodeGL(QSGNode *oldNode,
+ VisibleNode **visibleNode,
+ QSGNode *root,
+ QQuickWindow *window);
// QGeoMapCirclePrivate interface
void setCenter(const QGeoCoordinate &center) override;
@@ -87,15 +95,43 @@ public:
// QGeoMapObjectPrivate
QGeoMapObjectPrivate *clone() override;
+ void switchToGL();
+ void switchToCPU();
+
public:
// Data Members
+struct CircleDataCPU {
+ MapPolygonNode *m_node = nullptr;
QList<QDoubleVector2D> m_circlePath;
QGeoCoordinate m_leftBound;
QGeoMapCircleGeometry m_geometry;
QGeoMapPolylineGeometry m_borderGeometry;
bool m_updatingGeometry = false;
+
+ void updateCirclePath(const QGeoCoordinate &center, qreal radius, const QGeoProjectionWebMercator &p);
+};
+struct CircleDataGL {
+ QList<QGeoCoordinate> m_circlePath;
+ QGeoCoordinate m_leftBound;
+ QDoubleVector2D m_leftBoundMercator;
+ QGeoMapPolygonGeometryOpenGL m_geometry;
+ QGeoMapPolylineGeometryOpenGL m_borderGeometry;
+ QDeclarativePolygonMapItemPrivateOpenGL::RootNode *m_rootNode = nullptr;
+ MapPolygonNodeGL *m_node = nullptr;
+ MapPolylineNodeOpenGLExtruded *m_polylinenode = nullptr;
+
+ void updateCirclePath(const QGeoCoordinate &center, qreal radius, const QGeoProjectionWebMercator &p);
+ void markSourceDirty()
+ {
+ m_geometry.markSourceDirty();
+ m_borderGeometry.markSourceDirty();
+ }
+};
+ QScopedPointer<CircleDataCPU> m_dataCPU;
+ QScopedPointer<CircleDataGL> m_dataGL;
};
QT_END_NAMESPACE
#endif // QMAPCIRCLEOBJECT_P_P_H
+