Xj3D VRML/X3D Code API

org.web3d.vrml.lang
Interface VRMLNode

All Known Subinterfaces:
J3DAppearanceNodeType, J3DAudioClipNodeType, J3DBackgroundNodeType, J3DFogNodeType, J3DGeometryNodeType, J3DLightNodeType, J3DLinePropertiesNodeType, J3DMaterialNodeType, J3DOverlayItemNodeType, J3DOverlayStructureNodeType, J3DPickingSensorNodeType, J3DTextNodeType, J3DTextureCoordinateTransformNodeType, J3DTextureNodeType, J3DViewpointNodeType, J3DVRMLNode, J3DWorldRootNodeType, NRAudioClipNodeType, NRTexture2DNodeType, NRTextureNodeType, NRVRMLNode, OGLAppearanceNodeType, OGLBackgroundNodeType, OGLBindableNodeType, OGLGeometryNodeType, OGLLightNodeType, OGLMaterialNodeType, OGLNavigationInfoNodeType, OGLPickableTargetNodeType, OGLPickingSensorNodeType, OGLTextNodeType, OGLTextureCoordinateTransformNodeType, OGLViewpointNodeType, OGLVRMLNode, OGLWorldRootNodeType, 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, VRMLNodeType, VRMLNormalNodeType, VRMLOverlayNodeType, VRMLParametricGeometryNodeType, VRMLParticleEmitterNodeType, VRMLParticlePhysicsModelNodeType, VRMLParticleSystemNodeType, VRMLPickableNodeType, VRMLPickingSensorNodeType, VRMLPointingDeviceSensorNodeType, 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, VRMLVisualMaterialNodeType, VRMLWorldRootNodeType
All Known Implementing Classes:
AbstractDynamicFieldNode, AbstractNode, BaseBindableNode, BaseComponentGeometryNode, BaseDragSensorNode, BaseGeometricPropertyNode, BaseGroupingNode, BaseInterpolatorNode, BaseLightNode, BaseSensorNode, BaseSequencerNode, BaseTexture2DNode, BaseTexture3DNode, BaseTextureNode, BaseTimeControlledNode, BaseTimeDependentNode, CRProtoInstance, ImportNodeProxy, J3DComponentGeometryNode, J3DGeometryNode, J3DGroupingNode, J3DIndexedGeometry, J3DLightNode, J3DNode, NRNode, ProtoInstancePlaceHolder

public interface VRMLNode

Base representation of any node in the VRML system.

Each node contains a collection of fields. Each field has a fixed index for all instances of this node. If a node is cloned in any way, the accompanying user data is not cloned with the node.

Version:
$Revision: 1.10 $
Author:
Justin Couch

Method Summary
 VRMLFieldDeclaration getFieldDeclaration(int index)
          Get the declaration of the field at the given index.
 int getFieldIndex(java.lang.String fieldName)
          Get the index of the given field name.
 int[] getNodeFieldIndices()
          Get the list of indices that correspond to fields that contain nodes ie MFNode and SFNode).
 int getNumFields()
          Get the number of fields defined for this node.
 int getPrimaryType()
          Get the primary type of this node.
 int[] getSecondaryType()
          Get the secondary types of this node.
 java.lang.Object getUserData(int index)
          Fetch the stored user data for a given field index.
 java.lang.String getVRMLNodeName()
          Get the name of this node as a string.
 boolean isDEF()
          Check to see if this node has been DEFd.
 void setErrorReporter(ErrorReporter reporter)
          Register an error reporter with the engine so that any errors generated by the node's internals can be reported in a nice, pretty fashion.
 void setUserData(int index, java.lang.Object data)
          Set arbitrary data for a given field.
 void setVersion(int major, int minor, boolean isStatic)
          Set the version of VRML that this node should represent.
 

Method Detail

setErrorReporter

public void setErrorReporter(ErrorReporter reporter)
Register an error reporter with the engine so that any errors generated by the node's internals can be reported in a nice, pretty fashion. Setting a value of null will clear the currently set reporter. If one is already set, the new value replaces the old.

Parameters:
reporter - The instance to use or null

getVRMLNodeName

public java.lang.String getVRMLNodeName()
Get the name of this node as a string.

Returns:
The name of the node

isDEF

public boolean isDEF()
Check to see if this node has been DEFd. Returns true if it has and the user should ask for the shared representation rather than the normal one.

Returns:
true if this node has been DEFd

getPrimaryType

public int getPrimaryType()
Get the primary type of this node. Replaces the instanceof mechanism for use in switch statements.

Returns:
The primary type

getSecondaryType

public int[] getSecondaryType()
Get the secondary types of this node. Replaces the instanceof mechanism for use in switch statements. If there are no secondary types, it will return a zero-length array.

Returns:
The secondary type

setVersion

public void setVersion(int major,
                       int minor,
                       boolean isStatic)
Set the version of VRML that this node should represent. Different versions have different capabilities, even within the same node.

Parameters:
major - The major version number of this scene
minor - The minor version number of this scene
isStatic - true if this node is under a static group and won't change after the setup is finished

getFieldIndex

public int getFieldIndex(java.lang.String fieldName)
Get the index of the given field name. If the name does not exist for this node then return a value of -1.

Parameters:
fieldName - The name of the field we want the index from
Returns:
The index of the field name or -1

getNumFields

public int getNumFields()
Get the number of fields defined for this node.

Returns:
The number of fields.

getNodeFieldIndices

public int[] getNodeFieldIndices()
Get the list of indices that correspond to fields that contain nodes ie MFNode and SFNode). Used for blind scene graph traversal without needing to spend time querying for all fields etc. If a node does not have any fields that contain nodes, this shall return null. The field list covers all field types, regardless of whether they are readable or not at the VRML-level.

Returns:
The list of field indices that correspond to SF/MFnode fields or null if none

getFieldDeclaration

public VRMLFieldDeclaration getFieldDeclaration(int index)
Get the declaration of the field at the given index. This allows for reverse lookup if needed. If the field does not exist, this will give a value of null.

Parameters:
index - The index of the field to get information
Returns:
A representation of this field's information

setUserData

public void setUserData(int index,
                        java.lang.Object data)
                 throws InvalidFieldException
Set arbitrary data for a given field. Provided primarily to help the EAI fullfil its requirements, but may be useful elsewhere.

Parameters:
index - The index of destination field to set
data - The item to store for the field
Throws:
InvalidFieldException - The field index is not known

getUserData

public java.lang.Object getUserData(int index)
                             throws InvalidFieldException
Fetch the stored user data for a given field index. If nothing is registered, null is returned.

Parameters:
index - The index of destination field to set
Returns:
The item stored for the field or null
Throws:
InvalidFieldException - The field index is not known

Xj3D VRML/X3D Code API

Copyright © 2001 - 2005 Web3D Consortium