QGIS API Documentation  3.6.0-Noosa (5873452)
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...
 
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...
 
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...
 
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...
 

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::QgsQuickPositionKit ( QObject *  parent = nullptr)
explicit

Creates new position kit.

Definition at line 26 of file qgsquickpositionkit.cpp.

Member Function Documentation

◆ accuracy()

double QgsQuickPositionKit::accuracy ( ) const

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

This is a readonly property.

◆ accuracyChanged

double QgsQuickPositionKit::accuracyChanged ( ) const
signal

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

This is a readonly property.

◆ accuracyUnits()

QgsUnitTypes::DistanceUnit QgsQuickPositionKit::accuracyUnits ( ) const

GPS horizontal accuracy units - meters (constant)

Definition at line 302 of file qgsquickpositionkit.cpp.

◆ accuracyUnitsChanged

Q_INVOKABLE QString QgsQuickPositionKit::accuracyUnitsChanged ( ) const
signal

GPS horizontal accuracy units - meters (constant)

◆ direction()

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.

◆ directionChanged

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.

◆ hasPosition()

bool QgsQuickPositionKit::hasPosition ( ) const

GPS position in WGS84 coords.

This is a readonly property.

◆ hasPositionChanged

void QgsQuickPositionKit::hasPositionChanged ( )
signal

hasPosition changed

◆ isSimulated()

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

◆ isSimulatedChanged

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

◆ mapSettings()

QgsQuickMapSettings* QgsQuickPositionKit::mapSettings ( ) const

Associated map settings.

Should be initialized before the first use from mapcanvas map settings.

This is a readonly property.

◆ mapSettingsChanged

void QgsQuickPositionKit::mapSettingsChanged ( )
signal

Associated map settings.

Should be initialized before the first use from mapcanvas map settings.

This is a readonly property.

◆ position()

QgsPoint QgsQuickPositionKit::position ( ) const

GPS position in WGS84 coords.

This is a readonly property.

◆ positionChanged

void QgsQuickPositionKit::positionChanged ( )
signal

GPS position in WGS84 coords.

This is a readonly property.

◆ positionCRS()

QgsCoordinateReferenceSystem QgsQuickPositionKit::positionCRS ( ) const

Coordinate reference system of position - WGS84 (constant)

Definition at line 277 of file qgsquickpositionkit.cpp.

◆ projectedPosition()

QgsPoint QgsQuickPositionKit::projectedPosition ( ) const

GPS position in map coords.

This is a readonly property.

◆ projectedPositionChanged

void QgsQuickPositionKit::projectedPositionChanged ( )
signal

GPS position in map coords.

This is a readonly property.

◆ screenAccuracy()

double QgsQuickPositionKit::screenAccuracy ( ) const

Screen horizontal accuracy, 2 if not available or resolution is too small.

This is a readonly property.

◆ screenAccuracyChanged

double QgsQuickPositionKit::screenAccuracyChanged ( ) const
signal

Screen horizontal accuracy, 2 if not available or resolution is too small.

This is a readonly property.

◆ screenPosition()

QPointF QgsQuickPositionKit::screenPosition ( ) const

GPS position in device coords (pixels).

This is a readonly property.

◆ screenPositionChanged

void QgsQuickPositionKit::screenPositionChanged ( )
signal

GPS position in device coords (pixels).

This is a readonly property.

◆ setMapSettings()

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.

◆ setSimulatePositionLongLatRad()

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.

◆ simulatePositionLongLatRad()

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

◆ simulatePositionLongLatRadChanged

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

◆ source()

QGeoPositionInfoSource* QgsQuickPositionKit::source ( ) const

Returns pointer to the internal QGeoPositionInfoSource object used to receive GPS location.

Note
The returned pointer is only valid until sourceChanged() signal is emitted

◆ sourceChanged

void QgsQuickPositionKit::sourceChanged ( )
signal

Emitted when the internal source of GPS location data has been replaced.

◆ useGpsLocation()

void QgsQuickPositionKit::useGpsLocation ( )

Use real GPS source (not simulated)

Definition at line 100 of file qgsquickpositionkit.cpp.

◆ useSimulatedLocation()

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 67 of file qgsquickpositionkit.cpp.

Property Documentation

◆ accuracy

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.

◆ direction

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.

◆ hasPosition

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.

◆ isSimulated

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.

◆ mapSettings

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.

◆ position

QgsPoint QgsQuickPositionKit::position
read

GPS position in WGS84 coords.

This is a readonly property.

Definition at line 49 of file qgsquickpositionkit.h.

◆ projectedPosition

QgsPoint QgsQuickPositionKit::projectedPosition
read

GPS position in map coords.

This is a readonly property.

Definition at line 56 of file qgsquickpositionkit.h.

◆ screenAccuracy

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.

◆ screenPosition

QPointF QgsQuickPositionKit::screenPosition
read

GPS position in device coords (pixels).

This is a readonly property.

Definition at line 63 of file qgsquickpositionkit.h.

◆ simulatePositionLongLatRad

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.

◆ source

QGeoPositionInfoSource * QgsQuickPositionKit::source
read

Internal source of GPS location data.

Allows start/stop of its services or access properties.

Definition at line 121 of file qgsquickpositionkit.h.


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