OCCT3D OCCT 8.0.1
OCCT documentation

Search guides and API reference

Enter at least two characters.

    Open CASCADE Technology Reference Manual 8.0.1
    AIS_Animation Class Reference

    Class represents a basic animation class. AIS_Animation can be used as: More...

    #include <AIS_Animation.hxx>

    Inheritance diagram for AIS_Animation:

    Public Member Functions

     AIS_Animation (const TCollection_AsciiString &theAnimationName)
     Creates empty animation.
     ~AIS_Animation () override
     Destruct object, clear arguments.
    const TCollection_AsciiStringName () const
     Animation name.
    double StartPts () const
    void SetStartPts (const double thePtsStart)
     Sets time limits for animation in the animation timeline.
    double Duration () const
    void UpdateTotalDuration ()
     Update total duration considering all animations on timeline.
    bool HasOwnDuration () const
     Return true if duration is defined.
    double OwnDuration () const
    void SetOwnDuration (const double theDuration)
     Defines duration of the animation.
    void Add (const occ::handle< AIS_Animation > &theAnimation)
     Add single animation to the timeline.
    void Clear ()
     Clear animation timeline - remove all animations from it.
    occ::handle< AIS_AnimationFind (const TCollection_AsciiString &theAnimationName) const
     Return the child animation with the given name.
    bool Remove (const occ::handle< AIS_Animation > &theAnimation)
     Remove the child animation.
    bool Replace (const occ::handle< AIS_Animation > &theAnimationOld, const occ::handle< AIS_Animation > &theAnimationNew)
     Replace the child animation.
    void CopyFrom (const occ::handle< AIS_Animation > &theOther)
     Clears own children and then copy child animations from another object. Copy also Start Time and Duration values.
    const NCollection_Sequence< occ::handle< AIS_Animation > > & Children () const
     Return sequence of child animations.
    virtual void StartTimer (const double theStartPts, const double thePlaySpeed, const bool theToUpdate, const bool theToStopTimer=false)
     Start animation with internally defined timer instance. Calls ::Start() internally.
    virtual double UpdateTimer ()
     Update single frame of animation, update timer state.
    double ElapsedTime () const
     Return elapsed time.
    const occ::handle< Media_Timer > & Timer () const
     Return playback timer.
    void SetTimer (const occ::handle< Media_Timer > &theTimer)
     Set playback timer.
    virtual void Start (const bool theToUpdate)
     Start animation. This method changes status of the animation to Started. This status defines whether animation is to be performed in the timeline or not.
    virtual void Pause ()
     Pause the process timeline.
    virtual void Stop ()
     Stop animation. This method changed status of the animation to Stopped. This status shows that animation will not be performed in the timeline or it is finished.
    bool IsStopped ()
     Check if animation is to be performed in the animation timeline.
    virtual bool Update (const double thePts)
     Update single frame of animation, update timer state.
    Public Member Functions inherited from Standard_Transient
     Standard_Transient ()
     Empty constructor.
     Standard_Transient (const Standard_Transient &)
     Copy constructor – does nothing.
    Standard_Transientoperator= (const Standard_Transient &)
     Assignment operator, needed to avoid copying reference counter.
    virtual ~Standard_Transient ()=default
     Destructor must be virtual.
    virtual const opencascade::handle< Standard_Type > & DynamicType () const
     Returns a type descriptor about this object.
    bool IsInstance (const opencascade::handle< Standard_Type > &theType) const
     Returns a true value if this is an instance of Type.
    bool IsInstance (const char *const theTypeName) const
     Returns a true value if this is an instance of TypeName.
    bool IsKind (const opencascade::handle< Standard_Type > &theType) const
     Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
    bool IsKind (const char *const theTypeName) const
     Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
    Standard_TransientThis () const
     Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero.
    int GetRefCount () const noexcept
     Get the reference counter of this object.
    void IncrementRefCounter () noexcept
     Increments the reference counter of this object. Uses relaxed memory ordering since incrementing only requires atomicity, not synchronization with other memory operations.
    int DecrementRefCounter () noexcept
     Decrements the reference counter of this object; returns the decremented value. Uses release ordering for the decrement to ensure all writes to the object are visible before the count reaches zero. An acquire fence is added only when the count reaches zero, ensuring proper synchronization before deletion. This is more efficient than using acq_rel for every decrement.
    virtual void Delete () const
     Memory deallocator for transient classes.

    Protected Types

    enum  AnimationState { AnimationState_Started , AnimationState_Stopped , AnimationState_Paused }
     Defines animation state. More...

    Protected Member Functions

    virtual void updateWithChildren (const AIS_AnimationProgress &thePosition)
     Process one step of the animation according to the input time progress, including all children. Calls also ::update() to update own animation.
    virtual void update (const AIS_AnimationProgress &theProgress)
     Update the own animation to specified position - should be overridden by sub-class.

    Protected Attributes

    occ::handle< Media_TimermyTimer
    TCollection_AsciiString myName
     animation name
    NCollection_Sequence< occ::handle< AIS_Animation > > myAnimations
     sequence of child animations
    AnimationState myState
     animation state - started, stopped of paused
    double myPtsStart
     time of start in the timeline
    double myOwnDuration
     duration of animation excluding children
    double myChildrenDuration
     duration of animation including children

    Additional Inherited Members

    typedef void base_type
     Returns a type descriptor about this object.
    static constexpr const char * get_type_name ()
     Returns a type descriptor about this object.
    static const opencascade::handle< Standard_Type > & get_type_descriptor ()
     Returns type descriptor of Standard_Transient class.

    Detailed Description

    Class represents a basic animation class. AIS_Animation can be used as:

    • Animation Implementor Sub-classes should override method AIS_Animation::update() to perform specific animation. AIS package provides limited number of such animation atoms - classes AIS_AnimationObject and AIS_AnimationCamera, which could be enough for defining a simple animation. In general case, application is expected defining own AIS_Animation sub-classes implementing application-specific animation logic (e.g. another interpolation or another kind of transformations - like color transition and others). The basic conception of AIS_Animation::update() is defining an exact scene state for the current presentation timestamp, providing a smooth and continuous animation well defined at any time step and in any direction. So that a time difference between two sequential drawn Viewer frames can vary from frame to frame without visual artifacts, increasing rendering framerate would not lead to animation being executed too fast and low framerate (on slow hardware) would not lead to animation played longer than defined duration. Hence, implementation should avoid usage of incremental step logic or should apply it very carefully.
    • Animation Container AIS_Animation (no sub-classing) can be used to aggregate a sequence of Animation items (children). Each children should be defined with its own duration and start time (presentation timestamp). It is possible defining collection of nested AIS_Animation items, so that within each container level children define start playback time relative to its holder.
    • Animation playback Controller It is suggested that application would define a single AIS_Animation instance (optional sub-classing) for controlling animation playback as whole. Such controller should be filled in by other AIS_Animation as children objects, and will be managed by application by calling StartTimer(), UpdateTimer() and IsStopped() methods.

    Note, that AIS_Animation::StartTimer() defines a timer calculating an elapsed time, not a multimedia timer executing Viewer updates at specific intervals! Application should avoid using implicit and immediate Viewer updates to ensure that AIS_Animation::UpdateTimer() is called before each redrawing of a Viewer content. Redrawing logic should be also managed at application level for managing a smooth animation (by defining a multimedia timer provided by used GUI framework executing updates at desired framerate, or as continuous redraws in loop).

    Member Enumeration Documentation

    ◆ AnimationState

    Defines animation state.

    Enumerator
    AnimationState_Started 

    animation is in progress

    AnimationState_Stopped 

    animation is finished, force stopped or not started

    AnimationState_Paused 

    animation is paused and can be started from the pause moment

    Constructor & Destructor Documentation

    ◆ AIS_Animation()

    AIS_Animation::AIS_Animation ( const TCollection_AsciiString & theAnimationName)

    Creates empty animation.

    ◆ ~AIS_Animation()

    AIS_Animation::~AIS_Animation ( )
    override

    Destruct object, clear arguments.

    Member Function Documentation

    ◆ Add()

    void AIS_Animation::Add ( const occ::handle< AIS_Animation > & theAnimation)

    Add single animation to the timeline.

    Parameters
    theAnimationinput animation

    ◆ Children()

    const NCollection_Sequence< occ::handle< AIS_Animation > > & AIS_Animation::Children ( ) const
    inline

    Return sequence of child animations.

    ◆ Clear()

    void AIS_Animation::Clear ( )

    Clear animation timeline - remove all animations from it.

    ◆ CopyFrom()

    void AIS_Animation::CopyFrom ( const occ::handle< AIS_Animation > & theOther)

    Clears own children and then copy child animations from another object. Copy also Start Time and Duration values.

    ◆ Duration()

    double AIS_Animation::Duration ( ) const
    inline
    Returns
    duration of the animation in the timeline

    ◆ ElapsedTime()

    double AIS_Animation::ElapsedTime ( ) const
    inline

    Return elapsed time.

    ◆ Find()

    occ::handle< AIS_Animation > AIS_Animation::Find ( const TCollection_AsciiString & theAnimationName) const

    Return the child animation with the given name.

    ◆ HasOwnDuration()

    bool AIS_Animation::HasOwnDuration ( ) const
    inline

    Return true if duration is defined.

    ◆ IsStopped()

    bool AIS_Animation::IsStopped ( )
    inline

    Check if animation is to be performed in the animation timeline.

    Returns
    True if it is stopped of finished.

    ◆ Name()

    const TCollection_AsciiString & AIS_Animation::Name ( ) const
    inline

    Animation name.

    ◆ OwnDuration()

    double AIS_Animation::OwnDuration ( ) const
    inline
    Returns
    own duration of the animation in the timeline

    ◆ Pause()

    virtual void AIS_Animation::Pause ( )
    virtual

    Pause the process timeline.

    ◆ Remove()

    bool AIS_Animation::Remove ( const occ::handle< AIS_Animation > & theAnimation)

    Remove the child animation.

    ◆ Replace()

    bool AIS_Animation::Replace ( const occ::handle< AIS_Animation > & theAnimationOld,
    const occ::handle< AIS_Animation > & theAnimationNew )

    Replace the child animation.

    ◆ SetOwnDuration()

    void AIS_Animation::SetOwnDuration ( const double theDuration)
    inline

    Defines duration of the animation.

    ◆ SetStartPts()

    void AIS_Animation::SetStartPts ( const double thePtsStart)
    inline

    Sets time limits for animation in the animation timeline.

    ◆ SetTimer()

    void AIS_Animation::SetTimer ( const occ::handle< Media_Timer > & theTimer)
    inline

    Set playback timer.

    ◆ Start()

    virtual void AIS_Animation::Start ( const bool theToUpdate)
    virtual

    Start animation. This method changes status of the animation to Started. This status defines whether animation is to be performed in the timeline or not.

    Parameters
    theToUpdatecall Update() method

    ◆ StartPts()

    double AIS_Animation::StartPts ( ) const
    inline
    Returns
    start time of the animation in the timeline

    ◆ StartTimer()

    virtual void AIS_Animation::StartTimer ( const double theStartPts,
    const double thePlaySpeed,
    const bool theToUpdate,
    const bool theToStopTimer = false )
    virtual

    Start animation with internally defined timer instance. Calls ::Start() internally.

    Note, that this method initializes a timer calculating an elapsed time (presentation timestamps within AIS_Animation::UpdateTimer()), not a multimedia timer executing Viewer updates at specific intervals! Viewer redrawing should be managed at application level, so that AIS_Animation::UpdateTimer() is called once right before each redrawing of a Viewer content.

    Parameters
    theStartPtsstarting timer position (presentation timestamp)
    thePlaySpeedplayback speed (1.0 means normal speed)
    theToUpdateflag to update defined animations to specified start position
    theToStopTimerflag to pause timer at the starting position

    ◆ Stop()

    virtual void AIS_Animation::Stop ( )
    virtual

    Stop animation. This method changed status of the animation to Stopped. This status shows that animation will not be performed in the timeline or it is finished.

    ◆ Timer()

    const occ::handle< Media_Timer > & AIS_Animation::Timer ( ) const
    inline

    Return playback timer.

    ◆ Update()

    virtual bool AIS_Animation::Update ( const double thePts)
    virtual

    Update single frame of animation, update timer state.

    Parameters
    [in]thePtsthe time moment within [0; Duration()]
    Returns
    True if timeline is in progress

    ◆ update()

    virtual void AIS_Animation::update ( const AIS_AnimationProgress & theProgress)
    inlineprotectedvirtual

    Update the own animation to specified position - should be overridden by sub-class.

    Reimplemented in AIS_AnimationAxisRotation, AIS_AnimationCamera, and AIS_AnimationObject.

    ◆ UpdateTimer()

    virtual double AIS_Animation::UpdateTimer ( )
    virtual

    Update single frame of animation, update timer state.

    Returns
    current time of timeline progress.

    ◆ UpdateTotalDuration()

    void AIS_Animation::UpdateTotalDuration ( )

    Update total duration considering all animations on timeline.

    ◆ updateWithChildren()

    virtual void AIS_Animation::updateWithChildren ( const AIS_AnimationProgress & thePosition)
    protectedvirtual

    Process one step of the animation according to the input time progress, including all children. Calls also ::update() to update own animation.

    Field Documentation

    ◆ myAnimations

    NCollection_Sequence<occ::handle<AIS_Animation> > AIS_Animation::myAnimations
    protected

    sequence of child animations

    ◆ myChildrenDuration

    double AIS_Animation::myChildrenDuration
    protected

    duration of animation including children

    ◆ myName

    TCollection_AsciiString AIS_Animation::myName
    protected

    animation name

    ◆ myOwnDuration

    double AIS_Animation::myOwnDuration
    protected

    duration of animation excluding children

    ◆ myPtsStart

    double AIS_Animation::myPtsStart
    protected

    time of start in the timeline

    ◆ myState

    AnimationState AIS_Animation::myState
    protected

    animation state - started, stopped of paused

    ◆ myTimer

    occ::handle<Media_Timer> AIS_Animation::myTimer
    protected

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