QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
Public Member Functions | List of all members
QgsVectorLayerTemporalProperties Class Reference

Implementation of map layer temporal properties for vector layers. More...

#include <qgsvectorlayertemporalproperties.h>

Inheritance diagram for QgsVectorLayerTemporalProperties:
Inheritance graph
[legend]

Public Member Functions

 QgsVectorLayerTemporalProperties (QObject *parent=nullptr, bool enabled=false)
 Constructor for QgsVectorLayerTemporalProperties, with the specified parent object. More...
 
bool accumulateFeatures () const
 Returns true if features will be accumulated over time (i.e. More...
 
QgsDateTimeRange calculateTemporalExtent (QgsMapLayer *layer) const override
 Attempts to calculate the overall temporal extent for the specified layer, using the settings defined by the temporal properties object. More...
 
QString createFilterString (const QgsVectorLayerTemporalContext &context, const QgsDateTimeRange &range) const
 Creates a QGIS expression filter string for filtering features within the specified context to those within the specified time range. More...
 
QString durationField () const
 Returns the name of the duration field, which contains the duration of the event. More...
 
QgsUnitTypes::TemporalUnit durationUnits () const
 Returns the units of the event's duration. More...
 
QString endExpression () const
 Returns the expression for the end time for the feature's time spans. More...
 
QString endField () const
 Returns the name of the end datetime field, which contains the end time for the feature's time spans. More...
 
double fixedDuration () const
 Returns the fixed duration length, which contains the duration of the event. More...
 
const QgsDateTimeRange & fixedTemporalRange () const
 Returns the fixed temporal range for the layer. More...
 
QgsTemporalProperty::Flags flags () const override
 Returns flags associated to the temporal property. More...
 
void guessDefaultsFromFields (const QgsFields &fields)
 Attempts to setup the temporal properties by scanning a set of fields and looking for standard naming conventions (e.g. More...
 
bool isVisibleInTemporalRange (const QgsDateTimeRange &range) const override
 Returns true if the layer should be visible and rendered for the specified time range. More...
 
Qgis::VectorTemporalLimitMode limitMode () const
 Returns the temporal limit mode (to include or exclude begin/end limits). More...
 
Qgis::VectorTemporalMode mode () const
 Returns the temporal properties mode. More...
 
bool readXml (const QDomElement &element, const QgsReadWriteContext &context) override
 Reads temporal properties from a DOM element previously written by writeXml(). More...
 
void setAccumulateFeatures (bool accumulate)
 Sets whether features will be accumulated over time (i.e. More...
 
void setDefaultsFromDataProviderTemporalCapabilities (const QgsDataProviderTemporalCapabilities *capabilities) override
 Sets the layers temporal settings to appropriate defaults based on a provider's temporal capabilities. More...
 
void setDurationField (const QString &field)
 Sets the name of the duration field, which contains the duration of the event. More...
 
void setDurationUnits (QgsUnitTypes::TemporalUnit units)
 Sets the units of the event's duration. More...
 
void setEndExpression (const QString &endExpression)
 Sets the expression to use for the end time for the feature's time spans. More...
 
void setEndField (const QString &field)
 Sets the name of the end datetime field, which contains the end time for the feature's time spans. More...
 
void setFixedDuration (double duration)
 Sets the fixed event duration, which contains the duration of the event. More...
 
void setFixedTemporalRange (const QgsDateTimeRange &range)
 Sets a temporal range to apply to the whole layer. More...
 
void setLimitMode (Qgis::VectorTemporalLimitMode mode)
 Sets the temporal limit mode (to include or exclude begin/end limits). More...
 
void setMode (Qgis::VectorTemporalMode mode)
 Sets the temporal properties mode. More...
 
void setStartExpression (const QString &expression)
 Sets the expression to use for the start time for the feature's time spans. More...
 
void setStartField (const QString &field)
 Sets the name of the start datetime field, which contains the start time for the feature's time spans. More...
 
QString startExpression () const
 Returns the expression for the start time for the feature's time spans. More...
 
QString startField () const
 Returns the name of the start datetime field, which contains the start time for the feature's time spans. More...
 
QDomElement writeXml (QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context) override
 Writes the properties to a DOM element, to be used later with readXml(). More...
 
- Public Member Functions inherited from QgsMapLayerTemporalProperties
 QgsMapLayerTemporalProperties (QObject *parent, bool enabled=false)
 Constructor for QgsMapLayerTemporalProperties, with the specified parent object. More...
 
virtual QList< QgsDateTimeRange > allTemporalRanges (QgsMapLayer *layer) const
 Attempts to calculate the overall list of all temporal extents which are contained in the specified layer, using the settings defined by the temporal properties object. More...
 
- Public Member Functions inherited from QgsTemporalProperty
 QgsTemporalProperty (QObject *parent=nullptr, bool enabled=false)
 Constructor for QgsTemporalProperty, with the specified parent object. More...
 
bool isActive () const
 Returns true if the temporal property is active. More...
 
void setIsActive (bool active)
 Sets whether the temporal property is active. More...
 

Additional Inherited Members

- Public Types inherited from QgsTemporalProperty
enum  Flag { FlagDontInvalidateCachedRendersWhenRangeChanges = 1 }
 Flags attached to the temporal property. More...
 
- Signals inherited from QgsTemporalProperty
void changed ()
 Emitted when the temporal properties have changed. More...
 

Detailed Description

Implementation of map layer temporal properties for vector layers.

Since
QGIS 3.14

Definition at line 70 of file qgsvectorlayertemporalproperties.h.

Constructor & Destructor Documentation

◆ QgsVectorLayerTemporalProperties()

QgsVectorLayerTemporalProperties::QgsVectorLayerTemporalProperties ( QObject *  parent = nullptr,
bool  enabled = false 
)

Constructor for QgsVectorLayerTemporalProperties, with the specified parent object.

The enabled argument specifies whether the temporal properties are initially enabled or not (see isActive()).

Definition at line 25 of file qgsvectorlayertemporalproperties.cpp.

Member Function Documentation

◆ accumulateFeatures()

bool QgsVectorLayerTemporalProperties::accumulateFeatures ( ) const

Returns true if features will be accumulated over time (i.e.

all features which occur before or within the map's temporal range should be rendered).

Warning
This setting is only effective when mode() is QgsVectorLayerTemporalProperties::ModeFeatureDateTimeInstantFromField
See also
setAccumulateFeatures()

Definition at line 375 of file qgsvectorlayertemporalproperties.cpp.

◆ calculateTemporalExtent()

QgsDateTimeRange QgsVectorLayerTemporalProperties::calculateTemporalExtent ( QgsMapLayer layer) const
overridevirtual

Attempts to calculate the overall temporal extent for the specified layer, using the settings defined by the temporal properties object.

May return an infinite range if the extent could not be calculated.

Note
Not available in Python bindings

Reimplemented from QgsMapLayerTemporalProperties.

Definition at line 50 of file qgsvectorlayertemporalproperties.cpp.

◆ createFilterString()

QString QgsVectorLayerTemporalProperties::createFilterString ( const QgsVectorLayerTemporalContext context,
const QgsDateTimeRange &  range 
) const

Creates a QGIS expression filter string for filtering features within the specified context to those within the specified time range.

The returned expression string considers the mode() and other related settings (such as startField()) when building the filter string.

Warning
Note that ModeFixedTemporalRange is intentional NOT handled by this method and if mode() is ModeFixedTemporalRange then an empty string will be returned. Use isVisibleInTemporalRange() when testing whether features from a layer set to the ModeFixedTemporalRange should ALL be filtered out.

Definition at line 445 of file qgsvectorlayertemporalproperties.cpp.

◆ durationField()

QString QgsVectorLayerTemporalProperties::durationField ( ) const

Returns the name of the duration field, which contains the duration of the event.

Units are specified by durationUnits()

Warning
This setting is only effective when mode() is QgsVectorLayerTemporalProperties::ModeFeatureDateTimeStartAndDurationFromFields
See also
setDurationField()
durationUnits()

Definition at line 415 of file qgsvectorlayertemporalproperties.cpp.

◆ durationUnits()

QgsUnitTypes::TemporalUnit QgsVectorLayerTemporalProperties::durationUnits ( ) const

Returns the units of the event's duration.

See also
setDurationUnits()

Definition at line 425 of file qgsvectorlayertemporalproperties.cpp.

◆ endExpression()

QString QgsVectorLayerTemporalProperties::endExpression ( ) const

Returns the expression for the end time for the feature's time spans.

Warning
This setting is only effective when mode() is QgsVectorLayerTemporalProperties::ModeFeatureDateTimeStartAndEndFromExpressions
See also
setEndExpression()
startExpression()

Definition at line 365 of file qgsvectorlayertemporalproperties.cpp.

◆ endField()

QString QgsVectorLayerTemporalProperties::endField ( ) const

Returns the name of the end datetime field, which contains the end time for the feature's time spans.

See also
setEndField()
startField()

Definition at line 405 of file qgsvectorlayertemporalproperties.cpp.

◆ fixedDuration()

double QgsVectorLayerTemporalProperties::fixedDuration ( ) const

Returns the fixed duration length, which contains the duration of the event.

Units are specified by durationUnits()

Warning
This setting is only effective when mode() is QgsVectorLayerTemporalProperties::ModeFeatureDateTimeInstantFromField
See also
setFixedDuration()
durationUnits()

Definition at line 385 of file qgsvectorlayertemporalproperties.cpp.

◆ fixedTemporalRange()

const QgsDateTimeRange & QgsVectorLayerTemporalProperties::fixedTemporalRange ( ) const

Returns the fixed temporal range for the layer.

Warning
To be used only when mode() is QgsVectorLayerTemporalProperties::ModeFixedTemporalRange
See also
setFixedTemporalRange()

Definition at line 254 of file qgsvectorlayertemporalproperties.cpp.

◆ flags()

QgsTemporalProperty::Flags QgsVectorLayerTemporalProperties::flags ( ) const
overridevirtual

Returns flags associated to the temporal property.

Reimplemented from QgsTemporalProperty.

Definition at line 244 of file qgsvectorlayertemporalproperties.cpp.

◆ guessDefaultsFromFields()

void QgsVectorLayerTemporalProperties::guessDefaultsFromFields ( const QgsFields fields)

Attempts to setup the temporal properties by scanning a set of fields and looking for standard naming conventions (e.g.

"begin_date").

Definition at line 609 of file qgsvectorlayertemporalproperties.cpp.

◆ isVisibleInTemporalRange()

bool QgsVectorLayerTemporalProperties::isVisibleInTemporalRange ( const QgsDateTimeRange &  range) const
overridevirtual

Returns true if the layer should be visible and rendered for the specified time range.

Reimplemented from QgsMapLayerTemporalProperties.

Definition at line 30 of file qgsvectorlayertemporalproperties.cpp.

◆ limitMode()

Qgis::VectorTemporalLimitMode QgsVectorLayerTemporalProperties::limitMode ( ) const

Returns the temporal limit mode (to include or exclude begin/end limits).

See also
setLimitMode()
Since
QGIS 3.22

Definition at line 232 of file qgsvectorlayertemporalproperties.cpp.

◆ mode()

Qgis::VectorTemporalMode QgsVectorLayerTemporalProperties::mode ( ) const

Returns the temporal properties mode.

See also
setMode()

Definition at line 220 of file qgsvectorlayertemporalproperties.cpp.

◆ readXml()

bool QgsVectorLayerTemporalProperties::readXml ( const QDomElement &  element,
const QgsReadWriteContext context 
)
overridevirtual

Reads temporal properties from a DOM element previously written by writeXml().

See also
writeXml()

Implements QgsMapLayerTemporalProperties.

Definition at line 259 of file qgsvectorlayertemporalproperties.cpp.

◆ setAccumulateFeatures()

void QgsVectorLayerTemporalProperties::setAccumulateFeatures ( bool  accumulate)

Sets whether features will be accumulated over time (i.e.

all features which occur before or within the map's temporal range should be rendered).

Warning
This setting is only effective when mode() is QgsVectorLayerTemporalProperties::ModeFeatureDateTimeInstantFromField
See also
accumulateFeatures()

Definition at line 380 of file qgsvectorlayertemporalproperties.cpp.

◆ setDefaultsFromDataProviderTemporalCapabilities()

void QgsVectorLayerTemporalProperties::setDefaultsFromDataProviderTemporalCapabilities ( const QgsDataProviderTemporalCapabilities capabilities)
overridevirtual

Sets the layers temporal settings to appropriate defaults based on a provider's temporal capabilities.

Implements QgsMapLayerTemporalProperties.

Definition at line 332 of file qgsvectorlayertemporalproperties.cpp.

◆ setDurationField()

void QgsVectorLayerTemporalProperties::setDurationField ( const QString &  field)

Sets the name of the duration field, which contains the duration of the event.

Units are specified by setDurationUnits()

Warning
This setting is only effective when mode() is QgsVectorLayerTemporalProperties::ModeFeatureDateTimeStartAndDurationFromFields
See also
durationField()
setDurationUnits()

Definition at line 420 of file qgsvectorlayertemporalproperties.cpp.

◆ setDurationUnits()

void QgsVectorLayerTemporalProperties::setDurationUnits ( QgsUnitTypes::TemporalUnit  units)

Sets the units of the event's duration.

See also
durationUnits()

Definition at line 430 of file qgsvectorlayertemporalproperties.cpp.

◆ setEndExpression()

void QgsVectorLayerTemporalProperties::setEndExpression ( const QString &  endExpression)

Sets the expression to use for the end time for the feature's time spans.

Warning
This setting is only effective when mode() is QgsVectorLayerTemporalProperties::ModeFeatureDateTimeStartAndEndFromExpressions
See also
endExpression()
setStartExpression()

Definition at line 370 of file qgsvectorlayertemporalproperties.cpp.

◆ setEndField()

void QgsVectorLayerTemporalProperties::setEndField ( const QString &  field)

Sets the name of the end datetime field, which contains the end time for the feature's time spans.

See also
endField()
setStartField()

Definition at line 410 of file qgsvectorlayertemporalproperties.cpp.

◆ setFixedDuration()

void QgsVectorLayerTemporalProperties::setFixedDuration ( double  duration)

Sets the fixed event duration, which contains the duration of the event.

Units are specified by setDurationUnits()

Warning
This setting is only effective when mode() is QgsVectorLayerTemporalProperties::ModeFeatureDateTimeInstantFromField
See also
fixedDuration()
setDurationUnits()

Definition at line 390 of file qgsvectorlayertemporalproperties.cpp.

◆ setFixedTemporalRange()

void QgsVectorLayerTemporalProperties::setFixedTemporalRange ( const QgsDateTimeRange &  range)

Sets a temporal range to apply to the whole layer.

All features from the layer will be rendered whenever the current datetime range of a render context intersects the specified range.

Warning
This setting is only effective when mode() is QgsVectorLayerTemporalProperties::ModeFixedTemporalRange
See also
fixedTemporalRange()

Definition at line 249 of file qgsvectorlayertemporalproperties.cpp.

◆ setLimitMode()

void QgsVectorLayerTemporalProperties::setLimitMode ( Qgis::VectorTemporalLimitMode  mode)

Sets the temporal limit mode (to include or exclude begin/end limits).

See also
limitMode()
Since
QGIS 3.22

Definition at line 237 of file qgsvectorlayertemporalproperties.cpp.

◆ setMode()

void QgsVectorLayerTemporalProperties::setMode ( Qgis::VectorTemporalMode  mode)

Sets the temporal properties mode.

See also
mode()

Definition at line 225 of file qgsvectorlayertemporalproperties.cpp.

◆ setStartExpression()

void QgsVectorLayerTemporalProperties::setStartExpression ( const QString &  expression)

Sets the expression to use for the start time for the feature's time spans.

Warning
This setting is only effective when mode() is QgsVectorLayerTemporalProperties::ModeFeatureDateTimeStartAndEndFromExpressions
See also
startExpression()
setEndExpression()

Definition at line 360 of file qgsvectorlayertemporalproperties.cpp.

◆ setStartField()

void QgsVectorLayerTemporalProperties::setStartField ( const QString &  field)

Sets the name of the start datetime field, which contains the start time for the feature's time spans.

If mode() is ModeFeatureDateTimeInstantFromField, then this field represents both the start AND end times.

See also
startField()
setEndField()

Definition at line 400 of file qgsvectorlayertemporalproperties.cpp.

◆ startExpression()

QString QgsVectorLayerTemporalProperties::startExpression ( ) const

Returns the expression for the start time for the feature's time spans.

Warning
This setting is only effective when mode() is QgsVectorLayerTemporalProperties::ModeFeatureDateTimeStartAndEndFromExpressions
See also
setStartExpression()
endExpression()

Definition at line 355 of file qgsvectorlayertemporalproperties.cpp.

◆ startField()

QString QgsVectorLayerTemporalProperties::startField ( ) const

Returns the name of the start datetime field, which contains the start time for the feature's time spans.

If mode() is ModeFeatureDateTimeInstantFromField, then this field represents both the start AND end times.

See also
setStartField()
endField()

Definition at line 395 of file qgsvectorlayertemporalproperties.cpp.

◆ writeXml()

QDomElement QgsVectorLayerTemporalProperties::writeXml ( QDomElement &  element,
QDomDocument &  doc,
const QgsReadWriteContext context 
)
overridevirtual

Writes the properties to a DOM element, to be used later with readXml().

See also
readXml()

Implements QgsMapLayerTemporalProperties.

Definition at line 293 of file qgsvectorlayertemporalproperties.cpp.


The documentation for this class was generated from the following files: