2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Sami Rämö - sami.ramo@ixonos.com
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.
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.
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,
22 #ifndef GPSLOCATIONITEM_H
23 #define GPSLOCATIONITEM_H
25 #include <QGraphicsItem>
28 * @brief Class for indicating current position and accuracy accuired from GPS on the map.
30 * Actual position spot image is a child item of this class and this class handles drawing the
31 * accuracy ring. GPS fix accuracy is indicated by the radius of the circle around the position
34 class GPSLocationItem : public QGraphicsItem
42 /*******************************************************************************
43 * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
44 ******************************************************************************/
47 * @brief Implements the bounding rect
49 * @returns Bounding rect of the item
51 QRectF boundingRect() const;
54 * @brief Implements the painter
56 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
58 /*******************************************************************************
59 * MEMBER FUNCTIONS AND SLOTS
60 ******************************************************************************/
63 * @brief Enable / disable item
65 * Actual enabling is done when next position update is received, so the old value before
66 * hiding the item is not used.
68 * @param enable True if item should be enabled, otherwise false
70 void setEnabled(bool enable);
73 * @brief Update position item
75 * @param scenePosition Scene position
76 * @param accuracy Accuracy of the GPS fix
77 * @param sceneResolution Scene horizontal resolution at given coordinate latitude level
79 void updateItem(QPointF scenePosition, qreal accuracy, qreal sceneResolution);
83 * @brief Set new radius for the accuracy ring
85 * Calls setBoundingRect() if the radius changes
87 * @param accuracy Accuracy (in meters)
88 * @param sceneResolution Scene resolution (meters/pixel)
90 void setAccuracyRingRadius(qreal accuracy, qreal sceneResolution);
93 * @brief Sets new bounding rect for this item based on the accuracy ring radius
95 * @param radius Radius of the accuracy ring
97 void setBoundingRect(qreal radius);
99 /*******************************************************************************
101 ******************************************************************************/
103 bool m_showOnNextUpdate; ///< should the item be shown when next update arrives
105 qreal m_radius; ///< accuracy ring radius in scene pixels
107 QGraphicsPixmapItem *m_pixmapItem; ///< red led item
109 QRectF m_boundingRect; ///< item's bounding rect
112 #endif // GPSLOCATIONITEM_H