public class NavigatedPanel
extends javax.swing.JPanel
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.KeyListener
       Rectangle2D clipRect = (Rectangle2D) g.getClip();
 
 Our "world coordinates" are the same as java2D's "user coordinates".
 In general, the world coordinate plane is a projective geometry surface, typically
 in units of "km on the projection surface".
 The transformation from lat/lon to the projection plane is handled by a ProjectionImpl object.
 If a user selects a different projection, NavigatedPanel.setProjection() should be called.
 The default projection is "Cylindrical Equidistant" or "LatLon" which simply maps lat/lon
 degrees linearly to screen coordinates. A peculiarity of this projection is that the "seam"
 of the cylinder shifts as the user pans around. Currently our implementation sends
 a NewMapAreaEvent whenever this happens. javax.swing.JPanel.AccessibleJPaneljavax.swing.JComponent.AccessibleJComponent| Modifier and Type | Field and Description | 
|---|---|
protected int | 
deltax
dragging and zooming state 
 | 
protected int | 
deltay
dragging and zooming state 
 | 
javax.swing.AbstractAction | 
setReferenceAction
set reference action 
 | 
protected int | 
startX
dragging and zooming state 
 | 
protected int | 
startY
dragging and zooming state 
 | 
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW| Constructor and Description | 
|---|
NavigatedPanel()
The default constructor. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
addActionsToMenu(javax.swing.JMenu menu)
Add all of the toolbar's actions to a menu. 
 | 
void | 
addCursorMoveEventListener(CursorMoveEventListener l)
Register a CursorMoveEventListener. 
 | 
void | 
addNewMapAreaListener(NewMapAreaListener l)
Register a NewMapAreaListener. 
 | 
void | 
addPickEventListener(PickEventListener l)
Register a PickEventListener. 
 | 
java.awt.geom.AffineTransform | 
calcTransform(boolean rotate,
             double displayX,
             double displayY,
             double displayWidth,
             double displayHeight)
This calculates the Affine Transform that maps the current map area
 (in Projection Coordinates) to a display area (in arbitrary units). 
 | 
void | 
doMoveDown(double factor)
Translate down 
 | 
void | 
doMoveLeft(double factor)
Translate left 
 | 
void | 
doMoveRight(double factor)
Translate  right 
 | 
void | 
doMoveUp(double factor)
Translate up 
 | 
void | 
doZoomIn()
Zoom in 
 | 
void | 
doZoomOut()
Zoom out 
 | 
void | 
drawG()
Draw on the default graphics 
 | 
java.awt.geom.Point2D | 
earthToScreen(ucar.unidata.geoloc.LatLonPoint llp)
Utility to convert earth coordinates to Java screen coordinates 
 | 
ucar.unidata.geoloc.ProjectionRect | 
earthToWorld(ucar.unidata.geoloc.LatLonRect llr)
Change earth rect to world rect 
 | 
void | 
flipLon()
flip the latlon map between 0 360 and +-180 
 | 
java.awt.Color | 
getBackgroundColor()
Get the background color of the NavigatedPanel. 
 | 
java.awt.image.BufferedImage | 
getBufferedImage()
This is used to do some fancy tricks with double buffering 
 | 
java.awt.Graphics2D | 
getBufferedImageGraphics()
User must get this Graphics2D and draw into it when panel needs redrawing 
 | 
ucar.unidata.geoloc.ProjectionRect | 
getMapArea()
Get the current Map Area. 
 | 
javax.swing.JToolBar | 
getMoveToolBar()
Get the move toolbar 
 | 
Navigation | 
getNavigation()
Return the Navigation held by this object. 
 | 
javax.swing.JToolBar | 
getNavToolBar()
Get the navigation toolbar for this panel 
 | 
ucar.unidata.geoloc.ProjectionImpl | 
getProjectionImpl()
Get the current Projection. 
 | 
ucar.unidata.geoloc.LatLonRect | 
getSelectedEarthRegion()
Get the SelectedRegion property. 
 | 
ucar.unidata.geoloc.ProjectionRect | 
getSelectedRegion()
Get the SelectedRegion property. 
 | 
boolean | 
getSelectRegionMode()
Get the SelectRegionMode property. 
 | 
boolean | 
isFocusTraversable()
Return whether the focus is traversable 
 | 
void | 
keyPressed(java.awt.event.KeyEvent e)
Noop 
 | 
void | 
keyReleased(java.awt.event.KeyEvent e)
Noop 
 | 
void | 
keyTyped(java.awt.event.KeyEvent e)
Noop 
 | 
void | 
mouseClicked(java.awt.event.MouseEvent e)
Handle mouse clicked event 
 | 
void | 
mouseDragged(java.awt.event.MouseEvent e)
Handle the mouse dragged event. 
 | 
void | 
mouseEntered(java.awt.event.MouseEvent e)
Noop 
 | 
void | 
mouseExited(java.awt.event.MouseEvent e)
Noop 
 | 
void | 
mouseMoved(java.awt.event.MouseEvent e)
Handle the mouse moved event. 
 | 
void | 
mousePressed(java.awt.event.MouseEvent e)
Handle the mouse pressed event 
 | 
void | 
mouseReleased(java.awt.event.MouseEvent e)
Handle the mouse released event. 
 | 
ucar.unidata.geoloc.ProjectionRect | 
normalizeRectangle(ucar.unidata.geoloc.ProjectionRect bb)
If the projection is a LatLonProjection then this routine
 normalizes the rectangle to be between -180/180 
 | 
void | 
paintComponent(java.awt.Graphics g)
System-triggered redraw. 
 | 
static java.awt.geom.Point2D | 
ProjPointToPoint2D(ucar.unidata.geoloc.ProjectionPointImpl ppi)
Convert from a ProjectionPointImpl object to a Point2D object 
 | 
static java.awt.geom.Rectangle2D | 
ProjRectToRectangle2D(ucar.unidata.geoloc.ProjectionRect projRect)
Convert from a ProjectionRect object to a Rectangle2D object 
 | 
void | 
removeCursorMoveEventListener(CursorMoveEventListener l)
Remove a CursorMoveEventListener. 
 | 
void | 
removeNewMapAreaListener(NewMapAreaListener l)
Remove a NewMapAreaListener. 
 | 
void | 
removePickEventListener(PickEventListener l)
Remove a PickEventListener. 
 | 
void | 
repaint(long tm,
       int x,
       int y,
       int width,
       int height)
Catch repaints - for debugging 
 | 
void | 
resetZoom()
Reset the  zoom and projection 
 | 
ucar.unidata.geoloc.LatLonPoint | 
screenToEarth(java.awt.geom.Point2D p)
Utility to convert Java screen coordinates to earth coordinates 
 | 
protected void | 
selectedRegionChanged()
Handle the selected region changed. 
 | 
void | 
setChangeable(boolean mode)
Sets whether the user can zoom/pan on this NavigatedPanel. 
 | 
void | 
setEnabled(boolean enabled)
_more_ 
 | 
void | 
setMapArea(ucar.unidata.geoloc.ProjectionRect ma)
Set the Map Area. 
 | 
void | 
setPositionLabel(javax.swing.JLabel l)
The status label is where the lat/lon position of the mouse
 is displayed. 
 | 
void | 
setProjectionImpl(ucar.unidata.geoloc.ProjectionImpl p)
Set the Projection, change the Map Area to the projection's default 
 | 
void | 
setSelectedRegion(ucar.unidata.geoloc.LatLonRect llr)
Set the SelectedRegion property. 
 | 
void | 
setSelectedRegion(ucar.unidata.geoloc.ProjectionRect value)
Set the SelectedRegion property. 
 | 
void | 
setSelectedRegionBounds(ucar.unidata.geoloc.ProjectionRect bounds)
Define a bounding rectangle, in world coordinates, that the
 selection region is limited to. 
 | 
void | 
setSelectRegionMode(boolean value)
Set the SelectRegionMode property. 
 | 
void | 
setWorldCenterX(double wx_center)
kludgy thing to shift LatLon seam 
 | 
boolean | 
shouldSelectRegion(java.awt.event.MouseEvent e)
Are we in select region mode for the given event 
 | 
boolean | 
wantRotate(double pwidth,
          double pheight)
utility routine for printing. 
 | 
void | 
zoom(double zoomFactor)
Zoom by the given factor 
 | 
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIaddAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateadd, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCyclepublic javax.swing.AbstractAction setReferenceAction
protected int startX
protected int startY
protected int deltax
protected int deltay
public void setEnabled(boolean enabled)
setEnabled in class javax.swing.JComponentenabled - _more_public static java.awt.geom.Rectangle2D ProjRectToRectangle2D(ucar.unidata.geoloc.ProjectionRect projRect)
projRect - ProjectionRect objectpublic static java.awt.geom.Point2D ProjPointToPoint2D(ucar.unidata.geoloc.ProjectionPointImpl ppi)
ppi - ProjectionPointImpl objectpublic void addCursorMoveEventListener(CursorMoveEventListener l)
l - listener to registerpublic void removeCursorMoveEventListener(CursorMoveEventListener l)
l - listener to removepublic void addPickEventListener(PickEventListener l)
l - listener to registerpublic void removePickEventListener(PickEventListener l)
l - listener to removepublic void addNewMapAreaListener(NewMapAreaListener l)
l - listener to registerpublic void removeNewMapAreaListener(NewMapAreaListener l)
l - listener to removepublic java.awt.Color getBackgroundColor()
public Navigation getNavigation()
public ucar.unidata.geoloc.ProjectionRect getMapArea()
public void setMapArea(ucar.unidata.geoloc.ProjectionRect ma)
ma - the MapAreapublic void setWorldCenterX(double wx_center)
wx_center - world center pointpublic boolean isFocusTraversable()
isFocusTraversable in class java.awt.Componentpublic ucar.unidata.geoloc.ProjectionImpl getProjectionImpl()
public ucar.unidata.geoloc.ProjectionRect normalizeRectangle(ucar.unidata.geoloc.ProjectionRect bb)
bb - Incoming rectanglepublic void setProjectionImpl(ucar.unidata.geoloc.ProjectionImpl p)
p - the Projectionpublic void setPositionLabel(javax.swing.JLabel l)
l - the Jlabel to write intopublic javax.swing.JToolBar getNavToolBar()
public javax.swing.JToolBar getMoveToolBar()
public void addActionsToMenu(javax.swing.JMenu menu)
menu - the menu to add the actions topublic void setChangeable(boolean mode)
mode - set to false if user can't zoom/panpublic void repaint(long tm,
                    int x,
                    int y,
                    int width,
                    int height)
repaint in class javax.swing.JComponenttm - not usedx - x value of the dirty regiony - y value of the dirty regionwidth - width of the dirty regionheight - height of the dirty regionpublic void paintComponent(java.awt.Graphics g)
paintComponent in class javax.swing.JComponentg - graphics to paintpublic java.awt.image.BufferedImage getBufferedImage()
public java.awt.Graphics2D getBufferedImageGraphics()
public boolean wantRotate(double pwidth,
                          double pheight)
pwidth - width of the page, units are arbitrarypheight - height of the page, units are arbitrarypublic java.awt.geom.AffineTransform calcTransform(boolean rotate,
                                                   double displayX,
                                                   double displayY,
                                                   double displayWidth,
                                                   double displayHeight)
rotate - should the page be rotated?displayX - upper right X coord of corner of display areadisplayY - upper right Y coord of corner of display areadisplayWidth - display area widthdisplayHeight - display area heightNavigation.calcTransform(boolean, double, double, double, double)public void drawG()
public ucar.unidata.geoloc.LatLonPoint screenToEarth(java.awt.geom.Point2D p)
p - Screen pointpublic java.awt.geom.Point2D earthToScreen(ucar.unidata.geoloc.LatLonPoint llp)
llp - Earthpublic void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface java.awt.event.MouseListenere - event to handlepublic boolean shouldSelectRegion(java.awt.event.MouseEvent e)
e - eventpublic ucar.unidata.geoloc.ProjectionRect earthToWorld(ucar.unidata.geoloc.LatLonRect llr)
llr - earthpublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenere - event to handleprotected void selectedRegionChanged()
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListenere - event to handlepublic void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged in interface java.awt.event.MouseMotionListenere - event to handlepublic void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved in interface java.awt.event.MouseMotionListenere - event to handlepublic void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered in interface java.awt.event.MouseListenere - The eventpublic void mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface java.awt.event.MouseListenere - The eventpublic void keyPressed(java.awt.event.KeyEvent e)
keyPressed in interface java.awt.event.KeyListenere - The eventpublic void keyReleased(java.awt.event.KeyEvent e)
keyReleased in interface java.awt.event.KeyListenere - The eventpublic void keyTyped(java.awt.event.KeyEvent e)
keyTyped in interface java.awt.event.KeyListenere - The eventpublic void doZoomIn()
public void doZoomOut()
public void zoom(double zoomFactor)
zoomFactor - zoom factorpublic void doMoveUp(double factor)
factor - bypublic void doMoveDown(double factor)
factor - bypublic void doMoveRight(double factor)
factor - bypublic void doMoveLeft(double factor)
factor - bypublic void resetZoom()
public void flipLon()
public void setSelectRegionMode(boolean value)
value - The new value for SelectRegionModepublic void setSelectedRegionBounds(ucar.unidata.geoloc.ProjectionRect bounds)
bounds - The boundspublic boolean getSelectRegionMode()
public void setSelectedRegion(ucar.unidata.geoloc.ProjectionRect value)
value - The new value for SelectedRegionpublic void setSelectedRegion(ucar.unidata.geoloc.LatLonRect llr)
llr - The new regionpublic ucar.unidata.geoloc.ProjectionRect getSelectedRegion()
public ucar.unidata.geoloc.LatLonRect getSelectedEarthRegion()