summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbin Olsson <albin.olsson@cybercom.com>2013-09-19 16:17:20 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-11 12:18:46 +0200
commit42541b2406f6b35e109ee6bee64283582dfd2adc (patch)
tree96c873be5b39ef46022b72d88c04233578f4457b
parent7ec8919a055e35232b5127e312a525f61b0bc483 (diff)
downloadqtlocation-42541b2406f6b35e109ee6bee64283582dfd2adc.tar.gz
Make geo coordinates animatable in QML.
Interpolation logic in AnimatableCoordinate has been moved around so that QGeoCoordinates can be animated directly by QPropertyAnimation. A new QML type has been added, 'CoordinateAnimation', for animating coordinates in QML. This type follows the pattern of 'ColorAnimation' and other specializations of 'PropertyAnimation'. QDoubleVector2D, QDoubleVector3D and QGeoProjection has been moved to QtPositioning Testcase for CoordinateAnimation has been added to declarative_ui. AnimatableCoordinate and QGeoCoordinateInterpolator are redundant and have been removed. Change-Id: I0809da566e1800274384f9c5337df65623d1e61a Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
-rw-r--r--src/imports/location/qdeclarativegeomap.cpp24
-rw-r--r--src/imports/location/qdeclarativegeomap_p.h2
-rw-r--r--src/imports/location/qdeclarativegeomapgesturearea.cpp14
-rw-r--r--src/imports/positioning/positioning.cpp4
-rw-r--r--src/imports/positioning/positioning.pro6
-rw-r--r--src/imports/positioning/qdeclarativegeocoordinateanimation.cpp122
-rw-r--r--src/imports/positioning/qdeclarativegeocoordinateanimation_p.h (renamed from src/location/maps/qgeocoordinateinterpolator_p.h)44
-rw-r--r--src/location/location.pro2
-rw-r--r--src/location/maps/maps.pri8
-rw-r--r--src/location/maps/qgeocameradata.cpp47
-rw-r--r--src/location/maps/qgeocameradata_p.h8
-rw-r--r--src/location/maps/qgeocameratiles.cpp10
-rw-r--r--src/location/maps/qgeocoordinateinterpolator.cpp49
-rw-r--r--src/location/maps/qgeomap.cpp8
-rw-r--r--src/location/maps/qgeomap_p.h1
-rw-r--r--src/location/maps/qgeomapcontroller.cpp76
-rw-r--r--src/location/maps/qgeomapcontroller_p.h31
-rw-r--r--src/location/maps/qgeomapdata.cpp34
-rw-r--r--src/location/maps/qgeomapdata_p.h6
-rw-r--r--src/location/maps/qgeomapdata_p_p.h11
-rw-r--r--src/location/maps/qgeomapscene.cpp7
-rw-r--r--src/location/maps/qgeotiledmapdata.cpp65
-rw-r--r--src/location/maps/qgeotiledmapdata_p_p.h5
-rw-r--r--src/plugins/geoservices/nokia/nokia.pro2
-rw-r--r--src/plugins/geoservices/nokia/qgeotiledmappingmanagerengine_nokia.cpp5
-rw-r--r--src/plugins/geoservices/osm/osm.pro2
-rw-r--r--src/positioning/positioning.pro11
-rw-r--r--src/positioning/qdoublevector2d.cpp (renamed from src/location/maps/qdoublevector2d.cpp)2
-rw-r--r--src/positioning/qdoublevector2d_p.h (renamed from src/location/maps/qdoublevector2d_p.h)20
-rw-r--r--src/positioning/qdoublevector3d.cpp (renamed from src/location/maps/qdoublevector3d.cpp)2
-rw-r--r--src/positioning/qdoublevector3d_p.h (renamed from src/location/maps/qdoublevector3d_p.h)20
-rw-r--r--src/positioning/qgeoaddress.h2
-rw-r--r--src/positioning/qgeocircle.cpp2
-rw-r--r--src/positioning/qgeocoordinate.h2
-rw-r--r--src/positioning/qgeolocation.h2
-rw-r--r--src/positioning/qgeoprojection.cpp (renamed from src/location/maps/qgeoprojection.cpp)36
-rw-r--r--src/positioning/qgeoprojection_p.h (renamed from src/location/maps/qgeoprojection_p.h)5
-rw-r--r--src/positioning/qgeosatelliteinfo.h2
-rw-r--r--src/positioning/qpositioningglobal.h8
-rw-r--r--tests/auto/declarative_ui/tst_map_coordinateanimation.qml135
-rw-r--r--tests/auto/doublevectors/doublevectors.pro7
-rw-r--r--tests/auto/doublevectors/tst_doublevectors.cpp4
-rw-r--r--tests/auto/geotestplugin/geotestplugin.pro2
-rw-r--r--tests/auto/qgeocameracapabilities/qgeocameracapabilities.pro2
-rw-r--r--tests/auto/qgeocameradata/qgeocameradata.pro2
-rw-r--r--tests/auto/qgeocameradata/tst_qgeocameradata.cpp24
-rw-r--r--tests/auto/qgeocameratiles/qgeocameratiles.pro2
-rw-r--r--tests/auto/qgeocameratiles/tst_qgeocameratiles.cpp4
-rw-r--r--tests/auto/qgeomapcontroller/qgeomapcontroller.pro2
-rw-r--r--tests/auto/qgeomapcontroller/tst_qgeomapcontroller.cpp70
-rw-r--r--tests/auto/qgeomapscene/qgeomapscene.pro2
-rw-r--r--tests/auto/qgeomapscene/tst_qgeomapscene.cpp5
52 files changed, 481 insertions, 487 deletions
diff --git a/src/imports/location/qdeclarativegeomap.cpp b/src/imports/location/qdeclarativegeomap.cpp
index 2b860eb3..bfa1922f 100644
--- a/src/imports/location/qdeclarativegeomap.cpp
+++ b/src/imports/location/qdeclarativegeomap.cpp
@@ -494,9 +494,9 @@ void QDeclarativeGeoMap::mappingManagerInitialized()
this,
SLOT(update()));
connect(map_->mapController(),
- SIGNAL(centerChanged(AnimatableCoordinate)),
+ SIGNAL(centerChanged(QGeoCoordinate)),
this,
- SLOT(mapCenterChanged(AnimatableCoordinate)));
+ SIGNAL(centerChanged(QGeoCoordinate)));
connect(map_->mapController(),
SIGNAL(bearingChanged(qreal)),
this,
@@ -510,9 +510,7 @@ void QDeclarativeGeoMap::mappingManagerInitialized()
this,
SLOT(mapZoomLevelChanged(qreal)));
- AnimatableCoordinate acenter = map_->mapController()->center();
- acenter.setCoordinate(center_);
- map_->mapController()->setCenter(acenter);
+ map_->mapController()->setCenter(center_);
map_->mapController()->setZoom(zoomLevel_);
map_->mapController()->setBearing(bearing_);
map_->mapController()->setTilt(tilt_);
@@ -726,9 +724,7 @@ void QDeclarativeGeoMap::setCenter(const QGeoCoordinate &center)
center_ = center;
if (center_.isValid() && mappingManagerInitialized_) {
- AnimatableCoordinate acoord = map_->mapController()->center();
- acoord.setCoordinate(center_);
- map_->mapController()->setCenter(acoord);
+ map_->mapController()->setCenter(center_);
update();
} else {
emit centerChanged(center_);
@@ -738,7 +734,7 @@ void QDeclarativeGeoMap::setCenter(const QGeoCoordinate &center)
QGeoCoordinate QDeclarativeGeoMap::center() const
{
if (mappingManagerInitialized_)
- return map_->mapController()->center().coordinate();
+ return map_->mapController()->center();
else
return center_;
}
@@ -777,14 +773,6 @@ void QDeclarativeGeoMap::mapBearingChanged(qreal bearing)
}
/*!
- \internal
-*/
-void QDeclarativeGeoMap::mapCenterChanged(AnimatableCoordinate center)
-{
- emit centerChanged(center.coordinate());
-}
-
-/*!
\qmlproperty list<MapType> QtLocation5::Map::supportedMapTypes
This read-only property holds the set of \l{MapType}{map types} supported by this map.
@@ -1140,8 +1128,6 @@ void QDeclarativeGeoMap::fitViewportToMapItemsRefine(bool refine)
// position camera to the center of bounding box
QGeoCoordinate coordinate;
coordinate = map_->screenPositionToCoordinate(QPointF(bboxCenterX, bboxCenterY), false);
- AnimatableCoordinate acenter = map_->mapController()->center();
- acenter.setCoordinate(coordinate);
setCenter(coordinate);
// adjust zoom
diff --git a/src/imports/location/qdeclarativegeomap_p.h b/src/imports/location/qdeclarativegeomap_p.h
index c69541a7..eee281b7 100644
--- a/src/imports/location/qdeclarativegeomap_p.h
+++ b/src/imports/location/qdeclarativegeomap_p.h
@@ -72,7 +72,6 @@
#include "qgeocameradata_p.h"
#include "qgeomap_p.h"
#include "qdeclarativegeomaptype_p.h"
-#include <QWeakPointer>
QT_BEGIN_NAMESPACE
@@ -195,7 +194,6 @@ private Q_SLOTS:
void mapZoomLevelChanged(qreal zoom);
void mapTiltChanged(qreal tilt);
void mapBearingChanged(qreal bearing);
- void mapCenterChanged(AnimatableCoordinate center);
void pluginReady();
void onMapChildrenChanged();
diff --git a/src/imports/location/qdeclarativegeomapgesturearea.cpp b/src/imports/location/qdeclarativegeomapgesturearea.cpp
index c7f9926d..f9959e19 100644
--- a/src/imports/location/qdeclarativegeomapgesturearea.cpp
+++ b/src/imports/location/qdeclarativegeomapgesturearea.cpp
@@ -1139,8 +1139,7 @@ void QDeclarativeGeoMapGestureArea::updatePan()
QPointF mapCenterPoint;
mapCenterPoint.setY(map_->height() / 2.0 - dy);
mapCenterPoint.setX(map_->width() / 2.0 - dx);
- AnimatableCoordinate animationStartCoordinate;
- animationStartCoordinate.setCoordinate(map_->screenPositionToCoordinate(mapCenterPoint, false));
+ QGeoCoordinate animationStartCoordinate = map_->screenPositionToCoordinate(mapCenterPoint, false);
map_->mapController()->setCenter(animationStartCoordinate);
}
@@ -1196,16 +1195,15 @@ void QDeclarativeGeoMapGestureArea::startFlick(int dx, int dy, int timeMs)
{
if (timeMs < 0)
return;
- AnimatableCoordinate animationStartCoordinate = map_->mapController()->center();
- QGeoCoordinate coordinate = animationStartCoordinate.coordinate();
+
+ QGeoCoordinate animationStartCoordinate = map_->mapController()->center();
if (pan_.animation_->state() == QPropertyAnimation::Running)
pan_.animation_->stop();
- AnimatableCoordinate animationEndCoordinate = map_->mapController()->center();
+ QGeoCoordinate animationEndCoordinate = map_->mapController()->center();
pan_.animation_->setDuration(timeMs);
- coordinate.setLongitude(coordinate.longitude() - (dx / pow(2.0, map_->mapController()->zoom())));
- coordinate.setLatitude(coordinate.latitude() + (dy / pow(2.0, map_->mapController()->zoom())));
- animationEndCoordinate.setCoordinate(coordinate);
+ animationEndCoordinate.setLongitude(animationStartCoordinate.longitude() - (dx / pow(2.0, map_->mapController()->zoom())));
+ animationEndCoordinate.setLatitude(animationStartCoordinate.latitude() + (dy / pow(2.0, map_->mapController()->zoom())));
pan_.animation_->setStartValue(QVariant::fromValue(animationStartCoordinate));
pan_.animation_->setEndValue(QVariant::fromValue(animationEndCoordinate));
pan_.animation_->start();
diff --git a/src/imports/positioning/positioning.cpp b/src/imports/positioning/positioning.cpp
index 031b06b2..b4bda5fd 100644
--- a/src/imports/positioning/positioning.cpp
+++ b/src/imports/positioning/positioning.cpp
@@ -51,6 +51,7 @@
#include "qdeclarativegeorectangle.h"
#include "qdeclarativegeocircle.h"
#include "qdeclarativecoordinate_p.h"
+#include "qdeclarativegeocoordinateanimation_p.h"
#include "locationsingleton.h"
@@ -112,6 +113,9 @@ public:
qRegisterMetaType<QGeoRectangle>("QGeoRectangle");
qRegisterMetaType<QGeoCircle>("QGeoCircle");
qRegisterMetaType<QGeoLocation>("QGeoLocation");
+
+ qRegisterAnimationInterpolator<QGeoCoordinate>(geoCoordinateInterpolator);
+ qmlRegisterType<QDeclarativeGeoCoordinateAnimation>(uri, 5, 3, "CoordinateAnimation");
} else {
qDebug() << "Unsupported URI given to load positioning QML plugin: " << QLatin1String(uri);
}
diff --git a/src/imports/positioning/positioning.pro b/src/imports/positioning/positioning.pro
index 1f71f03c..6af459d8 100644
--- a/src/imports/positioning/positioning.pro
+++ b/src/imports/positioning/positioning.pro
@@ -11,7 +11,8 @@ HEADERS += qdeclarativeposition_p.h \
qdeclarativegeocircle.h \
locationvaluetypeprovider.h \
locationsingleton.h \
- error_messages.h
+ error_messages.h \
+ qdeclarativegeocoordinateanimation_p.h
SOURCES += qdeclarativeposition.cpp \
positioning.cpp \
@@ -22,7 +23,8 @@ SOURCES += qdeclarativeposition.cpp \
qdeclarativegeocircle.cpp \
locationvaluetypeprovider.cpp \
locationsingleton.cpp \
- error_messages.cpp
+ error_messages.cpp \
+ qdeclarativegeocoordinateanimation.cpp
load(qml_plugin)
diff --git a/src/imports/positioning/qdeclarativegeocoordinateanimation.cpp b/src/imports/positioning/qdeclarativegeocoordinateanimation.cpp
new file mode 100644
index 00000000..df4fee1b
--- /dev/null
+++ b/src/imports/positioning/qdeclarativegeocoordinateanimation.cpp
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtPositioning 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 "qdeclarativegeocoordinateanimation_p.h"
+#include <QtQuick/private/qquickanimation_p_p.h>
+#include <QtPositioning/private/qgeoprojection_p.h>
+#include <QtPositioning/private/qdoublevector2d_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype CoordinateAnimation
+ \instantiates QDeclarativeGeoCoordinateAnimation
+
+ \brief A PropertyAnimation for geo coordinate properties.
+
+ \inqmlmodule QtLocation 5.0
+ \ingroup qml-QtLocation5-maps
+
+ A specialized \l{PropertyAnimation} that defines an animation
+ between two geo coordinates.
+*/
+
+QDeclarativeGeoCoordinateAnimation::QDeclarativeGeoCoordinateAnimation(QObject *parent)
+ : QQuickPropertyAnimation(parent)
+{
+ Q_D(QQuickPropertyAnimation);
+ d->interpolatorType = qMetaTypeId<QGeoCoordinate>();
+ d->defaultToInterpolatorType = true;
+ d->interpolator = QVariantAnimationPrivate::getInterpolator(d->interpolatorType);
+}
+
+QDeclarativeGeoCoordinateAnimation::~QDeclarativeGeoCoordinateAnimation()
+{
+}
+
+/*!
+ \qmlproperty bool QtLocation5::CoordinateAnimation::from
+ This property holds the coordinate where the animation should begin.
+*/
+
+QGeoCoordinate QDeclarativeGeoCoordinateAnimation::from() const
+{
+ Q_D(const QQuickPropertyAnimation);
+ return d->from.value<QGeoCoordinate>();
+}
+
+void QDeclarativeGeoCoordinateAnimation::setFrom(const QGeoCoordinate &f)
+{
+ QQuickPropertyAnimation::setFrom(QVariant::fromValue(f));
+}
+
+/*!
+ \qmlproperty bool QtLocation5::CoordinateAnimation::to
+ This property holds the coordinate where the animation should end.
+*/
+
+QGeoCoordinate QDeclarativeGeoCoordinateAnimation::to() const
+{
+ Q_D(const QQuickPropertyAnimation);
+ return d->to.value<QGeoCoordinate>();
+}
+
+void QDeclarativeGeoCoordinateAnimation::setTo(const QGeoCoordinate &t)
+{
+ QQuickPropertyAnimation::setTo(QVariant::fromValue(t));
+}
+
+QVariant geoCoordinateInterpolator(const QGeoCoordinate &from, const QGeoCoordinate &to, qreal progress)
+{
+ if (from == to) {
+ if (progress < 0.5) {
+ return QVariant::fromValue(from);
+ } else {
+ return QVariant::fromValue(to);
+ }
+ }
+
+ QGeoCoordinate result = QGeoProjection::coordinateInterpolation(from, to, progress);
+
+ return QVariant::fromValue(result);
+}
+
+QT_END_NAMESPACE
diff --git a/src/location/maps/qgeocoordinateinterpolator_p.h b/src/imports/positioning/qdeclarativegeocoordinateanimation_p.h
index 1b75bfb4..86a0459a 100644
--- a/src/location/maps/qgeocoordinateinterpolator_p.h
+++ b/src/imports/positioning/qdeclarativegeocoordinateanimation_p.h
@@ -3,7 +3,7 @@
** 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.
+** This file is part of the QtPositioning module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -38,34 +38,38 @@
** $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.
-//
+#ifndef QDECLARATIVEGEOCOORDINATEANIMATION_P_H
+#define QDECLARATIVEGEOCOORDINATEANIMATION_P_H
-#include <QtPositioning/QGeoCoordinate>
-#include <QtLocation/qlocationglobal.h>
+#include <QtQuick/private/qquickanimation_p.h>
+#include "qdeclarativecoordinate_p.h"
QT_BEGIN_NAMESPACE
-class Q_LOCATION_EXPORT QGeoCoordinateInterpolator
+
+QVariant geoCoordinateInterpolator(const QGeoCoordinate &from, const QGeoCoordinate &to, qreal progress);
+
+class QDeclarativeGeoCoordinateAnimation : public QQuickPropertyAnimation
{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QQuickPropertyAnimation)
+ Q_PROPERTY(QGeoCoordinate from READ from WRITE setFrom)
+ Q_PROPERTY(QGeoCoordinate to READ to WRITE setTo)
+
public:
- QGeoCoordinateInterpolator();
- virtual ~QGeoCoordinateInterpolator();
+ QDeclarativeGeoCoordinateAnimation(QObject *parent=0);
+ ~QDeclarativeGeoCoordinateAnimation();
- virtual QGeoCoordinate interpolate(const QGeoCoordinate &start, const QGeoCoordinate &end, qreal progress) = 0;
+ QGeoCoordinate from() const;
+ void setFrom(const QGeoCoordinate &);
+
+ QGeoCoordinate to() const;
+ void setTo(const QGeoCoordinate &);
};
QT_END_NAMESPACE
-#endif // QGEOCOORDINATEINTERPOLATOR_P_H
+QML_DECLARE_TYPE(QDeclarativeGeoCoordinateAnimation)
+
+#endif // QDECLARATIVEGEOCOORDINATEANIMATION_P_H
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/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/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 &center)
+void QGeoMapController::setCenter(const QGeoCoordinate &center)
{
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 &center);
+ QGeoCoordinate center() const;
+ void setCenter(const QGeoCoordinate &center);
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 &center);
+ void centerChanged(const QGeoCoordinate &center);
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/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;
diff --git a/src/plugins/geoservices/nokia/nokia.pro b/src/plugins/geoservices/nokia/nokia.pro
index 9ce2a179..597f8bae 100644
--- a/src/plugins/geoservices/nokia/nokia.pro
+++ b/src/plugins/geoservices/nokia/nokia.pro
@@ -1,5 +1,5 @@
TARGET = qtgeoservices_nokia
-QT += location-private network
+QT += location-private positioning-private network
contains(QT_CONFIG, location-china-support) {
# China support
diff --git a/src/plugins/geoservices/nokia/qgeotiledmappingmanagerengine_nokia.cpp b/src/plugins/geoservices/nokia/qgeotiledmappingmanagerengine_nokia.cpp
index 1df1934b..fbffcc5e 100644
--- a/src/plugins/geoservices/nokia/qgeotiledmappingmanagerengine_nokia.cpp
+++ b/src/plugins/geoservices/nokia/qgeotiledmappingmanagerengine_nokia.cpp
@@ -51,10 +51,11 @@
#include "qgeotiledmapdata_nokia.h"
#include "qgeotilefetcher_nokia.h"
#include "qgeotilespec_p.h"
-#include "qgeoprojection_p.h"
-#include "qdoublevector2d_p.h"
#include "qgeotilecache_p.h"
+#include <QtPositioning/private/qdoublevector2d_p.h>
+#include <QtPositioning/private/qgeoprojection_p.h>
+
#include <QDebug>
#include <QDir>
#include <QVariant>
diff --git a/src/plugins/geoservices/osm/osm.pro b/src/plugins/geoservices/osm/osm.pro
index 5767bdee..897ebbfc 100644
--- a/src/plugins/geoservices/osm/osm.pro
+++ b/src/plugins/geoservices/osm/osm.pro
@@ -1,5 +1,5 @@
TARGET = qtgeoservices_osm
-QT += location-private network
+QT += location-private positioning-private network
PLUGIN_TYPE = geoservices
load(qt_plugin)
diff --git a/src/positioning/positioning.pro b/src/positioning/positioning.pro
index 296356d0..7ad5f480 100644
--- a/src/positioning/positioning.pro
+++ b/src/positioning/positioning.pro
@@ -34,7 +34,10 @@ PRIVATE_HEADERS += \
qgeocoordinate_p.h \
qgeopositioninfosource_p.h \
qdeclarativegeoaddress_p.h \
- qdeclarativegeolocation_p.h
+ qdeclarativegeolocation_p.h \
+ qdoublevector2d_p.h \
+ qdoublevector3d_p.h \
+ qgeoprojection_p.h
SOURCES += \
qgeoaddress.cpp \
@@ -53,8 +56,12 @@ SOURCES += \
qnmeapositioninfosource.cpp \
qgeopositioninfosourcefactory.cpp \
qdeclarativegeoaddress.cpp \
- qdeclarativegeolocation.cpp
+ qdeclarativegeolocation.cpp \
+ qdoublevector2d.cpp \
+ qdoublevector3d.cpp \
+ qgeoprojection.cpp
HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS
+
load(qt_module)
diff --git a/src/location/maps/qdoublevector2d.cpp b/src/positioning/qdoublevector2d.cpp
index 589289f7..355fbe54 100644
--- a/src/location/maps/qdoublevector2d.cpp
+++ b/src/positioning/qdoublevector2d.cpp
@@ -3,7 +3,7 @@
** 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.
+** This file is part of the QtPositioning module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/location/maps/qdoublevector2d_p.h b/src/positioning/qdoublevector2d_p.h
index f66a95a2..b3c24af6 100644
--- a/src/location/maps/qdoublevector2d_p.h
+++ b/src/positioning/qdoublevector2d_p.h
@@ -3,7 +3,7 @@
** 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.
+** This file is part of the QtPositioning module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -53,23 +53,27 @@
// We mean it.
//
+#ifdef QT_BUILD_LOCATION_LIB
#include <QVector2D>
+#endif
+#include "qpositioningglobal.h"
#include <QtCore/qmetatype.h>
QT_BEGIN_NAMESPACE
class QDoubleVector3D;
-class QDoubleVector2D
+class Q_POSITIONING_EXPORT_PRIVATE QDoubleVector2D
{
public:
QDoubleVector2D();
- explicit QDoubleVector2D(const QVector2D &vector);
QDoubleVector2D(double xpos, double ypos);
explicit QDoubleVector2D(const QDoubleVector3D &vector);
-
- operator QVector2D() const;
+#ifdef QT_BUILD_LOCATION_LIB
+ explicit QDoubleVector2D(const QVector2D &vector) : xp(vector.x()), yp(vector.y()) {}
+ operator QVector2D() const { return QVector2D(xp, yp); }
+#endif
bool isNull() const;
@@ -117,14 +121,10 @@ 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
{
diff --git a/src/location/maps/qdoublevector3d.cpp b/src/positioning/qdoublevector3d.cpp
index d35e4848..c4e2cf61 100644
--- a/src/location/maps/qdoublevector3d.cpp
+++ b/src/positioning/qdoublevector3d.cpp
@@ -3,7 +3,7 @@
** 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.
+** This file is part of the QtPositioning module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/location/maps/qdoublevector3d_p.h b/src/positioning/qdoublevector3d_p.h
index e237287d..c2033d34 100644
--- a/src/location/maps/qdoublevector3d_p.h
+++ b/src/positioning/qdoublevector3d_p.h
@@ -3,7 +3,7 @@
** 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.
+** This file is part of the QtPositioning module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -53,24 +53,29 @@
// We mean it.
//
+#ifdef QT_BUILD_LOCATION_LIB
#include <QVector3D>
+#endif
+#include "qpositioningglobal.h"
#include <QtCore/qmetatype.h>
QT_BEGIN_NAMESPACE
class QDoubleVector2D;
-class QDoubleVector3D
+class Q_POSITIONING_EXPORT_PRIVATE 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;
+#ifdef QT_BUILD_LOCATION_LIB
+ explicit QDoubleVector3D(const QVector3D &vector) : xp(vector.x()), yp(vector.y()), zp(vector.z()) {}
+ operator QVector3D() const { return QVector3D(xp, yp, zp); }
+#endif
bool isNull() const;
@@ -131,15 +136,8 @@ 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);
diff --git a/src/positioning/qgeoaddress.h b/src/positioning/qgeoaddress.h
index 1aedd1a5..5d9371c5 100644
--- a/src/positioning/qgeoaddress.h
+++ b/src/positioning/qgeoaddress.h
@@ -44,7 +44,7 @@
#include <QtCore/QMetaType>
#include <QtCore/QSharedDataPointer>
-#include <QtPositioning/qpositioningglobal.h>
+#include "qpositioningglobal.h"
QT_BEGIN_NAMESPACE
diff --git a/src/positioning/qgeocircle.cpp b/src/positioning/qgeocircle.cpp
index 4a4f67aa..60dffb41 100644
--- a/src/positioning/qgeocircle.cpp
+++ b/src/positioning/qgeocircle.cpp
@@ -45,6 +45,8 @@
#include "qgeocoordinate.h"
#include "qnumeric.h"
+#include "qdoublevector2d_p.h"
+#include "qdoublevector3d_p.h"
QT_BEGIN_NAMESPACE
/*!
diff --git a/src/positioning/qgeocoordinate.h b/src/positioning/qgeocoordinate.h
index 23001ad1..a4e76906 100644
--- a/src/positioning/qgeocoordinate.h
+++ b/src/positioning/qgeocoordinate.h
@@ -45,7 +45,7 @@
#include <QtCore/QMetaType>
#include <QtCore/QString>
#include <QSharedDataPointer>
-#include <QtPositioning/qpositioningglobal.h>
+#include "qpositioningglobal.h"
QT_BEGIN_NAMESPACE
diff --git a/src/positioning/qgeolocation.h b/src/positioning/qgeolocation.h
index 395f83f1..5d1aa98c 100644
--- a/src/positioning/qgeolocation.h
+++ b/src/positioning/qgeolocation.h
@@ -44,7 +44,7 @@
#include <QtCore/QSharedDataPointer>
#include <QtCore/QMetaType>
-#include <QtPositioning/qpositioningglobal.h>
+#include "qpositioningglobal.h"
QT_BEGIN_NAMESPACE
diff --git a/src/location/maps/qgeoprojection.cpp b/src/positioning/qgeoprojection.cpp
index 84dc5749..d2cc9243 100644
--- a/src/location/maps/qgeoprojection.cpp
+++ b/src/positioning/qgeoprojection.cpp
@@ -3,7 +3,7 @@
** 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.
+** This file is part of the QtPositioning module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -42,7 +42,6 @@
#include "qgeocoordinate.h"
-#include <QMatrix4x4>
#include <qnumeric.h>
#include <cmath>
@@ -105,4 +104,37 @@ QGeoCoordinate QGeoProjection::mercatorToCoord(const QDoubleVector2D &mercator)
return QGeoCoordinate(lat, lng, 0.0);
}
+QGeoCoordinate QGeoProjection::coordinateInterpolation(const QGeoCoordinate &from, const QGeoCoordinate &to, qreal progress)
+{
+ QDoubleVector2D s = QGeoProjection::coordToMercator(from);
+ QDoubleVector2D e = QGeoProjection::coordToMercator(to);
+
+ 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) * from.altitude() + progress * to.altitude());
+
+ return result;
+}
+
QT_END_NAMESPACE
diff --git a/src/location/maps/qgeoprojection_p.h b/src/positioning/qgeoprojection_p.h
index 4dcf8b4c..d0280030 100644
--- a/src/location/maps/qgeoprojection_p.h
+++ b/src/positioning/qgeoprojection_p.h
@@ -57,18 +57,19 @@
#endif
#include <qglobal.h>
-#include <QtLocation/qlocationglobal.h>
+#include "qpositioningglobal.h"
QT_BEGIN_NAMESPACE
class QGeoCoordinate;
class QDoubleVector2D;
-class Q_LOCATION_EXPORT QGeoProjection
+class Q_POSITIONING_EXPORT_PRIVATE QGeoProjection
{
public:
static QDoubleVector2D coordToMercator(const QGeoCoordinate &coord);
static QGeoCoordinate mercatorToCoord(const QDoubleVector2D &mercator);
+ static QGeoCoordinate coordinateInterpolation(const QGeoCoordinate &from, const QGeoCoordinate &to, qreal progress);
private:
static double realmod(const double a, const double b);
diff --git a/src/positioning/qgeosatelliteinfo.h b/src/positioning/qgeosatelliteinfo.h
index fb13157d..b6c70e4c 100644
--- a/src/positioning/qgeosatelliteinfo.h
+++ b/src/positioning/qgeosatelliteinfo.h
@@ -41,7 +41,7 @@
#ifndef QGEOSATELLITEINFO_H
#define QGEOSATELLITEINFO_H
-#include <QtPositioning/qpositioningglobal.h>
+#include "qpositioningglobal.h"
QT_BEGIN_NAMESPACE
diff --git a/src/positioning/qpositioningglobal.h b/src/positioning/qpositioningglobal.h
index e0de618b..5d1c3dea 100644
--- a/src/positioning/qpositioningglobal.h
+++ b/src/positioning/qpositioningglobal.h
@@ -47,14 +47,18 @@ QT_BEGIN_NAMESPACE
#ifndef QT_STATIC
# if defined(QT_BUILD_POSITIONING_LIB)
-# define Q_POSITIONING_EXPORT Q_DECL_EXPORT
+# define Q_POSITIONING_EXPORT Q_DECL_EXPORT
+# define Q_POSITIONING_EXPORT_PRIVATE Q_DECL_EXPORT
# else
-# define Q_POSITIONING_EXPORT Q_DECL_IMPORT
+# define Q_POSITIONING_EXPORT Q_DECL_IMPORT
+# define Q_POSITIONING_EXPORT_PRIVATE Q_DECL_IMPORT
# endif
#else
# define Q_POSITIONING_EXPORT
+# define Q_POSITIONING_EXPORT_PRIVATE
#endif
+
QT_END_NAMESPACE
#endif // QPOSITIONINGGLOBAL_H
diff --git a/tests/auto/declarative_ui/tst_map_coordinateanimation.qml b/tests/auto/declarative_ui/tst_map_coordinateanimation.qml
new file mode 100644
index 00000000..72c6aed8
--- /dev/null
+++ b/tests/auto/declarative_ui/tst_map_coordinateanimation.qml
@@ -0,0 +1,135 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite 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$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+import QtLocation 5.0
+import QtPositioning 5.3
+
+Item {
+ width:100
+ height:100
+ // General-purpose elements for the test:
+ Plugin { id: testPlugin; name: "qmlgeo.test.plugin"; allowExperimental: true }
+
+
+ property var coordinateList: []
+ property int coordinateCount: 0
+ property int animationDuration: 100
+
+ Map {id: map
+ plugin: testPlugin
+ width: 100
+ height: 100
+ Behavior on center { CoordinateAnimation { duration: animationDuration } }
+
+ onCenterChanged: {
+ if (!coordinateList) {
+ coordinateList = []
+ }
+
+ coordinateList[coordinateCount] = {'latitude': center.latitude, 'longitude': center.longitude}
+ coordinateCount++
+ }
+ }
+
+ function toMercator(coord) {
+ var pi = Math.PI
+ var lon = coord.longitude / 360.0 + 0.5;
+
+ var lat = coord.latitude;
+ lat = 0.5 - (Math.log(Math.tan((pi / 4.0) + (pi / 2.0) * lat / 180.0)) / pi) / 2.0;
+ lat = Math.max(0.0, lat);
+ lat = Math.min(1.0, lat);
+
+ return {'latitude': lat, 'longitude': lon};
+ }
+
+ TestCase {
+ when: windowShown
+ name: "Coordinate animation"
+
+ function test_coordinate_animation() {
+
+ coordinateList = []
+ coordinateCount = 0
+
+ var from = {'latitude': 58.0, 'longitude': 12.0}
+ var to = {'latitude': 62.0, 'longitude': 24.0}
+
+
+ var fromMerc = toMercator(from)
+ var toMerc = toMercator(to)
+
+ var delta = (toMerc.latitude - fromMerc.latitude) / (toMerc.longitude - fromMerc.longitude)
+
+ map.center = QtPositioning.coordinate(from.latitude, from.longitude)
+ wait(animationDuration * 2)
+ map.center = QtPositioning.coordinate(to.latitude, to.longitude)
+ wait(animationDuration * 2)
+
+ //check correct start position
+ compare(coordinateList[0].latitude, from.latitude)
+ compare(coordinateList[0].longitude, from.longitude)
+
+ //check correct end position
+ compare(coordinateList[coordinateList.length - 1].latitude, to.latitude)
+ compare(coordinateList[coordinateList.length - 1].longitude, to.longitude)
+
+ var i
+ var lastLatitude
+ for (i in coordinateList) {
+ var coordinate = coordinateList[i]
+ var mercCoordinate = toMercator(coordinate)
+
+ //check that coordinates from the animation is along a straight line between from and to
+ var estimatedLatitude = fromMerc.latitude + (mercCoordinate.longitude - fromMerc.longitude) * delta
+ verify(mercCoordinate.latitude - estimatedLatitude < 0.00000000001);
+
+ //check that each step has moved in the right direction
+ if (lastLatitude) {
+ verify(coordinate.latitude > lastLatitude)
+ }
+ lastLatitude = coordinate.latitude
+ }
+ }
+ }
+}
diff --git a/tests/auto/doublevectors/doublevectors.pro b/tests/auto/doublevectors/doublevectors.pro
index 98899218..aa42120d 100644
--- a/tests/auto/doublevectors/doublevectors.pro
+++ b/tests/auto/doublevectors/doublevectors.pro
@@ -1,11 +1,8 @@
TEMPLATE = app
CONFIG += testcase
TARGET = tst_doublevectors
-INCLUDEPATH += ../../../src/location/maps
-SOURCES += tst_doublevectors.cpp \
- ../../../src/location/maps/qdoublevector3d.cpp \
- ../../../src/location/maps/qdoublevector2d.cpp
+SOURCES += tst_doublevectors.cpp
-QT += location testlib
+QT += positioning-private testlib
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/doublevectors/tst_doublevectors.cpp b/tests/auto/doublevectors/tst_doublevectors.cpp
index 9ca1ec17..79fe3a88 100644
--- a/tests/auto/doublevectors/tst_doublevectors.cpp
+++ b/tests/auto/doublevectors/tst_doublevectors.cpp
@@ -42,8 +42,8 @@
#include <QtCore/QString>
#include <QtTest/QtTest>
-#include "qdoublevector2d_p.h"
-#include "qdoublevector3d_p.h"
+#include <QtPositioning/private/qdoublevector2d_p.h>
+#include <QtPositioning/private/qdoublevector3d_p.h>
QT_USE_NAMESPACE
diff --git a/tests/auto/geotestplugin/geotestplugin.pro b/tests/auto/geotestplugin/geotestplugin.pro
index 3737414e..2519b7d0 100644
--- a/tests/auto/geotestplugin/geotestplugin.pro
+++ b/tests/auto/geotestplugin/geotestplugin.pro
@@ -1,5 +1,5 @@
TARGET = qtgeoservices_qmltestplugin
-QT += location-private testlib
+QT += location-private positioning-private testlib
PLUGIN_TYPE = geoservices
load(qt_plugin)
diff --git a/tests/auto/qgeocameracapabilities/qgeocameracapabilities.pro b/tests/auto/qgeocameracapabilities/qgeocameracapabilities.pro
index db13ac9b..ec406d8b 100644
--- a/tests/auto/qgeocameracapabilities/qgeocameracapabilities.pro
+++ b/tests/auto/qgeocameracapabilities/qgeocameracapabilities.pro
@@ -6,5 +6,5 @@ INCLUDEPATH += ../../../src/location/maps
SOURCES += tst_qgeocameracapabilities.cpp
-QT += location testlib
+QT += location positioning-private testlib
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qgeocameradata/qgeocameradata.pro b/tests/auto/qgeocameradata/qgeocameradata.pro
index f01d0f34..39f154d2 100644
--- a/tests/auto/qgeocameradata/qgeocameradata.pro
+++ b/tests/auto/qgeocameradata/qgeocameradata.pro
@@ -6,5 +6,5 @@ INCLUDEPATH += ../../../src/location/maps
SOURCES += tst_qgeocameradata.cpp
-QT += location testlib
+QT += location positioning-private testlib
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qgeocameradata/tst_qgeocameradata.cpp b/tests/auto/qgeocameradata/tst_qgeocameradata.cpp
index 3147f057..e273711a 100644
--- a/tests/auto/qgeocameradata/tst_qgeocameradata.cpp
+++ b/tests/auto/qgeocameradata/tst_qgeocameradata.cpp
@@ -46,21 +46,6 @@
QT_USE_NAMESPACE
-// For testing the setters and getters of the QGeoCoordinateInterpolator shared pointer
-class QGeoCoordinateInterpolatorTest : public QGeoCoordinateInterpolator
-{
-public:
- QGeoCoordinateInterpolatorTest(){}
- ~QGeoCoordinateInterpolatorTest(){}
- QGeoCoordinate interpolate(const QGeoCoordinate &start, const QGeoCoordinate &end, qreal progress){
- Q_UNUSED(start);
- Q_UNUSED(end);
- Q_UNUSED(progress);
- return QGeoCoordinate();
- }
-};
-
-
class tst_QGeoCameraData : public QObject
{
Q_OBJECT
@@ -79,7 +64,6 @@ private Q_SLOTS:
void tiltTest();
void rollTest();
void zoomLevelTest();
- void coordinateInterpolatorTest();
void operatorsTest_data();
void operatorsTest();
};
@@ -198,14 +182,6 @@ void tst_QGeoCameraData::zoomLevelTest(){
QCOMPARE(cameraData2.zoomLevel(),8.0);
}
-void tst_QGeoCameraData::coordinateInterpolatorTest(){
- QGeoCameraData cameraData;
- QVERIFY2(cameraData.coordinateInterpolator().isNull(), "Default coordinate interpolator shared point is not null");
- QSharedPointer<QGeoCoordinateInterpolator> testPointer = QSharedPointer<QGeoCoordinateInterpolator>(new QGeoCoordinateInterpolatorTest());
- cameraData.setCoordinateInterpolator(testPointer);
- QVERIFY2(!cameraData.coordinateInterpolator().isNull(), "Coordinate interpolator shared point is null");
-}
-
void tst_QGeoCameraData::operatorsTest_data(){
populateCameraData();
}
diff --git a/tests/auto/qgeocameratiles/qgeocameratiles.pro b/tests/auto/qgeocameratiles/qgeocameratiles.pro
index 35f188eb..1c53e627 100644
--- a/tests/auto/qgeocameratiles/qgeocameratiles.pro
+++ b/tests/auto/qgeocameratiles/qgeocameratiles.pro
@@ -5,5 +5,5 @@ INCLUDEPATH += ../../../src/location/maps
SOURCES += tst_qgeocameratiles.cpp
-QT += location testlib 3d
+QT += location positioning-private testlib 3d
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qgeocameratiles/tst_qgeocameratiles.cpp b/tests/auto/qgeocameratiles/tst_qgeocameratiles.cpp
index fb666424..2aa55f49 100644
--- a/tests/auto/qgeocameratiles/tst_qgeocameratiles.cpp
+++ b/tests/auto/qgeocameratiles/tst_qgeocameratiles.cpp
@@ -44,10 +44,10 @@
#include "qgeotilespec_p.h"
#include "qgeocameratiles_p.h"
#include "qgeocameradata_p.h"
-#include "qgeoprojection_p.h"
-#include "qdoublevector2d_p.h"
#include "qgeomaptype_p.h"
+#include <QtPositioning/private/qgeoprojection_p.h>
+#include <QtPositioning/private/qdoublevector2d_p.h>
#include <qtest.h>
#include <QList>
diff --git a/tests/auto/qgeomapcontroller/qgeomapcontroller.pro b/tests/auto/qgeomapcontroller/qgeomapcontroller.pro
index 352960b7..8f5827b9 100644
--- a/tests/auto/qgeomapcontroller/qgeomapcontroller.pro
+++ b/tests/auto/qgeomapcontroller/qgeomapcontroller.pro
@@ -13,5 +13,5 @@ HEADERS += ../geotestplugin/qgeoserviceproviderplugin_test.h \
SOURCES += tst_qgeomapcontroller.cpp
SOURCES += ../geotestplugin/qgeoserviceproviderplugin_test.cpp
-QT += location-private testlib
+QT += location-private positioning-private testlib
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qgeomapcontroller/tst_qgeomapcontroller.cpp b/tests/auto/qgeomapcontroller/tst_qgeomapcontroller.cpp
index 564b5a3c..0123d375 100644
--- a/tests/auto/qgeomapcontroller/tst_qgeomapcontroller.cpp
+++ b/tests/auto/qgeomapcontroller/tst_qgeomapcontroller.cpp
@@ -81,8 +81,6 @@ private Q_SLOTS:
void rollTest();
void panTest();
void zoomTest();
-
- void animatableCoordinateTest();
};
tst_QGeoMapController::tst_QGeoMapController()
@@ -102,7 +100,7 @@ tst_QGeoMapController::tst_QGeoMapController()
map_->resize(100, 100);
- signalCenterChanged_ = new QSignalSpy(map_->mapController(), SIGNAL(centerChanged(AnimatableCoordinate)));
+ signalCenterChanged_ = new QSignalSpy(map_->mapController(), SIGNAL(centerChanged(QGeoCoordinate)));
signalBearingChanged_ = new QSignalSpy(map_->mapController(), SIGNAL(bearingChanged(qreal)));
signalTiltChanged_ = new QSignalSpy(map_->mapController(), SIGNAL(tiltChanged(qreal)));
signalRollChanged_ = new QSignalSpy(map_->mapController(), SIGNAL(rollChanged(qreal)));
@@ -166,13 +164,12 @@ void tst_QGeoMapController::constructorTest()
cameraData.setRoll(roll);
cameraData.setZoomLevel(zoom);
map_->setCameraData(cameraData);
- QSharedPointer<QGeoCoordinateInterpolator> coordinateInterpolator;
- QGeoMapController mapController(map_, coordinateInterpolator);
+ QGeoMapController mapController(map_);
// make sure the values come out the same
// also make sure the values match what they were actually set to
- QCOMPARE(mapController.center().coordinate(), cameraData.center());
- QCOMPARE(mapController.center().coordinate(), center);
+ QCOMPARE(mapController.center(), cameraData.center());
+ QCOMPARE(mapController.center(), center);
QCOMPARE(mapController.zoom(), cameraData.zoomLevel());
QCOMPARE(mapController.zoom(), zoom);
@@ -192,14 +189,13 @@ void tst_QGeoMapController::constructorTest()
void tst_QGeoMapController::centerTest()
{
- QSharedPointer<QGeoCoordinateInterpolator> coordinateInterpolator;
QGeoCameraData cameraData;
cameraData.setCenter(QGeoCoordinate(10.0,-20.4,30.8));
map_->setCameraData(cameraData);
- QGeoMapController mapController(map_, coordinateInterpolator);
- QCOMPARE(mapController.center().coordinate(),QGeoCoordinate(10.0,-20.4,30.8));
+ QGeoMapController mapController(map_);
+ QCOMPARE(mapController.center(),QGeoCoordinate(10.0,-20.4,30.8));
- AnimatableCoordinate coord(QGeoCoordinate(10.0,20.4,30.8), coordinateInterpolator);
+ QGeoCoordinate coord(10.0,20.4,30.8);
clearSignalSpies();
mapController.setCenter(coord);
@@ -210,10 +206,10 @@ void tst_QGeoMapController::centerTest()
QCOMPARE(signalRollChanged_->count(),0);
QCOMPARE(signalZoomChanged_->count(),0);
- QCOMPARE(mapController.center().coordinate(),QGeoCoordinate(10.0,20.4,30.8));
+ QCOMPARE(mapController.center(),QGeoCoordinate(10.0,20.4,30.8));
- mapController.setCenter(AnimatableCoordinate(QGeoCoordinate(10.0,20.4,30.9), coordinateInterpolator));
- QCOMPARE(mapController.center().coordinate(),QGeoCoordinate(10.0,20.4,30.9));
+ mapController.setCenter(QGeoCoordinate(10.0,20.4,30.9));
+ QCOMPARE(mapController.center(),QGeoCoordinate(10.0,20.4,30.9));
}
void tst_QGeoMapController::bearingTest()
@@ -224,8 +220,7 @@ void tst_QGeoMapController::bearingTest()
QGeoCameraData cameraData;
cameraData.setBearing(bearing);
map_->setCameraData(cameraData);
- QSharedPointer<QGeoCoordinateInterpolator> coordinateInterpolator;
- QGeoMapController mapController(map_, coordinateInterpolator);
+ QGeoMapController mapController(map_);
QCOMPARE(mapController.bearing(),bearing);
clearSignalSpies();
@@ -249,8 +244,7 @@ void tst_QGeoMapController::tiltTest()
QGeoCameraData cameraData;
cameraData.setTilt(tilt);
map_->setCameraData(cameraData);
- QSharedPointer<QGeoCoordinateInterpolator> coordinateInterpolator;
- QGeoMapController mapController(map_, coordinateInterpolator);
+ QGeoMapController mapController(map_);
QCOMPARE(mapController.tilt(),tilt);
tilt = map_->cameraCapabilities().minimumTilt();
@@ -275,8 +269,7 @@ void tst_QGeoMapController::rollTest()
QGeoCameraData cameraData;
cameraData.setRoll(roll);
map_->setCameraData(cameraData);
- QSharedPointer<QGeoCoordinateInterpolator> coordinateInterpolator;
- QGeoMapController mapController(map_, coordinateInterpolator);
+ QGeoMapController mapController(map_);
QCOMPARE(mapController.roll(),roll);
clearSignalSpies();
@@ -294,16 +287,15 @@ void tst_QGeoMapController::rollTest()
void tst_QGeoMapController::panTest()
{
- QSharedPointer<QGeoCoordinateInterpolator> coordinateInterpolator;
- QGeoMapController mapController(map_, coordinateInterpolator);
+ QGeoMapController mapController(map_);
- mapController.setCenter(AnimatableCoordinate(QGeoCoordinate(-1.0,-2.4,3.8), coordinateInterpolator));
+ mapController.setCenter(QGeoCoordinate(-1.0,-2.4,3.8));
// check that pan of zero leaves the camera centre unaltered
mapController.pan(0, 0);
- QCOMPARE(mapController.center().coordinate().altitude(), 3.8);
- QCOMPARE(mapController.center().coordinate().latitude(), -1.0);
- QCOMPARE(mapController.center().coordinate().longitude(), -2.4);
+ QCOMPARE(mapController.center().altitude(), 3.8);
+ QCOMPARE(mapController.center().latitude(), -1.0);
+ QCOMPARE(mapController.center().longitude(), -2.4);
qreal dx = 13.1;
qreal dy = -9.3;
@@ -312,9 +304,9 @@ void tst_QGeoMapController::panTest()
// rather than verify the exact new position, we check that the position has changed and the altitude
// is unaffected
- QCOMPARE(mapController.center().coordinate().altitude(), 3.8);
- QVERIFY(qFuzzyCompare(mapController.center().coordinate().latitude(), -1.0) == false);
- QVERIFY(qFuzzyCompare(mapController.center().coordinate().longitude(), -2.4) == false);
+ QCOMPARE(mapController.center().altitude(), 3.8);
+ QVERIFY(qFuzzyCompare(mapController.center().latitude(), -1.0) == false);
+ QVERIFY(qFuzzyCompare(mapController.center().longitude(), -2.4) == false);
// check correct signal is triggered
QCOMPARE(signalCenterChanged_->count(),1);
@@ -329,8 +321,7 @@ void tst_QGeoMapController::zoomTest()
QGeoCameraData cameraData;
cameraData.setZoomLevel(1.4);
map_->setCameraData(cameraData);
- QSharedPointer<QGeoCoordinateInterpolator> coordinateInterpolator;
- QGeoMapController mapController(map_, coordinateInterpolator);
+ QGeoMapController mapController(map_);
QCOMPARE(mapController.zoom(),1.4);
mapController.setZoom(1.4);
@@ -347,23 +338,6 @@ void tst_QGeoMapController::zoomTest()
QCOMPARE(signalZoomChanged_->count(),1);
}
-void tst_QGeoMapController::animatableCoordinateTest()
-{
- QSharedPointer<QGeoCoordinateInterpolator> coordinateInterpolator;
-
- // modifier tests
- AnimatableCoordinate animCoordinate;
- animCoordinate.setCoordinate(QGeoCoordinate(-1.0,-2.4,3.8));
- QCOMPARE(animCoordinate.coordinate(), QGeoCoordinate(-1.0,-2.4,3.8));
-
- animCoordinate.setInterpolator(coordinateInterpolator);
- QCOMPARE(animCoordinate.interpolator(), coordinateInterpolator);
-
- // constructor test
- AnimatableCoordinate animCoordinateB(QGeoCoordinate(-1.0,-2.4,3.8), coordinateInterpolator);
- QCOMPARE(animCoordinateB.coordinate(), QGeoCoordinate(-1.0,-2.4,3.8));
- QCOMPARE(animCoordinateB.interpolator(), coordinateInterpolator);
-}
QTEST_APPLESS_MAIN(tst_QGeoMapController)
diff --git a/tests/auto/qgeomapscene/qgeomapscene.pro b/tests/auto/qgeomapscene/qgeomapscene.pro
index c7e984e4..a1bacb05 100644
--- a/tests/auto/qgeomapscene/qgeomapscene.pro
+++ b/tests/auto/qgeomapscene/qgeomapscene.pro
@@ -5,5 +5,5 @@ INCLUDEPATH += ../../../src/location/maps
SOURCES += tst_qgeomapscene.cpp
-QT += location 3d testlib
+QT += location positioning-private 3d testlib
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qgeomapscene/tst_qgeomapscene.cpp b/tests/auto/qgeomapscene/tst_qgeomapscene.cpp
index eac628c4..57fc474d 100644
--- a/tests/auto/qgeomapscene/tst_qgeomapscene.cpp
+++ b/tests/auto/qgeomapscene/tst_qgeomapscene.cpp
@@ -45,10 +45,11 @@
#include "qgeomapscene_p.h"
#include "qgeocameratiles_p.h"
#include "qgeocameradata_p.h"
-#include "qgeoprojection_p.h"
-#include "qdoublevector2d_p.h"
#include "qgeotilecache_p.h"
+#include <QtPositioning/private/qgeoprojection_p.h>
+#include <QtPositioning/private/qdoublevector2d_p.h>
+
#include <Qt3D/qglscenenode.h>
#include <Qt3D/qgltexture2d.h>