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 intIndex of the autoRefresh fieldprotected static final intIndex of the autoRefreshTimeLimit fieldprotected static final intIndex of the description fieldprotected static final intIndex of the load fieldprotected static final intIndex of the parameter fieldprotected static final intIndex of the URL fieldprotected static final intIndex of the visible field, note overloading superclass BaseGroupingNode FIELD_VISIBLEprotected static final intThe last index used by this fieldprotected static final intTotal number of fieldsprotected booleanFlag to indicate if we've checked the URLs for relative referencesprotected doubleSFBool autoRefreshprotected doubleSFBool autoRefreshTimeLimitprotected StringSFString descriptionprotected booleanSFBool loadprotected String[]MFString parameterprotected String[]MFString URL listprotected StringThe 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, vfVisibleFields 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 TypeMethodDescriptiondoubleGet the autoRefresh value to associate with the link.doubleGet 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.intgetFieldIndex(String fieldName) Get the index of the given field name.getFieldValue(int index) Get the value of a field.booleangetLoad()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).intGet 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.voidsendRoute(double time, int srcIndex, VRMLNodeType destNode, int destIndex) Send a routed value from this node to the given destination node.voidsetAutoRefresh(double newValue) Set the autoRefresh value for this link.voidsetAutoRefreshTimeLimit(double newValue) Set the autoRefreshTimeLimit value for this link.voidsetDescription(String desc) Set the description string for this link.voidsetLoad(boolean newValue) Set the load value for this link.voidsetParameter(String[] params) Set the parameter list to the new series of values.voidSets the URL to a new value.voidsetValue(int index, boolean value) Set the value of the field at the given index as a boolean.voidsetValue(int index, double value) Set the value of the field at the given index as a double.voidSet the value of the field at the given index as a string.voidSet the value of the field at the given index as a double array of floats.voidsetWorldUrl(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, updateRefCountMethods 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, 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
getUserData, getVRMLNodeName, isDEF, setErrorReporter, setUserData, setVersionMethods 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:
getDescriptionin 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:
setDescriptionin interfaceVRMLLinkNodeType- Parameters:
desc- The new description to set
-
getAutoRefresh
public double getAutoRefresh()Get the autoRefresh value to associate with the link.- Specified by:
getAutoRefreshin interfaceVRMLLinkNodeType- Returns:
- The current autoRefresh value
-
setAutoRefresh
public void setAutoRefresh(double newValue) Set the autoRefresh value for this link.- Specified by:
setAutoRefreshin interfaceVRMLLinkNodeType- Parameters:
newValue- The new autoRefresh value to set
-
getAutoRefreshTimeLimit
public double getAutoRefreshTimeLimit()Get the autoRefreshTimeLimit value to associate with the link.- Specified by:
getAutoRefreshTimeLimitin interfaceVRMLLinkNodeType- Returns:
- The current TimeLimit value
-
setAutoRefreshTimeLimit
public void setAutoRefreshTimeLimit(double newValue) Set the autoRefreshTimeLimit value for this link.- Specified by:
setAutoRefreshTimeLimitin interfaceVRMLLinkNodeType- Parameters:
newValue- The new autoRefreshTimeLimit value to set
-
getLoad
public boolean getLoad()Get the load value to associate with the link.- Specified by:
getLoadin interfaceVRMLLinkNodeType- Returns:
- The current TimeLimit value
-
setLoad
public void setLoad(boolean newValue) Set the load value for this link.- Specified by:
setLoadin 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:
getParameterin 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:
setParameterin 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:
setWorldUrlin 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:
setUrlin 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:
getUrlin 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:
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
-
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:
getFieldDeclarationin 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:
getNumFieldsin 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:
getSecondaryTypein interfaceVRMLNode- Overrides:
getSecondaryTypein 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:
getFieldValuein interfaceVRMLNodeType- Overrides:
getFieldValuein 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:
sendRoutein interfaceVRMLNodeType- Overrides:
sendRoutein 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:
setValuein interfaceVRMLNodeType- Overrides:
setValuein 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:
setValuein interfaceVRMLNodeType- Overrides:
setValuein 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:
setValuein interfaceVRMLNodeType- Overrides:
setValuein 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:
setValuein interfaceVRMLNodeType- Overrides:
setValuein 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
-