void QDeclarativePosition::invalidate() { // Invalidate all data if (m_latitudeValid) { m_latitudeValid = false; emit latitudeValidChanged(); } if (m_longitudeValid) { m_longitudeValid = false; emit longitudeValidChanged(); } if (m_altitudeValid) { m_altitudeValid = false; emit altitudeValidChanged(); } if (m_speedValid) { m_speedValid = false; emit speedValidChanged(); } if (m_horizontalAccuracyValid) { m_horizontalAccuracyValid = false; emit horizontalAccuracyValidChanged(); } if (m_verticalAccuracyValid) { m_verticalAccuracyValid = false; emit verticalAccuracyValidChanged(); } }
void QDeclarativePosition::setVerticalAccuracy(qreal verticalAccuracy) { if (verticalAccuracy == m_verticalAccuracy) return; m_verticalAccuracy = verticalAccuracy; if (!m_verticalAccuracyValid) { m_verticalAccuracyValid = true; emit verticalAccuracyValidChanged(); } emit verticalAccuracyChanged(); }
/*! \qmlproperty real Position::verticalAccuracy This property holds the vertical accuracy of the coordinate (in meters). \sa verticalAccuracyValid, coordinate */ void QDeclarativePosition::setVerticalAccuracy(qreal verticalAccuracy) { const qreal pVerticalAccuracy = m_info.attribute(QGeoPositionInfo::VerticalAccuracy); if (equalOrNaN(pVerticalAccuracy, verticalAccuracy)) return; bool validChanged = exclusiveNaN(pVerticalAccuracy, verticalAccuracy); m_info.setAttribute(QGeoPositionInfo::VerticalAccuracy, verticalAccuracy); emit verticalAccuracyChanged(); if (validChanged) emit verticalAccuracyValidChanged(); }
void QDeclarativePosition::setPosition(const QGeoPositionInfo &info) { // timestamp const QDateTime pTimestamp = m_info.timestamp(); const QDateTime timestamp = info.timestamp(); bool emitTimestampChanged = pTimestamp != timestamp; // coordinate const QGeoCoordinate pCoordinate = m_info.coordinate(); const QGeoCoordinate coordinate = info.coordinate(); bool emitCoordinateChanged = pCoordinate != coordinate; bool emitLatitudeValidChanged = exclusiveNaN(pCoordinate.latitude(), coordinate.latitude()); bool emitLongitudeValidChanged = exclusiveNaN(pCoordinate.longitude(), coordinate.longitude()); bool emitAltitudeValidChanged = exclusiveNaN(pCoordinate.altitude(), coordinate.altitude()); // direction const qreal pDirection = m_info.attribute(QGeoPositionInfo::Direction); const qreal direction = info.attribute(QGeoPositionInfo::Direction); bool emitDirectionChanged = !equalOrNaN(pDirection, direction); bool emitDirectionValidChanged = exclusiveNaN(pDirection, direction); // ground speed const qreal pSpeed = m_info.attribute(QGeoPositionInfo::GroundSpeed); const qreal speed = info.attribute(QGeoPositionInfo::GroundSpeed); bool emitSpeedChanged = !equalOrNaN(pSpeed, speed); bool emitSpeedValidChanged = exclusiveNaN(pSpeed, speed); // vertical speed const qreal pVerticalSpeed = m_info.attribute(QGeoPositionInfo::VerticalSpeed); const qreal verticalSpeed = info.attribute(QGeoPositionInfo::VerticalSpeed); bool emitVerticalSpeedChanged = !equalOrNaN(pVerticalSpeed, verticalSpeed); bool emitVerticalSpeedValidChanged = exclusiveNaN(pVerticalSpeed, verticalSpeed); // magnetic variation const qreal pMagneticVariation = m_info.attribute(QGeoPositionInfo::MagneticVariation); const qreal magneticVariation = info.attribute(QGeoPositionInfo::MagneticVariation); bool emitMagneticVariationChanged = !equalOrNaN(pMagneticVariation, magneticVariation); bool emitMagneticVariationValidChanged = exclusiveNaN(pMagneticVariation, magneticVariation); // horizontal accuracy const qreal pHorizontalAccuracy = m_info.attribute(QGeoPositionInfo::HorizontalAccuracy); const qreal horizontalAccuracy = info.attribute(QGeoPositionInfo::HorizontalAccuracy); bool emitHorizontalAccuracyChanged = !equalOrNaN(pHorizontalAccuracy, horizontalAccuracy); bool emitHorizontalAccuracyValidChanged = exclusiveNaN(pHorizontalAccuracy, horizontalAccuracy); // vertical accuracy const qreal pVerticalAccuracy = m_info.attribute(QGeoPositionInfo::VerticalAccuracy); const qreal verticalAccuracy = info.attribute(QGeoPositionInfo::VerticalAccuracy); bool emitVerticalAccuracyChanged = !equalOrNaN(pVerticalAccuracy, verticalAccuracy); bool emitVerticalAccuracyValidChanged = exclusiveNaN(pVerticalAccuracy, verticalAccuracy); m_info = info; if (emitTimestampChanged) emit timestampChanged(); if (emitCoordinateChanged) emit coordinateChanged(); if (emitLatitudeValidChanged) emit latitudeValidChanged(); if (emitLongitudeValidChanged) emit longitudeValidChanged(); if (emitAltitudeValidChanged) emit altitudeValidChanged(); if (emitDirectionChanged) emit directionChanged(); if (emitDirectionValidChanged) emit directionValidChanged(); if (emitSpeedChanged) emit speedChanged(); if (emitSpeedValidChanged) emit speedValidChanged(); if (emitVerticalSpeedChanged) emit verticalSpeedChanged(); if (emitVerticalSpeedValidChanged) emit verticalSpeedValidChanged(); if (emitHorizontalAccuracyChanged) emit horizontalAccuracyChanged(); if (emitHorizontalAccuracyValidChanged) emit horizontalAccuracyValidChanged(); if (emitVerticalAccuracyChanged) emit verticalAccuracyChanged(); if (emitVerticalAccuracyValidChanged) emit verticalAccuracyValidChanged(); if (emitMagneticVariationChanged) emit magneticVariationChanged(); if (emitMagneticVariationValidChanged) emit magneticVariationValidChanged(); }