16 #ifndef QGSQUICKPOSITIONKIT_H
17 #define QGSQUICKPOSITIONKIT_H
20 #include <QtPositioning>
24 #include "qgis_quick.h"
49 Q_PROPERTY(
QgsPoint position READ position NOTIFY positionChanged )
56 Q_PROPERTY(
QgsPoint projectedPosition READ projectedPosition NOTIFY projectedPositionChanged )
63 Q_PROPERTY( QPointF screenPosition READ screenPosition NOTIFY screenPositionChanged )
70 Q_PROPERTY(
bool hasPosition READ hasPosition NOTIFY hasPositionChanged )
77 Q_PROPERTY(
double accuracy READ accuracy NOTIFY accuracyChanged )
84 Q_PROPERTY(
double screenAccuracy READ screenAccuracy NOTIFY screenAccuracyChanged )
91 Q_PROPERTY(
double direction READ direction NOTIFY directionChanged )
98 Q_PROPERTY(
bool isSimulated READ isSimulated NOTIFY isSimulatedChanged )
105 Q_PROPERTY(
QgsQuickMapSettings *mapSettings READ mapSettings WRITE setMapSettings NOTIFY mapSettingsChanged )
115 Q_PROPERTY( QVector<double> simulatePositionLongLatRad READ simulatePositionLongLatRad WRITE setSimulatePositionLongLatRad NOTIFY simulatePositionLongLatRadChanged )
121 Q_PROPERTY( QGeoPositionInfoSource *source READ source NOTIFY sourceChanged )
128 bool hasPosition()
const;
137 QPointF screenPosition()
const;
140 double accuracy()
const;
143 double screenAccuracy()
const;
151 double direction()
const;
154 bool isSimulated()
const;
163 QVector<double> simulatePositionLongLatRad()
const;
166 void setSimulatePositionLongLatRad(
const QVector<double> &simulatePositionLongLatRad );
172 QGeoPositionInfoSource *source()
const;
192 Q_INVOKABLE
void useSimulatedLocation(
double longitude,
double latitude,
double radius );
197 Q_INVOKABLE
void useGpsLocation();
237 void onPositionUpdated(
const QGeoPositionInfo &info );
238 void onMapSettingsUpdated();
239 void onUpdateTimeout();
240 void onSimulatePositionLongLatRadChanged( QVector<double> simulatePositionLongLatRad );
243 void replacePositionSource( QGeoPositionInfoSource *source );
244 QString calculateStatusLabel();
245 double calculateScreenAccuracy();
246 void updateProjectedPosition();
247 void updateScreenPosition();
248 void updateScreenAccuracy();
250 QGeoPositionInfoSource *gpsSource();
251 QGeoPositionInfoSource *simulatedSource(
double longitude,
double latitude,
double radius );
255 QPointF mScreenPosition;
256 double mAccuracy = -1;
257 double mScreenAccuracy = 2;
258 double mDirection = -1;
259 bool mHasPosition =
false;
260 bool mIsSimulated =
false;
261 QVector<double> mSimulatePositionLongLatRad;
262 std::unique_ptr<QGeoPositionInfoSource> mSource;
267 #endif // QGSQUICKPOSITIONKIT_H