|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--javax.swing.JComponent
|
+--com.bbn.openmap.Layer
|
+--com.bbn.openmap.examples.crew.RouteLayer
A sample Layer implementation. It demonstrates how to write a Layer that can be added to the MapBean.
The key elements are the paint and
projectionChanged methods.
paint renders the Layer on the map.
projectionChanged is called whenever the map's
projection changes. The Layer should update its internal state to
reflect the new map view. This may mean acquiring new data from a
data source, such as a database, or it may be as simple as
re-projecting existing graphics. The RouteLayer does
the latter. A Layer that simply displays a legend on top of the map
might not do anything in the projectionChanged
method since its display may be independent of the current
projection.
| Field Summary |
| Fields inherited from class com.bbn.openmap.Layer |
addAsBackground, AddAsBackgroundProperty, addToBeanContext, AddToBeanContextProperty, autoPalette, AutoPaletteProperty, beanContextChildSupport, DisplayPaletteCmd, DisplayPropertiesCmd, doHack, HidePaletteCmd, i18n, IDListeners, localHackList, lsListeners, palette, paletteListener, PrettyNameProperty, propertyPrefix, RedrawCmd, removable, RemovableProperty, RemoveableProperty, SWING_PACKAGE, windowSupport |
| Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface com.bbn.openmap.PropertyConsumer |
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
RouteLayer()
Construct a default route layer. |
|
| Method Summary | |
OMGraphicList |
createGraphics(OMGraphicList graphics)
Clears and then fills the given OMGraphicList. |
OMLine |
createLine(float lat1,
float lng1,
float lat2,
float lng2,
int lineType,
java.awt.Color color,
java.awt.Color selColor)
Creates an OMLine from the given parameters. |
MapMouseListener |
getMapMouseListener()
Returns self as the MapMouseListener in order to
receive MapMouseEvents. |
java.lang.String[] |
getMouseModeServiceList()
Indicates which mouse modes should send events to this Layer. |
boolean |
mouseClicked(java.awt.event.MouseEvent e)
Called whenever the mouse is clicked by the user and one of the requested mouse modes is active. |
boolean |
mouseDragged(java.awt.event.MouseEvent e)
Called whenever the mouse is dragged on this layer and one of the requested mouse modes is active. |
void |
mouseEntered(java.awt.event.MouseEvent e)
Called whenever the mouse enters this layer and one of the requested mouse modes is active. |
void |
mouseExited(java.awt.event.MouseEvent e)
Called whenever the mouse exits this layer and one of the requested mouse modes is active. |
void |
mouseMoved()
Called whenever the mouse is moved on this layer and one of the requested mouse modes is active, and the gesture is consumed by another active layer. |
boolean |
mouseMoved(java.awt.event.MouseEvent e)
Called whenever the mouse is moved on this layer and one of the requested mouse modes is active. |
boolean |
mousePressed(java.awt.event.MouseEvent e)
Called whenever the mouse is pressed by the user and one of the requested mouse modes is active. |
boolean |
mouseReleased(java.awt.event.MouseEvent e)
Called whenever the mouse is released by the user and one of the requested mouse modes is active. |
void |
paint(java.awt.Graphics g)
Renders the graphics list. |
void |
projectionChanged(ProjectionEvent e)
Handler for ProjectionEvents. |
| Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update, updateUI |
| Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
action, add, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.beans.beancontext.BeanContextChild |
addPropertyChangeListener, removePropertyChangeListener |
| Constructor Detail |
public RouteLayer()
| Method Detail |
public OMLine createLine(float lat1,
float lng1,
float lat2,
float lng2,
int lineType,
java.awt.Color color,
java.awt.Color selColor)
lat1 - The line's starting latitudelng1 - The line's starting longitudelat2 - The line's ending latitudelng2 - The line's ending longitudelineType - The line's typecolor - The line's colorselColor - The line's selected color
public OMGraphicList createGraphics(OMGraphicList graphics)
graphics - The OMGraphicList to clear and populate
public void paint(java.awt.Graphics g)
paint in class javax.swing.JComponentpublic MapMouseListener getMapMouseListener()
MapMouseListener in order to
receive MapMouseEvents. If the implementation
would prefer to delegate MapMouseEvents, it
could return the delegate from this method instead.
getMapMouseListener in class LayerMapMouseEvent s or
null if this layer isn't interested in
MapMouseEvent spublic void projectionChanged(ProjectionEvent e)
ProjectionEvents. This function is
invoked when the MapBean projection changes. The
projection is stored, the graphics are reprojected and the
Layer is repainted.
It is important to store a Projection and not the given
Projection since the Projection
given is the actual
MapBean Projection. This will
ensure that no other objects will be able to manipulate the
Projection held by this Layer.
projectionChanged in interface ProjectionListenere - the projection eventpublic java.lang.String[] getMouseModeServiceList()
Layer.
getMouseModeServiceList in interface MapMouseListenerMapMouseListener,
MouseDelegatorpublic boolean mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface MapMouseListenere - the press event
getMouseModeServiceList()public boolean mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface MapMouseListenere - the release event
getMouseModeServiceList()public boolean mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface MapMouseListenere - the click event
getMouseModeServiceList()public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered in interface MapMouseListenere - the enter eventgetMouseModeServiceList()public void mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface MapMouseListenere - the exit eventgetMouseModeServiceList()public boolean mouseDragged(java.awt.event.MouseEvent e)
mouseDragged in interface MapMouseListenere - the drag event
getMouseModeServiceList()public boolean mouseMoved(java.awt.event.MouseEvent e)
Tries to locate a graphic near the mouse, and if it is found, it is highlighted and the Layer is repainted to show the highlighting.
mouseMoved in interface MapMouseListenere - the move event
getMouseModeServiceList()public void mouseMoved()
mouseMoved in interface MapMouseListenergetMouseModeServiceList()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||