*/
#include <QDebug>
+#include <QUrl>
#include "mapengine.h"
#include "maptile.h"
m_mapScene = new MapScene(this);
mapView->setScene(m_mapScene);
m_zoomLevel = 14;
+
+ m_mapFetcher = new MapFetcher(this);
}
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);
+}
/// \author Sami Rämö - sami.ramo (at) ixonos.com
class MapEngine : public QObject
{
+ Q_OBJECT
public:
/// \brief Constructor
///
/// \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
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
};