Class ALcdAnimationManager

java.lang.Object
com.luciad.view.animation.ALcdAnimationManager

public abstract class ALcdAnimationManager extends Object
A global manager for animation playback. Multiple ILcdAnimation instances can be played back simultaneously. However, each animation must be associated with a particular key. Only one animation can be bound to a single key at the same time, so as to prevent conflicts between animations that try to assign different values to the same parameters of an animated object (e.g. multiple animations that want to modify the world-to-view transformation of the view).

This class is a singleton. The animation manager uses a separate thread to keep track of time, but invokes the setTime method of the animations on the painting thread.

The setTargetUpdateRate(double) method sets the target frame rate at which animations are played. For every frame, each animation's setTime() method is called with the time elapsed since the animation was started. An animation is started (ILcdAnimation.start()) when being added to the animation manager ( putAnimation(Object[], ILcdAnimation) ) and stopped (ILcdAnimation.stop()) when it has reached the end of its duration and does not need to be looped, or when it is explicitly removed using removeAnimation(Object[]). When looped animations (ILcdAnimation.isLoop()) have reached the end of their duration, the animation manager invokes ILcdAnimation.restart() to initiate a new loop. Animations that affect an ILcdView should be implemented by extending ALcdAnimation where the relevant views can be provided as constructor arguments.

Since:
2012.0
  • Method Details

    • getInstance

      public static ALcdAnimationManager getInstance()
      Returns the singleton instance of this class.
      Returns:
      the singleton instance of this class
    • setTargetUpdateRate

      public abstract void setTargetUpdateRate(double aTargetUpdateRate)
      The argument to this method specifies the desired animation update rate (in frames per second).
      Parameters:
      aTargetUpdateRate - the desired animation framerate
    • getTargetUpdateRate

      public abstract double getTargetUpdateRate()
      Returns the target update rate (in frames per second).
      Returns:
      the target update rate
    • setPaused

      public abstract void setPaused(boolean aPaused)
      Pauses this animation manager. All of the animations in this animation manager will be suspended until this method is called with a false argument.
      Parameters:
      aPaused - if true, pauses all running animations. If false, continues all paused animations from the point they were paused.
      See Also:
    • isPaused

      public abstract boolean isPaused()
      Checks whether the animation manager is paused or not.
      Returns:
      true if the animation manager is paused, false otherwise.
      See Also:
    • putAnimation

      public abstract void putAnimation(Object aAnimatedObjectKey, ILcdAnimation aAnimation)
      Starts the specified animation for the given key. Only one animation can be active for a key at any given time. Therefore, if another animation is already present for the specified key (and it is still running), it is first stopped and removed.
      Parameters:
      aAnimatedObjectKey - the object with which to associate the animation
      aAnimation - the animation to be played back
    • putAnimation

      public abstract void putAnimation(Object[] aAnimatedObjectKeys, ILcdAnimation aAnimation)
      Starts the specified animation for an array of keys. Only one animation can be active for a given array of keys at any given time. Therefore, if another animation is already present for the specified array (and it is still running), it is first stopped and removed.
      Parameters:
      aAnimatedObjectKeys - the array of keys with which to associate the animation
      aAnimation - the animation to be played back
    • getAnimation

      public abstract ILcdAnimation getAnimation(Object[] aAnimatedObjectKeys)
      Returns the current animation for the passed keys, or null if there isn't one. Use this for instance to check if the current animation is yours before removing it.
      Parameters:
      aAnimatedObjectKeys - the objects with which to associate the animation
      Returns:
      the current animation for the passed object or null.
    • getAnimation

      public abstract ILcdAnimation getAnimation(Object aAnimatedObjectKey)
      Returns the current animation for the passed key, or null if there isn't one. Use this for instance to check if the current animation is yours before removing it.
      Parameters:
      aAnimatedObjectKey - the object with which to associate the animation
      Returns:
      the current animation for the passed object or null.
    • removeAnimation

      public abstract void removeAnimation(Object aAnimatedObjectKey)
      Stops and removes the animation associated with the specified key, if any.
      Parameters:
      aAnimatedObjectKey - the object from which to remove any currently running animation
    • removeAnimation

      public abstract void removeAnimation(Object[] aAnimatedObjectKeys)
      Stops and removes the animation associated with the specified array of keys, if any.
      Parameters:
      aAnimatedObjectKeys - the array of keys for which to remove any currently running animation
    • getAnimationCount

      public abstract int getAnimationCount()
      Gets the number of registered animations.
      Returns:
      the number of registered animations.
    • isRunning

      public abstract boolean isRunning()
      Determines whether the animation manager is running.

      Note that the animation manager is automatically started when an animation is added and stopped when the last animation finishes.

      Returns:
      true if running, {code false} if not running
    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener aListener)
      Adds the given listener so that it gets notified of property changes.
      Parameters:
      aListener - the listener to add
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener aListener)
      Removes the given listener so that it no longer gets notified of property changes.
      Parameters:
      aListener - the listener to remove