LuciadCPillar 2023.1.04
luciad::AnimationManager Class Referenceabstract

Class that starts, updates and stops luciad::IAnimation objects that are assigned to it. More...

#include <luciad/animations/AnimationManager.h>

Classes

struct  OngoingAnimation
 This struct represents an animation that has been started in AnimationManager and has not been stopped yet. More...
 

Public Member Functions

virtual ~AnimationManager ()=default
 
virtual std::optional< OngoingAnimationgetCurrentAnimation (const std::string &key)=0
 Returns the currently ongoing animation if present or std::nullopt if no animation with that key is ongoing. More...
 
virtual void startAnimation (const std::string &key, std::shared_ptr< IAnimation > animation)=0
 Starts a new animation. More...
 
virtual void stopAnimation (const std::string &key)=0
 Stops the animation that was added with the given key, if present. More...
 

Detailed Description

Class that starts, updates and stops luciad::IAnimation objects that are assigned to it.

This class is used by the Map class. See luciad::Map::getAnimationManager.

Since
2021.1

Constructor & Destructor Documentation

◆ ~AnimationManager()

virtual luciad::AnimationManager::~AnimationManager ( )
virtualdefault

Member Function Documentation

◆ getCurrentAnimation()

virtual std::optional< OngoingAnimation > luciad::AnimationManager::getCurrentAnimation ( const std::string &  key)
pure virtual

Returns the currently ongoing animation if present or std::nullopt if no animation with that key is ongoing.

Parameters
keyThe key attached to an animation
Returns
the currently ongoing animation if present or std::nullopt if no animation with that key is ongoing.

◆ startAnimation()

virtual void luciad::AnimationManager::startAnimation ( const std::string &  key,
std::shared_ptr< IAnimation animation 
)
pure virtual

Starts a new animation.

Upon starting, the animation manager invokes IAnimation::onStart on the IAnimation.

Each animation has a key attached to it. You can stop an animation by invoking luciad::AnimationManager::stopAnimation with this key or you can replace the animation by invoking luciad::AnimationManager::startAnimation with the same key.

Parameters
keyThe key attached to that animation. If an animation is already playing with that key, the manager stops it before starting the new animation.
animationThe luciad::IAnimation object to be played, cannot be nullptr.
Exceptions
luciad::NullArgumentExceptionwhen the passed animation is nullptr.

◆ stopAnimation()

virtual void luciad::AnimationManager::stopAnimation ( const std::string &  key)
pure virtual

Stops the animation that was added with the given key, if present.

If an animation is currently playing with that key, the manager invokes IAnimation::onStop on that animation.

Parameters
keyThe key attached to the animation that should be removed.