Class BaseAnchor
java.lang.Object
org.web3d.vrml.renderer.common.nodes.AbstractNode
org.web3d.vrml.renderer.common.nodes.BaseGroupingNode
org.web3d.vrml.renderer.common.nodes.networking.BaseAnchor
- All Implemented Interfaces:
VRMLNode
,FrameStateListener
,VRMLBoundedNodeType
,VRMLChildNodeType
,VRMLGroupingNodeType
,VRMLLinkNodeType
,VRMLNodeType
,VRMLWorldRootChildNodeType
Base common implementation of an Anchor node.
The anchor node represents a standard grouping node that also contains URL information.
For dealing with user input,
- Version:
- $Revision: 1.14 $
- Author:
- Justin Couch
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final int
Index of the autoRefresh fieldprotected static final int
Index of the autoRefreshTimeLimit fieldprotected static final int
Index of the description fieldprotected static final int
Index of the load fieldprotected static final int
Index of the parameter fieldprotected static final int
Index of the URL fieldprotected static final int
Index of the visible field, note overloading superclass BaseGroupingNode FIELD_VISIBLEprotected static final int
The last index used by this fieldprotected static final int
Total number of fieldsprotected boolean
Flag to indicate if we've checked the URLs for relative referencesprotected double
SFBool autoRefreshprotected double
SFBool autoRefreshTimeLimitprotected String
SFString descriptionprotected boolean
SFBool loadprotected String[]
MFString parameterprotected String[]
MFString URL listprotected String
The world URL for correcting relative URL valuesFields inherited from class org.web3d.vrml.renderer.common.nodes.BaseGroupingNode
childCount, FIELD_ADDCHILDREN, FIELD_BBOX_CENTER, FIELD_BBOX_DISPLAY, FIELD_BBOX_SIZE, FIELD_CHILDREN, FIELD_REMOVECHILDREN, hasBindables, LAST_GROUP_INDEX, shareCount, USE_BIND_MSG, vfBboxCenter, vfBboxDisplay, vfBboxSize, vfChildren, vfVisible
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
ConstructorsConstructorDescriptionConstruct a default instance of this node.BaseAnchor
(VRMLNodeType node) Construct a new instance of this node based on the details from the given node. -
Method Summary
Modifier and TypeMethodDescriptiondouble
Get the autoRefresh value to associate with the link.double
Get the autoRefreshTimeLimit value to associate with the link.Get the description to associate with the link.getFieldDeclaration
(int index) Get the declaration of the field at the given index.int
getFieldIndex
(String fieldName) Get the index of the given field name.getFieldValue
(int index) Get the value of a field.boolean
getLoad()
Get the load value to associate with the link.int[]
Get the list of indices that correspond to fields that contain nodes ie MFNode and SFNode).int
Get the number of fields.String[]
Get the current list of parameters registered for this link.int[]
Get the secondary type of this node.String[]
getUrl()
Get the list of URLs requested by this node.Get the world URL so set for this node.void
sendRoute
(double time, int srcIndex, VRMLNodeType destNode, int destIndex) Send a routed value from this node to the given destination node.void
setAutoRefresh
(double newValue) Set the autoRefresh value for this link.void
setAutoRefreshTimeLimit
(double newValue) Set the autoRefreshTimeLimit value for this link.void
setDescription
(String desc) Set the description string for this link.void
setLoad
(boolean newValue) Set the load value for this link.void
setParameter
(String[] params) Set the parameter list to the new series of values.void
Sets the URL to a new value.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.void
Set the value of the field at the given index as a string.void
Set the value of the field at the given index as a double array of floats.void
setWorldUrl
(String url) Set the world URL so that any relative URLs may be corrected to the fully qualified version.Methods inherited from class org.web3d.vrml.renderer.common.nodes.BaseGroupingNode
addChild, addChildNode, clearChildren, containsBindableNodes, copy, getBboxCenter, getBboxDisplay, getBboxSize, getChildren, getChildrenSize, getPrimaryType, getVisible, isShared, removeChildNode, setBboxCenter, setBboxDisplay, setBboxSize, setChildren, setChildren, setDEF, setShared, setupFinished, setValue, setValue, setValue, setVisible, updateRefCount
Methods inherited from class org.web3d.vrml.renderer.common.nodes.AbstractNode
addNodeListener, allEventsComplete, checkNodeType, checkSecondaryType, checkSecondaryType, clearRemovedLayerIds, fireFieldChanged, getLayerIds, getMetadataObject, getRefCount, getRemovedLayerIds, getUserData, getVRMLNodeName, hasFieldChanged, isDEF, isSetupFinished, notifyExternProtoLoaded, removeNodeListener, setErrorReporter, setFrameStateManager, setMetadataObject, setUserData, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setVersion, throwInitOnlyWriteException, throwInputOnlyWriteException, throwInvalidNodeException, throwInvalidProtoException, throwOutputOnlyWriteException, 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
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, setFrameStateManager, setMetadataObject, setValue, setValue, setValue, setValue, setValue, setValue, setValue
-
Field Details
-
FIELD_DESCRIPTION
protected static final int FIELD_DESCRIPTIONIndex of the description field- See Also:
-
FIELD_PARAMETER
protected static final int FIELD_PARAMETERIndex of the parameter field- See Also:
-
FIELD_URL
protected static final int FIELD_URLIndex of the URL field- See Also:
-
FIELD_AUTOREFRESH
protected static final int FIELD_AUTOREFRESHIndex of the autoRefresh field- See Also:
-
FIELD_AUTOREFRESHTIMELIMIT
protected static final int FIELD_AUTOREFRESHTIMELIMITIndex of the autoRefreshTimeLimit field- See Also:
-
FIELD_LOAD
protected static final int FIELD_LOADIndex of the load field- See Also:
-
FIELD_VISIBLE
protected static final int FIELD_VISIBLEIndex of the visible field, note overloading superclass BaseGroupingNode FIELD_VISIBLE- See Also:
-
LAST_ANCHOR_INDEX
protected static final int LAST_ANCHOR_INDEXThe last index used by this field- See Also:
-
NUM_FIELDS
protected static final int NUM_FIELDSTotal number of fields- See Also:
-
vfUrl
MFString URL list -
worldURL
The world URL for correcting relative URL values -
urlRelativeCheck
protected boolean urlRelativeCheckFlag to indicate if we've checked the URLs for relative references -
vfParameter
MFString parameter -
vfDescription
SFString description -
vfAutoRefresh
protected double vfAutoRefreshSFBool autoRefresh -
vfAutoRefreshTimeLimit
protected double vfAutoRefreshTimeLimitSFBool autoRefreshTimeLimit -
vfLoad
protected boolean vfLoadSFBool load
-
-
Constructor Details
-
BaseAnchor
public BaseAnchor()Construct a default instance of this node. The defaults are set by the VRML specification. -
BaseAnchor
Construct a new instance of this node based on the details from the given node. If the node is not a group node, an exception will be thrown. It does not copy the children nodes, just this node.Note that the world URL has not been set by this call and will need to be called separately.
- Parameters:
node
- The node to copy- Throws:
IllegalArgumentException
- The node is not a Group node
-
-
Method Details
-
getDescription
Get the description to associate with the link. This is a line of text suitable for mouseovers, status information etc. If there is no description set then it returns null.- Specified by:
getDescription
in interfaceVRMLLinkNodeType
- Returns:
- The current description or null
-
setDescription
Set the description string for this link. Setting a value of null will clear the current description.- Specified by:
setDescription
in interfaceVRMLLinkNodeType
- Parameters:
desc
- The new description to set
-
getAutoRefresh
public double getAutoRefresh()Get the autoRefresh value to associate with the link.- Specified by:
getAutoRefresh
in interfaceVRMLLinkNodeType
- Returns:
- The current autoRefresh value
-
setAutoRefresh
public void setAutoRefresh(double newValue) Set the autoRefresh value for this link.- Specified by:
setAutoRefresh
in interfaceVRMLLinkNodeType
- Parameters:
newValue
- The new autoRefresh value to set
-
getAutoRefreshTimeLimit
public double getAutoRefreshTimeLimit()Get the autoRefreshTimeLimit value to associate with the link.- Specified by:
getAutoRefreshTimeLimit
in interfaceVRMLLinkNodeType
- Returns:
- The current TimeLimit value
-
setAutoRefreshTimeLimit
public void setAutoRefreshTimeLimit(double newValue) Set the autoRefreshTimeLimit value for this link.- Specified by:
setAutoRefreshTimeLimit
in interfaceVRMLLinkNodeType
- Parameters:
newValue
- The new autoRefreshTimeLimit value to set
-
getLoad
public boolean getLoad()Get the load value to associate with the link.- Specified by:
getLoad
in interfaceVRMLLinkNodeType
- Returns:
- The current TimeLimit value
-
setLoad
public void setLoad(boolean newValue) Set the load value for this link.- Specified by:
setLoad
in interfaceVRMLLinkNodeType
- Parameters:
newValue
- The new load value to set
-
getParameter
Get the current list of parameters registered for this link. If there are none set then this will return null. No format checking of the strings are performed.- Specified by:
getParameter
in interfaceVRMLLinkNodeType
- Returns:
- The list of current parameter values or null
-
setParameter
Set the parameter list to the new series of values. A value of null for the parameter list will clear the current list.- Specified by:
setParameter
in interfaceVRMLLinkNodeType
- Parameters:
params
- The new list of parameters to use
-
setWorldUrl
Set the world URL so that any relative URLs may be corrected to the fully qualified version. Guaranteed to be non-null.- Specified by:
setWorldUrl
in interfaceVRMLLinkNodeType
- Parameters:
url
- The world URL.
-
getWorldUrl
-
setUrl
Sets the URL to a new value. We will load only one of these URL's. The list provides alternates.- Specified by:
setUrl
in interfaceVRMLLinkNodeType
- Parameters:
newURL
- Array of candidate URL stringsnumValid
- The number of valid values to copy from the array
-
getUrl
Get the list of URLs requested by this node. If there are no URLs supplied in the text file then this will return a zero length array.- Specified by:
getUrl
in interfaceVRMLLinkNodeType
- Returns:
- The list of URLs to attempt to load
-
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:
getFieldIndex
in 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:
getNodeFieldIndices
in interfaceVRMLNode
- Returns:
- The list of field indices that correspond to SF/MFnode fields or null if none
-
getFieldDeclaration
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.- Specified by:
getFieldDeclaration
in interfaceVRMLNode
- Parameters:
index
- The index of the field to get information- Returns:
- A representation of this field's information
-
getNumFields
public int getNumFields()Get the number of fields.- Specified by:
getNumFields
in interfaceVRMLNode
- Returns:
- The number of fields.
-
getSecondaryType
public int[] getSecondaryType()Get the secondary type of this node. Replaces the instanceof mechanism for use in switch statements.- Specified by:
getSecondaryType
in interfaceVRMLNode
- Overrides:
getSecondaryType
in classAbstractNode
- Returns:
- The secondary 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:
getFieldValue
in interfaceVRMLNodeType
- Overrides:
getFieldValue
in classBaseGroupingNode
- 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:
sendRoute
in interfaceVRMLNodeType
- Overrides:
sendRoute
in classBaseGroupingNode
- 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
Set the value of the field at the given index as a string. This would be used to set SFString field "title".- 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 know
-
setValue
Set the value of the field at the given index as a boolean.- Specified by:
setValue
in interfaceVRMLNodeType
- Overrides:
setValue
in classBaseGroupingNode
- Parameters:
index
- The index of destination field to setvalue
- The new value to use for the node- Throws:
InvalidFieldException
- The field index is not know
-
setValue
Set the value of the field at the given index as a double.- 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 know
-
setValue
Set the value of the field at the given index as a double array of floats. The orientation is to use [number of items][number of values in one item]. This would be used to set MFVec2f, MFVec3f and MFRotation, field types.- 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 nodenumValid
-- Throws:
InvalidFieldException
- The field index is not know
-