QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Convenient set of tools to read GPS position and accuracy. More...
#include <qgsquickpositionkit.h>
Signals | |
double | accuracyChanged () const |
GPS horizontal accuracy in accuracyUnits, -1 if not available. More... | |
Q_INVOKABLE QString | accuracyUnitsChanged () const |
GPS horizontal accuracy units - meters (constant) More... | |
double | directionChanged () const |
GPS direction, bearing in degrees clockwise from north to direction of travel. More... | |
void | hasPositionChanged () |
hasPosition changed More... | |
void | isSimulatedChanged () |
GPS position and accuracy is simulated (not real from GPS sensor). More... | |
void | mapSettingsChanged () |
Associated map settings. More... | |
void | positionChanged () |
GPS position in WGS84 coords. More... | |
void | projectedPositionChanged () |
GPS position in map coords. More... | |
double | screenAccuracyChanged () const |
Screen horizontal accuracy, 2 if not available or resolution is too small. More... | |
void | screenPositionChanged () |
GPS position in device coords (pixels). More... | |
void | simulatePositionLongLatRadChanged (QVector< double > simulatePositionLongLatRad) |
Uses of GPS and simulated position and sets its parameters. More... | |
void | sourceChanged () |
Emitted when the internal source of GPS location data has been replaced. More... | |
Public Member Functions | |
QgsQuickPositionKit (QObject *parent=nullptr) | |
Creates new position kit. More... | |
double | accuracy () const |
GPS horizontal accuracy in accuracyUnits, -1 if not available. More... | |
QgsUnitTypes::DistanceUnit | accuracyUnits () const |
GPS horizontal accuracy units - meters (constant) More... | |
double | direction () const |
GPS direction, bearing in degrees clockwise from north to direction of travel. More... | |
bool | hasPosition () const |
GPS position in WGS84 coords. More... | |
bool | isSimulated () const |
GPS position and accuracy is simulated (not real from GPS sensor). More... | |
QgsQuickMapSettings * | mapSettings () const |
Associated map settings. More... | |
QgsPoint | position () const |
GPS position in WGS84 coords. More... | |
Q_INVOKABLE QgsCoordinateReferenceSystem | positionCRS () const |
Coordinate reference system of position - WGS84 (constant) More... | |
QgsPoint | projectedPosition () const |
GPS position in map coords. More... | |
double | screenAccuracy () const |
Screen horizontal accuracy, 2 if not available or resolution is too small. More... | |
QPointF | screenPosition () const |
GPS position in device coords (pixels). More... | |
void | setMapSettings (QgsQuickMapSettings *mapSettings) |
Associated map settings. More... | |
void | setSimulatePositionLongLatRad (const QVector< double > &simulatePositionLongLatRad) |
Uses of GPS and simulated position and sets its parameters. More... | |
QVector< double > | simulatePositionLongLatRad () const |
Uses of GPS and simulated position and sets its parameters. More... | |
QGeoPositionInfoSource * | source () const |
Returns pointer to the internal QGeoPositionInfoSource object used to receive GPS location. More... | |
Q_INVOKABLE void | useGpsLocation () |
Use real GPS source (not simulated) More... | |
Q_INVOKABLE void | useSimulatedLocation (double longitude, double latitude, double radius) |
Use simulated GPS source. More... | |
Properties | |
double | accuracy |
GPS horizontal accuracy in accuracyUnits, -1 if not available. More... | |
double | direction |
GPS direction, bearing in degrees clockwise from north to direction of travel. More... | |
bool | hasPosition |
GPS position is available (position property is a valid number). More... | |
bool | isSimulated |
GPS position and accuracy is simulated (not real from GPS sensor). More... | |
QgsQuickMapSettings * | mapSettings |
Associated map settings. More... | |
QgsPoint | position |
GPS position in WGS84 coords. More... | |
QgsPoint | projectedPosition |
GPS position in map coords. More... | |
double | screenAccuracy |
Screen horizontal accuracy, 2 if not available or resolution is too small. More... | |
QPointF | screenPosition |
GPS position in device coords (pixels). More... | |
QVector< double > | simulatePositionLongLatRad |
Uses of GPS and simulated position and sets its parameters. More... | |
QGeoPositionInfoSource * | source |
Internal source of GPS location data. More... | |
Convenient set of tools to read GPS position and accuracy.
Also, if one can use use_simulated_location to specify simulated position. Simulated position source generates random points in circles around the selected point and radius. Real GPS position is not used in this mode.
Definition at line 40 of file qgsquickpositionkit.h.
|
explicit |
Creates new position kit.
Definition at line 26 of file qgsquickpositionkit.cpp.
double QgsQuickPositionKit::accuracy | ( | ) | const |
GPS horizontal accuracy in accuracyUnits, -1 if not available.
This is a readonly property.
Definition at line 305 of file qgsquickpositionkit.cpp.
|
signal |
GPS horizontal accuracy in accuracyUnits, -1 if not available.
This is a readonly property.
QgsUnitTypes::DistanceUnit QgsQuickPositionKit::accuracyUnits | ( | ) | const |
GPS horizontal accuracy units - meters (constant)
Definition at line 310 of file qgsquickpositionkit.cpp.
|
signal |
GPS horizontal accuracy units - meters (constant)
double QgsQuickPositionKit::direction | ( | ) | const |
GPS direction, bearing in degrees clockwise from north to direction of travel.
-1 if not available
This is a readonly property.
Definition at line 315 of file qgsquickpositionkit.cpp.
|
signal |
GPS direction, bearing in degrees clockwise from north to direction of travel.
-1 if not available
This is a readonly property.
bool QgsQuickPositionKit::hasPosition | ( | ) | const |
GPS position in WGS84 coords.
This is a readonly property.
Definition at line 295 of file qgsquickpositionkit.cpp.
|
signal |
hasPosition changed
bool QgsQuickPositionKit::isSimulated | ( | ) | const |
GPS position and accuracy is simulated (not real from GPS sensor).
Default false
(use real GPS)
This is a readonly property. To change to simulated position, see QgsQuickPositionKit::simulatePositionLongLatRad
Definition at line 320 of file qgsquickpositionkit.cpp.
|
signal |
GPS position and accuracy is simulated (not real from GPS sensor).
Default false
(use real GPS)
This is a readonly property. To change to simulated position, see QgsQuickPositionKit::simulatePositionLongLatRad
QgsQuickMapSettings * QgsQuickPositionKit::mapSettings | ( | ) | const |
Associated map settings.
Should be initialized before the first use from mapcanvas map settings.
This is a readonly property.
Definition at line 131 of file qgsquickpositionkit.cpp.
|
signal |
Associated map settings.
Should be initialized before the first use from mapcanvas map settings.
This is a readonly property.
QgsPoint QgsQuickPositionKit::position | ( | ) | const |
GPS position in WGS84 coords.
This is a readonly property.
Definition at line 300 of file qgsquickpositionkit.cpp.
|
signal |
GPS position in WGS84 coords.
This is a readonly property.
QgsCoordinateReferenceSystem QgsQuickPositionKit::positionCRS | ( | ) | const |
Coordinate reference system of position - WGS84 (constant)
Definition at line 285 of file qgsquickpositionkit.cpp.
QgsPoint QgsQuickPositionKit::projectedPosition | ( | ) | const |
GPS position in map coords.
This is a readonly property.
Definition at line 290 of file qgsquickpositionkit.cpp.
|
signal |
GPS position in map coords.
This is a readonly property.
double QgsQuickPositionKit::screenAccuracy | ( | ) | const |
Screen horizontal accuracy, 2 if not available or resolution is too small.
This is a readonly property.
Definition at line 269 of file qgsquickpositionkit.cpp.
|
signal |
Screen horizontal accuracy, 2 if not available or resolution is too small.
This is a readonly property.
QPointF QgsQuickPositionKit::screenPosition | ( | ) | const |
GPS position in device coords (pixels).
This is a readonly property.
Definition at line 264 of file qgsquickpositionkit.cpp.
|
signal |
GPS position in device coords (pixels).
This is a readonly property.
void QgsQuickPositionKit::setMapSettings | ( | QgsQuickMapSettings * | mapSettings | ) |
Associated map settings.
Should be initialized before the first use from mapcanvas map settings.
This is a readonly property.
Definition at line 325 of file qgsquickpositionkit.cpp.
void QgsQuickPositionKit::setSimulatePositionLongLatRad | ( | const QVector< double > & | simulatePositionLongLatRad | ) |
Uses of GPS and simulated position and sets its parameters.
Vector containing longitude, latitude and radius (meters) of simulated position e.g. [-97.36, 36.93, 2] If empty vector is assigned, GPS source will be used.
From QML context, also functions useSimulatedLocation() or useGpsLocation() could be used instead
Definition at line 279 of file qgsquickpositionkit.cpp.
QVector< double > QgsQuickPositionKit::simulatePositionLongLatRad | ( | ) | const |
Uses of GPS and simulated position and sets its parameters.
Vector containing longitude, latitude and radius (meters) of simulated position e.g. [-97.36, 36.93, 2] If empty vector is assigned, GPS source will be used.
From QML context, also functions useSimulatedLocation() or useGpsLocation() could be used instead
Definition at line 274 of file qgsquickpositionkit.cpp.
|
signal |
Uses of GPS and simulated position and sets its parameters.
Vector containing longitude, latitude and radius (meters) of simulated position e.g. [-97.36, 36.93, 2] If empty vector is assigned, GPS source will be used.
From QML context, also functions useSimulatedLocation() or useGpsLocation() could be used instead
QGeoPositionInfoSource * QgsQuickPositionKit::source | ( | ) | const |
Returns pointer to the internal QGeoPositionInfoSource object used to receive GPS location.
Definition at line 62 of file qgsquickpositionkit.cpp.
|
signal |
Emitted when the internal source of GPS location data has been replaced.
void QgsQuickPositionKit::useGpsLocation | ( | ) |
Use real GPS source (not simulated)
Definition at line 100 of file qgsquickpositionkit.cpp.
void QgsQuickPositionKit::useSimulatedLocation | ( | double | longitude, |
double | latitude, | ||
double | radius | ||
) |
Use simulated GPS source.
Simulated GPS source emulates point on circle around defined point in specified radius
We do not want to have the origin point as property We basically want to set it once based on project/map cente and keep it that way regardless of mapsettings change (e.g. zoom etc)
longitude | longitude of the centre of the emulated points |
latitude | latitude of the centre of the emulated points |
radius | distance of emulated points from the centre (in degrees WSG84) |
Definition at line 67 of file qgsquickpositionkit.cpp.
|
read |
GPS horizontal accuracy in accuracyUnits, -1 if not available.
This is a readonly property.
Definition at line 1 of file qgsquickpositionkit.h.
|
read |
GPS direction, bearing in degrees clockwise from north to direction of travel.
-1 if not available
This is a readonly property.
Definition at line 1 of file qgsquickpositionkit.h.
|
read |
GPS position is available (position property is a valid number).
This is a readonly property.
Definition at line 1 of file qgsquickpositionkit.h.
|
read |
GPS position and accuracy is simulated (not real from GPS sensor).
Default false
(use real GPS)
This is a readonly property. To change to simulated position, see QgsQuickPositionKit::simulatePositionLongLatRad
Definition at line 1 of file qgsquickpositionkit.h.
|
readwrite |
Associated map settings.
Should be initialized before the first use from mapcanvas map settings.
This is a readonly property.
Definition at line 1 of file qgsquickpositionkit.h.
|
read |
GPS position in WGS84 coords.
This is a readonly property.
Definition at line 1 of file qgsquickpositionkit.h.
|
read |
GPS position in map coords.
This is a readonly property.
Definition at line 1 of file qgsquickpositionkit.h.
|
read |
Screen horizontal accuracy, 2 if not available or resolution is too small.
This is a readonly property.
Definition at line 1 of file qgsquickpositionkit.h.
|
read |
GPS position in device coords (pixels).
This is a readonly property.
Definition at line 1 of file qgsquickpositionkit.h.
|
readwrite |
Uses of GPS and simulated position and sets its parameters.
Vector containing longitude, latitude and radius (meters) of simulated position e.g. [-97.36, 36.93, 2] If empty vector is assigned, GPS source will be used.
From QML context, also functions useSimulatedLocation() or useGpsLocation() could be used instead
Definition at line 1 of file qgsquickpositionkit.h.
|
read |
Internal source of GPS location data.
Allows start/stop of its services or access properties.
Definition at line 1 of file qgsquickpositionkit.h.