USA.
*/
-const int ACCURATE_LIMIT = 250; // this and lower values (in meters) are considered as accurate
-
#include <QDebug>
#include <QGraphicsPixmapItem>
setFlag(QGraphicsItem::ItemIgnoresTransformations);
}
+void GPSLocationItem::setEnabled(bool enable)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ if (enable) {
+ show();
+ }
+ else {
+ m_currentAccuracy = NOT_SET;
+ hide();
+ setPixmap(QPixmap());
+ }
+
+}
+
void GPSLocationItem::updatePosition(QPoint scenePosition, qreal accuracy)
{
qDebug() << __PRETTY_FUNCTION__;
setPos(scenePosition);
- if (accuracy != GPS_ACCURACY_UNDEFINED // accuracy must be defined
- && accuracy <= ACCURATE_LIMIT // and smaller than limit
- && m_currentAccuracy != ACCURATE) { // and accurate pixmap not yet set
+ if (accuracy == GPS_ACCURACY_UNDEFINED) { // fix is NOT accurate
+ if (m_currentAccuracy != COARSE) { // coarse pixmap not yet set
+ setPixmap(m_coarsePixmap);
+ m_currentAccuracy = COARSE;
+ }
+ }
+ else { // fix is accurate
+ if (m_currentAccuracy != ACCURATE) { // accurate pixmap not yet set
setPixmap(m_accuratePixmap);
m_currentAccuracy = ACCURATE;
- }
- else if (m_currentAccuracy != COARSE) { // coarse pixmap not yet set
- setPixmap(m_coarsePixmap);
- m_currentAccuracy = COARSE;
+ }
}
}