Started writing some map fetcher usage code, but the actual map fetcher codebase...
authorSami Rämö <sami.ramo@ixonos.com>
Thu, 1 Apr 2010 07:43:47 +0000 (10:43 +0300)
committerSami Rämö <sami.ramo@ixonos.com>
Thu, 1 Apr 2010 07:43:47 +0000 (10:43 +0300)
src/map/mapengine.cpp
src/map/mapengine.h

index 4b6314f..601c6ab 100644 (file)
@@ -20,6 +20,7 @@
 */
 
 #include <QDebug>
+#include <QUrl>
 
 #include "mapengine.h"
 #include "maptile.h"
@@ -32,6 +33,8 @@ MapEngine::MapEngine(MapView *mapView, QWidget *parent)
     m_mapScene = new MapScene(this);
     mapView->setScene(m_mapScene);
     m_zoomLevel = 14;
+
+    m_mapFetcher = new MapFetcher(this);
 }
 
 void MapEngine::setViewLocation(QPointF latLonCoordinate)
@@ -41,14 +44,19 @@ void MapEngine::setViewLocation(QPointF latLonCoordinate)
     /// Show some dummy map tiles for demo purposes
     for (int x=9351; x<=9354; x++) {
         for (int y=4261; y<=4264; y++) {
-            MapTile *mapTile = new MapTile();
-            mapTile->setZoomLevel(m_zoomLevel);
-            mapTile->setTileNumber(QPoint(x, y));
-            QString fileName = QString("res/images/test_map_tiles/%1_%2_%3.png")
-                               .arg(mapTile->zoomLevel()).arg(x).arg(y);
-//            qDebug() << __PRETTY_FUNCTION__ << "fileName:" << fileName;
-            mapTile->setPixmap(QPixmap(fileName));
-            m_mapScene->addMapTile(mapTile);
+
         }
     }
 }
+
+void MapEngine::mapImageReceived(const QUrl url, const QPixmap pixmap)
+{
+    QString path = url.path();
+    qDebug() << __PRETTY_FUNCTION__ << "path:" << path;
+
+//    MapTile *mapTile = new MapTile();
+//    mapTile->setZoomLevel(m_zoomLevel);
+//    mapTile->setTileNumber(QPoint(x, y));
+//    mapTile->setPixmap(QPixmap(fileName));
+//    m_mapScene->addMapTile(mapTile);
+}
index cc486a2..8bbe1ff 100644 (file)
@@ -37,6 +37,7 @@
 /// \author Sami Rämö - sami.ramo (at) ixonos.com
 class MapEngine : public QObject
 {
+    Q_OBJECT
 public:
     /// \brief Constructor
     ///
@@ -63,6 +64,9 @@ public:
     /// \param latLonCoordinate Latitude & longitude coordinates for location
     void setViewLocation(QPointF latLonCoordinate);
 
+private slots:
+    void mapImageReceived(const QUrl url, const QPixmap pixmap);
+
 public:
     static const int TILE_SIZE_X = 256; ///< Tile image size in x direction
     static const int TILE_SIZE_Y = 256; ///< Tile image size in y direction
@@ -72,6 +76,7 @@ public:
 private:
     MapView *m_mapView; ///< View for viewing map
     MapScene *m_mapScene; ///< Scene for map tiles
+    MapFetcher *m_mapFetcher; ///< Fetcher for map tiles
     int m_zoomLevel; ///< Current zoom level
 };