32#include <QRegularExpression> 
   41  mStartDateTime->setDateTimeRange( QDateTime( QDate( 1, 1, 1 ), QTime( 0, 0, 0 ) ), mStartDateTime->maximumDateTime() );
 
   42  mEndDateTime->setDateTimeRange( QDateTime( QDate( 1, 1, 1 ), QTime( 0, 0, 0 ) ), mStartDateTime->maximumDateTime() );
 
   43  mFixedRangeStartDateTime->setDateTimeRange( QDateTime( QDate( 1, 1, 1 ), QTime( 0, 0, 0 ) ), mStartDateTime->maximumDateTime() );
 
   44  mFixedRangeEndDateTime->setDateTimeRange( QDateTime( QDate( 1, 1, 1 ), QTime( 0, 0, 0 ) ), mStartDateTime->maximumDateTime() );
 
   63        mNavigationObject->
pause();
 
   71        mNavigationObject->
next();
 
   82  connect( mAnimationLoopingCheckBox, &QCheckBox::toggled, 
this, [ = ]( 
bool state ) { mNavigationObject->
setLooping( state ); mMovieLoopingCheckBox->setChecked( state ); } );
 
   83  connect( mMovieLoopingCheckBox, &QCheckBox::toggled, 
this, [ = ]( 
bool state ) { mNavigationObject->
setLooping( state );  mAnimationLoopingCheckBox->setChecked( state ); } );
 
   85  setWidgetStateFromNavigationMode( mNavigationObject->
navigationMode() );
 
   90    if ( mBlockFrameDurationUpdates )
 
   93    mBlockFrameDurationUpdates++;
 
   94    updateTimeStepInputs( timeStep );
 
   95    mBlockFrameDurationUpdates--;
 
   97  connect( mNavigationOff, &QPushButton::clicked, 
this, &QgsTemporalControllerWidget::mNavigationOff_clicked );
 
   98  connect( mNavigationFixedRange, &QPushButton::clicked, 
this, &QgsTemporalControllerWidget::mNavigationFixedRange_clicked );
 
   99  connect( mNavigationAnimated, &QPushButton::clicked, 
this, &QgsTemporalControllerWidget::mNavigationAnimated_clicked );
 
  100  connect( mNavigationMovie, &QPushButton::clicked, 
this, &QgsTemporalControllerWidget::mNavigationMovie_clicked );
 
  104    mAnimationController->setState( state );
 
  105    mMovieController->setState( state );
 
  108  connect( mStartDateTime, &QDateTimeEdit::dateTimeChanged, 
this, &QgsTemporalControllerWidget::startEndDateTime_changed );
 
  109  connect( mEndDateTime, &QDateTimeEdit::dateTimeChanged, 
this, &QgsTemporalControllerWidget::startEndDateTime_changed );
 
  110  connect( mFixedRangeStartDateTime, &QDateTimeEdit::dateTimeChanged, 
this, &QgsTemporalControllerWidget::fixedRangeStartEndDateTime_changed );
 
  111  connect( mFixedRangeEndDateTime, &QDateTimeEdit::dateTimeChanged, 
this, &QgsTemporalControllerWidget::fixedRangeStartEndDateTime_changed );
 
  112  connect( mStepSpinBox, qOverload<double>( &QDoubleSpinBox::valueChanged ), 
this, &QgsTemporalControllerWidget::updateFrameDuration );
 
  113  connect( mTimeStepsComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), 
this, &QgsTemporalControllerWidget::updateFrameDuration );
 
  114  connect( mAnimationSlider, &QSlider::valueChanged, 
this, &QgsTemporalControllerWidget::timeSlider_valueChanged );
 
  115  connect( mMovieSlider, &QSlider::valueChanged, 
this, &QgsTemporalControllerWidget::timeSlider_valueChanged );
 
  117  connect( mTotalFramesSpinBox, qOverload<int>( &QSpinBox::valueChanged ), 
this, [ = ]( 
int frames )
 
  122  mStepSpinBox->setClearValue( 1 );
 
  127  connect( mSettings, &QPushButton::clicked, 
this, &QgsTemporalControllerWidget::settings_clicked );
 
  131  mRangeMenu.reset( 
new QMenu( 
this ) );
 
  133  mRangeSetToAllLayersAction = 
new QAction( tr( 
"Set to Full Range" ), mRangeMenu.get() );
 
  135  connect( mRangeSetToAllLayersAction, &QAction::triggered, 
this, &QgsTemporalControllerWidget::mRangeSetToAllLayersAction_triggered );
 
  136  mRangeMenu->addAction( mRangeSetToAllLayersAction );
 
  138  mRangeSetToProjectAction = 
new QAction( tr( 
"Set to Preset Project Range" ), mRangeMenu.get() );
 
  139  connect( mRangeSetToProjectAction, &QAction::triggered, 
this, &QgsTemporalControllerWidget::mRangeSetToProjectAction_triggered );
 
  140  mRangeMenu->addAction( mRangeSetToProjectAction );
 
  142  mRangeMenu->addSeparator();
 
  144  mRangeLayersSubMenu.reset( 
new QMenu( tr( 
"Set to Single Layer's Range" ), mRangeMenu.get() ) );
 
  145  mRangeLayersSubMenu->setEnabled( 
false );
 
  146  mRangeMenu->addMenu( mRangeLayersSubMenu.get() );
 
  147  connect( mRangeMenu.get(), &QMenu::aboutToShow, 
this, &QgsTemporalControllerWidget::aboutToShowRangeMenu );
 
  149  mSetRangeButton->setPopupMode( QToolButton::MenuButtonPopup );
 
  150  mSetRangeButton->setMenu( mRangeMenu.get() );
 
  151  mSetRangeButton->setDefaultAction( mRangeSetToAllLayersAction );
 
  152  mFixedRangeSetRangeButton->setPopupMode( QToolButton::MenuButtonPopup );
 
  153  mFixedRangeSetRangeButton->setMenu( mRangeMenu.get() );
 
  154  mFixedRangeSetRangeButton->setDefaultAction( mRangeSetToAllLayersAction );
 
  164  if ( range.
begin().isValid() && range.
end().isValid() )
 
  194  mStepSpinBox->setDecimals( 3 );
 
  196  mStepSpinBox->setMinimum( 0.001 );
 
  197  mStepSpinBox->setMaximum( std::numeric_limits<int>::max() );
 
  198  mStepSpinBox->setSingleStep( 1 );
 
  199  mStepSpinBox->setValue( 1 );
 
  201  updateFrameDuration();
 
 
  215  if ( ( mAnimationSlider->hasFocus() || mMovieSlider->hasFocus() ) && e->key() == Qt::Key_Space )
 
  217    mAnimationController->togglePause();
 
 
  223void QgsTemporalControllerWidget::aboutToShowRangeMenu()
 
  228  mRangeSetToProjectAction->setEnabled( projectRange.
begin().isValid() && projectRange.
end().isValid() );
 
  230  mRangeLayersSubMenu->clear();
 
  231  for ( 
int i = 0; i < mMapLayerModel->
rowCount(); ++i )
 
  233    const QModelIndex index = mMapLayerModel->
index( i, 0 );
 
  238    const QIcon icon = qvariant_cast<QIcon>( mMapLayerModel->
data( index, Qt::DecorationRole ) );
 
  239    const QString text = mMapLayerModel->
data( index, Qt::DisplayRole ).toString();
 
  241    if ( range.
begin().isValid() && range.
end().isValid() )
 
  243      QAction *action = 
new QAction( icon, text, mRangeLayersSubMenu.get() );
 
  244      connect( action, &QAction::triggered, 
this, [ = ]
 
  247        saveRangeToProject();
 
  249      mRangeLayersSubMenu->addAction( action );
 
  252  mRangeLayersSubMenu->setEnabled( !mRangeLayersSubMenu->actions().isEmpty() );
 
  255void QgsTemporalControllerWidget::updateTemporalExtent()
 
  259  const QDateTime start = mStartDateTime->dateTime();
 
  260  const QDateTime end = mEndDateTime->dateTime();
 
  261  const bool isTimeInstant = start == end;
 
  265  mAnimationSlider->setRange( 0, mNavigationObject->
totalFrameCount() - 1 );
 
  271void QgsTemporalControllerWidget::updateFrameDuration()
 
  273  if ( mBlockSettingUpdates )
 
  281  if ( !mBlockFrameDurationUpdates )
 
  288  mAnimationSlider->setRange( 0, mNavigationObject->
totalFrameCount() - 1 );
 
  295    mStepSpinBox->setEnabled( 
false );
 
  296    mStepSpinBox->setValue( 1 );
 
  297    mAnimationSlider->setTickInterval( 1 );
 
  298    mAnimationSlider->setTickPosition( QSlider::TicksBothSides );
 
  302    mStepSpinBox->setEnabled( 
true );
 
  303    mAnimationSlider->setTickInterval( 0 );
 
  304    mAnimationSlider->setTickPosition( QSlider::NoTicks );
 
  308void QgsTemporalControllerWidget::setWidgetStateFromProject()
 
  310  mBlockSettingUpdates++;
 
  313  mBlockSettingUpdates--;
 
  317      QStringLiteral( 
"/NavigationMode" ), 0, &ok ) );
 
  321    setWidgetStateFromNavigationMode( mode );
 
  332  const QString startString = 
QgsProject::instance()->
readEntry( QStringLiteral( 
"TemporalControllerWidget" ), QStringLiteral( 
"/StartDateTime" ) );
 
  333  const QString endString = 
QgsProject::instance()->
readEntry( QStringLiteral( 
"TemporalControllerWidget" ), QStringLiteral( 
"/EndDateTime" ) );
 
  334  if ( !startString.isEmpty() && !endString.isEmpty() )
 
  336    whileBlocking( mStartDateTime )->setDateTime( QDateTime::fromString( startString, Qt::ISODateWithMs ) );
 
  337    whileBlocking( mEndDateTime )->setDateTime( QDateTime::fromString( endString, Qt::ISODateWithMs ) );
 
  338    whileBlocking( mFixedRangeStartDateTime )->setDateTime( QDateTime::fromString( startString, Qt::ISODateWithMs ) );
 
  339    whileBlocking( mFixedRangeEndDateTime )->setDateTime( QDateTime::fromString( endString, Qt::ISODateWithMs ) );
 
  343    setDatesToProjectTime( 
false );
 
  345  updateTemporalExtent();
 
  346  updateFrameDuration();
 
  352void QgsTemporalControllerWidget::mNavigationOff_clicked()
 
  361void QgsTemporalControllerWidget::mNavigationFixedRange_clicked()
 
  370void QgsTemporalControllerWidget::mNavigationAnimated_clicked()
 
  379void QgsTemporalControllerWidget::mNavigationMovie_clicked()
 
  398      mNavigationModeStackedWidget->setCurrentIndex( 0 );
 
  401      mNavigationModeStackedWidget->setCurrentIndex( 1 );
 
  404      mNavigationModeStackedWidget->setCurrentIndex( 2 );
 
  407      mNavigationModeStackedWidget->setCurrentIndex( 3 );
 
  412void QgsTemporalControllerWidget::onLayersAdded( 
const QList<QgsMapLayer *> &layers )
 
  414  if ( !mHasTemporalLayersLoaded )
 
  418      if ( layer->temporalProperties() )
 
  420        mHasTemporalLayersLoaded |= layer->temporalProperties()->isActive();
 
  422        if ( !mHasTemporalLayersLoaded )
 
  426            if ( layer->isValid() && layer->temporalProperties()->isActive() && !mHasTemporalLayersLoaded )
 
  428              mHasTemporalLayersLoaded = true;
 
  429              firstTemporalLayerLoaded( layer );
 
  430              mNavigationObject->setAvailableTemporalRanges( QgsTemporalUtils::usedTemporalRangesForProject( QgsProject::instance() ) );
 
  435        firstTemporalLayerLoaded( layer );
 
  443void QgsTemporalControllerWidget::firstTemporalLayerLoaded( 
QgsMapLayer *layer )
 
  445  setDatesToProjectTime( 
true );
 
  447  if ( 
QgsMeshLayer *meshLayer = qobject_cast<QgsMeshLayer *>( layer ) )
 
  449    mBlockFrameDurationUpdates++;
 
  450    setTimeStep( meshLayer->firstValidTimeStep() );
 
  451    mBlockFrameDurationUpdates--;
 
  452    updateFrameDuration();
 
  454  else if ( 
QgsRasterLayer *rasterLayer = qobject_cast<QgsRasterLayer *>( layer ) )
 
  456    if ( rasterLayer->dataProvider() && rasterLayer->dataProvider()->temporalCapabilities() )
 
  458      mBlockFrameDurationUpdates++;
 
  459      setTimeStep( rasterLayer->dataProvider()->temporalCapabilities()->defaultInterval() );
 
  460      mBlockFrameDurationUpdates--;
 
  461      updateFrameDuration();
 
  466void QgsTemporalControllerWidget::onProjectCleared()
 
  468  mHasTemporalLayersLoaded = 
false;
 
  475  const QTime startOfCurrentHour = QTime( QTime::currentTime().hour(), 0, 0 );
 
  476  const QDateTime end = QDateTime( QDate::currentDate(), startOfCurrentHour, Qt::UTC );
 
  477  const QDateTime start = end.addSecs( -24 * 60 * 60 );
 
  481  whileBlocking( mFixedRangeStartDateTime )->setDateTime( start );
 
  484  updateTemporalExtent();
 
  486  mStepSpinBox->setValue( 1 );
 
  489void QgsTemporalControllerWidget::updateSlider( 
const QgsDateTimeRange &range )
 
  493  updateRangeLabel( range );
 
  496void QgsTemporalControllerWidget::totalMovieFramesChanged( 
long long frames )
 
  499  mTotalFramesSpinBox->setValue( frames );
 
  500  mCurrentRangeLabel->setText( tr( 
"Current frame: %1/%2" ).arg( mNavigationObject->
currentFrameNumber() ).arg( frames ) );
 
  503void QgsTemporalControllerWidget::updateRangeLabel( 
const QgsDateTimeRange &range )
 
  505  QString timeFrameFormat = QStringLiteral( 
"yyyy-MM-dd HH:mm:ss" );
 
  508    timeFrameFormat = QStringLiteral( 
"yyyy-MM-dd HH:mm:ss.zzz" );
 
  512      mCurrentRangeLabel->setText( tr( 
"Current frame: %1 ≤ <i>t</i> < %2" ).arg(
 
  513                                     range.
begin().toString( timeFrameFormat ),
 
  514                                     range.
end().toString( timeFrameFormat ) ) );
 
  517      mCurrentRangeLabel->setText( tr( 
"Range: %1 ≤ <i>t</i> < %2" ).arg(
 
  518                                     range.
begin().toString( timeFrameFormat ),
 
  519                                     range.
end().toString( timeFrameFormat ) ) );
 
  522      mCurrentRangeLabel->setText( tr( 
"Temporal navigation disabled" ) );
 
  532  return mNavigationObject;
 
 
  535void QgsTemporalControllerWidget::settings_clicked()
 
  537  QgsTemporalMapSettingsWidget *settingsWidget = 
new QgsTemporalMapSettingsWidget( 
this );
 
  538  settingsWidget->setFrameRateValue( mNavigationObject->
framesPerSecond() );
 
  541  connect( settingsWidget, &QgsTemporalMapSettingsWidget::frameRateChanged, 
this, [ = ]( 
double rate )
 
  548  connect( settingsWidget, &QgsTemporalMapSettingsWidget::temporalRangeCumulativeChanged, 
this, [ = ]( 
bool state )
 
  557void QgsTemporalControllerWidget::timeSlider_valueChanged( 
int value )
 
  562void QgsTemporalControllerWidget::startEndDateTime_changed()
 
  564  whileBlocking( mFixedRangeStartDateTime )->setDateTime( mStartDateTime->dateTime() );
 
  565  whileBlocking( mFixedRangeEndDateTime )->setDateTime( mEndDateTime->dateTime() );
 
  567  updateTemporalExtent();
 
  568  saveRangeToProject();
 
  571void QgsTemporalControllerWidget::fixedRangeStartEndDateTime_changed()
 
  573  whileBlocking( mStartDateTime )->setDateTime( mFixedRangeStartDateTime->dateTime() );
 
  574  whileBlocking( mEndDateTime )->setDateTime( mFixedRangeEndDateTime->dateTime() );
 
  576  updateTemporalExtent();
 
  577  saveRangeToProject();
 
  580void QgsTemporalControllerWidget::mRangeSetToAllLayersAction_triggered()
 
  582  setDatesToAllLayers();
 
  583  saveRangeToProject();
 
  586void QgsTemporalControllerWidget::setTimeStep( 
const QgsInterval &timeStep )
 
  591  int selectedUnit = -1;
 
  592  double selectedValue = std::numeric_limits<double>::max();
 
  598    int stringSize = std::numeric_limits<int>::max();
 
  599    const int precision = mStepSpinBox->decimals();
 
  600    for ( 
int i = 0; i < mTimeStepsComboBox->count(); ++i )
 
  604      QString 
string = QString::number( value, 
'f', 
precision );
 
  606      const thread_local QRegularExpression trailingZeroRegEx = QRegularExpression( QStringLiteral( 
"0+$" ) );
 
  608      string.remove( trailingZeroRegEx );
 
  610      const thread_local QRegularExpression trailingPointRegEx = QRegularExpression( QStringLiteral( 
"[.]+$" ) );
 
  612      string.remove( trailingPointRegEx );
 
  615           && 
string.size() <= stringSize 
 
  616           && value < selectedValue ) 
 
  619        selectedValue = value;
 
  620        stringSize = 
string.size();
 
  622      else if ( 
string != 
'0' 
  624                && 
string.size() < stringSize ) 
 
  627        selectedValue = value ;
 
  628        stringSize = 
string.size();
 
  634    selectedUnit = mTimeStepsComboBox->findData( 
static_cast< int >( timeStep.
originalUnit() ) );
 
  638  if ( selectedUnit >= 0 )
 
  640    mStepSpinBox->setValue( selectedValue );
 
  641    mTimeStepsComboBox->setCurrentIndex( selectedUnit );
 
  644  updateFrameDuration();
 
  647void QgsTemporalControllerWidget::updateTimeStepInputs( 
const QgsInterval &timeStep )
 
  652  QString timeDisplayFormat = QStringLiteral( 
"yyyy-MM-dd HH:mm:ss" );
 
  655    timeDisplayFormat = QStringLiteral( 
"yyyy-MM-dd HH:mm:ss.zzz" );
 
  657    updateTemporalExtent();
 
  659  mStartDateTime->setDisplayFormat( timeDisplayFormat );
 
  660  mEndDateTime->setDisplayFormat( timeDisplayFormat );
 
  661  mFixedRangeStartDateTime->setDisplayFormat( timeDisplayFormat );
 
  662  mFixedRangeEndDateTime->setDisplayFormat( timeDisplayFormat );
 
  665  if ( timeStep == 
QgsInterval( mStepSpinBox->value(),
 
  672    mTimeStepsComboBox->setCurrentIndex( mTimeStepsComboBox->findData( 
static_cast< int >( timeStep.
originalUnit() ) ) );
 
  675  updateFrameDuration();
 
  678void QgsTemporalControllerWidget::mRangeSetToProjectAction_triggered()
 
  680  setDatesToProjectTime( 
false );
 
  681  saveRangeToProject();
 
  686  if ( range.
begin().isValid() && range.
end().isValid() )
 
  692    updateTemporalExtent();
 
  696void QgsTemporalControllerWidget::setDatesToAllLayers()
 
  705void QgsTemporalControllerWidget::setDatesToProjectTime( 
bool tryLastStoredRange )
 
  709  if ( tryLastStoredRange )
 
  711    const QString startString = 
QgsProject::instance()->
readEntry( QStringLiteral( 
"TemporalControllerWidget" ), QStringLiteral( 
"/StartDateTime" ) );
 
  712    const QString endString = 
QgsProject::instance()->
readEntry( QStringLiteral( 
"TemporalControllerWidget" ), QStringLiteral( 
"/EndDateTime" ) );
 
  713    if ( !startString.isEmpty() && !endString.isEmpty() )
 
  715      range = 
QgsDateTimeRange( QDateTime::fromString( startString, Qt::ISODateWithMs ),
 
  716                                QDateTime::fromString( endString, Qt::ISODateWithMs ) );
 
  725  if ( !range.
begin().isValid() || !range.
end().isValid() )
 
  735void QgsTemporalControllerWidget::saveRangeToProject()
 
  738                                      QStringLiteral( 
"/StartDateTime" ), mStartDateTime->dateTime().toTimeSpec( Qt::OffsetFromUTC ).toString( Qt::ISODateWithMs ) );
 
  740                                      QStringLiteral( 
"/EndDateTime" ), mEndDateTime->dateTime().toTimeSpec( Qt::OffsetFromUTC ).toString( Qt::ISODateWithMs ) );
 
TemporalNavigationMode
Temporal navigation modes.
 
@ Animated
Temporal navigation relies on frames within a datetime range.
 
@ Movie
Movie mode – behaves like a video player, with a fixed frame duration and no temporal range.
 
@ FixedRange
Temporal navigation relies on a fixed datetime range.
 
@ Disabled
Temporal navigation is disabled.
 
PlaybackOperation
Media playback operations.
 
@ PlayReverse
Play in reverse.
 
@ PlayForward
Play forward.
 
@ SkipToStart
Jump to start of playback.
 
@ PreviousFrame
Step to previous frame.
 
@ SkipToEnd
Jump to end of playback.
 
@ NextFrame
Step to next frame.
 
TemporalUnit
Temporal units.
 
@ IrregularStep
Special 'irregular step' time unit, used for temporal data which uses irregular, non-real-world unit ...
 
@ Milliseconds
Milliseconds.
 
@ Unknown
Unknown time unit.
 
AnimationState
Animation states.
 
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
 
A representation of the interval between two datetime values.
 
double originalDuration() const
Returns the original interval duration.
 
bool isValid() const
Returns true if the interval is valid.
 
double seconds() const
Returns the interval duration in seconds.
 
Qgis::TemporalUnit originalUnit() const
Returns the original interval temporal unit.
 
The QgsMapLayerModel class is a model to display layers in widgets.
 
int rowCount(const QModelIndex &parent=QModelIndex()) const override
 
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
 
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
 
@ Layer
Stores pointer to the map layer itself.
 
virtual QgsDateTimeRange calculateTemporalExtent(QgsMapLayer *layer) const
Attempts to calculate the overall temporal extent for the specified layer, using the settings defined...
 
Base class for all map layer types.
 
void dataSourceChanged()
Emitted whenever the layer's data source has been changed.
 
virtual QgsMapLayerTemporalProperties * temporalProperties()
Returns the layer's temporal properties.
 
Represents a mesh layer supporting display of data on structured or unstructured meshes.
 
QgsDateTimeRange temporalRange() const
Returns the project's temporal range, which indicates the earliest and latest datetime ranges associa...
 
void setTotalMovieFrames(long long frames)
Sets the total number of frames for the movie.
 
void setFramesPerSecond(double rate)
Sets the project's default animation frame rate, in frames per second.
 
Qgis::TemporalUnit timeStepUnit() const
Returns the project's time step (length of one animation frame) unit, which is used as the default va...
 
void setTimeStepUnit(Qgis::TemporalUnit unit)
Sets the project's time step (length of one animation frame) unit, which is used as the default value...
 
void setIsTemporalRangeCumulative(bool state)
Sets the project's temporal range as cumulative in animation settings.
 
void setTimeStep(double step)
Sets the project's time step (length of one animation frame), which is used as the default value when...
 
int readNumEntry(const QString &scope, const QString &key, int def=0, bool *ok=nullptr) const
Reads an integer from the specified scope and key.
 
static QgsProject * instance()
Returns the QgsProject singleton instance.
 
void cleared()
Emitted when the project is cleared (and additionally when an open project is cleared just before a n...
 
QString readEntry(const QString &scope, const QString &key, const QString &def=QString(), bool *ok=nullptr) const
Reads a string from the specified scope and key.
 
bool writeEntry(const QString &scope, const QString &key, bool value)
Write a boolean value to the project file.
 
void readProject(const QDomDocument &document)
Emitted when a project is being read.
 
void layersAdded(const QList< QgsMapLayer * > &layers)
Emitted when one or more layers were added to the registry.
 
const QgsProjectTimeSettings * timeSettings() const
Returns the project's time settings, which contains the project's temporal range and other time based...
 
Represents a raster layer.
 
void updateTemporalRange(const QgsDateTimeRange &range)
Signals that a temporal range has changed and needs to be updated in all connected objects.
 
Implements a temporal controller based on a frame by frame navigation and animation.
 
void stateChanged(Qgis::AnimationState state)
Emitted whenever the animation state changes.
 
long long totalMovieFrames() const
Returns the total number of frames for the movie.
 
void previous()
Jumps back to the previous frame.
 
double framesPerSecond() const
Returns the animation frame rate, in frames per second.
 
void setAvailableTemporalRanges(const QList< QgsDateTimeRange > &ranges)
Sets the list of all available temporal ranges which have data available.
 
void setFrameDuration(const QgsInterval &duration)
Sets the frame duration, which dictates the temporal length of each frame in the animation.
 
void navigationModeChanged(Qgis::TemporalNavigationMode mode)
Emitted whenever the navigation mode changes.
 
void setNavigationMode(const Qgis::TemporalNavigationMode mode)
Sets the temporal navigation mode.
 
void playForward()
Starts the animation playing in a forward direction up till the end of all frames.
 
long long currentFrameNumber() const
Returns the current frame number.
 
void rewindToStart()
Rewinds the temporal navigation to start of the temporal extent.
 
void pause()
Pauses the temporal navigation.
 
void setCurrentFrameNumber(long long frame)
Sets the current animation frame number.
 
long long totalFrameCount() const
Returns the total number of frames for the navigation.
 
void skipToEnd()
Skips the temporal navigation to end of the temporal extent.
 
void temporalFrameDurationChanged(const QgsInterval &interval)
Emitted whenever the frameDuration interval of the controller changes.
 
void setFramesPerSecond(double rate)
Sets the animation frame rate, in frames per second.
 
bool temporalRangeCumulative() const
Returns the animation temporal range cumulative settings.
 
void next()
Advances to the next frame.
 
void totalMovieFramesChanged(long long frames)
Emitted whenever the total number of frames in the movie is changed.
 
void setTotalMovieFrames(long long frames)
Sets the total number of frames for the movie.
 
void setTemporalExtents(const QgsDateTimeRange &extents)
Sets the navigation temporal extents, which dictate the earliest and latest date time possible in the...
 
Qgis::TemporalNavigationMode navigationMode() const
Returns the current temporal navigation mode.
 
void setTemporalRangeCumulative(bool state)
Sets the animation temporal range as cumulative.
 
void setLooping(bool loop)
Sets whether the animation should loop after hitting the end or start frame.
 
void playBackward()
Starts the animation playing in a reverse direction until the beginning of the time range.
 
void temporalExtentsChanged(const QgsDateTimeRange &extent)
Emitted whenever the temporalExtent extent changes.
 
bool isActive() const
Returns true if the temporal property is active.
 
T begin() const
Returns the beginning of the range.
 
T end() const
Returns the upper bound of the range.
 
static QgsDateTimeRange calculateTemporalRangeForProject(QgsProject *project)
Calculates the temporal range for a project.
 
static QList< QgsDateTimeRange > usedTemporalRangesForProject(QgsProject *project)
Calculates all temporal ranges which are in use for a project.
 
static Q_INVOKABLE QString toString(Qgis::DistanceUnit unit)
Returns a translated string representing a distance unit.
 
static Q_INVOKABLE double fromUnitToUnitFactor(Qgis::DistanceUnit fromUnit, Qgis::DistanceUnit toUnit)
Returns the conversion factor between the specified distance units.
 
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
 
QgsTemporalRange< QDateTime > QgsDateTimeRange
QgsRange which stores a range of date times.