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();