Added basic zoom functionality
authorSami Rämö <sami.ramo@ixonos.com>
Mon, 12 Apr 2010 07:23:37 +0000 (10:23 +0300)
committerSami Rämö <sami.ramo@ixonos.com>
Mon, 12 Apr 2010 07:23:37 +0000 (10:23 +0300)
doc/map/map_class_diagram.dia
src/map/mapengine.cpp
src/map/mapengine.h
src/ui/mapviewscreen.cpp

index f68c489..a255926 100644 (file)
Binary files a/doc/map/map_class_diagram.dia and b/doc/map/map_class_diagram.dia differ
index dbfc315..633b6b2 100644 (file)
@@ -137,8 +137,10 @@ QRect MapEngine::calculateGrid(QPointF sceneCoordinate)
 
 void MapEngine::setLocation(QPointF sceneCoordinate)
 {
+    /// @todo SAVE LOCATION
     emit locationChanged(sceneCoordinate);
 
+    /// @todo REFACTOR, MAKE NEW METHOD FOR MAP TILE LOGIC
     QRect grid = calculateGrid(sceneCoordinate);
     int topLeftX = grid.topLeft().x();
     int topLeftY = grid.topLeft().y();
@@ -172,3 +174,22 @@ void MapEngine::setLocation(QPointF sceneCoordinate)
     }
 }
 
+void MapEngine::zoomIn()
+{
+    if (m_zoomLevel >= MAX_ZOOM_LEVEL)
+        return;
+
+    m_zoomLevel++;
+    emit zoomLevelChanged(m_zoomLevel);
+    /// @todo START FETCHING TILES
+}
+
+void MapEngine::zoomOut()
+{
+    if (m_zoomLevel <= MIN_ZOOM_LEVEL)
+        return;
+
+    m_zoomLevel--;
+    emit zoomLevelChanged(m_zoomLevel);
+    /// @todo START FETCHING TILES
+}
index 038bf82..b2da7a6 100644 (file)
@@ -170,6 +170,18 @@ private slots:
     */
     void setLocation(QPointF sceneCoordinate);
 
+    /**
+    * @brief Slot for zooming in
+    *
+    */
+    void zoomIn();
+
+    /**
+    * @brief Slot for zooming out
+    *
+    */
+    void zoomOut();
+
 signals:
     /**
     * @brief Signal for view location change
index 6c2684a..7ec92ce 100644 (file)
@@ -50,8 +50,8 @@ MapViewScreen::MapViewScreen(QWidget *parent)
     mapControlLayout->addWidget(zoomOut);
     mapViewLayout->addWidget(mapControl);
     connect(search, SIGNAL(clicked()), this, SLOT(searchMap()));
-    connect(zoomIn, SIGNAL(clicked()), this, SLOT(zoomInMap()));
-    connect(zoomOut, SIGNAL(clicked()), this, SLOT(zoomOutMap()));
+    connect(zoomIn, SIGNAL(clicked()), mapEngine, SLOT(zoomIn()));
+    connect(zoomOut, SIGNAL(clicked()), mapEngine, SLOT(zoomOut()));
     //DEBUG
     mapViewLayout->addWidget(mapView);
     setLayout(mapViewLayout);