Skip to content

Commit

Permalink
Add layer fields to QgsGpsLogger
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 14, 2022
1 parent f902248 commit 669fb4b
Show file tree
Hide file tree
Showing 5 changed files with 459 additions and 6 deletions.
158 changes: 154 additions & 4 deletions python/core/auto_generated/gps/qgsgpslogger.sip.in
Expand Up @@ -9,20 +9,22 @@




class QgsGpsLogger : QObject
%Docstring
{
%Docstring(signature="appended")
Handles logging of incoming GPS data to a vector layer.

.. versionadded:: 3.30
%End
{

%TypeHeaderCode
#include "qgsgpslogger.h"
%End
public:

QgsGpsLogger( QgsGpsConnection *connection, QObject *parent /TransferThis/ = 0 );
%Docstring
Constructor for :py:class:`QgsGpsLogger` with the specified ``parent`` object.
Constructor for QgsGpsLogger with the specified ``parent`` object.

The logger will automatically record GPS information from the specified ``connection``.
%End
Expand All @@ -32,6 +34,154 @@ The logger will automatically record GPS information from the specified ``connec
QgsGpsConnection *connection();
%Docstring
Returns the associated GPS connection.
%End

void setPointsLayer( QgsVectorLayer *layer );
%Docstring
Sets the ``layer`` in which recorded GPS points should be stored.

.. seealso:: :py:func:`setTracksLayer`

.. seealso:: :py:func:`pointsLayer`
%End

void setTracksLayer( QgsVectorLayer *layer );
%Docstring
Sets the ``layer`` in which recorded GPS tracks should be stored.

.. seealso:: :py:func:`setPointsLayer`

.. seealso:: :py:func:`tracksLayer`
%End

QgsVectorLayer *pointsLayer();
%Docstring
Returns the layer in which recorded GPS points will be stored.

May be ``None`` if points are not being stored.

.. seealso:: :py:func:`setPointsLayer`

.. seealso:: :py:func:`tracksLayer`
%End

QgsVectorLayer *tracksLayer();
%Docstring
Returns the layer in which recorded GPS tracks will be stored.

May be ``None`` if tracks are not being stored.

.. seealso:: :py:func:`setTracksLayer`

.. seealso:: :py:func:`pointsLayer`
%End

QString pointTimeField() const;
%Docstring
Returns the destination time field name from the :py:func:`~QgsGpsLogger.pointsLayer`.

If specified, timestamps for recorded points will be stored in this field.

.. seealso:: :py:func:`setPointTimeField`
%End

void setPointTimeField( const QString &field );
%Docstring
Sets the destination time ``field`` name from the :py:func:`~QgsGpsLogger.pointsLayer`.

If specified, timestamps for recorded points will be stored in this field.

.. seealso:: :py:func:`pointTimeField`
%End

QString pointDistanceFromPreviousField() const;
%Docstring
Returns the destination distance from previous point field name from the :py:func:`~QgsGpsLogger.pointsLayer`.

If specified, the distance from the previous recorded point will be stored in this field.

.. seealso:: :py:func:`setPointDistanceFromPreviousField`
%End

void setPointDistanceFromPreviousField( const QString &field );
%Docstring
Sets the destination distance from previous point ``field`` name from the :py:func:`~QgsGpsLogger.pointsLayer`.

If specified, the distance from the previous recorded point will be stored in this field.

.. seealso:: :py:func:`pointDistanceFromPreviousField`
%End

QString pointTimeDeltaFromPreviousField() const;
%Docstring
Returns the destination time delta from previous point field name from the :py:func:`~QgsGpsLogger.pointsLayer`.

If specified, the time difference from the previous recorded point will be stored in this field.

.. seealso:: :py:func:`setPointTimeDeltaFromPreviousField`
%End

void setPointTimeDeltaFromPreviousField( const QString &field );
%Docstring
Sets the destination time delta from previous point ``field`` name from the :py:func:`~QgsGpsLogger.pointsLayer`.

If specified, the time difference from the previous recorded point will be stored in this field.

.. seealso:: :py:func:`pointTimeDeltaFromPreviousField`
%End

QString trackStartTimeField() const;
%Docstring
Returns the destination start time field name from the :py:func:`~QgsGpsLogger.tracksLayer`.

If specified, the start timestamps for recorded tracks will be stored in this field.

.. seealso:: :py:func:`setTrackStartTimeField`
%End

void setTrackStartTimeField( const QString &field );
%Docstring
Sets the destination start time ``field`` name from the :py:func:`~QgsGpsLogger.tracksLayer`.

If specified, the start timestamps for recorded tracks will be stored in this field.

.. seealso:: :py:func:`trackStartTimeField`
%End

QString trackEndTimeField() const;
%Docstring
Returns the destination end time field name from the :py:func:`~QgsGpsLogger.tracksLayer`.

If specified, the end timestamps for recorded tracks will be stored in this field.

.. seealso:: :py:func:`setTrackEndTimeField`
%End

void setTrackEndTimeField( const QString &field );
%Docstring
Sets the destination end time ``field`` name from the :py:func:`~QgsGpsLogger.tracksLayer`.

If specified, the end timestamps for recorded tracks will be stored in this field.

.. seealso:: :py:func:`trackEndTimeField`
%End

QString trackLengthField() const;
%Docstring
Returns the destination track length field name from the :py:func:`~QgsGpsLogger.tracksLayer`.

If specified, the total track length recorded tracks will be stored in this field.

.. seealso:: :py:func:`setTrackLengthField`
%End

void setTrackLengthField( const QString &field );
%Docstring
Sets the destination track length ``field`` name from the :py:func:`~QgsGpsLogger.tracksLayer`.

If specified, the total track length recorded tracks will be stored in this field.

.. seealso:: :py:func:`trackLengthField`
%End

};
Expand Down
81 changes: 81 additions & 0 deletions src/core/gps/qgsgpslogger.cpp
Expand Up @@ -15,6 +15,7 @@

#include "qgsgpslogger.h"
#include "qgsgpsconnection.h"
#include "qgsvectorlayer.h"

QgsGpsLogger::QgsGpsLogger( QgsGpsConnection *connection, QObject *parent )
: QObject( parent )
Expand All @@ -32,3 +33,83 @@ QgsGpsConnection *QgsGpsLogger::connection()
{
return mConnection;
}

void QgsGpsLogger::setPointsLayer( QgsVectorLayer *layer )
{
mPointsLayer = layer;
}

void QgsGpsLogger::setTracksLayer( QgsVectorLayer *layer )
{
mTracksLayer = layer;
}

QgsVectorLayer *QgsGpsLogger::pointsLayer()
{
return mPointsLayer;
}

QgsVectorLayer *QgsGpsLogger::tracksLayer()
{
return mTracksLayer;
}

QString QgsGpsLogger::pointTimeField() const
{
return mPointTimeField;
}

void QgsGpsLogger::setPointTimeField( const QString &field )
{
mPointTimeField = field;
}

QString QgsGpsLogger::pointDistanceFromPreviousField() const
{
return mPointDistanceFromPreviousField;
}

void QgsGpsLogger::setPointDistanceFromPreviousField( const QString &field )
{
mPointDistanceFromPreviousField = field;
}

QString QgsGpsLogger::pointTimeDeltaFromPreviousField() const
{
return mPointTimeDeltaFromPreviousField;
}

void QgsGpsLogger::setPointTimeDeltaFromPreviousField( const QString &field )
{
mPointTimeDeltaFromPreviousField = field;
}

QString QgsGpsLogger::trackStartTimeField() const
{
return mTrackStartTimeField;
}

void QgsGpsLogger::setTrackStartTimeField( const QString &field )
{
mTrackStartTimeField = field;
}

QString QgsGpsLogger::trackEndTimeField() const
{
return mTrackEndTimeField;
}

void QgsGpsLogger::setTrackEndTimeField( const QString &field )
{
mTrackEndTimeField = field;
}

QString QgsGpsLogger::trackLengthField() const
{
return mTrackLengthField;
}

void QgsGpsLogger::setTrackLengthField( const QString &field )
{
mTrackLengthField = field;
}

0 comments on commit 669fb4b

Please sign in to comment.