org.mbari.siam.moos.utils.chart.graph
Class G2Dint

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Canvas
          extended by org.mbari.siam.moos.utils.chart.graph.Graph2D
              extended by org.mbari.siam.moos.utils.chart.graph.G2Dint
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible
Direct Known Subclasses:
Contour

public class G2Dint
extends Graph2D

This class is an extension of Graph2D class. It adds interactive selection of the plotting range and can display the mouse position in user coordinates.

Mouse Events

MouseDown
Starts the range selection
MouseDrag
Drag out a rectangular range selection
MouseUp
Replot with modified plotting range.

KeyDown Events

R
Redraw plot with default limits
r
Redraw plot using current limits
m
Pop window to enter manually plot range
c
Toggle pop-up window that displays the mouse position in user coordinates
d
Show coordinates of the closest data point to the cursor
D
Hide data coordinates pop-window
h
This key pressed in Any pop-window at any-time will hide it.

Note: To hide Any pop-window press the key h in the window. This will hide the window at any time. Depending on your windowing system the mouse button might have to be pressed in the popup window to ensure it has the keyboard focus.

Version:
$Revision: 1.1 $, $Date: 2008/11/04 22:17:54 $.
Author:
Leigh Brookshaw
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Canvas
java.awt.Canvas.AccessibleAWTCanvas
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  boolean drag
          Set to true when a rectangle is being dragged out by the mouse
protected  boolean userlimits
          User limits.
protected  Axis xaxis
          Attached X Axis which must be registered with this class.
protected  Axis yaxis
          Attached Y Axis which must be registered with this class.
 
Fields inherited from class org.mbari.siam.moos.utils.chart.graph.Graph2D
axis, borderBottom, borderLeft, borderRight, borderTop, clearAll, DataBackground, datarect, dataset, drawgrid, drawzero, frame, framecolor, gridcolor, lastText, load_thread, loadingData, markers, paintAll, square, zerocolor
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
G2Dint()
           
 
Method Summary
 boolean action(java.awt.Event e, java.lang.Object a)
          Handle the Action Events.
 void attachAxis(Axis a)
          Attach axis to be used for the drag scaling.
 Axis createXAxis()
          Create Xaxis to be used for the drag scaling
 Axis createYAxis()
          Create Yaxis to be used for the drag scaling
protected  double[] getClosestPoint(int ix, int iy)
          Find the closest data point to the cursor
 boolean keyDown(java.awt.Event e, int key)
          Handle the Key Down events.
 boolean mouseDown(java.awt.Event e, int x, int y)
          Handle the Mouse Down events
 boolean mouseDrag(java.awt.Event e, int x, int y)
          Handle the Mouse Drag events
 boolean mouseMove(java.awt.Event e, int x, int y)
          Handle the Mouse Mouve events
 boolean mouseUp(java.awt.Event e, int x, int y)
          Handle the Mouse Up events
 void update(java.awt.Graphics g)
          New update method incorporating mouse dragging.
 
Methods inherited from class org.mbari.siam.moos.utils.chart.graph.Graph2D
attachDataSet, createAxis, detachAxes, detachAxis, detachDataSet, detachDataSets, drawAxis, drawFrame, finishedloading, ForceSquare, getDataRectangle, getMarkers, getXmax, getXmin, getYmax, getYmin, loadDataSet, loadFile, loadmessage, paint, paintBeforeData, paintFirst, paintLast, setDataBackground, setGraphBackground, setMarkers, startedloading
 
Methods inherited from class java.awt.Canvas
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy
 
Methods inherited from class java.awt.Component
add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseEnter, mouseExit, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

drag

protected boolean drag
Set to true when a rectangle is being dragged out by the mouse


userlimits

protected boolean userlimits
User limits. The user has set the limits using the mouse drag option


xaxis

protected Axis xaxis
Attached X Axis which must be registered with this class. This is one of the axes used to find the drag range. If no X axis is registered no mouse drag.


yaxis

protected Axis yaxis
Attached Y Axis which must be registered with this class. This is one of the axes used to find the drag range. If no Y axis is registered no mouse drag.

Constructor Detail

G2Dint

public G2Dint()
Method Detail

createXAxis

public Axis createXAxis()
Create Xaxis to be used for the drag scaling


createYAxis

public Axis createYAxis()
Create Yaxis to be used for the drag scaling


attachAxis

public void attachAxis(Axis a)
Attach axis to be used for the drag scaling. X axes are assumed to have Axis position Axis.BOTTOM or Axis.TOP. Y axes are assumed to have position Axis.LEFT or Axis.RIGHT.

Overrides:
attachAxis in class Graph2D
Parameters:
a - Axis to attach
See Also:
Axis

update

public void update(java.awt.Graphics g)
New update method incorporating mouse dragging.

Overrides:
update in class Graph2D

keyDown

public boolean keyDown(java.awt.Event e,
                       int key)
Handle the Key Down events.

Overrides:
keyDown in class Graph2D

mouseDown

public boolean mouseDown(java.awt.Event e,
                         int x,
                         int y)
Handle the Mouse Down events

Overrides:
mouseDown in class java.awt.Component

mouseUp

public boolean mouseUp(java.awt.Event e,
                       int x,
                       int y)
Handle the Mouse Up events

Overrides:
mouseUp in class java.awt.Component

mouseDrag

public boolean mouseDrag(java.awt.Event e,
                         int x,
                         int y)
Handle the Mouse Drag events

Overrides:
mouseDrag in class java.awt.Component

mouseMove

public boolean mouseMove(java.awt.Event e,
                         int x,
                         int y)
Handle the Mouse Mouve events

Overrides:
mouseMove in class java.awt.Component

action

public boolean action(java.awt.Event e,
                      java.lang.Object a)
Handle the Action Events. This handler allows external classes (pop-up windows etc.) to communicate to this class asyncronously.

Overrides:
action in class java.awt.Component

getClosestPoint

protected double[] getClosestPoint(int ix,
                                   int iy)
Find the closest data point to the cursor



Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.