QGIS API Documentation
3.6.0-Noosa (5873452)
|
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.
|
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 302 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.
|
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.
|
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
|
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.
|
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.
|
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 277 of file qgsquickpositionkit.cpp.
QgsPoint QgsQuickPositionKit::projectedPosition | ( | ) | const |
GPS position in map coords.
This is a readonly property.
|
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.
|
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.
|
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 317 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 271 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
|
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.
|
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 77 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 91 of file qgsquickpositionkit.h.
|
read |
GPS position is available (position property is a valid number).
This is a readonly property.
Definition at line 70 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 98 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 105 of file qgsquickpositionkit.h.
|
read |
GPS position in WGS84 coords.
This is a readonly property.
Definition at line 49 of file qgsquickpositionkit.h.
|
read |
GPS position in map coords.
This is a readonly property.
Definition at line 56 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 84 of file qgsquickpositionkit.h.
|
read |
GPS position in device coords (pixels).
This is a readonly property.
Definition at line 63 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 115 of file qgsquickpositionkit.h.
|
read |
Internal source of GPS location data.
Allows start/stop of its services or access properties.
Definition at line 121 of file qgsquickpositionkit.h.