visad.java2d
Class KeyboardBehaviorJ2D
- java.lang.Object
-
- visad.java2d.KeyboardBehaviorJ2D
-
- All Implemented Interfaces:
- KeyboardBehavior
public class KeyboardBehaviorJ2D extends java.lang.Object implements KeyboardBehavior
KeyboardBehaviorJ2D is the VisAD class for keyboard control of translate (pan) and zoom in Java2D.
-
-
Field Summary
Fields Modifier and Type Field and Description static intROTATE_Z_NEGIdentifier for function to rotate negatively around the Z viewing axis (perpendicular to the screen plane)static intROTATE_Z_POSIdentifier for function to rotate positively around the Z viewing axis (perpendicular to the screen plane)-
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 KeyboardBehaviorJ2D(DisplayRendererJ2D r)Construct a new keyboard behavior for the DisplayRenderer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidexecFunction(int function)Executes the given function.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.
-
-
-
Field Detail
-
ROTATE_Z_POS
public static final int ROTATE_Z_POS
Identifier for function to rotate positively around the Z viewing axis (perpendicular to the screen plane)- 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 (perpendicular to the screen plane)- See Also:
- Constant Field Values
-
-
Constructor Detail
-
KeyboardBehaviorJ2D
public KeyboardBehaviorJ2D(DisplayRendererJ2D 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 keys for manipulations are as follows:
Translation- Arrow keys - translate up, down, left, right
- Shift + Up arrow - zoom in (ZOOM_IN)
- Shift + Down arrow - zoom out (ZOOM_OUT)
- Shift + Left arrow - rotate left (ROTATE_Z_POS)
- Shift + Right arrow - rotate right (ROTATE_Z_NEG)
- Ctrl + R key - reset to original projection (RESET)
- Parameters:
r- DisplayRenderer to use.- See Also:
DisplayRendererJ2D.addKeyboardBehavior(KeyboardBehaviorJ2D behavior)
-
-
Method Detail
-
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