QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
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_core.h"
20#include "qgis.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:
40
46 QgsVectorLayerGpsLogger( QgsGpsConnection *connection, QObject *parent SIP_TRANSFERTHIS = nullptr );
47
48 ~QgsVectorLayerGpsLogger() override;
49
59 bool writeToEditBuffer() const { return mUseEditBuffer; }
60
70 void setWriteToEditBuffer( bool buffer ) { mUseEditBuffer = buffer; }
71
78 void setPointsLayer( QgsVectorLayer *layer );
79
86 void setTracksLayer( QgsVectorLayer *layer );
87
96 QgsVectorLayer *pointsLayer();
97
106 QgsVectorLayer *tracksLayer();
107
139 void setDestinationField( Qgis::GpsInformationComponent component, const QString &field );
140
146 QString destinationField( Qgis::GpsInformationComponent component ) const;
147
148 void setTransformContext( const QgsCoordinateTransformContext &context ) override;
149
150 public slots:
151
155 void endCurrentTrack();
156
157 private slots:
158
159 void gpsStateChanged( const QgsGpsInformation &information );
160
161 private:
162
163 bool mUseEditBuffer = true;
164
165 QPointer< QgsVectorLayer > mPointsLayer;
166 QPointer< QgsVectorLayer > mTracksLayer;
167
168 QgsCoordinateTransform mWgs84toPointLayerTransform;
169 QgsCoordinateTransform mWgs84toTrackLayerTransform;
170
171 QMap< Qgis::GpsInformationComponent, QString > mDestinationFields;
172
173 QVariant timestamp( QgsVectorLayer *vlayer, int idx, const QDateTime &time );
174
175};
176
177
178#endif // QGSVECTORLAYERGPSLOGGER_H
GpsInformationComponent
GPS information component.
Definition qgis.h:1803
Contains information about the context in which a coordinate transform is executed.
Class for doing transforms between two map coordinate systems.
Abstract base class for connection to a GPS device.
Encapsulates information relating to a GPS position fix.
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.
Handles logging of incoming GPS data to a vector layer.
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.
Represents a vector layer which manages a vector based data sets.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53