visad
Class MouseHelper
- java.lang.Object
-
- visad.MouseHelper
-
- All Implemented Interfaces:
- RendererSourceListener
public class MouseHelper extends java.lang.Object implements RendererSourceListener
MouseHelper is the VisAD helper class for MouseBehaviorJ3D and MouseBehaviorJ2D.MouseHelper is preferred by cats everywhere.
-
-
Field Summary
Fields Modifier and Type Field and Description static intCENTERstatic intCURSOR_ROTATEstatic intCURSOR_TRANSLATEstatic intCURSOR_ZOOMstatic intDIRECTstatic intLEFTstatic intNONEstatic intRIGHTstatic intROTATEstatic intTRANSLATEstatic intZOOM
-
Constructor Summary
Constructors Constructor and Description MouseHelper(DisplayRenderer r, MouseBehavior b)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description DisplayImplgetDisplay()Get the Display for this HelperDisplayRenderergetDisplayRenderer()Get the DisplayRenderer for this HelperbooleangetEnableCombos()Get whether the mouse button combos are enabledbooleangetMode2D()Get whether we're in 2D modeMouseBehaviorgetMouseBehavior()Get the MouseBehavior for this HelperProjectionControlgetProjectionControl()Get the ProjectionControl for this Helpervoidprint_matrix(java.lang.String title, double[] m)Print out a readable form of a matrix.voidprocessEvent(java.awt.AWTEvent event)Process the given event treating it as a local event.voidprocessEvent(java.awt.AWTEvent event, int remoteId)Process the given event, treating it as coming from a remote source if remote flag is set.voidrendererDeleted(DataRenderer renderer)Implementation for RendererSourceListener.voidsetEnableCombos(boolean e)Enable/disable the interpretation of any pair of mouse buttons as the third button.voidsetFunctionMap(int[][][] map)Set mapping from (button, ctrl, shift) to function.
-
-
-
Field Detail
-
NONE
public static final int NONE
- See Also:
- Constant Field Values
-
ROTATE
public static final int ROTATE
- See Also:
- Constant Field Values
-
ZOOM
public static final int ZOOM
- See Also:
- Constant Field Values
-
TRANSLATE
public static final int TRANSLATE
- See Also:
- Constant Field Values
-
CURSOR_TRANSLATE
public static final int CURSOR_TRANSLATE
- See Also:
- Constant Field Values
-
CURSOR_ZOOM
public static final int CURSOR_ZOOM
- See Also:
- Constant Field Values
-
CURSOR_ROTATE
public static final int CURSOR_ROTATE
- See Also:
- Constant Field Values
-
DIRECT
public static final int DIRECT
- See Also:
- Constant Field Values
-
LEFT
public static final int LEFT
- See Also:
- Constant Field Values
-
CENTER
public static final int CENTER
- See Also:
- Constant Field Values
-
RIGHT
public static final int RIGHT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MouseHelper
public MouseHelper(DisplayRenderer r, MouseBehavior b)
-
-
Method Detail
-
getMouseBehavior
public MouseBehavior getMouseBehavior()
Get the MouseBehavior for this Helper- Returns:
- MouseBehavior
-
getDisplay
public DisplayImpl getDisplay()
Get the Display for this Helper- Returns:
- Display
-
getDisplayRenderer
public DisplayRenderer getDisplayRenderer()
Get the DisplayRenderer for this Helper- Returns:
- DisplayRenderer
-
getProjectionControl
public ProjectionControl getProjectionControl()
Get the ProjectionControl for this Helper- Returns:
- ProjectionControl
-
getMode2D
public boolean getMode2D()
Get whether we're in 2D mode- Returns:
- true if 2D mode
-
processEvent
public void processEvent(java.awt.AWTEvent event)
Process the given event treating it as a local event.- Parameters:
event- event to process.
-
processEvent
public void processEvent(java.awt.AWTEvent event, int remoteId)Process the given event, treating it as coming from a remote source if remote flag is set.- Parameters:
event- event to process.remoteId- id of remote source.
-
setEnableCombos
public void setEnableCombos(boolean e)
Enable/disable the interpretation of any pair of mouse buttons as the third button.- Parameters:
e- enable/disable. If true (default), interpret any pair of mouse buttons as the third button.
-
getEnableCombos
public boolean getEnableCombos()
Get whether the mouse button combos are enabled- Returns:
- true if any pair of mouse buttons is interpreted as the third
-
setFunctionMap
public void setFunctionMap(int[][][] map) throws VisADExceptionSet mapping from (button, ctrl, shift) to function.map[button][ctrl][shift] = MouseHelper.NONE for no function MouseHelper.ROTATE for box rotate MouseHelper.ZOOM for box zoom MouseHelper.TRANSLATE for box translate MouseHelper.CURSOR_TRANSLATE for cursor translate MouseHelper.CURSOR_ZOOM for cursor on Z axis (3-D only) MouseHelper.CURSOR_ROTATE for box rotate with cursor MouseHelper.DIRECT for direct manipulate where button = 0 (left), 1 (center), 2 (right) ctrl = 0 (CTRL key not pressed), 1 (CTRL key pressed) shift = 0 (SHIFT key not pressed), 1 (SHIFT key pressed) Note some direct manipulation DataRenderers test the status of CTRL and SHIFT keys, so it is advisable that the DIRECT function be invariant to the state of ctrl and shift in the map array. For example, to set the left mouse button for direct manipulation, and the center button for box rotation (only without shift or control): mouse_helper.setFunctionMap(new int[][][] {{{MouseHelper.DIRECT, MouseHelper.DIRECT}, {MouseHelper.DIRECT, MouseHelper.DIRECT}}, {{MouseHelper.ROTATE, MouseHelper.NONE}, {MouseHelper.NONE, MouseHelper.NONE}}, {{MouseHelper.NONE, MouseHelper.NONE}, {MouseHelper.NONE, MouseHelper.NONE}}});- Parameters:
map- map of functions. map must be int[3][2][2]- Throws:
VisADException- bad map
-
print_matrix
public void print_matrix(java.lang.String title, double[] m)Print out a readable form of a matrix. Useful for debugging.- Parameters:
title- title to prepend to output.m- matrix to print.
-
rendererDeleted
public void rendererDeleted(DataRenderer renderer)
Implementation for RendererSourceListener. Notifies that the renderer has been deleted.- Specified by:
rendererDeletedin interfaceRendererSourceListener- Parameters:
renderer- DataRenderer that was deleted.
-
-
DMelt 3.0 © DataMelt by jWork.ORG