QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
qgsprojectgpssettings.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsprojectgpssettings.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#ifndef QGSPROJECTGPSSETTINGS_H
16#define QGSPROJECTGPSSETTINGS_H
17
18#include "qgis.h"
19#include "qgis_core.h"
20#include "qgis_sip.h"
21#include "qgsvectorlayerref.h"
22
23#include <QObject>
24
25class QDomElement;
27class QDomDocument;
28
36class CORE_EXPORT QgsProjectGpsSettings : public QObject
37{
38 Q_OBJECT
39
40 public:
41
45
49 QgsProjectGpsSettings( QObject *parent = nullptr );
50
52
56 void resolveReferences( const QgsProject *project );
57
61 void reset();
62
67 bool readXml( const QDomElement &element, const QgsReadWriteContext &context );
68
73 QDomElement writeXml( QDomDocument &doc, const QgsReadWriteContext &context ) const;
74
83
92 bool automaticallyCommitFeatures() const;
93
102
113
121 QMap< QString, QString > destinationTimeStampFields() const;
122
130 QString destinationTimeStampField() const;
131
132 public slots:
133
141 void setAutomaticallyAddTrackVertices( bool enabled );
142
151 void setAutomaticallyCommitFeatures( bool enabled );
152
160 void setDestinationFollowsActiveLayer( bool follow );
161
171 void setDestinationLayer( QgsVectorLayer *layer );
172
183 void setDestinationTimeStampField( QgsVectorLayer *layer, const QString &field );
184
185 signals:
186
195
204
213
222
234 void destinationTimeStampFieldChanged( const QString &field );
235
236 private:
237
238 bool mAutoAddTrackVertices = false;
239 bool mAutoCommitFeatures = false;
240
241 bool mDestinationFollowsActiveLayer = true;
242 QgsVectorLayerRef mDestinationLayer;
243
244 QMap<QString, QString> mDestinationTimestampFields;
245
246};
247
248#endif // QGSPROJECTGPSSETTINGS_H
void setAutomaticallyCommitFeatures(bool enabled)
Sets whether features created from GPS locations should be immediately committed to their target laye...
void destinationFollowsActiveLayerChanged(bool follows)
Emitted whenever the destinationFollowsActiveLayer() setting is changed.
void destinationLayerChanged(QgsVectorLayer *layer)
Emitted whenever the destination layer for features digitized from GPS is changed.
void setDestinationFollowsActiveLayer(bool follow)
Sets whether the destination layer for storing features digitized from GPS should follow the current ...
QMap< QString, QString > destinationTimeStampFields() const
Returns the map of destination layer ID to target time stamp field name.
bool readXml(const QDomElement &element, const QgsReadWriteContext &context)
Reads the settings's state from a DOM element.
QgsProjectGpsSettings(QObject *parent=nullptr)
Constructor for QgsProjectGpsSettings with the specified parent object.
void reset()
Resets the settings to a default state.
QgsVectorLayer * destinationLayer
void setDestinationLayer(QgsVectorLayer *layer)
Sets the destination layer to be used for storing features digitized from GPS.
void setAutomaticallyAddTrackVertices(bool enabled)
Sets whether track vertices should be automatically created whenever new locations are received from ...
QDomElement writeXml(QDomDocument &doc, const QgsReadWriteContext &context) const
Returns a DOM element representing the settings.
void resolveReferences(const QgsProject *project)
Resolves reference to layers from stored layer ID (if it has not been resolved already).
void setDestinationTimeStampField(QgsVectorLayer *layer, const QString &field)
Sets the destination field name for automatically storing timestamps in the specified destination lay...
bool destinationFollowsActiveLayer() const
Returns true if the destination layer for storing features digitized from GPS should follow the curre...
void destinationTimeStampFieldChanged(const QString &field)
Emitted whenever the destination field for automatic time stamps is changed.
void automaticallyCommitFeaturesChanged(bool enabled)
Emitted whenever the automaticallyCommitFeatures() setting is changed.
void automaticallyAddTrackVerticesChanged(bool enabled)
Emitted whenever the automaticallyAddTrackVertices() setting is changed.
QString destinationTimeStampField() const
Returns the destination time stamp field name for the current destinationLayer(), or an empty string ...
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:109
A container for the context for various read/write operations on objects.
Represents a vector layer which manages a vector based dataset.
_LayerRef< QgsVectorLayer > QgsVectorLayerRef