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,
23 #include <QGraphicsPixmapItem>
25 #include "../gps/gpscommon.h"
26 #include "mapcommon.h"
28 #include "gpslocationitem.h"
30 GPSLocationItem::GPSLocationItem()
31 : m_currentAccuracy(NOT_SET)
33 qDebug() << __PRETTY_FUNCTION__;
34 m_accuratePixmap = QPixmap(":/res/images/gps_pos_accurate.png");
35 m_coarsePixmap = QPixmap(":/res/images/gps_pos_coarse.png");
37 setPos(QPoint(UNDEFINED, UNDEFINED));
38 setZValue(OWN_LOCATION_ICON_Z_LEVEL);
39 setOffset(-m_accuratePixmap.width() / 2, -m_accuratePixmap.height() / 2);
40 setFlag(QGraphicsItem::ItemIgnoresTransformations);
43 void GPSLocationItem::setEnabled(bool enable)
45 qDebug() << __PRETTY_FUNCTION__;
51 m_currentAccuracy = NOT_SET;
58 void GPSLocationItem::updatePosition(QPoint scenePosition, qreal accuracy)
60 qDebug() << __PRETTY_FUNCTION__;
62 setPos(scenePosition);
64 if (accuracy == GPS_ACCURACY_UNDEFINED) { // fix is NOT accurate
65 if (m_currentAccuracy != COARSE) { // coarse pixmap not yet set
66 setPixmap(m_coarsePixmap);
67 m_currentAccuracy = COARSE;
70 else { // fix is accurate
71 if (m_currentAccuracy != ACCURATE) { // accurate pixmap not yet set
72 setPixmap(m_accuratePixmap);
73 m_currentAccuracy = ACCURATE;