public class TestLayer extends OMGraphicHandlerLayer implements MapMouseListener
This layer responds to the following properties:
In addition, you can get this layer to work with the
OpenMap viewer by editing your openmap.properties file:
# initial visibility settings:
test.line.visible=true
test.circ.visible=true
test.rect.visible=true
test.text.visible=true
test.poly.visible=true
# latlon vertices of the poly
#test.poly.vertices=80 -180 80 -90 80 0 80 90 80 180 70 180 70 90 70 0 70 -90 70 -180
# layers
openmap.layers=test ...
# class
test.class=com.bbn.openmap.layer.TestLayer
# name
test.prettyName=Graticule
Modifier and Type | Class and Description |
---|---|
protected class |
TestLayer.Circle |
protected class |
TestLayer.GraphicBase |
protected class |
TestLayer.Line |
protected class |
TestLayer.Poly |
protected class |
TestLayer.Rect |
protected class |
TestLayer.Text |
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
protected TestLayer.Circle |
circle |
static java.lang.String |
CircVisibleProperty |
protected static java.lang.String[] |
colorNames |
protected static java.awt.Color[] |
colors |
protected javax.swing.JPanel |
gui |
protected TestLayer.Line |
line |
static java.lang.String |
LineVisibleProperty |
protected static int |
NCOLORS |
protected OMCircle |
omcircle |
protected OMLine |
omline |
protected OMPoly |
ompoly |
protected OMRect |
omrect |
protected OMText |
omtext |
protected TestLayer.Poly |
poly |
static java.lang.String |
PolyVertsProperty |
static java.lang.String |
PolyVisibleProperty |
protected TestLayer.Rect |
rect |
static java.lang.String |
RectVisibleProperty |
protected TestLayer.Text |
text |
static java.lang.String |
TextVisibleProperty |
consumeEvents, ConsumeEventsProperty, filter, interruptable, InterruptableProperty, layerWorker, LAYERWORKER_LOCK, layerWorkerQueue, logger, mouseEventInterpreter, mouseModeIDs, MouseModesProperty, projectionChangePolicy, ProjectionChangePolicyProperty, renderPolicy, RenderPolicyProperty, selectedList, TransparencyProperty
addAsBackground, AddAsBackgroundProperty, addToBeanContext, AddToBeanContextProperty, attributes, autoPalette, AutoPaletteProperty, beanContextChildSupport, coordTransform, DataPathPrefixProperty, DisplayPaletteCmd, DisplayPropertiesCmd, doHack, HidePaletteCmd, i18n, localHackList, maxScale, MaxScaleProperty, minScale, MinScaleProperty, palette, paletteListener, PrettyNameProperty, propertyPrefix, RedrawCmd, removable, RemovableProperty, SWING_PACKAGE, TransformProperty, windowSupport
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty
Constructor and Description |
---|
TestLayer()
Construct the TestLayer.
|
Modifier and Type | Method and Description |
---|---|
protected OMGraphicList |
generateGraphics()
Create and project the graphics.
|
protected javax.swing.JPanel |
getGraphicPalette(TestLayer.GraphicBase obj,
java.lang.String title)
Create the sub-palette for a particular graphic type.
|
java.awt.Component |
getGUI()
Gets the palette associated with the layer.
|
MapMouseListener |
getMapMouseListener()
Returns self as the
MapMouseListener in order to
receive MapMouseEvent s. |
java.lang.String[] |
getMouseModeServiceList()
Return a list of the modes that are interesting to the
MapMouseListener.
|
boolean |
mouseClicked(java.awt.event.MouseEvent e)
Invoked when the mouse has been clicked on a component.
|
boolean |
mouseDragged(java.awt.event.MouseEvent e)
Invoked when a mouse button is pressed on a component and then
dragged.
|
void |
mouseEntered(java.awt.event.MouseEvent e)
Invoked when the mouse enters a component.
|
void |
mouseExited(java.awt.event.MouseEvent e)
Invoked when the mouse exits a component.
|
void |
mouseMoved()
Handle a mouse cursor moving without the button being pressed.
|
boolean |
mouseMoved(java.awt.event.MouseEvent e)
Invoked when the mouse button has been moved on a component
(with no buttons no down).
|
boolean |
mousePressed(java.awt.event.MouseEvent e)
Invoked when a mouse button has been pressed on a component.
|
boolean |
mouseReleased(java.awt.event.MouseEvent e)
Invoked when a mouse button has been released on a component.
|
OMGraphicList |
prepare()
This is the main method you should be concerned with when overriding this
class.
|
void |
setProperties(java.lang.String prefix,
java.util.Properties properties)
The properties and prefix are managed and decoded here, for the
standard uses of the GraticuleLayer.
|
actionPerformed, canSetList, copy, createLayerWorker, cut, deselect, dispose, doAction, doPrepare, filter, filter, filter, getConsumeEvents, getFilter, getInfoText, getItemsForMapMenu, getItemsForOMGraphicMenu, getLayerWorker, getList, getMouseEventInterpreter, getMouseModeIDsForEvents, getProjectionChangePolicy, getProperties, getPropertyInfo, getRenderPolicy, getSelected, getToolTipTextFor, getTransparency, getTransparencyAdjustmentPanel, highlight, interrupt, isCancelled, isHighlightable, isInterruptable, isSelectable, isWorking, leftClick, mouseOver, paint, paste, projectionChanged, receivesMapEvents, renderDataForProjection, resetFiltering, select, setCancelled, setConsumeEvents, setFilter, setInterruptable, setLayerWorker, setList, setMouseEventInterpreter, setMouseModeIDsForEvents, setProjectionChangePolicy, setRenderPolicy, setTransparency, supportsSQL, unhighlight, workerComplete
addComponentListener, added, addInfoDisplayListener, addLayerStatusListener, addMouseListener, addVetoableChangeListener, childrenAdded, childrenRemoved, clearListeners, connectToBeanContext, createWindowSupport, disconnectFromBeanContext, finalize, findAndInit, findAndInit, findAndUndo, fireHideToolTip, firePaletteEvent, fireRequestBrowserContent, fireRequestBrowserContent, fireRequestCursor, fireRequestInfoLine, fireRequestInfoLine, fireRequestInfoLine, fireRequestMessage, fireRequestMessage, fireRequestToolTip, fireRequestToolTip, fireRequestURL, fireRequestURL, fireStatusUpdate, fireStatusUpdate, fireVetoableChange, getAddAsBackground, getAddToBeanContext, getAttribute, getBeanContext, getCoordTransform, getIcon, getMaxScale, getMinScale, getPackage, getPalette, getProjection, getPropertyPrefix, getWindowSupport, hasGUI, hidePalette, isAutoPalette, isProjectionOK, isRemovable, notifyHideHack, prependDataPathPrefix, putAttribute, removeComponentListener, removeConfirmed, removed, removeInfoDisplayListener, removeLayerStatusListener, removeVetoableChangeListener, repaint, resetPalette, setAddAsBackground, setAddToBeanContext, setAutoPalette, setBeanContext, setCoordTransform, setIcon, setLayerProperties, setMaxScale, setMinScale, setName, setPaletteVisible, setProjection, setProjection, setProperties, setPropertyPrefix, setRemovable, setVisible, setWindowSupport, showPalette
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, 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, unregisterKeyboardAction, update, updateUI
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, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, 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, hide, 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, 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, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final transient java.lang.String LineVisibleProperty
public static final transient java.lang.String CircVisibleProperty
public static final transient java.lang.String RectVisibleProperty
public static final transient java.lang.String TextVisibleProperty
public static final transient java.lang.String PolyVisibleProperty
public static final transient java.lang.String PolyVertsProperty
protected static final transient java.lang.String[] colorNames
protected static final transient java.awt.Color[] colors
protected static final transient int NCOLORS
protected OMCircle omcircle
protected TestLayer.Circle circle
protected OMLine omline
protected TestLayer.Line line
protected OMRect omrect
protected TestLayer.Rect rect
protected OMText omtext
protected TestLayer.Text text
protected OMPoly ompoly
protected TestLayer.Poly poly
protected javax.swing.JPanel gui
public void setProperties(java.lang.String prefix, java.util.Properties properties)
setProperties
in interface PropertyConsumer
setProperties
in class OMGraphicHandlerLayer
prefix
- string prefix used in the properties file for
this layer.properties
- the properties set in the properties file.public OMGraphicList prepare()
OMGraphicHandlerLayer
This method will be called in a separate thread if doPrepare() is called on the layer. This will automatically cause repaint() to be called, which lets java know to call paint() on this class.
Note that the default action of this method is to get the OMGraphicList as it is currently set in the layer, re-projects the list with the current projection (calls generate() on them), and then returns the current list.
If your layer needs to change what is on the list based on what the current projection is, you can either clear() the list yourself and add new OMGraphics to it (remember to call generate(Projection) on them), and return the list. You also have the option of setting a ListResetPCPolicy, which will automatically set the list to null when the projection changes before calling this method. The OMGraphicHandlerList will ignore a null OMGraphicList.
NOTE: If you call prepare directly, you may need to call repaint(), too. With all invocations of this method that are cause by a projection change, repaint() will be called for you. The method is synchronized in case renderDataForProjection() gets called while in the middle of this method. For a different projection, that would be bad.
prepare
in class OMGraphicHandlerLayer
protected OMGraphicList generateGraphics()
public java.awt.Component getGUI()
protected javax.swing.JPanel getGraphicPalette(TestLayer.GraphicBase obj, java.lang.String title)
obj
- GraphicObjtitle
- panel titlepublic MapMouseListener getMapMouseListener()
MapMouseListener
in order to
receive MapMouseEvent
s. If the implementation
would prefer to delegate MapMouseEvent
s, it
could return the delegate from this method instead.getMapMouseListener
in class OMGraphicHandlerLayer
public java.lang.String[] getMouseModeServiceList()
return new String[1] { SelectMouseMode.modeID };
getMouseModeServiceList
in interface MapMouseListener
NavMouseMode.modeID
,
SelectMouseMode.modeID
,
NullMouseMode.modeID
public boolean mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface MapMouseListener
e
- MouseEventpublic boolean mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface MapMouseListener
e
- MouseEventpublic boolean mouseClicked(java.awt.event.MouseEvent e)
mousePressed()
, or if no other listener
processes the event. If the listener successfully processes
mouseClicked(), then it will receive the next mouseClicked()
notifications that have a click count greater than one.mouseClicked
in interface MapMouseListener
e
- MouseListener MouseEvent to handle.public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface MapMouseListener
e
- MouseListener MouseEvent to handle.public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface MapMouseListener
e
- MouseListener MouseEvent to handle.public boolean mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface MapMouseListener
e
- MouseMotionListener MouseEvent to handle.public boolean mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface MapMouseListener
e
- MouseListener MouseEvent to handle.public void mouseMoved()
mouseMoved
in interface MapMouseListener
Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details