diff options
author | Paolo Angelelli <paolo.angelelli@qt.io> | 2018-04-26 10:37:48 +0200 |
---|---|---|
committer | Paolo Angelelli <paolo.angelelli@qt.io> | 2018-04-26 10:37:59 +0200 |
commit | e328d63a0291069dc0948e7c08e1db7aed269f9e (patch) | |
tree | b49c4f6b5f006125a6a88e42d19a7de1eb74dc88 /src/positioning | |
parent | 5457317c0ffbbb7e0c285a6899709be78f693b87 (diff) | |
parent | d44838125389720e4352dd51ad1da02f4cb58dc8 (diff) | |
download | qtlocation-e328d63a0291069dc0948e7c08e1db7aed269f9e.tar.gz |
Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: I566c63a233b2b53e89a2ce288bafd8a9a06cc86c
Diffstat (limited to 'src/positioning')
-rw-r--r-- | src/positioning/qdoublevector2d_p.h | 6 | ||||
-rw-r--r-- | src/positioning/qgeocoordinate.cpp | 46 | ||||
-rw-r--r-- | src/positioning/qgeocoordinate.h | 13 | ||||
-rw-r--r-- | src/positioning/qgeopath.cpp | 10 | ||||
-rw-r--r-- | src/positioning/qwebmercator.cpp | 24 | ||||
-rw-r--r-- | src/positioning/qwebmercator_p.h | 1 |
6 files changed, 13 insertions, 87 deletions
diff --git a/src/positioning/qdoublevector2d_p.h b/src/positioning/qdoublevector2d_p.h index e944d2f4..92ccfe85 100644 --- a/src/positioning/qdoublevector2d_p.h +++ b/src/positioning/qdoublevector2d_p.h @@ -73,6 +73,7 @@ public: Q_DECL_CONSTEXPR inline double manhattanLength() const; inline bool isNull() const; + inline bool isFinite() const; Q_DECL_CONSTEXPR inline double x() const; Q_DECL_CONSTEXPR inline double y() const; @@ -136,6 +137,11 @@ inline bool QDoubleVector2D::isNull() const return qIsNull(xp) && qIsNull(yp); } +inline bool QDoubleVector2D::isFinite() const +{ + return qIsFinite(xp) && qIsFinite(yp); +} + Q_DECL_CONSTEXPR inline double QDoubleVector2D::x() const { return xp; } Q_DECL_CONSTEXPR inline double QDoubleVector2D::y() const { return yp; } diff --git a/src/positioning/qgeocoordinate.cpp b/src/positioning/qgeocoordinate.cpp index 4353d214..80904d7c 100644 --- a/src/positioning/qgeocoordinate.cpp +++ b/src/positioning/qgeocoordinate.cpp @@ -39,7 +39,6 @@ #include "qgeocoordinate.h" #include "qgeocoordinate_p.h" #include "qlocationutils_p.h" -#include "qgeocoordinateobject_p.h" #include <QDateTime> #include <QHash> @@ -251,16 +250,6 @@ QGeoCoordinate::QGeoCoordinate(const QGeoCoordinate &other) : d(other.d) {} -QGeoCoordinate::QGeoCoordinate(const QGeoCoordinateObject &coordinateoObject) : d(coordinateoObject.coordinate().d) -{ -} - -QGeoCoordinate::QGeoCoordinate(const QGeoCoordinateObject *coordinateObject) : d(new QGeoCoordinatePrivate) -{ - if (coordinateObject) - d = coordinateObject->coordinate().d; -} - /*! Assigns \a other to this coordinate and returns a reference to this coordinate. */ @@ -274,24 +263,6 @@ QGeoCoordinate &QGeoCoordinate::operator=(const QGeoCoordinate &other) } /*! - \fn QGeoCoordinate &QGeoCoordinate::operator=(const QGeoCoordinateObject &coordinateoObject) - \fn QGeoCoordinate &QGeoCoordinate::operator=(const QGeoCoordinateObject *coordinateoObject) - - Assigns \a coordinateoObject to this coordinate and returns a reference to this coordinate. -*/ -QGeoCoordinate &QGeoCoordinate::operator=(const QGeoCoordinateObject &coordinateoObject) -{ - d = coordinateoObject.coordinate().d; - return (*this); -} - -QGeoCoordinate &QGeoCoordinate::operator=(const QGeoCoordinateObject *coordinateoObject) -{ - d = coordinateoObject->coordinate().d; - return (*this); -} - -/*! Destroys the coordinate object. */ QGeoCoordinate::~QGeoCoordinate() @@ -320,23 +291,6 @@ bool QGeoCoordinate::operator==(const QGeoCoordinate &other) const } /*! - \fn bool QGeoCoordinate::operator==(const QGeoCoordinateObject &other) const - \fn bool QGeoCoordinate::operator==(const QGeoCoordinateObject *other) const - - Returns \c true if latitude, longitude, and altitude of this - coordinate are identical to \a other. -*/ -bool QGeoCoordinate::operator==(const QGeoCoordinateObject &other) const -{ - return (*this == other.coordinate()); -} - -bool QGeoCoordinate::operator==(const QGeoCoordinateObject *other) const -{ - return (*this == other->coordinate()); -} - -/*! \fn bool QGeoCoordinate::operator!=(const QGeoCoordinate &other) const \fn bool QGeoCoordinate::operator!=(const QGeoCoordinateObject &other) const \fn bool QGeoCoordinate::operator!=(const QGeoCoordinateObject *other) const diff --git a/src/positioning/qgeocoordinate.h b/src/positioning/qgeocoordinate.h index c5497dae..ddb6274e 100644 --- a/src/positioning/qgeocoordinate.h +++ b/src/positioning/qgeocoordinate.h @@ -51,7 +51,6 @@ class QDebug; class QDataStream; class QGeoCoordinatePrivate; -class QGeoCoordinateObject; class Q_POSITIONING_EXPORT QGeoCoordinate { Q_GADGET @@ -82,26 +81,14 @@ public: QGeoCoordinate(double latitude, double longitude); QGeoCoordinate(double latitude, double longitude, double altitude); QGeoCoordinate(const QGeoCoordinate &other); - QGeoCoordinate(const QGeoCoordinateObject &coordinateoObject); - QGeoCoordinate(const QGeoCoordinateObject *coordinateObject); ~QGeoCoordinate(); QGeoCoordinate &operator=(const QGeoCoordinate &other); - QGeoCoordinate &operator=(const QGeoCoordinateObject &coordinateObject); - QGeoCoordinate &operator=(const QGeoCoordinateObject *coordinateoObject); bool operator==(const QGeoCoordinate &other) const; - bool operator==(const QGeoCoordinateObject &other) const; - bool operator==(const QGeoCoordinateObject *other) const; inline bool operator!=(const QGeoCoordinate &other) const { return !operator==(other); } - inline bool operator!=(const QGeoCoordinateObject &other) const { - return !operator==(other); - } - inline bool operator!=(const QGeoCoordinateObject *other) const { - return !operator==(*other); - } bool isValid() const; CoordinateType type() const; diff --git a/src/positioning/qgeopath.cpp b/src/positioning/qgeopath.cpp index 592933a9..94a14ad1 100644 --- a/src/positioning/qgeopath.cpp +++ b/src/positioning/qgeopath.cpp @@ -73,15 +73,19 @@ QT_BEGIN_NAMESPACE This class is a \l Q_GADGET. It can be \l{Cpp_value_integration_positioning}{directly used from C++ and QML}. + + A QGeoPath is both invalid and empty if it contains no coordinate. + + \note A default constructed QGeoPath is both invalid and empty as it does not contain any coordinates. */ /*! \property QGeoPath::path \brief This property holds the list of coordinates for the geo path. - The path is both invalid and empty if it contains no coordinate. - - A default constructed QGeoPath is therefore invalid. + \note The coordinates cannot be processed in place. To change the value + of this property, retrieve the complete list of coordinates, process them, + and assign the new value to the property. */ inline QGeoPathPrivate *QGeoPath::d_func() diff --git a/src/positioning/qwebmercator.cpp b/src/positioning/qwebmercator.cpp index b8abac2b..0aad4100 100644 --- a/src/positioning/qwebmercator.cpp +++ b/src/positioning/qwebmercator.cpp @@ -100,30 +100,6 @@ QGeoCoordinate QWebMercator::mercatorToCoord(const QDoubleVector2D &mercator) return QGeoCoordinate(lat, lng, 0.0); } -QGeoCoordinate QWebMercator::mercatorToCoordClamped(const QDoubleVector2D &mercator) -{ - double fx = mercator.x(); - double fy = mercator.y(); - - if (fy < 0.0) - fy = 0.0; - else if (fy > 1.0) - fy = 1.0; - - double lat = qRadiansToDegrees(2.0 * std::atan(std::exp(M_PI * (1.0 - 2.0 * fy))) - (M_PI / 2.0)); - - double lng; - if (fx >= 0) { - lng = realmod(fx, 1.0); - } else { - lng = realmod(1.0 - realmod(-1.0 * fx, 1.0), 1.0); - } - - lng = lng * 360.0 - 180.0; - - return QGeoCoordinate(lat, lng, 0.0); -} - QGeoCoordinate QWebMercator::coordinateInterpolation(const QGeoCoordinate &from, const QGeoCoordinate &to, qreal progress) { QDoubleVector2D s = QWebMercator::coordToMercator(from); diff --git a/src/positioning/qwebmercator_p.h b/src/positioning/qwebmercator_p.h index 52a5e040..109f0730 100644 --- a/src/positioning/qwebmercator_p.h +++ b/src/positioning/qwebmercator_p.h @@ -64,7 +64,6 @@ class Q_POSITIONING_PRIVATE_EXPORT QWebMercator public: static QDoubleVector2D coordToMercator(const QGeoCoordinate &coord); static QGeoCoordinate mercatorToCoord(const QDoubleVector2D &mercator); - static QGeoCoordinate mercatorToCoordClamped(const QDoubleVector2D &mercator); static QGeoCoordinate coordinateInterpolation(const QGeoCoordinate &from, const QGeoCoordinate &to, qreal progress); private: |