diff options
author | David Laing <david.laing@nokia.com> | 2012-01-04 11:52:21 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-05 07:05:08 +0100 |
commit | 7c2dc2cb57e426bbf8a37cfba988df7a964c5e94 (patch) | |
tree | d484b9167194881918174698d40d8d13af2313ae | |
parent | c9de94f6e4013744e03f93ece7fa960cf500eb12 (diff) | |
download | qtlocation-7c2dc2cb57e426bbf8a37cfba988df7a964c5e94.tar.gz |
Renames the new mapping classes.
Also moves them into src/location/maps.
We still need to take a closer look at which classes are
public and which are private, and then do the associated
file renaming and addition of private header warnings.
Change-Id: Ide0225ad5d5dc23834baaa9f6841646e4c92de39
Reviewed-by: Juha Vuolle <juha.vuolle@nokia.com>
70 files changed, 833 insertions, 1213 deletions
diff --git a/src/imports/location/location.pro b/src/imports/location/location.pro index f1043a30..2202a046 100644 --- a/src/imports/location/location.pro +++ b/src/imports/location/location.pro @@ -8,7 +8,7 @@ QT += declarative quick-private network location declarative qt3d core-private g DESTDIR = $$QT.location.imports/$$TARGETPATH target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH -INCLUDEPATH += ../../location/mapsgl +INCLUDEPATH += ../../location/maps INCLUDEPATH *= $$PWD # On some platforms, build both versions because debug and release diff --git a/src/imports/location/mapnode.cpp b/src/imports/location/mapnode.cpp index 45838486..c2bd8aa9 100644 --- a/src/imports/location/mapnode.cpp +++ b/src/imports/location/mapnode.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "mapnode_p.h" -#include "map.h" +#include "qgeomap.h" #include <Qt3D/qglpainter.h> #include <Qt3D/qglframebufferobjectsurface.h> #include <QtGui/QOpenGLFramebufferObject> @@ -49,7 +49,7 @@ #define GL_MULTISAMPLE 0x809D #endif -MapNode::MapNode(Map* map): QSGGeometryNode(), +MapNode::MapNode(QGeoMap* map): QSGGeometryNode(), m_fbo(0), m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4), m_texture(0), diff --git a/src/imports/location/mapnode_p.h b/src/imports/location/mapnode_p.h index d80d8f80..c0f4c30f 100644 --- a/src/imports/location/mapnode_p.h +++ b/src/imports/location/mapnode_p.h @@ -60,14 +60,14 @@ QT_BEGIN_NAMESPACE -class Map; +class QGeoMap; class QOpenGLFramebufferObject; class QGLPainter; class MapNode : public QSGGeometryNode { public: - MapNode(Map *m_map); + MapNode(QGeoMap *m_map); ~MapNode(); void setSize(const QSize &size); @@ -91,7 +91,7 @@ private: QSGTextureMaterial m_material; QSGGeometry m_geometry; QSGPlainTexture *m_texture; - Map *m_map; + QGeoMap *m_map; QSize m_size; bool m_initialized; bool m_dirtyFBO; diff --git a/src/imports/location/qdeclarativecirclemapitem.cpp b/src/imports/location/qdeclarativecirclemapitem.cpp index 35520d3c..38882ca9 100644 --- a/src/imports/location/qdeclarativecirclemapitem.cpp +++ b/src/imports/location/qdeclarativecirclemapitem.cpp @@ -41,7 +41,7 @@ #include "qdeclarativecirclemapitem_p.h" #include "qdeclarativegeomapquickitem_p.h" -#include "projection_p.h" +#include "qgeoprojection_p.h" #include <cmath> #include <QPen> #include <QPainter> @@ -126,7 +126,7 @@ inline static qreal qgeocoordinate_radToDeg(qreal rad) return rad * 180 / M_PI; } -static void updatePolygon(QPolygonF& points,const Map& map, const QList<QGeoCoordinate> &path, qreal& w, qreal& h) +static void updatePolygon(QPolygonF& points,const QGeoMap& map, const QList<QGeoCoordinate> &path, qreal& w, qreal& h) { qreal minX, maxX, minY, maxY; @@ -255,11 +255,11 @@ void QDeclarativeCircleMapItem::updateMapItemAssumeDirty() updateMapItem(); } -void QDeclarativeCircleMapItem::setMap(QDeclarativeGeoMap* quickMap, Map *map) +void QDeclarativeCircleMapItem::setMap(QDeclarativeGeoMap* quickMap, QGeoMap *map) { QDeclarativeGeoMapItemBase::setMap(quickMap,map); if (map) { - QObject::connect(map, SIGNAL(cameraDataChanged(CameraData)), this, SLOT(handleCameraDataChanged(CameraData))); + QObject::connect(map, SIGNAL(cameraDataChanged(QGeoCameraData)), this, SLOT(handleCameraDataChanged(QGeoCameraData))); dirtyGeoGeometry_ = true; updateMapItem(); } @@ -388,7 +388,7 @@ void QDeclarativeCircleMapItem::updateMapItem() update(); } -void QDeclarativeCircleMapItem::handleCameraDataChanged(const CameraData& cameraData) +void QDeclarativeCircleMapItem::handleCameraDataChanged(const QGeoCameraData& cameraData) { if (cameraData.zoomFactor() != zoomLevel_) { zoomLevel_ = cameraData.zoomFactor(); diff --git a/src/imports/location/qdeclarativecirclemapitem_p.h b/src/imports/location/qdeclarativecirclemapitem_p.h index 14ab51a3..65279d05 100644 --- a/src/imports/location/qdeclarativecirclemapitem_p.h +++ b/src/imports/location/qdeclarativecirclemapitem_p.h @@ -64,7 +64,7 @@ public: QDeclarativeCircleMapItem(QQuickItem *parent = 0); ~QDeclarativeCircleMapItem(); - virtual void setMap(QDeclarativeGeoMap* quickMap, Map *map); + virtual void setMap(QDeclarativeGeoMap* quickMap, QGeoMap *map); //from QuickItem virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *); @@ -92,7 +92,7 @@ protected Q_SLOTS: void updateMapItemAssumeDirty(); private Q_SLOTS: - void handleCameraDataChanged(const CameraData& cameraData); + void handleCameraDataChanged(const QGeoCameraData& cameraData); private: //TODO: pimpl diff --git a/src/imports/location/qdeclarativegeomap.cpp b/src/imports/location/qdeclarativegeomap.cpp index ceea6de4..523e8fe5 100644 --- a/src/imports/location/qdeclarativegeomap.cpp +++ b/src/imports/location/qdeclarativegeomap.cpp @@ -49,10 +49,10 @@ #include <QtCore/qnumeric.h> #include <QThread> -#include "tilecache.h" -#include "tile.h" -#include "cameradata.h" -#include "mapcontroller.h" +#include "qgeotilecache.h" +#include "qgeotile.h" +#include "qgeocameradata.h" +#include "qgeomapcontroller.h" #include "mapnode_p.h" #include <cmath> @@ -123,9 +123,9 @@ QDeclarativeGeoMap::QDeclarativeGeoMap(QQuickItem *parent) setFlags(QQuickItem::ItemHasContents | QQuickItem::ItemClipsChildrenToShape); // Create internal flickable and pinch area. - tileCache_ = new TileCache(); - map_ = new Map(tileCache_, this); - map_->setActiveMapType(MapType()); + tileCache_ = new QGeoTileCache(); + map_ = new QGeoMap(tileCache_, this); + map_->setActiveMapType(QGeoMapType()); flickable_ = new QDeclarativeGeoMapFlickable(this); flickable_->setMap(map_); pinchArea_ = new QDeclarativeGeoMapPinchArea(this, this); @@ -231,7 +231,7 @@ void QDeclarativeGeoMap::keyPressEvent(QKeyEvent *e) if (!mappingManagerInitialized_) return; QLOC_TRACE2(" key: ", e->key()); - CameraData cameraData = map_->cameraData(); + QGeoCameraData cameraData = map_->cameraData(); if (e->key() == Qt::Key_Left) { if (e->modifiers() & Qt::ShiftModifier) { map_->mapController()->pan(-1.0 * map_->width() / 8.0, 0); @@ -377,7 +377,7 @@ void QDeclarativeGeoMap::mappingManagerInitialized() map_->mapController()->setBearing(bearing_); map_->mapController()->setTilt(tilt_); - QList<MapType> types = mappingManager_->supportedMapTypes(); + QList<QGeoMapType> types = mappingManager_->supportedMapTypes(); for (int i = 0; i < types.size(); ++i) { QDeclarativeGeoMapType *type = new QDeclarativeGeoMapType(types[i], this); supportedMapTypes_.append(type); diff --git a/src/imports/location/qdeclarativegeomap_p.h b/src/imports/location/qdeclarativegeomap_p.h index 4108941d..4bab6bfd 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 "mapcontroller.h" +#include "qgeomapcontroller.h" #include "qgeomappingmanager.h" //#define QT_DECLARATIVE_LOCATION_TRACE 1 @@ -69,18 +69,18 @@ #define QLOC_TRACE2(msg1, msg2) #endif -#include "cameradata.h" -#include "map.h" +#include "qgeocameradata.h" +#include "qgeomap.h" #include "qdeclarativegeomaptype_p.h" QT_BEGIN_NAMESPACE class QGLPainter; class QGLSceneNode; -class TileCache; +class QGeoTileCache; class Tile; -class TileSpec; -class MapSphere; +class QGeoTileSpec; +class QGeoMapSphere; class QGeoCoordinate; class QGeoMapObject; @@ -230,8 +230,8 @@ private: QQuickCanvas* canvas_; int touchTimer_; - TileCache *tileCache_; - Map *map_; + QGeoTileCache *tileCache_; + QGeoMap *map_; QList<QObject*> mapItems_; diff --git a/src/imports/location/qdeclarativegeomapflickable.cpp b/src/imports/location/qdeclarativegeomapflickable.cpp index 418db37d..659b8f57 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 "mapcontroller.h" +#include "qgeomapcontroller.h" #include <QTimer> -#include "map.h" +#include "qgeomap.h" #include "math.h" #define QML_MAP_FLICK_DEFAULTMAXVELOCITY 2500 @@ -159,7 +159,7 @@ QDeclarativeGeoMapFlickable::~QDeclarativeGeoMapFlickable() { } -void QDeclarativeGeoMapFlickable::setMap(Map* map) +void QDeclarativeGeoMapFlickable::setMap(QGeoMap* map) { if (map_ || !map) return; diff --git a/src/imports/location/qdeclarativegeomapflickable_p.h b/src/imports/location/qdeclarativegeomapflickable_p.h index 4b14fecc..e96d89e9 100644 --- a/src/imports/location/qdeclarativegeomapflickable_p.h +++ b/src/imports/location/qdeclarativegeomapflickable_p.h @@ -54,8 +54,8 @@ QT_BEGIN_NAMESPACE class QGraphicsSceneMouseEvent; class QPropertyAnimation; -class CameraData; -class Map; +class QGeoCameraData; +class QGeoMap; class QDeclarativeGeoMapFlickable: public QObject { @@ -73,7 +73,7 @@ public: bool enabled() const; void setEnabled(bool enabled); - void setMap(Map* map); + void setMap(QGeoMap* map); bool mousePressEvent(QMouseEvent *event); bool mouseMoveEvent(QMouseEvent *event); @@ -113,7 +113,7 @@ private: QPointF lastPos_; QPointF pressPos_; bool flicking_; - Map* map_; + QGeoMap* map_; QPropertyAnimation* animation_; bool enabled_; bool moving_; diff --git a/src/imports/location/qdeclarativegeomapitembase.cpp b/src/imports/location/qdeclarativegeomapitembase.cpp index a4524b2c..ca26e02b 100644 --- a/src/imports/location/qdeclarativegeomapitembase.cpp +++ b/src/imports/location/qdeclarativegeomapitembase.cpp @@ -71,7 +71,7 @@ void QDeclarativeGeoMapItemBase::dragEnded() { } -void QDeclarativeGeoMapItemBase::setMap(QDeclarativeGeoMap *quickMap, Map *map) { +void QDeclarativeGeoMapItemBase::setMap(QDeclarativeGeoMap *quickMap, QGeoMap *map) { if (quickMap == quickMap_) return; if (quickMap && quickMap_) diff --git a/src/imports/location/qdeclarativegeomapitembase_p.h b/src/imports/location/qdeclarativegeomapitembase_p.h index fd106a9c..cf49205a 100644 --- a/src/imports/location/qdeclarativegeomapitembase_p.h +++ b/src/imports/location/qdeclarativegeomapitembase_p.h @@ -56,20 +56,20 @@ public: QDeclarativeGeoMapItemBase(QQuickItem *parent = 0); virtual ~QDeclarativeGeoMapItemBase(); - virtual void setMap(QDeclarativeGeoMap* quickMap, Map *map); + virtual void setMap(QDeclarativeGeoMap* quickMap, QGeoMap *map); virtual void setPositionOnMap(const QGeoCoordinate& coordinate, const QPointF& offset); virtual bool contains(QPointF point); virtual void dragStarted(); virtual void dragEnded(); QDeclarativeGeoMap* quickMap() {return quickMap_;} - Map* map() {return map_;} + QGeoMap* map() {return map_;} protected Q_SLOT: virtual void updateMapItem() = 0; private: - Map* map_; + QGeoMap* map_; QDeclarativeGeoMap* quickMap_; }; diff --git a/src/imports/location/qdeclarativegeomappincharea.cpp b/src/imports/location/qdeclarativegeomappincharea.cpp index 88592391..d215e517 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 "map.h" +#include "qgeomap.h" QT_BEGIN_NAMESPACE diff --git a/src/imports/location/qdeclarativegeomappincharea_p.h b/src/imports/location/qdeclarativegeomappincharea_p.h index 05685c09..7a5d677a 100644 --- a/src/imports/location/qdeclarativegeomappincharea_p.h +++ b/src/imports/location/qdeclarativegeomappincharea_p.h @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE class QGraphicsSceneMouseEvent; class QDeclarativeGeoMap; class QTouchEvent; -class Map; +class QGeoMap; class QDeclarativeGeoMapPinchEvent : public QObject { diff --git a/src/imports/location/qdeclarativegeomapquickitem.cpp b/src/imports/location/qdeclarativegeomapquickitem.cpp index 49da9c64..d2bf1cb7 100644 --- a/src/imports/location/qdeclarativegeomapquickitem.cpp +++ b/src/imports/location/qdeclarativegeomapquickitem.cpp @@ -158,13 +158,13 @@ void QDeclarativeGeoMapQuickItem::setCoordinate(QDeclarativeCoordinate *coordina emit coordinateChanged(); } -void QDeclarativeGeoMapQuickItem::setMap(QDeclarativeGeoMap* quickMap, Map *map) +void QDeclarativeGeoMapQuickItem::setMap(QDeclarativeGeoMap* quickMap, QGeoMap *map) { QDeclarativeGeoMapItemBase::setMap(quickMap,map); if (map && quickMap) { QObject::connect(quickMap, SIGNAL(heightChanged()), this, SLOT(updateMapItem())); QObject::connect(quickMap, SIGNAL(widthChanged()), this, SLOT(updateMapItem())); - QObject::connect(map, SIGNAL(cameraDataChanged(CameraData)), this, SLOT(updateMapItem())); + QObject::connect(map, SIGNAL(cameraDataChanged(QGeoCameraData)), this, SLOT(updateMapItem())); updateMapItem(); } } diff --git a/src/imports/location/qdeclarativegeomapquickitem_p.h b/src/imports/location/qdeclarativegeomapquickitem_p.h index 10f08c02..121b8e9e 100644 --- a/src/imports/location/qdeclarativegeomapquickitem_p.h +++ b/src/imports/location/qdeclarativegeomapquickitem_p.h @@ -62,7 +62,7 @@ public: QDeclarativeGeoMapQuickItem(QQuickItem *parent = 0); ~QDeclarativeGeoMapQuickItem(); - virtual void setMap(QDeclarativeGeoMap* quickMap, Map *map); + virtual void setMap(QDeclarativeGeoMap* quickMap, QGeoMap *map); void setCoordinate(QDeclarativeCoordinate *coordinate); QDeclarativeCoordinate* coordinate(); diff --git a/src/imports/location/qdeclarativegeomaptype.cpp b/src/imports/location/qdeclarativegeomaptype.cpp index eb51d326..d08fda58 100644 --- a/src/imports/location/qdeclarativegeomaptype.cpp +++ b/src/imports/location/qdeclarativegeomaptype.cpp @@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE \ingroup qml-location */ -QDeclarativeGeoMapType::QDeclarativeGeoMapType(const MapType mapType, QObject* parent) +QDeclarativeGeoMapType::QDeclarativeGeoMapType(const QGeoMapType mapType, QObject* parent) : QObject(parent), mapType_(mapType) {} diff --git a/src/imports/location/qdeclarativegeomaptype_p.h b/src/imports/location/qdeclarativegeomaptype_p.h index c48583e7..5121df0f 100644 --- a/src/imports/location/qdeclarativegeomaptype_p.h +++ b/src/imports/location/qdeclarativegeomaptype_p.h @@ -43,7 +43,7 @@ #define QDECLARATIVEGEOMAPTYPE_H #include <QtDeclarative/qdeclarative.h> -#include "maptype.h" +#include "qgeomaptype.h" #include <QObject> QT_BEGIN_NAMESPACE @@ -60,18 +60,18 @@ class QDeclarativeGeoMapType : public QObject public: enum MapStyle { - NoMap = MapType::NoMap, - StreetMap = MapType::StreetMap, - SatelliteMapDay = MapType::SatelliteMapDay, - SatelliteMapNight = MapType::SatelliteMapNight, - TerrainMap = MapType::TerrainMap, - HybridMap = MapType::HybridMap, - TransitMap = MapType::TransitMap, - GrayStreetMap = MapType::GrayStreetMap, + NoMap = QGeoMapType::NoMap, + StreetMap = QGeoMapType::StreetMap, + SatelliteMapDay = QGeoMapType::SatelliteMapDay, + SatelliteMapNight = QGeoMapType::SatelliteMapNight, + TerrainMap = QGeoMapType::TerrainMap, + HybridMap = QGeoMapType::HybridMap, + TransitMap = QGeoMapType::TransitMap, + GrayStreetMap = QGeoMapType::GrayStreetMap, CustomMap = 100 }; - QDeclarativeGeoMapType(const MapType mapType, QObject* parent = 0); + QDeclarativeGeoMapType(const QGeoMapType mapType, QObject* parent = 0); ~QDeclarativeGeoMapType(); MapStyle style() const; @@ -79,10 +79,10 @@ public: QString description() const; bool mobile() const; - const MapType mapType(){return mapType_;} + const QGeoMapType mapType(){return mapType_;} private: - MapType mapType_; + QGeoMapType mapType_; }; diff --git a/src/imports/location/qdeclarativepolygonmapitem.cpp b/src/imports/location/qdeclarativepolygonmapitem.cpp index 40a56b34..f537544f 100644 --- a/src/imports/location/qdeclarativepolygonmapitem.cpp +++ b/src/imports/location/qdeclarativepolygonmapitem.cpp @@ -111,7 +111,7 @@ struct Vertex QVector2D position; }; -static void updatePolygon(QPolygonF& points,const Map& map, const QList<QGeoCoordinate> &path, qreal& w, qreal& h) +static void updatePolygon(QPolygonF& points,const QGeoMap& map, const QList<QGeoCoordinate> &path, qreal& w, qreal& h) { qreal minX, maxX, minY, maxY; //TODO: dateline handling @@ -197,11 +197,11 @@ QDeclarativeMapLineProperties *QDeclarativePolygonMapItem::border() return &border_; } -void QDeclarativePolygonMapItem::setMap(QDeclarativeGeoMap* quickMap, Map *map) +void QDeclarativePolygonMapItem::setMap(QDeclarativeGeoMap* quickMap, QGeoMap *map) { QDeclarativeGeoMapItemBase::setMap(quickMap,map); if (map) { - QObject::connect(map, SIGNAL(cameraDataChanged(CameraData)), this, SLOT(handleCameraDataChanged(CameraData))); + QObject::connect(map, SIGNAL(cameraDataChanged(QGeoCameraData)), this, SLOT(handleCameraDataChanged(QGeoCameraData))); dirtyGeometry_ = true; updateMapItem(); } @@ -380,7 +380,7 @@ void QDeclarativePolygonMapItem::updateMapItem() update(); } -void QDeclarativePolygonMapItem::handleCameraDataChanged(const CameraData& cameraData) +void QDeclarativePolygonMapItem::handleCameraDataChanged(const QGeoCameraData& cameraData) { if (cameraData.zoomFactor() != zoomLevel_) { zoomLevel_ = cameraData.zoomFactor(); diff --git a/src/imports/location/qdeclarativepolygonmapitem_p.h b/src/imports/location/qdeclarativepolygonmapitem_p.h index 91de848d..617274ae 100644 --- a/src/imports/location/qdeclarativepolygonmapitem_p.h +++ b/src/imports/location/qdeclarativepolygonmapitem_p.h @@ -63,7 +63,7 @@ public: QDeclarativePolygonMapItem(QQuickItem *parent = 0); ~QDeclarativePolygonMapItem(); - virtual void setMap(QDeclarativeGeoMap* quickMap, Map *map); + virtual void setMap(QDeclarativeGeoMap* quickMap, QGeoMap *map); //from QuickItem virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *); @@ -89,7 +89,7 @@ protected Q_SLOTS: private Q_SLOTS: // map size changed - void handleCameraDataChanged(const CameraData& cameraData); + void handleCameraDataChanged(const QGeoCameraData& cameraData); void updateAfterCoordinateChanged(); private: diff --git a/src/imports/location/qdeclarativepolylinemapitem.cpp b/src/imports/location/qdeclarativepolylinemapitem.cpp index 9eaadb2b..efe10cae 100644 --- a/src/imports/location/qdeclarativepolylinemapitem.cpp +++ b/src/imports/location/qdeclarativepolylinemapitem.cpp @@ -143,7 +143,7 @@ struct Vertex QVector2D position; }; -void QDeclarativePolylineMapItem::updatePolyline(QPolygonF& points,const Map& map, const QList<QGeoCoordinate> &path, qreal& w, qreal& h) +void QDeclarativePolylineMapItem::updatePolyline(QPolygonF& points,const QGeoMap& map, const QList<QGeoCoordinate> &path, qreal& w, qreal& h) { qreal minX, maxX, minY, maxY; //TODO: dateline handling @@ -213,11 +213,11 @@ void QDeclarativePolylineMapItem::updateAfterCoordinateChanged() } } -void QDeclarativePolylineMapItem::setMap(QDeclarativeGeoMap* quickMap, Map *map) +void QDeclarativePolylineMapItem::setMap(QDeclarativeGeoMap* quickMap, QGeoMap *map) { QDeclarativeGeoMapItemBase::setMap(quickMap,map); if (map){ - QObject::connect(map, SIGNAL(cameraDataChanged(CameraData)), this, SLOT(handleCameraDataChanged(CameraData))); + QObject::connect(map, SIGNAL(cameraDataChanged(QGeoCameraData)), this, SLOT(handleCameraDataChanged(QGeoCameraData))); dirtyGeometry_ = true; updateMapItem(); } @@ -384,7 +384,7 @@ void QDeclarativePolylineMapItem::updateMapItem() update(); } -void QDeclarativePolylineMapItem::handleCameraDataChanged(const CameraData& cameraData) +void QDeclarativePolylineMapItem::handleCameraDataChanged(const QGeoCameraData& cameraData) { if (cameraData.zoomFactor() != zoomLevel_) { zoomLevel_ = cameraData.zoomFactor(); diff --git a/src/imports/location/qdeclarativepolylinemapitem_p.h b/src/imports/location/qdeclarativepolylinemapitem_p.h index b85c8ead..984d26a1 100644 --- a/src/imports/location/qdeclarativepolylinemapitem_p.h +++ b/src/imports/location/qdeclarativepolylinemapitem_p.h @@ -86,9 +86,9 @@ public: QDeclarativePolylineMapItem(QQuickItem *parent = 0); ~QDeclarativePolylineMapItem(); - static void updatePolyline(QPolygonF& points,const Map& map, const QList<QGeoCoordinate> &path, qreal& w, qreal& h); + static void updatePolyline(QPolygonF& points,const QGeoMap& map, const QList<QGeoCoordinate> &path, qreal& w, qreal& h); - virtual void setMap(QDeclarativeGeoMap* quickMap, Map *map); + virtual void setMap(QDeclarativeGeoMap* quickMap, QGeoMap *map); //from QuickItem virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *); @@ -111,7 +111,7 @@ protected Q_SLOTS: private Q_SLOTS: // map size changed - void handleCameraDataChanged(const CameraData& cameraData); + void handleCameraDataChanged(const QGeoCameraData& cameraData); private: static void path_append(QDeclarativeListProperty<QDeclarativeCoordinate> *prop, QDeclarativeCoordinate *coordinate); diff --git a/src/imports/location/qdeclarativerectanglemapitem.cpp b/src/imports/location/qdeclarativerectanglemapitem.cpp index c1b94109..29d8d615 100644 --- a/src/imports/location/qdeclarativerectanglemapitem.cpp +++ b/src/imports/location/qdeclarativerectanglemapitem.cpp @@ -120,11 +120,11 @@ QDeclarativeRectangleMapItem::~QDeclarativeRectangleMapItem() { } -void QDeclarativeRectangleMapItem::setMap(QDeclarativeGeoMap* quickMap, Map *map) +void QDeclarativeRectangleMapItem::setMap(QDeclarativeGeoMap* quickMap, QGeoMap *map) { QDeclarativeGeoMapItemBase::setMap(quickMap,map); if (map) { - QObject::connect(map, SIGNAL(cameraDataChanged(CameraData)),this, SLOT(handleCameraDataChanged(CameraData))); + QObject::connect(map, SIGNAL(cameraDataChanged(QGeoCameraData)),this, SLOT(handleCameraDataChanged(QGeoCameraData))); dirtyGeometry_ = true; updateMapItem(); } @@ -281,7 +281,7 @@ void QDeclarativeRectangleMapItem::updateMapItem() update(); } -void QDeclarativeRectangleMapItem::handleCameraDataChanged(const CameraData& cameraData) +void QDeclarativeRectangleMapItem::handleCameraDataChanged(const QGeoCameraData& cameraData) { if (cameraData.zoomFactor() != zoomLevel_) { zoomLevel_ = cameraData.zoomFactor(); diff --git a/src/imports/location/qdeclarativerectanglemapitem_p.h b/src/imports/location/qdeclarativerectanglemapitem_p.h index 3686dd5d..a4825a6e 100644 --- a/src/imports/location/qdeclarativerectanglemapitem_p.h +++ b/src/imports/location/qdeclarativerectanglemapitem_p.h @@ -64,7 +64,7 @@ public: QDeclarativeRectangleMapItem(QQuickItem *parent = 0); ~QDeclarativeRectangleMapItem(); - virtual void setMap(QDeclarativeGeoMap* quickMap, Map *map); + virtual void setMap(QDeclarativeGeoMap* quickMap, QGeoMap *map); //from QuickItem virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *); @@ -93,7 +93,7 @@ protected Q_SLOTS: private Q_SLOTS: // map size changed - void handleCameraDataChanged(const CameraData& cameraData); + void handleCameraDataChanged(const QGeoCameraData& cameraData); private: QDeclarativeCoordinate* topLeft_; diff --git a/src/imports/location/qdeclarativeroutemapitem.cpp b/src/imports/location/qdeclarativeroutemapitem.cpp index 33468ead..a5430c4e 100644 --- a/src/imports/location/qdeclarativeroutemapitem.cpp +++ b/src/imports/location/qdeclarativeroutemapitem.cpp @@ -73,7 +73,7 @@ TODO: an example here. do we want to use a RouteModel? */ -static void updatePolyline(QPolygonF& points,const Map& map, const QList<QGeoCoordinate> &path, qreal& w, qreal& h) +static void updatePolyline(QPolygonF& points,const QGeoMap& map, const QList<QGeoCoordinate> &path, qreal& w, qreal& h) { qreal minX, maxX, minY, maxY; @@ -132,11 +132,11 @@ void QDeclarativeRouteMapItem::updateAfterLinePropertiesChanged() updateMapItem(); } -void QDeclarativeRouteMapItem::setMap(QDeclarativeGeoMap* quickMap, Map *map) +void QDeclarativeRouteMapItem::setMap(QDeclarativeGeoMap* quickMap, QGeoMap *map) { QDeclarativeGeoMapItemBase::setMap(quickMap,map); if (map) { - QObject::connect(map, SIGNAL(cameraDataChanged(CameraData)), this, SLOT(handleCameraDataChanged(CameraData))); + QObject::connect(map, SIGNAL(cameraDataChanged(QGeoCameraData)), this, SLOT(handleCameraDataChanged(QGeoCameraData))); dirtyGeometry_ = true; updateMapItem(); } @@ -223,7 +223,7 @@ void QDeclarativeRouteMapItem::updateMapItem() setPositionOnMap(path_.at(0), polyline_.at(0)); } -void QDeclarativeRouteMapItem::handleCameraDataChanged(const CameraData& cameraData) +void QDeclarativeRouteMapItem::handleCameraDataChanged(const QGeoCameraData& cameraData) { if (cameraData.zoomFactor() != zoomLevel_) { zoomLevel_ = cameraData.zoomFactor(); diff --git a/src/imports/location/qdeclarativeroutemapitem_p.h b/src/imports/location/qdeclarativeroutemapitem_p.h index 86da1bb3..7e9ca72a 100644 --- a/src/imports/location/qdeclarativeroutemapitem_p.h +++ b/src/imports/location/qdeclarativeroutemapitem_p.h @@ -64,7 +64,7 @@ public: QDeclarativeRouteMapItem(QQuickItem *parent = 0); ~QDeclarativeRouteMapItem(); - virtual void setMap(QDeclarativeGeoMap* quickMap, Map *map); + virtual void setMap(QDeclarativeGeoMap* quickMap, QGeoMap *map); //from QuickItem virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *); @@ -84,7 +84,7 @@ protected Q_SLOTS: private Q_SLOTS: // map size changed - void handleCameraDataChanged(const CameraData& cameraData); + void handleCameraDataChanged(const QGeoCameraData& cameraData); private: QDeclarativeMapLineProperties line_; diff --git a/src/location/location.pro b/src/location/location.pro index 7c0a288d..33673aad 100644 --- a/src/location/location.pro +++ b/src/location/location.pro @@ -17,7 +17,6 @@ load(qt_module_config) HEADERS += qtlocationversion.h include(maps/maps.pri) -include(mapsgl/mapsgl.pri) include(places/places.pri) PUBLIC_HEADERS += \ diff --git a/src/location/maps/maps.pri b/src/location/maps/maps.pri index 01603279..1d1e0078 100644 --- a/src/location/maps/maps.pri +++ b/src/location/maps/maps.pri @@ -1,46 +1,70 @@ INCLUDEPATH += maps +QT += network qt3d + PUBLIC_HEADERS += \ - maps/qgeocodingmanager.h \ - maps/qgeocodingmanagerengine.h \ + maps/qgeocameradata.h \ maps/qgeocodereply.h \ + maps/qgeocodingmanagerengine.h \ + maps/qgeocodingmanager.h \ maps/qgeomaneuver.h \ - maps/qgeomappingmanager.h \ + maps/qgeomapcontroller.h \ + maps/qgeomap.h \ maps/qgeomappingmanagerengine.h \ + maps/qgeomappingmanager.h \ + maps/qgeomaptype.h \ maps/qgeoroute.h \ maps/qgeoroutereply.h \ maps/qgeorouterequest.h \ maps/qgeoroutesegment.h \ - maps/qgeoroutingmanager.h \ maps/qgeoroutingmanagerengine.h \ - maps/qgeoserviceprovider.h \ + maps/qgeoroutingmanager.h \ maps/qgeoserviceproviderfactory.h \ - maps/qgeotiledmapreply.h + maps/qgeoserviceprovider.h \ + maps/qgeotilecache.h \ + maps/qgeotiledmapreply.h \ + maps/qgeotile.h \ + maps/qgeotilespec.h PRIVATE_HEADERS += \ - maps/qgeocodingmanager_p.h \ - maps/qgeocodingmanagerengine_p.h \ maps/qgeocodereply_p.h \ + maps/qgeocodingmanagerengine_p.h \ + maps/qgeocodingmanager_p.h \ + maps/qgeofrustum_p.h \ maps/qgeomaneuver_p.h \ - maps/qgeomappingmanager_p.h \ + maps/qgeomap_p.h \ maps/qgeomappingmanagerengine_p.h \ + maps/qgeomappingmanager_p.h \ + maps/qgeomapsphere_p.h \ + maps/qgeomaptype_p.h \ + maps/qgeoprojection2d_p.h \ + maps/qgeoprojection_p.h \ maps/qgeoroute_p.h \ maps/qgeoroutereply_p.h \ maps/qgeorouterequest_p.h \ maps/qgeoroutesegment_p.h \ - maps/qgeoroutingmanager_p.h \ maps/qgeoroutingmanagerengine_p.h \ + maps/qgeoroutingmanager_p.h \ maps/qgeoserviceprovider_p.h \ - maps/qgeotiledmapreply_p.h + maps/qgeotiledmapreply_p.h \ + maps/qgeotilespec_p.h SOURCES += \ + maps/qgeocameradata.cpp \ + maps/qgeocodereply.cpp \ maps/qgeocodingmanager.cpp \ maps/qgeocodingmanagerengine.cpp \ - maps/qgeocodereply.cpp \ + maps/qgeofrustum.cpp \ maps/qgeomaneuver.cpp \ + maps/qgeomapcontroller.cpp \ + maps/qgeomap.cpp \ maps/qgeomappingmanager.cpp \ maps/qgeomappingmanagerengine.cpp \ + maps/qgeomapsphere.cpp \ + maps/qgeomaptype.cpp \ + maps/qgeoprojection2d_p.cpp \ + maps/qgeoprojection.cpp \ maps/qgeoroute.cpp \ maps/qgeoroutereply.cpp \ maps/qgeorouterequest.cpp \ @@ -49,4 +73,7 @@ SOURCES += \ maps/qgeoroutingmanagerengine.cpp \ maps/qgeoserviceprovider.cpp \ maps/qgeoserviceproviderfactory.cpp \ - maps/qgeotiledmapreply.cpp + maps/qgeotilecache.cpp \ + maps/qgeotile.cpp \ + maps/qgeotiledmapreply.cpp \ + maps/qgeotilespec.cpp diff --git a/src/location/mapsgl/cameradata.cpp b/src/location/maps/qgeocameradata.cpp index 619c8250..e407c5ba 100644 --- a/src/location/mapsgl/cameradata.cpp +++ b/src/location/maps/qgeocameradata.cpp @@ -38,9 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "cameradata.h" - -#include "projection_p.h" +#include "qgeocameradata.h" #include <QVariant> #include <QVariantAnimation> @@ -53,15 +51,15 @@ QT_BEGIN_NAMESPACE -class CameraDataPrivate : public QSharedData +class QGeoCameraDataPrivate : public QSharedData { public: - CameraDataPrivate(); - CameraDataPrivate(const CameraDataPrivate &rhs); + QGeoCameraDataPrivate(); + QGeoCameraDataPrivate(const QGeoCameraDataPrivate &rhs); - CameraDataPrivate& operator = (const CameraDataPrivate &rhs); + QGeoCameraDataPrivate& operator = (const QGeoCameraDataPrivate &rhs); - bool operator == (const CameraDataPrivate &rhs) const; + bool operator == (const QGeoCameraDataPrivate &rhs) const; QGeoCoordinate center_; double distance_; @@ -72,10 +70,10 @@ public: int zoomLevel_; double zoomFactor_; - QWeakPointer<Projection> projection_; + QWeakPointer<QGeoProjection> projection_; }; -CameraDataPrivate::CameraDataPrivate() +QGeoCameraDataPrivate::QGeoCameraDataPrivate() : QSharedData(), center_(-27.5, 153), distance_(0.02), @@ -85,7 +83,7 @@ CameraDataPrivate::CameraDataPrivate() aspectRatio_(1.0), zoomLevel_(9) {} -CameraDataPrivate::CameraDataPrivate(const CameraDataPrivate &rhs) +QGeoCameraDataPrivate::QGeoCameraDataPrivate(const QGeoCameraDataPrivate &rhs) : QSharedData(rhs), center_(rhs.center_), distance_(rhs.distance_), @@ -97,7 +95,7 @@ CameraDataPrivate::CameraDataPrivate(const CameraDataPrivate &rhs) zoomFactor_(rhs.zoomFactor_), projection_(rhs.projection_) {} -CameraDataPrivate& CameraDataPrivate::operator = (const CameraDataPrivate &rhs) +QGeoCameraDataPrivate& QGeoCameraDataPrivate::operator = (const QGeoCameraDataPrivate &rhs) { center_ = rhs.center_; distance_ = rhs.distance_; @@ -107,7 +105,7 @@ CameraDataPrivate& CameraDataPrivate::operator = (const CameraDataPrivate &rhs) aspectRatio_ = rhs.aspectRatio_; zoomLevel_ = rhs.zoomLevel_; zoomFactor_ = rhs.zoomFactor_; - QSharedPointer<Projection> p = rhs.projection_.toStrongRef(); + QSharedPointer<QGeoProjection> p = rhs.projection_.toStrongRef(); if (p) projection_ = p.toWeakRef(); else @@ -116,7 +114,7 @@ CameraDataPrivate& CameraDataPrivate::operator = (const CameraDataPrivate &rhs) return *this; } -bool CameraDataPrivate::operator == (const CameraDataPrivate &rhs) const +bool QGeoCameraDataPrivate::operator == (const QGeoCameraDataPrivate &rhs) const { return ((center_ == rhs.center_) && (distance_ == rhs.distance_) @@ -128,14 +126,14 @@ bool CameraDataPrivate::operator == (const CameraDataPrivate &rhs) const && (zoomFactor_ == rhs.zoomFactor_)); } -QVariant cameraInterpolator(const CameraData &start, - const CameraData &end, +QVariant cameraInterpolator(const QGeoCameraData &start, + const QGeoCameraData &end, qreal progress) { - CameraData result = start; + QGeoCameraData result = start; - QSharedPointer<Projection> p = start.projection(); + QSharedPointer<QGeoProjection> p = start.projection(); if (!p) p = end.projection(); @@ -155,83 +153,83 @@ QVariant cameraInterpolator(const CameraData &start, return QVariant::fromValue(result); } -CameraData::CameraData() - : d(new CameraDataPrivate()) +QGeoCameraData::QGeoCameraData() + : d(new QGeoCameraDataPrivate()) { - qRegisterMetaType<CameraData>(); - qRegisterAnimationInterpolator<CameraData>(cameraInterpolator); + qRegisterMetaType<QGeoCameraData>(); + qRegisterAnimationInterpolator<QGeoCameraData>(cameraInterpolator); setZoomFactor(4.0); } -CameraData::CameraData(const CameraData &other) +QGeoCameraData::QGeoCameraData(const QGeoCameraData &other) : d(other.d) {} -CameraData::~CameraData() +QGeoCameraData::~QGeoCameraData() { } -CameraData& CameraData::operator = (const CameraData &other) +QGeoCameraData& QGeoCameraData::operator = (const QGeoCameraData &other) { d = other.d; return *this; } -bool CameraData::operator == (const CameraData &rhs) const +bool QGeoCameraData::operator == (const QGeoCameraData &rhs) const { return (*(d.constData()) == *(rhs.d.constData())); } -bool CameraData::operator != (const CameraData &other) const +bool QGeoCameraData::operator != (const QGeoCameraData &other) const { return !(operator==(other)); } -void CameraData::setCenter(const QGeoCoordinate ¢er) +void QGeoCameraData::setCenter(const QGeoCoordinate ¢er) { d->center_ = center; } -QGeoCoordinate CameraData::center() const +QGeoCoordinate QGeoCameraData::center() const { return d->center_; } -void CameraData::setBearing(double bearing) +void QGeoCameraData::setBearing(double bearing) { d->bearing_ = bearing; } -double CameraData::bearing() const +double QGeoCameraData::bearing() const { return d->bearing_; } -void CameraData::setTilt(double tilt) +void QGeoCameraData::setTilt(double tilt) { d->tilt_ = tilt; } -double CameraData::tilt() const +double QGeoCameraData::tilt() const { return d->tilt_; } -void CameraData::setRoll(double roll) +void QGeoCameraData::setRoll(double roll) { d->roll_ = roll; } -double CameraData::roll() const +double QGeoCameraData::roll() const { return d->roll_; } -void CameraData::setAspectRatio(double aspectRatio) +void QGeoCameraData::setAspectRatio(double aspectRatio) { d->aspectRatio_ = aspectRatio; } -double CameraData::aspectRatio() const +double QGeoCameraData::aspectRatio() const { return d->aspectRatio_; } @@ -242,28 +240,28 @@ double CameraData::aspectRatio() const the way to set these. */ -void CameraData::setDistance(double distance) +void QGeoCameraData::setDistance(double distance) { d->zoomFactor_ = -1.0 * log(distance) / log(2.0); d->distance_ = distance; } -double CameraData::distance() const +double QGeoCameraData::distance() const { return d->distance_; } -void CameraData::setZoomLevel(int zoomLevel) +void QGeoCameraData::setZoomLevel(int zoomLevel) { d->zoomLevel_ = zoomLevel; } -int CameraData::zoomLevel() const +int QGeoCameraData::zoomLevel() const { return d->zoomLevel_; } -void CameraData::setZoomFactor(double zoomFactor) +void QGeoCameraData::setZoomFactor(double zoomFactor) { d->zoomLevel_ = floor(zoomFactor); // qDebug() << __FUNCTION__ << zoomFactor << d->zoomLevel_; @@ -275,17 +273,17 @@ void CameraData::setZoomFactor(double zoomFactor) d->zoomFactor_ = zoomFactor; } -double CameraData::zoomFactor() const +double QGeoCameraData::zoomFactor() const { return d->zoomFactor_; } -void CameraData::setProjection(QSharedPointer<Projection> projection) +void QGeoCameraData::setProjection(QSharedPointer<QGeoProjection> projection) { d->projection_ = projection.toWeakRef(); } -QSharedPointer<Projection> CameraData::projection() const +QSharedPointer<QGeoProjection> QGeoCameraData::projection() const { return d->projection_.toStrongRef(); } diff --git a/src/location/mapsgl/cameradata.h b/src/location/maps/qgeocameradata.h index a735a24f..5a9e9233 100644 --- a/src/location/mapsgl/cameradata.h +++ b/src/location/maps/qgeocameradata.h @@ -38,11 +38,11 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef CAMERADATA_H -#define CAMERADATA_H +#ifndef QGEOCAMERADATA_H +#define QGEOCAMERADATA_H #include "qgeocoordinate.h" -#include "projection_p.h" +#include "qgeoprojection_p.h" #include <QMetaType> @@ -53,19 +53,19 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -class CameraDataPrivate; +class QGeoCameraDataPrivate; -class Q_LOCATION_EXPORT CameraData +class Q_LOCATION_EXPORT QGeoCameraData { public: - CameraData(); - CameraData(const CameraData &other); - ~CameraData(); + QGeoCameraData(); + QGeoCameraData(const QGeoCameraData &other); + ~QGeoCameraData(); - CameraData& operator = (const CameraData &other); + QGeoCameraData& operator = (const QGeoCameraData &other); - bool operator == (const CameraData &other) const; - bool operator != (const CameraData &other) const; + bool operator == (const QGeoCameraData &other) const; + bool operator != (const QGeoCameraData &other) const; void setCenter(const QGeoCoordinate &coordinate); QGeoCoordinate center() const; @@ -91,17 +91,17 @@ public: void setZoomFactor(double zoomFactor); double zoomFactor() const; - void setProjection(QSharedPointer<Projection> projection); - QSharedPointer<Projection> projection() const; + void setProjection(QSharedPointer<QGeoProjection> projection); + QSharedPointer<QGeoProjection> projection() const; private: - QSharedDataPointer<CameraDataPrivate> d; + QSharedDataPointer<QGeoCameraDataPrivate> d; }; QT_END_NAMESPACE -Q_DECLARE_METATYPE(CameraData) +Q_DECLARE_METATYPE(QGeoCameraData) QT_END_HEADER -#endif // CAMERADATA_H +#endif // QGEOCAMERADATA_H diff --git a/src/location/mapsgl/frustum.cpp b/src/location/maps/qgeofrustum.cpp index 99ff0fa8..8427707f 100644 --- a/src/location/mapsgl/frustum.cpp +++ b/src/location/maps/qgeofrustum.cpp @@ -38,15 +38,15 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "frustum_p.h" +#include "qgeofrustum_p.h" #include <Qt3D/qglcamera.h> #include <cmath> -Frustum::Frustum() {} +QGeoFrustum::QGeoFrustum() {} -void Frustum::update(const QGLCamera *camera, double aspectRatio, bool updatePlanes) +void QGeoFrustum::update(const QGLCamera *camera, double aspectRatio, bool updatePlanes) { if (aspectRatio > 1.0) { double fov = atan2(camera->viewSize().height() , (2 * camera->nearPlane())); @@ -92,36 +92,36 @@ void Frustum::update(const QGLCamera *camera, double aspectRatio, bool updatePla QPlane3D pn = QPlane3D(bln_, tln_, brn_); pn.setNormal(pn.normal().normalized()); - planeHash_.insert(Frustum::Planes(Frustum::Near), pn); + planeHash_.insert(QGeoFrustum::Planes(QGeoFrustum::Near), pn); QPlane3D pf = QPlane3D(blf_, brf_, tlf_); pf.setNormal(pf.normal().normalized()); - planeHash_.insert(Frustum::Planes(Frustum::Far), pf); + planeHash_.insert(QGeoFrustum::Planes(QGeoFrustum::Far), pf); QPlane3D pl = QPlane3D(blf_, tlf_, bln_); pl.setNormal(pl.normal().normalized()); - planeHash_.insert(Frustum::Planes(Frustum::Left), pl); + planeHash_.insert(QGeoFrustum::Planes(QGeoFrustum::Left), pl); QPlane3D pr = QPlane3D(brf_, brn_, trf_); pr.setNormal(pr.normal().normalized()); - planeHash_.insert(Frustum::Planes(Frustum::Right), pr); + planeHash_.insert(QGeoFrustum::Planes(QGeoFrustum::Right), pr); QPlane3D pt = QPlane3D(tlf_, trf_, tln_); pt.setNormal(pt.normal().normalized()); - planeHash_.insert(Frustum::Planes(Frustum::Top), pt); + planeHash_.insert(QGeoFrustum::Planes(QGeoFrustum::Top), pt); QPlane3D pb = QPlane3D(blf_, bln_, brf_); pb.setNormal(pb.normal().normalized()); - planeHash_.insert(Frustum::Planes(Frustum::Bottom), pb); + planeHash_.insert(QGeoFrustum::Planes(QGeoFrustum::Bottom), pb); } -bool Frustum::contains(const QVector3D ¢er, double radius) const +bool QGeoFrustum::contains(const QVector3D ¢er, double radius) const { if (planeHash_.isEmpty()) return false; - QHash<Frustum::Planes, QPlane3D>::const_iterator i = planeHash_.constBegin(); - QHash<Frustum::Planes, QPlane3D>::const_iterator end = planeHash_.constEnd(); + QHash<QGeoFrustum::Planes, QPlane3D>::const_iterator i = planeHash_.constBegin(); + QHash<QGeoFrustum::Planes, QPlane3D>::const_iterator end = planeHash_.constEnd(); while (i != end) { if (i.value().distanceTo(center) < -1.0 * radius) @@ -132,7 +132,7 @@ bool Frustum::contains(const QVector3D ¢er, double radius) const return true; } -QPlane3D Frustum::plane(Planes planes) const +QPlane3D QGeoFrustum::plane(Planes planes) const { return planeHash_.value(planes); } diff --git a/src/location/mapsgl/frustum_p.h b/src/location/maps/qgeofrustum_p.h index e558b99f..0d1ca0e7 100644 --- a/src/location/mapsgl/frustum_p.h +++ b/src/location/maps/qgeofrustum_p.h @@ -38,8 +38,8 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef TILEFRUSTUM_H -#define TILEFRUSTUM_H +#ifndef QGEOFRUSTUM_H +#define QGEOFRUSTUM_H // // W A R N I N G @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE class QGLCamera; -class Q_AUTOTEST_EXPORT Frustum +class Q_AUTOTEST_EXPORT QGeoFrustum { public: enum Plane { @@ -83,7 +83,7 @@ public: Q_DECLARE_FLAGS(Planes, Plane) - Frustum(); + QGeoFrustum(); void update(const QGLCamera *camera, double aspectRatio, bool updatePlanes = false); @@ -136,8 +136,8 @@ private: QHash<Planes, QPlane3D> planeHash_; }; -Q_DECLARE_OPERATORS_FOR_FLAGS(Frustum::Planes) +Q_DECLARE_OPERATORS_FOR_FLAGS(QGeoFrustum::Planes) QT_END_NAMESPACE -#endif // TILEFRUSTUM_H +#endif // QGEOFRUSTUM_H diff --git a/src/location/mapsgl/map.cpp b/src/location/maps/qgeomap.cpp index 9b168d19..f06fb144 100644 --- a/src/location/mapsgl/map.cpp +++ b/src/location/maps/qgeomap.cpp @@ -38,15 +38,15 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "map.h" -#include "map_p.h" +#include "qgeomap.h" +#include "qgeomap_p.h" -#include "tilecache.h" -#include "mapsphere_p.h" -#include "projection_p.h" -#include "projection2d_p.h" -#include "tile.h" -#include "mapcontroller.h" +#include "qgeotilecache.h" +#include "qgeomapsphere_p.h" +#include "qgeoprojection_p.h" +#include "qgeoprojection2d_p.h" +#include "qgeotile.h" +#include "qgeomapcontroller.h" #include "qgeomappingmanager.h" @@ -64,74 +64,74 @@ #include <cmath> -Map::Map(TileCache *cache, QObject *parent) +QGeoMap::QGeoMap(QGeoTileCache *cache, QObject *parent) : QObject(parent) { // d_ptr = new Map3DPrivate(this, cache, 20000.0); // edge is 2^max zoom * 4 - d_ptr = new MapPrivate(this, cache, 20, 256); + d_ptr = new QGeoMapPrivate(this, cache, 20, 256); } -Map::~Map() +QGeoMap::~QGeoMap() { delete d_ptr; } -TileCache* Map::tileCache() +QGeoTileCache* QGeoMap::tileCache() { - Q_D(Map); + Q_D(QGeoMap); return d->tileCache(); } -MapController* Map::mapController() +QGeoMapController* QGeoMap::mapController() { - Q_D(Map); + Q_D(QGeoMap); return d->mapController(); } -void Map::setMappingManager(QGeoMappingManager *manager) +void QGeoMap::setMappingManager(QGeoMappingManager *manager) { - Q_D(Map); + Q_D(QGeoMap); d->setMappingManager(manager); } -void Map::paintGL(QGLPainter *painter) +void QGeoMap::paintGL(QGLPainter *painter) { - Q_D(Map); + Q_D(QGeoMap); d->paintGL(painter); } -QGLCamera* Map::glCamera() const +QGLCamera* QGeoMap::glCamera() const { - Q_D(const Map); + Q_D(const QGeoMap); return d->glCamera(); } -void Map::resize(int width, int height) +void QGeoMap::resize(int width, int height) { - Q_D(Map); + Q_D(QGeoMap); d->resize(width, height); // always emit this signal to trigger items to redraw emit cameraDataChanged(d->cameraData()); } -int Map::width() const +int QGeoMap::width() const { - Q_D(const Map); + Q_D(const QGeoMap); return d->width(); } -int Map::height() const +int QGeoMap::height() const { - Q_D(const Map); + Q_D(const QGeoMap); return d->height(); } -void Map::setCameraData(const CameraData &cameraData) +void QGeoMap::setCameraData(const QGeoCameraData &cameraData) { - Q_D(Map); + Q_D(QGeoMap); if (cameraData == d->cameraData()) return; @@ -142,22 +142,22 @@ void Map::setCameraData(const CameraData &cameraData) emit cameraDataChanged(d->cameraData()); } -CameraData Map::cameraData() const +QGeoCameraData QGeoMap::cameraData() const { - Q_D(const Map); + Q_D(const QGeoMap); return d->cameraData(); } -void Map::update() +void QGeoMap::update() { - Q_D(Map); + Q_D(QGeoMap); d->update(); emit updateRequired(); } -QGeoCoordinate Map::screenPositionToCoordinate(const QPointF &pos, bool clipToViewport) const +QGeoCoordinate QGeoMap::screenPositionToCoordinate(const QPointF &pos, bool clipToViewport) const { - Q_D(const Map); + Q_D(const QGeoMap); if (clipToViewport) { int w = d->width(); int h = d->height(); @@ -169,9 +169,9 @@ QGeoCoordinate Map::screenPositionToCoordinate(const QPointF &pos, bool clipToVi return d->screenPositionToCoordinate(pos); } -QPointF Map::coordinateToScreenPosition(const QGeoCoordinate &coordinate, bool clipToViewport) const +QPointF QGeoMap::coordinateToScreenPosition(const QGeoCoordinate &coordinate, bool clipToViewport) const { - Q_D(const Map); + Q_D(const QGeoMap); QPointF pos = d->coordinateToScreenPosition(coordinate); if (clipToViewport) { @@ -185,15 +185,15 @@ QPointF Map::coordinateToScreenPosition(const QGeoCoordinate &coordinate, bool c return pos; } -void Map::setActiveMapType(const MapType type) +void QGeoMap::setActiveMapType(const QGeoMapType type) { - Q_D(Map); + Q_D(QGeoMap); d->setActiveMapType(type); } -const MapType Map::activeMapType() const +const QGeoMapType QGeoMap::activeMapType() const { - Q_D(const Map); + Q_D(const QGeoMap); return d->activeMapType(); } @@ -232,7 +232,7 @@ void TileMap::adjust(int tileX, int tileY) } } -IntersectGenerator::IntersectGenerator(const MapPrivate *mp, +IntersectGenerator::IntersectGenerator(const QGeoMapPrivate *mp, double p1, double p2, int t1, @@ -315,22 +315,22 @@ void IntersectGenerator::generateValue() //------------------------------------------------------------// -MapPrivate::MapPrivate(Map *parent, TileCache *cache, int maxZoom, int tileSize) +QGeoMapPrivate::QGeoMapPrivate(QGeoMap *parent, QGeoTileCache *cache, int maxZoom, int tileSize) : map_(parent), cache_(cache), manager_(0), controller_(0), - activeMapType_(MapType()), + activeMapType_(QGeoMapType()), maxZoom_(maxZoom), tileSize_(tileSize), baseHeight_(100.0) { - sphere_ = new MapSphere(parent, this, cache); + sphere_ = new QGeoMapSphere(parent, this, cache); glCamera_ = new QGLCamera(); sideLength_ = pow(2.0, 1.0 * maxZoom_) * tileSize; - projection_ = QSharedPointer<Projection>(new Projection2D(baseHeight_, sideLength_)); + projection_ = QSharedPointer<QGeoProjection>(new QGeoProjection2D(baseHeight_, sideLength_)); screenPoly_.resize(4); screenPoly_[0] = QPointF(0.0, 0.0); screenPoly_[1] = QPointF(0.0, sideLength_); @@ -350,7 +350,7 @@ MapPrivate::MapPrivate(Map *parent, TileCache *cache, int maxZoom, int tileSize) screenPolyRight_[3] = QPointF(sideLength_, 0.0); } -MapPrivate::~MapPrivate() +QGeoMapPrivate::~QGeoMapPrivate() { // controller_ is a child of map_, don't need to delete it here manager_->deregisterMap(map_); @@ -360,12 +360,12 @@ MapPrivate::~MapPrivate() // However: how to ensure this is done in rendering thread? } -TileCache* MapPrivate::tileCache() +QGeoTileCache* QGeoMapPrivate::tileCache() { return cache_; } -QGLSceneNode* MapPrivate::createTileNode(const Tile &tile) +QGLSceneNode* QGeoMapPrivate::createTileNode(const QGeoTile &tile) { QGLSceneNode* node = createTileSpecNode(tile.tileSpec()); @@ -377,7 +377,7 @@ QGLSceneNode* MapPrivate::createTileNode(const Tile &tile) return node; } -void MapPrivate::setMappingManager(QGeoMappingManager *manager) +void QGeoMapPrivate::setMappingManager(QGeoMappingManager *manager) { if (manager) { manager->registerMap(map_); @@ -389,19 +389,19 @@ void MapPrivate::setMappingManager(QGeoMappingManager *manager) manager_ = manager; } -MapController* MapPrivate::mapController() +QGeoMapController* QGeoMapPrivate::mapController() { if (!controller_) - controller_ = new MapController(map_, projection_); + controller_ = new QGeoMapController(map_, projection_); return controller_; } -QGLCamera* MapPrivate::glCamera() const +QGLCamera* QGeoMapPrivate::glCamera() const { return glCamera_; } -void MapPrivate::setCameraData(const CameraData &cameraData) +void QGeoMapPrivate::setCameraData(const QGeoCameraData &cameraData) { cameraData_ = cameraData; cameraData_.setAspectRatio(aspectRatio_); @@ -412,17 +412,17 @@ void MapPrivate::setCameraData(const CameraData &cameraData) sphere_->update(visibleTiles_); } -CameraData MapPrivate::cameraData() const +QGeoCameraData QGeoMapPrivate::cameraData() const { return cameraData_; } -void MapPrivate::update() +void QGeoMapPrivate::update() { sphere_->update(visibleTiles_); } -void MapPrivate::resize(int width, int height) +void QGeoMapPrivate::resize(int width, int height) { width_ = width; height_ = height; @@ -430,7 +430,7 @@ void MapPrivate::resize(int width, int height) setCameraData(cameraData_); } -QVector2D MapPrivate::pointToTile(const QVector3D &point, int zoom, bool roundUp) const +QVector2D QGeoMapPrivate::pointToTile(const QVector3D &point, int zoom, bool roundUp) const { QVector2D p = projection_->pointToMercator(point); @@ -454,42 +454,42 @@ QVector2D MapPrivate::pointToTile(const QVector3D &point, int zoom, bool roundUp return QVector2D(x, y); } -QVector3D MapPrivate::tileXIntersectToPoint(int zoomLevel, int x) const +QVector3D QGeoMapPrivate::tileXIntersectToPoint(int zoomLevel, int x) const { int zpow2 = 1 << zoomLevel; return projection_->mercatorToPoint(QVector2D(x * 1.0 / zpow2, zpow2 / 2.0)); } -QVector3D MapPrivate::tileYIntersectToPoint(int zoomLevel, int y) const +QVector3D QGeoMapPrivate::tileYIntersectToPoint(int zoomLevel, int y) const { int zpow2 = 1 << zoomLevel; return projection_->mercatorToPoint(QVector2D(zpow2 / 2.0, y * 1.0 / zpow2)); } -int MapPrivate::width() const +int QGeoMapPrivate::width() const { return width_; } -int MapPrivate::height() const +int QGeoMapPrivate::height() const { return height_; } -double MapPrivate::aspectRatio() const +double QGeoMapPrivate::aspectRatio() const { return aspectRatio_; } -void MapPrivate::setActiveMapType(const MapType type) +void QGeoMapPrivate::setActiveMapType(const QGeoMapType type) { activeMapType_ = type; //TODO: check if this shared //make it more optimal //rewrite current specs - QList<TileSpec> temp = visibleTiles_; + QList<QGeoTileSpec> temp = visibleTiles_; visibleTiles_.clear(); - foreach (TileSpec spec,temp) { + foreach (QGeoTileSpec spec,temp) { spec.setMapId(type.mapId()); visibleTiles_ << spec; } @@ -497,17 +497,17 @@ void MapPrivate::setActiveMapType(const MapType type) map_->update(); } -const MapType MapPrivate::activeMapType() const +const QGeoMapType QGeoMapPrivate::activeMapType() const { return activeMapType_; } -void MapPrivate::tileFetched(const TileSpec &spec) +void QGeoMapPrivate::tileFetched(const QGeoTileSpec &spec) { sphere_->tileFetched(spec); } -QRect MapPrivate::specToRect(const TileSpec &tileSpec) const +QRect QGeoMapPrivate::specToRect(const QGeoTileSpec &tileSpec) const { int geomZoom = tileSpec.zoom(); int x = tileSpec.x(); @@ -539,7 +539,7 @@ QRect MapPrivate::specToRect(const TileSpec &tileSpec) const return QRect(bl.x(), bl.y(), br.x() - tl.x() - 1, tl.y() - br.y() - 1); } -QGLSceneNode* MapPrivate::createTileSpecNode(const TileSpec &tileSpec) +QGLSceneNode* QGeoMapPrivate::createTileSpecNode(const QGeoTileSpec &tileSpec) { int geomZoom = tileSpec.zoom(); int tileZoom = geomZoom; @@ -613,7 +613,7 @@ QGLSceneNode* MapPrivate::createTileSpecNode(const TileSpec &tileSpec) return builder.finalizedSceneNode(); } -void MapPrivate::paintGL(QGLPainter *painter) +void QGeoMapPrivate::paintGL(QGLPainter *painter) { double side = pow(2.0, cameraData_.zoomFactor()) * tileSize_; double mapWidth = width_ * 1.0; @@ -676,11 +676,11 @@ void MapPrivate::paintGL(QGLPainter *painter) camera->blockSignals(old); } -void MapPrivate::updateGlCamera(QGLCamera* glCamera) +void QGeoMapPrivate::updateGlCamera(QGLCamera* glCamera) { bool old = glCamera->blockSignals(true); - CameraData camera = cameraData(); + QGeoCameraData camera = cameraData(); double f = 1.0 * qMin(width(), height()) / tileSize_; @@ -735,7 +735,7 @@ void MapPrivate::updateGlCamera(QGLCamera* glCamera) projectionMatrix_ = glCamera->projectionMatrix(aspectRatio()) * glCamera->modelViewMatrix(); } -QGeoCoordinate MapPrivate::screenPositionToCoordinate(const QPointF &pos) const +QGeoCoordinate QGeoMapPrivate::screenPositionToCoordinate(const QPointF &pos) const { double side = pow(2.0, cameraData_.zoomFactor()) * tileSize_; double mapWidth = width_ * 1.0; @@ -789,7 +789,7 @@ QGeoCoordinate MapPrivate::screenPositionToCoordinate(const QPointF &pos) const return projection_->pointToCoord(c); } -QPointF MapPrivate::coordinateToScreenPosition(const QGeoCoordinate &coordinate) const +QPointF QGeoMapPrivate::coordinateToScreenPosition(const QGeoCoordinate &coordinate) const { QVector3D c = projection_->coordToPoint(coordinate); QVector3D d = projectionMatrix_.map(c); @@ -829,12 +829,12 @@ QPointF MapPrivate::coordinateToScreenPosition(const QGeoCoordinate &coordinate) return ret; } -void MapPrivate::updateFrustum(Frustum &frustum) +void QGeoMapPrivate::updateFrustum(QGeoFrustum &frustum) { frustum.update(glCamera(), cameraData().aspectRatio()); } -QList<TileSpec> MapPrivate::updateVisibleTiles() +QList<QGeoTileSpec> QGeoMapPrivate::updateVisibleTiles() { QList<QVector3D> points; @@ -853,7 +853,7 @@ QList<TileSpec> MapPrivate::updateVisibleTiles() points.append(pointsOnLineWithZ(frustum_.bottomRightFar(), frustum_.topRightFar(), baseHeight_)); points.append(pointsOnLineWithZ(frustum_.topRightFar(), frustum_.topLeftFar(), baseHeight_)); - QList<TileSpec> tiles; + QList<QGeoTileSpec> tiles; if (points.isEmpty()) return tiles; @@ -952,12 +952,12 @@ QList<TileSpec> MapPrivate::updateVisibleTiles() return tiles; } -QList<TileSpec> MapPrivate::tilesFromPoints(const QVector<QVector3D> &points, bool roundUp) const +QList<QGeoTileSpec> QGeoMapPrivate::tilesFromPoints(const QVector<QVector3D> &points, bool roundUp) const { int numPoints = points.size(); if (numPoints == 0) - return QList<TileSpec>(); + return QList<QGeoTileSpec>(); int zoomLevel = cameraData().zoomLevel(); @@ -984,7 +984,7 @@ QList<TileSpec> MapPrivate::tilesFromPoints(const QVector<QVector3D> &points, bo tilesFromLine(points.at(i1), points.at(i2), tiles.at(i1), tiles.at(i2), zoomLevel, map); } - QList<TileSpec> results; + QList<QGeoTileSpec> results; results.reserve(map.size); @@ -994,13 +994,13 @@ QList<TileSpec> MapPrivate::tilesFromPoints(const QVector<QVector3D> &points, bo int minX = map.minX[i]; int maxX = map.maxX[i]; for (int x = minX; x <= maxX; ++x) - results << TileSpec(pluginString_, activeMapType().mapId(), zoomLevel, x, y); + results << QGeoTileSpec(pluginString_, activeMapType().mapId(), zoomLevel, x, y); } return results; } -void MapPrivate::tilesFromLine(const QVector3D &p1, +void QGeoMapPrivate::tilesFromLine(const QVector3D &p1, const QVector3D &p2, const QVector2D &t1, const QVector2D &t2, @@ -1052,7 +1052,7 @@ void MapPrivate::tilesFromLine(const QVector3D &p1, } } -QPair<QList<QVector3D>,QList<QVector3D> > MapPrivate::clipPolygonToMap(const QList<QVector3D> &points) const +QPair<QList<QVector3D>,QList<QVector3D> > QGeoMapPrivate::clipPolygonToMap(const QList<QVector3D> &points) const { bool clipX0 = false; bool clipX1 = false; @@ -1107,7 +1107,7 @@ QPair<QList<QVector3D>,QList<QVector3D> > MapPrivate::clipPolygonToMap(const QLi } } -QPair<QList<QVector3D>,QList<QVector3D> > MapPrivate::splitPolygonY(const QList<QVector3D> &points, double y) const +QPair<QList<QVector3D>,QList<QVector3D> > QGeoMapPrivate::splitPolygonY(const QList<QVector3D> &points, double y) const { QList<QVector3D> pointsBelow; QList<QVector3D> pointsAbove; @@ -1205,7 +1205,7 @@ QPair<QList<QVector3D>,QList<QVector3D> > MapPrivate::splitPolygonY(const QList< return QPair<QList<QVector3D>,QList<QVector3D> >(pointsBelow, pointsAbove); } -QPair<QList<QVector3D>,QList<QVector3D> > MapPrivate::splitPolygonX(const QList<QVector3D> &points, double x) const +QPair<QList<QVector3D>,QList<QVector3D> > QGeoMapPrivate::splitPolygonX(const QList<QVector3D> &points, double x) const { QList<QVector3D> pointsBelow; QList<QVector3D> pointsAbove; @@ -1302,7 +1302,7 @@ QPair<QList<QVector3D>,QList<QVector3D> > MapPrivate::splitPolygonX(const QList< return QPair<QList<QVector3D>,QList<QVector3D> >(pointsBelow, pointsAbove); } -QList<QVector3D> MapPrivate::pointsOnLineWithX(const QVector3D &p1, const QVector3D &p2, double x) const +QList<QVector3D> QGeoMapPrivate::pointsOnLineWithX(const QVector3D &p1, const QVector3D &p2, double x) const { QList<QVector3D> results; @@ -1320,7 +1320,7 @@ QList<QVector3D> MapPrivate::pointsOnLineWithX(const QVector3D &p1, const QVecto return results; } -QList<QVector3D> MapPrivate::pointsOnLineWithY(const QVector3D &p1, const QVector3D &p2, double y) const +QList<QVector3D> QGeoMapPrivate::pointsOnLineWithY(const QVector3D &p1, const QVector3D &p2, double y) const { QList<QVector3D> results; @@ -1338,7 +1338,7 @@ QList<QVector3D> MapPrivate::pointsOnLineWithY(const QVector3D &p1, const QVecto return results; } -QList<QVector3D> MapPrivate::pointsOnLineWithZ(const QVector3D &p1, const QVector3D &p2, double z) const +QList<QVector3D> QGeoMapPrivate::pointsOnLineWithZ(const QVector3D &p1, const QVector3D &p2, double z) const { QList<QVector3D> results; diff --git a/src/location/mapsgl/map.h b/src/location/maps/qgeomap.h index 8b3644e9..e9fba052 100644 --- a/src/location/mapsgl/map.h +++ b/src/location/maps/qgeomap.h @@ -38,13 +38,13 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef MAP_H -#define MAP_H +#ifndef QGEOMAP_H +#define QGEOMAP_H #include <QObject> -#include "cameradata.h" -#include "maptype.h" +#include "qgeocameradata.h" +#include "qgeomaptype.h" QT_BEGIN_HEADER @@ -54,32 +54,32 @@ class QGeoCoordinate; class QGeoMappingManager; -class TileCache; -class MapPrivate; +class QGeoTileCache; +class QGeoMapPrivate; class MapItem; -class MapController; +class QGeoMapController; class QGLCamera; class QGLPainter; class QPointF; -class Q_LOCATION_EXPORT Map : public QObject +class Q_LOCATION_EXPORT QGeoMap : public QObject { Q_OBJECT - Q_PROPERTY(CameraData camera READ cameraData WRITE setCameraData NOTIFY cameraDataChanged) - Q_PROPERTY(MapType activeMapType READ activeMapType WRITE setActiveMapType NOTIFY activeMapTypeChanged) + Q_PROPERTY(QGeoCameraData camera READ cameraData WRITE setCameraData NOTIFY cameraDataChanged) + Q_PROPERTY(QGeoMapType activeMapType READ activeMapType WRITE setActiveMapType NOTIFY activeMapTypeChanged) public: - Map(TileCache *cache, QObject *parent = 0); - virtual ~Map(); + QGeoMap(QGeoTileCache *cache, QObject *parent = 0); + virtual ~QGeoMap(); - TileCache* tileCache(); + QGeoTileCache* tileCache(); void setMappingManager(QGeoMappingManager *manager); - MapController* mapController(); + QGeoMapController* mapController(); QGLCamera* glCamera() const; void paintGL(QGLPainter *painter); @@ -88,26 +88,26 @@ public: int width() const; int height() const; - void setCameraData(const CameraData &cameraData); - CameraData cameraData() 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 MapType mapType); - const MapType activeMapType() const; + void setActiveMapType(const QGeoMapType mapType); + const QGeoMapType activeMapType() const; public Q_SLOTS: void update(); Q_SIGNALS: void updateRequired(); - void cameraDataChanged(const CameraData &cameraData); + void cameraDataChanged(const QGeoCameraData &cameraData); void activeMapTypeChanged(); private: - MapPrivate *d_ptr; - Q_DECLARE_PRIVATE(Map) + QGeoMapPrivate *d_ptr; + Q_DECLARE_PRIVATE(QGeoMap) friend class QGeoMappingManager; }; @@ -116,4 +116,4 @@ QT_END_NAMESPACE QT_END_HEADER -#endif // MAP_H +#endif // QGEOMAP_H diff --git a/src/location/mapsgl/map_p.h b/src/location/maps/qgeomap_p.h index 989c15ef..d8a4530c 100644 --- a/src/location/mapsgl/map_p.h +++ b/src/location/maps/qgeomap_p.h @@ -38,8 +38,8 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef MAP_P_H -#define MAP_P_H +#ifndef QGEOMAP_P_H +#define QGEOMAP_P_H // // W A R N I N G @@ -62,10 +62,10 @@ #include <QMatrix4x4> #include <QString> -#include "cameradata.h" -#include "frustum_p.h" +#include "qgeocameradata.h" +#include "qgeofrustum_p.h" -#include "maptype.h" +#include "qgeomaptype.h" #include <QSharedPointer> @@ -73,19 +73,19 @@ QT_BEGIN_NAMESPACE class QGeoMappingManager; -class Tile; -class TileCache; -class TileSpec; -class Map; -class MapController; -class MapSphere; -class Projection; +class QGeoTile; +class QGeoTileCache; +class QGeoTileSpec; +class QGeoMap; +class QGeoMapController; +class QGeoMapSphere; +class QGeoProjection; class QGLCamera; class QGLSceneNode; class QGLPainter; -class MapPrivate; +class QGeoMapPrivate; struct TileMap { @@ -107,7 +107,7 @@ public: XAxis, YAxis }; - IntersectGenerator(const MapPrivate *mp, + IntersectGenerator(const QGeoMapPrivate *mp, double p1, double p2, int t1, @@ -123,7 +123,7 @@ private: void generateValue(); protected: - const MapPrivate *mp_; + const QGeoMapPrivate *mp_; Axis axis_; int zoomLevel_; @@ -139,38 +139,38 @@ protected: double denom_; }; -class MapPrivate +class QGeoMapPrivate { public: - MapPrivate(Map *parent, TileCache *cache, int maxZoom, int tileSize); - virtual ~MapPrivate(); + QGeoMapPrivate(QGeoMap *parent, QGeoTileCache *cache, int maxZoom, int tileSize); + virtual ~QGeoMapPrivate(); - TileCache* tileCache(); + QGeoTileCache* tileCache(); void setMappingManager(QGeoMappingManager *manager); - MapController* mapController(); + QGeoMapController* mapController(); QGLCamera* glCamera() const; void paintGL(QGLPainter *painter); - void setCameraData(const CameraData &cameraData); - CameraData cameraData() const; + 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 TileSpec &tileSpec); - QGLSceneNode* createTileNode(const Tile &tile); + QGLSceneNode* createTileSpecNode(const QGeoTileSpec &tileSpec); + QGLSceneNode* createTileNode(const QGeoTile &tile); - QRect specToRect(const TileSpec &tileSpec) const; + QRect specToRect(const QGeoTileSpec &tileSpec) const; void update(); - const MapType activeMapType() const; - void setActiveMapType(const MapType mapType); + const QGeoMapType activeMapType() const; + void setActiveMapType(const QGeoMapType mapType); QGeoCoordinate screenPositionToCoordinate(const QPointF &pos) const; QPointF coordinateToScreenPosition(const QGeoCoordinate &coordinate) const; @@ -179,33 +179,33 @@ public: QVector3D tileXIntersectToPoint(int zoomLevel, int x) const; QVector3D tileYIntersectToPoint(int zoomLevel, int y) const; - void tileFetched(const TileSpec &spec); + void tileFetched(const QGeoTileSpec &spec); private: void updateGlCamera(QGLCamera* glCamera); - void updateFrustum(Frustum &frustum); - QList<TileSpec> updateVisibleTiles(); + void updateFrustum(QGeoFrustum &frustum); + QList<QGeoTileSpec> updateVisibleTiles(); int width_; int height_; double aspectRatio_; - Map *map_; - TileCache* cache_; + QGeoMap *map_; + QGeoTileCache* cache_; QGeoMappingManager *manager_; QString pluginString_; - MapController *controller_; + QGeoMapController *controller_; - QSharedPointer<Projection> projection_; + QSharedPointer<QGeoProjection> projection_; QGLCamera *glCamera_; - CameraData cameraData_; - Frustum frustum_; - QList<TileSpec> visibleTiles_; + QGeoCameraData cameraData_; + QGeoFrustum frustum_; + QList<QGeoTileSpec> visibleTiles_; - MapSphere *sphere_; - MapType activeMapType_; + QGeoMapSphere *sphere_; + QGeoMapType activeMapType_; // from map2d_p.h @@ -216,7 +216,7 @@ private: int zoomLevel, TileMap &map) const; - QList<TileSpec> tilesFromPoints(const QVector<QVector3D> &points, bool roundUp) const; + QList<QGeoTileSpec> tilesFromPoints(const QVector<QVector3D> &points, bool roundUp) const; QPair<QList<QVector3D>,QList<QVector3D> > clipPolygonToMap(const QList<QVector3D> &points) const; @@ -251,4 +251,4 @@ private: QT_END_NAMESPACE -#endif // MAP_P_H +#endif // QGEOMAP_P_H diff --git a/src/location/mapsgl/mapcontroller.cpp b/src/location/maps/qgeomapcontroller.cpp index df263f69..43473e64 100644 --- a/src/location/mapsgl/mapcontroller.cpp +++ b/src/location/maps/qgeomapcontroller.cpp @@ -39,10 +39,10 @@ ** ****************************************************************************/ -#include "mapcontroller.h" +#include "qgeomapcontroller.h" -#include "map.h" -#include "projection_p.h" +#include "qgeomap.h" +#include "qgeoprojection_p.h" #include <QPointF> @@ -55,7 +55,7 @@ QVariant coordinateInterpolator(const AnimatableCoordinate &start, { AnimatableCoordinate result; - QSharedPointer<Projection> p = start.projection(); + QSharedPointer<QGeoProjection> p = start.projection(); if (!p) p = end.projection(); @@ -74,7 +74,7 @@ QVariant coordinateInterpolator(const AnimatableCoordinate &start, AnimatableCoordinate::AnimatableCoordinate() {} AnimatableCoordinate::AnimatableCoordinate(const QGeoCoordinate &coordinate, - QSharedPointer<Projection> projection) + QSharedPointer<QGeoProjection> projection) : coordinate_(coordinate), projection_(projection) { @@ -90,17 +90,17 @@ void AnimatableCoordinate::setCoordinate(const QGeoCoordinate &coordinate) coordinate_ = coordinate; } -QSharedPointer<Projection> AnimatableCoordinate::projection() const +QSharedPointer<QGeoProjection> AnimatableCoordinate::projection() const { return projection_; } -void AnimatableCoordinate::setProjection(QSharedPointer<Projection> projection) +void AnimatableCoordinate::setProjection(QSharedPointer<QGeoProjection> projection) { projection_ = projection; } -MapController::MapController(Map *map, QSharedPointer<Projection> projection) +QGeoMapController::QGeoMapController(QGeoMap *map, QSharedPointer<QGeoProjection> projection) : QObject(map), map_(map), projection_(projection) @@ -111,14 +111,14 @@ MapController::MapController(Map *map, QSharedPointer<Projection> projection) oldCameraData_ = map_->cameraData(); connect(map, - SIGNAL(cameraDataChanged(CameraData)), + SIGNAL(cameraDataChanged(QGeoCameraData)), this, - SLOT(cameraDataChanged(CameraData))); + SLOT(cameraDataChanged(QGeoCameraData))); } -MapController::~MapController() {} +QGeoMapController::~QGeoMapController() {} -void MapController::cameraDataChanged(const CameraData &cameraData) +void QGeoMapController::cameraDataChanged(const QGeoCameraData &cameraData) { if (oldCameraData_.center() != cameraData.center()) emit centerChanged(AnimatableCoordinate(cameraData.center(), projection_)); @@ -138,14 +138,14 @@ void MapController::cameraDataChanged(const CameraData &cameraData) oldCameraData_ = cameraData; } -AnimatableCoordinate MapController::center() const +AnimatableCoordinate QGeoMapController::center() const { return AnimatableCoordinate(map_->cameraData().center(), projection_); } -void MapController::setCenter(const AnimatableCoordinate ¢er) +void QGeoMapController::setCenter(const AnimatableCoordinate ¢er) { - CameraData cd = map_->cameraData(); + QGeoCameraData cd = map_->cameraData(); if (center.coordinate() == cd.center()) return; @@ -154,14 +154,14 @@ void MapController::setCenter(const AnimatableCoordinate ¢er) map_->setCameraData(cd); } -qreal MapController::bearing() const +qreal QGeoMapController::bearing() const { return map_->cameraData().bearing(); } -void MapController::setBearing(qreal bearing) +void QGeoMapController::setBearing(qreal bearing) { - CameraData cd = map_->cameraData(); + QGeoCameraData cd = map_->cameraData(); if (bearing == cd.bearing()) return; @@ -170,14 +170,14 @@ void MapController::setBearing(qreal bearing) map_->setCameraData(cd); } -qreal MapController::tilt() const +qreal QGeoMapController::tilt() const { return map_->cameraData().tilt(); } -void MapController::setTilt(qreal tilt) +void QGeoMapController::setTilt(qreal tilt) { - CameraData cd = map_->cameraData(); + QGeoCameraData cd = map_->cameraData(); if (tilt == cd.tilt()) return; @@ -186,14 +186,14 @@ void MapController::setTilt(qreal tilt) map_->setCameraData(cd); } -qreal MapController::roll() const +qreal QGeoMapController::roll() const { return map_->cameraData().roll(); } -void MapController::setRoll(qreal roll) +void QGeoMapController::setRoll(qreal roll) { - CameraData cd = map_->cameraData(); + QGeoCameraData cd = map_->cameraData(); if (roll == cd.roll()) return; @@ -202,14 +202,14 @@ void MapController::setRoll(qreal roll) map_->setCameraData(cd); } -qreal MapController::zoom() const +qreal QGeoMapController::zoom() const { return map_->cameraData().zoomFactor(); } -void MapController::setZoom(qreal zoom) +void QGeoMapController::setZoom(qreal zoom) { - CameraData cd = map_->cameraData(); + QGeoCameraData cd = map_->cameraData(); if (zoom == cd.zoomFactor()) return; @@ -218,11 +218,11 @@ void MapController::setZoom(qreal zoom) map_->setCameraData(cd); } -void MapController::pan(qreal dx, qreal dy) +void QGeoMapController::pan(qreal dx, qreal dy) { if (dx == 0 && dy == 0) return; - CameraData cd = map_->cameraData(); + QGeoCameraData cd = map_->cameraData(); QGeoCoordinate coord = map_->screenPositionToCoordinate( QPointF(map_->width() / 2 + dx, map_->height() / 2 - dy)); diff --git a/src/location/mapsgl/mapcontroller.h b/src/location/maps/qgeomapcontroller.h index 6873488e..a0605f03 100644 --- a/src/location/mapsgl/mapcontroller.h +++ b/src/location/maps/qgeomapcontroller.h @@ -39,36 +39,36 @@ ** ****************************************************************************/ -#ifndef MAPCONTROLLER_H -#define MAPCONTROLLER_H +#ifndef QGEOMAPCONTROLLER_H +#define QGEOMAPCONTROLLER_H #include <QObject> #include "qgeocoordinate.h" -#include "cameradata.h" +#include "qgeocameradata.h" QT_BEGIN_NAMESPACE -class Map; +class QGeoMap; class Q_LOCATION_EXPORT AnimatableCoordinate { public: AnimatableCoordinate(); AnimatableCoordinate(const QGeoCoordinate &coordinate, - QSharedPointer<Projection> projection); + QSharedPointer<QGeoProjection> projection); QGeoCoordinate coordinate() const; void setCoordinate(const QGeoCoordinate &coordinate); - QSharedPointer<Projection> projection() const; - void setProjection(QSharedPointer<Projection> projection); + QSharedPointer<QGeoProjection> projection() const; + void setProjection(QSharedPointer<QGeoProjection> projection); private: QGeoCoordinate coordinate_; - QSharedPointer<Projection> projection_; + QSharedPointer<QGeoProjection> projection_; }; -class Q_LOCATION_EXPORT MapController : public QObject +class Q_LOCATION_EXPORT QGeoMapController : public QObject { Q_OBJECT @@ -79,8 +79,8 @@ class Q_LOCATION_EXPORT MapController : public QObject Q_PROPERTY(qreal zoom READ zoom WRITE setZoom NOTIFY zoomChanged) public: - MapController(Map *map, QSharedPointer<Projection> projection); - ~MapController(); + QGeoMapController(QGeoMap *map, QSharedPointer<QGeoProjection> projection); + ~QGeoMapController(); AnimatableCoordinate center() const; void setCenter(const AnimatableCoordinate ¢er); @@ -100,7 +100,7 @@ public: void pan(qreal dx, qreal dy); private slots: - void cameraDataChanged(const CameraData &cameraData); + void cameraDataChanged(const QGeoCameraData &cameraData); signals: void centerChanged(const AnimatableCoordinate ¢er); @@ -110,13 +110,13 @@ signals: void zoomChanged(qreal zoom); private: - Map *map_; - QSharedPointer<Projection> projection_; - CameraData oldCameraData_; + QGeoMap *map_; + QSharedPointer<QGeoProjection> projection_; + QGeoCameraData oldCameraData_; }; QT_END_NAMESPACE Q_DECLARE_METATYPE(AnimatableCoordinate) -#endif // MAPCONTROLLER_H +#endif // QGEOMAPCONTROLLER_H diff --git a/src/location/maps/qgeomappingmanager.cpp b/src/location/maps/qgeomappingmanager.cpp index fa4bb749..c40893ec 100644 --- a/src/location/maps/qgeomappingmanager.cpp +++ b/src/location/maps/qgeomappingmanager.cpp @@ -45,10 +45,10 @@ #include "qgeotiledmapreply.h" -#include "map.h" -#include "map_p.h" -#include "tilecache.h" -#include "tilespec.h" +#include "qgeomap.h" +#include "qgeomap_p.h" +#include "qgeotilecache.h" +#include "qgeotilespec.h" #include <QTimer> #include <QNetworkProxy> @@ -103,17 +103,17 @@ QGeoMappingManager::QGeoMappingManager(QGeoMappingManagerEngine *engine, QObject d_ptr->thread= new QThread; - qRegisterMetaType<TileSpec>(); + qRegisterMetaType<QGeoTileSpec>(); connect(d_ptr->engine, - SIGNAL(tileFinished(TileSpec,QByteArray)), + SIGNAL(tileFinished(QGeoTileSpec,QByteArray)), this, - SLOT(engineTileFinished(TileSpec,QByteArray)), + SLOT(engineTileFinished(QGeoTileSpec,QByteArray)), Qt::QueuedConnection); connect(d_ptr->engine, - SIGNAL(tileError(TileSpec,QString)), + SIGNAL(tileError(QGeoTileSpec,QString)), this, - SLOT(engineTileError(TileSpec,QString)), + SLOT(engineTileError(QGeoTileSpec,QString)), Qt::QueuedConnection); connect(d_ptr->engine, @@ -180,15 +180,15 @@ int QGeoMappingManager::managerVersion() const return d_ptr->engine->managerVersion(); } -void QGeoMappingManager::registerMap(Map *map) +void QGeoMappingManager::registerMap(QGeoMap *map) { - TileCache *cache = map->tileCache(); - QSet<Map*> maps = d_ptr->caches.value(cache); + QGeoTileCache *cache = map->tileCache(); + QSet<QGeoMap*> maps = d_ptr->caches.value(cache); maps.insert(map); d_ptr->caches.insert(cache, maps); } -void QGeoMappingManager::deregisterMap(Map *map) +void QGeoMappingManager::deregisterMap(QGeoMap *map) { Q_UNUSED(map); // TileCache *cache = map->tileCache(); @@ -203,15 +203,15 @@ void QGeoMappingManager::deregisterMap(Map *map) // clear any tileHash / mapHash entries } -void QGeoMappingManager::updateTileRequests(Map *map, - const QSet<TileSpec> &tilesAdded, - const QSet<TileSpec> &tilesRemoved) +void QGeoMappingManager::updateTileRequests(QGeoMap *map, + const QSet<QGeoTileSpec> &tilesAdded, + const QSet<QGeoTileSpec> &tilesRemoved) { - typedef QSet<TileSpec>::const_iterator tile_iter; + typedef QSet<QGeoTileSpec>::const_iterator tile_iter; // add and remove tiles from tileset for this map - QSet<TileSpec> oldTiles = d_ptr->mapHash.value(map); + QSet<QGeoTileSpec> oldTiles = d_ptr->mapHash.value(map); tile_iter rem = tilesRemoved.constBegin(); tile_iter remEnd = tilesRemoved.constEnd(); @@ -229,12 +229,12 @@ void QGeoMappingManager::updateTileRequests(Map *map, // add and remove map from mapset for the tiles - QSet<TileSpec> reqTiles; - QSet<TileSpec> cancelTiles; + QSet<QGeoTileSpec> reqTiles; + QSet<QGeoTileSpec> cancelTiles; rem = tilesRemoved.constBegin(); for (; rem != remEnd; ++rem) { - QSet<Map*> mapSet = d_ptr->tileHash.value(*rem); + QSet<QGeoMap*> mapSet = d_ptr->tileHash.value(*rem); mapSet.remove(map); if (mapSet.isEmpty()) { cancelTiles.insert(*rem); @@ -246,7 +246,7 @@ void QGeoMappingManager::updateTileRequests(Map *map, add = tilesAdded.constBegin(); for (; add != addEnd; ++add) { - QSet<Map*> mapSet = d_ptr->tileHash.value(*add); + QSet<QGeoMap*> mapSet = d_ptr->tileHash.value(*add); if (mapSet.isEmpty()) { reqTiles.insert(*add); } @@ -258,24 +258,24 @@ void QGeoMappingManager::updateTileRequests(Map *map, QMetaObject::invokeMethod(d_ptr->engine, "updateTileRequests", Qt::QueuedConnection, - Q_ARG(QSet<TileSpec>, reqTiles), - Q_ARG(QSet<TileSpec>, cancelTiles)); + Q_ARG(QSet<QGeoTileSpec>, reqTiles), + Q_ARG(QSet<QGeoTileSpec>, cancelTiles)); } -void QGeoMappingManager::engineTileFinished(const TileSpec &spec, const QByteArray &bytes) +void QGeoMappingManager::engineTileFinished(const QGeoTileSpec &spec, const QByteArray &bytes) { - QSet<TileCache*> caches; + QSet<QGeoTileCache*> caches; - QSet<Map*> maps = d_ptr->tileHash.value(spec); + QSet<QGeoMap*> maps = d_ptr->tileHash.value(spec); - typedef QSet<Map*>::const_iterator map_iter; + typedef QSet<QGeoMap*>::const_iterator map_iter; map_iter map = maps.constBegin(); map_iter mapEnd = maps.constEnd(); for (; map != mapEnd; ++map) { caches.insert((*map)->tileCache()); - QSet<TileSpec> tileSet = d_ptr->mapHash.value(*map); + QSet<QGeoTileSpec> tileSet = d_ptr->mapHash.value(*map); tileSet.remove(spec); if (tileSet.isEmpty()) d_ptr->mapHash.remove(*map); @@ -285,7 +285,7 @@ void QGeoMappingManager::engineTileFinished(const TileSpec &spec, const QByteArr d_ptr->tileHash.remove(spec); - typedef QSet<TileCache*>::const_iterator cache_iter; + typedef QSet<QGeoTileCache*>::const_iterator cache_iter; cache_iter cache = caches.constBegin(); cache_iter cacheEnd = caches.constEnd(); @@ -299,12 +299,12 @@ void QGeoMappingManager::engineTileFinished(const TileSpec &spec, const QByteArr } } -void QGeoMappingManager::engineTileError(const TileSpec &spec, const QString &errorString) +void QGeoMappingManager::engineTileError(const QGeoTileSpec &spec, const QString &errorString) { emit tileError(spec, errorString); } -QList<MapType> QGeoMappingManager::supportedMapTypes() const +QList<QGeoMapType> QGeoMappingManager::supportedMapTypes() const { return d_ptr->engine->supportedMapTypes(); } @@ -410,7 +410,7 @@ QLocale QGeoMappingManager::locale() const return d_ptr->engine->locale(); } -TileCache::CacheAreas QGeoMappingManager::cacheHint() const +QGeoTileCache::CacheAreas QGeoMappingManager::cacheHint() const { return d_ptr->engine->cacheHint(); } diff --git a/src/location/maps/qgeomappingmanager.h b/src/location/maps/qgeomappingmanager.h index 3c810ddf..84cf62f0 100644 --- a/src/location/maps/qgeomappingmanager.h +++ b/src/location/maps/qgeomappingmanager.h @@ -46,8 +46,8 @@ #include <QSize> #include <QPair> #include <QtLocation/qlocationglobal.h> -#include "maptype.h" -#include "tilecache.h" +#include "qgeomaptype.h" +#include "qgeotilecache.h" QT_BEGIN_HEADER @@ -61,8 +61,8 @@ class QGeoMapRequestOptions; class QGeoMappingManagerEngine; class QGeoTiledMapReply; -class TileSpec; -class Map; +class QGeoTileSpec; +class QGeoMap; class Q_LOCATION_EXPORT QGeoMappingManager : public QObject { @@ -74,14 +74,14 @@ public: QString managerName() const; int managerVersion() const; - void registerMap(Map *map); - void deregisterMap(Map *map); + void registerMap(QGeoMap *map); + void deregisterMap(QGeoMap *map); - void updateTileRequests(Map *map, - const QSet<TileSpec> &tilesAdded, - const QSet<TileSpec> &tilesRemoved); + void updateTileRequests(QGeoMap *map, + const QSet<QGeoTileSpec> &tilesAdded, + const QSet<QGeoTileSpec> &tilesRemoved); - QList<MapType> supportedMapTypes() const; + QList<QGeoMapType> supportedMapTypes() const; // QList<QGraphicsGeoMap::ConnectivityMode> supportedConnectivityModes() const; qreal minimumZoomLevel() const; @@ -94,18 +94,18 @@ public: qreal minimumTilt() const; qreal maximumTilt() const; - TileCache::CacheAreas cacheHint() const; + QGeoTileCache::CacheAreas cacheHint() const; void setLocale(const QLocale &locale); QLocale locale() const; private Q_SLOTS: - void engineTileFinished(const TileSpec &spec, const QByteArray &bytes); - void engineTileError(const TileSpec &spec, const QString &errorString); + void engineTileFinished(const QGeoTileSpec &spec, const QByteArray &bytes); + void engineTileError(const QGeoTileSpec &spec, const QString &errorString); Q_SIGNALS: - void tileFinished(const TileSpec &spec, const QByteArray &bytes); - void tileError(const TileSpec &spec, const QString &errorString); + void tileFinished(const QGeoTileSpec &spec, const QByteArray &bytes); + void tileError(const QGeoTileSpec &spec, const QString &errorString); void initialized(); private: diff --git a/src/location/maps/qgeomappingmanager_p.h b/src/location/maps/qgeomappingmanager_p.h index 124b51d2..68d49dbd 100644 --- a/src/location/maps/qgeomappingmanager_p.h +++ b/src/location/maps/qgeomappingmanager_p.h @@ -59,9 +59,9 @@ #include <QSet> #include <QThread> -class Map; -class TileCache; -class TileSpec; +class QGeoMap; +class QGeoTileCache; +class QGeoTileSpec; QT_BEGIN_NAMESPACE @@ -76,9 +76,9 @@ public: QThread *thread; QGeoMappingManagerEngine *engine; - QHash<TileCache*, QSet<Map*> > caches; - QHash<Map*, QSet<TileSpec> > mapHash; - QHash<TileSpec, QSet<Map*> > tileHash; + QHash<QGeoTileCache*, QSet<QGeoMap*> > caches; + QHash<QGeoMap*, QSet<QGeoTileSpec> > mapHash; + QHash<QGeoTileSpec, QSet<QGeoMap*> > tileHash; private: Q_DISABLE_COPY(QGeoMappingManagerPrivate) diff --git a/src/location/maps/qgeomappingmanagerengine.cpp b/src/location/maps/qgeomappingmanagerengine.cpp index a79db933..a03e7994 100644 --- a/src/location/maps/qgeomappingmanagerengine.cpp +++ b/src/location/maps/qgeomappingmanagerengine.cpp @@ -42,7 +42,7 @@ #include "qgeomappingmanagerengine.h" #include "qgeomappingmanagerengine_p.h" #include "qgeotiledmapreply.h" -#include "tilespec.h" +#include "qgeotilespec.h" #include <QThread> #include <QNetworkProxy> @@ -155,8 +155,8 @@ void QGeoMappingManagerEngine::threadFinished() this->deleteLater(); } -void QGeoMappingManagerEngine::updateTileRequests(const QSet<TileSpec> &tilesAdded, - const QSet<TileSpec> &tilesRemoved) +void QGeoMappingManagerEngine::updateTileRequests(const QSet<QGeoTileSpec> &tilesAdded, + const QSet<QGeoTileSpec> &tilesRemoved) { Q_D(QGeoMappingManagerEngine); @@ -171,11 +171,11 @@ void QGeoMappingManagerEngine::updateTileRequests(const QSet<TileSpec> &tilesAdd d->timer_->start(); } -void QGeoMappingManagerEngine::cancelTileRequests(const QSet<TileSpec> &tiles) +void QGeoMappingManagerEngine::cancelTileRequests(const QSet<QGeoTileSpec> &tiles) { Q_D(QGeoMappingManagerEngine); - typedef QSet<TileSpec>::const_iterator tile_iter; + typedef QSet<QGeoTileSpec>::const_iterator tile_iter; tile_iter tile = tiles.constBegin(); tile_iter end = tiles.constEnd(); for (; tile != end; ++tile) { @@ -204,7 +204,7 @@ void QGeoMappingManagerEngine::requestNextTile() return; } - TileSpec ts = d->queue_.takeFirst(); + QGeoTileSpec ts = d->queue_.takeFirst(); QGeoTiledMapReply *reply = getTileImage(ts); @@ -231,7 +231,7 @@ void QGeoMappingManagerEngine::finished() if (!reply) return; - TileSpec spec = reply->tileSpec(); + QGeoTileSpec spec = reply->tileSpec(); if (!d->invmap_.contains(spec)) { reply->deleteLater(); @@ -243,7 +243,7 @@ void QGeoMappingManagerEngine::finished() handleReply(reply, spec); } -void QGeoMappingManagerEngine::handleReply(QGeoTiledMapReply *reply, const TileSpec &spec) +void QGeoMappingManagerEngine::handleReply(QGeoTiledMapReply *reply, const QGeoTileSpec &spec) { Q_D(QGeoMappingManagerEngine); @@ -308,7 +308,7 @@ int QGeoMappingManagerEngine::managerVersion() const return d_ptr->managerVersion; } -QList<MapType> QGeoMappingManagerEngine::supportedMapTypes() const +QList<QGeoMapType> QGeoMappingManagerEngine::supportedMapTypes() const { Q_D(const QGeoMappingManagerEngine); return d->supportedMapTypes; @@ -320,7 +320,7 @@ QList<MapType> QGeoMappingManagerEngine::supportedMapTypes() const Subclasses of QGeoMappingManagerEngine should use this function to ensure that supportedMapTypes() provides accurate information. */ -void QGeoMappingManagerEngine::setSupportedMapTypes(const QList<MapType> &supportedMapTypes) +void QGeoMappingManagerEngine::setSupportedMapTypes(const QList<QGeoMapType> &supportedMapTypes) { Q_D(QGeoMappingManagerEngine); d->supportedMapTypes = supportedMapTypes; @@ -564,13 +564,13 @@ QLocale QGeoMappingManagerEngine::locale() const return d_ptr->locale; } -TileCache::CacheAreas QGeoMappingManagerEngine::cacheHint() const +QGeoTileCache::CacheAreas QGeoMappingManagerEngine::cacheHint() const { Q_D(const QGeoMappingManagerEngine); return d->cacheHint; } -void QGeoMappingManagerEngine::setCacheHint(TileCache::CacheAreas cacheHint) +void QGeoMappingManagerEngine::setCacheHint(QGeoTileCache::CacheAreas cacheHint) { Q_D(QGeoMappingManagerEngine); d->cacheHint = cacheHint; @@ -587,7 +587,7 @@ QGeoMappingManagerEnginePrivate::QGeoMappingManagerEnginePrivate() supportsTilting(false), minimumTilt(0.0), maximumTilt(0.0), - cacheHint(TileCache::AllCaches), + cacheHint(QGeoTileCache::AllCaches), started_(false), stopped_(false) {} diff --git a/src/location/maps/qgeomappingmanagerengine.h b/src/location/maps/qgeomappingmanagerengine.h index 633654d4..0442cb01 100644 --- a/src/location/maps/qgeomappingmanagerengine.h +++ b/src/location/maps/qgeomappingmanagerengine.h @@ -46,8 +46,8 @@ #include <QSize> #include <QPair> #include <QtLocation/qlocationglobal.h> -#include "maptype.h" -#include "tilecache.h" +#include "qgeomaptype.h" +#include "qgeotilecache.h" QT_BEGIN_HEADER @@ -66,7 +66,7 @@ class QGeoMapRequestOptions; class QGeoMappingManagerEnginePrivate; class QGeoTiledMapReply; -class TileSpec; +class QGeoTileSpec; class Q_LOCATION_EXPORT QGeoMappingManagerEngine : public QObject { @@ -81,7 +81,7 @@ public: QString managerName() const; int managerVersion() const; - QList<MapType> supportedMapTypes() const; + QList<QGeoMapType> supportedMapTypes() const; // QList<QGraphicsGeoMap::ConnectivityMode> supportedConnectivityModes() const; QSize tileSize() const; @@ -95,7 +95,7 @@ public: qreal minimumTilt() const; qreal maximumTilt() const; - TileCache::CacheAreas cacheHint() const; + QGeoTileCache::CacheAreas cacheHint() const; void setLocale(const QLocale &locale); QLocale locale() const; @@ -106,22 +106,22 @@ public: public Q_SLOTS: void threadStarted(); void threadFinished(); - void updateTileRequests(const QSet<TileSpec> &tilesAdded, const QSet<TileSpec> &tilesRemoved); - void cancelTileRequests(const QSet<TileSpec> &tiles); + void updateTileRequests(const QSet<QGeoTileSpec> &tilesAdded, const QSet<QGeoTileSpec> &tilesRemoved); + void cancelTileRequests(const QSet<QGeoTileSpec> &tiles); private Q_SLOTS: void requestNextTile(); void finished(); Q_SIGNALS: - void tileFinished(const TileSpec &spec, const QByteArray &bytes); - void tileError(const TileSpec &spec, const QString &errorString); + void tileFinished(const QGeoTileSpec &spec, const QByteArray &bytes); + void tileError(const QGeoTileSpec &spec, const QString &errorString); void initialized(); protected: QGeoMappingManagerEngine(QGeoMappingManagerEnginePrivate *dd, QObject *parent = 0); - void setSupportedMapTypes(const QList<MapType> &supportedMapTypes); + void setSupportedMapTypes(const QList<QGeoMapType> &supportedMapTypes); // void setSupportedConnectivityModes(const QList<QGraphicsGeoMap::ConnectivityMode> &connectivityModes); void setTileSize(const QSize &tileSize); @@ -135,14 +135,14 @@ protected: void setSupportsBearing(bool supportsBearing); void setSupportsTilting(bool supportsTilting); - void setCacheHint(TileCache::CacheAreas cacheHint); + void setCacheHint(QGeoTileCache::CacheAreas cacheHint); QGeoMappingManagerEnginePrivate* d_ptr; private: - virtual QGeoTiledMapReply* getTileImage(const TileSpec &spec) = 0; + virtual QGeoTiledMapReply* getTileImage(const QGeoTileSpec &spec) = 0; - void handleReply(QGeoTiledMapReply *reply, const TileSpec &spec); + void handleReply(QGeoTiledMapReply *reply, const QGeoTileSpec &spec); void setManagerName(const QString &managerName); void setManagerVersion(int managerVersion); diff --git a/src/location/maps/qgeomappingmanagerengine_p.h b/src/location/maps/qgeomappingmanagerengine_p.h index f4a66958..3c73a4ad 100644 --- a/src/location/maps/qgeomappingmanagerengine_p.h +++ b/src/location/maps/qgeomappingmanagerengine_p.h @@ -60,10 +60,10 @@ #include <QMap> #include <QLocale> #include <QTimer> -#include "maptype.h" -#include "tilecache.h" +#include "qgeomaptype.h" +#include "qgeotilecache.h" -class TileSpec; +class QGeoTileSpec; class QGeoTiledMapReply; QT_BEGIN_NAMESPACE @@ -79,7 +79,7 @@ public: QString managerName; int managerVersion; - QList<MapType> supportedMapTypes; + QList<QGeoMapType> supportedMapTypes; // QList<QGraphicsGeoMap::ConnectivityMode> supportedConnectivityModes; QSize tileSize; qreal minimumZoomLevel; @@ -88,15 +88,15 @@ public: bool supportsTilting; qreal minimumTilt; qreal maximumTilt; - TileCache::CacheAreas cacheHint; + QGeoTileCache::CacheAreas cacheHint; QLocale locale; bool started_; bool initialized; bool stopped_; QTimer *timer_; - QList<TileSpec> queue_; - QHash<TileSpec, QGeoTiledMapReply*> invmap_; + QList<QGeoTileSpec> queue_; + QHash<QGeoTileSpec, QGeoTiledMapReply*> invmap_; private: Q_DISABLE_COPY(QGeoMappingManagerEnginePrivate) diff --git a/src/location/mapsgl/mapsphere.cpp b/src/location/maps/qgeomapsphere.cpp index 0a56f9b4..e8cb922e 100644 --- a/src/location/mapsgl/mapsphere.cpp +++ b/src/location/maps/qgeomapsphere.cpp @@ -38,13 +38,12 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "mapsphere_p.h" +#include "qgeomapsphere_p.h" -#include "tilecache.h" -#include "tilespec.h" -#include "tile.h" -#include "map.h" -#include "map_p.h" +#include "qgeotilecache.h" +#include "qgeotile.h" +#include "qgeomap.h" +#include "qgeomap_p.h" #include "qgeomappingmanager.h" @@ -58,7 +57,7 @@ #include <QVector> #include <QTimer> -MapSphere::MapSphere(Map* map, MapPrivate *mapPrivate, TileCache *tileCache) +QGeoMapSphere::QGeoMapSphere(QGeoMap* map, QGeoMapPrivate *mapPrivate, QGeoTileCache *tileCache) : QObject(0), tileCache_(tileCache), map_(map), @@ -74,7 +73,7 @@ MapSphere::MapSphere(Map* map, MapPrivate *mapPrivate, TileCache *tileCache) SIGNAL(updateRequired())); } -MapSphere::~MapSphere() +QGeoMapSphere::~QGeoMapSphere() { QList<QGLSceneNode*> nodes = built_.values(); for (int i = 0; i < nodes.size(); ++i) { @@ -86,12 +85,12 @@ MapSphere::~MapSphere() } } -void MapSphere::setMappingManager(QGeoMappingManager *manager) +void QGeoMapSphere::setMappingManager(QGeoMappingManager *manager) { manager_ = manager; } -QGLSceneNode* MapSphere::sphereSceneNode() const +QGLSceneNode* QGeoMapSphere::sphereSceneNode() const { return sphereNode_; } @@ -103,7 +102,7 @@ QGLSceneNode* MapSphere::sphereSceneNode() const // Function is guaranteed to be only called when executing in // rendering thread with valid GL context. Furthermore it is // safe to update any geometry/structures - mutex is locked. -void MapSphere::GLContextAvailable() +void QGeoMapSphere::GLContextAvailable() { // need something like this in the cache for // releasing textures and freeing nodes that @@ -113,19 +112,19 @@ void MapSphere::GLContextAvailable() // obsoleteNodes_.clear(); } -void MapSphere::update(const QList<TileSpec> &tiles) +void QGeoMapSphere::update(const QList<QGeoTileSpec> &tiles) { - QHash<TileSpec, QGLSceneNode*> stillBuilt; + QHash<QGeoTileSpec, QGLSceneNode*> stillBuilt; - QVector<TileSpec> req(tiles.size()); - QVector<TileSpec> draw(tiles.size()); + QVector<QGeoTileSpec> req(tiles.size()); + QVector<QGeoTileSpec> draw(tiles.size()); - QSet<TileSpec> cancelTiles = requested_ - tiles.toSet(); + QSet<QGeoTileSpec> cancelTiles = requested_ - tiles.toSet(); int reqSize = 0; int drawSize = 0; - QList<TileSpec>::const_iterator i = tiles.constBegin(); - QList<TileSpec>::const_iterator tilesEnd = tiles.constEnd(); + QList<QGeoTileSpec>::const_iterator i = tiles.constBegin(); + QList<QGeoTileSpec>::const_iterator tilesEnd = tiles.constEnd(); while (i != tilesEnd) { /* If the tile is already built or has been requested then we @@ -155,10 +154,10 @@ void MapSphere::update(const QList<TileSpec> &tiles) updateMutex.lock(); - QHash<TileSpec, QGLSceneNode*>::const_iterator j = built_.constBegin(); - QHash<TileSpec, QGLSceneNode*>::const_iterator end = built_.constEnd(); + QHash<QGeoTileSpec, QGLSceneNode*>::const_iterator j = built_.constBegin(); + QHash<QGeoTileSpec, QGLSceneNode*>::const_iterator end = built_.constEnd(); while (j != end) { - TileSpec spec = j.key(); + QGeoTileSpec spec = j.key(); if (!stillBuilt.contains(spec)) { sphereNode_->removeNode(j.value()); } @@ -180,7 +179,7 @@ void MapSphere::update(const QList<TileSpec> &tiles) } } -void MapSphere::tileFetched(const TileSpec &spec) +void QGeoMapSphere::tileFetched(const QGeoTileSpec &spec) { if (!requested_.contains(spec)) return; @@ -192,13 +191,13 @@ void MapSphere::tileFetched(const TileSpec &spec) emit tileUpdated(); } -void MapSphere::displayTile(const TileSpec &spec) +void QGeoMapSphere::displayTile(const QGeoTileSpec &spec) { if (built_.contains(spec)) return; updateMutex.lock(); - Tile tile = tileCache_->get(spec); + QGeoTile tile = tileCache_->get(spec); QGLSceneNode *node = tile.sceneNode(); if (!node) { node = mapPrivate_->createTileNode(tile); @@ -213,7 +212,7 @@ void MapSphere::displayTile(const TileSpec &spec) updateMutex.unlock(); } -void MapSphere::paintGL(QGLPainter *painter) +void QGeoMapSphere::paintGL(QGLPainter *painter) { if (!updateMutex.tryLock()) { qWarning() << "----- map will miss a frame, no mutex acquired!------"; diff --git a/src/location/mapsgl/mapsphere_p.h b/src/location/maps/qgeomapsphere_p.h index c66d683f..53f2d081 100644 --- a/src/location/mapsgl/mapsphere_p.h +++ b/src/location/maps/qgeomapsphere_p.h @@ -38,8 +38,8 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef MAPSPHERE_H -#define MAPSPHERE_H +#ifndef QGEOMAPSPHERE_H +#define QGEOMAPSPHERE_H // // W A R N I N G @@ -53,7 +53,7 @@ // #include <QtLocation/qlocationglobal.h> -#include "tilespec.h" +#include "qgeotilespec.h" #include <QObject> #include <QSet> @@ -71,20 +71,20 @@ class QGLPainter; class QOpenGLFramebufferObject; -class TileSpec; -class TileCache; +class QGeoTileSpec; +class QGeoTileCache; -class Map; -class MapPrivate; +class QGeoMap; +class QGeoMapPrivate; class QGeoMappingManager; -class Q_LOCATION_EXPORT MapSphere : public QObject +class Q_LOCATION_EXPORT QGeoMapSphere : public QObject { Q_OBJECT public: - MapSphere(Map* map, MapPrivate *mapPrivate, TileCache *tileCache); - ~MapSphere(); + QGeoMapSphere(QGeoMap* map, QGeoMapPrivate *mapPrivate, QGeoTileCache *tileCache); + ~QGeoMapSphere(); void setMappingManager(QGeoMappingManager *manager); @@ -97,32 +97,32 @@ public: void paintGL(QGLPainter *painter); - void tileFetched(const TileSpec &spec); + void tileFetched(const QGeoTileSpec &spec); public Q_SLOTS: - void update(const QList<TileSpec> &tiles); + void update(const QList<QGeoTileSpec> &tiles); Q_SIGNALS: void tileUpdated(); private: - void displayTile(const TileSpec &spec); + void displayTile(const QGeoTileSpec &spec); - QList<TileSpec> visibleTiles_; + QList<QGeoTileSpec> visibleTiles_; - TileCache *tileCache_; + QGeoTileCache *tileCache_; int minZoom_; - QSet<TileSpec> requested_; - QHash<TileSpec, QGLSceneNode*> built_; + QSet<QGeoTileSpec> requested_; + QHash<QGeoTileSpec, QGLSceneNode*> built_; QGLSceneNode* sphereNode_; - Map *map_; - MapPrivate* mapPrivate_; + QGeoMap *map_; + QGeoMapPrivate* mapPrivate_; QGeoMappingManager *manager_; }; QT_END_NAMESPACE -#endif // MAPSPHERE_H +#endif // QGEOMAPSPHERE_H diff --git a/src/location/mapsgl/maptype.cpp b/src/location/maps/qgeomaptype.cpp index e3d63f11..cdb6241c 100644 --- a/src/location/mapsgl/maptype.cpp +++ b/src/location/maps/qgeomaptype.cpp @@ -39,71 +39,71 @@ ** ****************************************************************************/ -#include "maptype.h" -#include "maptype_p.h" +#include "qgeomaptype.h" +#include "qgeomaptype_p.h" QT_BEGIN_NAMESPACE -MapType::MapType() - : d_ptr(new MapTypePrivate()) {} +QGeoMapType::QGeoMapType() + : d_ptr(new QGeoMapTypePrivate()) {} -MapType::MapType(const MapType &other) +QGeoMapType::QGeoMapType(const QGeoMapType &other) : d_ptr(other.d_ptr) {} -MapType::MapType(MapType::MapStyle style, const QString &name, const QString &description, bool mobile, int mapId) - : d_ptr(new MapTypePrivate(style, name, description, mobile, mapId)) {} +QGeoMapType::QGeoMapType(QGeoMapType::MapStyle style, const QString &name, const QString &description, bool mobile, int mapId) + : d_ptr(new QGeoMapTypePrivate(style, name, description, mobile, mapId)) {} -MapType::~MapType() {} +QGeoMapType::~QGeoMapType() {} -MapType& MapType::operator = (const MapType &other) +QGeoMapType& QGeoMapType::operator = (const QGeoMapType &other) { d_ptr = other.d_ptr; return *this; } -bool MapType::operator == (const MapType &other) const +bool QGeoMapType::operator == (const QGeoMapType &other) const { return (*d_ptr.constData() == *other.d_ptr.constData()); } -bool MapType::operator != (const MapType &other) const +bool QGeoMapType::operator != (const QGeoMapType &other) const { return !(operator ==(other)); } -MapType::MapStyle MapType::style() const +QGeoMapType::MapStyle QGeoMapType::style() const { return d_ptr->style_; } -QString MapType::name() const +QString QGeoMapType::name() const { return d_ptr->name_; } -QString MapType::description() const +QString QGeoMapType::description() const { return d_ptr->description_; } -bool MapType::mobile() const +bool QGeoMapType::mobile() const { return d_ptr->mobile_; } -int MapType::mapId() const +int QGeoMapType::mapId() const { return d_ptr->mapId_; } -MapTypePrivate::MapTypePrivate() - : style_(MapType::NoMap), +QGeoMapTypePrivate::QGeoMapTypePrivate() + : style_(QGeoMapType::NoMap), name_(QLatin1String("")), description_(QLatin1String("")), mobile_(false), mapId_(0) {} -MapTypePrivate::MapTypePrivate(const MapTypePrivate &other) +QGeoMapTypePrivate::QGeoMapTypePrivate(const QGeoMapTypePrivate &other) : QSharedData(other), style_(other.style_), name_(other.name_), @@ -111,16 +111,16 @@ MapTypePrivate::MapTypePrivate(const MapTypePrivate &other) mobile_(other.mobile_), mapId_(other.mapId_) {} -MapTypePrivate::MapTypePrivate(MapType::MapStyle style, const QString &name, const QString &description, bool mobile, int mapId) +QGeoMapTypePrivate::QGeoMapTypePrivate(QGeoMapType::MapStyle style, const QString &name, const QString &description, bool mobile, int mapId) : style_(style), name_(name), description_(description), mobile_(mobile), mapId_(mapId) {} -MapTypePrivate::~MapTypePrivate() {} +QGeoMapTypePrivate::~QGeoMapTypePrivate() {} -bool MapTypePrivate::operator == (const MapTypePrivate &other) const +bool QGeoMapTypePrivate::operator == (const QGeoMapTypePrivate &other) const { return ((style_ == other.style_) && (name_ == other.name_) diff --git a/src/location/mapsgl/maptype.h b/src/location/maps/qgeomaptype.h index 874b2f60..bd927b17 100644 --- a/src/location/mapsgl/maptype.h +++ b/src/location/maps/qgeomaptype.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef MAPTYPE_H -#define MAPTYPE_H +#ifndef QGEOMAPTYPE_H +#define QGEOMAPTYPE_H #include <QtLocation/qlocationglobal.h> #include <QString> @@ -50,9 +50,9 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -class MapTypePrivate; +class QGeoMapTypePrivate; -class Q_LOCATION_EXPORT MapType +class Q_LOCATION_EXPORT QGeoMapType { public: @@ -68,15 +68,15 @@ public: CustomMap = 100 }; - MapType(); - MapType(const MapType &other); - MapType(MapStyle style, const QString &name, const QString &description, bool mobile, int mapId); - ~MapType(); + QGeoMapType(); + QGeoMapType(const QGeoMapType &other); + QGeoMapType(MapStyle style, const QString &name, const QString &description, bool mobile, int mapId); + ~QGeoMapType(); - MapType& operator = (const MapType &other); + QGeoMapType& operator = (const QGeoMapType &other); - bool operator == (const MapType &other) const; - bool operator != (const MapType &other) const; + bool operator == (const QGeoMapType &other) const; + bool operator != (const QGeoMapType &other) const; MapStyle style() const; QString name() const; @@ -85,11 +85,11 @@ public: int mapId() const; private: - QSharedDataPointer<MapTypePrivate> d_ptr; + QSharedDataPointer<QGeoMapTypePrivate> d_ptr; }; QT_END_NAMESPACE QT_END_HEADER -#endif +#endif // QGEOMAPTYPE_H diff --git a/src/location/mapsgl/maptype_p.h b/src/location/maps/qgeomaptype_p.h index e3e05255..e6fa71aa 100644 --- a/src/location/mapsgl/maptype_p.h +++ b/src/location/maps/qgeomaptype_p.h @@ -39,31 +39,31 @@ ** ****************************************************************************/ -#ifndef MAPTYPE_P_H -#define MAPTYPE_P_H +#ifndef QGEOMAPTYPE_P_H +#define QGEOMAPTYPE_P_H #include <QMetaType> #include <QString> #include <QSharedData> -#include "maptype.h" +#include "qgeomaptype.h" QT_BEGIN_NAMESPACE -class MapTypePrivate : public QSharedData +class QGeoMapTypePrivate : public QSharedData { public: - MapTypePrivate(); - MapTypePrivate(MapType::MapStyle style, const QString &name, const QString &description, bool mobile, int mapId); - MapTypePrivate(const MapTypePrivate &other); - ~MapTypePrivate(); + QGeoMapTypePrivate(); + QGeoMapTypePrivate(QGeoMapType::MapStyle style, const QString &name, const QString &description, bool mobile, int mapId); + QGeoMapTypePrivate(const QGeoMapTypePrivate &other); + ~QGeoMapTypePrivate(); - MapTypePrivate& operator = (const MapTypePrivate &other); + QGeoMapTypePrivate& operator = (const QGeoMapTypePrivate &other); - bool operator == (const MapTypePrivate &other) const; + bool operator == (const QGeoMapTypePrivate &other) const; - MapType::MapStyle style_; + QGeoMapType::MapStyle style_; QString name_; QString description_; bool mobile_; @@ -72,6 +72,6 @@ public: QT_END_NAMESPACE -Q_DECLARE_METATYPE(MapTypePrivate) +Q_DECLARE_METATYPE(QGeoMapTypePrivate) -#endif // MAPTYPE_P_H +#endif // QGEOMAPTYPE_P_H diff --git a/src/location/mapsgl/projection.cpp b/src/location/maps/qgeoprojection.cpp index 84927351..4561af7d 100644 --- a/src/location/mapsgl/projection.cpp +++ b/src/location/maps/qgeoprojection.cpp @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "projection_p.h" +#include "qgeoprojection_p.h" #include "qgeocoordinate.h" @@ -49,21 +49,21 @@ #include <cmath> -Projection::Projection() {} +QGeoProjection::QGeoProjection() {} -Projection::~Projection() {} +QGeoProjection::~QGeoProjection() {} -QVector3D Projection::mercatorToPoint(const QVector2D &mercator) const +QVector3D QGeoProjection::mercatorToPoint(const QVector2D &mercator) const { return this->coordToPoint(mercatorToCoord(mercator)); } -QVector2D Projection::pointToMercator(const QVector3D &point) const +QVector2D QGeoProjection::pointToMercator(const QVector3D &point) const { return coordToMercator(this->pointToCoord(point)); } -QVector2D Projection::coordToMercator(const QGeoCoordinate &coord) const +QVector2D QGeoProjection::coordToMercator(const QGeoCoordinate &coord) const { const double pi = M_PI; @@ -77,13 +77,13 @@ QVector2D Projection::coordToMercator(const QGeoCoordinate &coord) const return QVector2D(lon, lat); } -double Projection::realmod(const double a, const double b) +double QGeoProjection::realmod(const double a, const double b) { quint64 div = static_cast<quint64>(a / b); return a - static_cast<double>(div) * b; } -QGeoCoordinate Projection::mercatorToCoord(const QVector2D &mercator) const +QGeoCoordinate QGeoProjection::mercatorToCoord(const QVector2D &mercator) const { const double pi = M_PI; diff --git a/src/location/mapsgl/projection2d_p.cpp b/src/location/maps/qgeoprojection2d_p.cpp index d8adddce..21488b84 100644 --- a/src/location/mapsgl/projection2d_p.cpp +++ b/src/location/maps/qgeoprojection2d_p.cpp @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "projection2d_p.h" +#include "qgeoprojection2d_p.h" #include "qgeocoordinate.h" @@ -47,12 +47,12 @@ #include <qnumeric.h> -Projection2D::Projection2D(double baseHeight, double sideLength) +QGeoProjection2D::QGeoProjection2D(double baseHeight, double sideLength) : baseHeight_(baseHeight), sideLength_(sideLength) {} -Projection2D::~Projection2D() {} +QGeoProjection2D::~QGeoProjection2D() {} -QVector3D Projection2D::coordToPoint(const QGeoCoordinate &coord) const +QVector3D QGeoProjection2D::coordToPoint(const QGeoCoordinate &coord) const { QVector2D m = coordToMercator(coord); double z = baseHeight_; @@ -61,7 +61,7 @@ QVector3D Projection2D::coordToPoint(const QGeoCoordinate &coord) const return QVector3D(m.x() * sideLength_, (1.0 - m.y()) * sideLength_, z); } -QGeoCoordinate Projection2D::pointToCoord(const QVector3D &point) const +QGeoCoordinate QGeoProjection2D::pointToCoord(const QVector3D &point) const { QVector2D m = QVector2D(point.x() / sideLength_, 1.0 - point.y() / sideLength_); QGeoCoordinate coord = mercatorToCoord(m); @@ -69,17 +69,17 @@ QGeoCoordinate Projection2D::pointToCoord(const QVector3D &point) const return coord; } -QVector3D Projection2D::mercatorToPoint(const QVector2D &mercator) const +QVector3D QGeoProjection2D::mercatorToPoint(const QVector2D &mercator) const { return QVector3D(mercator.x() * sideLength_, (1.0 - mercator.y()) * sideLength_, baseHeight_); } -QVector2D Projection2D::pointToMercator(const QVector3D &point) const +QVector2D QGeoProjection2D::pointToMercator(const QVector3D &point) const { return QVector2D(point.x() / sideLength_, 1.0 - (point.y() / sideLength_)); } -QGeoCoordinate Projection2D::interpolate(const QGeoCoordinate &start, const QGeoCoordinate &end, qreal progress) +QGeoCoordinate QGeoProjection2D::interpolate(const QGeoCoordinate &start, const QGeoCoordinate &end, qreal progress) { if (start == end) { if (progress < 0.5) { diff --git a/src/location/mapsgl/projection2d_p.h b/src/location/maps/qgeoprojection2d_p.h index 2ca83703..a43fcac9 100644 --- a/src/location/mapsgl/projection2d_p.h +++ b/src/location/maps/qgeoprojection2d_p.h @@ -38,8 +38,8 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef PROJECTION2D_P_H -#define PROJECTION2D_P_H +#ifndef QGEOPROJECTION2D_P_H +#define QGEOPROJECTION2D_P_H // // W A R N I N G @@ -52,15 +52,15 @@ // We mean it. // -#include "projection_p.h" +#include "qgeoprojection_p.h" QT_BEGIN_NAMESPACE -class Q_AUTOTEST_EXPORT Projection2D : public Projection +class Q_AUTOTEST_EXPORT QGeoProjection2D : public QGeoProjection { public: - Projection2D(double baseHeight, double sideLength); - virtual ~Projection2D(); + QGeoProjection2D(double baseHeight, double sideLength); + virtual ~QGeoProjection2D(); virtual QVector3D coordToPoint(const QGeoCoordinate &coord) const; virtual QGeoCoordinate pointToCoord(const QVector3D &point) const; @@ -77,4 +77,4 @@ private: QT_END_NAMESPACE -#endif // PROJECTION2D_P_H +#endif // QGEOPROJECTION2D_P_H diff --git a/src/location/mapsgl/projection_p.h b/src/location/maps/qgeoprojection_p.h index 20f86f63..8eece8f2 100644 --- a/src/location/mapsgl/projection_p.h +++ b/src/location/maps/qgeoprojection_p.h @@ -38,8 +38,8 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef PROJECTION_H -#define PROJECTION_H +#ifndef QGEOPROJECTION_H +#define QGEOPROJECTION_H // // W A R N I N G @@ -60,11 +60,11 @@ class QGeoCoordinate; class QVector2D; class QVector3D; -class Q_AUTOTEST_EXPORT Projection +class Q_AUTOTEST_EXPORT QGeoProjection { public: - Projection(); - virtual ~Projection(); + QGeoProjection(); + virtual ~QGeoProjection(); virtual QVector3D coordToPoint(const QGeoCoordinate &coord) const = 0; virtual QGeoCoordinate pointToCoord(const QVector3D &point) const = 0; @@ -82,4 +82,4 @@ private: QT_END_NAMESPACE -#endif // PROJECTION_H +#endif // QGEOPROJECTION_H diff --git a/src/location/mapsgl/tile.cpp b/src/location/maps/qgeotile.cpp index 4cd51f14..42a92d1e 100644 --- a/src/location/mapsgl/tile.cpp +++ b/src/location/maps/qgeotile.cpp @@ -38,57 +38,57 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "tile.h" +#include "qgeotile.h" #include <Qt3D/qgltexture2d.h> #include <Qt3D/qglscenenode.h> QT_BEGIN_NAMESPACE -Tile::Tile() {} +QGeoTile::QGeoTile() {} -Tile::Tile(const TileSpec &spec) +QGeoTile::QGeoTile(const QGeoTileSpec &spec) : spec_(spec), texture_(0), sceneNode_(0), bound_(false) {} -bool Tile::operator == (const Tile &rhs) const +bool QGeoTile::operator == (const QGeoTile &rhs) const { return (spec_ == rhs.spec_); } -void Tile::setTileSpec(const TileSpec &spec) +void QGeoTile::setTileSpec(const QGeoTileSpec &spec) { spec_ = spec; } -TileSpec Tile::tileSpec() const +QGeoTileSpec QGeoTile::tileSpec() const { return spec_; } -void Tile::setTexture(QGLTexture2D *texture) +void QGeoTile::setTexture(QGLTexture2D *texture) { texture_ = texture; } -QGLTexture2D* Tile::texture() const +QGLTexture2D* QGeoTile::texture() const { return texture_; } -void Tile::setSceneNode(QGLSceneNode *sceneNode) +void QGeoTile::setSceneNode(QGLSceneNode *sceneNode) { sceneNode_ = sceneNode; } -QGLSceneNode* Tile::sceneNode() const +QGLSceneNode* QGeoTile::sceneNode() const { return sceneNode_; } -void Tile::bind() +void QGeoTile::bind() { if (bound_) return; @@ -99,12 +99,12 @@ void Tile::bind() bound_ = true; } -void Tile::setBound(bool bound) +void QGeoTile::setBound(bool bound) { bound_ = bound; } -bool Tile::isBound() const +bool QGeoTile::isBound() const { return bound_; } diff --git a/src/location/mapsgl/tile.h b/src/location/maps/qgeotile.h index 96879e23..44584e29 100644 --- a/src/location/mapsgl/tile.h +++ b/src/location/maps/qgeotile.h @@ -38,32 +38,30 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef TILE_H -#define TILE_H +#ifndef QGEOTILE_H +#define QGEOTILE_H #include "qglobal.h" -#include "tilespec.h" +#include "qgeotilespec.h" QT_BEGIN_HEADER QT_BEGIN_NAMESPACE - - class QGLTexture2D; class QGLSceneNode; -class Q_LOCATION_EXPORT Tile +class Q_LOCATION_EXPORT QGeoTile { public: - Tile(); - Tile(const TileSpec &spec); + QGeoTile(); + QGeoTile(const QGeoTileSpec &spec); - bool operator == (const Tile &rhs) const; + bool operator == (const QGeoTile &rhs) const; - void setTileSpec(const TileSpec &spec); - TileSpec tileSpec() const; + void setTileSpec(const QGeoTileSpec &spec); + QGeoTileSpec tileSpec() const; void setTexture(QGLTexture2D *texture); QGLTexture2D* texture() const; @@ -76,7 +74,7 @@ public: bool isBound() const; private: - TileSpec spec_; + QGeoTileSpec spec_; QGLTexture2D *texture_; QGLSceneNode *sceneNode_; bool bound_; @@ -86,4 +84,4 @@ QT_END_NAMESPACE QT_END_HEADER -#endif // TILE_H +#endif // QGEOTILE_H diff --git a/src/location/mapsgl/tilecache.cpp b/src/location/maps/qgeotilecache.cpp index ebc1f7ec..cd0cf5e8 100644 --- a/src/location/mapsgl/tilecache.cpp +++ b/src/location/maps/qgeotilecache.cpp @@ -38,10 +38,10 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "tilecache.h" +#include "qgeotilecache.h" -#include "tile.h" -#include "tilespec.h" +#include "qgeotile.h" +#include "qgeotilespec.h" #include "qgeomappingmanager.h" @@ -52,8 +52,8 @@ #include <Qt3D/qgltexture2d.h> #include <Qt3D/qglscenenode.h> -Q_DECLARE_METATYPE(QList<TileSpec>) -Q_DECLARE_METATYPE(QSet<TileSpec>) +Q_DECLARE_METATYPE(QList<QGeoTileSpec>) +Q_DECLARE_METATYPE(QSet<QGeoTileSpec>) QT_BEGIN_NAMESPACE @@ -66,9 +66,9 @@ public: // cache->evictFromDiskCache(this); } - TileSpec spec; + QGeoTileSpec spec; QString filename; - TileCache *cache; + QGeoTileCache *cache; }; class TileMemory @@ -80,9 +80,9 @@ public: cache->evictFromMemoryCache(this); } - TileSpec spec; + QGeoTileSpec spec; QPixmap pixmap; - TileCache *cache; + QGeoTileCache *cache; }; class TileTexture { @@ -93,19 +93,19 @@ public: cache->evictFromTextureCache(this); } - TileSpec spec; + QGeoTileSpec spec; bool bound; QGLTexture2D *texture; QGLSceneNode *node; - TileCache *cache; + QGeoTileCache *cache; }; -TileCache::TileCache(const QString &directory, QObject *parent) +QGeoTileCache::QGeoTileCache(const QString &directory, QObject *parent) : QObject(parent), directory_(directory) { - qRegisterMetaType<TileSpec>(); - qRegisterMetaType<QList<TileSpec> >(); - qRegisterMetaType<QSet<TileSpec> >(); + qRegisterMetaType<QGeoTileSpec>(); + qRegisterMetaType<QList<QGeoTileSpec> >(); + qRegisterMetaType<QSet<QGeoTileSpec> >(); if (directory_.isEmpty()) { @@ -124,58 +124,58 @@ TileCache::TileCache(const QString &directory, QObject *parent) loadTiles(); } -TileCache::~TileCache() {} +QGeoTileCache::~QGeoTileCache() {} -void TileCache::setMaxDiskUsage(int diskUsage) +void QGeoTileCache::setMaxDiskUsage(int diskUsage) { diskCache_.setMaxCost(diskUsage); } -int TileCache::maxDiskUsage() const +int QGeoTileCache::maxDiskUsage() const { return diskCache_.maxCost(); } -int TileCache::diskUsage() const +int QGeoTileCache::diskUsage() const { return diskCache_.totalCost(); } -void TileCache::setMaxMemoryUsage(int memoryUsage) +void QGeoTileCache::setMaxMemoryUsage(int memoryUsage) { memoryCache_.setMaxCost(memoryUsage); } -int TileCache::maxMemoryUsage() const +int QGeoTileCache::maxMemoryUsage() const { return memoryCache_.maxCost(); } -int TileCache::memoryUsage() const +int QGeoTileCache::memoryUsage() const { return memoryCache_.totalCost(); } -void TileCache::setMaxTextureUsage(int textureUsage) +void QGeoTileCache::setMaxTextureUsage(int textureUsage) { textureCache_.setMaxCost(textureUsage); } -int TileCache::maxTextureUsage() const +int QGeoTileCache::maxTextureUsage() const { return textureCache_.maxCost(); } -int TileCache::textureUsage() const +int QGeoTileCache::textureUsage() const { return textureCache_.totalCost(); } -void TileCache::GLContextAvailable(QGLSceneNode *parentNode) +void QGeoTileCache::GLContextAvailable(QGLSceneNode *parentNode) { int size = cleanupList_.size(); for (int i = 0; i < size; ++i) { - Tile t = cleanupList_.at(i); + QGeoTile t = cleanupList_.at(i); QGLSceneNode *node = t.sceneNode(); if (node) { parentNode->removeNode(node); @@ -190,17 +190,17 @@ void TileCache::GLContextAvailable(QGLSceneNode *parentNode) cleanupList_.clear(); } -bool TileCache::contains(const TileSpec &spec) const +bool QGeoTileCache::contains(const QGeoTileSpec &spec) const { return keys_.contains(spec); } -Tile TileCache::get(const TileSpec &spec) +QGeoTile QGeoTileCache::get(const QGeoTileSpec &spec) { if (textureCache_.contains(spec)) { TileTexture *tt = textureCache_.object(spec); - Tile t = Tile(tt->spec); + QGeoTile t = QGeoTile(tt->spec); t.setTexture(tt->texture); t.setSceneNode(tt->node); t.setBound(tt->bound); @@ -210,7 +210,7 @@ Tile TileCache::get(const TileSpec &spec) // TileMemory *tm = memoryCache_.object(spec); // TileTexture *tt = addToTextureCache(tm->spec, tm->pixmap); -// Tile t = Tile(tt->spec); +// QGeoTile t = Tile(tt->spec); // t.setTexture(tt->texture); // t.setSceneNode(tt->node); // t.setBound(tt->bound); @@ -222,19 +222,19 @@ Tile TileCache::get(const TileSpec &spec) // TileTexture *tt = addToTextureCache(tm->spec, tm->pixmap); TileTexture *tt = addToTextureCache(td->spec, QPixmap(td->filename)); - Tile t = Tile(tt->spec); + QGeoTile t = QGeoTile(tt->spec); t.setTexture(tt->texture); t.setSceneNode(tt->node); t.setBound(tt->bound); return t; } - return Tile(); + return QGeoTile(); } // TODO rename so this is less strange // OR do node creation in here somehow -void TileCache::update(const TileSpec &spec, const Tile &tile) +void QGeoTileCache::update(const QGeoTileSpec &spec, const QGeoTile &tile) { TileTexture *tt = textureCache_.object(spec); if (tt) { @@ -244,7 +244,7 @@ void TileCache::update(const TileSpec &spec, const Tile &tile) } } -void TileCache::insert(const TileSpec &spec, const QByteArray &bytes, TileCache::CacheAreas areas) +void QGeoTileCache::insert(const QGeoTileSpec &spec, const QByteArray &bytes, QGeoTileCache::CacheAreas areas) { keys_.insert(spec); @@ -254,7 +254,7 @@ void TileCache::insert(const TileSpec &spec, const QByteArray &bytes, TileCache: return; } - if (areas & TileCache::DiskCache) { + if (areas & QGeoTileCache::DiskCache) { QString filename = tileSpecToFilename(spec, directory_); QFile file(filename); @@ -265,34 +265,34 @@ void TileCache::insert(const TileSpec &spec, const QByteArray &bytes, TileCache: addToDiskCache(spec, filename); } - if (areas & TileCache::MemoryCache) { + if (areas & QGeoTileCache::MemoryCache) { // addToMemoryCache(spec, pixmap); } - if (areas & TileCache::TextureCache) { + if (areas & QGeoTileCache::TextureCache) { addToTextureCache(spec, pixmap); } } -void TileCache::evictFromDiskCache(TileDisk *td) +void QGeoTileCache::evictFromDiskCache(TileDisk *td) { keys_.remove(td->spec); QFile::remove(td->filename); } -void TileCache::evictFromMemoryCache(TileMemory * /* tm */) +void QGeoTileCache::evictFromMemoryCache(TileMemory * /* tm */) { } -void TileCache::evictFromTextureCache(TileTexture *tt) +void QGeoTileCache::evictFromTextureCache(TileTexture *tt) { - Tile t(tt->spec); + QGeoTile t(tt->spec); t.setTexture(tt->texture); t.setSceneNode(tt->node); cleanupList_ << t; } -TileDisk* TileCache::addToDiskCache(const TileSpec &spec, const QString &filename) +TileDisk* QGeoTileCache::addToDiskCache(const QGeoTileSpec &spec, const QString &filename) { keys_.insert(spec); @@ -313,7 +313,7 @@ TileDisk* TileCache::addToDiskCache(const TileSpec &spec, const QString &filenam return td; } -TileMemory* TileCache::addToMemoryCache(const TileSpec &spec, const QPixmap &pixmap) +TileMemory* QGeoTileCache::addToMemoryCache(const QGeoTileSpec &spec, const QPixmap &pixmap) { keys_.insert(spec); @@ -333,7 +333,7 @@ TileMemory* TileCache::addToMemoryCache(const TileSpec &spec, const QPixmap &pix return tm; } -TileTexture* TileCache::addToTextureCache(const TileSpec &spec, const QPixmap &pixmap) +TileTexture* QGeoTileCache::addToTextureCache(const QGeoTileSpec &spec, const QPixmap &pixmap) { keys_.insert(spec); @@ -361,12 +361,12 @@ TileTexture* TileCache::addToTextureCache(const TileSpec &spec, const QPixmap &p return tt; } -void TileCache::handleError(const TileSpec &, const QString &error) +void QGeoTileCache::handleError(const QGeoTileSpec &, const QString &error) { qWarning() << "tile request error " << error; } -void TileCache::loadTiles() +void QGeoTileCache::loadTiles() { QStringList formats; formats << QLatin1String("*.png"); @@ -376,7 +376,7 @@ void TileCache::loadTiles() QStringList files = dir.entryList(formats, QDir::Files); int tiles = 0; for (int i = 0; i < files.size(); ++i) { - TileSpec spec = filenameToTileSpec(files.at(i)); + QGeoTileSpec spec = filenameToTileSpec(files.at(i)); if (spec.zoom() == -1) continue; QString filename = dir.filePath(files.at(i)); @@ -387,7 +387,7 @@ void TileCache::loadTiles() } -QString TileCache::tileSpecToFilename(const TileSpec &spec, const QString &directory) +QString QGeoTileCache::tileSpecToFilename(const QGeoTileSpec &spec, const QString &directory) { QString filename = spec.plugin(); filename += QLatin1String("-"); @@ -405,9 +405,9 @@ QString TileCache::tileSpecToFilename(const TileSpec &spec, const QString &direc return dir.filePath(filename); } -TileSpec TileCache::filenameToTileSpec(const QString &filename) +QGeoTileSpec QGeoTileCache::filenameToTileSpec(const QString &filename) { - TileSpec emptySpec; + QGeoTileSpec emptySpec; QString extension = QLatin1String(".png"); if (!filename.endsWith(extension)) @@ -431,7 +431,7 @@ TileSpec TileCache::filenameToTileSpec(const QString &filename) numbers.append(value); } - return TileSpec(fields.at(0), + return QGeoTileSpec(fields.at(0), numbers.at(0), numbers.at(1), numbers.at(2), diff --git a/src/location/mapsgl/tilecache.h b/src/location/maps/qgeotilecache.h index 06432d9f..42bf7879 100644 --- a/src/location/mapsgl/tilecache.h +++ b/src/location/maps/qgeotilecache.h @@ -38,8 +38,8 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef TILECACHE_H -#define TILECACHE_H +#ifndef QGEOTILECACHE_H +#define QGEOTILECACHE_H #include <QtLocation/qlocationglobal.h> @@ -51,12 +51,10 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE - - class QGeoMappingManager; -class TileSpec; -class Tile; +class QGeoTileSpec; +class QGeoTile; class TileDisk; class TileMemory; @@ -67,7 +65,7 @@ class QGLSceneNode; class QPixmap; class QThread; -class Q_LOCATION_EXPORT TileCache : public QObject +class Q_LOCATION_EXPORT QGeoTileCache : public QObject { Q_OBJECT public: @@ -79,8 +77,8 @@ public: }; Q_DECLARE_FLAGS(CacheAreas, CacheArea) - TileCache(const QString &directory = QString(), QObject *parent = 0); - ~TileCache(); + QGeoTileCache(const QString &directory = QString(), QObject *parent = 0); + ~QGeoTileCache(); void setMaxDiskUsage(int diskUsage); int maxDiskUsage() const; @@ -96,42 +94,42 @@ public: void GLContextAvailable(QGLSceneNode *parentNode); - bool contains(const TileSpec &spec) const; - Tile get(const TileSpec &spec); + bool contains(const QGeoTileSpec &spec) const; + QGeoTile get(const QGeoTileSpec &spec); - void update(const TileSpec &spec, const Tile &tile); + void update(const QGeoTileSpec &spec, const QGeoTile &tile); void evictFromDiskCache(TileDisk *td); void evictFromMemoryCache(TileMemory *tm); void evictFromTextureCache(TileTexture *tt); - void insert(const TileSpec &spec, const QByteArray &bytes, CacheAreas areas = AllCaches); - void handleError(const TileSpec &spec, const QString &errorString); + void insert(const QGeoTileSpec &spec, const QByteArray &bytes, CacheAreas areas = AllCaches); + void handleError(const QGeoTileSpec &spec, const QString &errorString); private: void loadTiles(); - TileDisk* addToDiskCache(const TileSpec &spec, const QString &filename); - TileMemory* addToMemoryCache(const TileSpec &spec, const QPixmap &pixmap); - TileTexture* addToTextureCache(const TileSpec &spec, const QPixmap &pixmap); + TileDisk* addToDiskCache(const QGeoTileSpec &spec, const QString &filename); + TileMemory* addToMemoryCache(const QGeoTileSpec &spec, const QPixmap &pixmap); + TileTexture* addToTextureCache(const QGeoTileSpec &spec, const QPixmap &pixmap); - static QString tileSpecToFilename(const TileSpec &spec, const QString &directory); - static TileSpec filenameToTileSpec(const QString &filename); + static QString tileSpecToFilename(const QGeoTileSpec &spec, const QString &directory); + static QGeoTileSpec filenameToTileSpec(const QString &filename); QString directory_; - QSet<TileSpec> keys_; - QCache<TileSpec, TileDisk > diskCache_; - QCache<TileSpec, TileMemory > memoryCache_; - QCache<TileSpec, TileTexture > textureCache_; + QSet<QGeoTileSpec> keys_; + QCache<QGeoTileSpec, TileDisk > diskCache_; + QCache<QGeoTileSpec, TileMemory > memoryCache_; + QCache<QGeoTileSpec, TileTexture > textureCache_; - QList<Tile> cleanupList_; + QList<QGeoTile> cleanupList_; }; -Q_DECLARE_OPERATORS_FOR_FLAGS(TileCache::CacheAreas) +Q_DECLARE_OPERATORS_FOR_FLAGS(QGeoTileCache::CacheAreas) QT_END_NAMESPACE QT_END_HEADER -#endif // TILECACHE_H +#endif // QGEOTILECACHE_H diff --git a/src/location/maps/qgeotiledmapreply.cpp b/src/location/maps/qgeotiledmapreply.cpp index 400a0713..c8d40c04 100644 --- a/src/location/maps/qgeotiledmapreply.cpp +++ b/src/location/maps/qgeotiledmapreply.cpp @@ -93,7 +93,7 @@ QT_BEGIN_NAMESPACE /*! Constructs a tiled map reply object based on \a request, with parent \a parent. */ -QGeoTiledMapReply::QGeoTiledMapReply(const TileSpec &spec, QObject *parent) +QGeoTiledMapReply::QGeoTiledMapReply(const QGeoTileSpec &spec, QObject *parent) : QObject(parent), d_ptr(new QGeoTiledMapReplyPrivate(spec)) { @@ -201,7 +201,7 @@ void QGeoTiledMapReply::setCached(bool cached) /*! Returns the request which corresponds to this reply. */ -TileSpec QGeoTiledMapReply::tileSpec() const +QGeoTileSpec QGeoTiledMapReply::tileSpec() const { return d_ptr->spec; } @@ -304,7 +304,7 @@ void QGeoTiledMapReply::abort() /******************************************************************************* *******************************************************************************/ -QGeoTiledMapReplyPrivate::QGeoTiledMapReplyPrivate(const TileSpec &spec) +QGeoTiledMapReplyPrivate::QGeoTiledMapReplyPrivate(const QGeoTileSpec &spec) : error(QGeoTiledMapReply::NoError), errorString(QLatin1String("")), isFinished(false), diff --git a/src/location/maps/qgeotiledmapreply.h b/src/location/maps/qgeotiledmapreply.h index e7cfb628..d354e6ad 100644 --- a/src/location/maps/qgeotiledmapreply.h +++ b/src/location/maps/qgeotiledmapreply.h @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE -class TileSpec; +class QGeoTileSpec; class QGeoTiledMapReplyPrivate; class Q_LOCATION_EXPORT QGeoTiledMapReply : public QObject @@ -67,7 +67,7 @@ public: UnknownError }; - QGeoTiledMapReply(const TileSpec &spec, QObject *parent = 0); + QGeoTiledMapReply(const QGeoTileSpec &spec, QObject *parent = 0); QGeoTiledMapReply(Error error, const QString &errorString, QObject *parent = 0); virtual ~QGeoTiledMapReply(); @@ -77,7 +77,7 @@ public: bool isCached() const; - TileSpec tileSpec() const; + QGeoTileSpec tileSpec() const; QByteArray mapImageData() const; QString mapImageFormat() const; diff --git a/src/location/maps/qgeotiledmapreply_p.h b/src/location/maps/qgeotiledmapreply_p.h index cf0043cb..5ac1fccc 100644 --- a/src/location/maps/qgeotiledmapreply_p.h +++ b/src/location/maps/qgeotiledmapreply_p.h @@ -54,14 +54,14 @@ // #include "qgeotiledmapreply.h" -#include "tilespec.h" +#include "qgeotilespec.h" QT_BEGIN_NAMESPACE class QGeoTiledMapReplyPrivate { public: - QGeoTiledMapReplyPrivate(const TileSpec &spec); + QGeoTiledMapReplyPrivate(const QGeoTileSpec &spec); QGeoTiledMapReplyPrivate(QGeoTiledMapReply::Error error, const QString& errorString); ~QGeoTiledMapReplyPrivate(); @@ -70,7 +70,7 @@ public: bool isFinished; bool isCached; - TileSpec spec; + QGeoTileSpec spec; QByteArray mapImageData; QString mapImageFormat; }; diff --git a/src/location/mapsgl/tilespec.cpp b/src/location/maps/qgeotilespec.cpp index 951a2266..13a0b394 100644 --- a/src/location/mapsgl/tilespec.cpp +++ b/src/location/maps/qgeotilespec.cpp @@ -38,96 +38,96 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "tilespec.h" -#include "tilespec_p.h" +#include "qgeotilespec.h" +#include "qgeotilespec_p.h" #include <QDebug> QT_BEGIN_NAMESPACE -TileSpec::TileSpec() - : d_ptr(new TileSpecPrivate()) {} +QGeoTileSpec::QGeoTileSpec() + : d_ptr(new QGeoTileSpecPrivate()) {} -TileSpec::TileSpec(const QString &plugin, int mapId, int zoom, int x, int y) - : d_ptr(new TileSpecPrivate(plugin, mapId, zoom, x, y)) {} +QGeoTileSpec::QGeoTileSpec(const QString &plugin, int mapId, int zoom, int x, int y) + : d_ptr(new QGeoTileSpecPrivate(plugin, mapId, zoom, x, y)) {} -TileSpec::TileSpec(const TileSpec &other) - : d_ptr(new TileSpecPrivate(*(other.d_ptr))) {} +QGeoTileSpec::QGeoTileSpec(const QGeoTileSpec &other) + : d_ptr(new QGeoTileSpecPrivate(*(other.d_ptr))) {} -TileSpec::~TileSpec() { +QGeoTileSpec::~QGeoTileSpec() { delete d_ptr; } -TileSpec& TileSpec::operator = (const TileSpec &other) +QGeoTileSpec& QGeoTileSpec::operator = (const QGeoTileSpec &other) { d_ptr->operator=(*(other.d_ptr)); return *this; } -QString TileSpec::plugin() const +QString QGeoTileSpec::plugin() const { - Q_D(const TileSpec); + Q_D(const QGeoTileSpec); return d->plugin_; } -void TileSpec::setZoom(int zoom) +void QGeoTileSpec::setZoom(int zoom) { - Q_D(TileSpec); + Q_D(QGeoTileSpec); d->zoom_ = zoom; } -int TileSpec::zoom() const +int QGeoTileSpec::zoom() const { - Q_D(const TileSpec); + Q_D(const QGeoTileSpec); return d->zoom_; } -void TileSpec::setX(int x) +void QGeoTileSpec::setX(int x) { - Q_D(TileSpec); + Q_D(QGeoTileSpec); d->x_ = x; } -int TileSpec::x() const +int QGeoTileSpec::x() const { - Q_D(const TileSpec); + Q_D(const QGeoTileSpec); return d->x_; } -void TileSpec::setY(int y) +void QGeoTileSpec::setY(int y) { - Q_D(TileSpec); + Q_D(QGeoTileSpec); d->y_ = y; } -int TileSpec::y() const +int QGeoTileSpec::y() const { - Q_D(const TileSpec); + Q_D(const QGeoTileSpec); return d->y_; } -void TileSpec::setMapId(int mapId) +void QGeoTileSpec::setMapId(int mapId) { - Q_D(TileSpec); + Q_D(QGeoTileSpec); d->mapId_ = mapId; } -int TileSpec::mapId() const +int QGeoTileSpec::mapId() const { - Q_D(const TileSpec); + Q_D(const QGeoTileSpec); return d->mapId_; } -bool TileSpec::operator == (const TileSpec &rhs) const +bool QGeoTileSpec::operator == (const QGeoTileSpec &rhs) const { return (d_ptr->operator == (*(rhs.d_ptr))); } -bool TileSpec::operator < (const TileSpec &rhs) const +bool QGeoTileSpec::operator < (const QGeoTileSpec &rhs) const { return (d_ptr->operator < (*(rhs.d_ptr))); } -unsigned int qHash(const TileSpec &spec) +unsigned int qHash(const QGeoTileSpec &spec) { unsigned int result = (qHash(spec.plugin()) * 13) % 31; result += ((spec.mapId() * 17) % 31) << 5; @@ -137,35 +137,35 @@ unsigned int qHash(const TileSpec &spec) return result; } -QDebug operator<< (QDebug dbg, const TileSpec &spec) +QDebug operator<< (QDebug dbg, const QGeoTileSpec &spec) { dbg << spec.plugin() << spec.mapId() << spec.zoom() << spec.x() << spec.y(); return dbg; } -TileSpecPrivate::TileSpecPrivate() +QGeoTileSpecPrivate::QGeoTileSpecPrivate() : mapId_(0), zoom_(-1), x_(-1), y_(-1) {} -TileSpecPrivate::TileSpecPrivate(const TileSpecPrivate &other) +QGeoTileSpecPrivate::QGeoTileSpecPrivate(const QGeoTileSpecPrivate &other) : plugin_(other.plugin_), mapId_(other.mapId_), zoom_(other.zoom_), x_(other.x_), y_(other.y_) {} -TileSpecPrivate::TileSpecPrivate(const QString &plugin, int mapId, int zoom, int x, int y) +QGeoTileSpecPrivate::QGeoTileSpecPrivate(const QString &plugin, int mapId, int zoom, int x, int y) : plugin_(plugin), mapId_(mapId), zoom_(zoom), x_(x), y_(y) {} -TileSpecPrivate::~TileSpecPrivate() {} +QGeoTileSpecPrivate::~QGeoTileSpecPrivate() {} -TileSpecPrivate& TileSpecPrivate::operator = (const TileSpecPrivate &other) +QGeoTileSpecPrivate& QGeoTileSpecPrivate::operator = (const QGeoTileSpecPrivate &other) { plugin_ = other.plugin_; mapId_ = other.mapId_; @@ -175,7 +175,7 @@ TileSpecPrivate& TileSpecPrivate::operator = (const TileSpecPrivate &other) return *this; } -bool TileSpecPrivate::operator == (const TileSpecPrivate &rhs) const +bool QGeoTileSpecPrivate::operator == (const QGeoTileSpecPrivate &rhs) const { if (plugin_ != rhs.plugin_) return false; @@ -195,7 +195,7 @@ bool TileSpecPrivate::operator == (const TileSpecPrivate &rhs) const return true; } -bool TileSpecPrivate::operator < (const TileSpecPrivate &rhs) const +bool QGeoTileSpecPrivate::operator < (const QGeoTileSpecPrivate &rhs) const { if (plugin_ < rhs.plugin_) return true; diff --git a/src/location/mapsgl/tilespec.h b/src/location/maps/qgeotilespec.h index 9b14a50b..6726b936 100644 --- a/src/location/mapsgl/tilespec.h +++ b/src/location/maps/qgeotilespec.h @@ -38,8 +38,8 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef TILESPEC_H -#define TILESPEC_H +#ifndef QGEOTILESPEC_H +#define QGEOTILESPEC_H #include <QtLocation/qlocationglobal.h> #include <QtCore/QMetaType> @@ -49,17 +49,17 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -class TileSpecPrivate; +class QGeoTileSpecPrivate; -class Q_LOCATION_EXPORT TileSpec +class Q_LOCATION_EXPORT QGeoTileSpec { public: - TileSpec(); - TileSpec(const TileSpec &other); - TileSpec(const QString &plugin, int mapId, int zoom, int x, int y); - ~TileSpec(); + QGeoTileSpec(); + QGeoTileSpec(const QGeoTileSpec &other); + QGeoTileSpec(const QString &plugin, int mapId, int zoom, int x, int y); + ~QGeoTileSpec(); - TileSpec& operator = (const TileSpec &other); + QGeoTileSpec& operator = (const QGeoTileSpec &other); QString plugin() const; @@ -75,22 +75,22 @@ public: void setMapId(int mapId); int mapId() const; - bool operator == (const TileSpec &rhs) const; - bool operator < (const TileSpec &rhs) const; + bool operator == (const QGeoTileSpec &rhs) const; + bool operator < (const QGeoTileSpec &rhs) const; private: - TileSpecPrivate *d_ptr; - Q_DECLARE_PRIVATE(TileSpec) + QGeoTileSpecPrivate *d_ptr; + Q_DECLARE_PRIVATE(QGeoTileSpec) }; -unsigned int qHash(const TileSpec &spec); +unsigned int qHash(const QGeoTileSpec &spec); -QDebug operator<<(QDebug, const TileSpec &); +QDebug operator<<(QDebug, const QGeoTileSpec &); QT_END_NAMESPACE -Q_DECLARE_METATYPE(TileSpec) +Q_DECLARE_METATYPE(QGeoTileSpec) QT_END_HEADER -#endif // TILESPEC_H +#endif // QGEOTILESPEC_H diff --git a/src/location/mapsgl/tilespec_p.h b/src/location/maps/qgeotilespec_p.h index 828a8adb..8c364c85 100644 --- a/src/location/mapsgl/tilespec_p.h +++ b/src/location/maps/qgeotilespec_p.h @@ -38,25 +38,25 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef TILESPEC_P_H -#define TILESPEC_P_H +#ifndef QGEOTILESPEC_P_H +#define QGEOTILESPEC_P_H #include <QString> QT_BEGIN_NAMESPACE -class TileSpecPrivate +class QGeoTileSpecPrivate { public: - TileSpecPrivate(); - TileSpecPrivate(const TileSpecPrivate &other); - TileSpecPrivate(const QString &plugin, int mapId, int zoom, int x, int y); - ~TileSpecPrivate(); + QGeoTileSpecPrivate(); + QGeoTileSpecPrivate(const QGeoTileSpecPrivate &other); + QGeoTileSpecPrivate(const QString &plugin, int mapId, int zoom, int x, int y); + ~QGeoTileSpecPrivate(); - TileSpecPrivate& operator = (const TileSpecPrivate &other); + QGeoTileSpecPrivate& operator = (const QGeoTileSpecPrivate &other); - bool operator == (const TileSpecPrivate &rhs) const; - bool operator < (const TileSpecPrivate &rhs) const; + bool operator == (const QGeoTileSpecPrivate &rhs) const; + bool operator < (const QGeoTileSpecPrivate &rhs) const; QString plugin_; int mapId_; @@ -67,4 +67,4 @@ public: QT_END_NAMESPACE -#endif // TILESPEC_P_H +#endif // QGEOTILESPEC_P_H diff --git a/src/location/mapsgl/mapsgl.pri b/src/location/mapsgl/mapsgl.pri deleted file mode 100644 index 27c68661..00000000 --- a/src/location/mapsgl/mapsgl.pri +++ /dev/null @@ -1,35 +0,0 @@ - -INCLUDEPATH += mapsgl - -QT += network qt3d - -SOURCES += \ - mapsgl/cameradata.cpp \ - mapsgl/frustum.cpp \ - mapsgl/map.cpp \ - mapsgl/mapcontroller.cpp \ - mapsgl/mapsphere.cpp \ - mapsgl/projection.cpp \ - mapsgl/projection2d_p.cpp \ - mapsgl/tilecache.cpp \ - mapsgl/tile.cpp \ - mapsgl/tilespec.cpp \ - mapsgl/maptype.cpp - -PUBLIC_HEADERS += \ - mapsgl/cameradata.h \ - mapsgl/map.h \ - mapsgl/mapcontroller.h \ - mapsgl/tilecache.h \ - mapsgl/tile.h \ - mapsgl/tilespec.h \ - mapsgl/maptype.h - -PRIVATE_HEADERS += \ - mapsgl/frustum_p.h \ - mapsgl/map_p.h \ - mapsgl/mapsphere_p.h \ - mapsgl/maptype_p.h \ - mapsgl/projection_p.h \ - mapsgl/projection2d_p.h \ - mapsgl/tilespec_p.h diff --git a/src/location/mapsgl/tilecamera.cpp b/src/location/mapsgl/tilecamera.cpp deleted file mode 100644 index 32a28a9a..00000000 --- a/src/location/mapsgl/tilecamera.cpp +++ /dev/null @@ -1,261 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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$ -** -****************************************************************************/ -#include "tilecamera.h" - -#include "spheregeometry.h" - -#include <QVector3D> -#include <qnumeric.h> -#include <qglcamera.h> - -#include <cmath> - -TileCamera::TileCamera() - : latitude_(-27.5), - longitude_(153), - distance_(0.1), - bearing_(0.0), - tilt_(0.0), - aspectRatio_(1.0), - camera_(new QGLCamera()) -{ -} - -TileCamera::~TileCamera() -{ - delete camera_; -} - -// Up and right units are bit obscure still, fixme -void TileCamera::rotateCamera(const SphereGeometry & sphere, double up, double right) -{ - QVector3D view = camera_->eye() - camera_->center(); - QVector3D side = QVector3D::normal(view, camera_->upVector()); - QMatrix4x4 rotationMatrix; - // First determine how big angle and about which axis' to rotate - // and express them with a rotation matrix (spherical rotation around origin) - rotationMatrix.rotate(right / sphere.zoomLevel(), camera_->upVector()); - rotationMatrix.rotate(up / sphere.zoomLevel(), side); - // Then rotate the eye and center of the camera - camera_->setCenter(camera_->center() * rotationMatrix); - camera_->setEye(camera_->eye() * rotationMatrix); -} - -void TileCamera::setCamera(const SphereGeometry &sphere, - double latitude, - double longitude, - double distance, - double bearing, - double tilt, - double aspectRatio) -{ - QVector3D c = sphere.coordToPoint(latitude, longitude); - QVector3D e = sphere.coordToPoint(latitude, longitude, sphere.radius() * distance); - - camera_->setCenter(c); - camera_->setEye(e); - - QVector3D view = camera_->eye() - camera_->center(); - QVector3D side = QVector3D::normal(view, QVector3D(0.0, 1.0, 0.0)); - QVector3D up = QVector3D::normal(side, view); - - // define rotation around view vector and apply it to up vector - QMatrix4x4 mBearing; - mBearing.rotate(-1.0 * bearing, view); - camera_->setUpVector(mBearing * up); - - // define rotation around new side vector and apply it to eye - QVector3D side2 = QVector3D::normal(mBearing * up, view); - QMatrix4x4 mTilt; - mTilt.rotate(tilt, side2); - camera_->setEye((mTilt * view) + c); - - // reset the up vector after tilting - view = camera_->eye() - camera_->center(); - up = QVector3D::normal(view, side2); - camera_->setUpVector(up); - - // set near and far planes - camera_->setNearPlane(1); - camera_->setFarPlane(2.0 * sphere.radius() * distance); - zoom_ = sphere.zoomLevel(); -} - -/* TODO improve zoomCamera a lot. Current implementation is very hacky. - - @factor: fractions of a zoom level to zoom in. Doubling a zoom level - roughly doubles the distance from the earth. - - @detailPreference: whether the distance from the earth should be that of the eye from - closest point on earth, or from eye to center (center is where we are looking at). - - */ -void TileCamera::zoomCamera(SphereGeometry& sphere, double factor, DetailPreference detailPreference) -{ - if (!(-1.0 < factor && factor < 1.0)) { - qWarning() << "Zoom factor must be between -1.0 and 1.0, you gave: " << factor; - return; - } - - QVector3D view = camera_->eye() - camera_->center(); - Q_ASSERT(view.length() > 0.0); - double viewVectorLength = view.length(); - double eyeVectorLength = camera_->eye().length(); - double sphereRadius = sphere.radius(); - double zoomDistance; - if (detailPreference == DetailPreferenceNear) { - qDebug() << "Zooming, preferring details/tiles near, factor: " << factor; - double viewEyeDotProduct = QVector3D::dotProduct(view, camera_->eye()); - // Dodgy, fixme - bool zoomOut = false; - if (factor < 0.0) { - factor = -factor; - zoomOut = true; - } - factor += 1.0; - // Look for the multiplication factor so that multiplying the view with the factor - // will result in eye height changing according to given factor. - double sqrtResult = sqrt(pow(viewEyeDotProduct, 2) - 4 * pow(viewVectorLength, 2) * (pow(eyeVectorLength, 2) - pow(sphereRadius + factor * eyeVectorLength - factor * sphereRadius , 2))); - double viewVectorFactor = (-viewEyeDotProduct + sqrtResult) / (2 * pow(viewVectorLength, 2)); - // Dodgy, fixme - if (!zoomOut) - camera_->setEye(camera_->eye() - view * viewVectorFactor); - else - camera_->setEye(view * viewVectorFactor + camera_->eye()); - // Fixme, far too big farplane (no pun intended) - view = camera_->eye() - camera_->center(); - camera_->setFarPlane(sphere.radius() + view.length()); - zoomDistance = camera_->eye().length() - sphere.radius(); - } else if (detailPreference == DetailPreferenceCenter) { - qDebug() << "Zooming, preferring details/tiles at center, factor: " << factor; - factor = -factor; - factor += 1; - camera_->setEye(camera_->center() + view * factor); - view = camera_->eye() - camera_->center(); - camera_->setFarPlane(sphere.radius() + view.length()); - zoomDistance = view.length(); - } else { - qWarning("Unsupported detail preference for zoom."); - return; - } - // Adjust sphere zoom level if necessary - double maxZoomLevel = 18; // TODO this needs to come from the current plugin - double zoomCoefficient = 0.5; // TODO just initial guess - int zoomLevel = int(maxZoomLevel - log(zoomDistance / zoomCoefficient) / log(2.0)); - qDebug() << "Zoom, tilesphere zoom was : " << sphere.zoomLevel(); - qDebug() << "Zoom level (fractional) would be : " << maxZoomLevel - log2(zoomDistance / zoomCoefficient); - if ((int)zoomLevel != sphere.zoomLevel() && zoomLevel < maxZoomLevel && zoomLevel >= 0) { - sphere.setZoomLevel(int(zoomLevel)); -// sphere.update(*this); - } -} - -// Can be done like this if quaternions ease the animation -//void TileCamera::tiltCamera(double tilt, QQuaternion = QQuaternion()) { -// { -// if (!quaternion.isIdentity()) // use quaternion. However, keeping track of 'tilt_' needs to be done -// ... -// else // use tilt angle - -void TileCamera::tiltCamera(const SphereGeometry& sphere, double tilt) -{ - Q_ASSERT(!qIsNaN(tilt)); - camera_->rotateCenter(camera_->tilt(tilt)); - // Don't fall through the sphere surface - if (camera_->eye().length() - sphere.radius() < 0.0) { - qDebug() << "Camera tilt safestop, would go through earth."; - camera_->rotateCenter(camera_->tilt(-tilt)); - } -} - -void TileCamera::rollCamera(const SphereGeometry& sphere, double roll) -{ - Q_UNUSED(sphere); - Q_ASSERT(!qIsNaN(roll)); - camera_->rotateCenter(camera_->roll(roll)); -} - -void TileCamera::panCamera(const SphereGeometry& sphere, double pan) -{ - Q_ASSERT(!qIsNaN(pan)); - camera_->rotateCenter(camera_->pan(pan)); - if (camera_->eye().length() - sphere.radius() < 0.0) { - qDebug() << "Camera pan safety stop, would go through earth."; - camera_->rotateCenter(camera_->pan(-pan)); - } -} - -QGLCamera* TileCamera::camera() const -{ - return camera_; -} - -QVector3D TileCamera::eye() const -{ - return camera_->eye(); -} - -QVector3D TileCamera::view(double x, double y) const -{ - double fov = atan(camera_->viewSize().height() / (2 * camera_->nearPlane())); - - double hf = 2 * tan(fov) * camera_->farPlane(); - double wf = hf * aspectRatio_; - - QVector3D p = camera_->eye(); - QVector3D d = camera_->center() - camera_->eye(); - d.normalize(); - - QVector3D up = camera_->upVector(); - up.normalize(); - - QVector3D right = QVector3D::normal(d, up); - - double x1 = qMin(qMax(x, 0.0), 1.0) - 0.5; - double y1 = qMin(qMax(y, 0.0), 1.0) - 0.5; - - QVector3D c = d * camera_->farPlane(); - c += up * hf * y1; - c += right * wf * x1; - - return c.normalized(); -} - diff --git a/src/location/mapsgl/tilecamera.h b/src/location/mapsgl/tilecamera.h deleted file mode 100644 index 4c40743f..00000000 --- a/src/location/mapsgl/tilecamera.h +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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 TILECAMERA_H -#define TILECAMERA_H - -#include "qglobal.h" - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - - - -class SphereGeometry; -class QGLCamera; -class QGLSceneNode; -class QVector3D; - -class Q_LOCATION_EXPORT TileCamera -{ -public: - TileCamera(); - ~TileCamera(); - - enum DetailPreference { - DetailPreferenceNear, - DetailPreferenceCenter - }; - - // Reset the camera (to look at lon,lat, with given distance, tilt etc.) - void setCamera(const SphereGeometry &sphere, - double latitude, - double longitude, - double distance, - double bearing, - double tilt, - double aspectRatio); - void tiltCamera(const SphereGeometry& sphere, double tilt); - void rollCamera(const SphereGeometry& sphere, double roll); - void panCamera(const SphereGeometry& sphere, double pan); - void rotateCamera(const SphereGeometry& sphere, double up, double right); - void zoomCamera(SphereGeometry& sphere, double factor, DetailPreference detailPreference = DetailPreferenceNear); - - QGLCamera* camera() const; - - QVector3D eye() const; - QVector3D view(double x, double y) const; - -private: - double latitude_; - double longitude_; - double distance_; - double bearing_; - double tilt_; - double zoom_; - double aspectRatio_; - QGLCamera* camera_; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // TILECAMERA_H diff --git a/src/plugins/geoservices/nokia/qgeomappingmanagerengine_nokia.cpp b/src/plugins/geoservices/nokia/qgeomappingmanagerengine_nokia.cpp index df94c263..efc8c357 100644 --- a/src/plugins/geoservices/nokia/qgeomappingmanagerengine_nokia.cpp +++ b/src/plugins/geoservices/nokia/qgeomappingmanagerengine_nokia.cpp @@ -49,7 +49,7 @@ #include "qgeomappingmanagerengine_nokia.h" #include "qgeomapreply_nokia.h" -#include <tilespec.h> +#include <qgeotilespec.h> #include <QNetworkAccessManager> #include <QNetworkDiskCache> @@ -97,18 +97,18 @@ void QGeoMappingManagerEngineNokia::init() { setTileSize(QSize(256, 256)); - QList<MapType> types; - types << MapType(MapType::StreetMap,tr("Street Map"),tr("Nokia Street Map"), false, 1); - types << MapType(MapType::SatelliteMapDay,tr("Satellite Map(day)"),tr("Nokia Satellite Map (day)"), false, 2); - types << MapType(MapType::TerrainMap,tr("Terrain Map"),tr("Nokia Terrain Map"), false, 3); - types << MapType(MapType::HybridMap,tr("Hybrid Map"),tr("Nokia Hybrid Map"), false, 4); - types << MapType(MapType::TransitMap,tr("Transit Map"),tr("Nokia Transit Map"), false, 5); - types << MapType(MapType::GrayStreetMap,tr("Gray Street Map"),tr("Nokia Gray Street Map"), false, 6); - types << MapType(MapType::StreetMap,tr("Mobile Street Map"),tr("Nokia Mobile Street Map"), true, 7); - types << MapType(MapType::TerrainMap,tr("Mobile Terrain Map"),tr("Nokia Mobile Terrain Map"), true, 8); - types << MapType(MapType::HybridMap,tr("Mobile Hybrid Map"),tr("Nokia Mobile Hybrid Map"), true, 9); - types << MapType(MapType::TransitMap,tr("Mobile Transit Map"),tr("Nokia Mobile Transit Map"), true, 10); - types << MapType(MapType::GrayStreetMap,tr("Mobile Gray Street Map"),tr("Nokia Mobile Gray Street Map"), true, 11); + QList<QGeoMapType> types; + types << QGeoMapType(QGeoMapType::StreetMap,tr("Street Map"),tr("Nokia Street Map"), false, 1); + types << QGeoMapType(QGeoMapType::SatelliteMapDay,tr("Satellite Map(day)"),tr("Nokia Satellite Map (day)"), false, 2); + types << QGeoMapType(QGeoMapType::TerrainMap,tr("Terrain Map"),tr("Nokia Terrain Map"), false, 3); + types << QGeoMapType(QGeoMapType::HybridMap,tr("Hybrid Map"),tr("Nokia Hybrid Map"), false, 4); + types << QGeoMapType(QGeoMapType::TransitMap,tr("Transit Map"),tr("Nokia Transit Map"), false, 5); + types << QGeoMapType(QGeoMapType::GrayStreetMap,tr("Gray Street Map"),tr("Nokia Gray Street Map"), false, 6); + types << QGeoMapType(QGeoMapType::StreetMap,tr("Mobile Street Map"),tr("Nokia Mobile Street Map"), true, 7); + types << QGeoMapType(QGeoMapType::TerrainMap,tr("Mobile Terrain Map"),tr("Nokia Mobile Terrain Map"), true, 8); + types << QGeoMapType(QGeoMapType::HybridMap,tr("Mobile Hybrid Map"),tr("Nokia Mobile Hybrid Map"), true, 9); + types << QGeoMapType(QGeoMapType::TransitMap,tr("Mobile Transit Map"),tr("Nokia Mobile Transit Map"), true, 10); + types << QGeoMapType(QGeoMapType::GrayStreetMap,tr("Mobile Gray Street Map"),tr("Nokia Mobile Gray Street Map"), true, 11); setSupportedMapTypes(types); // QList<QGraphicsGeoMap::ConnectivityMode> modes; @@ -207,7 +207,7 @@ void QGeoMappingManagerEngineNokia::init() QGeoMappingManagerEngine::init(); } -QGeoTiledMapReply* QGeoMappingManagerEngineNokia::getTileImage(const TileSpec &spec) +QGeoTiledMapReply* QGeoMappingManagerEngineNokia::getTileImage(const QGeoTileSpec &spec) { // TODO add error detection for if request.connectivityMode() != QGraphicsGeoMap::OnlineMode QString rawRequest = getRequestString(spec); @@ -230,7 +230,7 @@ QGeoTiledMapReply* QGeoMappingManagerEngineNokia::getTileImage(const TileSpec &s return mapReply; } -QString QGeoMappingManagerEngineNokia::getRequestString(const TileSpec &spec) const +QString QGeoMappingManagerEngineNokia::getRequestString(const QGeoTileSpec &spec) const { const char subdomain = m_maxSubdomains ? m_firstSubdomain.toAscii() + (spec.x() + spec.y()) % m_maxSubdomains : 0; diff --git a/src/plugins/geoservices/nokia/qgeomappingmanagerengine_nokia.h b/src/plugins/geoservices/nokia/qgeomappingmanagerengine_nokia.h index 9c11ed0e..a0f1d458 100644 --- a/src/plugins/geoservices/nokia/qgeomappingmanagerengine_nokia.h +++ b/src/plugins/geoservices/nokia/qgeomappingmanagerengine_nokia.h @@ -64,7 +64,7 @@ class QNetworkAccessManager; class QNetworkDiskCache; class QGeoTiledMapReply; -class TileSpec; +class QGeoTileSpec; class QGeoMappingManagerEngineNokia : public QGeoMappingManagerEngine { @@ -77,7 +77,7 @@ public: void init(); - QGeoTiledMapReply* getTileImage(const TileSpec &spec); + QGeoTiledMapReply* getTileImage(const QGeoTileSpec &spec); const QString& host() const; QChar firstSubdomain() const; @@ -94,7 +94,7 @@ private Q_SLOTS: private: Q_DISABLE_COPY(QGeoMappingManagerEngineNokia) - QString getRequestString(const TileSpec &spec) const; + QString getRequestString(const QGeoTileSpec &spec) const; static QString sizeToStr(const QSize &size); static QString mapIdToStr(int mapId); diff --git a/src/plugins/geoservices/nokia/qgeomapreply_nokia.cpp b/src/plugins/geoservices/nokia/qgeomapreply_nokia.cpp index 3471304b..697a44bd 100644 --- a/src/plugins/geoservices/nokia/qgeomapreply_nokia.cpp +++ b/src/plugins/geoservices/nokia/qgeomapreply_nokia.cpp @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE -QGeoMapReplyNokia::QGeoMapReplyNokia(QNetworkReply *reply, const TileSpec &spec, QObject *parent) +QGeoMapReplyNokia::QGeoMapReplyNokia(QNetworkReply *reply, const QGeoTileSpec &spec, QObject *parent) : QGeoTiledMapReply(spec, parent), m_reply(reply) { diff --git a/src/plugins/geoservices/nokia/qgeomapreply_nokia.h b/src/plugins/geoservices/nokia/qgeomapreply_nokia.h index bb95f4a7..6dce1964 100644 --- a/src/plugins/geoservices/nokia/qgeomapreply_nokia.h +++ b/src/plugins/geoservices/nokia/qgeomapreply_nokia.h @@ -49,7 +49,7 @@ #ifndef QGEOMAPREPLY_NOKIA_H #define QGEOMAPREPLY_NOKIA_H -#include <tilespec.h> +#include <qgeotilespec.h> #include <qgeotiledmapreply.h> #include <QNetworkReply> @@ -60,7 +60,7 @@ class QGeoMapReplyNokia : public QGeoTiledMapReply Q_OBJECT public: - QGeoMapReplyNokia(QNetworkReply *reply, const TileSpec &spec, QObject *parent = 0); + QGeoMapReplyNokia(QNetworkReply *reply, const QGeoTileSpec &spec, QObject *parent = 0); ~QGeoMapReplyNokia(); void abort(); diff --git a/tests/auto/geotestplugin/qgeomappingmanagerengine_test.h b/tests/auto/geotestplugin/qgeomappingmanagerengine_test.h index 37e57385..d7549735 100644 --- a/tests/auto/geotestplugin/qgeomappingmanagerengine_test.h +++ b/tests/auto/geotestplugin/qgeomappingmanagerengine_test.h @@ -50,8 +50,8 @@ #include <QByteArray> #include <QBuffer> #include <qgeotiledmapreply.h> -#include "maptype.h" -#include "tilespec.h" +#include "qgeomaptype.h" +#include "qgeotilespec.h" #include <QTimer> #include <QDebug> @@ -64,7 +64,7 @@ class TiledMapReplyTest :public QGeoTiledMapReply { Q_OBJECT public: - TiledMapReplyTest(const TileSpec &spec, QObject *parent=0): QGeoTiledMapReply (spec, parent) {} + TiledMapReplyTest(const QGeoTileSpec &spec, QObject *parent=0): QGeoTiledMapReply (spec, parent) {} void callSetError ( Error error, const QString & errorString ) {setError(error, errorString);} void callSetFinished ( bool finished ) { setFinished(finished);} void callSetCached(bool cached) { setFinished(cached);} @@ -101,13 +101,13 @@ public: void init() { setTileSize(QSize(256, 256)); - QList<MapType> types; - types << MapType(MapType::StreetMap,tr("Street Map"),tr("Test Street Map"), false, 1); + QList<QGeoMapType> types; + types << QGeoMapType(QGeoMapType::StreetMap,tr("Street Map"),tr("Test Street Map"), false, 1); setSupportedMapTypes(types); QGeoMappingManagerEngine::init(); } - QGeoTiledMapReply* getTileImage(const TileSpec &spec) + QGeoTiledMapReply* getTileImage(const QGeoTileSpec &spec) { mappingReply_ = new TiledMapReplyTest(spec, this); diff --git a/tests/auto/maptype/tst_maptype.cpp b/tests/auto/maptype/tst_maptype.cpp index 492e6cf3..a0848f75 100644 --- a/tests/auto/maptype/tst_maptype.cpp +++ b/tests/auto/maptype/tst_maptype.cpp @@ -42,7 +42,7 @@ #include <QtCore/QString> #include <QtTest/QtTest> -#include <maptype.h> +#include <qgeomaptype.h> QT_USE_NAMESPACE @@ -67,12 +67,12 @@ tst_MapType::tst_MapType() {} void tst_MapType::constructorTest() { - MapType *testObjPtr = new MapType(MapType::StreetMap, "street name", "street desc", false, 0); + QGeoMapType *testObjPtr = new QGeoMapType(QGeoMapType::StreetMap, "street name", "street desc", false, 0); QVERIFY(testObjPtr); delete testObjPtr; - testObjPtr = new MapType(); - QVERIFY2(testObjPtr->style() == MapType::NoMap, "Wrong default value"); + testObjPtr = new QGeoMapType(); + QVERIFY2(testObjPtr->style() == QGeoMapType::NoMap, "Wrong default value"); QVERIFY2(testObjPtr->name() == "", "Wrong default value"); QVERIFY2(testObjPtr->description() == "", "Wrong default value"); QVERIFY2(testObjPtr->mobile() == false, "Wrong default value"); @@ -82,64 +82,64 @@ void tst_MapType::constructorTest() void tst_MapType::styleTest() { - MapType testObj = MapType(MapType::StreetMap, "street name", "street desc", false, 0); - QVERIFY2(testObj.style() == MapType::StreetMap, "Wrong value returned"); + QGeoMapType testObj = QGeoMapType(QGeoMapType::StreetMap, "street name", "street desc", false, 0); + QVERIFY2(testObj.style() == QGeoMapType::StreetMap, "Wrong value returned"); } void tst_MapType::nameTest() { - MapType testObj = MapType(MapType::StreetMap, "street name", "street desc", false, 0); + QGeoMapType testObj = QGeoMapType(QGeoMapType::StreetMap, "street name", "street desc", false, 0); QVERIFY2(testObj.name() == "street name", "Wrong value returned"); } void tst_MapType::descTest() { - MapType testObj = MapType(MapType::StreetMap, "street name", "street desc", false, 0); + QGeoMapType testObj = QGeoMapType(QGeoMapType::StreetMap, "street name", "street desc", false, 0); QVERIFY2(testObj.description() == "street desc", "Wrong value returned"); } void tst_MapType::mobileTest() { - MapType testObj = MapType(MapType::StreetMap, "mobile street name", "mobile street desc", true, 0); + QGeoMapType testObj = QGeoMapType(QGeoMapType::StreetMap, "mobile street name", "mobile street desc", true, 0); QVERIFY2(testObj.mobile() == true, "Wrong value returned"); } void tst_MapType::mapIdTest() { - MapType testObj = MapType(MapType::StreetMap, "mobile street name", "mobile street desc", true, 42); + QGeoMapType testObj = QGeoMapType(QGeoMapType::StreetMap, "mobile street name", "mobile street desc", true, 42); QVERIFY2(testObj.mapId() == 42, "Wrong value returned"); } void tst_MapType::comparison() { // TODO Tried using data function but couldn't make QFETCH work - MapType t1 = MapType(MapType::StreetMap, "street name", "street desc", false, 42); - MapType t2 = MapType(MapType::StreetMap, "street name", "street desc", false, 42); + QGeoMapType t1 = QGeoMapType(QGeoMapType::StreetMap, "street name", "street desc", false, 42); + QGeoMapType t2 = QGeoMapType(QGeoMapType::StreetMap, "street name", "street desc", false, 42); QCOMPARE(t1 == t2, true); QCOMPARE(t1 != t2, false); - t1 = MapType(); - t2 = MapType(); + t1 = QGeoMapType(); + t2 = QGeoMapType(); QCOMPARE(t1 == t2, true); - t1 = MapType(MapType::StreetMap, "street name", "street desc", false, 42); - t2 = MapType(MapType::TerrainMap, "street name", "street desc", false, 42); + t1 = QGeoMapType(QGeoMapType::StreetMap, "street name", "street desc", false, 42); + t2 = QGeoMapType(QGeoMapType::TerrainMap, "street name", "street desc", false, 42); QCOMPARE(t1 == t2, false); - t1 = MapType(MapType::StreetMap, "street name", "street desc", false, 42); - t2 = MapType(MapType::StreetMap, "different name", "street desc", false, 42); + t1 = QGeoMapType(QGeoMapType::StreetMap, "street name", "street desc", false, 42); + t2 = QGeoMapType(QGeoMapType::StreetMap, "different name", "street desc", false, 42); QCOMPARE(t1 == t2, false); - t1 = MapType(MapType::StreetMap, "street name", "street desc", false, 42); - t2 = MapType(MapType::StreetMap, "street name", "different desc", false, 42); + t1 = QGeoMapType(QGeoMapType::StreetMap, "street name", "street desc", false, 42); + t2 = QGeoMapType(QGeoMapType::StreetMap, "street name", "different desc", false, 42); QCOMPARE(t1 == t2, false); - t1 = MapType(MapType::StreetMap, "street name", "street desc", false, 42); - t2 = MapType(MapType::StreetMap, "street name", "street desc", true, 42); + t1 = QGeoMapType(QGeoMapType::StreetMap, "street name", "street desc", false, 42); + t2 = QGeoMapType(QGeoMapType::StreetMap, "street name", "street desc", true, 42); QCOMPARE(t1 == t2, false); - t1 = MapType(MapType::StreetMap, "street name", "street desc", false, 42); - t2 = MapType(MapType::StreetMap, "street name", "street desc", false, 99); + t1 = QGeoMapType(QGeoMapType::StreetMap, "street name", "street desc", false, 42); + t2 = QGeoMapType(QGeoMapType::StreetMap, "street name", "street desc", false, 99); QCOMPARE(t1 == t2, false); } |