QGIS API Documentation 4.1.0-Master (60fea48833c)
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:
44
48 QgsProjectGpsSettings( QObject *parent = nullptr );
49
51
55 void resolveReferences( const QgsProject *project );
56
60 void reset();
61
66 bool readXml( const QDomElement &element, const QgsReadWriteContext &context );
67
72 QDomElement writeXml( QDomDocument &doc, const QgsReadWriteContext &context ) const;
73
82
91 bool automaticallyCommitFeatures() const;
92
101
112
120 QMap< QString, QString > destinationTimeStampFields() const;
121
129 QString destinationTimeStampField() const;
130
131 public slots:
132
140 void setAutomaticallyAddTrackVertices( bool enabled );
141
150 void setAutomaticallyCommitFeatures( bool enabled );
151
159 void setDestinationFollowsActiveLayer( bool follow );
160
170 void setDestinationLayer( QgsVectorLayer *layer );
171
182 void setDestinationTimeStampField( QgsVectorLayer *layer, const QString &field );
183
184 signals:
185
194
203
212
221
233 void destinationTimeStampFieldChanged( const QString &field );
234
235 private:
236 bool mAutoAddTrackVertices = false;
237 bool mAutoCommitFeatures = false;
238
239 bool mDestinationFollowsActiveLayer = true;
240 QgsVectorLayerRef mDestinationLayer;
241
242 QMap<QString, QString> mDestinationTimestampFields;
243};
244
245#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:113
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