Xj3D 2.0 VRML/X3D Code API

org.web3d.vrml.nodes
Interface VRMLNodeType

All Superinterfaces:
FrameStateListener, VRMLNode
All Known Subinterfaces:
NRAudioClipNodeType, NRTexture2DNodeType, NRTextureNodeType, NRVRMLNode, OGLAppearanceNodeType, OGLBackgroundNodeType, OGLBindableNodeType, OGLGeometryNodeType, OGLLightNodeType, OGLMaterialNodeType, OGLNavigationInfoNodeType, OGLPickableTargetNodeType, OGLPickingSensorNodeType, OGLTextNodeType, OGLTextureCoordinateTransformNodeType, OGLTextureNodeType, OGLViewpointNodeType, OGLVRMLNode, OGLWorldRootNodeType, VRMLAnnotationNodeType, VRMLAppearanceChildNodeType, VRMLAppearanceNodeType, VRMLAudioClipNodeType, VRMLBackgroundNodeType, VRMLBindableNodeType, VRMLBoundedNodeType, VRMLChildNodeType, VRMLCollidableNodeType, VRMLColorNodeType, VRMLComponentGeometryNodeType, VRMLComposedTextureNodeType, VRMLCoordinateNodeType, VRMLDeviceManagerNodeType, VRMLDeviceSensorNodeType, VRMLDISManagerNodeType, VRMLDISNodeType, VRMLDragSensorNodeType, VRMLEnvironmentalSensorNodeType, VRMLEnvironmentTextureNodeType, VRMLExternalSynchronizedNodeType, VRMLFogNodeType, VRMLFontStyleNodeType, VRMLGeometricPropertyNodeType, VRMLGeometryNodeType, VRMLGroupingNodeType, VRMLHAnimHumanoidNodeType, VRMLHAnimNodeType, VRMLInlineNodeType, VRMLInterpolatorNodeType, VRMLKeyDeviceSensorNodeType, VRMLLayerNodeType, VRMLLayerSetNodeType, VRMLLightNodeType, VRMLLocalOriginNodeType, VRMLMaterialNodeType, VRMLMultiTextureNodeType, VRMLNavigationInfoNodeType, VRMLNBodyCollidableNodeType, VRMLNBodyGroupNodeType, VRMLNBodySensorNodeType, VRMLNBodySpaceNodeType, VRMLNetworkInterfaceNodeType, VRMLNormalNodeType, VRMLOverlayNodeType, VRMLParametricGeometryNodeType, VRMLParticleEmitterNodeType, VRMLParticlePhysicsModelNodeType, VRMLParticleSystemNodeType, VRMLPickableNodeType, VRMLPickingSensorNodeType, VRMLPointingDeviceSensorNodeType, VRMLPointPropertiesNodeType, VRMLProductStructureChildNodeType, VRMLProtoInstance, VRMLRigidBodyGroupNodeType, VRMLRigidBodyNodeType, VRMLRigidJointNodeType, VRMLScriptNodeType, VRMLSensorNodeType, VRMLSequencerNodeType, VRMLShapeNodeType, VRMLSoundNodeType, VRMLSurfaceChildNodeType, VRMLSurfaceLayoutNodeType, VRMLSurfaceMaterialNodeType, VRMLSurfaceNodeType, VRMLTextNodeType, VRMLTexture2DNodeType, VRMLTexture3DNodeType, VRMLTextureCoordinateNodeType, VRMLTextureCoordinateTransformNodeType, VRMLTextureNodeType, VRMLTextureProperties2DNodeType, VRMLTextureTransformNodeType, VRMLTimeControlledNodeType, VRMLTimeDependentNodeType, VRMLTouchSensorNodeType, VRMLViewDependentNodeType, VRMLViewpointNodeType, VRMLViewportNodeType, VRMLVisualMaterialNodeType, VRMLWorldRootChildNodeType, VRMLWorldRootNodeType
All Known Implementing Classes:
AbstractDynamicFieldNode, AbstractNode, BaseBindableNode, BaseComponentGeometryNode, BaseDragSensorNode, BaseGeometricPropertyNode, BaseGroupingNode, BaseIndexedGeometryNode, BaseIndexedTriangleGeometryNode, BaseInterpolatorNode, BaseLightNode, BaseMetadataObjectNode, BaseSensorNode, BaseSequencerNode, BaseTexture2DNode, BaseTexture3DNode, BaseTextureNode, BaseTimeControlledNode, BaseTimeDependentNode, BaseTriangleGeometryNode, CRProtoInstance, ImportNodeProxy, NRNode, ProtoInstancePlaceHolder

public interface VRMLNodeType
extends VRMLNode, FrameStateListener

Supplemental representation of any renderable node in the VRML system along with the methods required to manage the rendering process.

Each node contains a collection of fields. Each field has a fixed index for all instances of this node. Field values are set using the setValue() method for the appropriate data type. The node implementation must make sure that values are only being set when permitted. InitializeOnly fields can only be set before the setupFinished() function is called and should otherwise issue an exception.

Version:
$Revision: 1.25 $
Author:
Justin Couch

Method Summary
 void addNodeListener(VRMLNodeListener l)
          Add a listener to this node instance.
 void clearRemovedLayerIds()
          Clear the current removed layer ID list.
 VRMLFieldData getFieldValue(int index)
          Get the value of a field.
 int[] getLayerIds()
          Get a listing of the current layer IDs that are directly or indirectly referencing this node.
 VRMLNodeType getMetadataObject()
          Get the currently registered metadata object instance.
 int getRefCount(int layer)
          Ask for the current number of references to this object in the given layer.
 int[] getRemovedLayerIds()
          Get the list of layer IDs that this node has just been removed from.
 boolean hasFieldChanged(int index)
          Check to see if the given field has changed since we last checked.
 boolean isSetupFinished()
          Check to see if setupFinished() has already been called on this node.
 void notifyExternProtoLoaded(int index, VRMLNodeType node)
          Notify a node that an ExternProto has resolved.
 void removeNodeListener(VRMLNodeListener l)
          Remove a listener from this node instance.
 void sendRoute(double time, int srcIndex, VRMLNodeType destNode, int destIndex)
          Send a routed value from this node to the given destination node.
 void setDEF()
          Notify this node that is has been DEFd.
 void setFrameStateManager(FrameStateManager mgr)
          Tell the node about the frame registration state manager to use.
 void setMetadataObject(VRMLNodeType metadata)
          Set the X3DMetadataObject that is associated with this node.
 void setupFinished()
          Notification that the construction phase of this node has finished.
 void setValue(int index, boolean value)
          Set the value of the field at the given index as an boolean.
 void setValue(int index, boolean[] value, int numValid)
          Set the value of the field at the given index as an array of boolean.
 void setValue(int index, double value)
          Set the value of the field at the given index as an double.
 void setValue(int index, double[] value, int numValid)
          Set the value of the field at the given index as an array of doubles.
 void setValue(int index, float value)
          Set the value of the field at the given index as a float.
 void setValue(int index, float[] value, int numValid)
          Set the value of the field at the given index as an array of floats.
 void setValue(int index, int value)
          Set the value of the field at the given index as an integer.
 void setValue(int index, int[] value, int numValid)
          Set the value of the field at the given index as an array of integers.
 void setValue(int index, long value)
          Set the value of the field at the given index as an long.
 void setValue(int index, long[] value, int numValid)
          Set the value of the field at the given index as an array of longs.
 void setValue(int index, java.lang.String value)
          Set the value of the field at the given index as a string.
 void setValue(int index, java.lang.String[] value, int numValid)
          Set the value of the field at the given index as an array of strings.
 void setValue(int index, VRMLNodeType child)
          Set the value of the field at the given index as a node.
 void setValue(int index, VRMLNodeType[] children, int numValid)
          Set the value of the field at the given index as an array of nodes.
 void updateRefCount(int layer, boolean add)
          Change the reference count up or down by one for a given layer ID.
 
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
 

Method Detail

setMetadataObject

void setMetadataObject(VRMLNodeType metadata)
                       throws InvalidFieldValueException
Set the X3DMetadataObject that is associated with this node.

Parameters:
metadata - The node to register as the metadata
Throws:
InvalidFieldValueException - The object instance provided does not implment VRMLMetadataNodeType or is not a proto instance that encapsulates it as it's primary type

getMetadataObject

VRMLNodeType getMetadataObject()
Get the currently registered metadata object instance. If none is set then return null.

Returns:
The current metadata object or null

setDEF

void setDEF()
Notify this node that is has been DEFd. This method shall only be called before setupFinished(). It is an error to call it any other time. It is also guaranteed that this call will be made after construction, but before any of the setValue() methods have been called.

Throws:
java.lang.IllegalStateException - The setup is finished.

getRefCount

int getRefCount(int layer)
Ask for the current number of references to this object in the given layer. If this node represents a layer node itself, then the value returned for that ID should always be one. If the layer requested does not have a reference to this node, return zero.

Parameters:
layer - The id of the layer to get the ref count for
Returns:
The number of references to this node

updateRefCount

void updateRefCount(int layer,
                    boolean add)
Change the reference count up or down by one for a given layer ID. If there is no reference to the given layer ID previously, add one now. A listing of the layer IDs that reference this node can be retrieved through getLayerIds().

Parameters:
layer - The id of the layer to modify the ref count on
add - true to increment the reference count, false to decrement

getLayerIds

int[] getLayerIds()
Get a listing of the current layer IDs that are directly or indirectly referencing this node. If this layer is not part of a live scene graph (eg held by a script code, but not by the script itself) then this will will return a null value. The array will always be exactly equal in length to the number of IDs that reference this node.

Returns:
An array of all the IDs referencing this node or null if none

getRemovedLayerIds

int[] getRemovedLayerIds()
Get the list of layer IDs that this node has just been removed from. If it currently has not been removed from anything, this will return null. This will remain updated until the next clearRemovedLayerIds() call.

Returns:
An array of all the IDs this is delete from or null if none

clearRemovedLayerIds

void clearRemovedLayerIds()
Clear the current removed layer ID list. If there is nothing removed, this method does nothing.


setFrameStateManager

void setFrameStateManager(FrameStateManager mgr)
Tell the node about the frame registration state manager to use. If the manager is not useful for this node, ignore the call. A value of null will clear the manager, but that will only happen during a dispose. After the setup process has finished a node may assume that it will always have a valid pointer to this node.

Parameters:
mgr - The manager instance to use

hasFieldChanged

boolean hasFieldChanged(int index)
Check to see if the given field has changed since we last checked. Calling this method will set the flag back to "not changed" so that two consective reads after a changed value would result in a true and then false being returned. If the field number is not recognized for this node then this returns false.

Parameters:
index - The index of the field to change
Returns:
true if the field has changed since last read

addNodeListener

void addNodeListener(VRMLNodeListener l)
Add a listener to this node instance. If the listener is already added or null the request is silently ignored.

Parameters:
l - The listener instance to add

removeNodeListener

void removeNodeListener(VRMLNodeListener l)
Remove a listener from this node instance. If the listener is null or not registered, the request is silently ignored.

Parameters:
l - The listener to be removed

notifyExternProtoLoaded

void notifyExternProtoLoaded(int index,
                             VRMLNodeType node)
                             throws InvalidFieldValueException
Notify a node that an ExternProto has resolved. This will verify the objects type and add it to the render sceneGraph.

Parameters:
index - The field index
node - The node resolved
Throws:
InvalidFieldValueException

getFieldValue

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.

Parameters:
index - The index of the field to change.
Returns:
The class representing the field value
Throws:
InvalidFieldException - The field index is not known

setupFinished

void setupFinished()
Notification that the construction phase of this node has finished. If the node would like to do any internal processing, such as setting up geometry, then go for it now. It is then responsbile for calling its childrens setupFinished.


isSetupFinished

boolean isSetupFinished()
Check to see if setupFinished() has already been called on this node.

Returns:
true if setupFinished() has been called

sendRoute

void sendRoute(double time,
               int srcIndex,
               VRMLNodeType destNode,
               int destIndex)
Send a routed value from this node to the given destination node. The route should use the appropriate setValue() method of the destination node. It should not attempt to cast the node up to a higher level. Routing should also follow the standard rules for the loop breaking and other appropriate rules for the specification.

Parameters:
time - The time that this route occurred (not necessarily epoch time. Should be treated as a relative value only)
srcIndex - The index of the field in this node that the value should be sent from
destNode - The node reference that we will be sending the value to
destIndex - The index of the field in the destination node that the value should be sent to.

setValue

void setValue(int index,
              int value)
              throws InvalidFieldException,
                     InvalidFieldValueException,
                     InvalidFieldAccessException
Set the value of the field at the given index as an integer. This would be used to set SFInt32 field types.

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
InvalidFieldAccessException - The call is attempting to write to a field that does not permit writing now

setValue

void setValue(int index,
              int[] value,
              int numValid)
              throws InvalidFieldException,
                     InvalidFieldValueException,
                     InvalidFieldAccessException
Set the value of the field at the given index as an array of integers. This would be used to set MFInt32 field types.

Parameters:
index - The index of destination field to set
value - The new value to use for the node
numValid - The number of valid values to copy from the array
Throws:
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is not in range or not appropriate for this field
InvalidFieldAccessException - The call is attempting to write to a field that does not permit writing now

setValue

void setValue(int index,
              boolean value)
              throws InvalidFieldException,
                     InvalidFieldValueException,
                     InvalidFieldAccessException
Set the value of the field at the given index as an boolean. This would be used to set SFBool field types.

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
InvalidFieldAccessException - The call is attempting to write to a field that does not permit writing now

setValue

void setValue(int index,
              boolean[] value,
              int numValid)
              throws InvalidFieldException,
                     InvalidFieldValueException,
                     InvalidFieldAccessException
Set the value of the field at the given index as an array of boolean. This would be used to set MFBool field types.

Parameters:
index - The index of destination field to set
value - The new value to use for the node
numValid - The number of valid values to copy from the array
Throws:
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is not in range or not appropriate for this field
InvalidFieldAccessException - The call is attempting to write to a field that does not permit writing now

setValue

void setValue(int index,
              float value)
              throws InvalidFieldException,
                     InvalidFieldValueException,
                     InvalidFieldAccessException
Set the value of the field at the given index as a float. This would be used to set SFFloat field types.

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
InvalidFieldAccessException - The call is attempting to write to a field that does not permit writing now

setValue

void setValue(int index,
              float[] value,
              int numValid)
              throws InvalidFieldException,
                     InvalidFieldValueException,
                     InvalidFieldAccessException
Set the value of the field at the given index as an array of floats. This would be used to set MFFloat, SFVec2f, SFVec3f and SFRotation field types.

Parameters:
index - The index of destination field to set
value - The new value to use for the node
numValid - The number of valid values to copy from the array
Throws:
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is not in range or not appropriate for this field
InvalidFieldAccessException - The call is attempting to write to a field that does not permit writing now

setValue

void setValue(int index,
              long value)
              throws InvalidFieldException,
                     InvalidFieldValueException,
                     InvalidFieldAccessException
Set the value of the field at the given index as an long. This would be used to set SFTime field types.

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
InvalidFieldAccessException - The call is attempting to write to a field that does not permit writing now

setValue

void setValue(int index,
              long[] value,
              int numValid)
              throws InvalidFieldException,
                     InvalidFieldValueException,
                     InvalidFieldAccessException
Set the value of the field at the given index as an array of longs. This would be used to set MFTime field types.

Parameters:
index - The index of destination field to set
value - The new value to use for the node
numValid - The number of valid values to copy from the array
Throws:
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is not in range or not appropriate for this field
InvalidFieldAccessException - The call is attempting to write to a field that does not permit writing now

setValue

void setValue(int index,
              double value)
              throws InvalidFieldException,
                     InvalidFieldValueException,
                     InvalidFieldAccessException
Set the value of the field at the given index as an double. This would be used to set SFDouble field types.

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
InvalidFieldAccessException - The call is attempting to write to a field that does not permit writing now

setValue

void setValue(int index,
              double[] value,
              int numValid)
              throws InvalidFieldException,
                     InvalidFieldValueException,
                     InvalidFieldAccessException
Set the value of the field at the given index as an array of doubles. This would be used to set MFDouble, SFVec2d and SFVec3d field types.

Parameters:
index - The index of destination field to set
value - The new value to use for the node
numValid - The number of valid values to copy from the array
Throws:
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is not in range or not appropriate for this field
InvalidFieldAccessException - The call is attempting to write to a field that does not permit writing now

setValue

void setValue(int index,
              java.lang.String value)
              throws InvalidFieldException,
                     InvalidFieldValueException,
                     InvalidFieldAccessException
Set the value of the field at the given index as a string. This would be used to set SFString field types.

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
InvalidFieldAccessException - The call is attempting to write to a field that does not permit writing now

setValue

void setValue(int index,
              java.lang.String[] value,
              int numValid)
              throws InvalidFieldException,
                     InvalidFieldValueException,
                     InvalidFieldAccessException
Set the value of the field at the given index as an array of strings. This would be used to set MFString field types.

Parameters:
index - The index of destination field to set
value - The new value to use for the node
numValid - The number of valid values to copy from the array
Throws:
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is not in range or not appropriate for this field
InvalidFieldAccessException - The call is attempting to write to a field that does not permit writing now

setValue

void setValue(int index,
              VRMLNodeType child)
              throws InvalidFieldException,
                     InvalidFieldValueException,
                     InvalidFieldAccessException
Set the value of the field at the given index as a node. This would be used to set SFNode field types.

Parameters:
index - The index of destination field to set
child - The new value to use for the node
Throws:
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided does not fit this type of node
InvalidFieldAccessException - The call is attempting to write to a field that does not permit writing now

setValue

void setValue(int index,
              VRMLNodeType[] children,
              int numValid)
              throws InvalidFieldException,
                     InvalidFieldValueException,
                     InvalidFieldAccessException
Set the value of the field at the given index as an array of nodes. This would be used to set MFNode field types.

Parameters:
index - The index of destination field to set
children - The new value to use for the node
numValid - The number of valid values to copy from the array
Throws:
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided does not fit this type of node
InvalidFieldAccessException - The call is attempting to write to a field that does not permit writing now

Xj3D 2.0 VRML/X3D Code API

Copyright © 2001 - 2006 Web3D Consortium