QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
31 QDomElement temporalElement = doc.createElement( QStringLiteral(
"temporal" ) );
32 temporalElement.setAttribute( QStringLiteral(
"temporal-active" ),
isActive() ?
true :
false );
33 temporalElement.setAttribute( QStringLiteral(
"reference-time" ), mReferenceTime.toTimeSpec( Qt::UTC ).toString( Qt::ISODate ) );
34 temporalElement.setAttribute( QStringLiteral(
"start-time-extent" ), mTimeExtent.begin().toTimeSpec( Qt::UTC ).toString( Qt::ISODate ) );
35 temporalElement.setAttribute( QStringLiteral(
"end-time-extent" ), mTimeExtent.end().toTimeSpec( Qt::UTC ).toString( Qt::ISODate ) );
36 temporalElement.setAttribute( QStringLiteral(
"matching-method" ), mMatchingMethod );
38 element.appendChild( temporalElement );
47 const QDomElement temporalElement = element.firstChildElement( QStringLiteral(
"temporal" ) );
48 const bool active = temporalElement.attribute( QStringLiteral(
"temporal-active" ) ).toInt();
51 mReferenceTime = QDateTime::fromString( temporalElement.attribute( QStringLiteral(
"reference-time" ) ), Qt::ISODate );
53 if ( temporalElement.hasAttribute( QStringLiteral(
"start-time-extent" ) )
54 && temporalElement.hasAttribute( QStringLiteral(
"end-time-extent" ) ) )
56 const QDateTime start = QDateTime::fromString( temporalElement.attribute( QStringLiteral(
"start-time-extent" ) ), Qt::ISODate );
57 const QDateTime end = QDateTime::fromString( temporalElement.attribute( QStringLiteral(
"end-time-extent" ) ), Qt::ISODate );
58 mTimeExtent = QgsDateTimeRange( start, end );
62 temporalElement.attribute( QStringLiteral(
"matching-method" ) ).toInt() );
76 if ( mReferenceTime.isValid() )
77 mTimeExtent = temporalCapabilities->
timeExtent();
94 return mReferenceTime;
111 return mMatchingMethod;
The class is used as a container of context for various read/write operations on other objects.
Class for handling properties relating to a mesh data provider's temporal capabilities.
bool isValid() const
Returns whether the instance is valid.
QgsMeshLayerTemporalProperties(QObject *parent=nullptr, bool enabled=true)
Constructor for QgsMeshLayerTemporalProperties.
void setMatchingMethod(const QgsMeshDataProviderTemporalCapabilities::MatchingTemporalDatasetMethod &matchingMethod)
Sets the method used to match dataset from temporal capabilities.
void setReferenceTime(const QDateTime &referenceTime, const QgsDataProviderTemporalCapabilities *capabilities)
Sets the reference time and update the time extent from the temporal capabilities,...
QgsDateTimeRange calculateTemporalExtent(QgsMapLayer *layer) const override
Attempts to calculate the overall temporal extent for the specified layer, using the settings defined...
QgsDateTimeRange timeExtent() const
Returns the time extent.
Base class for handling properties relating to a data provider's temporal capabilities.
bool isActive() const
Returns true if the temporal property is active.
bool readXml(const QDomElement &element, const QgsReadWriteContext &context) override
Reads temporal properties from a DOM element previously written by writeXml().
QDateTime referenceTime() const
Returns the reference time.
MatchingTemporalDatasetMethod
Method for selection of temporal mesh dataset from a range time.
Base class for storage of map layer temporal properties.
void setDefaultsFromDataProviderTemporalCapabilities(const QgsDataProviderTemporalCapabilities *capabilities) override
Sets the layers temporal settings to appropriate defaults based on a provider's temporal capabilities...
void setIsActive(bool active)
Sets whether the temporal property is active.
Base class for all map layer types. This is the base class for all map layer types (vector,...
void setIsValid(bool isValid)
Sets whether the instance is valid.
bool hasTemporalCapabilities() const
Returns true if the provider has temporal capabilities available.
QgsMeshDataProviderTemporalCapabilities::MatchingTemporalDatasetMethod matchingMethod() const
Returns the method used to match dataset from temporal capabilities.
QDomElement writeXml(QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context) override
Writes the properties to a DOM element, to be used later with readXml().
QgsDateTimeRange timeExtent() const
Returns the time extent using the internal reference time and the first and last times available from...
QDateTime referenceTime() const
Returns the reference time.