| |
|
| java.lang.Object javax.media.j3d.SceneGraphObject javax.media.j3d.Node javax.media.j3d.Leaf javax.media.j3d.Behavior com.db.behaviors.ViewerBehavior com.db.behaviors.WalkViewerBehavior
WalkViewerBehavior | public class WalkViewerBehavior extends ViewerBehavior (Code) | | WalkViewerBehavior is a utility class that creates a "walking style"
navigation symantic.
The behavior wakes up on mouse button presses, releases, and
mouse movements and generates transforms in a "walk style" that
enables the user to walk through a scene, translating and turning
about as if they are within the scene. Such a walk style is
similar to the "Walk" navigation type used by VRML browsers.
The behavior maps mouse drags to different transforms depending
upon the mouse button held down:
- Button 1 (left)
- Horizontal movement --> Y-axis rotation
- Vertical movement --> Z-axis translation
- Button 2 (middle)
- Horizontal movement --> Y-axis rotation
- Vertical movement --> X-axis rotation
- Button 3 (right)
- Horizontal movement --> X-axis translation
- Vertical movement --> Y-axis translation
To support systems with 2 or 1 mouse buttons, the following
alternate mappings are supported while dragging with any mouse
button held down and zero or more keyboard modifiers held down:
- No modifiers = Button 1
- ALT = Button 2
- Meta = Button 3
- Control = Button 3
The behavior automatically modifies a TransformGroup provided
to the constructor. The TransformGroup's transform can be set
at any time by the application or other behaviors to cause the
walk rotation and translation to be reset.
While a mouse button is down, the behavior automatically changes
the cursor in a given parent AWT Component. If no parent
Component is given, no cursor changes are attempted.
version: 1.0, 98/04/16 author: David R. Nadeau, San Diego Supercomputer Center |
DEFAULT_YROTATION_ANIMATION_FACTOR | final public static double DEFAULT_YROTATION_ANIMATION_FACTOR(Code) | | Default Rotation and translation scaling factors for
animated movements (Button 1 press).
|
DEFAULT_ZTRANSLATION_ANIMATION_FACTOR | final public static double DEFAULT_ZTRANSLATION_ANIMATION_FACTOR(Code) | | |
DELTAX_DEADZONE | final protected static int DELTAX_DEADZONE(Code) | | |
DELTAY_DEADZONE | final protected static int DELTAY_DEADZONE(Code) | | |
YRotationAnimationFactor | protected double YRotationAnimationFactor(Code) | | |
ZTranslationAnimationFactor | protected double ZTranslationAnimationFactor(Code) | | |
initialX | protected int initialX(Code) | | |
initialY | protected int initialY(Code) | | |
previousX | protected int previousX(Code) | | |
previousY | protected int previousY(Code) | | |
WalkViewerBehavior | public WalkViewerBehavior()(Code) | | Constructs a new walk behavior that converts mouse actions
into rotations and translations. Rotations and translations
are written into a TransformGroup that must be set using the
setTransformGroup method. The cursor will be changed during
mouse actions if the parent frame is set using the
setParentComponent method.
a new WalkViewerBehavior that needs itsTransformGroup and parent Component set |
WalkViewerBehavior | public WalkViewerBehavior(Component parent)(Code) | | Constructs a new walk behavior that converts mouse actions
into rotations and translations. Rotations and translations
are written into a TransformGroup that must be set using the
setTransformGroup method. The cursor will be changed within
the given AWT parent Component during mouse drags.
Parameters: parent - a parent AWT Component within which the cursorwill change during mouse drags a new WalkViewerBehavior that needs itsTransformGroup and parent Component set |
WalkViewerBehavior | public WalkViewerBehavior(TransformGroup transformGroup)(Code) | | Constructs a new walk behavior that converts mouse actions
into rotations and translations. Rotations and translations
are written into the given TransformGroup. The cursor will
be changed during mouse actions if the parent frame is set
using the setParentComponent method.
Parameters: transformGroup - a TransformGroup whos transform isread and written by the behavior a new WalkViewerBehavior that needs itsTransformGroup and parent Component set |
WalkViewerBehavior | public WalkViewerBehavior(TransformGroup transformGroup, Component parent)(Code) | | Constructs a new walk behavior that converts mouse actions
into rotations and translations. Rotations and translations
are written into the given TransformGroup. The cursor will be
changed within the given AWT parent Component during mouse drags.
Parameters: transformGroup - a TransformGroup whos transform isread and written by the behavior Parameters: parent - a parent AWT Component within which the cursorwill change during mouse drags a new WalkViewerBehavior that needs itsTransformGroup and parent Component set |
getYRotationAnimationFactor | public double getYRotationAnimationFactor()(Code) | | Gets the current Y animation rotation scaling factor for Y-axis
rotations.
the double Y rotation scaling factor |
getZTranslationAnimationFactor | public double getZTranslationAnimationFactor()(Code) | | Gets the current Z animation translation scaling factor for Z-axis
translations.
the double Z translation scaling factor |
onButton1 | public void onButton1(MouseEvent mev)(Code) | | Responds to a button1 event (press, release, or drag). On a
press, the method adds a wakeup criterion to the behavior's
set, callling for the behavior to be awoken on each frame.
On a button prelease, this criterion is removed from the set.
Parameters: mouseEvent - the MouseEvent to respond to |
onButton2 | public void onButton2(MouseEvent mev)(Code) | | Responds to a button2 event (press, release, or drag). On a
press, the method records the initial cursor location.
On a drag, the difference between the current and previous
cursor location provides a delta that controls the amount by
which to rotate in X and Y.
Parameters: mouseEvent - the MouseEvent to respond to |
onButton3 | public void onButton3(MouseEvent mev)(Code) | | Responds to a button3 event (press, release, or drag).
On a drag, the difference between the current and previous
cursor location provides a delta that controls the amount by
which to translate in X and Y.
Parameters: mouseEvent - the MouseEvent to respond to |
onElapsedFrames | public void onElapsedFrames(WakeupOnElapsedFrames timeEvent)(Code) | | Respond to an elapsed frames event (assuming subclass has set up a
wakeup criterion for it).
Parameters: time - A WakeupOnElapsedFrames criterion to respond to. |
setYRotationAnimationFactor | public void setYRotationAnimationFactor(double factor)(Code) | | Sets the Y rotation animation scaling factor for Y-axis rotations.
This scaling factor is used to control the speed of Y rotation
when button 1 is pressed and dragged.
Parameters: factor - the double Y rotation scaling factor |
setZTranslationAnimationFactor | public void setZTranslationAnimationFactor(double factor)(Code) | | Sets the Z animation translation scaling factor for Z-axis
translations. This scaling factor is used to control the speed
of Z translation when button 1 is pressed and dragged.
Parameters: factor - the double Z translation scaling factor |
|
|
|