QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
Public Slots | Signals | Public Member Functions | List of all members
QgsTemporalNavigationObject Class Reference

Implements a temporal controller based on a frame by frame navigation and animation. More...

#include <qgstemporalnavigationobject.h>

Inheritance diagram for QgsTemporalNavigationObject:
Inheritance graph
[legend]

Public Slots

void next ()
 Advances to the next frame. More...
 
void pause ()
 Pauses the temporal navigation. More...
 
void play ()
 Starts playing the temporal navigation from its current frame, using the direction specified by animationState() More...
 
void playBackward ()
 Starts the animation playing in a reverse direction until the beginning of the time range. More...
 
void playForward ()
 Starts the animation playing in a forward direction up till the end of all frames. More...
 
void previous ()
 Jumps back to the previous frame. More...
 
void rewindToStart ()
 Rewinds the temporal navigation to start of the temporal extent. More...
 
void skipToEnd ()
 Skips the temporal navigation to end of the temporal extent. More...
 

Signals

void navigationModeChanged (Qgis::TemporalNavigationMode mode)
 Emitted whenever the navigation mode changes. More...
 
void stateChanged (Qgis::AnimationState state)
 Emitted whenever the animation state changes. More...
 
void temporalExtentsChanged (const QgsDateTimeRange &extent)
 Emitted whenever the temporalExtent extent changes. More...
 
void temporalFrameDurationChanged (const QgsInterval &interval)
 Emitted whenever the frameDuration interval of the controller changes. More...
 
void totalMovieFramesChanged (long long frames)
 Emitted whenever the total number of frames in the movie is changed. More...
 
- Signals inherited from QgsTemporalController
void updateTemporalRange (const QgsDateTimeRange &range)
 Signals that a temporal range has changed and needs to be updated in all connected objects. More...
 

Public Member Functions

 QgsTemporalNavigationObject (QObject *parent=nullptr)
 Constructor for QgsTemporalNavigationObject, with the specified parent object. More...
 
Qgis::AnimationState animationState () const
 Returns the current animation state. More...
 
QList< QgsDateTimeRangeavailableTemporalRanges () const
 Returns the list of all available temporal ranges which have data available. More...
 
QgsExpressionContextScopecreateExpressionContextScope () const override
 This method needs to be reimplemented in all classes which implement this interface and return an expression context scope. More...
 
long long currentFrameNumber () const
 Returns the current frame number. More...
 
QgsDateTimeRange dateTimeRangeForFrameNumber (long long frame) const
 Calculates the temporal range associated with a particular animation frame. More...
 
long long findBestFrameNumberForFrameStart (const QDateTime &frameStart) const
 Returns the best suited frame number for the specified datetime, based on the start of the corresponding temporal range. More...
 
QgsInterval frameDuration () const
 Returns the current set frame duration, which dictates the temporal length of each frame in the animation. More...
 
double framesPerSecond () const
 Returns the animation frame rate, in frames per second. More...
 
bool isLooping () const
 Returns true if the animation should loop after hitting the end or start frame. More...
 
Qgis::TemporalNavigationMode navigationMode () const
 Returns the current temporal navigation mode. More...
 
void setAnimationState (Qgis::AnimationState state)
 Sets the current animation state. More...
 
void setAvailableTemporalRanges (const QList< QgsDateTimeRange > &ranges)
 Sets the list of all available temporal ranges which have data available. More...
 
void setCurrentFrameNumber (long long frame)
 Sets the current animation frame number. More...
 
void setFrameDuration (const QgsInterval &duration)
 Sets the frame duration, which dictates the temporal length of each frame in the animation. More...
 
void setFramesPerSecond (double rate)
 Sets the animation frame rate, in frames per second. More...
 
void setLooping (bool loop)
 Sets whether the animation should loop after hitting the end or start frame. More...
 
void setNavigationMode (const Qgis::TemporalNavigationMode mode)
 Sets the temporal navigation mode. More...
 
void setTemporalExtents (const QgsDateTimeRange &extents)
 Sets the navigation temporal extents, which dictate the earliest and latest date time possible in the animation. More...
 
void setTemporalRangeCumulative (bool state)
 Sets the animation temporal range as cumulative. More...
 
void setTotalMovieFrames (long long frames)
 Sets the total number of frames for the movie. More...
 
QgsDateTimeRange temporalExtents () const
 Returns the navigation temporal extents, which dictate the earliest and latest date time possible in the animation. More...
 
bool temporalRangeCumulative () const
 Returns the animation temporal range cumulative settings. More...
 
long long totalFrameCount () const
 Returns the total number of frames for the navigation. More...
 
long long totalMovieFrames () const
 Returns the total number of frames for the movie. More...
 
- Public Member Functions inherited from QgsTemporalController
 QgsTemporalController (QObject *parent=nullptr)
 Constructor for QgsTemporalController, with the specified parent object. More...
 
- Public Member Functions inherited from QgsExpressionContextScopeGenerator
virtual ~QgsExpressionContextScopeGenerator ()=default
 
virtual QgsExpressionContextScopecreateExpressionContextScope () const =0
 This method needs to be reimplemented in all classes which implement this interface and return an expression context scope. More...
 

Detailed Description

Implements a temporal controller based on a frame by frame navigation and animation.

Since
QGIS 3.14

Definition at line 39 of file qgstemporalnavigationobject.h.

Constructor & Destructor Documentation

◆ QgsTemporalNavigationObject()

QgsTemporalNavigationObject::QgsTemporalNavigationObject ( QObject *  parent = nullptr)

Constructor for QgsTemporalNavigationObject, with the specified parent object.

Definition at line 23 of file qgstemporalnavigationobject.cpp.

Member Function Documentation

◆ animationState()

Qgis::AnimationState QgsTemporalNavigationObject::animationState ( ) const

Returns the current animation state.

See also
setAnimationState()

Definition at line 362 of file qgstemporalnavigationobject.cpp.

◆ availableTemporalRanges()

QList< QgsDateTimeRange > QgsTemporalNavigationObject::availableTemporalRanges ( ) const

Returns the list of all available temporal ranges which have data available.

The ranges list can be a list of non-contiguous ranges (i.e. containing gaps) which together describe the complete range of times which contain data.

See also
setAvailableTemporalRanges()
Since
QGIS 3.20

Definition at line 210 of file qgstemporalnavigationobject.cpp.

◆ createExpressionContextScope()

QgsExpressionContextScope * QgsTemporalNavigationObject::createExpressionContextScope ( ) const
overridevirtual

This method needs to be reimplemented in all classes which implement this interface and return an expression context scope.

Implements QgsExpressionContextScopeGenerator.

Definition at line 90 of file qgstemporalnavigationobject.cpp.

◆ currentFrameNumber()

long long QgsTemporalNavigationObject::currentFrameNumber ( ) const

Returns the current frame number.

See also
setCurrentFrameNumber()

Definition at line 227 of file qgstemporalnavigationobject.cpp.

◆ dateTimeRangeForFrameNumber()

QgsDateTimeRange QgsTemporalNavigationObject::dateTimeRangeForFrameNumber ( long long  frame) const

Calculates the temporal range associated with a particular animation frame.

This is calculated from the navigation start time (taken from temporalExtents()), the specified frame number, and the frame duration (see frameDuration()).

Definition at line 109 of file qgstemporalnavigationobject.cpp.

◆ findBestFrameNumberForFrameStart()

long long QgsTemporalNavigationObject::findBestFrameNumberForFrameStart ( const QDateTime &  frameStart) const

Returns the best suited frame number for the specified datetime, based on the start of the corresponding temporal range.

Definition at line 367 of file qgstemporalnavigationobject.cpp.

◆ frameDuration()

QgsInterval QgsTemporalNavigationObject::frameDuration ( ) const

Returns the current set frame duration, which dictates the temporal length of each frame in the animation.

See also
setFrameDuration()

Definition at line 252 of file qgstemporalnavigationobject.cpp.

◆ framesPerSecond()

double QgsTemporalNavigationObject::framesPerSecond ( ) const

Returns the animation frame rate, in frames per second.

This setting controls the overall playback speed of the animation, i.e. how quickly a playing animation will advance to the next frame.

See also
setFramesPerSecond()

Definition at line 266 of file qgstemporalnavigationobject.cpp.

◆ isLooping()

bool QgsTemporalNavigationObject::isLooping ( ) const

Returns true if the animation should loop after hitting the end or start frame.

See also
setLooping()

Definition at line 80 of file qgstemporalnavigationobject.cpp.

◆ navigationMode()

Qgis::TemporalNavigationMode QgsTemporalNavigationObject::navigationMode ( ) const
inline

Returns the current temporal navigation mode.

See also
setNavigationMode()

Definition at line 76 of file qgstemporalnavigationobject.h.

◆ navigationModeChanged

void QgsTemporalNavigationObject::navigationModeChanged ( Qgis::TemporalNavigationMode  mode)
signal

Emitted whenever the navigation mode changes.

◆ next

void QgsTemporalNavigationObject::next ( )
slot

Advances to the next frame.

Note
Calling this slot does not change the current animation state, i.e. a paused animation will remain paused.

Definition at line 316 of file qgstemporalnavigationobject.cpp.

◆ pause

void QgsTemporalNavigationObject::pause ( )
slot

Pauses the temporal navigation.

Calling this slot changes the animation state to idle, preventing automatic advancement of frames.

It does not affect the current animation frame number or the current temporal range of the controller.

Definition at line 286 of file qgstemporalnavigationobject.cpp.

◆ play

void QgsTemporalNavigationObject::play ( )
slot

Starts playing the temporal navigation from its current frame, using the direction specified by animationState()

Definition at line 281 of file qgstemporalnavigationobject.cpp.

◆ playBackward

void QgsTemporalNavigationObject::playBackward ( )
slot

Starts the animation playing in a reverse direction until the beginning of the time range.

Definition at line 304 of file qgstemporalnavigationobject.cpp.

◆ playForward

void QgsTemporalNavigationObject::playForward ( )
slot

Starts the animation playing in a forward direction up till the end of all frames.

Definition at line 292 of file qgstemporalnavigationobject.cpp.

◆ previous

void QgsTemporalNavigationObject::previous ( )
slot

Jumps back to the previous frame.

Note
Calling this slot does not change the current animation state, i.e. a paused animation will remain paused.

Definition at line 321 of file qgstemporalnavigationobject.cpp.

◆ rewindToStart

void QgsTemporalNavigationObject::rewindToStart ( )
slot

Rewinds the temporal navigation to start of the temporal extent.

Definition at line 326 of file qgstemporalnavigationobject.cpp.

◆ setAnimationState()

void QgsTemporalNavigationObject::setAnimationState ( Qgis::AnimationState  state)

Sets the current animation state.

See also
animationState()

Definition at line 353 of file qgstemporalnavigationobject.cpp.

◆ setAvailableTemporalRanges()

void QgsTemporalNavigationObject::setAvailableTemporalRanges ( const QList< QgsDateTimeRange > &  ranges)

Sets the list of all available temporal ranges which have data available.

The ranges list can be a list of non-contiguous ranges (i.e. containing gaps) which together describe the complete range of times which contain data.

See also
availableTemporalRanges()
Since
QGIS 3.20

Definition at line 205 of file qgstemporalnavigationobject.cpp.

◆ setCurrentFrameNumber()

void QgsTemporalNavigationObject::setCurrentFrameNumber ( long long  frame)

Sets the current animation frame number.

Calling this method will change the controllers current datetime range to match, based on the temporalExtents() and frameDuration() values.

See also
currentFrameNumber()

Definition at line 215 of file qgstemporalnavigationobject.cpp.

◆ setFrameDuration()

void QgsTemporalNavigationObject::setFrameDuration ( const QgsInterval duration)

Sets the frame duration, which dictates the temporal length of each frame in the animation.

Note
Calling this will reset the currentFrameNumber() to the closest temporal match for the previous temporal range.
See also
frameDuration()

Definition at line 232 of file qgstemporalnavigationobject.cpp.

◆ setFramesPerSecond()

void QgsTemporalNavigationObject::setFramesPerSecond ( double  rate)

Sets the animation frame rate, in frames per second.

This setting controls the overall playback speed of the animation, i.e. how quickly a playing animation will advance to the next frame.

See also
framesPerSecond()

Definition at line 257 of file qgstemporalnavigationobject.cpp.

◆ setLooping()

void QgsTemporalNavigationObject::setLooping ( bool  loop)

Sets whether the animation should loop after hitting the end or start frame.

See also
isLooping()

Definition at line 85 of file qgstemporalnavigationobject.cpp.

◆ setNavigationMode()

void QgsTemporalNavigationObject::setNavigationMode ( const Qgis::TemporalNavigationMode  mode)

Sets the temporal navigation mode.

See also
navigationMode()

Definition at line 141 of file qgstemporalnavigationobject.cpp.

◆ setTemporalExtents()

void QgsTemporalNavigationObject::setTemporalExtents ( const QgsDateTimeRange extents)

Sets the navigation temporal extents, which dictate the earliest and latest date time possible in the animation.

Note
Calling this will reset the currentFrameNumber() to the first frame.
See also
temporalExtents()

Definition at line 167 of file qgstemporalnavigationobject.cpp.

◆ setTemporalRangeCumulative()

void QgsTemporalNavigationObject::setTemporalRangeCumulative ( bool  state)

Sets the animation temporal range as cumulative.

See also
temporalRangeCumulative()

Definition at line 271 of file qgstemporalnavigationobject.cpp.

◆ setTotalMovieFrames()

void QgsTemporalNavigationObject::setTotalMovieFrames ( long long  frames)

Sets the total number of frames for the movie.

Note
This is only used when the navigationMode() is set to Qgis::TemporalNavigationMode::Movie.
See also
totalMovieFrames()
totalMovieFramesChanged()
Since
QGIS 3.36

Definition at line 69 of file qgstemporalnavigationobject.cpp.

◆ skipToEnd

void QgsTemporalNavigationObject::skipToEnd ( )
slot

Skips the temporal navigation to end of the temporal extent.

Definition at line 331 of file qgstemporalnavigationobject.cpp.

◆ stateChanged

void QgsTemporalNavigationObject::stateChanged ( Qgis::AnimationState  state)
signal

Emitted whenever the animation state changes.

◆ temporalExtents()

QgsDateTimeRange QgsTemporalNavigationObject::temporalExtents ( ) const

Returns the navigation temporal extents, which dictate the earliest and latest date time possible in the animation.

See also
setTemporalExtents()

Definition at line 200 of file qgstemporalnavigationobject.cpp.

◆ temporalExtentsChanged

void QgsTemporalNavigationObject::temporalExtentsChanged ( const QgsDateTimeRange extent)
signal

Emitted whenever the temporalExtent extent changes.

◆ temporalFrameDurationChanged

void QgsTemporalNavigationObject::temporalFrameDurationChanged ( const QgsInterval interval)
signal

Emitted whenever the frameDuration interval of the controller changes.

◆ temporalRangeCumulative()

bool QgsTemporalNavigationObject::temporalRangeCumulative ( ) const

Returns the animation temporal range cumulative settings.

See also
setTemporalRangeCumulative()

Definition at line 276 of file qgstemporalnavigationobject.cpp.

◆ totalFrameCount()

long long QgsTemporalNavigationObject::totalFrameCount ( ) const

Returns the total number of frames for the navigation.

Definition at line 337 of file qgstemporalnavigationobject.cpp.

◆ totalMovieFrames()

long long QgsTemporalNavigationObject::totalMovieFrames ( ) const

Returns the total number of frames for the movie.

Note
This is only used when the navigationMode() is set to Qgis::TemporalNavigationMode::Movie.
See also
setTotalMovieFrames()
totalMovieFramesChanged()
Since
QGIS 3.36

Definition at line 64 of file qgstemporalnavigationobject.cpp.

◆ totalMovieFramesChanged

void QgsTemporalNavigationObject::totalMovieFramesChanged ( long long  frames)
signal

Emitted whenever the total number of frames in the movie is changed.

Note
This is only used when the navigationMode() is set to Qgis::TemporalNavigationMode::Movie.
See also
setTotalMovieFrames()
totalMovieFrames()
Since
QGIS 3.36

The documentation for this class was generated from the following files: