Class BaseTimeControlledNode
java.lang.Object
org.web3d.vrml.renderer.common.nodes.AbstractNode
org.web3d.vrml.renderer.common.nodes.BaseTimeDependentNode
org.web3d.vrml.renderer.common.nodes.BaseTimeControlledNode
- All Implemented Interfaces:
VRMLNode
,FrameStateListener
,VRMLChildNodeType
,VRMLNodeType
,VRMLTimeControlledNodeType
,VRMLTimeDependentNodeType
,VRMLWorldRootChildNodeType
- Direct Known Subclasses:
BaseAudioClip
,BaseMovieTexture
,BaseTimeSensor
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.8 $
- Author:
- Justin Couch
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final int
The field index for elapsedTimeprotected static final int
The field index for Loopprotected static final int
The field index for pauseTimeprotected static final int
The field index for resumeTimeprotected static final int
The field index for startTimeprotected static final int
The field index for stopTimeprotected static final int
The last field index used by this classprotected double
The value of the pauseTime fieldprotected boolean
The value of the loop fieldprotected double
The value of the pauseTime fieldprotected double
The value of the resumeTime fieldprotected double
The value of the startTime fieldprotected double
The value of the stopTime fieldFields inherited from class org.web3d.vrml.renderer.common.nodes.BaseTimeDependentNode
vrmlClock
Fields inherited from class org.web3d.vrml.renderer.common.nodes.AbstractNode
errorReporter, FIELD_METADATA, fieldLocalData, hasChanged, inSetup, isDEF, isStatic, LAST_NODE_INDEX, layerIds, nodeName, pMetadata, refCounts, removedLayerIds, stateManager, STATIC_SCENE_GRAPH, vfMetadata, vrmlMajorVersion, vrmlMinorVersion
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
BaseTimeControlledNode
(String name) Initialise the time dependent node and it's fields that are held locally. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Set the fields of the time dependent node that has the fields set based on the fields of the passed in node.getFieldValue
(int index) Get the value of a field.boolean
getLoop()
Accessor method to get current value of field loop, default value isfalse
double
Accessor method to get current value of field startTime, default value is0
.double
Accessor method to get current value of field stopTime, default value is0
void
setLoop
(boolean newLoop) Accessor method to set a new value for field attribute loopvoid
setPauseTime
(double newPauseTime) Accessor method to set a new value for field attribute pauseTimevoid
setResumeTime
(double newResumeTime) Accessor method to set a new value for field attribute resumeTimevoid
setStartTime
(double newStartTime) Accessor method to set a new value for field attribute startTimevoid
setStopTime
(double newStopTime) Accessor method to set a new value for field attribute stopTimevoid
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, clearRemovedLayerIds, fireFieldChanged, getLayerIds, getMetadataObject, getRefCount, getRemovedLayerIds, 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, throwInitOnlyWriteException, throwInputOnlyWriteException, throwInvalidNodeException, throwInvalidProtoException, throwOutputOnlyWriteException, updateRefCount, updateRefs
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.FrameStateListener
allEventsComplete
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.VRMLNodeType
addNodeListener, clearRemovedLayerIds, getLayerIds, getMetadataObject, getRefCount, getRemovedLayerIds, 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.nodes.VRMLTimeDependentNodeType
setVRMLClock
-
Field Details
-
FIELD_LOOP
protected static final int FIELD_LOOPThe field index for Loop- See Also:
-
FIELD_START_TIME
protected static final int FIELD_START_TIMEThe field index for startTime- See Also:
-
FIELD_STOP_TIME
protected static final int FIELD_STOP_TIMEThe field index for stopTime- See Also:
-
FIELD_PAUSE_TIME
protected static final int FIELD_PAUSE_TIMEThe field index for pauseTime- See Also:
-
FIELD_RESUME_TIME
protected static final int FIELD_RESUME_TIMEThe field index for resumeTime- See Also:
-
FIELD_ELAPSED_TIME
protected static final int FIELD_ELAPSED_TIMEThe field index for elapsedTime- See Also:
-
LAST_TIME_INDEX
protected static final int LAST_TIME_INDEXThe last field index used by this class- See Also:
-
vfLoop
protected boolean vfLoopThe value of the loop field -
vfStartTime
protected double vfStartTimeThe value of the startTime field -
vfStopTime
protected double vfStopTimeThe value of the stopTime field -
vfPauseTime
protected double vfPauseTimeThe value of the pauseTime field -
vfResumeTime
protected double vfResumeTimeThe value of the resumeTime field -
vfElapsedTime
protected double vfElapsedTimeThe value of the pauseTime field
-
-
Constructor Details
-
BaseTimeControlledNode
Initialise the time dependent node and it's fields that are held locally.- Parameters:
name
- The name of the type of node
-
-
Method Details
-
copy
Set the fields of the time dependent 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 interfaceVRMLTimeControlledNodeType
- Parameters:
newLoop
- Whether this field loops or not
-
getLoop
public boolean getLoop()Accessor method to get current value of field loop, default value isfalse
- Specified by:
getLoop
in interfaceVRMLTimeControlledNodeType
- 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 interfaceVRMLTimeControlledNodeType
- 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 is0
.- Specified by:
getStartTime
in interfaceVRMLTimeControlledNodeType
- 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 interfaceVRMLTimeControlledNodeType
- Parameters:
newStopTime
- The new stop time
-
getStopTime
public double getStopTime()Accessor method to get current value of field stopTime, default value is0
- Specified by:
getStopTime
in interfaceVRMLTimeControlledNodeType
- Returns:
- The current stop Time
-
getFieldValue
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 interfaceVRMLNodeType
- Overrides:
getFieldValue
in classAbstractNode
- 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 affected 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 interfaceVRMLNodeType
- Overrides:
setValue
in classAbstractNode
- Parameters:
index
- The index of destination field to setvalue
- The new value to use for the node- Throws:
InvalidFieldException
- The field index is not knownInvalidFieldValueException
- 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 interfaceVRMLNodeType
- Overrides:
setValue
in classAbstractNode
- Parameters:
index
- The index of destination field to setvalue
- The new value to use for the node- Throws:
InvalidFieldException
- The field index is not knownInvalidFieldValueException
- The value provided is not in range or not appropriate for this field
-