Merge branch 'master' into settings_auto_update
[situare] / src / map / gpslocationitem.h
1 /*
2     Situare - A location system for Facebook
3     Copyright (C) 2010  Ixonos Plc. Authors:
4
5         Sami Rämö - sami.ramo@ixonos.com
6
7     Situare is free software; you can redistribute it and/or
8     modify it under the terms of the GNU General Public License
9     version 2 as published by the Free Software Foundation.
10
11     Situare is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with Situare; if not, write to the Free Software
18     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
19     USA.
20 */
21
22
23 #ifndef GPSLOCATIONITEM_H
24 #define GPSLOCATIONITEM_H
25
26 #include <QGraphicsPixmapItem>
27
28 /**
29   * @brief Class for indicating current position accuired from GPS on the map.
30   *
31   * Also GPS fix accuracy is indicated by using two different color indicator images
32   * based on current accuracy
33   */
34 class GPSLocationItem : public QGraphicsPixmapItem
35 {
36 public:
37     /**
38       * @brief Constructor
39       */
40     GPSLocationItem();
41
42 /*******************************************************************************
43  * MEMBER FUNCTIONS AND SLOTS
44  ******************************************************************************/
45 public:
46     /**
47       * @brief Enable / disable item
48       *
49       * @param enable True if item should be enabled, otherwise false
50       */
51     void setEnabled(bool enable);
52
53     /**
54       * @brief Update position item
55       *
56       * Use yellow led image when using network positioning and green led image when using GPS.
57       *
58       * @param scenePosition Scene coordinate
59       * @param accuracy Accuracy of the GPS fix
60       */
61     void updatePosition(QPoint scenePosition, qreal accuracy);
62
63 /*******************************************************************************
64  * DATA MEMBERS
65  ******************************************************************************/
66 private:
67     /**
68       * @brief Enum for current pixmap state
69       */
70     enum Accuracy { NOT_SET, ACCURATE, COARSE };
71
72     QPixmap m_accuratePixmap; ///< pixmap used when GPS fix is accurate
73     QPixmap m_coarsePixmap; ///< pixmap used when GPS fix is coarse
74     Accuracy m_currentAccuracy; ///< current accuracy
75 };
76
77 #endif // GPSLOCATIONITEM_H