20#include "moc_qgstemporalcontrollerwidget.cpp" 
   33#include <QRegularExpression> 
   42  mStartDateTime->setDateTimeRange( QDateTime( QDate( 1, 1, 1 ), QTime( 0, 0, 0 ) ), mStartDateTime->maximumDateTime() );
 
   43  mEndDateTime->setDateTimeRange( QDateTime( QDate( 1, 1, 1 ), QTime( 0, 0, 0 ) ), mStartDateTime->maximumDateTime() );
 
   44  mFixedRangeStartDateTime->setDateTimeRange( QDateTime( QDate( 1, 1, 1 ), QTime( 0, 0, 0 ) ), mStartDateTime->maximumDateTime() );
 
   45  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, [
this]( 
bool state ) { mNavigationObject->
setLooping( state ); mMovieLoopingCheckBox->setChecked( state ); } );
 
   83  connect( mMovieLoopingCheckBox, &QCheckBox::toggled, 
this, [
this]( 
bool state ) { mNavigationObject->
setLooping( state );  mAnimationLoopingCheckBox->setChecked( state ); } );
 
   85  setWidgetStateFromNavigationMode( mNavigationObject->
navigationMode() );
 
   89    if ( mBlockFrameDurationUpdates )
 
   92    mBlockFrameDurationUpdates++;
 
   93    updateTimeStepInputs( timeStep );
 
   94    mBlockFrameDurationUpdates--;
 
   96  connect( mNavigationOff, &QPushButton::clicked, 
this, &QgsTemporalControllerWidget::mNavigationOff_clicked );
 
   97  connect( mNavigationFixedRange, &QPushButton::clicked, 
this, &QgsTemporalControllerWidget::mNavigationFixedRange_clicked );
 
   98  connect( mNavigationAnimated, &QPushButton::clicked, 
this, &QgsTemporalControllerWidget::mNavigationAnimated_clicked );
 
   99  connect( mNavigationMovie, &QPushButton::clicked, 
this, &QgsTemporalControllerWidget::mNavigationMovie_clicked );
 
  102    mAnimationController->setState( state );
 
  103    mMovieController->setState( state );
 
  106  connect( mStartDateTime, &QDateTimeEdit::dateTimeChanged, 
this, &QgsTemporalControllerWidget::startEndDateTime_changed );
 
  107  connect( mEndDateTime, &QDateTimeEdit::dateTimeChanged, 
this, &QgsTemporalControllerWidget::startEndDateTime_changed );
 
  108  connect( mFixedRangeStartDateTime, &QDateTimeEdit::dateTimeChanged, 
this, &QgsTemporalControllerWidget::fixedRangeStartEndDateTime_changed );
 
  109  connect( mFixedRangeEndDateTime, &QDateTimeEdit::dateTimeChanged, 
this, &QgsTemporalControllerWidget::fixedRangeStartEndDateTime_changed );
 
  110  connect( mStepSpinBox, qOverload<double>( &QDoubleSpinBox::valueChanged ), 
this, &QgsTemporalControllerWidget::updateFrameDuration );
 
  111  connect( mTimeStepsComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), 
this, &QgsTemporalControllerWidget::updateFrameDuration );
 
  112  connect( mAnimationSlider, &QSlider::valueChanged, 
this, &QgsTemporalControllerWidget::timeSlider_valueChanged );
 
  113  connect( mMovieSlider, &QSlider::valueChanged, 
this, &QgsTemporalControllerWidget::timeSlider_valueChanged );
 
  115  connect( mTotalFramesSpinBox, qOverload<int>( &QSpinBox::valueChanged ), 
this, [
this]( 
int frames ) {
 
  119  mStepSpinBox->setClearValue( 1 );
 
  124  connect( mSettings, &QPushButton::clicked, 
this, &QgsTemporalControllerWidget::settings_clicked );
 
  128  mRangeMenu.reset( 
new QMenu( 
this ) );
 
  130  mRangeSetToAllLayersAction = 
new QAction( tr( 
"Set to Full Range" ), mRangeMenu.get() );
 
  132  connect( mRangeSetToAllLayersAction, &QAction::triggered, 
this, &QgsTemporalControllerWidget::mRangeSetToAllLayersAction_triggered );
 
  133  mRangeMenu->addAction( mRangeSetToAllLayersAction );
 
  135  mRangeSetToProjectAction = 
new QAction( tr( 
"Set to Preset Project Range" ), mRangeMenu.get() );
 
  136  connect( mRangeSetToProjectAction, &QAction::triggered, 
this, &QgsTemporalControllerWidget::mRangeSetToProjectAction_triggered );
 
  137  mRangeMenu->addAction( mRangeSetToProjectAction );
 
  139  mRangeMenu->addSeparator();
 
  141  mRangeLayersSubMenu.reset( 
new QMenu( tr( 
"Set to Single Layer's Range" ), mRangeMenu.get() ) );
 
  142  mRangeLayersSubMenu->setEnabled( 
false );
 
  143  mRangeMenu->addMenu( mRangeLayersSubMenu.get() );
 
  144  connect( mRangeMenu.get(), &QMenu::aboutToShow, 
this, &QgsTemporalControllerWidget::aboutToShowRangeMenu );
 
  146  mSetRangeButton->setPopupMode( QToolButton::MenuButtonPopup );
 
  147  mSetRangeButton->setMenu( mRangeMenu.get() );
 
  148  mSetRangeButton->setDefaultAction( mRangeSetToAllLayersAction );
 
  149  mFixedRangeSetRangeButton->setPopupMode( QToolButton::MenuButtonPopup );
 
  150  mFixedRangeSetRangeButton->setMenu( mRangeMenu.get() );
 
  151  mFixedRangeSetRangeButton->setDefaultAction( mRangeSetToAllLayersAction );
 
  161  if ( range.
begin().isValid() && range.
end().isValid() )
 
  191  mStepSpinBox->setDecimals( 3 );
 
  193  mStepSpinBox->setMinimum( 0.001 );
 
  194  mStepSpinBox->setMaximum( std::numeric_limits<int>::max() );
 
  195  mStepSpinBox->setSingleStep( 1 );
 
  196  mStepSpinBox->setValue( 1 );
 
  198  updateFrameDuration();
 
 
  212  if ( ( mAnimationSlider->hasFocus() || mMovieSlider->hasFocus() ) && e->key() == Qt::Key_Space )
 
  214    mAnimationController->togglePause();
 
 
  220void QgsTemporalControllerWidget::aboutToShowRangeMenu()
 
  225  mRangeSetToProjectAction->setEnabled( projectRange.
begin().isValid() && projectRange.
end().isValid() );
 
  227  mRangeLayersSubMenu->clear();
 
  228  for ( 
int i = 0; i < mMapLayerModel->
rowCount(); ++i )
 
  230    const QModelIndex index = mMapLayerModel->
index( i, 0 );
 
  235    const QIcon icon = qvariant_cast<QIcon>( mMapLayerModel->
data( index, Qt::DecorationRole ) );
 
  236    const QString text = mMapLayerModel->
data( index, Qt::DisplayRole ).toString();
 
  238    if ( range.
begin().isValid() && range.
end().isValid() )
 
  240      QAction *action = 
new QAction( icon, text, mRangeLayersSubMenu.get() );
 
  241      connect( action, &QAction::triggered, 
this, [
this, range] {
 
  243        saveRangeToProject();
 
  245      mRangeLayersSubMenu->addAction( action );
 
  248  mRangeLayersSubMenu->setEnabled( !mRangeLayersSubMenu->actions().isEmpty() );
 
  251void QgsTemporalControllerWidget::updateTemporalExtent()
 
  255  const QDateTime start = mStartDateTime->dateTime();
 
  256  const QDateTime end = mEndDateTime->dateTime();
 
  257  const bool isTimeInstant = start == end;
 
  260  mAnimationSlider->setRange( 0, mNavigationObject->
totalFrameCount() - 1 );
 
  266void QgsTemporalControllerWidget::updateFrameDuration()
 
  268  if ( mBlockSettingUpdates )
 
  276  if ( !mBlockFrameDurationUpdates )
 
  283  mAnimationSlider->setRange( 0, mNavigationObject->
totalFrameCount() - 1 );
 
  290    mStepSpinBox->setEnabled( 
false );
 
  291    mStepSpinBox->setValue( 1 );
 
  292    mAnimationSlider->setTickInterval( 1 );
 
  293    mAnimationSlider->setTickPosition( QSlider::TicksBothSides );
 
  297    mStepSpinBox->setEnabled( 
true );
 
  298    mAnimationSlider->setTickInterval( 0 );
 
  299    mAnimationSlider->setTickPosition( QSlider::NoTicks );
 
  303void QgsTemporalControllerWidget::setWidgetStateFromProject()
 
  305  mBlockSettingUpdates++;
 
  308  mBlockSettingUpdates--;
 
  315    setWidgetStateFromNavigationMode( mode );
 
  326  const QString startString = 
QgsProject::instance()->
readEntry( QStringLiteral( 
"TemporalControllerWidget" ), QStringLiteral( 
"/StartDateTime" ) );
 
  327  const QString endString = 
QgsProject::instance()->
readEntry( QStringLiteral( 
"TemporalControllerWidget" ), QStringLiteral( 
"/EndDateTime" ) );
 
  328  if ( !startString.isEmpty() && !endString.isEmpty() )
 
  330    whileBlocking( mStartDateTime )->setDateTime( QDateTime::fromString( startString, Qt::ISODateWithMs ) );
 
  331    whileBlocking( mEndDateTime )->setDateTime( QDateTime::fromString( endString, Qt::ISODateWithMs ) );
 
  332    whileBlocking( mFixedRangeStartDateTime )->setDateTime( QDateTime::fromString( startString, Qt::ISODateWithMs ) );
 
  333    whileBlocking( mFixedRangeEndDateTime )->setDateTime( QDateTime::fromString( endString, Qt::ISODateWithMs ) );
 
  337    setDatesToProjectTime( 
false );
 
  339  updateTemporalExtent();
 
  340  updateFrameDuration();
 
  346void QgsTemporalControllerWidget::mNavigationOff_clicked()
 
  354void QgsTemporalControllerWidget::mNavigationFixedRange_clicked()
 
  362void QgsTemporalControllerWidget::mNavigationAnimated_clicked()
 
  370void QgsTemporalControllerWidget::mNavigationMovie_clicked()
 
  388      mNavigationModeStackedWidget->setCurrentIndex( 0 );
 
  391      mNavigationModeStackedWidget->setCurrentIndex( 1 );
 
  394      mNavigationModeStackedWidget->setCurrentIndex( 2 );
 
  397      mNavigationModeStackedWidget->setCurrentIndex( 3 );
 
  402void QgsTemporalControllerWidget::onLayersAdded( 
const QList<QgsMapLayer *> &layers )
 
  404  if ( !mHasTemporalLayersLoaded )
 
  408      if ( layer->temporalProperties() )
 
  410        mHasTemporalLayersLoaded |= layer->temporalProperties()->isActive();
 
  412        if ( !mHasTemporalLayersLoaded )
 
  415            if ( layer->isValid() && layer->temporalProperties()->isActive() && !mHasTemporalLayersLoaded )
 
  417              mHasTemporalLayersLoaded = true;
 
  418              firstTemporalLayerLoaded( layer );
 
  419              mNavigationObject->setAvailableTemporalRanges( QgsTemporalUtils::usedTemporalRangesForProject( QgsProject::instance() ) );
 
  424        firstTemporalLayerLoaded( layer );
 
  432void QgsTemporalControllerWidget::firstTemporalLayerLoaded( 
QgsMapLayer *layer )
 
  434  setDatesToProjectTime( 
true );
 
  436  if ( 
QgsMeshLayer *meshLayer = qobject_cast<QgsMeshLayer *>( layer ) )
 
  438    mBlockFrameDurationUpdates++;
 
  439    setTimeStep( meshLayer->firstValidTimeStep() );
 
  440    mBlockFrameDurationUpdates--;
 
  441    updateFrameDuration();
 
  443  else if ( 
QgsRasterLayer *rasterLayer = qobject_cast<QgsRasterLayer *>( layer ) )
 
  445    if ( rasterLayer->dataProvider() && rasterLayer->dataProvider()->temporalCapabilities() )
 
  447      mBlockFrameDurationUpdates++;
 
  448      setTimeStep( rasterLayer->dataProvider()->temporalCapabilities()->defaultInterval() );
 
  449      mBlockFrameDurationUpdates--;
 
  450      updateFrameDuration();
 
  455void QgsTemporalControllerWidget::onProjectCleared()
 
  457  mHasTemporalLayersLoaded = 
false;
 
  464  const QTime startOfCurrentHour = QTime( QTime::currentTime().hour(), 0, 0 );
 
  465  const QDateTime end = QDateTime( QDate::currentDate(), startOfCurrentHour, Qt::UTC );
 
  466  const QDateTime start = end.addSecs( -24 * 60 * 60 );
 
  470  whileBlocking( mFixedRangeStartDateTime )->setDateTime( start );
 
  473  updateTemporalExtent();
 
  475  mStepSpinBox->setValue( 1 );
 
  478void QgsTemporalControllerWidget::updateSlider( 
const QgsDateTimeRange &range )
 
  482  updateRangeLabel( range );
 
  485void QgsTemporalControllerWidget::totalMovieFramesChanged( 
long long frames )
 
  488  mTotalFramesSpinBox->setValue( frames );
 
  489  mCurrentRangeLabel->setText( tr( 
"Current frame: %1/%2" ).arg( mNavigationObject->
currentFrameNumber() ).arg( frames ) );
 
  492void QgsTemporalControllerWidget::updateRangeLabel( 
const QgsDateTimeRange &range )
 
  494  QString timeFrameFormat = QStringLiteral( 
"yyyy-MM-dd HH:mm:ss" );
 
  497    timeFrameFormat = QStringLiteral( 
"yyyy-MM-dd HH:mm:ss.zzz" );
 
  501      mCurrentRangeLabel->setText( tr( 
"Current frame: %1 ≤ <i>t</i> < %2" ).arg( range.
begin().toString( timeFrameFormat ), range.
end().toString( timeFrameFormat ) ) );
 
  504      mCurrentRangeLabel->setText( tr( 
"Range: %1 ≤ <i>t</i> < %2" ).arg( range.
begin().toString( timeFrameFormat ), range.
end().toString( timeFrameFormat ) ) );
 
  507      mCurrentRangeLabel->setText( tr( 
"Temporal navigation disabled" ) );
 
  517  return mNavigationObject;
 
 
  520void QgsTemporalControllerWidget::settings_clicked()
 
  522  QgsTemporalMapSettingsWidget *settingsWidget = 
new QgsTemporalMapSettingsWidget( 
this );
 
  523  settingsWidget->setFrameRateValue( mNavigationObject->
framesPerSecond() );
 
  526  connect( settingsWidget, &QgsTemporalMapSettingsWidget::frameRateChanged, 
this, [
this]( 
double rate ) {
 
  532  connect( settingsWidget, &QgsTemporalMapSettingsWidget::temporalRangeCumulativeChanged, 
this, [
this]( 
bool state ) {
 
  540void QgsTemporalControllerWidget::timeSlider_valueChanged( 
int value )
 
  545void QgsTemporalControllerWidget::startEndDateTime_changed()
 
  547  whileBlocking( mFixedRangeStartDateTime )->setDateTime( mStartDateTime->dateTime() );
 
  548  whileBlocking( mFixedRangeEndDateTime )->setDateTime( mEndDateTime->dateTime() );
 
  550  updateTemporalExtent();
 
  551  saveRangeToProject();
 
  554void QgsTemporalControllerWidget::fixedRangeStartEndDateTime_changed()
 
  556  whileBlocking( mStartDateTime )->setDateTime( mFixedRangeStartDateTime->dateTime() );
 
  557  whileBlocking( mEndDateTime )->setDateTime( mFixedRangeEndDateTime->dateTime() );
 
  559  updateTemporalExtent();
 
  560  saveRangeToProject();
 
  563void QgsTemporalControllerWidget::mRangeSetToAllLayersAction_triggered()
 
  565  setDatesToAllLayers();
 
  566  saveRangeToProject();
 
  569void QgsTemporalControllerWidget::setTimeStep( 
const QgsInterval &timeStep )
 
  574  int selectedUnit = -1;
 
  575  double selectedValue = std::numeric_limits<double>::max();
 
  581    int stringSize = std::numeric_limits<int>::max();
 
  582    const int precision = mStepSpinBox->decimals();
 
  583    for ( 
int i = 0; i < mTimeStepsComboBox->count(); ++i )
 
  587      QString 
string = QString::number( value, 
'f', 
precision );
 
  589      const thread_local QRegularExpression trailingZeroRegEx = QRegularExpression( QStringLiteral( 
"0+$" ) );
 
  591      string.remove( trailingZeroRegEx );
 
  593      const thread_local QRegularExpression trailingPointRegEx = QRegularExpression( QStringLiteral( 
"[.]+$" ) );
 
  595      string.remove( trailingPointRegEx );
 
  598           && 
string.size() <= stringSize 
 
  599           && value < selectedValue )     
 
  602        selectedValue = value;
 
  603        stringSize = 
string.size();
 
  605      else if ( 
string != 
'0' 
  607                && 
string.size() < stringSize )  
 
  610        selectedValue = value;
 
  611        stringSize = 
string.size();
 
  617    selectedUnit = mTimeStepsComboBox->findData( 
static_cast<int>( timeStep.
originalUnit() ) );
 
  621  if ( selectedUnit >= 0 )
 
  623    mStepSpinBox->setValue( selectedValue );
 
  624    mTimeStepsComboBox->setCurrentIndex( selectedUnit );
 
  627  updateFrameDuration();
 
  630void QgsTemporalControllerWidget::updateTimeStepInputs( 
const QgsInterval &timeStep )
 
  635  QString timeDisplayFormat = QStringLiteral( 
"yyyy-MM-dd HH:mm:ss" );
 
  638    timeDisplayFormat = QStringLiteral( 
"yyyy-MM-dd HH:mm:ss.zzz" );
 
  640    updateTemporalExtent();
 
  642  mStartDateTime->setDisplayFormat( timeDisplayFormat );
 
  643  mEndDateTime->setDisplayFormat( timeDisplayFormat );
 
  644  mFixedRangeStartDateTime->setDisplayFormat( timeDisplayFormat );
 
  645  mFixedRangeEndDateTime->setDisplayFormat( timeDisplayFormat );
 
  654    mTimeStepsComboBox->setCurrentIndex( mTimeStepsComboBox->findData( 
static_cast<int>( timeStep.
originalUnit() ) ) );
 
  657  updateFrameDuration();
 
  660void QgsTemporalControllerWidget::mRangeSetToProjectAction_triggered()
 
  662  setDatesToProjectTime( 
false );
 
  663  saveRangeToProject();
 
  668  if ( range.
begin().isValid() && range.
end().isValid() )
 
  674    updateTemporalExtent();
 
  678void QgsTemporalControllerWidget::setDatesToAllLayers()
 
  687void QgsTemporalControllerWidget::setDatesToProjectTime( 
bool tryLastStoredRange )
 
  691  if ( tryLastStoredRange )
 
  693    const QString startString = 
QgsProject::instance()->
readEntry( QStringLiteral( 
"TemporalControllerWidget" ), QStringLiteral( 
"/StartDateTime" ) );
 
  694    const QString endString = 
QgsProject::instance()->
readEntry( QStringLiteral( 
"TemporalControllerWidget" ), QStringLiteral( 
"/EndDateTime" ) );
 
  695    if ( !startString.isEmpty() && !endString.isEmpty() )
 
  697      range = 
QgsDateTimeRange( QDateTime::fromString( startString, Qt::ISODateWithMs ), QDateTime::fromString( endString, Qt::ISODateWithMs ) );
 
  706  if ( !range.
begin().isValid() || !range.
end().isValid() )
 
  716void QgsTemporalControllerWidget::saveRangeToProject()
 
  718  QgsProject::instance()->
writeEntry( QStringLiteral( 
"TemporalControllerWidget" ), QStringLiteral( 
"/StartDateTime" ), mStartDateTime->dateTime().toTimeSpec( Qt::OffsetFromUTC ).toString( Qt::ISODateWithMs ) );
 
  719  QgsProject::instance()->
writeEntry( QStringLiteral( 
"TemporalControllerWidget" ), 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.
 
A model for display of map 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.