Class BaseAnnotation
java.lang.Object
org.web3d.vrml.renderer.common.nodes.AbstractNode
org.web3d.vrml.renderer.common.nodes.annotation.BaseAnnotation
- All Implemented Interfaces:
VRMLNode,FrameStateListener,VRMLAnnotationNodeType,VRMLChildNodeType,VRMLNodeType,VRMLWorldRootChildNodeType
Common base class for all the AnnotationNodeType implementations.
The base X3D node definition is:
X3DAnnotationNode : X3DChildNode {
SFString [in,out] annotationGroupID ""
SFString [in,out] displayPolicy "NEVER" ["POINTER_OVER", "POINTER_ACTIVATE", "ALWAYS", "WHEN_VISIBLE", "NEVER"]
SFBool [in,out] enabled TRUE
SFNode [in,out] metadata NULL [X3DMetadataObject]
}
- Version:
- $Revision: 1.1 $
- Author:
- Justin Couch
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intIndex of the annotations fieldprotected static final intIndex of the leadLineStyle fieldprotected static final intIndex of the leadLineStyle fieldprotected static final VRMLFieldDeclaration[]Array of VRMLFieldDeclarationsHashmap between a field name and its indexprotected static final intThe last field index used by this classprotected static final StringDisplay Policy is NEVERprotected StringinputOutput SFVec3f referencePoint 0, 0, 0protected StringinputOutput MFNode annotationsprotected booleanTemporary array to store the values in during node setupFields 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
ConstructorsModifierConstructorDescriptionprotectedBaseAnnotation(String name) Create a new, default instance of this class.BaseAnnotation(VRMLNodeType node) Construct a new instance of this node based on the details from the given node. -
Method Summary
Modifier and TypeMethodDescriptionGet the current annotation group ID.Get the policy for when this annotation should be displayed.booleanGet current value of the enabled field.intgetFieldIndex(String fieldName) Get the index of the given field name.getFieldValue(int index) Get the value of a field.int[]Get the list of indices that correspond to fields that contain nodes ie MFNode and SFNode).intGet the primary type of this node.voidsendRoute(double time, int srcIndex, VRMLNodeType destNode, int destIndex) Send a routed value from this node to the given destination node.voidSet the annotation group ID field to the new value.voidsetDisplayPolicy(String policy) Set the display policy field to the new value.voidsetEnabled(boolean state) Set a new enabled state for the annotation.voidsetValue(int index, float[] value, int numValid) Set the value of the field at the given index as an array of floats.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, setDEF, setErrorReporter, setFrameStateManager, setMetadataObject, setupFinished, setUserData, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setVersion, throwInitOnlyWriteException, throwInputOnlyWriteException, throwInvalidNodeException, throwInvalidProtoException, throwOutputOnlyWriteException, updateRefCount, updateRefsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.web3d.vrml.nodes.FrameStateListener
allEventsCompleteMethods inherited from interface org.web3d.vrml.lang.VRMLNode
getFieldDeclaration, getNumFields, getSecondaryType, getUserData, getVRMLNodeName, isDEF, setErrorReporter, setUserData, setVersionMethods inherited from interface org.web3d.vrml.nodes.VRMLNodeType
addNodeListener, clearRemovedLayerIds, getLayerIds, getMetadataObject, getRefCount, getRemovedLayerIds, hasFieldChanged, isSetupFinished, notifyExternProtoLoaded, removeNodeListener, setDEF, setFrameStateManager, setMetadataObject, setupFinished, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, updateRefCount
-
Field Details
-
FIELD_ANNOTATION_GROUP_ID
protected static final int FIELD_ANNOTATION_GROUP_IDIndex of the annotations field- See Also:
-
FIELD_DISPLAY_POLICY
protected static final int FIELD_DISPLAY_POLICYIndex of the leadLineStyle field- See Also:
-
FIELD_ENABLED
protected static final int FIELD_ENABLEDIndex of the leadLineStyle field- See Also:
-
LAST_ANNOTATION_INDEX
protected static final int LAST_ANNOTATION_INDEXThe last field index used by this class- See Also:
-
POLICY_NEVER
-
fieldDecl
Array of VRMLFieldDeclarations -
fieldMap
-
vfAnnotationGroupID
inputOutput SFVec3f referencePoint 0, 0, 0 -
vfDisplayPolicy
inputOutput MFNode annotations -
vfEnabled
protected boolean vfEnabledTemporary array to store the values in during node setup
-
-
Constructor Details
-
BaseAnnotation
Create a new, default instance of this class.- Parameters:
name- name of this new BaseAnnotation
-
BaseAnnotation
Construct a new instance of this node based on the details from the given node. If the node is not the same type, an exception will be thrown.- Parameters:
node- The node to copy- Throws:
IllegalArgumentException- Incorrect Node Type
-
-
Method Details
-
getAnnotationGroupID
Get the current annotation group ID. If there is none set, this will return an empty string.- Specified by:
getAnnotationGroupIDin interfaceVRMLAnnotationNodeType- Returns:
- A string representing the group ID
-
setAnnotationGroupID
Set the annotation group ID field to the new value. A null value or zero length string will be treated as clearing the current value.- Specified by:
setAnnotationGroupIDin interfaceVRMLAnnotationNodeType- Parameters:
id- The new ID string to use
-
setEnabled
public void setEnabled(boolean state) Set a new enabled state for the annotation.- Specified by:
setEnabledin interfaceVRMLAnnotationNodeType- Parameters:
state- The new enabled value
-
getEnabled
public boolean getEnabled()Get current value of the enabled field. The default value istrue.- Specified by:
getEnabledin interfaceVRMLAnnotationNodeType- Returns:
- The value of the enabled field
-
getDisplayPolicy
Get the policy for when this annotation should be displayed. The default value is "NEVER".- Specified by:
getDisplayPolicyin interfaceVRMLAnnotationNodeType- Returns:
- A string representing the current display policy
-
setDisplayPolicy
Set the display policy field to the new value. The field must be a valid string from the collection described in the class overview documentation. Null values are treated as an error.- Specified by:
setDisplayPolicyin interfaceVRMLAnnotationNodeType- Parameters:
policy- The new display policy to use- Throws:
InvalidFieldValueException
-
getFieldIndex
Get the index of the given field name. If the name does not exist for this node then return a value of -1.- Specified by:
getFieldIndexin interfaceVRMLNode- Parameters:
fieldName- The name of the field we want the index from- Returns:
- The index of the field name or -1
-
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.- Specified by:
getNodeFieldIndicesin interfaceVRMLNode- Returns:
- The list of field indices that correspond to SF/MFnode fields or null if none
-
getPrimaryType
public int getPrimaryType()Get the primary type of this node. Replaces the instanceof mechanism for use in switch statements.- Specified by:
getPrimaryTypein interfaceVRMLNode- Returns:
- The primary type
-
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:
getFieldValuein interfaceVRMLNodeType- Overrides:
getFieldValuein 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
-
sendRoute
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.- Specified by:
sendRoutein interfaceVRMLNodeType- Overrides:
sendRoutein classAbstractNode- 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 fromdestNode- The node reference that we will be sending the value todestIndex- The index of the field in the destination node that the value should be sent to.
-
setValue
public void setValue(int index, float[] value, int numValid) throws InvalidFieldException, InvalidFieldValueException Set the value of the field at the given index as an array of floats. This would be used to set MFFloat field type.- Specified by:
setValuein interfaceVRMLNodeType- Overrides:
setValuein classAbstractNode- Parameters:
index- The index of destination field to setvalue- The new value to use for the nodenumValid- The number of valid values to copy from the array- Throws:
InvalidFieldException- The field index is not knownInvalidFieldValueException- The value provided is not in range or not appropriate for this fieldInvalidFieldAccessException- The call is attempting to write to a field that does not permit writing now
-