QGIS API Documentation  3.4.15-Madeira (e83d02e274)
Signals | Public Member Functions | Properties | List of all members
QgsQuickPositionKit Class Reference

Convenient set of tools to read GPS position and accuracy. More...

#include <qgsquickpositionkit.h>

Inheritance diagram for QgsQuickPositionKit:
Inheritance graph
[legend]

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...
 

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...
 
QgsQuickMapSettingsmapSettings () 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...
 
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...
 

Detailed Description

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.

Note
QML Type: PositionKit
Since
QGIS 3.4

Definition at line 40 of file qgsquickpositionkit.h.

Constructor & Destructor Documentation

QgsQuickPositionKit::QgsQuickPositionKit ( QObject *  parent = nullptr)
explicit

Creates new position kit.

Definition at line 26 of file qgsquickpositionkit.cpp.

Member Function Documentation

double QgsQuickPositionKit::accuracy ( ) const

GPS horizontal accuracy in accuracyUnits, -1 if not available.

This is a readonly property.

double QgsQuickPositionKit::accuracyChanged ( ) const
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 296 of file qgsquickpositionkit.cpp.

Q_INVOKABLE QString QgsQuickPositionKit::accuracyUnitsChanged ( ) const
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.

double QgsQuickPositionKit::directionChanged ( ) const
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.

void QgsQuickPositionKit::hasPositionChanged ( )
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

void QgsQuickPositionKit::isSimulatedChanged ( )
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.

void QgsQuickPositionKit::mapSettingsChanged ( )
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.

void QgsQuickPositionKit::positionChanged ( )
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 271 of file qgsquickpositionkit.cpp.

QgsPoint QgsQuickPositionKit::projectedPosition ( ) const

GPS position in map coords.

This is a readonly property.

void QgsQuickPositionKit::projectedPositionChanged ( )
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.

double QgsQuickPositionKit::screenAccuracyChanged ( ) const
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.

void QgsQuickPositionKit::screenPositionChanged ( )
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 311 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 265 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

void QgsQuickPositionKit::simulatePositionLongLatRadChanged ( QVector< double >  simulatePositionLongLatRad)
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

void QgsQuickPositionKit::useGpsLocation ( )

Use real GPS source (not simulated)

Definition at line 95 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)

Parameters
longitudelongitude of the centre of the emulated points
latitudelatitude of the centre of the emulated points
radiusdistance of emulated points from the centre (in degrees WSG84)

Definition at line 62 of file qgsquickpositionkit.cpp.

Property Documentation

double QgsQuickPositionKit::accuracy
read

GPS horizontal accuracy in accuracyUnits, -1 if not available.

This is a readonly property.

Definition at line 77 of file qgsquickpositionkit.h.

double QgsQuickPositionKit::direction
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.

bool QgsQuickPositionKit::hasPosition
read

GPS position is available (position property is a valid number).

This is a readonly property.

Definition at line 70 of file qgsquickpositionkit.h.

bool QgsQuickPositionKit::isSimulated
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.

QgsQuickMapSettings * QgsQuickPositionKit::mapSettings
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.

QgsPoint QgsQuickPositionKit::position
read

GPS position in WGS84 coords.

This is a readonly property.

Definition at line 49 of file qgsquickpositionkit.h.

QgsPoint QgsQuickPositionKit::projectedPosition
read

GPS position in map coords.

This is a readonly property.

Definition at line 56 of file qgsquickpositionkit.h.

double QgsQuickPositionKit::screenAccuracy
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.

QPointF QgsQuickPositionKit::screenPosition
read

GPS position in device coords (pixels).

This is a readonly property.

Definition at line 63 of file qgsquickpositionkit.h.

QVector< double > QgsQuickPositionKit::simulatePositionLongLatRad
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.


The documentation for this class was generated from the following files: