Package com.sun.j3d.utils.behaviors.vp
Class WandViewBehavior.ListenerBase
java.lang.Object
com.sun.j3d.utils.behaviors.sensor.SensorInputAdaptor
com.sun.j3d.utils.behaviors.vp.WandViewBehavior.ListenerBase
- All Implemented Interfaces:
SensorButtonListener,SensorReadListener
- Direct Known Subclasses:
WandViewBehavior.GrabViewListener6D,WandViewBehavior.RotationListener2D,WandViewBehavior.RotationListener6D,WandViewBehavior.ScaleListener2D,WandViewBehavior.ScaleListener6D,WandViewBehavior.TranslationListener2D,WandViewBehavior.TranslationListener6D
- Enclosing class:
- WandViewBehavior
A base class for implementing some of this behavior's listeners.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Transform3DThe initial transform from sensor coordinates to tracker base coordinates, set byinitAction.protected Transform3DThe initial transform from sensor coordinates to virtual world coordinates, set byinitAction.protected Transform3DThe initial transform from tracker base coordinates to virtual world coordinates, set byinitAction.protected Transform3DThe initial transform from view platform coordinates to virtual world coordinates, set byinitAction. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidconditionViewScale(Transform3D viewPlatformToVworld) Equalizes the scale factors in the view tranform, which must be congruent.protected voidEnds the action.protected doubleGets the scale from physical units to view platform units.protected doubleGets the physical to virtual scale.protected voidinitAction(Sensor s) Initializes the listener action.protected booleanisActive()Returns true if the listener is currently active; that is, ifinitActionhas been called but not yetendAction.voidThis method is called when a sensor's button is pressed.voidThis method is called when a sensor's button is released.protected voidtransformAboutCenter(Transform3D target, javax.vecmath.Point3d center, Transform3D transform) Transforms the target coordinate system about a center point.protected voidtranslateTransform(Transform3D transform, javax.vecmath.Vector3d translation) Translates a coordinate system.Methods inherited from class com.sun.j3d.utils.behaviors.sensor.SensorInputAdaptor
clicked, dragged, read
-
Field Details
-
viewPlatformToVworld
The initial transform from view platform coordinates to virtual world coordinates, set byinitAction. -
trackerToVworld
The initial transform from tracker base coordinates to virtual world coordinates, set byinitAction. -
sensorToVworld
The initial transform from sensor coordinates to virtual world coordinates, set byinitAction. -
sensorToTracker
The initial transform from sensor coordinates to tracker base coordinates, set byinitAction.
-
-
Constructor Details
-
ListenerBase
public ListenerBase()
-
-
Method Details
-
initAction
Initializes the listener action. Subclasses must call this before starting the action, either frompressedor when a 2D valuator exits the deadzone threshold.- Parameters:
s- reference to a 6DOF sensor if used by the listener; may benull
-
endAction
Ends the action. Subclasses must be call this fromreleasedor when a 2D valuator enters the deadzone threshold.- Parameters:
s- reference to a 6DOF sensor if used by the listener; may benull
-
isActive
protected boolean isActive()Returns true if the listener is currently active; that is, ifinitActionhas been called but not yetendAction.- Returns:
- true if the listener is active, false otherwise
-
pressed
Description copied from interface:SensorButtonListenerThis method is called when a sensor's button is pressed.- Specified by:
pressedin interfaceSensorButtonListener- Overrides:
pressedin classSensorInputAdaptor- Parameters:
e- the sensor event
-
released
Description copied from interface:SensorButtonListenerThis method is called when a sensor's button is released.- Specified by:
releasedin interfaceSensorButtonListener- Overrides:
releasedin classSensorInputAdaptor- Parameters:
e- the sensor event
-
getPhysicalToVirtualScale
protected double getPhysicalToVirtualScale()Gets the physical to virtual scale. -
getPhysicalToViewPlatformScale
protected double getPhysicalToViewPlatformScale()Gets the scale from physical units to view platform units. -
translateTransform
Translates a coordinate system.- Parameters:
transform- the coordinate system to be translatedtranslation- the vector by which to translate
-
transformAboutCenter
protected void transformAboutCenter(Transform3D target, javax.vecmath.Point3d center, Transform3D transform) Transforms the target coordinate system about a center point. This can be used for rotation and scaling.- Parameters:
target- the coordinate system to transformcenter- the center point about which to transformtransform- the transform to apply
-
conditionViewScale
Equalizes the scale factors in the view tranform, which must be congruent. If successful, theViewingPlatform TransformGroupis updated; otherwise, its transform is reset to the home transform. This should be called if multiple incremental scale factors are applied to the view transform.- Parameters:
viewPlatformToVworld- the view transform
-