Skip to content
Permalink
Browse files

Use time step when exporting animation

  • Loading branch information
dminor authored and nyalldawson committed Jan 6, 2021
1 parent f2d5d5f commit 8aac2388c2eb988fa5bf70ff4e9d958ea0eddb26
@@ -35,7 +35,9 @@ returns the maximal combined temporal extent of these layers.
{
QgsDateTimeRange animationRange;

QgsInterval frameDuration;
double frameTimeStep;

QgsUnitTypes::TemporalUnit frameTimeStepUnit;

QString outputDirectory;

@@ -225,9 +225,14 @@ QgsDateTimeRange QgsAnimationExportDialog::animationRange() const
return QgsDateTimeRange( mStartDateTime->dateTime(), mEndDateTime->dateTime() );
}

QgsInterval QgsAnimationExportDialog::frameInterval() const
double QgsAnimationExportDialog::frameTimeStep() const
{
return QgsInterval( mFrameDurationSpinBox->value(), static_cast< QgsUnitTypes::TemporalUnit>( mTimeStepsComboBox->currentData().toInt() ) );
return mFrameDurationSpinBox->value();
}

QgsUnitTypes::TemporalUnit QgsAnimationExportDialog::frameTimeStepUnit() const
{
return static_cast< QgsUnitTypes::TemporalUnit>( mTimeStepsComboBox->currentData().toInt() );
}

void QgsAnimationExportDialog::applyMapSettings( QgsMapSettings &mapSettings )
@@ -63,8 +63,11 @@ class APP_EXPORT QgsAnimationExportDialog: public QDialog, private Ui::QgsAnimat
//! Returns the overall animation range
QgsDateTimeRange animationRange() const;

//! Returns the duration of each individual frame
QgsInterval frameInterval() const;
//! Returns the time step of each individual frame
double frameTimeStep() const;

//! Returns the time step unit of each individual frame
QgsUnitTypes::TemporalUnit frameTimeStepUnit() const;

//! configure a map settings object
void applyMapSettings( QgsMapSettings &mapSettings );
@@ -60,7 +60,8 @@ void QgsTemporalControllerDockWidget::exportAnimation()
dlg->applyMapSettings( s );

const QgsDateTimeRange animationRange = dlg->animationRange();
const QgsInterval frameDuration = dlg->frameInterval();
const double frameTimeStep = dlg->frameTimeStep();
const QgsUnitTypes::TemporalUnit frameTimeStepUnit = dlg->frameTimeStepUnit();
const QString outputDir = dlg->outputDirectory();
const QString fileNameExpression = dlg->fileNameExpression();

@@ -89,7 +90,8 @@ void QgsTemporalControllerDockWidget::exportAnimation()
decorations = QgisApp::instance()->activeDecorations();

QgsTemporalUtils::AnimationExportSettings animationSettings;
animationSettings.frameDuration = frameDuration;
animationSettings.frameTimeStep = frameTimeStep;
animationSettings.frameTimeStepUnit = frameTimeStepUnit;
animationSettings.animationRange = animationRange;
animationSettings.outputDirectory = outputDir;
animationSettings.fileNameTemplate = fileNameExpression;
@@ -80,8 +80,8 @@ bool QgsTemporalUtils::exportAnimation( const QgsMapSettings &mapSettings, const

QgsTemporalNavigationObject navigator;
navigator.setTemporalExtents( settings.animationRange );
navigator.setFrameTimeStep( settings.frameDuration.seconds() );
navigator.setFrameTimeStepUnit( QgsUnitTypes::TemporalUnit::TemporalSeconds );
navigator.setFrameTimeStep( settings.frameTimeStep );
navigator.setFrameTimeStepUnit( settings.frameTimeStepUnit );
QgsMapSettings ms = mapSettings;
const QgsExpressionContext context = ms.expressionContext();

@@ -51,8 +51,11 @@ class CORE_EXPORT QgsTemporalUtils
//! Dictates the overall temporal range of the animation.
QgsDateTimeRange animationRange;

//! Duration of individual export frames
QgsInterval frameDuration;
//! Time step of individual export frames
double frameTimeStep;

//! Time step unit of individual export frames
QgsUnitTypes::TemporalUnit frameTimeStepUnit;

//! Destination directory for created image files.
QString outputDirectory;

0 comments on commit 8aac238

Please sign in to comment.
You can’t perform that action at this time.