visad.java2d
Class AnimationControlJ2D

java.lang.Object
  extended by visad.Control
      extended by visad.java2d.AVControlJ2D
          extended by visad.java2d.AnimationControlJ2D
All Implemented Interfaces:
Serializable, Cloneable, Runnable, AnimationControl, AVControl

public class AnimationControlJ2D
extends AVControlJ2D
implements Runnable, AnimationControl

AnimationControlJ2D is the VisAD class for controlling Animation display scalars under Java2D.

WLH - manipulate a list of VisADSwitch nodes in scene graph.

See Also:
Serialized Form

Constructor Summary
AnimationControlJ2D(DisplayImplJ2D d, RealType r)
           
 
Method Summary
 boolean equals(Object o)
          Indicates whether or not this instance equals an Object
 boolean getComputeSet()
          Get the flag to automatically compute the animation set if it is null
 int getCurrent()
          get the current ordinal step number
 boolean getDirection()
          Get the animation direction.
 boolean getOn()
          return true if automatic stepping is on
 String getSaveString()
          get a String that can be used to reconstruct this AnimationControl later
 Set getSet()
           
 long getStep()
          Return the dwell time for the current step
 long[] getSteps()
          return an array of the dwell times for all the steps.
 void init()
          actually set Switches (Java3D) or VisADSwitches (Java2D) to child nodes corresponding to current ordinal step number
 void nullControl()
          end this control (called by ScalarMap.nullDisplay())
 void run()
          a single invocation implements anmation behavior until stop() is called
 void setComputeSet(boolean compute)
          Set the flag to automatically compute the animation set if it is null
 void setCurrent(double value)
          set the current step by the value of the RealType mapped to Display.Animation
 void setCurrent(int c)
          set the current ordinal step number = c
 void setDirection(boolean dir)
          Set the animation direction.
 void setOn(boolean o)
          Set automatic stepping on or off.
 void setSaveString(String save)
          reconstruct this AnimationControl using the specified save string
 void setSet(Set s)
          Sets the set of times in this animation control.
 void setSet(Set s, boolean noChange)
          Sets the set of times in this animation control.
 void setStep(int st)
          Set the dwell rate between animation steps to a constant value
 void setSteps(int[] steps)
          set the dwell time for individual steps.
 void stop()
          stop activity in this AnimationControl
 boolean subCheckTicks(DataRenderer r, DataDisplayLink link)
          run checkTicks on any sub-Controls this default for no sub-Controls
 boolean subPeekTicks(DataRenderer r, DataDisplayLink link)
          run peekTicks on any sub-Controls this default for no sub-Controls
 void subResetTicks()
          run resetTicks on any sub-Controls this default for no sub-Controls
 void subSetTicks()
          run setTicks on any sub-Controls; this default for no sub-Controls
 void syncControl(Control rmt)
          copy the state of a remote control to this control
 void takeStep()
          advance one step (forward or backward)
 void toggle()
          toggle automatic stepping between off and on
 String toString()
           
 
Methods inherited from class visad.java2d.AVControlJ2D
clearSwitches, selectSwitches
 
Methods inherited from class visad.Control
addControlListener, animation_string, changeControl, checkTicks, clone, getDisplay, getDisplayRenderer, getInstanceNumber, incTick, peekTicks, removeControlListener, resetTicks, setTicks
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface visad.AVControl
addControlListener, clearSwitches, removeControlListener
 

Constructor Detail

AnimationControlJ2D

public AnimationControlJ2D(DisplayImplJ2D d,
                           RealType r)
Method Detail

nullControl

public void nullControl()
Description copied from class: Control
end this control (called by ScalarMap.nullDisplay())

Overrides:
nullControl in class Control

stop

public void stop()
Description copied from interface: AnimationControl
stop activity in this AnimationControl

Specified by:
stop in interface AnimationControl

run

public void run()
Description copied from interface: AnimationControl
a single invocation implements anmation behavior until stop() is called

Specified by:
run in interface Runnable
Specified by:
run in interface AnimationControl

getCurrent

public int getCurrent()
get the current ordinal step number

Specified by:
getCurrent in interface AnimationControl
Returns:
the current ordinal step number

setCurrent

public void setCurrent(int c)
                throws VisADException,
                       RemoteException
set the current ordinal step number = c

Specified by:
setCurrent in interface AnimationControl
Parameters:
c - - value for current ordinal step number
Throws:
VisADException - - a VisAD error occurred
RemoteException - - an RMI error occurred

setCurrent

public void setCurrent(double value)
                throws VisADException,
                       RemoteException
set the current step by the value of the RealType mapped to Display.Animation

Specified by:
setCurrent in interface AnimationControl
Parameters:
value - - RealType value that is converted to an ordinal step number
Throws:
VisADException - - a VisAD error occurred
RemoteException - - an RMI error occurred

setDirection

public void setDirection(boolean dir)
                  throws VisADException,
                         RemoteException
Set the animation direction.

Specified by:
setDirection in interface AnimationControl
Parameters:
dir - true for forward, false for backward
Throws:
VisADException - Couldn't create necessary VisAD object. The direction remains unchanged.
RemoteException - Java RMI exception

getDirection

public boolean getDirection()
Get the animation direction.

Specified by:
getDirection in interface AnimationControl
Returns:
true for forward, false for backward

getStep

public long getStep()
Return the dwell time for the current step

Specified by:
getStep in interface AnimationControl
Returns:
the dwell time for the current step (in ms)

getSteps

public long[] getSteps()
return an array of the dwell times for all the steps.

Specified by:
getSteps in interface AnimationControl
Returns:
an array of the dwell times for all the steps (in ms)

setStep

public void setStep(int st)
             throws VisADException,
                    RemoteException
Set the dwell rate between animation steps to a constant value

Specified by:
setStep in interface AnimationControl
Parameters:
st - dwell time in milliseconds
Throws:
VisADException - Couldn't create necessary VisAD object. The dwell time remains unchanged.
RemoteException - Java RMI exception

setSteps

public void setSteps(int[] steps)
              throws VisADException,
                     RemoteException
set the dwell time for individual steps.

Specified by:
setSteps in interface AnimationControl
Parameters:
steps - an array of dwell rates for each step in the animation If the length of the array is less than the number of frames in the animation, the subsequent step values will be set to the value of the last step.
Throws:
VisADException - Couldn't create necessary VisAD object. The dwell times remain unchanged.
RemoteException - Java RMI exception

takeStep

public void takeStep()
              throws VisADException,
                     RemoteException
advance one step (forward or backward)

Specified by:
takeStep in interface AnimationControl
Throws:
VisADException - Couldn't create necessary VisAD object. No step is taken.
RemoteException - Java RMI exception

init

public void init()
          throws VisADException
Description copied from interface: AnimationControl
actually set Switches (Java3D) or VisADSwitches (Java2D) to child nodes corresponding to current ordinal step number

Specified by:
init in interface AnimationControl
Throws:
VisADException - - a VisAD error occurred.

getSet

public Set getSet()
Specified by:
getSet in interface AnimationControl
Returns:
Set of RealType values for animation steps, in RealType mapped to Animation

setSet

public void setSet(Set s)
            throws VisADException,
                   RemoteException

Sets the set of times in this animation control. If the argument set is equal to the current set, then nothing is done.

Specified by:
setSet in interface AnimationControl
Parameters:
s - The set of times.
Throws:
VisADException - if a VisAD failure occurs.
RemoteException - if a Java RMI failure occurs.

setSet

public void setSet(Set s,
                   boolean noChange)
            throws VisADException,
                   RemoteException

Sets the set of times in this animation control. If the argument set is equal to the current set, then nothing is done.

Specified by:
setSet in interface AnimationControl
Parameters:
s - The set of times.
noChange - changeControl(!noChange) to not trigger re-transform, used by ScalarMap.setRange
Throws:
VisADException - if a VisAD failure occurs.
RemoteException - if a Java RMI failure occurs.

getOn

public boolean getOn()
return true if automatic stepping is on

Specified by:
getOn in interface AnimationControl
Returns:
true if automatic stepping is on, false otherwise

setOn

public void setOn(boolean o)
           throws VisADException,
                  RemoteException
Set automatic stepping on or off.

Specified by:
setOn in interface AnimationControl
Parameters:
o - true = turn stepping on, false = turn stepping off
Throws:
VisADException - Couldn't create necessary VisAD object. No change in automatic stepping occurs.
RemoteException - Java RMI exception

toggle

public void toggle()
            throws VisADException,
                   RemoteException
toggle automatic stepping between off and on

Specified by:
toggle in interface AnimationControl
Throws:
VisADException - Couldn't create necessary VisAD object. No change in automatic stepping occurs.
RemoteException - Java RMI exception

subSetTicks

public void subSetTicks()
Description copied from class: Control
run setTicks on any sub-Controls; this default for no sub-Controls

Overrides:
subSetTicks in class Control

subCheckTicks

public boolean subCheckTicks(DataRenderer r,
                             DataDisplayLink link)
Description copied from class: Control
run checkTicks on any sub-Controls this default for no sub-Controls

Overrides:
subCheckTicks in class Control
Parameters:
r - DataRenderer to check if changes to this Control require re-transform
link - DataDisplayLink involved in decision whether changes to this Control require re-transform
Returns:
'logical or' of values from checkTicks on sub-Controls

subPeekTicks

public boolean subPeekTicks(DataRenderer r,
                            DataDisplayLink link)
Description copied from class: Control
run peekTicks on any sub-Controls this default for no sub-Controls

Overrides:
subPeekTicks in class Control
Parameters:
r - DataRenderer to check if changes to this Control require re-transform
link - DataDisplayLink involved in decision whether changes to this Control require re-transform
Returns:
'logical or' of values from peekTicks on sub-Controls

subResetTicks

public void subResetTicks()
Description copied from class: Control
run resetTicks on any sub-Controls this default for no sub-Controls

Overrides:
subResetTicks in class Control

getSaveString

public String getSaveString()
get a String that can be used to reconstruct this AnimationControl later

Specified by:
getSaveString in interface AVControl
Specified by:
getSaveString in class Control
Returns:
String representation of this Control

setSaveString

public void setSaveString(String save)
                   throws VisADException,
                          RemoteException
reconstruct this AnimationControl using the specified save string

Specified by:
setSaveString in interface AVControl
Specified by:
setSaveString in class Control
Parameters:
save - - String representation for reconstruction
Throws:
VisADException - if a VisAD error occurs
RemoteException - if an RMI error occurs

syncControl

public void syncControl(Control rmt)
                 throws VisADException
copy the state of a remote control to this control

Specified by:
syncControl in class Control
Parameters:
rmt - remote Control whose state is copied
Throws:
VisADException - if a VisAD error occurs

equals

public boolean equals(Object o)
Description copied from class: Control
Indicates whether or not this instance equals an Object

Overrides:
equals in class AVControlJ2D
Parameters:
o - an Object
Returns:
true if and only if this instance is equal to o

toString

public String toString()
Overrides:
toString in class Control
Returns:
a simple String representation of this Control

setComputeSet

public void setComputeSet(boolean compute)
Set the flag to automatically compute the animation set if it is null

Specified by:
setComputeSet in interface AnimationControl
Parameters:
compute - false to allow application to control set computation if set is null.

getComputeSet

public boolean getComputeSet()
Get the flag to automatically compute the animation set if it is null

Specified by:
getComputeSet in interface AnimationControl
Returns:
true if should compute