Xj3D VRML/X3D Code API

org.web3d.vrml.renderer.common.nodes
Class BaseTimeControlledNode

java.lang.Object
  extended byorg.web3d.vrml.renderer.common.nodes.AbstractNode
      extended byorg.web3d.vrml.renderer.common.nodes.BaseTimeDependentNode
          extended byorg.web3d.vrml.renderer.common.nodes.BaseTimeControlledNode
All Implemented Interfaces:
FrameStateListener, VRMLChildNodeType, VRMLNode, VRMLNodeType, VRMLTimeControlledNodeType, VRMLTimeDependentNodeType

public abstract class BaseTimeControlledNode
extends BaseTimeDependentNode
implements VRMLTimeControlledNodeType

An abstract representation of any form of time dependent node for subclassing by specific implementations.

The implementation performs the basic handling of the time fields but does not create any data structures for them to run with.

Version:
$Revision: 1.7 $
Author:
Justin Couch

Field Summary
protected static int FIELD_ELAPSED_TIME
          The field index for elapsedTime
protected static int FIELD_LOOP
          The field index for Loop
protected static int FIELD_PAUSE_TIME
          The field index for pauseTime
protected static int FIELD_RESUME_TIME
          The field index for resumeTime
protected static int FIELD_START_TIME
          The field index for startTime
protected static int FIELD_STOP_TIME
          The field index for stopTime
protected static int LAST_TIME_INDEX
          The last field index used by this class
protected  double vfElapsedTime
          The value of the pauseTime field
protected  boolean vfLoop
          The value of the loop field
protected  double vfPauseTime
          The value of the pauseTime field
protected  double vfResumeTime
          The value of the resumeTime field
protected  double vfStartTime
          The value of the startTime field
protected  double vfStopTime
          The value of the stopTime field
 
Fields inherited from class org.web3d.vrml.renderer.common.nodes.BaseTimeDependentNode
vrmlClock
 
Fields inherited from class org.web3d.vrml.renderer.common.nodes.AbstractNode
BAD_NODE_MSG, errorReporter, FIELD_METADATA, fieldData, hasChanged, INIT_ONLY_WRITE_MSG, inSetup, isDEF, isStatic, LAST_NODE_INDEX, METADATA_NODE_MSG, METADATA_PROTO_MSG, nodeName, pMetadata, refCount, stateManager, vfMetadata, vrmlMajorVersion, vrmlMinorVersion
 
Constructor Summary
protected BaseTimeControlledNode(java.lang.String name)
          Initialise the time dependent node and it's fields that are held locally.
 
Method Summary
protected  void copy(VRMLTimeControlledNodeType node)
          Set the fields of the time dependant node that has the fields set based on the fields of the passed in node.
 VRMLFieldData getFieldValue(int index)
          Get the value of a field.
 boolean getLoop()
          Accessor method to get current value of field loop, default value is false
 double getStartTime()
          Accessor method to get current value of field startTime, default value is 0.
 double getStopTime()
          Accessor method to get current value of field stopTime, default value is 0
 void setLoop(boolean newLoop)
          Accessor method to set a new value for field attribute loop
 void setPauseTime(double newPauseTime)
          Accessor method to set a new value for field attribute pauseTime
 void setResumeTime(double newResumeTime)
          Accessor method to set a new value for field attribute resumeTime
 void setStartTime(double newStartTime)
          Accessor method to set a new value for field attribute startTime
 void setStopTime(double newStopTime)
          Accessor method to set a new value for field attribute stopTime
 void setValue(int index, boolean value)
          Set the value of the field at the given index as a boolean.
 void setValue(int index, double value)
          Set the value of the field at the given index as a double for the SFTime fields.
 
Methods inherited from class org.web3d.vrml.renderer.common.nodes.BaseTimeDependentNode
setVRMLClock
 
Methods inherited from class org.web3d.vrml.renderer.common.nodes.AbstractNode
addNodeListener, allEventsComplete, checkNodeType, checkSecondaryType, checkSecondaryType, fireFieldChanged, getMetadataObject, getNodeFieldIndices, getRefCount, getSecondaryType, getUserData, getVRMLNodeName, hasFieldChanged, isDEF, isSetupFinished, notifyExternProtoLoaded, removeNodeListener, sendRoute, setDEF, setErrorReporter, setFrameStateManager, setMetadataObject, setupFinished, setUserData, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setVersion, updateRefCount
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.web3d.vrml.nodes.VRMLTimeDependentNodeType
setVRMLClock
 
Methods inherited from interface org.web3d.vrml.nodes.VRMLNodeType
addNodeListener, getMetadataObject, getRefCount, hasFieldChanged, isSetupFinished, notifyExternProtoLoaded, removeNodeListener, sendRoute, setDEF, setFrameStateManager, setMetadataObject, setupFinished, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, updateRefCount
 
Methods inherited from interface org.web3d.vrml.lang.VRMLNode
getFieldDeclaration, getFieldIndex, getNodeFieldIndices, getNumFields, getPrimaryType, getSecondaryType, getUserData, getVRMLNodeName, isDEF, setErrorReporter, setUserData, setVersion
 
Methods inherited from interface org.web3d.vrml.nodes.FrameStateListener
allEventsComplete
 

Field Detail

FIELD_LOOP

protected static final int FIELD_LOOP
The field index for Loop

See Also:
Constant Field Values

FIELD_START_TIME

protected static final int FIELD_START_TIME
The field index for startTime

See Also:
Constant Field Values

FIELD_STOP_TIME

protected static final int FIELD_STOP_TIME
The field index for stopTime

See Also:
Constant Field Values

FIELD_PAUSE_TIME

protected static final int FIELD_PAUSE_TIME
The field index for pauseTime

See Also:
Constant Field Values

FIELD_RESUME_TIME

protected static final int FIELD_RESUME_TIME
The field index for resumeTime

See Also:
Constant Field Values

FIELD_ELAPSED_TIME

protected static final int FIELD_ELAPSED_TIME
The field index for elapsedTime

See Also:
Constant Field Values

LAST_TIME_INDEX

protected static final int LAST_TIME_INDEX
The last field index used by this class

See Also:
Constant Field Values

vfLoop

protected boolean vfLoop
The value of the loop field


vfStartTime

protected double vfStartTime
The value of the startTime field


vfStopTime

protected double vfStopTime
The value of the stopTime field


vfPauseTime

protected double vfPauseTime
The value of the pauseTime field


vfResumeTime

protected double vfResumeTime
The value of the resumeTime field


vfElapsedTime

protected double vfElapsedTime
The value of the pauseTime field

Constructor Detail

BaseTimeControlledNode

protected BaseTimeControlledNode(java.lang.String name)
Initialise the time dependent node and it's fields that are held locally.

Parameters:
name - The name of the type of node
Method Detail

copy

protected void copy(VRMLTimeControlledNodeType node)
Set the fields of the time dependant node that has the fields set based on the fields of the passed in node. This will not copy any children nodes, only the local fields.

Parameters:
node - The grouping node to copy info from

setLoop

public void setLoop(boolean newLoop)
Accessor method to set a new value for field attribute loop

Specified by:
setLoop in interface VRMLTimeControlledNodeType
Parameters:
newLoop - Whether this field loops or not

getLoop

public boolean getLoop()
Accessor method to get current value of field loop, default value is false

Specified by:
getLoop in interface VRMLTimeControlledNodeType
Returns:
The value of the loop field

setStartTime

public void setStartTime(double newStartTime)
Accessor method to set a new value for field attribute startTime

Specified by:
setStartTime in interface VRMLTimeControlledNodeType
Parameters:
newStartTime - The new start time

setPauseTime

public void setPauseTime(double newPauseTime)
Accessor method to set a new value for field attribute pauseTime

Parameters:
newPauseTime - The new start time

setResumeTime

public void setResumeTime(double newResumeTime)
Accessor method to set a new value for field attribute resumeTime

Parameters:
newResumeTime - The new start time

getStartTime

public double getStartTime()
Accessor method to get current value of field startTime, default value is 0.

Specified by:
getStartTime in interface VRMLTimeControlledNodeType
Returns:
The current startTime

setStopTime

public void setStopTime(double newStopTime)
Accessor method to set a new value for field attribute stopTime

Specified by:
setStopTime in interface VRMLTimeControlledNodeType
Parameters:
newStopTime - The new stop time

getStopTime

public double getStopTime()
Accessor method to get current value of field stopTime, default value is 0

Specified by:
getStopTime in interface VRMLTimeControlledNodeType
Returns:
The current stop Time

getFieldValue

public VRMLFieldData getFieldValue(int index)
                            throws InvalidFieldException
Get the value of a field. If the field is a primitive type, it will return a class representing the value. For arrays or nodes it will return the instance directly.

Specified by:
getFieldValue in interface VRMLNodeType
Overrides:
getFieldValue in class AbstractNode
Parameters:
index - The index of the field to change.
Returns:
The class representing the field value
Throws:
InvalidFieldException - The field index is not known

setValue

public void setValue(int index,
                     double value)
              throws InvalidFieldException,
                     InvalidFieldValueException
Set the value of the field at the given index as a double for the SFTime fields. The fields effected by this cycleTime, cycleInterval, startTime, stopTime, fraction and time fields. This method does not currently check for negative values. Should it?

Specified by:
setValue in interface VRMLNodeType
Overrides:
setValue in class AbstractNode
Parameters:
index - The index of destination field to set
value - The new value to use for the node
Throws:
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is not in range or not appropriate for this field

setValue

public void setValue(int index,
                     boolean value)
              throws InvalidFieldException,
                     InvalidFieldValueException
Set the value of the field at the given index as a boolean. This is be used to set SFBool field types isActive, enabled and loop.

Specified by:
setValue in interface VRMLNodeType
Overrides:
setValue in class AbstractNode
Parameters:
index - The index of destination field to set
value - The new value to use for the node
Throws:
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is not in range or not appropriate for this field

Xj3D VRML/X3D Code API

Copyright © 2001 - 2005 Web3D Consortium