diff options
author | Paolo Angelelli <paolo.angelelli@qt.io> | 2017-03-14 13:51:46 +0100 |
---|---|---|
committer | Paolo Angelelli <paolo.angelelli@qt.io> | 2017-03-22 11:13:38 +0000 |
commit | ec1033a1cc24305025f9397ff29b6562a3187eb8 (patch) | |
tree | 651bef1e1871da1654840ca4c3fd9c285ed7a175 /src/location/declarativemaps/qdeclarativecirclemapitem_p.h | |
parent | 172cff4678d26883b822c5486f1da7f33f760575 (diff) | |
download | qtlocation-ec1033a1cc24305025f9397ff29b6562a3187eb8.tar.gz |
Cache coordinate projections in map items
This patch caches the result of geoToMapProjection() for the coordinates
of the map items, regenerating this data only upon coordinate changes.
This allows avoiding to perform a (mercator) projection basically
every time the item has to be drawn, and instead do only the wrapping
around the camera center and the projection to screen
Task-number: QTBUG-59479
Change-Id: Iea5ec04f360d2fe7495cd9c1dd278e83200e0f8d
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/location/declarativemaps/qdeclarativecirclemapitem_p.h')
-rw-r--r-- | src/location/declarativemaps/qdeclarativecirclemapitem_p.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/location/declarativemaps/qdeclarativecirclemapitem_p.h b/src/location/declarativemaps/qdeclarativecirclemapitem_p.h index bcbd67d8..511e3b17 100644 --- a/src/location/declarativemaps/qdeclarativecirclemapitem_p.h +++ b/src/location/declarativemaps/qdeclarativecirclemapitem_p.h @@ -63,7 +63,7 @@ class QGeoMapCircleGeometry : public QGeoMapPolygonGeometry public: QGeoMapCircleGeometry(); - void updateScreenPointsInvert(const QList<QGeoCoordinate> &circlePath, const QGeoMap &map); + void updateScreenPointsInvert(const QList<QDoubleVector2D> &circlePath, const QGeoMap &map); }; class Q_LOCATION_PRIVATE_EXPORT QDeclarativeCircleMapItem : public QDeclarativeGeoMapItemBase @@ -110,16 +110,17 @@ protected Q_SLOTS: virtual void afterViewportChanged(const QGeoMapViewportChangeEvent &event) Q_DECL_OVERRIDE; private: - bool preserveCircleGeometry(QList<QGeoCoordinate> &path, const QGeoCoordinate ¢er, + void updateCirclePath(); + bool preserveCircleGeometry(QList<QDoubleVector2D> &path, const QGeoCoordinate ¢er, qreal distance); - void updateCirclePathForRendering(QList<QGeoCoordinate> &path, const QGeoCoordinate ¢er, + void updateCirclePathForRendering(QList<QDoubleVector2D> &path, const QGeoCoordinate ¢er, qreal distance); private: QGeoCircle circle_; QDeclarativeMapLineProperties border_; QColor color_; - QList<QGeoCoordinate> circlePath_; + QList<QDoubleVector2D> circlePath_; bool dirtyMaterial_; QGeoMapCircleGeometry geometry_; QGeoMapPolylineGeometry borderGeometry_; |