diff options
author | Michal Klocek <michal.klocek@theqtcompany.com> | 2015-07-02 14:04:09 +0200 |
---|---|---|
committer | Michal Klocek <michal.klocek@theqtcompany.com> | 2015-07-03 14:30:24 +0000 |
commit | c64dbfe5531c8291aac620e2b334cd3687e19843 (patch) | |
tree | fd5bc2c10bce84f9b85b8750a4d0b2667f0c14e8 /src/positioning/qgeocoordinate.cpp | |
parent | acd38b1f307788bc9a860c34e008f39720734b85 (diff) | |
download | qtlocation-c64dbfe5531c8291aac620e2b334cd3687e19843.tar.gz |
Cache coordToMercator result during coordinate animations
A calculation of Mercator transformations is expensive.
Cache calculated values in QGeoMercatorCoordinatePrivate.
Caching is only enabled for QGeoCoordinateAnimation.
Default coordinate interpolation does not use caching.
Change-Id: I5fe67e6a3da6e4b01c0e0ad33d1f45a152660937
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/positioning/qgeocoordinate.cpp')
-rw-r--r-- | src/positioning/qgeocoordinate.cpp | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/src/positioning/qgeocoordinate.cpp b/src/positioning/qgeocoordinate.cpp index d061562b..36434eba 100644 --- a/src/positioning/qgeocoordinate.cpp +++ b/src/positioning/qgeocoordinate.cpp @@ -60,11 +60,11 @@ inline static double qgeocoordinate_radToDeg(double rad) } -QGeoCoordinatePrivate::QGeoCoordinatePrivate() { - lat = qQNaN(); - lng = qQNaN(); - alt = qQNaN(); -} +QGeoCoordinatePrivate::QGeoCoordinatePrivate(): + lat(qQNaN()), + lng(qQNaN()), + alt(qQNaN()) +{} QGeoCoordinatePrivate::QGeoCoordinatePrivate(const QGeoCoordinatePrivate &other) : QSharedData(other), @@ -77,6 +77,21 @@ QGeoCoordinatePrivate::~QGeoCoordinatePrivate() {} +QGeoMercatorCoordinatePrivate::QGeoMercatorCoordinatePrivate(): + QGeoCoordinatePrivate(), + m_mercatorX(qQNaN()), + m_mercatorY(qQNaN()) +{} + +QGeoMercatorCoordinatePrivate::QGeoMercatorCoordinatePrivate(const QGeoMercatorCoordinatePrivate &other) + : QGeoCoordinatePrivate(other), + m_mercatorX(other.m_mercatorX), + m_mercatorY(other.m_mercatorY) +{} + +QGeoMercatorCoordinatePrivate::~QGeoMercatorCoordinatePrivate() +{} + /*! \class QGeoCoordinate \inmodule QtPositioning @@ -666,6 +681,11 @@ QString QGeoCoordinate::toString(CoordinateFormat format) const return QString::fromLatin1("%1, %2, %3m").arg(latStr, longStr, QString::number(d->alt)); } +QGeoCoordinate::QGeoCoordinate(QGeoCoordinatePrivate &dd): + d(&dd) +{ +} + #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug dbg, const QGeoCoordinate &coord) { |