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.AxisAngle4fprotected float[]Calculated value based on origin if providedprotected List<NavigationInfoChangeListener> The listener for navigation info changesprotected static final intIndex of the centerOfRotation fieldprotected static final intIndex of the description fieldprotected static final intIndex of the farDistance fieldprotected static final intIndex of the fieldOfView fieldprotected static final intIndex of the geoOrigin fieldprotected static final intIndex of the geoSystem fieldprotected static final intIndex of the headlight fieldprotected static final intIndex of the jump fieldprotected static final intIndex of the nayType fieldprotected static final intIndex of the nearDistance fieldprotected static final intIndex of the orientation fieldprotected static final intIndex of the position fieldprotected static final intIndex of the retainUserOffsets fieldprotected static final intIndex of the orientation fieldprotected static final intIndex of the position fieldprotected static final intIndex of the position fieldprotected static final intIndex of the viewAll fieldprotected static final intThe 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 intNumber of fields constantprotected OriginManagerManager for precision controlprotected VRMLProtoInstanceProto version of the geoOriginprotected booleanFlag indicating that the OriginManager is enabledprotected StringSFString description ""protected floatSFFloat farDistance -1protected floatSFFloat fieldOfView 0.785398protected VRMLNodeTypefield SFNode geoOriginprotected String[]field MFString geoSystem ["GD","WE"]protected booleanSFBool headlight TRUEprotected booleanSFBool jump TRUEprotected String[]MFString navType ["EXAMINE", "ANY"]protected floatSFFloat nearDistance -1protected float[]SFRotation orientation 0 0 1 0protected double[]SFVec3f position 0 0 100000protected booleanSFBool retainUserOffsets FALSEprotected floatSFFloat speedFactor 1.0protected booleanSFBool 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, vfIsBoundFields 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, vrmlMinorVersionFields 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_TELEPORTFields inherited from interface org.web3d.vrml.nodes.VRMLViewpointNodeType
PROJECTION_ORTHO, PROJECTION_PERSPECTIVE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstruct a default geo viewpoint instanceprotectedBaseGeoViewpoint(VRMLNodeType node) Construct a new instance of this node based on the details from the given node. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a listener for navigation info changes.voidAdd a ViewpointListener.protected voidConvert specified orientation into an axis angle.protected voidfireCenterOfRotationChanged(float[] val) Send a notification to the registered listeners the center of rotation has changed.protected voidfireFieldOfViewChanged(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.floatGet the farDistance value associated with this viewpoint.getFieldDeclaration(int index) Get the declaration of the field at the given index.intgetFieldIndex(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.booleanGet the status of the headlight that we are operating with.booleangetJump()Get the Jump field value of this viewpoint.floatGet the nearDistance value associated with this viewpoint.int[]Get the list of indices that correspond to fields that contain nodes ie MFNode and SFNode).intGet the number of fields.intGet the number of valid navigation types in the result from getType().intGet the primary type of this node.intGet the projection type.booleanGet the retainUserOffsets field value of this viewpoint.int[]Get the secondary type of this node.floatgetSpeed()Get the speed that we are currently moving at.String[]getType()Get the list of navigation types that are to be used.booleanGet the viewAll field value of this viewpoint.floatGet the visibility limit that we are currently operating at.voidRemove the listener for navigation info changes.voidRemove a ViewpointListener.voidsendRoute(double time, int srcIndex, VRMLNodeType destNode, int destIndex) Send a routed value from this node to the given destination node.voidsetAvatarSize(float[] size, int numValid) Set the dimensions of the avatar in use.voidsetCenterOfRotation(float[] pos) Set the center of rotation of this viewpoint.voidsetDescription(String desc) Set the description string of this viewpoint.voidsetFarDistance(float newValue) Set the farDistance value of this viewpointvoidsetFieldOfView(float fov) Set the field of view for this viewpoint.voidsetHeadlight(boolean enable) Set the state of the headlight to the new value.voidsetJump(boolean jump) Set the jump field value of this viewpoint to the new valuevoidsetNearDistance(float newValue) Set the nearDistance value of this viewpointprotected voidsetOrientation(float[] dir) Convenience method to set the orientation of the viewpoint.protected voidsetPosition(double[] position) Convenience method to set the position of the viewpoint.voidsetRetainUserOffsets(boolean retainUserOffsets) Set the retainUserOffsets field value of this viewpoint to the new valuevoidsetSpeed(float newSpeed) Set the speed to move at.voidSet the navigation type to the new value(s).voidNotification that the construction phase of this node has finished.voidsetValue(int index, boolean value) Set the value of the field at the given index as an boolean.voidsetValue(int index, double[] value, int numValid) Set the value of the field at the given index as an array of floats.voidsetValue(int index, float value) Set the value of the field at the given index as a float.voidsetValue(int index, float[] value, int numValid) Set the value of the field at the given index as an array of floats.voidSet the value of the field at the given index as a string.voidSet the value of the field at the given index as an array of strings.voidsetValue(int index, VRMLNodeType child) Set the value of the field at the given index as a node.voidsetViewAll(boolean viewAll) Set the viewAll field value of this viewpoint to the new valuevoidsetVisibilityLimit(float limit) Set the visibility limie to move at.voidsetWorldLocation(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, setVRMLClockMethods 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, 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.nodes.VRMLBindableNodeType
addBindableNodeListener, getBindTime, getIsBound, removeBindableNodeListener, setBind, setOnStackMethods 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, 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:
addViewpointListenerin interfaceVRMLViewpointNodeType- Parameters:
l- The listener. Duplicates and nulls are ignored.
-
removeViewpointListener
Remove a ViewpointListener.- Specified by:
removeViewpointListenerin interfaceVRMLViewpointNodeType- Parameters:
l- The listener
-
getProjectionType
public int getProjectionType()Get the projection type.- Specified by:
getProjectionTypein 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:
getFieldOfViewin 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:
getJumpin 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:
setJumpin 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:
getRetainUserOffsetsin 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:
setRetainUserOffsetsin 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:
getViewAllin 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:
setViewAllin 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:
getDescriptionin 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:
setDescriptionin 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:
setWorldLocationin 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:
getCenterOfRotationin 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:
setCenterOfRotationin 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:
getTypein 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:
getNumTypesin 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:
setTypein 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:
getAvatarSizein 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:
setAvatarSizein 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:
getSpeedin interfaceVRMLNavigationInfoNodeType- Returns:
- The current movement speed.
-
setSpeed
Set the speed to move at. The speed value must be non-negative.- Specified by:
setSpeedin 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:
getVisibilityLimitin 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:
setVisibilityLimitin 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:
getHeadlightin 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:
setHeadlightin 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:
setupFinishedin interfaceVRMLNodeType- Overrides:
setupFinishedin 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:
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.
-
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
-
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 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:
getFieldValuein interfaceVRMLNodeType- Overrides:
getFieldValuein 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:
sendRoutein interfaceVRMLNodeType- Overrides:
sendRoutein 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:
setValuein interfaceVRMLNodeType- Overrides:
setValuein 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:
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 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:
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 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:
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 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:
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
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:
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 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:
setValuein interfaceVRMLNodeType- Overrides:
setValuein 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
-