summaryrefslogtreecommitdiff
path: root/src/location/maps
diff options
context:
space:
mode:
Diffstat (limited to 'src/location/maps')
-rw-r--r--src/location/maps/qgeomap_p.h2
-rw-r--r--src/location/maps/qgeomapdata_p_p.h2
-rw-r--r--src/location/maps/qgeomappingmanager.cpp11
-rw-r--r--src/location/maps/qgeomappingmanager_p.h4
-rw-r--r--src/location/maps/qgeomapscene.cpp30
-rw-r--r--src/location/maps/qgeomapsscene_qt3d.cpp30
-rw-r--r--src/location/maps/qgeotilecache.cpp12
-rw-r--r--src/location/maps/qgeotilecache_p.h6
8 files changed, 61 insertions, 36 deletions
diff --git a/src/location/maps/qgeomap_p.h b/src/location/maps/qgeomap_p.h
index d27fd178..7ea67dc1 100644
--- a/src/location/maps/qgeomap_p.h
+++ b/src/location/maps/qgeomap_p.h
@@ -108,6 +108,8 @@ public:
QString pluginString();
+ QGeoMapData *mapData() { return mapData_; }
+
public Q_SLOTS:
void update();
void cameraStopped(); // optional hint for prefetch
diff --git a/src/location/maps/qgeomapdata_p_p.h b/src/location/maps/qgeomapdata_p_p.h
index 0c1238a9..9737da00 100644
--- a/src/location/maps/qgeomapdata_p_p.h
+++ b/src/location/maps/qgeomapdata_p_p.h
@@ -107,7 +107,9 @@ private:
int height_;
double aspectRatio_;
+#ifndef NO_QT3D_RENDERER
QGLCamera *camera_;
+#endif
QGeoMapData *map_;
QGeoMappingManagerEngine *engine_;
QString pluginString_;
diff --git a/src/location/maps/qgeomappingmanager.cpp b/src/location/maps/qgeomappingmanager.cpp
index 24e08278..c6761d16 100644
--- a/src/location/maps/qgeomappingmanager.cpp
+++ b/src/location/maps/qgeomappingmanager.cpp
@@ -45,6 +45,10 @@
#include "qgeotiledmapreply_p.h"
#include "qgeocameracapabilities_p.h"
+#ifdef NO_QT3D_RENDERER
+#include "qgeotiledmapdata_p.h"
+#include "qgeotilecache_p.h"
+#endif
#include "qgeomap_p.h"
@@ -135,9 +139,14 @@ QGeoCameraCapabilities QGeoMappingManager::cameraCapabilities() const
/*!
Returns a new QGeoMap instance which will be managed by this manager.
*/
-QGeoMap *QGeoMappingManager::createMap(QObject *parent)
+QGeoMap *QGeoMappingManager::createMap(QObject *parent, QQuickWindow *window)
{
QGeoMapData *mapData = d_ptr->engine->createMapData();
+#ifdef NO_QT3D_RENDERER
+ QGeoTiledMapData *tMapData = qobject_cast<QGeoTiledMapData*>(mapData);
+ qDebug() << "Setting window";
+ tMapData->tileCache()->setQQuickWindow(window);
+#endif
QGeoMap *map = new QGeoMap(mapData, parent);
return map;
}
diff --git a/src/location/maps/qgeomappingmanager_p.h b/src/location/maps/qgeomappingmanager_p.h
index fd1a8ae6..976d1804 100644
--- a/src/location/maps/qgeomappingmanager_p.h
+++ b/src/location/maps/qgeomappingmanager_p.h
@@ -69,7 +69,7 @@ class QGeoMappingManagerPrivate;
class QGeoMapRequestOptions;
class QGeoMappingManagerEngine;
class QGeoCameraCapabilities;
-
+class QQuickWindow;
class Q_LOCATION_EXPORT QGeoMappingManager : public QObject
{
@@ -81,7 +81,7 @@ public:
QString managerName() const;
int managerVersion() const;
- QGeoMap *createMap(QObject *parent);
+ QGeoMap *createMap(QObject *parent, QQuickWindow *window = 0);
QList<QGeoMapType> supportedMapTypes() const;
diff --git a/src/location/maps/qgeomapscene.cpp b/src/location/maps/qgeomapscene.cpp
index feade05e..e182ed73 100644
--- a/src/location/maps/qgeomapscene.cpp
+++ b/src/location/maps/qgeomapscene.cpp
@@ -337,5 +337,35 @@ void QGeoMapScenePrivate::setTileBounds(const QSet<QGeoTileSpec> &tiles)
}
}
+QRectF QGeoMapScenePrivate::buildGeometry(const QGeoTileSpec &spec)
+{
+ int x = spec.x();
+
+ if (x < tileXWrapsBelow_)
+ x += sideLength_;
+
+ if ((x < minTileX_)
+ || (maxTileX_ < x)
+ || (spec.y() < minTileY_)
+ || (maxTileY_ < spec.y())
+ || (spec.zoom() != tileZ_)) {
+ return QRectF();
+ }
+
+ double edge = scaleFactor_ * tileSize_;
+
+ double x1 = (x - minTileX_);
+ double x2 = x1 + 1.0;
+
+ double y1 = (minTileY_ - spec.y());
+ double y2 = y1 - 1.0;
+
+ x1 *= edge;
+ x2 *= edge;
+ y1 *= edge;
+ y2 *= edge;
+ return QRectF(x1, y1, x2-x1, y2-y1);
+}
+
QT_END_NAMESPACE
diff --git a/src/location/maps/qgeomapsscene_qt3d.cpp b/src/location/maps/qgeomapsscene_qt3d.cpp
index fa15001f..8d2fd5e4 100644
--- a/src/location/maps/qgeomapsscene_qt3d.cpp
+++ b/src/location/maps/qgeomapsscene_qt3d.cpp
@@ -191,36 +191,6 @@ void QGeoMapScenePrivate::updateTiles(const QSet<QGeoTileSpec> &tiles)
}
}
-QRectF QGeoMapScenePrivate::buildGeometry(const QGeoTileSpec &spec)
-{
- int x = spec.x();
-
- if (x < tileXWrapsBelow_)
- x += sideLength_;
-
- if ((x < minTileX_)
- || (maxTileX_ < x)
- || (spec.y() < minTileY_)
- || (maxTileY_ < spec.y())
- || (spec.zoom() != tileZ_)) {
- return QRectF();
- }
-
- double edge = scaleFactor_ * tileSize_;
-
- double x1 = (x - minTileX_);
- double x2 = x1 + 1.0;
-
- double y1 = (minTileY_ - spec.y());
- double y2 = y1 - 1.0;
-
- x1 *= edge;
- x2 *= edge;
- y1 *= edge;
- y2 *= edge;
- return QRectF(x1, y1, x2-x1, y2-y1);
-}
-
void QGeoMapScenePrivate::removeTiles(const QSet<QGeoTileSpec> &oldTiles)
{
typedef QSet<QGeoTileSpec>::const_iterator iter;
diff --git a/src/location/maps/qgeotilecache.cpp b/src/location/maps/qgeotilecache.cpp
index a79e29e7..41dc498d 100644
--- a/src/location/maps/qgeotilecache.cpp
+++ b/src/location/maps/qgeotilecache.cpp
@@ -65,7 +65,7 @@ QMutex QGeoTileCache::cleanupMutex_;
#ifndef NO_QT3D_RENDERER
QList<QGLTexture2D*> QGeoTileCache::cleanupList_;
#else
-QList<void*> QGeoTileCache::cleanupList_;
+QList<QSGTexture*> QGeoTileCache::cleanupList_;
#endif
@@ -116,6 +116,9 @@ QGeoTileTexture::~QGeoTileTexture()
QGeoTileCache::QGeoTileCache(const QString &directory, QObject *parent)
: QObject(parent), directory_(directory),
minTextureUsage_(0), extraTextureUsage_(0)
+#ifdef NO_QT3D_RENDERER
+ , m_containingWindow(0)
+#endif
{
qRegisterMetaType<QGeoTileSpec>();
qRegisterMetaType<QList<QGeoTileSpec> >();
@@ -301,6 +304,11 @@ void QGeoTileCache::GLContextAvailable()
cleanupList_.pop_front();
}
}
+#else
+void QGeoTileCache::setQQuickWindow(QQuickWindow *window)
+{
+ m_containingWindow = window;
+}
#endif
QSharedPointer<QGeoTileTexture> QGeoTileCache::get(const QGeoTileSpec &spec)
@@ -420,7 +428,7 @@ QSharedPointer<QGeoTileTexture> QGeoTileCache::addToTextureCache(const QGeoTileS
tt->texture->setHorizontalWrap(QGL::ClampToEdge);
tt->texture->setVerticalWrap(QGL::ClampToEdge);
#else
- //tt->texture = QQuickWindow::createTextureFromImage(pixmap.toImage());
+ tt->texture = m_containingWindow->createTextureFromImage(pixmap.toImage());
tt->texture->setHorizontalWrapMode(QSGTexture::ClampToEdge);
tt->texture->setVerticalWrapMode(QSGTexture::ClampToEdge);
#endif
diff --git a/src/location/maps/qgeotilecache_p.h b/src/location/maps/qgeotilecache_p.h
index 1dbb0363..2d473dad 100644
--- a/src/location/maps/qgeotilecache_p.h
+++ b/src/location/maps/qgeotilecache_p.h
@@ -75,6 +75,7 @@ class QGeoTileCache;
class QGLTexture2D;
#else
class QSGTexture;
+class QQuickWindow;
#endif
class QPixmap;
@@ -142,6 +143,8 @@ public:
#ifndef NO_QT3D_RENDERER
void GLContextAvailable();
+#else
+ void setQQuickWindow(QQuickWindow *window);
#endif
QSharedPointer<QGeoTileTexture> get(const QGeoTileSpec &spec);
@@ -182,7 +185,8 @@ private:
#ifndef NO_QT3D_RENDERER
static QList<QGLTexture2D*> cleanupList_;
#else
- static QList<void*> cleanupList_;
+ static QList<QSGTexture*> cleanupList_;
+ QQuickWindow *m_containingWindow;
#endif
};