QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
35 return range.isInfinite() || mFixedRange.isInfinite() || mFixedRange.overlaps( range );
45 QgsRasterLayer *rasterLayer = qobject_cast< QgsRasterLayer *>( layer );
47 return QgsDateTimeRange();
58 return QgsDateTimeRange();
80 return mIntervalHandlingMethod;
85 if ( mIntervalHandlingMethod == method )
87 mIntervalHandlingMethod = method;
105 QDomElement temporalNode = element.firstChildElement( QStringLiteral(
"temporal" ) );
107 setIsActive( temporalNode.attribute( QStringLiteral(
"enabled" ), QStringLiteral(
"0" ) ).toInt() );
109 mMode =
static_cast< TemporalMode >( temporalNode.attribute( QStringLiteral(
"mode" ), QStringLiteral(
"0" ) ). toInt() );
112 QDomNode rangeElement = temporalNode.namedItem( QStringLiteral(
"fixedRange" ) );
114 QDomNode begin = rangeElement.namedItem( QStringLiteral(
"start" ) );
115 QDomNode end = rangeElement.namedItem( QStringLiteral(
"end" ) );
117 QDateTime beginDate = QDateTime::fromString( begin.toElement().text(), Qt::ISODate );
118 QDateTime endDate = QDateTime::fromString( end.toElement().text(), Qt::ISODate );
120 QgsDateTimeRange range = QgsDateTimeRange( beginDate, endDate );
129 if ( element.isNull() )
130 return QDomElement();
132 QDomElement temporalElement = document.createElement( QStringLiteral(
"temporal" ) );
133 temporalElement.setAttribute( QStringLiteral(
"enabled" ),
isActive() ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
134 temporalElement.setAttribute( QStringLiteral(
"mode" ), QString::number( mMode ) );
135 temporalElement.setAttribute( QStringLiteral(
"fetchMode" ), QString::number( mIntervalHandlingMethod ) );
137 QDomElement rangeElement = document.createElement( QStringLiteral(
"fixedRange" ) );
139 QDomElement startElement = document.createElement( QStringLiteral(
"start" ) );
140 QDomElement endElement = document.createElement( QStringLiteral(
"end" ) );
142 QDomText startText = document.createTextNode( mFixedRange.begin().toTimeSpec( Qt::OffsetFromUTC ).toString( Qt::ISODate ) );
143 QDomText endText = document.createTextNode( mFixedRange.end().toTimeSpec( Qt::OffsetFromUTC ).toString( Qt::ISODate ) );
144 startElement.appendChild( startText );
145 endElement.appendChild( endText );
146 rangeElement.appendChild( startElement );
147 rangeElement.appendChild( endElement );
149 temporalElement.appendChild( rangeElement );
151 element.appendChild( temporalElement );
160 setIsActive( rasterCaps->hasTemporalCapabilities() );
163 if ( rasterCaps->hasTemporalCapabilities() )
168 mIntervalHandlingMethod = rasterCaps->intervalHandlingMethod();
The class is used as a container of context for various read/write operations on other objects.
const QgsDateTimeRange & availableTemporalRange() const
Returns the datetime range extent from which temporal data is available from the provider.
TemporalMode
Mode of the raster temporal properties.
QgsRasterLayerTemporalProperties(QObject *parent=nullptr, bool enabled=false)
Constructor for QgsRasterLayerTemporalProperties, with the specified parent object.
IntervalHandlingMethod
Method to use when resolving a temporal range to a data provider layer or band.
void setIntervalHandlingMethod(QgsRasterDataProviderTemporalCapabilities::IntervalHandlingMethod method)
Sets the desired method to use when resolving a temporal interval to matching layers or bands in the ...
@ ModeTemporalRangeFromDataProvider
Mode when raster layer delegates temporal range handling to the dataprovider.
Base class for handling properties relating to a data provider's temporal capabilities.
@ ModeFixedTemporalRange
Mode when temporal properties have fixed start and end datetimes.
bool readXml(const QDomElement &element, const QgsReadWriteContext &context) override
Reads temporal properties from a DOM element previously written by writeXml().
bool isActive() const
Returns true if the temporal property is active.
void setFixedTemporalRange(const QgsDateTimeRange &range)
Sets a temporal range to apply to the whole layer.
QgsRasterDataProviderTemporalCapabilities * temporalCapabilities() override
Returns the provider's temporal capabilities.
QgsRasterDataProvider * dataProvider() override
Returns the source data provider.
TemporalMode mode() const
Returns the temporal properties mode.
Base class for storage of map layer temporal properties.
bool isVisibleInTemporalRange(const QgsDateTimeRange &range) const override
Returns true if the layer should be visible and rendered for the specified time range.
Represents a raster layer.
void setIsActive(bool active)
Sets whether the temporal property is active.
QgsRasterDataProviderTemporalCapabilities::IntervalHandlingMethod intervalHandlingMethod() const
Returns the desired method to use when resolving a temporal interval to matching layers or bands in t...
void setDefaultsFromDataProviderTemporalCapabilities(const QgsDataProviderTemporalCapabilities *capabilities) override
Sets the layers temporal settings to appropriate defaults based on a provider's temporal capabilities...
void setMode(TemporalMode mode)
Sets the temporal properties mode.
Base class for all map layer types.
QgsTemporalProperty::Flags flags() const override
Returns flags associated to the temporal property.
const QgsDateTimeRange & fixedTemporalRange() const
Returns the fixed temporal range for the layer.
QDomElement writeXml(QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context) override
Writes the properties to a DOM element, to be used later with readXml().
QgsDateTimeRange calculateTemporalExtent(QgsMapLayer *layer) const override
Attempts to calculate the overall temporal extent for the specified layer, using the settings defined...
@ FlagDontInvalidateCachedRendersWhenRangeChanges
Any cached rendering will not be invalidated when temporal range context is modified.
Implementation of data provider temporal properties for QgsRasterDataProviders.