QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
Public Slots | Public Member Functions | List of all members
QgsVectorLayerGpsLogger Class Reference

Handles logging of incoming GPS data to a vector layer. More...

#include <qgsvectorlayergpslogger.h>

Inheritance diagram for QgsVectorLayerGpsLogger:
Inheritance graph
[legend]

Public Slots

void endCurrentTrack ()
 Ends the current track, storing it in the tracksLayer() if appropriate. More...
 

Public Member Functions

 QgsVectorLayerGpsLogger (QgsGpsConnection *connection, QObject *parent=nullptr)
 Constructor for QgsVectorLayerGpsLogger with the specified parent object. More...
 
 ~QgsVectorLayerGpsLogger () override
 
QString destinationField (Qgis::GpsInformationComponent component) const
 Returns the destination field name for a specific GPS information component. More...
 
QgsVectorLayerpointsLayer ()
 Returns the layer in which recorded GPS points will be stored. More...
 
void setDestinationField (Qgis::GpsInformationComponent component, const QString &field)
 Sets a destination field name for a specific GPS information component. More...
 
void setPointsLayer (QgsVectorLayer *layer)
 Sets the layer in which recorded GPS points should be stored. More...
 
void setTracksLayer (QgsVectorLayer *layer)
 Sets the layer in which recorded GPS tracks should be stored. More...
 
void setTransformContext (const QgsCoordinateTransformContext &context) override
 Sets the coordinate transform context to be used when transforming GPS coordinates. More...
 
void setWriteToEditBuffer (bool buffer)
 Sets whether the logger will use the vector layer edit buffer for the destination layers. More...
 
QgsVectorLayertracksLayer ()
 Returns the layer in which recorded GPS tracks will be stored. More...
 
bool writeToEditBuffer () const
 Returns true if the logger will use the vector layer edit buffer for the destination layers. More...
 
- Public Member Functions inherited from QgsGpsLogger
 QgsGpsLogger (QgsGpsConnection *connection, QObject *parent=nullptr)
 Constructor for QgsGpsLogger with the specified parent object. More...
 
 ~QgsGpsLogger () override
 
bool automaticallyAddTrackVertices () const
 Returns true if track vertices will be automatically added whenever the GPS position is changed. More...
 
QVariant componentValue (Qgis::GpsInformationComponent component) const
 Returns the value of the corresponding GPS information component. More...
 
QgsGpsConnectionconnection ()
 Returns the associated GPS connection. More...
 
QgsGeometry currentGeometry (Qgis::WkbType type, QString &error) const
 Returns the current logged GPS positions as a geometry of the specified type. More...
 
QVector< QgsPointcurrentTrack () const
 Returns the recorded points in the current track. More...
 
const QgsDistanceAreadistanceArea () const
 Returns the distance area calculator which should be used for calculating distances associated with the GPS log. More...
 
double lastElevation () const
 Returns the last recorded elevation the device. More...
 
double lastMValue () const
 Returns the last recorded value corresponding to the QgsGpsLogger::settingsGpsMValueComponent setting. More...
 
QgsPointXY lastPosition () const
 Returns the last recorded position of the device. More...
 
QDateTime lastTimestamp () const
 Returns the last recorded timestamp from the device. More...
 
void resetTrack ()
 Resets the current track, discarding all recorded points. More...
 
void setAutomaticallyAddTrackVertices (bool enabled)
 Sets whether track vertices will be automatically added whenever the GPS position is changed. More...
 
void setConnection (QgsGpsConnection *connection)
 Sets the associated GPS connection. More...
 
void setEllipsoid (const QString &ellipsoid)
 Sets the ellipsoid which will be used for calculating distances in the log. More...
 
virtual void setTransformContext (const QgsCoordinateTransformContext &context)
 Sets the coordinate transform context to be used when transforming GPS coordinates. More...
 
double totalTrackLength () const
 Returns the total length of the current digitized track (in meters). More...
 
double trackDistanceFromStart () const
 Returns the direct length from the first vertex in the track to the last (in meters). More...
 
QDateTime trackStartTime () const
 Returns the timestamp at which the current track was started. More...
 
QgsCoordinateTransformContext transformContext () const
 Returns the coordinate transform context to be used when transforming GPS coordinates. More...
 
void updateGpsSettings ()
 Should be called whenever the QGIS GPS settings are changed. More...
 

Additional Inherited Members

- Signals inherited from QgsGpsLogger
void distanceAreaChanged ()
 Emitted whenever the distance area used to calculate track distances is changed. More...
 
void stateChanged (const QgsGpsInformation &info)
 Emitted whenever the associated GPS device state is changed. More...
 
void trackIsEmptyChanged (bool isEmpty)
 Emitted whenever the current track changes from being empty to non-empty or vice versa. More...
 
void trackReset ()
 Emitted whenever the current track is reset. More...
 
void trackVertexAdded (const QgsPoint &vertex)
 Emitted whenever a new vertex is added to the track. More...
 
- Static Public Attributes inherited from QgsGpsLogger
static const QgsSettingsEntryIntegersettingsAcquisitionInterval = new QgsSettingsEntryInteger( QStringLiteral( "acquisitionInterval" ), QgsSettingsTree::sTreeGps, 0 )
 
static const QgsSettingsEntryBoolsettingsApplyLeapSeconds = new QgsSettingsEntryBool( QStringLiteral( "applyLeapSeconds" ), QgsSettingsTree::sTreeGps, true )
 
static const QgsSettingsEntryDoublesettingsDistanceThreshold = new QgsSettingsEntryDouble( QStringLiteral( "distanceThreshold" ), QgsSettingsTree::sTreeGps, 0 )
 
static const QgsSettingsEntryEnumFlag< Qgis::GpsInformationComponent > * settingsGpsMValueComponent = new QgsSettingsEntryEnumFlag<Qgis::GpsInformationComponent>( QStringLiteral( "m-value-attribute" ), QgsSettingsTree::sTreeGps, Qgis::GpsInformationComponent::Timestamp, QStringLiteral( "Which GPS attribute should be stored in geometry m values" ) )
 Settings entry dictating which GPS attribute should be stored in geometry M values. More...
 
static const QgsSettingsEntryBoolsettingsGpsStoreAttributeInMValues = new QgsSettingsEntryBool( QStringLiteral( "store-attribute-in-m-values" ), QgsSettingsTree::sTreeGps, false, QStringLiteral( "Whether GPS attributes should be stored in geometry m values" ) )
 Settings entry for whether storing GPS attributes as geometry M values should be enabled. More...
 
static const QgsSettingsEntryIntegersettingsLeapSecondsCorrection = new QgsSettingsEntryInteger( QStringLiteral( "leapSecondsCorrection" ), QgsSettingsTree::sTreeGps, 18 )
 
static const QgsSettingsEntryIntegersettingsTimeStampFormat = new QgsSettingsEntryInteger( QStringLiteral( "timeStampFormat" ), QgsSettingsTree::sTreeGps, Qt::LocalTime )
 
static const QgsSettingsEntryStringsettingsTimestampTimeZone = new QgsSettingsEntryString( QStringLiteral( "timestampTimeZone" ), QgsSettingsTree::sTreeGps, QString() )
 
- Protected Member Functions inherited from QgsGpsLogger
void addTrackVertex ()
 Adds a track vertex at the current GPS location. More...
 
- Protected Attributes inherited from QgsGpsLogger
int mBlockGpsStateChanged = 0
 Used to pause logging of incoming GPS messages. More...
 
QgsCoordinateReferenceSystem mWgs84CRS
 WGS84 coordinate reference system. More...
 

Detailed Description

Handles logging of incoming GPS data to a vector layer.

Since
QGIS 3.30

Definition at line 35 of file qgsvectorlayergpslogger.h.

Constructor & Destructor Documentation

◆ QgsVectorLayerGpsLogger()

QgsVectorLayerGpsLogger::QgsVectorLayerGpsLogger ( QgsGpsConnection connection,
QObject *  parent = nullptr 
)

Constructor for QgsVectorLayerGpsLogger with the specified parent object.

The logger will automatically record GPS information from the specified connection.

Definition at line 22 of file qgsvectorlayergpslogger.cpp.

◆ ~QgsVectorLayerGpsLogger()

QgsVectorLayerGpsLogger::~QgsVectorLayerGpsLogger ( )
override

Definition at line 28 of file qgsvectorlayergpslogger.cpp.

Member Function Documentation

◆ destinationField()

QString QgsVectorLayerGpsLogger::destinationField ( Qgis::GpsInformationComponent  component) const

Returns the destination field name for a specific GPS information component.

See also
setDestinationField()

Definition at line 71 of file qgsvectorlayergpslogger.cpp.

◆ endCurrentTrack

void QgsVectorLayerGpsLogger::endCurrentTrack ( )
slot

Ends the current track, storing it in the tracksLayer() if appropriate.

Definition at line 90 of file qgsvectorlayergpslogger.cpp.

◆ pointsLayer()

QgsVectorLayer * QgsVectorLayerGpsLogger::pointsLayer ( )

Returns the layer in which recorded GPS points will be stored.

May be nullptr if points are not being stored.

See also
setPointsLayer()
tracksLayer()

Definition at line 53 of file qgsvectorlayergpslogger.cpp.

◆ setDestinationField()

void QgsVectorLayerGpsLogger::setDestinationField ( Qgis::GpsInformationComponent  component,
const QString &  field 
)

◆ setPointsLayer()

void QgsVectorLayerGpsLogger::setPointsLayer ( QgsVectorLayer layer)

Sets the layer in which recorded GPS points should be stored.

See also
setTracksLayer()
pointsLayer()

Definition at line 33 of file qgsvectorlayergpslogger.cpp.

◆ setTracksLayer()

void QgsVectorLayerGpsLogger::setTracksLayer ( QgsVectorLayer layer)

Sets the layer in which recorded GPS tracks should be stored.

See also
setPointsLayer()
tracksLayer()

Definition at line 43 of file qgsvectorlayergpslogger.cpp.

◆ setTransformContext()

void QgsVectorLayerGpsLogger::setTransformContext ( const QgsCoordinateTransformContext context)
overridevirtual

Sets the coordinate transform context to be used when transforming GPS coordinates.

See also
transformContext()

Reimplemented from QgsGpsLogger.

Definition at line 76 of file qgsvectorlayergpslogger.cpp.

◆ setWriteToEditBuffer()

void QgsVectorLayerGpsLogger::setWriteToEditBuffer ( bool  buffer)
inline

Sets whether the logger will use the vector layer edit buffer for the destination layers.

If buffer is false then the features will be written directly to the destination layer's data providers.

The default behavior is to use the edit buffer.

See also
writeToEditBuffer()

Definition at line 70 of file qgsvectorlayergpslogger.h.

◆ tracksLayer()

QgsVectorLayer * QgsVectorLayerGpsLogger::tracksLayer ( )

Returns the layer in which recorded GPS tracks will be stored.

May be nullptr if tracks are not being stored.

See also
setTracksLayer()
pointsLayer()

Definition at line 58 of file qgsvectorlayergpslogger.cpp.

◆ writeToEditBuffer()

bool QgsVectorLayerGpsLogger::writeToEditBuffer ( ) const
inline

Returns true if the logger will use the vector layer edit buffer for the destination layers.

If false then the features will be written directly to the destination layer's data providers.

The default behavior is to use the edit buffer.

See also
setWriteToEditBuffer()

Definition at line 59 of file qgsvectorlayergpslogger.h.


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