Merge branch 'crosshair2'
[situare] / src / map / mapengine.h
index 98516a7..5067057 100644 (file)
@@ -34,6 +34,7 @@
 #include "user/user.h"
 
 class FriendItemsHandler;
+class GPSLocationItem;
 
 /**
 * @brief Map engine
@@ -105,13 +106,6 @@ public:
     QGraphicsScene* scene();
 
     /**
-    * @brief Set auto centering.
-    *
-    * @param enabled true if enabled, false otherwise
-    */
-    void setAutoCentering(bool enabled);
-
-    /**
     * @brief Return tile path created from tile values.
     *
     * @param zoomLevel tile's zoom level
@@ -131,13 +125,6 @@ public:
 
 public slots:
     /**
-    * @brief Slot for immovable scene items position correction
-    *
-    * @param viewTopLeft Scene coordinate of the viewport top left corner
-    */
-    void alignImmovableItems(QPoint viewTopLeft);
-
-    /**
     * @brief Slot for setting current view location
     *
     * Emits locationChanged signal.
@@ -241,6 +228,26 @@ private:
 
 private slots:
     /**
+      * @brief Slot for enabling / disabling GPS
+      *
+      * GPS location item is disabled or enabled based on GPS state
+      *
+      * @param enabled True is GPS is enabled, otherwise false
+      */
+    void gpsEnabled(bool enabled);
+
+    /**
+      * @brief Slot for GPS position updates
+      *
+      * GPS location item is updated and map centered to new location (if automatic
+      * centering is enabled).
+      *
+      * @param position New coordinates from GPS
+      * @param accuracy Accuracy of the GPS fix
+      */
+    void gpsPositionUpdate(QPointF position, qreal accuracy);
+
+    /**
     * @brief Slot for received map tile images
     *
     * Does add MapTile objects to MapScene.
@@ -252,6 +259,13 @@ private slots:
     void mapImageReceived(int zoomLevel, int x, int y, const QPixmap &image);
 
     /**
+    * @brief Set auto centering.
+    *
+    * @param enabled true if enabled, false otherwise
+    */
+    void setAutoCentering(bool enabled);
+
+    /**
     * @brief Slot for actions after view zoom is finished
     *
     * Does run removeOutOfViewTiles
@@ -300,7 +314,17 @@ signals:
     /**
     * @brief Signal to notify map scrolling.
     */
-    void mapScrolled();
+    void mapScrolledManually();
+
+    /**
+    * @brief Signal to notify when map is zoomed in to the maxmimum.
+    */
+    void maxZoomLevelReached();
+
+    /**
+    * @brief Signal to notify when map is zoomed out to the minimum.
+    */
+    void minZoomLevelReached();
 
     /**
     * @brief Signal request mapView to update view port contents
@@ -325,9 +349,10 @@ signals:
  * DATA MEMBERS
  ******************************************************************************/
 private:
-    bool m_autoCenteringEnabled;    ///< Auto centering enabled
+    bool m_autoCenteringEnabled; ///< Auto centering enabled
     QPoint m_centerTile; ///< Current center tile
     FriendItemsHandler *m_friendItemsHandler; ///< Handler for friend and group items
+    GPSLocationItem *m_gpsLocationItem; ///< Item pointing current location from GPS
     QPoint m_lastManualPosition;  ///< Last manually set position in scene coordinate
     MapFetcher *m_mapFetcher; ///< Fetcher for map tiles
     MapScene *m_mapScene; ///< Scene for map tiles