Class BaseGeoViewpoint
- All Implemented Interfaces:
VRMLNode
,FrameStateListener
,VRMLBindableNodeType
,VRMLChildNodeType
,VRMLNavigationInfoNodeType
,VRMLNodeType
,VRMLTimeDependentNodeType
,VRMLViewpointNodeType
,VRMLWorldRootChildNodeType
- Direct Known Subclasses:
NRGeoViewpoint
,OGLGeoViewpoint
This implementation implements both the viewpoint and navInfo interfaces so that it can be internally detected by the system as being functional for both parts of the scene graph. The primary type is defined to be the viewpoint, and the secondaries are the bindable and nav info node types. Hopefully this will allow system to work out what is going on here. Note the following paragraph from the X3D spec:
"The GeoViewpoint node may be implemented as if there is an embedded NavigationInfo node that is bound and unbound with the GeoViewpoint node. As such, a X3D browser should internally set the speed, avatarSize, and visibilityLimit fields to an appropriate value for the viewpoint's elevation."
Viewpoints cannot be shared using DEF/USE. They may be named as such for Anchor purposes, but attempting to reuse them will cause an error. This implementation does not provide any protection against USE of this node and attempting to do so will result in throwing exceptions - most probably in the grouping node that includes this node. TODO: CenterOfRotation is missing from regular viewpoint
- Version:
- $Revision: 1.28 $
- Author:
- Alan Hudson, Justin Couch
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected javax.vecmath.AxisAngle4f
protected float[]
Calculated value based on origin if providedprotected List
<NavigationInfoChangeListener> The listener for navigation info changesprotected static final int
Index of the centerOfRotation fieldprotected static final int
Index of the description fieldprotected static final int
Index of the farDistance fieldprotected static final int
Index of the fieldOfView fieldprotected static final int
Index of the geoOrigin fieldprotected static final int
Index of the geoSystem fieldprotected static final int
Index of the headlight fieldprotected static final int
Index of the jump fieldprotected static final int
Index of the nayType fieldprotected static final int
Index of the nearDistance fieldprotected static final int
Index of the orientation fieldprotected static final int
Index of the position fieldprotected static final int
Index of the retainUserOffsets fieldprotected static final int
Index of the orientation fieldprotected static final int
Index of the position fieldprotected static final int
Index of the position fieldprotected static final int
Index of the viewAll fieldprotected static final int
The last index of the nodes used by the viewpointprotected double[]
The origin in useprotected double[]
The calculated local version of the points taking into account both the projection information and the GeoOrigin setting.protected static final int
Number of fields constantprotected OriginManager
Manager for precision controlprotected VRMLProtoInstance
Proto version of the geoOriginprotected boolean
Flag indicating that the OriginManager is enabledprotected String
SFString description ""protected float
SFFloat farDistance -1protected float
SFFloat fieldOfView 0.785398protected VRMLNodeType
field SFNode geoOriginprotected String[]
field MFString geoSystem ["GD","WE"]protected boolean
SFBool headlight TRUEprotected boolean
SFBool jump TRUEprotected String[]
MFString navType ["EXAMINE", "ANY"]protected float
SFFloat nearDistance -1protected float[]
SFRotation orientation 0 0 1 0protected double[]
SFVec3f position 0 0 100000protected boolean
SFBool retainUserOffsets FALSEprotected float
SFFloat speedFactor 1.0protected boolean
SFBool viewAll FALSEprotected List
<ViewpointListener> List of those who want to know about role changes, likely 1Fields inherited from class org.web3d.vrml.renderer.common.nodes.BaseBindableNode
FIELD_BIND, FIELD_BIND_TIME, FIELD_IS_BOUND, isOnStack, LAST_BINDABLE_INDEX, vfBindTime, vfIsBound
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
Fields inherited from interface org.web3d.vrml.nodes.VRMLNavigationInfoNodeType
NAV_TYPE_ANY, NAV_TYPE_EXAMINE, NAV_TYPE_FLY, NAV_TYPE_LOOKAT, NAV_TYPE_NONE, NAV_TYPE_WALK, TRANSITION_TYPE_ANIMATE, TRANSITION_TYPE_LINEAR, TRANSITION_TYPE_TELEPORT
Fields inherited from interface org.web3d.vrml.nodes.VRMLViewpointNodeType
PROJECTION_ORTHO, PROJECTION_PERSPECTIVE
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Construct a default geo viewpoint instanceprotected
BaseGeoViewpoint
(VRMLNodeType node) Construct a new instance of this node based on the details from the given node. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a listener for navigation info changes.void
Add a ViewpointListener.protected void
Convert specified orientation into an axis angle.protected void
fireCenterOfRotationChanged
(float[] val) Send a notification to the registered listeners the center of rotation has changed.protected void
fireFieldOfViewChanged
(float[] val) Send a notification to the registered listeners the field of view has changed.float[]
Get the dimensions of the avatar in use.float[]
Get the center of rotation defined by this viewpoint.Get the description string associated with this viewpoint.float
Get the farDistance value associated with this viewpoint.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.float[]
Get the field of view used by this viewpoint.getFieldValue
(int index) Get the value of a field.boolean
Get the status of the headlight that we are operating with.boolean
getJump()
Get the Jump field value of this viewpoint.float
Get the nearDistance value associated with this viewpoint.int[]
Get the list of indices that correspond to fields that contain nodes ie MFNode and SFNode).int
Get the number of fields.int
Get the number of valid navigation types in the result from getType().int
Get the primary type of this node.int
Get the projection type.boolean
Get the retainUserOffsets field value of this viewpoint.int[]
Get the secondary type of this node.float
getSpeed()
Get the speed that we are currently moving at.String[]
getType()
Get the list of navigation types that are to be used.boolean
Get the viewAll field value of this viewpoint.float
Get the visibility limit that we are currently operating at.void
Remove the listener for navigation info changes.void
Remove a ViewpointListener.void
sendRoute
(double time, int srcIndex, VRMLNodeType destNode, int destIndex) Send a routed value from this node to the given destination node.void
setAvatarSize
(float[] size, int numValid) Set the dimensions of the avatar in use.void
setCenterOfRotation
(float[] pos) Set the center of rotation of this viewpoint.void
setDescription
(String desc) Set the description string of this viewpoint.void
setFarDistance
(float newValue) Set the farDistance value of this viewpointvoid
setFieldOfView
(float fov) Set the field of view for this viewpoint.void
setHeadlight
(boolean enable) Set the state of the headlight to the new value.void
setJump
(boolean jump) Set the jump field value of this viewpoint to the new valuevoid
setNearDistance
(float newValue) Set the nearDistance value of this viewpointprotected void
setOrientation
(float[] dir) Convenience method to set the orientation of the viewpoint.protected void
setPosition
(double[] position) Convenience method to set the position of the viewpoint.void
setRetainUserOffsets
(boolean retainUserOffsets) Set the retainUserOffsets field value of this viewpoint to the new valuevoid
setSpeed
(float newSpeed) Set the speed to move at.void
Set the navigation type to the new value(s).void
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, double[] value, int numValid) Set the value of the field at the given index as an array of floats.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
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 an array of strings.void
setValue
(int index, VRMLNodeType child) Set the value of the field at the given index as a node.void
setViewAll
(boolean viewAll) Set the viewAll field value of this viewpoint to the new valuevoid
setVisibilityLimit
(float limit) Set the visibility limie to move at.void
setWorldLocation
(javax.vecmath.Vector3f wcpos) Sets the current position in world coordinates.Methods inherited from class org.web3d.vrml.renderer.common.nodes.BaseBindableNode
addBindableNodeListener, copy, fireIsBoundChanged, getBindTime, getIsBound, removeBindableNodeListener, setBind, setOnStack, setVRMLClock
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, setDEF, setErrorReporter, setFrameStateManager, setMetadataObject, setUserData, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setVersion, throwInitOnlyWriteException, throwInputOnlyWriteException, throwInvalidNodeException, throwInvalidProtoException, throwOutputOnlyWriteException, updateRefCount, 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.nodes.VRMLBindableNodeType
addBindableNodeListener, getBindTime, getIsBound, removeBindableNodeListener, setBind, setOnStack
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, setDEF, setFrameStateManager, setMetadataObject, setValue, setValue, setValue, setValue, setValue, setValue, setValue, updateRefCount
-
Field Details
-
FIELD_FIELDOFVIEW
protected static final int FIELD_FIELDOFVIEWIndex of the fieldOfView field- See Also:
-
FIELD_JUMP
protected static final int FIELD_JUMPIndex of the jump field- See Also:
-
FIELD_SET_ORIENTATION
protected static final int FIELD_SET_ORIENTATIONIndex of the orientation field- See Also:
-
FIELD_SET_POSITION
protected static final int FIELD_SET_POSITIONIndex of the position field- See Also:
-
FIELD_HEADLIGHT
protected static final int FIELD_HEADLIGHTIndex of the headlight field- See Also:
-
FIELD_NAV_TYPE
protected static final int FIELD_NAV_TYPEIndex of the nayType field- See Also:
-
FIELD_DESCRIPTION
protected static final int FIELD_DESCRIPTIONIndex of the description field- See Also:
-
FIELD_GEO_ORIGIN
protected static final int FIELD_GEO_ORIGINIndex of the geoOrigin field- See Also:
-
FIELD_GEO_SYSTEM
protected static final int FIELD_GEO_SYSTEMIndex of the geoSystem field- See Also:
-
FIELD_ORIENTATION
protected static final int FIELD_ORIENTATIONIndex of the orientation field- See Also:
-
FIELD_POSITION
protected static final int FIELD_POSITIONIndex of the position field- See Also:
-
FIELD_SPEED_FACTOR
protected static final int FIELD_SPEED_FACTORIndex of the position field- See Also:
-
FIELD_CENTER_OF_ROTATION
protected static final int FIELD_CENTER_OF_ROTATIONIndex of the centerOfRotation field- See Also:
-
FIELD_RETAIN_USER_OFFSETS
protected static final int FIELD_RETAIN_USER_OFFSETSIndex of the retainUserOffsets field- See Also:
-
FIELD_VIEWALL
protected static final int FIELD_VIEWALLIndex of the viewAll field- See Also:
-
FIELD_FARDISTANCE
protected static final int FIELD_FARDISTANCEIndex of the farDistance field- See Also:
-
FIELD_NEARDISTANCE
protected static final int FIELD_NEARDISTANCEIndex of the nearDistance field- See Also:
-
LAST_VIEWPOINT_INDEX
protected static final int LAST_VIEWPOINT_INDEXThe last index of the nodes used by the viewpoint- See Also:
-
NUM_FIELDS
protected static final int NUM_FIELDSNumber of fields constant- See Also:
-
vfFieldOfView
protected float vfFieldOfViewSFFloat fieldOfView 0.785398 -
vfJump
protected boolean vfJumpSFBool jump TRUE -
vfRetainUserOffsets
protected boolean vfRetainUserOffsetsSFBool retainUserOffsets FALSE -
vfViewAll
protected boolean vfViewAllSFBool viewAll FALSE -
vfHeadlight
protected boolean vfHeadlightSFBool headlight TRUE -
vfOrientation
protected float[] vfOrientationSFRotation orientation 0 0 1 0 -
vfPosition
protected double[] vfPositionSFVec3f position 0 0 100000 -
vfDescription
SFString description "" -
vfFarDistance
protected float vfFarDistanceSFFloat farDistance -1 -
vfNearDistance
protected float vfNearDistanceSFFloat nearDistance -1 -
vfGeoSystem
field MFString geoSystem ["GD","WE"] -
pGeoOrigin
Proto version of the geoOrigin -
vfGeoOrigin
field SFNode geoOrigin -
vfSpeedFactor
protected float vfSpeedFactorSFFloat speedFactor 1.0 -
localPosition
protected double[] localPositionThe calculated local version of the points taking into account both the projection information and the GeoOrigin setting. -
changeListener
The listener for navigation info changes -
viewpointListeners
List of those who want to know about role changes, likely 1 -
centerOfRotation
protected float[] centerOfRotationCalculated value based on origin if provided -
axis
protected javax.vecmath.AxisAngle4f axis -
originManager
Manager for precision control -
useOriginManager
protected boolean useOriginManagerFlag indicating that the OriginManager is enabled -
local_origin
protected double[] local_originThe origin in use
-
-
Constructor Details
-
BaseGeoViewpoint
protected BaseGeoViewpoint()Construct a default geo viewpoint instance -
BaseGeoViewpoint
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
- The node is not the same type
-
-
Method Details
-
addViewpointListener
Add a ViewpointListener.- Specified by:
addViewpointListener
in interfaceVRMLViewpointNodeType
- Parameters:
l
- The listener. Duplicates and nulls are ignored.
-
removeViewpointListener
Remove a ViewpointListener.- Specified by:
removeViewpointListener
in interfaceVRMLViewpointNodeType
- Parameters:
l
- The listener
-
getProjectionType
public int getProjectionType()Get the projection type.- Specified by:
getProjectionType
in interfaceVRMLViewpointNodeType
- Returns:
- The type of projection. One of the PROJECTION_ constants.
-
getFieldOfView
public float[] getFieldOfView()Get the field of view used by this viewpoint. The value returned is an angle that is not less than zero and less than or equal to PI. The number of items in the list is dependent on the Viewpoint type.- Specified by:
getFieldOfView
in interfaceVRMLViewpointNodeType
- Returns:
- The field of view used by this viewpoint
-
setFieldOfView
Set the field of view for this viewpoint. The value must be between zero and pie or an exception will be thrown.- Parameters:
fov
- The new field of view to use- Throws:
InvalidFieldValueException
- The field used is out of range
-
getJump
public boolean getJump()Get the Jump field value of this viewpoint.- Specified by:
getJump
in interfaceVRMLViewpointNodeType
- Returns:
- true if this viewpoint should jump to new positions
-
setJump
public void setJump(boolean jump) Set the jump field value of this viewpoint to the new value- Specified by:
setJump
in interfaceVRMLViewpointNodeType
- Parameters:
jump
- True if the viewpoint should jump to ne positions
-
getRetainUserOffsets
public boolean getRetainUserOffsets()Get the retainUserOffsets field value of this viewpoint.- Specified by:
getRetainUserOffsets
in interfaceVRMLViewpointNodeType
- Returns:
- true if this viewpoint should retainUserOffsets on a bind
-
setRetainUserOffsets
public void setRetainUserOffsets(boolean retainUserOffsets) Set the retainUserOffsets field value of this viewpoint to the new value- Specified by:
setRetainUserOffsets
in interfaceVRMLViewpointNodeType
- Parameters:
retainUserOffsets
- True if the viewpoint should retainUserOffsets on a bind
-
getViewAll
public boolean getViewAll()Get the viewAll field value of this viewpoint.- Specified by:
getViewAll
in interfaceVRMLViewpointNodeType
- Returns:
- true if this viewpoint should viewAll geometry
-
setViewAll
public void setViewAll(boolean viewAll) Set the viewAll field value of this viewpoint to the new value- Specified by:
setViewAll
in interfaceVRMLViewpointNodeType
- Parameters:
viewAll
- True if the viewpoint should viewAll geometry
-
getDescription
Get the description string associated with this viewpoint. If no description is set, this will return null.- Specified by:
getDescription
in interfaceVRMLViewpointNodeType
- Returns:
- The description string of this viewpoint
-
setDescription
Set the description string of this viewpoint. A zero length string or null will clear the currently set description.- Specified by:
setDescription
in interfaceVRMLViewpointNodeType
- Parameters:
desc
- The new description to use
-
getFarDistance
public float getFarDistance()Get the farDistance value associated with this viewpoint.- Returns:
- The value for this viewpoint
-
setFarDistance
public void setFarDistance(float newValue) Set the farDistance value of this viewpoint- Parameters:
newValue
- The new value to use
-
getNearDistance
public float getNearDistance()Get the nearDistance value associated with this viewpoint.- Returns:
- The value for this viewpoint
-
setNearDistance
public void setNearDistance(float newValue) Set the nearDistance value of this viewpoint- Parameters:
newValue
- The new value to use
-
setWorldLocation
public void setWorldLocation(javax.vecmath.Vector3f wcpos) Sets the current position in world coordinates.- Specified by:
setWorldLocation
in interfaceVRMLNavigationInfoNodeType
- Parameters:
wcpos
- Location of the user in world coordinates(x,y,z)
-
getCenterOfRotation
public float[] getCenterOfRotation()Get the center of rotation defined by this viewpoint. The center of rotation is a point in space relative to the coordinate systems of this node.- Specified by:
getCenterOfRotation
in interfaceVRMLViewpointNodeType
- Returns:
- The position of the center of rotation
-
setCenterOfRotation
Set the center of rotation of this viewpoint. The center is a position in 3-space.- Specified by:
setCenterOfRotation
in interfaceVRMLViewpointNodeType
- Parameters:
pos
- The new position to use- Throws:
InvalidFieldValueException
- The field used is not 3 values
-
getType
Get the list of navigation types that are to be used. It may contain some or all of the constants above. The array will always be non-null.- Specified by:
getType
in interfaceVRMLNavigationInfoNodeType
- Returns:
- The list of navigation types set
-
getNumTypes
public int getNumTypes()Get the number of valid navigation types in the result from getType().- Specified by:
getNumTypes
in interfaceVRMLNavigationInfoNodeType
- Returns:
- The number of elements in getType().
-
setType
Set the navigation type to the new value(s). The array must be non-null. If the underlying implementation does not support any of the types requested, it shall default to the type NONE. If the array is empty, it defaults to NONE.- Specified by:
setType
in interfaceVRMLNavigationInfoNodeType
- Parameters:
types
- The list of types to now use in order of preferencenumValid
- The number of valid values to copy from the array- Throws:
InvalidFieldValueException
- The list was null or empty
-
getAvatarSize
public float[] getAvatarSize()Get the dimensions of the avatar in use.- Specified by:
getAvatarSize
in interfaceVRMLNavigationInfoNodeType
- Returns:
- A list of floats describing the dimension of the avatar.
-
setAvatarSize
Set the dimensions of the avatar in use. The array must have at least three values in it as required by the specification.- Specified by:
setAvatarSize
in interfaceVRMLNavigationInfoNodeType
- Parameters:
size
- The new size values to usenumValid
- The number of valid values to copy from the array- Throws:
InvalidFieldValueException
- The array did not contain 3 values
-
getSpeed
public float getSpeed()Get the speed that we are currently moving at.- Specified by:
getSpeed
in interfaceVRMLNavigationInfoNodeType
- Returns:
- The current movement speed.
-
setSpeed
Set the speed to move at. The speed value must be non-negative.- Specified by:
setSpeed
in interfaceVRMLNavigationInfoNodeType
- Parameters:
newSpeed
- The new speed value to use- Throws:
InvalidFieldValueException
- The speed was negative
-
getVisibilityLimit
public float getVisibilityLimit()Get the visibility limit that we are currently operating at.- Specified by:
getVisibilityLimit
in interfaceVRMLNavigationInfoNodeType
- Returns:
- The current movement visibility limit.
-
setVisibilityLimit
Set the visibility limie to move at. The visibility limit value must be non-negative.- Specified by:
setVisibilityLimit
in interfaceVRMLNavigationInfoNodeType
- Parameters:
limit
- The new visibility limit value to use- Throws:
InvalidFieldValueException
- The visibility limit was negative
-
getHeadlight
public boolean getHeadlight()Get the status of the headlight that we are operating with. A true value represents the headlight being on.- Specified by:
getHeadlight
in interfaceVRMLNavigationInfoNodeType
- Returns:
- true if the headlight is to be used
-
setHeadlight
public void setHeadlight(boolean enable) Set the state of the headlight to the new value.- Specified by:
setHeadlight
in interfaceVRMLNavigationInfoNodeType
- Parameters:
enable
- True if we are to use the headlight
-
setupFinished
public 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.- Specified by:
setupFinished
in interfaceVRMLNodeType
- Overrides:
setupFinished
in classAbstractNode
-
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.
-
getPrimaryType
public int getPrimaryType()Get the primary type of this node. Replaces the instanceof mechanism for use in switch statements.- Specified by:
getPrimaryType
in interfaceVRMLNode
- Returns:
- The primary type
-
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 classBaseBindableNode
- 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 classBaseBindableNode
- 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 classBaseBindableNode
- 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, boolean value) throws InvalidFieldException, InvalidFieldValueException Set the value of the field at the given index as an boolean. This would be used to set SFBool field types.- Specified by:
setValue
in interfaceVRMLNodeType
- Overrides:
setValue
in classBaseBindableNode
- Parameters:
index
- The index of destination field to setvalue
- The new value to use for the node- Throws:
InvalidFieldException
- The index does not relate to one of our fieldsInvalidFieldValueException
- The value does not contain an in range value or bad numerical type
-
setValue
public void setValue(int index, float value) throws InvalidFieldException, InvalidFieldValueException Set the value of the field at the given index as a float. This would be used to set SFFloat 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 node- Throws:
InvalidFieldException
- The index does not relate to one of our fieldsInvalidFieldValueException
- The value does not contain an in range value or bad numerical type
-
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, SFVec2f, SFVec3f and SFRotation 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
- The number of valid values to copy from the array- Throws:
InvalidFieldException
- The index does not relate to one of our fieldsInvalidFieldValueException
- The value does not contain an in range value or bad numerical type
-
setValue
public void setValue(int index, double[] 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, SFVec2f, SFVec3f and SFRotation 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
- The number of valid values to copy from the array- Throws:
InvalidFieldException
- The index does not relate to one of our fieldsInvalidFieldValueException
- The value does not contain an in range value or bad numerical type
-
setValue
Set the value of the field at the given index as a string. This would be used to set SFString 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 node- Throws:
InvalidFieldException
- The field index is not know
-
setValue
public void setValue(int index, String[] value, int numValid) throws InvalidFieldException, InvalidFieldValueException Set the value of the field at the given index as an array of strings. This would be used to set the MFString field type "type".- 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
- The number of valid values to copy from the array- Throws:
InvalidFieldException
- The field index is not knowInvalidFieldValueException
- The value provided is not in range or not appropriate for this field
-
setValue
public void setValue(int index, VRMLNodeType child) throws InvalidFieldException, InvalidFieldValueException Set the value of the field at the given index as a node. This would be used to set SFNode field types.- Specified by:
setValue
in interfaceVRMLNodeType
- Overrides:
setValue
in classAbstractNode
- Parameters:
index
- The index of destination field to setchild
- The new value to use for the node- Throws:
InvalidFieldException
- The field index is not knownInvalidFieldValueException
- The node does not match the required type.
-
setPosition
protected void setPosition(double[] position) Convenience method to set the position of the viewpoint. Designed to be overridden by derived classes. Make sure you also call this first to set the field values.- Parameters:
position
- The position vector to use
-
setOrientation
protected void setOrientation(float[] dir) Convenience method to set the orientation of the viewpoint. Designed to be overridden by derived classes. Make sure you also call this first to set the field values.- Parameters:
dir
- The orientation quaternion to use
-
convOriToAxisAngle
protected void convOriToAxisAngle()Convert specified orientation into an axis angle. -
fireCenterOfRotationChanged
protected void fireCenterOfRotationChanged(float[] val) Send a notification to the registered listeners the center of rotation has changed. If no listeners have been registered, then this does nothing, so always call it regardless.- Parameters:
val
- The new center of Rotation
-
fireFieldOfViewChanged
protected void fireFieldOfViewChanged(float[] val) Send a notification to the registered listeners the field of view has changed. If no listeners have been registered, then this does nothing, so always call it regardless.- Parameters:
val
- The new center of Rotation
-