public class NavigatedPanel
extends javax.swing.JPanel
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.
NPController
,
Serialized Formjavax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
javax.swing.AbstractAction |
setReferenceAction |
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
NavigatedPanel()
The 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 |
addGeoSelectionListener(GeoSelectionListener l)
Register a PickEventListener.
|
void |
addNewMapAreaListener(NewMapAreaListener l)
Register a NewMapAreaListener.
|
void |
addNewProjectionListener(NewProjectionListener l)
Register a NewProjectionListener.
|
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 |
drawG() |
java.awt.Color |
getBackgroundColor() |
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
|
ProjectionRect |
getGeoSelection() |
LatLonRect |
getGeoSelectionLL() |
ProjectionRect |
getMapArea()
Get the current Map Area
|
LatLonRect |
getMapAreaLL()
Get the current Map Area as a lat/lon bounding box
|
javax.swing.JToolBar |
getMoveToolBar() |
Navigation |
getNavigation() |
javax.swing.JToolBar |
getNavToolBar() |
ProjectionImpl |
getProjectionImpl()
Get the current Projection.
|
void |
paintComponent(java.awt.Graphics g)
System-triggered redraw.
|
void |
removeCursorMoveEventListener(CursorMoveEventListener l)
Remove a CursorMoveEventListener.
|
void |
removeGeoSelectionListener(GeoSelectionListener l)
Remove a PickEventListener.
|
void |
removeNewMapAreaListener(NewMapAreaListener l)
Remove a NewMapAreaListener.
|
void |
removeNewProjectionListener(NewProjectionListener l)
Remove a NewProjectionListener.
|
void |
removePickEventListener(PickEventListener l)
Remove a PickEventListener.
|
void |
repaint(long tm,
int x,
int y,
int width,
int height)
catch repaints - for debugging
|
void |
setChangeable(boolean mode)
sets whether the user can zoom/pan on this NavigatedPanel.
|
void |
setEnabledActions(boolean b) |
void |
setGeoSelection(LatLonRect llbb) |
void |
setGeoSelection(ProjectionRect bb) |
void |
setGeoSelectionMode(boolean b) |
void |
setLatLonCenterMapArea(double lat,
double lon)
set the center point of the MapArea
|
void |
setMapArea(LatLonRect llbb)
Set the Map Area by converting LatLonRect to a ProjectionRect.
|
void |
setMapArea(ProjectionRect ma)
Set the Map Area.
|
void |
setPositionLabel(javax.swing.JLabel statusLabel)
The status label is where the lat/lon position of the mouse is displayed.
|
void |
setProjectionImpl(ProjectionImpl p)
Set the Projection, change the Map Area to the projection's default.
|
void |
setWorldCenterX(double wx_center)
kludgy thing to shift LatLon seam
|
boolean |
wantRotate(double pwidth,
double pheight)
utility routine for printing.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
addAncestorListener, 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, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, 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, validateTree
action, 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, isFocusTraversable, 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, transferFocusUpCycle
public LatLonRect getGeoSelectionLL()
public ProjectionRect getGeoSelection()
public void setGeoSelection(ProjectionRect bb)
public void setGeoSelection(LatLonRect llbb)
public void setGeoSelectionMode(boolean b)
public void addNewMapAreaListener(NewMapAreaListener l)
public void removeNewMapAreaListener(NewMapAreaListener l)
public void addNewProjectionListener(NewProjectionListener l)
public void removeNewProjectionListener(NewProjectionListener l)
public void addCursorMoveEventListener(CursorMoveEventListener l)
public void removeCursorMoveEventListener(CursorMoveEventListener l)
public void addPickEventListener(PickEventListener l)
public void removePickEventListener(PickEventListener l)
public void addGeoSelectionListener(GeoSelectionListener l)
public void removeGeoSelectionListener(GeoSelectionListener l)
public Navigation getNavigation()
public java.awt.Color getBackgroundColor()
public void setMapArea(ProjectionRect ma)
public void setMapArea(LatLonRect llbb)
public ProjectionRect getMapArea()
public LatLonRect getMapAreaLL()
public void setWorldCenterX(double wx_center)
public void setLatLonCenterMapArea(double lat, double lon)
public ProjectionImpl getProjectionImpl()
public void setProjectionImpl(ProjectionImpl p)
public void setPositionLabel(javax.swing.JLabel statusLabel)
statusLabel
- 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 setEnabledActions(boolean b)
public 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.JComponent
public void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
public java.awt.image.BufferedImage getBufferedImage()
public java.awt.Graphics2D getBufferedImageGraphics()
public boolean wantRotate(double pwidth, double pheight)
pwidth
- : widtht 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 corner of display areadisplayY
- upper right corner of display areadisplayWidth
- display areadisplayHeight
- display area
see Navigation.calcTransformpublic void drawG()