QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
qgsvectorlayertemporalproperties.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsvectorlayertemporalproperties.h
3 ---------------
4 begin : May 2020
5 copyright : (C) 2020 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18
19#ifndef QGSVECTORLAYERTEMPORALPROPERTIES_H
20#define QGSVECTORLAYERTEMPORALPROPERTIES_H
21
22#include "qgis_core.h"
23#include "qgis.h"
24#include "qgis_sip.h"
25#include "qgsrange.h"
27#include "qgsunittypes.h"
28
29class QgsVectorLayer;
30class QgsFields;
31
41{
42 public:
43
49 QgsVectorLayer *layer() const;
50
56 void setLayer( QgsVectorLayer *layer );
57
58 private:
59
60 QgsVectorLayer *mLayer = nullptr;
61};
62
71{
72 Q_OBJECT
73
74 public:
75
81 QgsVectorLayerTemporalProperties( QObject *parent SIP_TRANSFERTHIS = nullptr, bool enabled = false );
82
83 bool isVisibleInTemporalRange( const QgsDateTimeRange &range ) const override;
84 QgsDateTimeRange calculateTemporalExtent( QgsMapLayer *layer ) const override SIP_SKIP;
85
91 Qgis::VectorTemporalMode mode() const;
92
98 void setMode( Qgis::VectorTemporalMode mode );
99
106 Qgis::VectorTemporalLimitMode limitMode() const;
107
114 void setLimitMode( Qgis::VectorTemporalLimitMode mode );
115
119 QgsTemporalProperty::Flags flags() const override;
120
131 void setFixedTemporalRange( const QgsDateTimeRange &range );
132
141 const QgsDateTimeRange &fixedTemporalRange() const;
142
153 QString startField() const;
154
165 void setStartField( const QString &field );
166
174 QString endField() const;
175
183 void setEndField( const QString &field );
184
194 QString startExpression() const;
195
205 void setStartExpression( const QString &expression );
206
216 QString endExpression() const;
217
227 void setEndExpression( const QString &endExpression );
228
241 QString durationField() const;
242
255 void setDurationField( const QString &field );
256
262 QgsUnitTypes::TemporalUnit durationUnits() const;
263
269 void setDurationUnits( QgsUnitTypes::TemporalUnit units );
270
282 double fixedDuration() const;
283
295 void setFixedDuration( double duration );
296
306 bool accumulateFeatures() const;
307
317 void setAccumulateFeatures( bool accumulate );
318
331 QString createFilterString( const QgsVectorLayerTemporalContext &context, const QgsDateTimeRange &range ) const;
332
337 void guessDefaultsFromFields( const QgsFields &fields );
338
339 QDomElement writeXml( QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context ) override;
340 bool readXml( const QDomElement &element, const QgsReadWriteContext &context ) override;
341 void setDefaultsFromDataProviderTemporalCapabilities( const QgsDataProviderTemporalCapabilities *capabilities ) override;
342
343 private:
344
346 Qgis::VectorTemporalMode mMode = Qgis::VectorTemporalMode::FixedTemporalRange;
347
350
352 QgsDateTimeRange mFixedRange;
353
354 QString mStartFieldName;
355 QString mEndFieldName;
356 QString mDurationFieldName;
358
359 double mFixedDuration = 0;
360
361 bool mAccumulateFeatures = false;
362
363 QString mStartExpression;
364 QString mEndExpression;
365
366};
367
368#endif // QGSVECTORLAYERTEMPORALPROPERTIES_H
VectorTemporalMode
Vector layer temporal feature modes.
Definition: qgis.h:1232
VectorTemporalLimitMode
Mode for the handling of the limits of the filtering timeframe for vector features.
Definition: qgis.h:1248
@ IncludeBeginExcludeEnd
Default mode: include the Begin limit, but exclude the End limit.
Base class for handling properties relating to a data provider's temporal capabilities.
Container of fields for a vector layer.
Definition: qgsfields.h:45
Base class for storage of map layer temporal properties.
Base class for all map layer types.
Definition: qgsmaplayer.h:73
The class is used as a container of context for various read/write operations on other objects.
TemporalUnit
Temporal units.
Definition: qgsunittypes.h:150
@ TemporalMinutes
Minutes.
Definition: qgsunittypes.h:153
Encapsulates the context in which a QgsVectorLayer's temporal capabilities will be applied.
Implementation of map layer temporal properties for vector layers.
Represents a vector layer which manages a vector based data sets.
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
#define SIP_SKIP
Definition: qgis_sip.h:126
const QgsField & field
Definition: qgsfield.h:463