QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
Loading...
Searching...
No Matches
qgsvectorlayergpslogger.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsvectorlayergpslogger.h
3 -------------------
4 begin : November 2022
5 copyright : (C) 2022 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSVECTORLAYERGPSLOGGER_H
17#define QGSVECTORLAYERGPSLOGGER_H
18
19#include "qgis.h"
20#include "qgis_core.h"
21#include "qgis_sip.h"
22#include "qgsgpslogger.h"
23
24#include <QDateTime>
25
26class QgsVectorLayer;
27
35class CORE_EXPORT QgsVectorLayerGpsLogger : public QgsGpsLogger
36{
37 Q_OBJECT
38
39 public:
46
47 ~QgsVectorLayerGpsLogger() override;
48
58 bool writeToEditBuffer() const { return mUseEditBuffer; }
59
69 void setWriteToEditBuffer( bool buffer ) { mUseEditBuffer = buffer; }
70
77 void setPointsLayer( QgsVectorLayer *layer );
78
85 void setTracksLayer( QgsVectorLayer *layer );
86
95 QgsVectorLayer *pointsLayer();
96
105 QgsVectorLayer *tracksLayer();
106
138 void setDestinationField( Qgis::GpsInformationComponent component, const QString &field );
139
145 QString destinationField( Qgis::GpsInformationComponent component ) const;
146
147 void setTransformContext( const QgsCoordinateTransformContext &context ) override;
148
149 public slots:
150
154 void endCurrentTrack();
155
156 private slots:
157
158 void gpsStateChanged( const QgsGpsInformation &information );
159
160 private:
161 bool mUseEditBuffer = true;
162
163 QPointer< QgsVectorLayer > mPointsLayer;
164 QPointer< QgsVectorLayer > mTracksLayer;
165
166 QgsCoordinateTransform mWgs84toPointLayerTransform;
167 QgsCoordinateTransform mWgs84toTrackLayerTransform;
168
169 QMap< Qgis::GpsInformationComponent, QString > mDestinationFields;
170
171 QVariant timestamp( QgsVectorLayer *vlayer, int idx, const QDateTime &time );
172};
173
174
175#endif // QGSVECTORLAYERGPSLOGGER_H
GpsInformationComponent
GPS information component.
Definition qgis.h:2035
Contains information about the context in which a coordinate transform is executed.
Handles coordinate transforms between two coordinate systems.
Abstract base class for connections to a GPS device.
Encapsulates information relating to a GPS position fix.
virtual void setTransformContext(const QgsCoordinateTransformContext &context)
Sets the coordinate transform context to be used when transforming GPS coordinates.
QgsGpsLogger(QgsGpsConnection *connection, QObject *parent=nullptr)
Constructor for QgsGpsLogger with the specified parent object.
QgsGpsConnection * connection()
Returns the associated GPS connection.
bool writeToEditBuffer() const
Returns true if the logger will use the vector layer edit buffer for the destination layers.
void setWriteToEditBuffer(bool buffer)
Sets whether the logger will use the vector layer edit buffer for the destination layers.
QgsVectorLayerGpsLogger(QgsGpsConnection *connection, QObject *parent=nullptr)
Constructor for QgsVectorLayerGpsLogger with the specified parent object.
Represents a vector layer which manages a vector based dataset.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:52