diff options
Diffstat (limited to 'src/location')
23 files changed, 60 insertions, 1413 deletions
diff --git a/src/location/location.pro b/src/location/location.pro index c09ea06f..d3ecd5ad 100644 --- a/src/location/location.pro +++ b/src/location/location.pro @@ -1,5 +1,5 @@ TARGET = QtLocation -QT = core-private positioning +QT = core-private positioning-private QMAKE_DOCS = $$PWD/doc/qtlocation.qdocconf diff --git a/src/location/maps/maps.pri b/src/location/maps/maps.pri index dda60622..3a43c5ea 100644 --- a/src/location/maps/maps.pri +++ b/src/location/maps/maps.pri @@ -18,15 +18,12 @@ PUBLIC_HEADERS += \ maps/qgeoserviceprovider.h PRIVATE_HEADERS += \ - maps/qdoublevector2d_p.h \ - maps/qdoublevector3d_p.h \ maps/qgeocameracapabilities_p.h \ maps/qgeocameradata_p.h \ maps/qgeocameratiles_p.h \ maps/qgeocodereply_p.h \ maps/qgeocodingmanagerengine_p.h \ maps/qgeocodingmanager_p.h \ - maps/qgeocoordinateinterpolator_p.h \ maps/qgeomaneuver_p.h \ maps/qgeomapcontroller_p.h \ maps/qgeomapscene_p.h \ @@ -46,7 +43,6 @@ PRIVATE_HEADERS += \ maps/qgeotiledmappingmanagerengine_p_p.h \ maps/qgeomaptype_p.h \ maps/qgeomaptype_p_p.h \ - maps/qgeoprojection_p.h \ maps/qgeoroute_p.h \ maps/qgeoroutereply_p.h \ maps/qgeorouterequest_p.h \ @@ -62,15 +58,12 @@ PRIVATE_HEADERS += \ maps/qcache3q_p.h SOURCES += \ - maps/qdoublevector2d.cpp \ - maps/qdoublevector3d.cpp \ maps/qgeocameracapabilities.cpp \ maps/qgeocameradata.cpp \ maps/qgeocameratiles.cpp \ maps/qgeocodereply.cpp \ maps/qgeocodingmanager.cpp \ maps/qgeocodingmanagerengine.cpp \ - maps/qgeocoordinateinterpolator.cpp \ maps/qgeomaneuver.cpp \ maps/qgeomapcontroller.cpp \ maps/qgeomapscene.cpp \ @@ -83,7 +76,6 @@ SOURCES += \ maps/qgeotiledmappingmanagerengine.cpp \ maps/qgeotilefetcher.cpp \ maps/qgeomaptype.cpp \ - maps/qgeoprojection.cpp \ maps/qgeoroute.cpp \ maps/qgeoroutereply.cpp \ maps/qgeorouterequest.cpp \ diff --git a/src/location/maps/qdoublevector2d.cpp b/src/location/maps/qdoublevector2d.cpp deleted file mode 100644 index 589289f7..00000000 --- a/src/location/maps/qdoublevector2d.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdoublevector2d_p.h" -#include "qdoublevector3d_p.h" -#include <QtCore/qdatastream.h> -#include <QtCore/qdebug.h> -#include <QtCore/qmath.h> - -QT_BEGIN_NAMESPACE - -QDoubleVector2D::QDoubleVector2D(const QDoubleVector3D &vector) -{ - xp = vector.xp; - yp = vector.yp; -} - -double QDoubleVector2D::length() const -{ - return qSqrt(xp * xp + yp * yp); -} - -double QDoubleVector2D::lengthSquared() const -{ - return xp * xp + yp * yp; -} - -QDoubleVector2D QDoubleVector2D::normalized() const -{ - // Need some extra precision if the length is very small. - double len = double(xp) * double(xp) + - double(yp) * double(yp); - if (qFuzzyIsNull(len - 1.0)) - return *this; - else if (!qFuzzyIsNull(len)) - return *this / (double)qSqrt(len); - else - return QDoubleVector2D(); -} - -void QDoubleVector2D::normalize() -{ - // Need some extra precision if the length is very small. - double len = double(xp) * double(xp) + - double(yp) * double(yp); - if (qFuzzyIsNull(len - 1.0) || qFuzzyIsNull(len)) - return; - - len = qSqrt(len); - - xp /= len; - yp /= len; -} - -double QDoubleVector2D::dotProduct(const QDoubleVector2D &v1, const QDoubleVector2D &v2) -{ - return v1.xp * v2.xp + v1.yp * v2.yp; -} - -QDoubleVector3D QDoubleVector2D::toVector3D() const -{ - return QDoubleVector3D(xp, yp, 0.0); -} - -#ifndef QT_NO_DEBUG_STREAM - -QDebug operator<<(QDebug dbg, const QDoubleVector2D &vector) -{ - dbg.nospace() << "QDoubleVector2D(" << vector.x() << ", " << vector.y() << ')'; - return dbg.space(); -} - -#endif - -#ifndef QT_NO_DATASTREAM - -QDataStream &operator<<(QDataStream &stream, const QDoubleVector2D &vector) -{ - stream << double(vector.x()) << double(vector.y()); - return stream; -} - -QDataStream &operator>>(QDataStream &stream, QDoubleVector2D &vector) -{ - double x, y; - stream >> x; - stream >> y; - vector.setX(double(x)); - vector.setY(double(y)); - return stream; -} - -#endif // QT_NO_DATASTREAM - -QT_END_NAMESPACE diff --git a/src/location/maps/qdoublevector2d_p.h b/src/location/maps/qdoublevector2d_p.h deleted file mode 100644 index f66a95a2..00000000 --- a/src/location/maps/qdoublevector2d_p.h +++ /dev/null @@ -1,236 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDOUBLEVECTOR2D_P_H -#define QDOUBLEVECTOR2D_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QVector2D> - -#include <QtCore/qmetatype.h> - -QT_BEGIN_NAMESPACE - -class QDoubleVector3D; - -class QDoubleVector2D -{ -public: - QDoubleVector2D(); - explicit QDoubleVector2D(const QVector2D &vector); - QDoubleVector2D(double xpos, double ypos); - explicit QDoubleVector2D(const QDoubleVector3D &vector); - - operator QVector2D() const; - - bool isNull() const; - - double x() const; - double y() const; - - void setX(double x); - void setY(double y); - - double length() const; - double lengthSquared() const; - - QDoubleVector2D normalized() const; - void normalize(); - - QDoubleVector2D &operator+=(const QDoubleVector2D &vector); - QDoubleVector2D &operator-=(const QDoubleVector2D &vector); - QDoubleVector2D &operator*=(double factor); - QDoubleVector2D &operator*=(const QDoubleVector2D &vector); - QDoubleVector2D &operator/=(double divisor); - - static double dotProduct(const QDoubleVector2D &v1, const QDoubleVector2D &v2); - - friend inline bool operator==(const QDoubleVector2D &v1, const QDoubleVector2D &v2); - friend inline bool operator!=(const QDoubleVector2D &v1, const QDoubleVector2D &v2); - friend inline const QDoubleVector2D operator+(const QDoubleVector2D &v1, const QDoubleVector2D &v2); - friend inline const QDoubleVector2D operator-(const QDoubleVector2D &v1, const QDoubleVector2D &v2); - friend inline const QDoubleVector2D operator*(double factor, const QDoubleVector2D &vector); - friend inline const QDoubleVector2D operator*(const QDoubleVector2D &vector, double factor); - friend inline const QDoubleVector2D operator*(const QDoubleVector2D &v1, const QDoubleVector2D &v2); - friend inline const QDoubleVector2D operator-(const QDoubleVector2D &vector); - friend inline const QDoubleVector2D operator/(const QDoubleVector2D &vector, double divisor); - - friend inline bool qFuzzyCompare(const QDoubleVector2D &v1, const QDoubleVector2D &v2); - - QDoubleVector3D toVector3D() const; - -private: - double xp, yp; - - friend class QDoubleVector3D; -}; - -Q_DECLARE_TYPEINFO(QDoubleVector2D, Q_MOVABLE_TYPE); - -inline QDoubleVector2D::QDoubleVector2D() : xp(0.0), yp(0.0) {} - -inline QDoubleVector2D::QDoubleVector2D(const QVector2D &vector) : xp(vector.x()), yp(vector.y()) {} - -inline QDoubleVector2D::QDoubleVector2D(double xpos, double ypos) : xp(xpos), yp(ypos) {} - -inline QDoubleVector2D::operator QVector2D() const -{ - return QVector2D(xp, yp); -} - -inline bool QDoubleVector2D::isNull() const -{ - return qIsNull(xp) && qIsNull(yp); -} - -inline double QDoubleVector2D::x() const { return double(xp); } -inline double QDoubleVector2D::y() const { return double(yp); } - -inline void QDoubleVector2D::setX(double aX) { xp = aX; } -inline void QDoubleVector2D::setY(double aY) { yp = aY; } - -inline QDoubleVector2D &QDoubleVector2D::operator+=(const QDoubleVector2D &vector) -{ - xp += vector.xp; - yp += vector.yp; - return *this; -} - -inline QDoubleVector2D &QDoubleVector2D::operator-=(const QDoubleVector2D &vector) -{ - xp -= vector.xp; - yp -= vector.yp; - return *this; -} - -inline QDoubleVector2D &QDoubleVector2D::operator*=(double factor) -{ - xp *= factor; - yp *= factor; - return *this; -} - -inline QDoubleVector2D &QDoubleVector2D::operator*=(const QDoubleVector2D &vector) -{ - xp *= vector.xp; - yp *= vector.yp; - return *this; -} - -inline QDoubleVector2D &QDoubleVector2D::operator/=(double divisor) -{ - xp /= divisor; - yp /= divisor; - return *this; -} - -inline bool operator==(const QDoubleVector2D &v1, const QDoubleVector2D &v2) -{ - return v1.xp == v2.xp && v1.yp == v2.yp; -} - -inline bool operator!=(const QDoubleVector2D &v1, const QDoubleVector2D &v2) -{ - return v1.xp != v2.xp || v1.yp != v2.yp; -} - -inline const QDoubleVector2D operator+(const QDoubleVector2D &v1, const QDoubleVector2D &v2) -{ - return QDoubleVector2D(v1.xp + v2.xp, v1.yp + v2.yp); -} - -inline const QDoubleVector2D operator-(const QDoubleVector2D &v1, const QDoubleVector2D &v2) -{ - return QDoubleVector2D(v1.xp - v2.xp, v1.yp - v2.yp); -} - -inline const QDoubleVector2D operator*(double factor, const QDoubleVector2D &vector) -{ - return QDoubleVector2D(vector.xp * factor, vector.yp * factor); -} - -inline const QDoubleVector2D operator*(const QDoubleVector2D &vector, double factor) -{ - return QDoubleVector2D(vector.xp * factor, vector.yp * factor); -} - -inline const QDoubleVector2D operator*(const QDoubleVector2D &v1, const QDoubleVector2D &v2) -{ - return QDoubleVector2D(v1.xp * v2.xp, v1.yp * v2.yp); -} - -inline const QDoubleVector2D operator-(const QDoubleVector2D &vector) -{ - return QDoubleVector2D(-vector.xp, -vector.yp); -} - -inline const QDoubleVector2D operator/(const QDoubleVector2D &vector, double divisor) -{ - return QDoubleVector2D(vector.xp / divisor, vector.yp / divisor); -} - -inline bool qFuzzyCompare(const QDoubleVector2D &v1, const QDoubleVector2D &v2) -{ - return qFuzzyCompare(v1.xp, v2.xp) && qFuzzyCompare(v1.yp, v2.yp); -} - -#ifndef QT_NO_DEBUG_STREAM -QDebug operator<<(QDebug dbg, const QDoubleVector2D &vector); -#endif - -#ifndef QT_NO_DATASTREAM -QDataStream &operator<<(QDataStream &, const QDoubleVector2D &); -QDataStream &operator>>(QDataStream &, QDoubleVector2D &); -#endif - -QT_END_NAMESPACE - -#endif diff --git a/src/location/maps/qdoublevector3d.cpp b/src/location/maps/qdoublevector3d.cpp deleted file mode 100644 index d35e4848..00000000 --- a/src/location/maps/qdoublevector3d.cpp +++ /dev/null @@ -1,188 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdoublevector3d_p.h" -#include "qdoublevector2d_p.h" -#include <QtCore/qdatastream.h> -#include <QtCore/qmath.h> -#include <QtCore/qdebug.h> - -QT_BEGIN_NAMESPACE - -QDoubleVector3D::QDoubleVector3D(const QDoubleVector2D &vector) -{ - xp = vector.xp; - yp = vector.yp; - zp = 0.0; -} - -QDoubleVector3D::QDoubleVector3D(const QDoubleVector2D &vector, double zpos) -{ - xp = vector.xp; - yp = vector.yp; - zp = zpos; -} - -QDoubleVector3D QDoubleVector3D::normalized() const -{ - // Need some extra precision if the length is very small. - double len = double(xp) * double(xp) + - double(yp) * double(yp) + - double(zp) * double(zp); - if (qFuzzyIsNull(len - 1.0)) - return *this; - else if (!qFuzzyIsNull(len)) - return *this / (double)qSqrt(len); - else - return QDoubleVector3D(); -} - -void QDoubleVector3D::normalize() -{ - // Need some extra precision if the length is very small. - double len = double(xp) * double(xp) + - double(yp) * double(yp) + - double(zp) * double(zp); - if (qFuzzyIsNull(len - 1.0) || qFuzzyIsNull(len)) - return; - - len = qSqrt(len); - - xp /= len; - yp /= len; - zp /= len; -} - -double QDoubleVector3D::dotProduct(const QDoubleVector3D &v1, const QDoubleVector3D &v2) -{ - return v1.xp * v2.xp + v1.yp * v2.yp + v1.zp * v2.zp; -} - -QDoubleVector3D QDoubleVector3D::crossProduct(const QDoubleVector3D &v1, const QDoubleVector3D &v2) -{ - return QDoubleVector3D(v1.yp * v2.zp - v1.zp * v2.yp, - v1.zp * v2.xp - v1.xp * v2.zp, - v1.xp * v2.yp - v1.yp * v2.xp); -} - -QDoubleVector3D QDoubleVector3D::normal(const QDoubleVector3D &v1, const QDoubleVector3D &v2) -{ - return crossProduct(v1, v2).normalized(); -} - -QDoubleVector3D QDoubleVector3D::normal - (const QDoubleVector3D &v1, const QDoubleVector3D &v2, const QDoubleVector3D &v3) -{ - return crossProduct((v2 - v1), (v3 - v1)).normalized(); -} - -double QDoubleVector3D::distanceToPlane - (const QDoubleVector3D &plane, const QDoubleVector3D &normal) const -{ - return dotProduct(*this - plane, normal); -} - -double QDoubleVector3D::distanceToPlane - (const QDoubleVector3D &plane1, const QDoubleVector3D &plane2, const QDoubleVector3D &plane3) const -{ - QDoubleVector3D n = normal(plane2 - plane1, plane3 - plane1); - return dotProduct(*this - plane1, n); -} - -double QDoubleVector3D::distanceToLine - (const QDoubleVector3D &point, const QDoubleVector3D &direction) const -{ - if (direction.isNull()) - return (*this - point).length(); - QDoubleVector3D p = point + dotProduct(*this - point, direction) * direction; - return (*this - p).length(); -} - -QDoubleVector2D QDoubleVector3D::toVector2D() const -{ - return QDoubleVector2D(xp, yp); -} - -double QDoubleVector3D::length() const -{ - return qSqrt(xp * xp + yp * yp + zp * zp); -} - -double QDoubleVector3D::lengthSquared() const -{ - return xp * xp + yp * yp + zp * zp; -} - -#ifndef QT_NO_DEBUG_STREAM - -QDebug operator<<(QDebug dbg, const QDoubleVector3D &vector) -{ - dbg.nospace() << "QDoubleVector3D(" - << vector.x() << ", " << vector.y() << ", " << vector.z() << ')'; - return dbg.space(); -} - -#endif - -#ifndef QT_NO_DATASTREAM - -QDataStream &operator<<(QDataStream &stream, const QDoubleVector3D &vector) -{ - stream << double(vector.x()) << double(vector.y()) - << double(vector.z()); - return stream; -} - -QDataStream &operator>>(QDataStream &stream, QDoubleVector3D &vector) -{ - double x, y, z; - stream >> x; - stream >> y; - stream >> z; - vector.setX(double(x)); - vector.setY(double(y)); - vector.setZ(double(z)); - return stream; -} - -#endif // QT_NO_DATASTREAM - -QT_END_NAMESPACE diff --git a/src/location/maps/qdoublevector3d_p.h b/src/location/maps/qdoublevector3d_p.h deleted file mode 100644 index e237287d..00000000 --- a/src/location/maps/qdoublevector3d_p.h +++ /dev/null @@ -1,290 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDOUBLEVECTOR3D_P_H -#define QDOUBLEVECTOR3D_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QVector3D> - -#include <QtCore/qmetatype.h> - -QT_BEGIN_NAMESPACE - -class QDoubleVector2D; - -class QDoubleVector3D -{ -public: - QDoubleVector3D(); - QDoubleVector3D(double xpos, double ypos, double zpos); - explicit QDoubleVector3D(const QVector3D &vector); - QDoubleVector3D(const QDoubleVector2D &vector); - QDoubleVector3D(const QDoubleVector2D &vector, double zpos); - - operator QVector3D() const; - - bool isNull() const; - - double x() const; - double y() const; - double z() const; - - void setX(double x); - void setY(double y); - void setZ(double z); - - double get(int i) const; - void set(int i, double value); - - double length() const; - double lengthSquared() const; - - QDoubleVector3D normalized() const; - void normalize(); - - QDoubleVector3D &operator+=(const QDoubleVector3D &vector); - QDoubleVector3D &operator-=(const QDoubleVector3D &vector); - QDoubleVector3D &operator*=(double factor); - QDoubleVector3D &operator*=(const QDoubleVector3D &vector); - QDoubleVector3D &operator/=(double divisor); - - static double dotProduct(const QDoubleVector3D &v1, const QDoubleVector3D &v2); - static QDoubleVector3D crossProduct(const QDoubleVector3D &v1, const QDoubleVector3D &v2); - static QDoubleVector3D normal(const QDoubleVector3D &v1, const QDoubleVector3D &v2); - static QDoubleVector3D normal - (const QDoubleVector3D &v1, const QDoubleVector3D &v2, const QDoubleVector3D &v3); - - double distanceToPlane(const QDoubleVector3D &plane, const QDoubleVector3D &normal) const; - double distanceToPlane(const QDoubleVector3D &plane1, const QDoubleVector3D &plane2, const QDoubleVector3D &plane3) const; - double distanceToLine(const QDoubleVector3D &point, const QDoubleVector3D &direction) const; - - friend inline bool operator==(const QDoubleVector3D &v1, const QDoubleVector3D &v2); - friend inline bool operator!=(const QDoubleVector3D &v1, const QDoubleVector3D &v2); - friend inline const QDoubleVector3D operator+(const QDoubleVector3D &v1, const QDoubleVector3D &v2); - friend inline const QDoubleVector3D operator-(const QDoubleVector3D &v1, const QDoubleVector3D &v2); - friend inline const QDoubleVector3D operator*(double factor, const QDoubleVector3D &vector); - friend inline const QDoubleVector3D operator*(const QDoubleVector3D &vector, double factor); - friend const QDoubleVector3D operator*(const QDoubleVector3D &v1, const QDoubleVector3D &v2); - friend inline const QDoubleVector3D operator-(const QDoubleVector3D &vector); - friend inline const QDoubleVector3D operator/(const QDoubleVector3D &vector, double divisor); - - friend inline bool qFuzzyCompare(const QDoubleVector3D &v1, const QDoubleVector3D &v2); - - QDoubleVector2D toVector2D() const; - -private: - double xp, yp, zp; - - friend class QDoubleVector2D; -}; - -Q_DECLARE_TYPEINFO(QDoubleVector3D, Q_MOVABLE_TYPE); - -inline QDoubleVector3D::QDoubleVector3D() : xp(0.0), yp(0.0), zp(0.0) {} - -inline QDoubleVector3D::QDoubleVector3D(const QVector3D &vector) : xp(vector.x()), yp(vector.y()), zp(vector.z()) {} - -inline QDoubleVector3D::QDoubleVector3D(double xpos, double ypos, double zpos) : xp(xpos), yp(ypos), zp(zpos) {} - -inline QDoubleVector3D::operator QVector3D() const -{ - return QVector3D(xp, yp, zp); -} - -inline bool QDoubleVector3D::isNull() const -{ - return qIsNull(xp) && qIsNull(yp) && qIsNull(zp); -} - -inline double QDoubleVector3D::x() const { return xp; } -inline double QDoubleVector3D::y() const { return yp; } -inline double QDoubleVector3D::z() const { return zp; } - -inline void QDoubleVector3D::setX(double aX) { xp = aX; } -inline void QDoubleVector3D::setY(double aY) { yp = aY; } -inline void QDoubleVector3D::setZ(double aZ) { zp = aZ; } - -inline double QDoubleVector3D::get(int i) const -{ - switch (i) { - case 0: - return xp; - case 1: - return yp; - case 2: - return zp; - default: - return 0.0; - } -} - -inline void QDoubleVector3D::set(int i, double value) -{ - switch (i) { - case 0: - xp = value; - break; - case 1: - yp = value; - break; - case 2: - zp = value; - break; - default: - break; - } -} - -inline QDoubleVector3D &QDoubleVector3D::operator+=(const QDoubleVector3D &vector) -{ - xp += vector.xp; - yp += vector.yp; - zp += vector.zp; - return *this; -} - -inline QDoubleVector3D &QDoubleVector3D::operator-=(const QDoubleVector3D &vector) -{ - xp -= vector.xp; - yp -= vector.yp; - zp -= vector.zp; - return *this; -} - -inline QDoubleVector3D &QDoubleVector3D::operator*=(double factor) -{ - xp *= factor; - yp *= factor; - zp *= factor; - return *this; -} - -inline QDoubleVector3D &QDoubleVector3D::operator*=(const QDoubleVector3D &vector) -{ - xp *= vector.xp; - yp *= vector.yp; - zp *= vector.zp; - return *this; -} - -inline QDoubleVector3D &QDoubleVector3D::operator/=(double divisor) -{ - xp /= divisor; - yp /= divisor; - zp /= divisor; - return *this; -} - -inline bool operator==(const QDoubleVector3D &v1, const QDoubleVector3D &v2) -{ - return v1.xp == v2.xp && v1.yp == v2.yp && v1.zp == v2.zp; -} - -inline bool operator!=(const QDoubleVector3D &v1, const QDoubleVector3D &v2) -{ - return v1.xp != v2.xp || v1.yp != v2.yp || v1.zp != v2.zp; -} - -inline const QDoubleVector3D operator+(const QDoubleVector3D &v1, const QDoubleVector3D &v2) -{ - return QDoubleVector3D(v1.xp + v2.xp, v1.yp + v2.yp, v1.zp + v2.zp); -} - -inline const QDoubleVector3D operator-(const QDoubleVector3D &v1, const QDoubleVector3D &v2) -{ - return QDoubleVector3D(v1.xp - v2.xp, v1.yp - v2.yp, v1.zp - v2.zp); -} - -inline const QDoubleVector3D operator*(double factor, const QDoubleVector3D &vector) -{ - return QDoubleVector3D(vector.xp * factor, vector.yp * factor, vector.zp * factor); -} - -inline const QDoubleVector3D operator*(const QDoubleVector3D &vector, double factor) -{ - return QDoubleVector3D(vector.xp * factor, vector.yp * factor, vector.zp * factor); -} - -inline const QDoubleVector3D operator*(const QDoubleVector3D &v1, const QDoubleVector3D &v2) -{ - return QDoubleVector3D(v1.xp * v2.xp, v1.yp * v2.yp, v1.zp * v2.zp); -} - -inline const QDoubleVector3D operator-(const QDoubleVector3D &vector) -{ - return QDoubleVector3D(-vector.xp, -vector.yp, -vector.zp); -} - -inline const QDoubleVector3D operator/(const QDoubleVector3D &vector, double divisor) -{ - return QDoubleVector3D(vector.xp / divisor, vector.yp / divisor, vector.zp / divisor); -} - -inline bool qFuzzyCompare(const QDoubleVector3D &v1, const QDoubleVector3D &v2) -{ - return qFuzzyCompare(v1.xp, v2.xp) && - qFuzzyCompare(v1.yp, v2.yp) && - qFuzzyCompare(v1.zp, v2.zp); -} - -#ifndef QT_NO_DEBUG_STREAM -QDebug operator<<(QDebug dbg, const QDoubleVector3D &vector); -#endif - -#ifndef QT_NO_DATASTREAM -QDataStream &operator<<(QDataStream &, const QDoubleVector3D &); -QDataStream &operator>>(QDataStream &, QDoubleVector3D &); -#endif - -QT_END_NAMESPACE - -#endif diff --git a/src/location/maps/qgeocameradata.cpp b/src/location/maps/qgeocameradata.cpp index e1d7e114..085a3134 100644 --- a/src/location/maps/qgeocameradata.cpp +++ b/src/location/maps/qgeocameradata.cpp @@ -39,14 +39,13 @@ ** ****************************************************************************/ #include "qgeocameradata_p.h" +#include <QtPositioning/private/qgeocoordinate_p.h> #include <QVariant> #include <QVariantAnimation> #include <QMetaType> -#include <QWeakPointer> - #include <cmath> QT_BEGIN_NAMESPACE @@ -66,8 +65,6 @@ public: double tilt_; double roll_; double zoomLevel_; - - QWeakPointer<QGeoCoordinateInterpolator> interpolator_; }; QGeoCameraDataPrivate::QGeoCameraDataPrivate() @@ -84,8 +81,7 @@ QGeoCameraDataPrivate::QGeoCameraDataPrivate(const QGeoCameraDataPrivate &rhs) bearing_(rhs.bearing_), tilt_(rhs.tilt_), roll_(rhs.roll_), - zoomLevel_(rhs.zoomLevel_), - interpolator_(rhs.interpolator_) {} + zoomLevel_(rhs.zoomLevel_) {} QGeoCameraDataPrivate &QGeoCameraDataPrivate::operator = (const QGeoCameraDataPrivate &rhs) { @@ -97,11 +93,6 @@ QGeoCameraDataPrivate &QGeoCameraDataPrivate::operator = (const QGeoCameraDataPr tilt_ = rhs.tilt_; roll_ = rhs.roll_; zoomLevel_ = rhs.zoomLevel_; - QSharedPointer<QGeoCoordinateInterpolator> i = rhs.interpolator_.toStrongRef(); - if (i) - interpolator_ = i.toWeakRef(); - else - interpolator_.clear(); return *this; } @@ -120,16 +111,20 @@ QVariant cameraInterpolator(const QGeoCameraData &start, qreal progress) { QGeoCameraData result = start; - - - QSharedPointer<QGeoCoordinateInterpolator> i = start.coordinateInterpolator(); - if (!i) - i = end.coordinateInterpolator(); - - if (!i) - result.setCenter(start.center()); - else - result.setCenter(i->interpolate(start.center(), end.center(), progress)); + QGeoCoordinate from = start.center(); + QGeoCoordinate to = end.center(); + + if (from == to) { + if (progress < 0.5) { + result.setCenter(from); + } else { + result.setCenter(to); + } + } + else { + QGeoCoordinate coordinateResult = QGeoProjection::coordinateInterpolation(from, to, progress); + result.setCenter(coordinateResult); + } double sf = 1.0 - progress; double ef = progress; @@ -225,14 +220,4 @@ double QGeoCameraData::zoomLevel() const return d->zoomLevel_; } -void QGeoCameraData::setCoordinateInterpolator(QSharedPointer<QGeoCoordinateInterpolator> interpolator) -{ - d->interpolator_ = interpolator.toWeakRef(); -} - -QSharedPointer<QGeoCoordinateInterpolator> QGeoCameraData::coordinateInterpolator() const -{ - return d->interpolator_.toStrongRef(); -} - QT_END_NAMESPACE diff --git a/src/location/maps/qgeocameradata_p.h b/src/location/maps/qgeocameradata_p.h index ca2bf4a9..fd24c065 100644 --- a/src/location/maps/qgeocameradata_p.h +++ b/src/location/maps/qgeocameradata_p.h @@ -52,14 +52,13 @@ // We mean it. // +#include "qlocationglobal.h" #include "qgeocoordinate.h" -#include "qgeoprojection_p.h" -#include "qgeocoordinateinterpolator_p.h" +#include <QtPositioning/private/qgeoprojection_p.h> #include <QMetaType> -#include <QSharedPointer> #include <QSharedDataPointer> QT_BEGIN_NAMESPACE @@ -93,9 +92,6 @@ public: void setZoomLevel(double zoomLevel); double zoomLevel() const; - void setCoordinateInterpolator(QSharedPointer<QGeoCoordinateInterpolator> interpolator); - QSharedPointer<QGeoCoordinateInterpolator> coordinateInterpolator() const; - private: QSharedDataPointer<QGeoCameraDataPrivate> d; }; diff --git a/src/location/maps/qgeocameratiles.cpp b/src/location/maps/qgeocameratiles.cpp index e921cf9c..050e7fc3 100644 --- a/src/location/maps/qgeocameratiles.cpp +++ b/src/location/maps/qgeocameratiles.cpp @@ -39,16 +39,14 @@ ** ****************************************************************************/ #include "qgeocameratiles_p.h" - #include "qgeocameradata_p.h" -#include "qgeoprojection_p.h" #include "qgeotilespec_p.h" - -#include "qdoublevector2d_p.h" -#include "qdoublevector3d_p.h" - #include "qgeomaptype_p.h" +#include <QtPositioning/private/qgeoprojection_p.h> +#include <QtPositioning/private/qdoublevector2d_p.h> +#include <QtPositioning/private/qdoublevector3d_p.h> + #include <QVector> #include <QMap> #include <QPair> diff --git a/src/location/maps/qgeocoordinateinterpolator.cpp b/src/location/maps/qgeocoordinateinterpolator.cpp deleted file mode 100644 index d7bc3019..00000000 --- a/src/location/maps/qgeocoordinateinterpolator.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtLocation module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "qgeocoordinateinterpolator_p.h" - -QT_BEGIN_NAMESPACE - -QGeoCoordinateInterpolator::QGeoCoordinateInterpolator() {} - -QGeoCoordinateInterpolator::~QGeoCoordinateInterpolator() {} - -QT_END_NAMESPACE diff --git a/src/location/maps/qgeocoordinateinterpolator_p.h b/src/location/maps/qgeocoordinateinterpolator_p.h deleted file mode 100644 index 1b75bfb4..00000000 --- a/src/location/maps/qgeocoordinateinterpolator_p.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtLocation module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QGEOCOORDINATEINTERPOLATOR_P_H -#define QGEOCOORDINATEINTERPOLATOR_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtPositioning/QGeoCoordinate> -#include <QtLocation/qlocationglobal.h> - -QT_BEGIN_NAMESPACE - -class Q_LOCATION_EXPORT QGeoCoordinateInterpolator -{ -public: - QGeoCoordinateInterpolator(); - virtual ~QGeoCoordinateInterpolator(); - - virtual QGeoCoordinate interpolate(const QGeoCoordinate &start, const QGeoCoordinate &end, qreal progress) = 0; -}; - -QT_END_NAMESPACE - -#endif // QGEOCOORDINATEINTERPOLATOR_P_H diff --git a/src/location/maps/qgeomap.cpp b/src/location/maps/qgeomap.cpp index 98718bbb..f27e2ffa 100644 --- a/src/location/maps/qgeomap.cpp +++ b/src/location/maps/qgeomap.cpp @@ -44,11 +44,13 @@ #include "qgeotilecache_p.h" #include "qgeotilespec_p.h" -#include "qgeoprojection_p.h" + #include "qgeocameracapabilities_p.h" #include "qgeomapcontroller_p.h" -#include "qdoublevector2d_p.h" -#include "qdoublevector3d_p.h" + +#include <QtPositioning/private/qgeoprojection_p.h> +#include <QtPositioning/private/qdoublevector2d_p.h> +#include <QtPositioning/private/qdoublevector3d_p.h> #include "qgeocameratiles_p.h" #include "qgeotilerequestmanager_p.h" diff --git a/src/location/maps/qgeomap_p.h b/src/location/maps/qgeomap_p.h index e001a99d..ebd1381b 100644 --- a/src/location/maps/qgeomap_p.h +++ b/src/location/maps/qgeomap_p.h @@ -56,7 +56,6 @@ #include "qgeocameradata_p.h" #include "qgeomaptype_p.h" -#include "qgeocoordinateinterpolator_p.h" QT_BEGIN_NAMESPACE diff --git a/src/location/maps/qgeomapcontroller.cpp b/src/location/maps/qgeomapcontroller.cpp index 0d5965df..b7ab96dc 100644 --- a/src/location/maps/qgeomapcontroller.cpp +++ b/src/location/maps/qgeomapcontroller.cpp @@ -42,74 +42,16 @@ #include "qgeomapcontroller_p.h" #include "qgeomapdata_p.h" -#include "qgeoprojection_p.h" +#include <QtPositioning/private/qgeoprojection_p.h> #include <QPointF> -#include <QVariant> -#include <QVariantAnimation> - QT_BEGIN_NAMESPACE -QVariant coordinateInterpolator(const AnimatableCoordinate &start, - const AnimatableCoordinate &end, - qreal progress) -{ - AnimatableCoordinate result = start; - - QSharedPointer<QGeoCoordinateInterpolator> i = start.interpolator(); - if (!i) - i = end.interpolator(); - - if (!i) - result.setCoordinate(start.coordinate()); - else - result.setCoordinate(i->interpolate(start.coordinate(), - end.coordinate(), - progress)); - - result.setInterpolator(i); - - return QVariant::fromValue(result); -} - -AnimatableCoordinate::AnimatableCoordinate() {} - -AnimatableCoordinate::AnimatableCoordinate(const QGeoCoordinate &coordinate, - QSharedPointer<QGeoCoordinateInterpolator> interpolator) - : coordinate_(coordinate), - interpolator_(interpolator) -{ -} - -QGeoCoordinate AnimatableCoordinate::coordinate() const -{ - return coordinate_; -} - -void AnimatableCoordinate::setCoordinate(const QGeoCoordinate &coordinate) -{ - coordinate_ = coordinate; -} - -QSharedPointer<QGeoCoordinateInterpolator> AnimatableCoordinate::interpolator() const -{ - return interpolator_; -} - -void AnimatableCoordinate::setInterpolator(QSharedPointer<QGeoCoordinateInterpolator> interpolator) -{ - interpolator_ = interpolator; -} - -QGeoMapController::QGeoMapController(QGeoMapData *map, QSharedPointer<QGeoCoordinateInterpolator> interpolator) +QGeoMapController::QGeoMapController(QGeoMapData *map) : QObject(map), - map_(map), - interpolator_(interpolator) + map_(map) { - qRegisterMetaType<AnimatableCoordinate>(); - qRegisterAnimationInterpolator<AnimatableCoordinate>(coordinateInterpolator); - oldCameraData_ = map_->cameraData(); connect(map_, @@ -123,7 +65,7 @@ QGeoMapController::~QGeoMapController() {} void QGeoMapController::cameraDataChanged(const QGeoCameraData &cameraData) { if (oldCameraData_.center() != cameraData.center()) - emit centerChanged(AnimatableCoordinate(cameraData.center(), interpolator_)); + emit centerChanged(cameraData.center()); if (oldCameraData_.bearing() != cameraData.bearing()) emit bearingChanged(cameraData.bearing()); @@ -140,19 +82,19 @@ void QGeoMapController::cameraDataChanged(const QGeoCameraData &cameraData) oldCameraData_ = cameraData; } -AnimatableCoordinate QGeoMapController::center() const +QGeoCoordinate QGeoMapController::center() const { - return AnimatableCoordinate(map_->cameraData().center(), interpolator_); + return map_->cameraData().center(); } -void QGeoMapController::setCenter(const AnimatableCoordinate ¢er) +void QGeoMapController::setCenter(const QGeoCoordinate ¢er) { QGeoCameraData cd = map_->cameraData(); - if (center.coordinate() == cd.center()) + if (center == cd.center()) return; - cd.setCenter(center.coordinate()); + cd.setCenter(center); map_->setCameraData(cd); } diff --git a/src/location/maps/qgeomapcontroller_p.h b/src/location/maps/qgeomapcontroller_p.h index 7af95a3d..247adcc3 100644 --- a/src/location/maps/qgeomapcontroller_p.h +++ b/src/location/maps/qgeomapcontroller_p.h @@ -56,46 +56,28 @@ #include "qgeocoordinate.h" #include "qgeocameradata_p.h" -#include "qgeocoordinateinterpolator_p.h" QT_BEGIN_NAMESPACE class QGeoMapData; -class Q_LOCATION_EXPORT AnimatableCoordinate -{ -public: - AnimatableCoordinate(); - AnimatableCoordinate(const QGeoCoordinate &coordinate, - QSharedPointer<QGeoCoordinateInterpolator> interpolator); - - QGeoCoordinate coordinate() const; - void setCoordinate(const QGeoCoordinate &coordinate); - - QSharedPointer<QGeoCoordinateInterpolator> interpolator() const; - void setInterpolator(QSharedPointer<QGeoCoordinateInterpolator> interpolator); - -private: - QGeoCoordinate coordinate_; - QSharedPointer<QGeoCoordinateInterpolator> interpolator_; -}; class Q_LOCATION_EXPORT QGeoMapController : public QObject { Q_OBJECT - Q_PROPERTY(AnimatableCoordinate center READ center WRITE setCenter NOTIFY centerChanged) + Q_PROPERTY(QGeoCoordinate center READ center WRITE setCenter NOTIFY centerChanged) Q_PROPERTY(qreal bearing READ bearing WRITE setBearing NOTIFY bearingChanged) Q_PROPERTY(qreal tilt READ tilt WRITE setTilt NOTIFY tiltChanged) Q_PROPERTY(qreal roll READ roll WRITE setRoll NOTIFY rollChanged) Q_PROPERTY(qreal zoom READ zoom WRITE setZoom NOTIFY zoomChanged) public: - QGeoMapController(QGeoMapData *map, QSharedPointer<QGeoCoordinateInterpolator> coordinateInterpolator); + QGeoMapController(QGeoMapData *map); ~QGeoMapController(); - AnimatableCoordinate center() const; - void setCenter(const AnimatableCoordinate ¢er); + QGeoCoordinate center() const; + void setCenter(const QGeoCoordinate ¢er); void setLatitude(qreal latitude); void setLongitude(qreal longitude); @@ -119,7 +101,7 @@ private Q_SLOTS: void cameraDataChanged(const QGeoCameraData &cameraData); Q_SIGNALS: - void centerChanged(const AnimatableCoordinate ¢er); + void centerChanged(const QGeoCoordinate ¢er); void bearingChanged(qreal bearing); void tiltChanged(qreal tilt); void rollChanged(qreal roll); @@ -127,12 +109,9 @@ Q_SIGNALS: private: QGeoMapData *map_; - QSharedPointer<QGeoCoordinateInterpolator> interpolator_; QGeoCameraData oldCameraData_; }; QT_END_NAMESPACE -Q_DECLARE_METATYPE(AnimatableCoordinate) - #endif // QGEOMAPCONTROLLER_P_H diff --git a/src/location/maps/qgeomapdata.cpp b/src/location/maps/qgeomapdata.cpp index c26d9adb..69e11530 100644 --- a/src/location/maps/qgeomapdata.cpp +++ b/src/location/maps/qgeomapdata.cpp @@ -44,11 +44,8 @@ #include "qgeotilecache_p.h" #include "qgeotilespec_p.h" -#include "qgeoprojection_p.h" #include "qgeocameracapabilities_p.h" #include "qgeomapcontroller_p.h" -#include "qdoublevector2d_p.h" -#include "qdoublevector3d_p.h" #include "qgeocameratiles_p.h" #include "qgeotilerequestmanager_p.h" @@ -56,6 +53,11 @@ #include "qgeomappingmanager_p.h" + +#include <QtPositioning/private/qgeoprojection_p.h> +#include <QtPositioning/private/qdoublevector2d_p.h> +#include <QtPositioning/private/qdoublevector3d_p.h> + #include <QMutex> #include <QMap> @@ -157,18 +159,6 @@ QString QGeoMapData::pluginString() return d->pluginString(); } -QSharedPointer<QGeoCoordinateInterpolator> QGeoMapData::coordinateInterpolator() -{ - Q_D(QGeoMapData); - return d->coordinateInterpolator(); -} - -void QGeoMapData::setCoordinateInterpolator(QSharedPointer<QGeoCoordinateInterpolator> interpolator) -{ - Q_D(QGeoMapData); - return d->setCoordinateInterpolator(interpolator); -} - QGeoCameraCapabilities QGeoMapData::cameraCapabilities() { Q_D(QGeoMapData); @@ -216,20 +206,10 @@ QString QGeoMapDataPrivate::pluginString() return pluginString_; } -QSharedPointer<QGeoCoordinateInterpolator> QGeoMapDataPrivate::coordinateInterpolator() const -{ - return coordinateInterpolator_; -} - -void QGeoMapDataPrivate::setCoordinateInterpolator(QSharedPointer<QGeoCoordinateInterpolator> interpolator) -{ - coordinateInterpolator_ = interpolator; -} - QGeoMapController *QGeoMapDataPrivate::mapController() { if (!controller_) - controller_ = new QGeoMapController(map_, coordinateInterpolator_); + controller_ = new QGeoMapController(map_); return controller_; } @@ -268,8 +248,6 @@ void QGeoMapDataPrivate::setCameraData(const QGeoCameraData &cameraData) cameraData_.setRoll(0.0); } - cameraData_.setCoordinateInterpolator(coordinateInterpolator_.toWeakRef()); - // Do not call this expensive function if the width is 0, since it will get called // anyway when it is resized to a width > 0. // this is mainly an optimisation to the initalization of the geomap, which would otherwise diff --git a/src/location/maps/qgeomapdata_p.h b/src/location/maps/qgeomapdata_p.h index be8649f3..59316056 100644 --- a/src/location/maps/qgeomapdata_p.h +++ b/src/location/maps/qgeomapdata_p.h @@ -56,8 +56,6 @@ #include "qgeocameradata_p.h" #include "qgeomaptype_p.h" -#include "qgeocoordinateinterpolator_p.h" -#include "qgeocoordinateinterpolator_p.h" QT_BEGIN_NAMESPACE @@ -98,8 +96,6 @@ public: void setActiveMapType(const QGeoMapType mapType); const QGeoMapType activeMapType() const; - QSharedPointer<QGeoCoordinateInterpolator> coordinateInterpolator(); - virtual QGeoCoordinate screenPositionToCoordinate(const QPointF &pos, bool clipToViewport = true) const = 0; virtual QPointF coordinateToScreenPosition(const QGeoCoordinate &coordinate, bool clipToViewport = true) const = 0; @@ -109,8 +105,6 @@ public: virtual void prefetchData() {} protected: - void setCoordinateInterpolator(QSharedPointer<QGeoCoordinateInterpolator> interpolator); - virtual void mapResized(int width, int height) = 0; virtual void changeCameraData(const QGeoCameraData &oldCameraData) = 0; virtual void changeActiveMapType(const QGeoMapType mapType) = 0; diff --git a/src/location/maps/qgeomapdata_p_p.h b/src/location/maps/qgeomapdata_p_p.h index 6df9f86e..5e81d457 100644 --- a/src/location/maps/qgeomapdata_p_p.h +++ b/src/location/maps/qgeomapdata_p_p.h @@ -60,13 +60,13 @@ #include <QSizeF> #include <QMatrix4x4> #include <QString> -#include <QSharedPointer> + +#include <QtPositioning/private/qdoublevector3d_p.h> + #include "qgeocameradata_p.h" #include "qgeomaptype_p.h" -#include "qdoublevector3d_p.h" - QT_BEGIN_NAMESPACE class QGeoMappingManagerEngine; @@ -101,9 +101,6 @@ public: void setActiveMapType(const QGeoMapType &mapType); QString pluginString(); - QSharedPointer<QGeoCoordinateInterpolator> coordinateInterpolator() const; - void setCoordinateInterpolator(QSharedPointer<QGeoCoordinateInterpolator> interpolator); - private: int width_; int height_; @@ -117,8 +114,6 @@ private: QGeoCameraData cameraData_; QGeoMapType activeMapType_; - - QSharedPointer<QGeoCoordinateInterpolator> coordinateInterpolator_; }; QT_END_NAMESPACE diff --git a/src/location/maps/qgeomapscene.cpp b/src/location/maps/qgeomapscene.cpp index 444877b1..e83a2ace 100644 --- a/src/location/maps/qgeomapscene.cpp +++ b/src/location/maps/qgeomapscene.cpp @@ -41,12 +41,13 @@ #include "qgeomapscene_p.h" #include "qgeocameradata_p.h" -#include "qgeoprojection_p.h" + #include "qgeotilecache_p.h" #include "qgeotilespec_p.h" -#include "qdoublevector2d_p.h" -#include "qdoublevector3d_p.h" +#include <QtPositioning/private/qgeoprojection_p.h> +#include <QtPositioning/private/qdoublevector2d_p.h> +#include <QtPositioning/private/qdoublevector3d_p.h> #include <Qt3D/qglscenenode.h> #include <Qt3D/qglbuilder.h> diff --git a/src/location/maps/qgeoprojection.cpp b/src/location/maps/qgeoprojection.cpp deleted file mode 100644 index 84dc5749..00000000 --- a/src/location/maps/qgeoprojection.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtLocation module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "qgeoprojection_p.h" - -#include "qgeocoordinate.h" - -#include <QMatrix4x4> -#include <qnumeric.h> - -#include <cmath> - -#include "qdoublevector2d_p.h" -#include "qdoublevector3d_p.h" - -QT_BEGIN_NAMESPACE - -QDoubleVector2D QGeoProjection::coordToMercator(const QGeoCoordinate &coord) -{ - const double pi = M_PI; - - double lon = coord.longitude() / 360.0 + 0.5; - - double lat = coord.latitude(); - lat = 0.5 - (std::log(std::tan((pi / 4.0) + (pi / 2.0) * lat / 180.0)) / pi) / 2.0; - lat = qMax(0.0, lat); - lat = qMin(1.0, lat); - - return QDoubleVector2D(lon, lat); -} - -double QGeoProjection::realmod(const double a, const double b) -{ - quint64 div = static_cast<quint64>(a / b); - return a - static_cast<double>(div) * b; -} - -QGeoCoordinate QGeoProjection::mercatorToCoord(const QDoubleVector2D &mercator) -{ - const double pi = M_PI; - - 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; - - if (fy == 0.0) - lat = 90.0; - else if (fy == 1.0) - lat = -90.0; - else - lat = (180.0 / pi) * (2.0 * std::atan(std::exp(pi * (1.0 - 2.0 * fy))) - (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); -} - -QT_END_NAMESPACE diff --git a/src/location/maps/qgeoprojection_p.h b/src/location/maps/qgeoprojection_p.h deleted file mode 100644 index 4dcf8b4c..00000000 --- a/src/location/maps/qgeoprojection_p.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtLocation module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QGEOPROJECTION_P_H -#define QGEOPROJECTION_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#ifndef M_PI -#define M_PI (3.14159265358979323846) -#endif - -#include <qglobal.h> -#include <QtLocation/qlocationglobal.h> - -QT_BEGIN_NAMESPACE - -class QGeoCoordinate; -class QDoubleVector2D; - -class Q_LOCATION_EXPORT QGeoProjection -{ -public: - static QDoubleVector2D coordToMercator(const QGeoCoordinate &coord); - static QGeoCoordinate mercatorToCoord(const QDoubleVector2D &mercator); - -private: - static double realmod(const double a, const double b); -}; - -QT_END_NAMESPACE - -#endif // QGEOPROJECTION_P_H diff --git a/src/location/maps/qgeotiledmapdata.cpp b/src/location/maps/qgeotiledmapdata.cpp index 2c322749..0b9d0471 100644 --- a/src/location/maps/qgeotiledmapdata.cpp +++ b/src/location/maps/qgeotiledmapdata.cpp @@ -44,14 +44,10 @@ #include "qgeotiledmappingmanagerengine_p.h" #include "qgeotilecache_p.h" #include "qgeotilespec_p.h" -#include "qgeoprojection_p.h" #include "qgeocameratiles_p.h" #include "qgeotilerequestmanager_p.h" #include "qgeomapscene_p.h" -#include "qgeocoordinateinterpolator_p.h" -#include "qgeoprojection_p.h" -#include "qdoublevector2d_p.h" #include "qgeocameracapabilities_p.h" #include <QMutex> @@ -68,74 +64,19 @@ #include <Qt3D/qglcamera.h> #include <Qt3D/qglsubsurface.h> +#include <QtPositioning/private/qgeoprojection_p.h> +#include <QtPositioning/private/qdoublevector2d_p.h> + #include <cmath> QT_BEGIN_NAMESPACE -class QGeoCoordinateInterpolator2D : public QGeoCoordinateInterpolator -{ -public: - QGeoCoordinateInterpolator2D(); - virtual ~QGeoCoordinateInterpolator2D(); - - virtual QGeoCoordinate interpolate(const QGeoCoordinate &start, const QGeoCoordinate &end, qreal progress); -}; - -QGeoCoordinateInterpolator2D::QGeoCoordinateInterpolator2D() {} - -QGeoCoordinateInterpolator2D::~QGeoCoordinateInterpolator2D() {} - -QGeoCoordinate QGeoCoordinateInterpolator2D::interpolate(const QGeoCoordinate &start, const QGeoCoordinate &end, qreal progress) -{ - if (start == end) { - if (progress < 0.5) { - return start; - } else { - return end; - } - } - - QGeoCoordinate s2 = start; - QGeoCoordinate e2 = end; - QDoubleVector2D s = QGeoProjection::coordToMercator(s2); - QDoubleVector2D e = QGeoProjection::coordToMercator(e2); - - double x = s.x(); - - if (0.5 < qAbs(e.x() - s.x())) { - // handle dateline crossing - double ex = e.x(); - double sx = s.x(); - if (ex < sx) - sx -= 1.0; - else if (sx < ex) - ex -= 1.0; - - x = (1.0 - progress) * sx + progress * ex; - - if (!qFuzzyIsNull(x) && (x < 0.0)) - x += 1.0; - - } else { - x = (1.0 - progress) * s.x() + progress * e.x(); - } - - double y = (1.0 - progress) * s.y() + progress * e.y(); - - QGeoCoordinate result = QGeoProjection::mercatorToCoord(QDoubleVector2D(x, y)); - result.setAltitude((1.0 - progress) * start.altitude() + progress * end.altitude()); - return result; -} - -//------------------------ -//------------------------ QGeoTiledMapData::QGeoTiledMapData(QGeoTiledMappingManagerEngine *engine, QObject *parent) : QGeoMapData(engine, parent) { d_ptr = new QGeoTiledMapDataPrivate(this, engine); engine->registerMap(this); - setCoordinateInterpolator(QSharedPointer<QGeoCoordinateInterpolator>(new QGeoCoordinateInterpolator2D())); } QGeoTiledMapData::~QGeoTiledMapData() diff --git a/src/location/maps/qgeotiledmapdata_p_p.h b/src/location/maps/qgeotiledmapdata_p_p.h index 16e6be0c..722a9789 100644 --- a/src/location/maps/qgeotiledmapdata_p_p.h +++ b/src/location/maps/qgeotiledmapdata_p_p.h @@ -60,14 +60,13 @@ #include <QSizeF> #include <QMatrix4x4> #include <QString> -#include <QSharedPointer> #include <QPointer> +#include <QtPositioning/private/qdoublevector3d_p.h> + #include "qgeocameradata_p.h" #include "qgeomaptype_p.h" -#include "qdoublevector3d_p.h" - QT_BEGIN_NAMESPACE class QGeoTile; |