visad.java3d
Class KeyboardBehaviorJ3D
- java.lang.Object
-
- javax.media.j3d.SceneGraphObject
-
- javax.media.j3d.Node
-
- javax.media.j3d.Leaf
-
- javax.media.j3d.Behavior
-
- visad.java3d.KeyboardBehaviorJ3D
-
- All Implemented Interfaces:
- KeyboardBehavior
- Direct Known Subclasses:
- CBMKeyboardBehaviorJ3D
public class KeyboardBehaviorJ3D extends javax.media.j3d.Behavior implements KeyboardBehavior
KeyboardBehaviorJ3D is the VisAD class for keyboard control of rotation, translation, and zoom of display in Java3D.
-
-
Field Summary
Fields Modifier and Type Field and Description static intROTATE_X_NEGIdentifier for function to rotate negatively around the X viewing axisstatic intROTATE_X_POSIdentifier for function to rotate positively around the X viewing axisstatic intROTATE_Y_NEGIdentifier for function to rotate negatively around the Y viewing axisstatic intROTATE_Y_POSIdentifier for function to rotate positively around the Y viewing axisstatic intROTATE_Z_NEGIdentifier for function to rotate negatively around the Z viewing axisstatic intROTATE_Z_POSIdentifier for function to rotate positively around the Z viewing axis-
Fields inherited from class javax.media.j3d.Node
ALLOW_AUTO_COMPUTE_BOUNDS_READ, ALLOW_AUTO_COMPUTE_BOUNDS_WRITE, ALLOW_BOUNDS_READ, ALLOW_BOUNDS_WRITE, ALLOW_COLLIDABLE_READ, ALLOW_COLLIDABLE_WRITE, ALLOW_LOCAL_TO_VWORLD_READ, ALLOW_LOCALE_READ, ALLOW_PARENT_READ, ALLOW_PICKABLE_READ, ALLOW_PICKABLE_WRITE, ENABLE_COLLISION_REPORTING, ENABLE_PICK_REPORTING
-
Fields inherited from interface visad.KeyboardBehavior
NO_MASK, RESET, TRANSLATE_DOWN, TRANSLATE_LEFT, TRANSLATE_RIGHT, TRANSLATE_UP, ZOOM_IN, ZOOM_OUT
-
-
Constructor Summary
Constructors Constructor and Description KeyboardBehaviorJ3D(DisplayRendererJ3D r)Construct a new keyboard behavior for the DisplayRenderer.KeyboardBehaviorJ3D(DisplayRendererJ3D r, int num_functions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidexecFunction(int function)Executes the given function.voidinitialize()Initialize this behavior.voidmapKeyToFunction(int function, int keycode, int modifiers)Maps key represented by keycode & modifiers to the given function.voidprocessKeyEvent(java.awt.event.KeyEvent event)Process a key event.voidprocessStimulus(java.util.Enumeration criteria)Process a stimulus meant for this behavior.-
Methods inherited from class javax.media.j3d.Behavior
getEnable, getNumSchedulingIntervals, getSchedulingBoundingLeaf, getSchedulingBounds, getSchedulingInterval, postId, setEnable, setSchedulingBoundingLeaf, setSchedulingBounds, setSchedulingInterval, updateNodeReferences
-
Methods inherited from class javax.media.j3d.Node
cloneNode, cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, duplicateNode, getBounds, getBoundsAutoCompute, getCollidable, getLocale, getLocalToVworld, getLocalToVworld, getParent, getPickable, setBounds, setBoundsAutoCompute, setCollidable, setPickable
-
-
-
-
Field Detail
-
ROTATE_Z_POS
public static final int ROTATE_Z_POS
Identifier for function to rotate positively around the Z viewing axis- See Also:
- Constant Field Values
-
ROTATE_Z_NEG
public static final int ROTATE_Z_NEG
Identifier for function to rotate negatively around the Z viewing axis- See Also:
- Constant Field Values
-
ROTATE_X_POS
public static final int ROTATE_X_POS
Identifier for function to rotate positively around the X viewing axis- See Also:
- Constant Field Values
-
ROTATE_X_NEG
public static final int ROTATE_X_NEG
Identifier for function to rotate negatively around the X viewing axis- See Also:
- Constant Field Values
-
ROTATE_Y_POS
public static final int ROTATE_Y_POS
Identifier for function to rotate positively around the Y viewing axis- See Also:
- Constant Field Values
-
ROTATE_Y_NEG
public static final int ROTATE_Y_NEG
Identifier for function to rotate negatively around the Y viewing axis- See Also:
- Constant Field Values
-
-
Constructor Detail
-
KeyboardBehaviorJ3D
public KeyboardBehaviorJ3D(DisplayRendererJ3D r)
Construct a new keyboard behavior for the DisplayRenderer. You need to add the behavior to the DisplayRenderer if you want to use it. Default key assignments use the arrow keys to simulate the default VisAD mouse behavior.Rotation (3D renderer only):
- Arrow keys - rotate up (X_NEG), down(X_POS), left(Y_NEG), right(Y_POS)
- Shift + Up arrow - zoom in (ZOOM_IN)
- Shift + Down arrow - zoom out (ZOOM_OUT)
- Shift + Left arrow - rotate left around axis perpendicular to screen (Z_POS)
- Shift + Right arrow - rotate right around axis perpendicular to screen (Z_NEG)
- Ctrl + Arrow keys - translate up, down, left, right
- Ctrl + R key - reset to original projection (RESET)
- Parameters:
r- DisplayRenderer to use.- See Also:
DisplayRendererJ3D.addKeyboardBehavior(KeyboardBehaviorJ3D behavior),to change default key to function mappings
-
KeyboardBehaviorJ3D
public KeyboardBehaviorJ3D(DisplayRendererJ3D r, int num_functions)
-
-
Method Detail
-
initialize
public void initialize()
Initialize this behavior. NOTE: Applications should not call this method. It is called by the Java 3D behavior scheduler.- Specified by:
initializein classjavax.media.j3d.Behavior
-
processStimulus
public void processStimulus(java.util.Enumeration criteria)
Process a stimulus meant for this behavior. This method is invoked when a key is pressed. NOTE: Applications should not call this method. It is called by the Java 3D behavior scheduler.- Specified by:
processStimulusin classjavax.media.j3d.Behavior- Parameters:
criteria- an enumeration of triggered wakeup criteria
-
mapKeyToFunction
public void mapKeyToFunction(int function, int keycode, int modifiers)Maps key represented by keycode & modifiers to the given function. Each function can only have one key/modifier combination assigned to it at a time.- Specified by:
mapKeyToFunctionin interfaceKeyboardBehavior- Parameters:
function- keyboard function (ROTATE_X_POS, ZOOM_IN, etc)keycode-KeyEventvirtual keycodesmodifiers-InputEventkey mask- See Also:
KeyEvent,InputEvent
-
processKeyEvent
public void processKeyEvent(java.awt.event.KeyEvent event)
Process a key event. Determines whether a meaningful key was pressed.- Specified by:
processKeyEventin interfaceKeyboardBehavior- Parameters:
event- KeyEvent stimulus
-
execFunction
public void execFunction(int function)
Executes the given function.- Specified by:
execFunctionin interfaceKeyboardBehavior- Parameters:
function- function to perform (TRANSLATE_UP, ZOOM_IN, etc)
-
-
DMelt 3.0 © DataMelt by jWork.ORG