{
qDebug() << __PRETTY_FUNCTION__;
- qWarning() << __PRETTY_FUNCTION__ << "h: " << positionInfo.attribute(QGeoPositionInfo::HorizontalAccuracy)
- << "v: " << positionInfo.attribute(QGeoPositionInfo::VerticalAccuracy);
+ if (!positionInfo.dateTime().isValid())
+ return GPS_ACCURACY_UNDEFINED;
if (positionInfo.hasAttribute(QGeoPositionInfo::HorizontalAccuracy))
return positionInfo.attribute(QGeoPositionInfo::HorizontalAccuracy);
* @brief Return horizontal accuracy
*
* @param positionInfo geo position info
- * @return accuracy value, -1 if undefined
+ * @return accuracy value, -1 if undefined. Returns -1 also is timestamp is not valid
+ * (when using network positioning)
*/
qreal accuracy(QGeoPositionInfo positionInfo);
USA.
*/
-const int ACCURATE_LIMIT = 50; // this and lower values (in meters) are considered as accurate
-
#include <QDebug>
#include <QGraphicsPixmapItem>
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;
+ }
}
}
/**
* @brief Update position item
*
+ * Use yellow led image when using network positioning and green led image when using GPS.
+ *
* @param scenePosition Scene coordinate
* @param accuracy Accuracy of the GPS fix
*/