20 #include <QDomElement>
30 mRange = QgsDateTimeRange();
41 if ( range == mRange )
50 QDomElement temporalElement = element.firstChildElement( QStringLiteral(
"TemporalRange" ) );
51 if ( !temporalElement.isNull() )
53 QDomNode begin = temporalElement.namedItem( QStringLiteral(
"start" ) );
54 QDomNode end = temporalElement.namedItem( QStringLiteral(
"end" ) );
56 QDateTime beginDate = QDateTime::fromString( begin.toElement().text(), Qt::ISODate );
57 QDateTime endDate = QDateTime::fromString( end.toElement().text(), Qt::ISODate );
64 mTimeStep = element.attribute( QStringLiteral(
"timeStep" ),
"1" ).toDouble();
65 mFrameRate = element.attribute( QStringLiteral(
"frameRate" ),
"1" ).toDouble();
66 mCumulativeTemporalRange = element.attribute( QStringLiteral(
"cumulativeTemporalRange" ),
"0" ).toInt();
73 QDomElement element = document.createElement( QStringLiteral(
"ProjectTimeSettings" ) );
75 if ( mRange.begin().isValid() && mRange.end().isValid() )
77 QDomElement temporalElement = document.createElement( QStringLiteral(
"TemporalRange" ) );
78 QDomElement startElement = document.createElement( QStringLiteral(
"start" ) );
79 QDomElement endElement = document.createElement( QStringLiteral(
"end" ) );
81 QDomText startText = document.createTextNode( mRange.begin().toTimeSpec( Qt::OffsetFromUTC ).toString( Qt::ISODate ) );
82 QDomText endText = document.createTextNode( mRange.end().toTimeSpec( Qt::OffsetFromUTC ).toString( Qt::ISODate ) );
84 startElement.appendChild( startText );
85 endElement.appendChild( endText );
87 temporalElement.appendChild( startElement );
88 temporalElement.appendChild( endElement );
90 element.appendChild( temporalElement );
94 element.setAttribute( QStringLiteral(
"timeStep" ),
qgsDoubleToString( mTimeStep ) );
95 element.setAttribute( QStringLiteral(
"frameRate" ),
qgsDoubleToString( mFrameRate ) );
96 element.setAttribute( QStringLiteral(
"cumulativeTemporalRange" ), mCumulativeTemporalRange ? 1 : 0 );
103 return mTimeStepUnit;
108 mTimeStepUnit = unit;
133 mCumulativeTemporalRange = state;
137 return mCumulativeTemporalRange;