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/qdeclarativepolylinemapitem_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/qdeclarativepolylinemapitem_p.h')
-rw-r--r-- | src/location/declarativemaps/qdeclarativepolylinemapitem_p.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/location/declarativemaps/qdeclarativepolylinemapitem_p.h b/src/location/declarativemaps/qdeclarativepolylinemapitem_p.h index 55703258..90e03b9a 100644 --- a/src/location/declarativemaps/qdeclarativepolylinemapitem_p.h +++ b/src/location/declarativemaps/qdeclarativepolylinemapitem_p.h @@ -91,7 +91,7 @@ public: QGeoMapPolylineGeometry(); void updateSourcePoints(const QGeoMap &map, - const QList<QGeoCoordinate> &path, + const QList<QDoubleVector2D> &path, const QGeoCoordinate geoLeftBound); void updateScreenPoints(const QGeoMap &map, @@ -99,7 +99,7 @@ public: protected: QList<QList<QDoubleVector2D> > clipPath(const QGeoMap &map, - const QList<QGeoCoordinate> &path, + const QList<QDoubleVector2D> &path, QDoubleVector2D &leftBoundWrapped); void pathToScreen(const QGeoMap &map, @@ -162,9 +162,12 @@ protected Q_SLOTS: virtual void afterViewportChanged(const QGeoMapViewportChangeEvent &event) Q_DECL_OVERRIDE; private: + void regenerateCache(); + void updateCache(); void pathPropertyChanged(); QGeoPath geopath_; + QList<QDoubleVector2D> geopathProjected_; QDeclarativeMapLineProperties line_; QColor color_; bool dirtyMaterial_; |