diff options
author | David Laing <david.laing@nokia.com> | 2012-01-05 16:21:45 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-09 20:55:07 +0100 |
commit | 9a5bcb41a44cd9108690606b79396e424cba983d (patch) | |
tree | f90e0f66c7812de24e8cc1f2b3a03b52bc13056d | |
parent | f75c61a5eed56327fce5a1d798085bc950178089 (diff) | |
download | qtlocation-9a5bcb41a44cd9108690606b79396e424cba983d.tar.gz |
Adding private API warnings for the Maps API.
Also renamed some of the files to follow the naming conventions
for private header files.
Change-Id: I84a6bc0956b942861dfb63169cb4cdcc2033f2df
Reviewed-by: Alex Wilson <alex.wilson@nokia.com>
33 files changed, 452 insertions, 369 deletions
diff --git a/src/imports/location/mapnode.cpp b/src/imports/location/mapnode.cpp index c7c0e66a..cdd3e772 100644 --- a/src/imports/location/mapnode.cpp +++ b/src/imports/location/mapnode.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "mapnode_p.h" -#include "qgeomap.h" +#include "qgeomap_p.h" #include <Qt3D/qglpainter.h> #include <Qt3D/qglframebufferobjectsurface.h> #include <QtGui/QOpenGLFramebufferObject> diff --git a/src/imports/location/qdeclarativegeomap.cpp b/src/imports/location/qdeclarativegeomap.cpp index b9c9cd3c..67141c68 100644 --- a/src/imports/location/qdeclarativegeomap.cpp +++ b/src/imports/location/qdeclarativegeomap.cpp @@ -49,10 +49,10 @@ #include <QtCore/qnumeric.h> #include <QThread> -#include "qgeotilecache.h" -#include "qgeotile.h" -#include "qgeocameradata.h" -#include "qgeomapcontroller.h" +#include "qgeotilecache_p.h" +#include "qgeotile_p.h" +#include "qgeocameradata_p.h" +#include "qgeomapcontroller_p.h" #include "mapnode_p.h" #include <cmath> diff --git a/src/imports/location/qdeclarativegeomap_p.h b/src/imports/location/qdeclarativegeomap_p.h index d1b83eff..06c7fdcb 100644 --- a/src/imports/location/qdeclarativegeomap_p.h +++ b/src/imports/location/qdeclarativegeomap_p.h @@ -54,7 +54,7 @@ #include "qdeclarativegeomapitemview_p.h" #include "qdeclarativegeomapflickable_p.h" #include "qdeclarativegeomappincharea_p.h" -#include "qgeomapcontroller.h" +#include "qgeomapcontroller_p.h" #include "qgeomappingmanager.h" //#define QT_DECLARATIVE_LOCATION_TRACE 1 @@ -69,8 +69,8 @@ #define QLOC_TRACE2(msg1, msg2) #endif -#include "qgeocameradata.h" -#include "qgeomap.h" +#include "qgeocameradata_p.h" +#include "qgeomap_p.h" #include "qdeclarativegeomaptype_p.h" QT_BEGIN_NAMESPACE diff --git a/src/imports/location/qdeclarativegeomapflickable.cpp b/src/imports/location/qdeclarativegeomapflickable.cpp index 70174165..d8cb45f2 100644 --- a/src/imports/location/qdeclarativegeomapflickable.cpp +++ b/src/imports/location/qdeclarativegeomapflickable.cpp @@ -44,9 +44,9 @@ #include <QPropertyAnimation> #include <QEasingCurve> #include "qdeclarativegeomapflickable_p.h" -#include "qgeomapcontroller.h" +#include "qgeomapcontroller_p.h" #include <QTimer> -#include "qgeomap.h" +#include "qgeomap_p.h" #include "math.h" #define QML_MAP_FLICK_DEFAULTMAXVELOCITY 2500 diff --git a/src/imports/location/qdeclarativegeomappincharea.cpp b/src/imports/location/qdeclarativegeomappincharea.cpp index a838f471..3f03a8b0 100644 --- a/src/imports/location/qdeclarativegeomappincharea.cpp +++ b/src/imports/location/qdeclarativegeomappincharea.cpp @@ -47,7 +47,7 @@ #include <QtDeclarative/qdeclarativeinfo.h> #include <QDebug> #include "math.h" -#include "qgeomap.h" +#include "qgeomap_p.h" QT_BEGIN_NAMESPACE diff --git a/src/location/maps/maps.pri b/src/location/maps/maps.pri index 1d1e0078..548b177b 100644 --- a/src/location/maps/maps.pri +++ b/src/location/maps/maps.pri @@ -4,13 +4,10 @@ INCLUDEPATH += maps QT += network qt3d PUBLIC_HEADERS += \ - maps/qgeocameradata.h \ maps/qgeocodereply.h \ maps/qgeocodingmanagerengine.h \ maps/qgeocodingmanager.h \ maps/qgeomaneuver.h \ - maps/qgeomapcontroller.h \ - maps/qgeomap.h \ maps/qgeomappingmanagerengine.h \ maps/qgeomappingmanager.h \ maps/qgeomaptype.h \ @@ -22,18 +19,19 @@ PUBLIC_HEADERS += \ maps/qgeoroutingmanager.h \ maps/qgeoserviceproviderfactory.h \ maps/qgeoserviceprovider.h \ - maps/qgeotilecache.h \ maps/qgeotiledmapreply.h \ - maps/qgeotile.h \ maps/qgeotilespec.h PRIVATE_HEADERS += \ + maps/qgeocameradata_p.h \ maps/qgeocodereply_p.h \ maps/qgeocodingmanagerengine_p.h \ maps/qgeocodingmanager_p.h \ maps/qgeofrustum_p.h \ maps/qgeomaneuver_p.h \ + maps/qgeomapcontroller_p.h \ maps/qgeomap_p.h \ + maps/qgeomap_p_p.h \ maps/qgeomappingmanagerengine_p.h \ maps/qgeomappingmanager_p.h \ maps/qgeomapsphere_p.h \ @@ -47,7 +45,9 @@ PRIVATE_HEADERS += \ maps/qgeoroutingmanagerengine_p.h \ maps/qgeoroutingmanager_p.h \ maps/qgeoserviceprovider_p.h \ + maps/qgeotilecache_p.h \ maps/qgeotiledmapreply_p.h \ + maps/qgeotile_p.h \ maps/qgeotilespec_p.h SOURCES += \ @@ -63,7 +63,7 @@ SOURCES += \ maps/qgeomappingmanagerengine.cpp \ maps/qgeomapsphere.cpp \ maps/qgeomaptype.cpp \ - maps/qgeoprojection2d_p.cpp \ + maps/qgeoprojection2d.cpp \ maps/qgeoprojection.cpp \ maps/qgeoroute.cpp \ maps/qgeoroutereply.cpp \ diff --git a/src/location/maps/qgeocameradata.cpp b/src/location/maps/qgeocameradata.cpp index 4d72205a..1761e3e8 100644 --- a/src/location/maps/qgeocameradata.cpp +++ b/src/location/maps/qgeocameradata.cpp @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "qgeocameradata.h" +#include "qgeocameradata_p.h" #include <QVariant> #include <QVariantAnimation> diff --git a/src/location/maps/qgeocameradata.h b/src/location/maps/qgeocameradata_p.h index bf40e766..17b70b7c 100644 --- a/src/location/maps/qgeocameradata.h +++ b/src/location/maps/qgeocameradata_p.h @@ -38,8 +38,19 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef QGEOCAMERADATA_H -#define QGEOCAMERADATA_H +#ifndef QGEOCAMERADATA_P_H +#define QGEOCAMERADATA_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 "qgeocoordinate.h" #include "qgeoprojection_p.h" @@ -49,8 +60,6 @@ #include <QSharedPointer> #include <QSharedDataPointer> -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QGeoCameraDataPrivate; @@ -102,6 +111,4 @@ QT_END_NAMESPACE Q_DECLARE_METATYPE(QGeoCameraData) -QT_END_HEADER - -#endif // QGEOCAMERADATA_H +#endif // QGEOCAMERADATA_P_H diff --git a/src/location/maps/qgeofrustum.cpp b/src/location/maps/qgeofrustum.cpp index cf9987b6..8d4bb290 100644 --- a/src/location/maps/qgeofrustum.cpp +++ b/src/location/maps/qgeofrustum.cpp @@ -44,6 +44,8 @@ #include <cmath> +QT_BEGIN_NAMESPACE + QGeoFrustum::QGeoFrustum() {} void QGeoFrustum::update(const QGLCamera *camera, double aspectRatio, bool updatePlanes) @@ -136,3 +138,5 @@ QPlane3D QGeoFrustum::plane(Planes planes) const { return planeHash_.value(planes); } + +QT_END_NAMESPACE diff --git a/src/location/maps/qgeofrustum_p.h b/src/location/maps/qgeofrustum_p.h index c7672ff9..1e0a3fa1 100644 --- a/src/location/maps/qgeofrustum_p.h +++ b/src/location/maps/qgeofrustum_p.h @@ -38,8 +38,8 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef QGEOFRUSTUM_H -#define QGEOFRUSTUM_H +#ifndef QGEOFRUSTUM_P_H +#define QGEOFRUSTUM_P_H // // W A R N I N G @@ -140,4 +140,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QGeoFrustum::Planes) QT_END_NAMESPACE -#endif // QGEOFRUSTUM_H +#endif // QGEOFRUSTUM_P_H diff --git a/src/location/maps/qgeomap.cpp b/src/location/maps/qgeomap.cpp index 28766081..7f98902c 100644 --- a/src/location/maps/qgeomap.cpp +++ b/src/location/maps/qgeomap.cpp @@ -38,15 +38,15 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "qgeomap.h" #include "qgeomap_p.h" +#include "qgeomap_p_p.h" -#include "qgeotilecache.h" +#include "qgeotilecache_p.h" #include "qgeomapsphere_p.h" #include "qgeoprojection_p.h" #include "qgeoprojection2d_p.h" -#include "qgeotile.h" -#include "qgeomapcontroller.h" +#include "qgeotile_p.h" +#include "qgeomapcontroller_p.h" #include "qgeomappingmanager.h" @@ -64,6 +64,8 @@ #include <cmath> +QT_BEGIN_NAMESPACE + QGeoMap::QGeoMap(QGeoTileCache *cache, QObject *parent) : QObject(parent) { @@ -1355,3 +1357,5 @@ QList<QVector3D> QGeoMapPrivate::pointsOnLineWithZ(const QVector3D &p1, const QV return results; } + +QT_END_NAMESPACE diff --git a/src/location/maps/qgeomap.h b/src/location/maps/qgeomap.h deleted file mode 100644 index e11f11a3..00000000 --- a/src/location/maps/qgeomap.h +++ /dev/null @@ -1,119 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtLocation module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QGEOMAP_H -#define QGEOMAP_H - -#include <QObject> - -#include "qgeocameradata.h" -#include "qgeomaptype.h" - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QGeoCoordinate; - -class QGeoMappingManager; - -class QGeoTileCache; -class QGeoMapPrivate; -class MapItem; -class QGeoMapController; - -class QGLCamera; -class QGLPainter; - -class QPointF; - -class Q_LOCATION_EXPORT QGeoMap : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QGeoCameraData camera READ cameraData WRITE setCameraData NOTIFY cameraDataChanged) - Q_PROPERTY(QGeoMapType activeMapType READ activeMapType WRITE setActiveMapType NOTIFY activeMapTypeChanged) - -public: - QGeoMap(QGeoTileCache *cache, QObject *parent = 0); - virtual ~QGeoMap(); - - QGeoTileCache* tileCache(); - - void setMappingManager(QGeoMappingManager *manager); - - QGeoMapController* mapController(); - - QGLCamera* glCamera() const; - void paintGL(QGLPainter *painter); - - void resize(int width, int height); - int width() const; - int height() const; - - void setCameraData(const QGeoCameraData &cameraData); - QGeoCameraData cameraData() const; - - QGeoCoordinate screenPositionToCoordinate(const QPointF &pos, bool clipToViewport = true) const; - QPointF coordinateToScreenPosition(const QGeoCoordinate &coordinate, bool clipToViewport = true) const; - - void setActiveMapType(const QGeoMapType mapType); - const QGeoMapType activeMapType() const; - -public Q_SLOTS: - void update(); - -Q_SIGNALS: - void updateRequired(); - void cameraDataChanged(const QGeoCameraData &cameraData); - void activeMapTypeChanged(); - -private: - QGeoMapPrivate *d_ptr; - Q_DECLARE_PRIVATE(QGeoMap) - - friend class QGeoMappingManager; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QGEOMAP_H diff --git a/src/location/maps/qgeomap_p.h b/src/location/maps/qgeomap_p.h index 60c1bb5e..4b077a36 100644 --- a/src/location/maps/qgeomap_p.h +++ b/src/location/maps/qgeomap_p.h @@ -52,98 +52,37 @@ // We mean it. // -#include <QList> -#include <QSet> -#include <QVector> -#include <QPair> -#include <QPolygonF> -#include <QSizeF> -#include <QVector3D> -#include <QMatrix4x4> -#include <QString> - -#include "qgeocameradata.h" -#include "qgeofrustum_p.h" +#include <QObject> +#include "qgeocameradata_p.h" #include "qgeomaptype.h" -#include <QSharedPointer> - QT_BEGIN_NAMESPACE +class QGeoCoordinate; + class QGeoMappingManager; -class QGeoTile; class QGeoTileCache; -class QGeoTileSpec; -class QGeoMap; +class QGeoMapPrivate; +class MapItem; class QGeoMapController; -class QGeoMapSphere; -class QGeoProjection; class QGLCamera; -class QGLSceneNode; class QGLPainter; -class QGeoMapPrivate; +class QPointF; -struct TileMap +class Q_LOCATION_EXPORT QGeoMap : public QObject { - TileMap(int minY, int maxY); - - int size; - int minY; - int maxY; - QVector<int> minX; - QVector<int> maxX; - - void adjust(int tileX, int tileY); -}; - -class IntersectGenerator -{ -public: - enum Axis { - XAxis, - YAxis - }; - IntersectGenerator(const QGeoMapPrivate *mp, - double p1, - double p2, - int t1, - int t2, - Axis axis, - int zoomLevel); - - bool hasNext() const; - QPair<double, int> value() const; - void next(); - -private: - void generateValue(); - -protected: - const QGeoMapPrivate *mp_; - Axis axis_; - int zoomLevel_; - - bool hasNext_; - QPair<double, int> value_; + Q_OBJECT - int current_; - int step_; - int end_; + Q_PROPERTY(QGeoCameraData camera READ cameraData WRITE setCameraData NOTIFY cameraDataChanged) + Q_PROPERTY(QGeoMapType activeMapType READ activeMapType WRITE setActiveMapType NOTIFY activeMapTypeChanged) - int adjust_; - double first_; - double denom_; -}; - -class QGeoMapPrivate -{ public: - QGeoMapPrivate(QGeoMap *parent, QGeoTileCache *cache, int maxZoom, int tileSize); - virtual ~QGeoMapPrivate(); + QGeoMap(QGeoTileCache *cache, QObject *parent = 0); + virtual ~QGeoMap(); QGeoTileCache* tileCache(); @@ -154,99 +93,32 @@ public: QGLCamera* glCamera() const; void paintGL(QGLPainter *painter); - void setCameraData(const QGeoCameraData &cameraData); - QGeoCameraData cameraData() const; - void resize(int width, int height); int width() const; int height() const; - double aspectRatio() const; - QGLSceneNode* createTileSpecNode(const QGeoTileSpec &tileSpec); - QGLSceneNode* createTileNode(const QGeoTile &tile); - - QRect specToRect(const QGeoTileSpec &tileSpec) const; + void setCameraData(const QGeoCameraData &cameraData); + QGeoCameraData cameraData() const; - void update(); + QGeoCoordinate screenPositionToCoordinate(const QPointF &pos, bool clipToViewport = true) const; + QPointF coordinateToScreenPosition(const QGeoCoordinate &coordinate, bool clipToViewport = true) const; - const QGeoMapType activeMapType() const; void setActiveMapType(const QGeoMapType mapType); + const QGeoMapType activeMapType() const; - QGeoCoordinate screenPositionToCoordinate(const QPointF &pos) const; - QPointF coordinateToScreenPosition(const QGeoCoordinate &coordinate) const; - - QVector2D pointToTile(const QVector3D &point, int zoom, bool roundUp = false) const; - QVector3D tileXIntersectToPoint(int zoomLevel, int x) const; - QVector3D tileYIntersectToPoint(int zoomLevel, int y) const; +public Q_SLOTS: + void update(); - void tileFetched(const QGeoTileSpec &spec); +Q_SIGNALS: + void updateRequired(); + void cameraDataChanged(const QGeoCameraData &cameraData); + void activeMapTypeChanged(); private: - void updateGlCamera(QGLCamera* glCamera); - void updateFrustum(QGeoFrustum &frustum); - QList<QGeoTileSpec> updateVisibleTiles(); - - int width_; - int height_; - double aspectRatio_; - - QGeoMap *map_; - QGeoTileCache* cache_; - QGeoMappingManager *manager_; - QString pluginString_; - QGeoMapController *controller_; - - QSharedPointer<QGeoProjection> projection_; - - QGLCamera *glCamera_; - - QGeoCameraData cameraData_; - QGeoFrustum frustum_; - QList<QGeoTileSpec> visibleTiles_; - - QGeoMapSphere *sphere_; - QGeoMapType activeMapType_; - - // from map2d_p.h - - void tilesFromLine(const QVector3D &p1, - const QVector3D &p2, - const QVector2D &t1, - const QVector2D &t2, - int zoomLevel, - TileMap &map) const; - - QList<QGeoTileSpec> tilesFromPoints(const QVector<QVector3D> &points, bool roundUp) const; - - QPair<QList<QVector3D>,QList<QVector3D> > clipPolygonToMap(const QList<QVector3D> &points) const; - - class LengthSorter { - public: - QVector3D base; - bool operator()(const QVector3D &lhs, const QVector3D &rhs) { - return (lhs - base).lengthSquared() < (rhs - base).lengthSquared(); - } - }; - - QList<QVector3D> pointsOnLineWithX(const QVector3D &p1, const QVector3D &p2, double x) const; - QList<QVector3D> pointsOnLineWithY(const QVector3D &p1, const QVector3D &p2, double y) const; - QList<QVector3D> pointsOnLineWithZ(const QVector3D &p1, const QVector3D &p2, double z) const; - - QPair<QList<QVector3D>,QList<QVector3D> > splitPolygonX(const QList<QVector3D> &points, double x) const; - QPair<QList<QVector3D>,QList<QVector3D> > splitPolygonY(const QList<QVector3D> &points, double y) const; - - int maxZoom_; - int tileSize_; - - double baseHeight_; - double sideLength_; - QPolygonF screenPoly_; - QPolygonF screenPolyLeft_; - QPolygonF screenPolyRight_; + QGeoMapPrivate *d_ptr; + Q_DECLARE_PRIVATE(QGeoMap) - QSizeF viewSize_; - QVector3D eye_; - QMatrix4x4 projectionMatrix_; + friend class QGeoMappingManager; }; QT_END_NAMESPACE diff --git a/src/location/maps/qgeomap_p_p.h b/src/location/maps/qgeomap_p_p.h new file mode 100644 index 00000000..c686fb7e --- /dev/null +++ b/src/location/maps/qgeomap_p_p.h @@ -0,0 +1,254 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtLocation module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QGEOMAP_P_P_H +#define QGEOMAP_P_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 <QList> +#include <QSet> +#include <QVector> +#include <QPair> +#include <QPolygonF> +#include <QSizeF> +#include <QVector3D> +#include <QMatrix4x4> +#include <QString> + +#include "qgeocameradata_p.h" +#include "qgeofrustum_p.h" + +#include "qgeomaptype.h" + +#include <QSharedPointer> + +QT_BEGIN_NAMESPACE + +class QGeoMappingManager; + +class QGeoTile; +class QGeoTileCache; +class QGeoTileSpec; +class QGeoMap; +class QGeoMapController; +class QGeoMapSphere; +class QGeoProjection; + +class QGLCamera; +class QGLSceneNode; +class QGLPainter; + +class QGeoMapPrivate; + +struct TileMap +{ + TileMap(int minY, int maxY); + + int size; + int minY; + int maxY; + QVector<int> minX; + QVector<int> maxX; + + void adjust(int tileX, int tileY); +}; + +class IntersectGenerator +{ +public: + enum Axis { + XAxis, + YAxis + }; + IntersectGenerator(const QGeoMapPrivate *mp, + double p1, + double p2, + int t1, + int t2, + Axis axis, + int zoomLevel); + + bool hasNext() const; + QPair<double, int> value() const; + void next(); + +private: + void generateValue(); + +protected: + const QGeoMapPrivate *mp_; + Axis axis_; + int zoomLevel_; + + bool hasNext_; + QPair<double, int> value_; + + int current_; + int step_; + int end_; + + int adjust_; + double first_; + double denom_; +}; + +class QGeoMapPrivate +{ +public: + QGeoMapPrivate(QGeoMap *parent, QGeoTileCache *cache, int maxZoom, int tileSize); + virtual ~QGeoMapPrivate(); + + QGeoTileCache* tileCache(); + + void setMappingManager(QGeoMappingManager *manager); + + QGeoMapController* mapController(); + + QGLCamera* glCamera() const; + void paintGL(QGLPainter *painter); + + void setCameraData(const QGeoCameraData &cameraData); + QGeoCameraData cameraData() const; + + void resize(int width, int height); + int width() const; + int height() const; + double aspectRatio() const; + + QGLSceneNode* createTileSpecNode(const QGeoTileSpec &tileSpec); + QGLSceneNode* createTileNode(const QGeoTile &tile); + + QRect specToRect(const QGeoTileSpec &tileSpec) const; + + void update(); + + const QGeoMapType activeMapType() const; + void setActiveMapType(const QGeoMapType mapType); + + QGeoCoordinate screenPositionToCoordinate(const QPointF &pos) const; + QPointF coordinateToScreenPosition(const QGeoCoordinate &coordinate) const; + + QVector2D pointToTile(const QVector3D &point, int zoom, bool roundUp = false) const; + QVector3D tileXIntersectToPoint(int zoomLevel, int x) const; + QVector3D tileYIntersectToPoint(int zoomLevel, int y) const; + + void tileFetched(const QGeoTileSpec &spec); + +private: + void updateGlCamera(QGLCamera* glCamera); + void updateFrustum(QGeoFrustum &frustum); + QList<QGeoTileSpec> updateVisibleTiles(); + + int width_; + int height_; + double aspectRatio_; + + QGeoMap *map_; + QGeoTileCache* cache_; + QGeoMappingManager *manager_; + QString pluginString_; + QGeoMapController *controller_; + + QSharedPointer<QGeoProjection> projection_; + + QGLCamera *glCamera_; + + QGeoCameraData cameraData_; + QGeoFrustum frustum_; + QList<QGeoTileSpec> visibleTiles_; + + QGeoMapSphere *sphere_; + QGeoMapType activeMapType_; + + // from map2d_p.h + + void tilesFromLine(const QVector3D &p1, + const QVector3D &p2, + const QVector2D &t1, + const QVector2D &t2, + int zoomLevel, + TileMap &map) const; + + QList<QGeoTileSpec> tilesFromPoints(const QVector<QVector3D> &points, bool roundUp) const; + + QPair<QList<QVector3D>,QList<QVector3D> > clipPolygonToMap(const QList<QVector3D> &points) const; + + class LengthSorter { + public: + QVector3D base; + bool operator()(const QVector3D &lhs, const QVector3D &rhs) { + return (lhs - base).lengthSquared() < (rhs - base).lengthSquared(); + } + }; + + QList<QVector3D> pointsOnLineWithX(const QVector3D &p1, const QVector3D &p2, double x) const; + QList<QVector3D> pointsOnLineWithY(const QVector3D &p1, const QVector3D &p2, double y) const; + QList<QVector3D> pointsOnLineWithZ(const QVector3D &p1, const QVector3D &p2, double z) const; + + QPair<QList<QVector3D>,QList<QVector3D> > splitPolygonX(const QList<QVector3D> &points, double x) const; + QPair<QList<QVector3D>,QList<QVector3D> > splitPolygonY(const QList<QVector3D> &points, double y) const; + + int maxZoom_; + int tileSize_; + + double baseHeight_; + double sideLength_; + QPolygonF screenPoly_; + QPolygonF screenPolyLeft_; + QPolygonF screenPolyRight_; + + QSizeF viewSize_; + QVector3D eye_; + QMatrix4x4 projectionMatrix_; +}; + +QT_END_NAMESPACE + +#endif // QGEOMAP_P_P_H diff --git a/src/location/maps/qgeomapcontroller.cpp b/src/location/maps/qgeomapcontroller.cpp index edfee7f5..8ce53405 100644 --- a/src/location/maps/qgeomapcontroller.cpp +++ b/src/location/maps/qgeomapcontroller.cpp @@ -39,9 +39,9 @@ ** ****************************************************************************/ -#include "qgeomapcontroller.h" +#include "qgeomapcontroller_p.h" -#include "qgeomap.h" +#include "qgeomap_p.h" #include "qgeoprojection_p.h" #include <QPointF> @@ -49,6 +49,8 @@ #include <QVariant> #include <QVariantAnimation> +QT_BEGIN_NAMESPACE + QVariant coordinateInterpolator(const AnimatableCoordinate &start, const AnimatableCoordinate &end, qreal progress) @@ -232,3 +234,5 @@ void QGeoMapController::pan(qreal dx, qreal dy) map_->setCameraData(cd); } } + +QT_END_NAMESPACE diff --git a/src/location/maps/qgeomapcontroller.h b/src/location/maps/qgeomapcontroller_p.h index bdd394ee..1ed6f11b 100644 --- a/src/location/maps/qgeomapcontroller.h +++ b/src/location/maps/qgeomapcontroller_p.h @@ -38,14 +38,24 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ - -#ifndef QGEOMAPCONTROLLER_H -#define QGEOMAPCONTROLLER_H +#ifndef QGEOMAPCONTROLLER_P_H +#define QGEOMAPCONTROLLER_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 <QObject> #include "qgeocoordinate.h" -#include "qgeocameradata.h" +#include "qgeocameradata_p.h" QT_BEGIN_NAMESPACE @@ -119,4 +129,4 @@ QT_END_NAMESPACE Q_DECLARE_METATYPE(AnimatableCoordinate) -#endif // QGEOMAPCONTROLLER_H +#endif // QGEOMAPCONTROLLER_P_H diff --git a/src/location/maps/qgeomappingmanager.cpp b/src/location/maps/qgeomappingmanager.cpp index 90b82fdf..27947cfa 100644 --- a/src/location/maps/qgeomappingmanager.cpp +++ b/src/location/maps/qgeomappingmanager.cpp @@ -45,9 +45,9 @@ #include "qgeotiledmapreply.h" -#include "qgeomap.h" #include "qgeomap_p.h" -#include "qgeotilecache.h" +#include "qgeomap_p_p.h" +#include "qgeotilecache_p.h" #include "qgeotilespec.h" #include <QTimer> @@ -410,7 +410,7 @@ QLocale QGeoMappingManager::locale() const return d_ptr->engine->locale(); } -QGeoTileCache::CacheAreas QGeoMappingManager::cacheHint() const +QGeoMappingManager::CacheAreas QGeoMappingManager::cacheHint() const { return d_ptr->engine->cacheHint(); } diff --git a/src/location/maps/qgeomappingmanager.h b/src/location/maps/qgeomappingmanager.h index f12ba378..da80e198 100644 --- a/src/location/maps/qgeomappingmanager.h +++ b/src/location/maps/qgeomappingmanager.h @@ -47,7 +47,6 @@ #include <QPair> #include <QtLocation/qlocationglobal.h> #include "qgeomaptype.h" -#include "qgeotilecache.h" QT_BEGIN_HEADER @@ -69,6 +68,14 @@ class Q_LOCATION_EXPORT QGeoMappingManager : public QObject Q_OBJECT public: + enum CacheArea { + DiskCache = 0x01, + MemoryCache = 0x02, + TextureCache = 0x04, + AllCaches = 0xFF + }; + Q_DECLARE_FLAGS(CacheAreas, CacheArea) + ~QGeoMappingManager(); QString managerName() const; @@ -94,7 +101,7 @@ public: qreal minimumTilt() const; qreal maximumTilt() const; - QGeoTileCache::CacheAreas cacheHint() const; + CacheAreas cacheHint() const; void setLocale(const QLocale &locale); QLocale locale() const; @@ -117,6 +124,8 @@ private: friend class QGeoServiceProvider; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QGeoMappingManager::CacheAreas) + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/location/maps/qgeomappingmanager_p.h b/src/location/maps/qgeomappingmanager_p.h index 2404d937..0eb5bc08 100644 --- a/src/location/maps/qgeomappingmanager_p.h +++ b/src/location/maps/qgeomappingmanager_p.h @@ -59,12 +59,11 @@ #include <QSet> #include <QThread> +QT_BEGIN_NAMESPACE + class QGeoMap; class QGeoTileCache; class QGeoTileSpec; - -QT_BEGIN_NAMESPACE - class QGeoMappingManagerEngine; class QGeoMappingManagerPrivate diff --git a/src/location/maps/qgeomappingmanagerengine.cpp b/src/location/maps/qgeomappingmanagerengine.cpp index f7fff762..b3bc7caa 100644 --- a/src/location/maps/qgeomappingmanagerengine.cpp +++ b/src/location/maps/qgeomappingmanagerengine.cpp @@ -564,13 +564,13 @@ QLocale QGeoMappingManagerEngine::locale() const return d_ptr->locale; } -QGeoTileCache::CacheAreas QGeoMappingManagerEngine::cacheHint() const +QGeoMappingManager::CacheAreas QGeoMappingManagerEngine::cacheHint() const { Q_D(const QGeoMappingManagerEngine); return d->cacheHint; } -void QGeoMappingManagerEngine::setCacheHint(QGeoTileCache::CacheAreas cacheHint) +void QGeoMappingManagerEngine::setCacheHint(QGeoMappingManager::CacheAreas cacheHint) { Q_D(QGeoMappingManagerEngine); d->cacheHint = cacheHint; @@ -587,7 +587,7 @@ QGeoMappingManagerEnginePrivate::QGeoMappingManagerEnginePrivate() supportsTilting(false), minimumTilt(0.0), maximumTilt(0.0), - cacheHint(QGeoTileCache::AllCaches), + cacheHint(QGeoMappingManager::AllCaches), started_(false), stopped_(false) {} diff --git a/src/location/maps/qgeomappingmanagerengine.h b/src/location/maps/qgeomappingmanagerengine.h index eff7a2c7..f5e09d3f 100644 --- a/src/location/maps/qgeomappingmanagerengine.h +++ b/src/location/maps/qgeomappingmanagerengine.h @@ -47,7 +47,7 @@ #include <QPair> #include <QtLocation/qlocationglobal.h> #include "qgeomaptype.h" -#include "qgeotilecache.h" +#include "qgeomappingmanager.h" QT_BEGIN_HEADER @@ -95,7 +95,7 @@ public: qreal minimumTilt() const; qreal maximumTilt() const; - QGeoTileCache::CacheAreas cacheHint() const; + QGeoMappingManager::CacheAreas cacheHint() const; void setLocale(const QLocale &locale); QLocale locale() const; @@ -135,7 +135,7 @@ protected: void setSupportsBearing(bool supportsBearing); void setSupportsTilting(bool supportsTilting); - void setCacheHint(QGeoTileCache::CacheAreas cacheHint); + void setCacheHint(QGeoMappingManager::CacheAreas cacheHint); QGeoMappingManagerEnginePrivate* d_ptr; diff --git a/src/location/maps/qgeomappingmanagerengine_p.h b/src/location/maps/qgeomappingmanagerengine_p.h index 52fe7ba8..db7cd5f0 100644 --- a/src/location/maps/qgeomappingmanagerengine_p.h +++ b/src/location/maps/qgeomappingmanagerengine_p.h @@ -61,7 +61,7 @@ #include <QLocale> #include <QTimer> #include "qgeomaptype.h" -#include "qgeotilecache.h" +#include "qgeomappingmanager.h" class QGeoTileSpec; class QGeoTiledMapReply; @@ -88,7 +88,7 @@ public: bool supportsTilting; qreal minimumTilt; qreal maximumTilt; - QGeoTileCache::CacheAreas cacheHint; + QGeoMappingManager::CacheAreas cacheHint; QLocale locale; bool started_; diff --git a/src/location/maps/qgeomapsphere.cpp b/src/location/maps/qgeomapsphere.cpp index f3b1199c..b828a901 100644 --- a/src/location/maps/qgeomapsphere.cpp +++ b/src/location/maps/qgeomapsphere.cpp @@ -40,10 +40,10 @@ ****************************************************************************/ #include "qgeomapsphere_p.h" -#include "qgeotilecache.h" -#include "qgeotile.h" -#include "qgeomap.h" +#include "qgeotilecache_p.h" +#include "qgeotile_p.h" #include "qgeomap_p.h" +#include "qgeomap_p_p.h" #include "qgeomappingmanager.h" @@ -57,6 +57,8 @@ #include <QVector> #include <QTimer> +QT_BEGIN_NAMESPACE + QGeoMapSphere::QGeoMapSphere(QGeoMap* map, QGeoMapPrivate *mapPrivate, QGeoTileCache *tileCache) : QObject(0), tileCache_(tileCache), @@ -225,3 +227,5 @@ void QGeoMapSphere::paintGL(QGLPainter *painter) updateMutex.unlock(); } + +QT_END_NAMESPACE diff --git a/src/location/maps/qgeomapsphere_p.h b/src/location/maps/qgeomapsphere_p.h index 0df0f360..34799839 100644 --- a/src/location/maps/qgeomapsphere_p.h +++ b/src/location/maps/qgeomapsphere_p.h @@ -38,8 +38,8 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef QGEOMAPSPHERE_H -#define QGEOMAPSPHERE_H +#ifndef QGEOMAPSPHERE_P_H +#define QGEOMAPSPHERE_P_H // // W A R N I N G diff --git a/src/location/maps/qgeomaptype_p.h b/src/location/maps/qgeomaptype_p.h index ef11ad68..c02c2d27 100644 --- a/src/location/maps/qgeomaptype_p.h +++ b/src/location/maps/qgeomaptype_p.h @@ -38,10 +38,20 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ - #ifndef QGEOMAPTYPE_P_H #define QGEOMAPTYPE_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 <QMetaType> #include <QString> #include <QSharedData> diff --git a/src/location/maps/qgeoprojection.cpp b/src/location/maps/qgeoprojection.cpp index ac21868a..b751bcd4 100644 --- a/src/location/maps/qgeoprojection.cpp +++ b/src/location/maps/qgeoprojection.cpp @@ -49,6 +49,8 @@ #include <cmath> +QT_BEGIN_NAMESPACE + QGeoProjection::QGeoProjection() {} QGeoProjection::~QGeoProjection() {} @@ -115,3 +117,5 @@ QGeoCoordinate QGeoProjection::mercatorToCoord(const QVector2D &mercator) const return QGeoCoordinate(lat, lng, 0.0); } + +QT_END_NAMESPACE diff --git a/src/location/maps/qgeoprojection2d_p.cpp b/src/location/maps/qgeoprojection2d.cpp index 87e6e36a..b14c6a3f 100644 --- a/src/location/maps/qgeoprojection2d_p.cpp +++ b/src/location/maps/qgeoprojection2d.cpp @@ -47,6 +47,8 @@ #include <qnumeric.h> +QT_BEGIN_NAMESPACE + QGeoProjection2D::QGeoProjection2D(double baseHeight, double sideLength) : baseHeight_(baseHeight), sideLength_(sideLength) {} @@ -110,3 +112,5 @@ QGeoCoordinate QGeoProjection2D::interpolate(const QGeoCoordinate &start, const result.setAltitude((1.0 - progress) * start.altitude() + progress * end.altitude()); return result; } + +QT_END_NAMESPACE diff --git a/src/location/maps/qgeoprojection_p.h b/src/location/maps/qgeoprojection_p.h index 1d6a970b..fb83a896 100644 --- a/src/location/maps/qgeoprojection_p.h +++ b/src/location/maps/qgeoprojection_p.h @@ -38,8 +38,8 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef QGEOPROJECTION_H -#define QGEOPROJECTION_H +#ifndef QGEOPROJECTION_P_H +#define QGEOPROJECTION_P_H // // W A R N I N G @@ -82,4 +82,4 @@ private: QT_END_NAMESPACE -#endif // QGEOPROJECTION_H +#endif // QGEOPROJECTION_P_H diff --git a/src/location/maps/qgeotile.cpp b/src/location/maps/qgeotile.cpp index 09364423..720dbe54 100644 --- a/src/location/maps/qgeotile.cpp +++ b/src/location/maps/qgeotile.cpp @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "qgeotile.h" +#include "qgeotile_p.h" #include <Qt3D/qgltexture2d.h> #include <Qt3D/qglscenenode.h> diff --git a/src/location/maps/qgeotile.h b/src/location/maps/qgeotile_p.h index c05d48f5..5f7c0be6 100644 --- a/src/location/maps/qgeotile.h +++ b/src/location/maps/qgeotile_p.h @@ -38,15 +38,24 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef QGEOTILE_H -#define QGEOTILE_H +#ifndef QGEOTILE_P_H +#define QGEOTILE_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 "qglobal.h" #include "qgeotilespec.h" -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QGLTexture2D; @@ -82,6 +91,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - -#endif // QGEOTILE_H +#endif // QGEOTILE_P_H diff --git a/src/location/maps/qgeotilecache.cpp b/src/location/maps/qgeotilecache.cpp index e430a39a..c6915529 100644 --- a/src/location/maps/qgeotilecache.cpp +++ b/src/location/maps/qgeotilecache.cpp @@ -38,9 +38,9 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "qgeotilecache.h" +#include "qgeotilecache_p.h" -#include "qgeotile.h" +#include "qgeotile_p.h" #include "qgeotilespec.h" #include "qgeomappingmanager.h" @@ -244,7 +244,7 @@ void QGeoTileCache::update(const QGeoTileSpec &spec, const QGeoTile &tile) } } -void QGeoTileCache::insert(const QGeoTileSpec &spec, const QByteArray &bytes, QGeoTileCache::CacheAreas areas) +void QGeoTileCache::insert(const QGeoTileSpec &spec, const QByteArray &bytes, QGeoMappingManager::CacheAreas areas) { keys_.insert(spec); @@ -254,7 +254,7 @@ void QGeoTileCache::insert(const QGeoTileSpec &spec, const QByteArray &bytes, QG return; } - if (areas & QGeoTileCache::DiskCache) { + if (areas & QGeoMappingManager::DiskCache) { QString filename = tileSpecToFilename(spec, directory_); QFile file(filename); @@ -265,11 +265,11 @@ void QGeoTileCache::insert(const QGeoTileSpec &spec, const QByteArray &bytes, QG addToDiskCache(spec, filename); } - if (areas & QGeoTileCache::MemoryCache) { + if (areas & QGeoMappingManager::MemoryCache) { // addToMemoryCache(spec, pixmap); } - if (areas & QGeoTileCache::TextureCache) { + if (areas & QGeoMappingManager::TextureCache) { addToTextureCache(spec, pixmap); } } diff --git a/src/location/maps/qgeotilecache.h b/src/location/maps/qgeotilecache_p.h index 67d7f2db..3c597840 100644 --- a/src/location/maps/qgeotilecache.h +++ b/src/location/maps/qgeotilecache_p.h @@ -38,8 +38,19 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef QGEOTILECACHE_H -#define QGEOTILECACHE_H +#ifndef QGEOTILECACHE_P_H +#define QGEOTILECACHE_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 <QtLocation/qlocationglobal.h> @@ -47,7 +58,7 @@ #include <QCache> #include <QSet> -QT_BEGIN_HEADER +#include "qgeomappingmanager.h" QT_BEGIN_NAMESPACE @@ -69,14 +80,6 @@ class Q_LOCATION_EXPORT QGeoTileCache : public QObject { Q_OBJECT public: - enum CacheArea { - DiskCache = 0x01, - MemoryCache = 0x02, - TextureCache = 0x04, - AllCaches = 0xFF - }; - Q_DECLARE_FLAGS(CacheAreas, CacheArea) - QGeoTileCache(const QString &directory = QString(), QObject *parent = 0); ~QGeoTileCache(); @@ -103,7 +106,7 @@ public: void evictFromMemoryCache(TileMemory *tm); void evictFromTextureCache(TileTexture *tt); - void insert(const QGeoTileSpec &spec, const QByteArray &bytes, CacheAreas areas = AllCaches); + void insert(const QGeoTileSpec &spec, const QByteArray &bytes, QGeoMappingManager::CacheAreas areas = QGeoMappingManager::AllCaches); void handleError(const QGeoTileSpec &spec, const QString &errorString); private: @@ -126,10 +129,6 @@ private: QList<QGeoTile> cleanupList_; }; -Q_DECLARE_OPERATORS_FOR_FLAGS(QGeoTileCache::CacheAreas) - QT_END_NAMESPACE -QT_END_HEADER - -#endif // QGEOTILECACHE_H +#endif // QGEOTILECACHE_P_H diff --git a/src/location/maps/qgeotilespec_p.h b/src/location/maps/qgeotilespec_p.h index a7f7deb0..cc067d6d 100644 --- a/src/location/maps/qgeotilespec_p.h +++ b/src/location/maps/qgeotilespec_p.h @@ -41,6 +41,17 @@ #ifndef QGEOTILESPEC_P_H #define QGEOTILESPEC_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 <QString> QT_BEGIN_NAMESPACE |