Merge branch 'map' of https://vcs.maemo.org/git/situare into map
[situare] / src / map / mapengine.h
index 7ba92eb..eca611f 100644 (file)
@@ -64,7 +64,6 @@ public:
     * @param tileNumber x & y numbers of the tile
     * @return QPoint MapScene coordinate
     */
-
     static QPoint convertTileNumberToSceneCoordinate(int zoomLevel, QPoint tileNumber)
     {
         int pow = 1 << (MAX_MAP_ZOOM_LEVEL - zoomLevel);
@@ -81,7 +80,7 @@ public:
     * @param sceneCoordinate MapScene coordinate
     * @return QPoint tile x & y numbers
     */
-    static QPoint convertSceneCoordinateToTileNumber(int zoomLevel, QPointF sceneCoordinate)
+    static QPoint convertSceneCoordinateToTileNumber(int zoomLevel, QPoint sceneCoordinate)
     {
         int pow = 1 << (MAX_MAP_ZOOM_LEVEL - zoomLevel);
         int x = static_cast<int>(sceneCoordinate.x() / (TILE_SIZE_X*pow));
@@ -111,7 +110,7 @@ public:
     * @param latLonCoordinate latitude and longitude values
     * @return scene coordinate
     */
-    static QPointF convertLatLonToSceneCoordinate(QPointF latLonCoordinate)
+    static QPoint convertLatLonToSceneCoordinate(QPointF latLonCoordinate)
     {
         /// @todo CREATE TEST CASE & CHECK CALCULATION
         qDebug() << __PRETTY_FUNCTION__;
@@ -130,7 +129,7 @@ public:
         qreal y = static_cast<qreal>((1.0 - log(tan(latitude * M_PI / 180.0) + 1.0
                                     / cos(latitude * M_PI / 180.0)) / M_PI) / 2.0);
 
-        return QPointF(x*z*TILE_SIZE_X, y*z*TILE_SIZE_Y);
+        return QPointF(x*z*TILE_SIZE_X, y*z*TILE_SIZE_Y).toPoint();
     }
 
 public slots:
@@ -140,7 +139,7 @@ public slots:
     * Emits locationChanged signal.
     * @param sceneCoordinate Scene coordinates for new position
     */
-    void setLocation(QPointF sceneCoordinate);
+    void setLocation(QPoint sceneCoordinate);
 
     void viewResized(const QSize &size);
 
@@ -191,14 +190,14 @@ private:
     * @param sceneCoordinate scene's current center coordinate
     * @return QRect grid of tile coordinates
     */
-    QRect calculateGrid(QPointF sceneCoordinate);
+    QRect calculateGrid(QPoint sceneCoordinate);
 
     /**
     * @brief Calculate new tiles to fetch.
     *
     * @param sceneCoordinate scene's center coordinate
     */
-    void calculateNewTiles(QPointF sceneCoordinate);
+    void calculateNewTiles(QPoint sceneCoordinate);
 
     /**
     * @brief Remove tiles which are out of view bounds.
@@ -221,7 +220,7 @@ private:
     * @param sceneCoordinate scene's center coordinate
     * @return bool true if center tile changed, false otherwise
     */
-    bool centerTileChanged(QPointF sceneCoordinate);
+    bool centerTileChanged(QPoint sceneCoordinate);
 
 private slots:
     /**
@@ -251,7 +250,7 @@ signals:
     *
     * @param sceneCoordinate New scene coordinates
     */
-    void locationChanged(QPointF sceneCoordinate);
+    void locationChanged(QPoint sceneCoordinate);
 
     /**
     * @brief Signal for zoom level change
@@ -267,13 +266,6 @@ signals:
     */
     void fetchImage(const QUrl &url);
 
-    /**
-    * @brief Signal for centering to scene coordinate.
-    *
-    * @param sceneCoordinate center scene coordinate
-    */
-    void centerToSceneCoordinates(QPointF sceneCoordinate);
-
 private:
 
     MapScene *m_mapScene; ///< Scene for map tiles
@@ -281,7 +273,7 @@ private:
     int m_zoomLevel; ///< Current zoom level
     QHash<QString, MapTile *> mapTilesInScene;  ///< List of map tiles in map scene
     QSize m_viewSize;   ///< Current view size
-    QPointF m_sceneCoordinate;  ///< Current center coordinate
+    QPoint m_sceneCoordinate;  ///< Current center coordinate
     QPoint m_centerTile;    ///< Current center tile
     QRect viewGrid; ///< Current grid of tiles in view
 };