QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
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
28class QgsVectorLayer;
29class QgsFields;
30
40{
41 public:
42
48 QgsVectorLayer *layer() const;
49
55 void setLayer( QgsVectorLayer *layer );
56
57 private:
58
59 QgsVectorLayer *mLayer = nullptr;
60};
61
70{
71 Q_OBJECT
72
73 public:
74
80 QgsVectorLayerTemporalProperties( QObject *parent SIP_TRANSFERTHIS = nullptr, bool enabled = false );
81
82 bool isVisibleInTemporalRange( const QgsDateTimeRange &range ) const override;
83 QgsDateTimeRange calculateTemporalExtent( QgsMapLayer *layer ) const override SIP_SKIP;
84
90 Qgis::VectorTemporalMode mode() const;
91
97 void setMode( Qgis::VectorTemporalMode mode );
98
105 Qgis::VectorTemporalLimitMode limitMode() const;
106
113 void setLimitMode( Qgis::VectorTemporalLimitMode mode );
114
118 QgsTemporalProperty::Flags flags() const override;
119
130 void setFixedTemporalRange( const QgsDateTimeRange &range );
131
140 const QgsDateTimeRange &fixedTemporalRange() const;
141
152 QString startField() const;
153
164 void setStartField( const QString &field );
165
173 QString endField() const;
174
182 void setEndField( const QString &field );
183
193 QString startExpression() const;
194
204 void setStartExpression( const QString &expression );
205
215 QString endExpression() const;
216
226 void setEndExpression( const QString &endExpression );
227
240 QString durationField() const;
241
254 void setDurationField( const QString &field );
255
261 Qgis::TemporalUnit durationUnits() const;
262
268 void setDurationUnits( Qgis::TemporalUnit units );
269
281 double fixedDuration() const;
282
294 void setFixedDuration( double duration );
295
305 bool accumulateFeatures() const;
306
316 void setAccumulateFeatures( bool accumulate );
317
330 QString createFilterString( const QgsVectorLayerTemporalContext &context, const QgsDateTimeRange &range ) const;
331
336 void guessDefaultsFromFields( const QgsFields &fields );
337
338 QDomElement writeXml( QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context ) override;
339 bool readXml( const QDomElement &element, const QgsReadWriteContext &context ) override;
340 void setDefaultsFromDataProviderTemporalCapabilities( const QgsDataProviderTemporalCapabilities *capabilities ) override;
341
342 private:
343
346
349
351 QgsDateTimeRange mFixedRange;
352
353 QString mStartFieldName;
354 QString mEndFieldName;
355 QString mDurationFieldName;
357
358 double mFixedDuration = 0;
359
360 bool mAccumulateFeatures = false;
361
362 QString mStartExpression;
363 QString mEndExpression;
364
365};
366
367#endif // QGSVECTORLAYERTEMPORALPROPERTIES_H
VectorTemporalMode
Vector layer temporal feature modes.
Definition: qgis.h:2102
@ FixedTemporalRange
Mode when temporal properties have fixed start and end datetimes.
TemporalUnit
Temporal units.
Definition: qgis.h:4231
VectorTemporalLimitMode
Mode for the handling of the limits of the filtering timeframe for vector features.
Definition: qgis.h:2118
@ 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:75
The class is used as a container of context for various read/write operations on other objects.
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