65  if ( field.isEmpty() )
 
   66    mDestinationFields.remove( component );
 
   68    mDestinationFields[ component ] = field;
 
 
   73  return mDestinationFields.value( component );
 
 
   93  if ( track.isEmpty() )
 
  103      geometry.
transform( mWgs84toTrackLayerTransform );
 
  107      QgsDebugError( QStringLiteral( 
"Error transforming GPS track" ) );
 
  121    for ( 
auto it = mDestinationFields.constBegin(); it != mDestinationFields.constEnd(); ++it )
 
  123      if ( it.value().isEmpty() )
 
  150          const int fieldIdx = mTracksLayer->fields().lookupField( it.value() );
 
  154            if ( value.toDateTime().isValid() )
 
  156              attributes.insert( fieldIdx, timestamp( mTracksLayer, fieldIdx, value.toDateTime() ) );
 
  166          const int fieldIdx = mTracksLayer->fields().lookupField( it.value() );
 
  172              attributes.insert( fieldIdx, value );
 
  184    if ( mUseEditBuffer )
 
 
  194  if ( mPointsLayer && info.
isValid() )
 
  200    if ( geometry.constGet()->is3D() && !
QgsWkbTypes::hasZ( mPointsLayer->wkbType() ) )
 
  202      geometry.get()->dropZValue();
 
  204    if ( geometry.constGet()->isMeasure() && !
QgsWkbTypes::hasM( mPointsLayer->wkbType() ) )
 
  206      geometry.get()->dropMValue();
 
  211      geometry.transform( mWgs84toPointLayerTransform );
 
  215      QgsDebugError( QStringLiteral( 
"Error transforming GPS point" ) );
 
  220    for ( 
auto it = mDestinationFields.constBegin(); it != mDestinationFields.constEnd(); ++it )
 
  222      if ( it.value().isEmpty() )
 
  244          const int fieldIdx = mPointsLayer->fields().lookupField( it.value() );
 
  250              attributes.insert( fieldIdx, value );
 
  259          const int fieldIdx = mPointsLayer->fields().lookupField( it.value() );
 
  263            if ( value.toDateTime().isValid() )
 
  265              attributes.insert( fieldIdx, timestamp( mPointsLayer, fieldIdx, value.toDateTime() ) );
 
  283    if ( mUseEditBuffer )
 
  290QVariant QgsVectorLayerGpsLogger::timestamp( 
QgsVectorLayer *vlayer, 
int idx, 
const QDateTime &time )
 
  293  if ( idx != -1 && time.isValid() )
 
  298      case QMetaType::Type::QString:
 
  299        value = time.toString( Qt::DateFormat::ISODate );
 
  301      case QMetaType::Type::QDateTime:
 
GpsInformationComponent
GPS information component.
 
@ TrackStartTime
Timestamp at start of current track (available from QgsGpsLogger class only)
 
@ GroundSpeed
Ground speed.
 
@ TrackTimeSinceLastPoint
Time since last recorded location (available from QgsGpsLogger class only)
 
@ Pdop
Dilution of precision.
 
@ TrackEndTime
Timestamp at end (current point) of current track (available from QgsGpsLogger class only)
 
@ Altitude
Altitude/elevation above or below the mean sea level.
 
@ TrackDistanceFromStart
Direct distance from first vertex in current GPS track to last vertex (available from QgsGpsLogger cl...
 
@ TotalTrackLength
Total distance of current GPS track (available from QgsGpsLogger class only)
 
@ Hdop
Horizontal dilution of precision.
 
@ EllipsoidAltitude
Altitude/elevation above or below the WGS-84 Earth ellipsoid.
 
@ Bearing
Bearing measured in degrees clockwise from true north to the direction of travel.
 
@ Vdop
Vertical dilution of precision.
 
@ GeoidalSeparation
Geoidal separation, the difference between the WGS-84 Earth ellipsoid and mean-sea-level (geoid),...
 
@ VerticalAccuracy
Vertical accuracy in meters.
 
@ Location
2D location (latitude/longitude), as a QgsPointXY value
 
@ TrackDistanceSinceLastPoint
Distance since last recorded location (available from QgsGpsLogger class only)
 
@ HorizontalAccuracy
Horizontal accuracy in meters.
 
@ SatellitesUsed
Count of satellites used in obtaining the fix.
 
virtual bool dropMValue()=0
Drops any measure values which exist in the geometry.
 
bool isMeasure() const
Returns true if the geometry contains m values.
 
bool is3D() const
Returns true if the geometry is 3D and contains a z-value.
 
virtual bool dropZValue()=0
Drops any z-dimensions which exist in the geometry.
 
Contains information about the context in which a coordinate transform is executed.
 
Custom exception class for Coordinate Reference System related exceptions.
 
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
 
@ FastInsert
Use faster inserts, at the cost of updating the passed features to reflect changes made at the provid...
 
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
 
QgsField at(int i) const
Returns the field at particular index (must be in range 0..N-1).
 
A geometry is the spatial representation of a feature.
 
Qgis::GeometryOperationResult transform(const QgsCoordinateTransform &ct, Qgis::TransformDirection direction=Qgis::TransformDirection::Forward, bool transformZ=false)
Transforms this geometry as described by the coordinate transform ct.
 
QgsAbstractGeometry * get()
Returns a modifiable (non-const) reference to the underlying abstract geometry primitive.
 
const QgsAbstractGeometry * constGet() const
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
 
Abstract base class for connection to a GPS device.
 
Base class for objects which log incoming GPS data.
 
virtual void setTransformContext(const QgsCoordinateTransformContext &context)
Sets the coordinate transform context to be used when transforming GPS coordinates.
 
void stateChanged(const QgsGpsInformation &info)
Emitted whenever the associated GPS device state is changed.
 
double lastElevation() const
Returns the last recorded elevation the device.
 
QgsCoordinateReferenceSystem mWgs84CRS
WGS84 coordinate reference system.
 
QVector< QgsPoint > currentTrack() const
Returns the recorded points in the current track.
 
void resetTrack()
Resets the current track, discarding all recorded points.
 
double lastMValue() const
Returns the last recorded value corresponding to the QgsGpsLogger::settingsGpsMValueComponent setting...
 
QgsCoordinateTransformContext transformContext() const
Returns the coordinate transform context to be used when transforming GPS coordinates.
 
QVariant componentValue(Qgis::GpsInformationComponent component) const
Returns the value of the corresponding GPS information component.
 
QgsPointXY lastPosition() const
Returns the last recorded position of the device.
 
Line string geometry type, with support for z-dimension and m-values.
 
A class to represent a 2D point.
 
Point geometry type, with support for z-dimension and m-values.
 
static bool isNull(const QVariant &variant, bool silenceNullWarnings=false)
Returns true if the specified variant should be considered a NULL value.
 
~QgsVectorLayerGpsLogger() override
 
QgsVectorLayer * pointsLayer()
Returns the layer in which recorded GPS points will be stored.
 
void setDestinationField(Qgis::GpsInformationComponent component, const QString &field)
Sets a destination field name for a specific GPS information component.
 
QgsVectorLayerGpsLogger(QgsGpsConnection *connection, QObject *parent=nullptr)
Constructor for QgsVectorLayerGpsLogger with the specified parent object.
 
void setPointsLayer(QgsVectorLayer *layer)
Sets the layer in which recorded GPS points should be stored.
 
void setTracksLayer(QgsVectorLayer *layer)
Sets the layer in which recorded GPS tracks should be stored.
 
void setTransformContext(const QgsCoordinateTransformContext &context) override
Sets the coordinate transform context to be used when transforming GPS coordinates.
 
QString destinationField(Qgis::GpsInformationComponent component) const
Returns the destination field name for a specific GPS information component.
 
QgsVectorLayer * tracksLayer()
Returns the layer in which recorded GPS tracks will be stored.
 
void endCurrentTrack()
Ends the current track, storing it in the tracksLayer() if appropriate.
 
static QgsFeature createFeature(const QgsVectorLayer *layer, const QgsGeometry &geometry=QgsGeometry(), const QgsAttributeMap &attributes=QgsAttributeMap(), QgsExpressionContext *context=nullptr)
Creates a new feature ready for insertion into a layer.
 
Represents a vector layer which manages a vector based data sets.
 
static bool hasZ(Qgis::WkbType type)
Tests whether a WKB type contains the z-dimension.
 
static bool hasM(Qgis::WkbType type)
Tests whether a WKB type contains m values.
 
QMap< int, QVariant > QgsAttributeMap
 
#define QgsDebugError(str)