Set animation properties for map settings when exporting animations

This commit is contained in:
Nyall Dawson 2022-03-27 10:05:40 +10:00
parent 2268689cd1
commit 5451f22017
3 changed files with 11 additions and 0 deletions

View File

@ -58,6 +58,8 @@ The returned list may be non-contiguous and have gaps in the ranges. The ranges
QList<QgsMapDecoration *> decorations;
double frameRate;
};
static bool exportAnimation( const QgsMapSettings &mapSettings, const AnimationExportSettings &settings, QString &error /Out/, QgsFeedback *feedback = 0 );

View File

@ -101,6 +101,7 @@ bool QgsTemporalUtils::exportAnimation( const QgsMapSettings &mapSettings, const
navigator.setFrameDuration( settings.frameDuration );
QgsMapSettings ms = mapSettings;
const QgsExpressionContext context = ms.expressionContext();
ms.setFrameRate( settings.frameRate );
const long long totalFrames = navigator.totalFrameCount();
long long currentFrame = 0;
@ -121,6 +122,7 @@ bool QgsTemporalUtils::exportAnimation( const QgsMapSettings &mapSettings, const
ms.setIsTemporal( true );
ms.setTemporalRange( navigator.dateTimeRangeForFrameNumber( currentFrame ) );
ms.setCurrentFrame( currentFrame );
QgsExpressionContext frameContext = context;
frameContext.appendScope( navigator.createExpressionContextScope() );

View File

@ -167,6 +167,13 @@ class CORE_EXPORT QgsTemporalUtils
//! List of decorations to draw onto exported frames.
QList<QgsMapDecoration *> decorations;
/**
* Target animation frame rate in frames per second.
*
* \since QGIS 3.26
*/
double frameRate = 30;
};
/**