72void QDeclarativePosition::setPosition(
const QGeoPositionInfo &info)
75 const QDateTime pTimestamp = m_info.timestamp();
76 const QDateTime timestamp = info.timestamp();
77 const bool timestampChanged = pTimestamp != timestamp;
80 const QGeoCoordinate pCoordinate = m_info.coordinate();
81 const QGeoCoordinate coordinate = info.coordinate();
82 const bool coordinateChanged = pCoordinate != coordinate;
83 const bool latitudeValidChanged = exclusiveNaN(pCoordinate.latitude(), coordinate.latitude());
84 const bool longitudeValidChanged =
85 exclusiveNaN(pCoordinate.longitude(), coordinate.longitude());
86 const bool altitudeValidChanged = exclusiveNaN(pCoordinate.altitude(), coordinate.altitude());
89 const qreal pDirection = m_info.attribute(QGeoPositionInfo::Direction);
90 const qreal direction = info.attribute(QGeoPositionInfo::Direction);
91 const bool directionChanged = !equalOrNaN(pDirection, direction);
92 const bool directionValidChanged = exclusiveNaN(pDirection, direction);
95 const qreal pSpeed = m_info.attribute(QGeoPositionInfo::GroundSpeed);
96 const qreal speed = info.attribute(QGeoPositionInfo::GroundSpeed);
97 const bool speedChanged = !equalOrNaN(pSpeed, speed);
98 const bool speedValidChanged = exclusiveNaN(pSpeed, speed);
101 const qreal pVerticalSpeed = m_info.attribute(QGeoPositionInfo::VerticalSpeed);
102 const qreal verticalSpeed = info.attribute(QGeoPositionInfo::VerticalSpeed);
103 const bool verticalSpeedChanged = !equalOrNaN(pVerticalSpeed, verticalSpeed);
104 const bool verticalSpeedValidChanged = exclusiveNaN(pVerticalSpeed, verticalSpeed);
107 const qreal pMagneticVariation = m_info.attribute(QGeoPositionInfo::MagneticVariation);
108 const qreal magneticVariation = info.attribute(QGeoPositionInfo::MagneticVariation);
109 const bool magneticVariationChanged = !equalOrNaN(pMagneticVariation, magneticVariation);
110 const bool magneticVariationValidChanged = exclusiveNaN(pMagneticVariation, magneticVariation);
113 const qreal pHorizontalAccuracy = m_info.attribute(QGeoPositionInfo::HorizontalAccuracy);
114 const qreal horizontalAccuracy = info.attribute(QGeoPositionInfo::HorizontalAccuracy);
115 const bool horizontalAccuracyChanged = !equalOrNaN(pHorizontalAccuracy, horizontalAccuracy);
116 const bool horizontalAccuracyValidChanged =
117 exclusiveNaN(pHorizontalAccuracy, horizontalAccuracy);
120 const qreal pVerticalAccuracy = m_info.attribute(QGeoPositionInfo::VerticalAccuracy);
121 const qreal verticalAccuracy = info.attribute(QGeoPositionInfo::VerticalAccuracy);
122 const bool verticalAccuracyChanged = !equalOrNaN(pVerticalAccuracy, verticalAccuracy);
123 const bool verticalAccuracyValidChanged = exclusiveNaN(pVerticalAccuracy, verticalAccuracy);
126 const qreal pDirectionAccuracy = m_info.attribute(QGeoPositionInfo::DirectionAccuracy);
127 const qreal directionAccuracy = info.attribute(QGeoPositionInfo::DirectionAccuracy);
128 const bool directionAccuracyChanged = !equalOrNaN(pDirectionAccuracy, directionAccuracy);
129 const bool directionAccuracyValidChanged = exclusiveNaN(pDirectionAccuracy, directionAccuracy);
133 if (timestampChanged)
134 m_computedTimestamp.notify();
136 if (coordinateChanged)
137 m_computedCoordinate.notify();
138 if (latitudeValidChanged)
139 m_computedLatitudeValid.notify();
140 if (longitudeValidChanged)
141 m_computedLongitudeValid.notify();
142 if (altitudeValidChanged)
143 m_computedAltitudeValid.notify();
145 if (directionChanged)
146 m_computedDirection.notify();
147 if (directionValidChanged)
148 m_computedDirectionValid.notify();
151 m_computedSpeed.notify();
152 if (speedValidChanged)
153 m_computedSpeedValid.notify();
155 if (verticalSpeedChanged)
156 m_computedVerticalSpeed.notify();
157 if (verticalSpeedValidChanged)
158 m_computedVerticalSpeedValid.notify();
160 if (horizontalAccuracyChanged)
161 m_computedHorizontalAccuracy.notify();
162 if (horizontalAccuracyValidChanged)
163 m_computedHorizontalAccuracyValid.notify();
165 if (verticalAccuracyChanged)
166 m_computedVerticalAccuracy.notify();
167 if (verticalAccuracyValidChanged)
168 m_computedVerticalAccuracyValid.notify();
170 if (magneticVariationChanged)
171 m_computedMagneticVariation.notify();
172 if (magneticVariationValidChanged)
173 m_computedMagneticVariationValid.notify();
175 if (directionAccuracyChanged)
176 m_computedDirectionAccuracy.notify();
177 if (directionAccuracyValidChanged)
178 m_computedDirectionAccuracyValid.notify();