Merge branch 'master' into kinetic
[situare] / src / map / mapengine.h
index d267072..816577a 100644 (file)
@@ -180,6 +180,13 @@ public:
 
 public slots:
     /**
+     * @brief Center smoothly to given latitude and longitude coordinates.
+     *
+     * @param latLonCoordinate Latitude & longitude coordinates for location
+     */
+    void centerToCoordinates(QPointF latLonCoordinate);
+
+    /**
      * @brief Slot to catch user own location data
      *
      * @param user User info
@@ -203,22 +210,6 @@ public slots:
     void setGPSEnabled(bool enabled);
 
     /**
-     * @brief Slot for setting current view location
-     *
-     * Emits locationChanged signal.
-     * @param sceneCoordinate Scene coordinates for new position
-     */
-    void setLocation(QPoint sceneCoordinate);
-
-    /**
-     * @brief Helper for setting view location based on latitude and longitude
-     * coordinates
-     *
-     * @param latLonCoordinate Latitude & longitude coordinates for location
-     */
-    void setViewLocation(QPointF latLonCoordinate);
-
-    /**
      * @brief Calculate maximum value for tile in this zoom level.
      *
      * @param zoomLevel zoom level
@@ -245,12 +236,11 @@ private:
     QRect calculateTileGrid(QPoint sceneCoordinate);
 
     /**
-     * @brief Check if auto centering should be disabled.
+     * @brief Request disabling of auto centering if centered too far from the real location.
      *
      * @param sceneCoordinate scene's center coordinate
-     * @return bool true if auto centering should be disabled
      */
-    bool disableAutoCentering(QPoint sceneCoordinate);
+    void disableAutoCenteringIfRequired(QPoint sceneCoordinate);
 
     /**
      * @brief Get new tiles.
@@ -340,6 +330,31 @@ private slots:
     void mapImageReceived(int zoomLevel, int x, int y, const QPixmap &image);
 
     /**
+    * @brief Called when MapScroller state is changed
+    *
+    * Does check if the smooth scroll effect was interrupted and should the auto centering
+    * feature to be disabled.
+    *
+    * @param newState New state
+    */
+    void scrollerStateChanged(QAbstractAnimation::State newState);
+
+    /**
+    * @brief Scroll smoothly to given scene position
+    *
+    * @param scenePosition Target position in the scene
+    */
+    void scrollToPosition(QPoint scenePosition);
+
+    /**
+     * @brief Set center point in the scene
+     *
+     * Does emit locationChanged signal.
+     * @param scenePosition Scene coordinates for new position
+     */
+    void setCenterPosition(QPoint scenePosition);
+
+    /**
      * @brief Slot for actions after view zoom is finished
      *
      * Does run removeOutOfViewTiles
@@ -429,19 +444,21 @@ signals:
  * DATA MEMBERS
  ******************************************************************************/
 private:
-    bool m_autoCenteringEnabled;   ///< Auto centering enabled
-    bool m_zoomedIn;               ///< Flag for checking if zoomed in when zoom is finished
+    bool m_autoCenteringEnabled;    ///< Auto centering enabled
+    bool m_scrollStartedByGps;      ///< Smooth scroll is started by GPS?
+    bool m_smoothScrollRunning;     ///< Smooth scroll is running?
+    bool m_zoomedIn;                ///< Flag for checking if zoomed in when zoom is finished
 
-    int m_zoomLevel;               ///< Current zoom level
+    int m_zoomLevel;                ///< Current zoom level
 
-    QPoint m_centerTile;           ///< Current center tile
-    QPoint m_lastManualPosition;   ///< Last manually set position in scene coordinate
-    QPoint m_sceneCoordinate;      ///< Current center coordinate
+    QPoint m_centerTile;            ///< Current center tile
+    QPoint m_lastAutomaticPosition; ///< Last automatically set position in scene coordinate
+    QPoint m_sceneCoordinate;       ///< Current center coordinate
 
-    QRect m_viewTilesGrid;         ///< Current grid of tiles in view (includes margin)
+    QRect m_viewTilesGrid;          ///< Current grid of tiles in view (includes margin)
 
-    QSize m_tilesGridSize;         ///< Current size of the tiles grid
-    QSize m_viewSize;              ///< Current view size
+    QSize m_tilesGridSize;          ///< Current size of the tiles grid
+    QSize m_viewSize;               ///< Current view size
 
     FriendItemsHandler *m_friendItemsHandler;   ///< Handler for friend and group items
     GPSLocationItem *m_gpsLocationItem;         ///< Item pointing current location from GPS