public class DrawLayer extends com.bbn.openmap.Layer implements com.bbn.openmap.event.MapMouseListener, java.awt.event.KeyListener, java.awt.event.ComponentListener, MouseWheelCanZoomMap
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DRAW_MOUSE_MODE_NAME
Mouse mode name for this Layer.
|
addAsBackground, AddAsBackgroundProperty, addToBeanContext, AddToBeanContextProperty, attributes, autoPalette, AutoPaletteProperty, beanContextChildSupport, coordTransform, DataPathPrefixProperty, DisplayPaletteCmd, DisplayPropertiesCmd, doHack, HidePaletteCmd, i18n, localHackList, maxScale, MaxScaleProperty, minScale, MinScaleProperty, palette, paletteListener, PrettyNameProperty, propertyPrefix, readyToPaint, RedrawCmd, removable, RemovableProperty, SWING_PACKAGE, TransformProperty, windowSupport
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Constructor and Description |
---|
DrawLayer(GeographicalMap geoMap,
com.bbn.openmap.MouseDelegator mouseDelegator)
Create a DrawLayer for the specified MouseDelegator.
|
Modifier and Type | Method and Description |
---|---|
void |
addDrawable(AbstractDrawable drawable)
Add another drawable to the draw layer.
|
void |
addGraphicList(com.bbn.openmap.omGraphics.OMGraphicList gl)
load a list of OMGraphic objects into the DrawLayer.
|
void |
clearSelectedDrawable()
Unselects any drawable in the DrawLayer that was selected by the SELECT mode.
|
void |
componentHidden(java.awt.event.ComponentEvent e)
Invoked when the component has been made invisible.
|
void |
componentMoved(java.awt.event.ComponentEvent e)
Invoked when the component's position changes.
|
void |
componentResized(java.awt.event.ComponentEvent e)
Invoked when the component's size changes.
|
void |
componentShown(java.awt.event.ComponentEvent e)
Invoked when the component has been made visible.
|
java.awt.Color |
getLineColor()
Get the current color selected for drawing lines.
|
java.awt.BasicStroke |
getlineStroke1Pixel()
Get the one-pixel wide style of the line stroke.
|
java.lang.String |
getLineStrokeType()
Get the descriptive name of the current line stroke type.
|
float |
getLineWidth()
Get the width (in pixels) for the line drawing the current shape.
|
com.bbn.openmap.event.MapMouseListener |
getMapMouseListener()
Get the listener to be informed of MapMouseEvents.
|
DrawMode |
getMode()
Get the current drawing mode of the DrawLayer.
|
java.lang.String[] |
getMouseModeServiceList()
Get the MapBean mouse modes that this DrawLayer services.
|
int |
getTransparency()
Get the current transparency (alpha) value for drawing the current shape.
|
boolean |
isMouseWheelZooming()
Test whether this map or Layer will zoom the map if the mouse wheel is adjusted.
|
void |
keyPressed(java.awt.event.KeyEvent e)
Invoked when a key has been pressed.
|
void |
keyReleased(java.awt.event.KeyEvent e)
Invoked when a key has been released.
|
void |
keyTyped(java.awt.event.KeyEvent e)
Invoked when a key has been typed.
|
void |
load(java.io.DataInput din)
Read one drawable shape from a binary file.
|
void |
loadCSV(java.io.DataInput din,
boolean latBeforeLon)
Load a polyline from a CSV file (one vertex per line), using the current stroke and color settings.
|
void |
loadDrawing()
Load drawing overlay.
|
void |
loadGPX(java.io.InputStream din)
Load a polyline from a GPX file.
|
void |
loadKML(java.io.InputStream din)
Read polylines from a KML file.
|
boolean |
mouseClicked(java.awt.event.MouseEvent mouseEvent) |
boolean |
mouseDragged(java.awt.event.MouseEvent mouseEvent) |
void |
mouseEntered(java.awt.event.MouseEvent mouseEvent) |
void |
mouseExited(java.awt.event.MouseEvent mouseEvent) |
void |
mouseMoved() |
boolean |
mouseMoved(java.awt.event.MouseEvent mouseEvent) |
boolean |
mousePressed(java.awt.event.MouseEvent mouseEvent) |
boolean |
mouseReleased(java.awt.event.MouseEvent mouseEvent) |
void |
paint(java.awt.Graphics g)
Render this layer's content into the MapBean.
|
void |
projectionChanged(com.bbn.openmap.event.ProjectionEvent projectionEvent)
Invoked when there has been a fundamental change to the Map.
|
void |
registerMouseMode(com.bbn.openmap.MouseDelegator mouseDelegator)
Register the drawing mode of this layer with the MouseDelegator.
|
void |
save(java.io.DataOutput dos)
Write the current set of drawn shapes to a save file in binary format.
|
void |
saveCSV(java.io.PrintStream ps,
boolean latBeforeLon)
Save all the polylines in the DrawLayer in a CSV file of longitude and latitude tuples (altitude is always reported as zero).
|
void |
saveDrawing()
Save drawing overlay.
|
void |
saveKML(java.io.PrintStream ps)
Save all the polylines currently in the DrawLayer as a KML file.
|
void |
setLineColor(java.awt.Color lineColor)
Set the RGB Color for drawing the currently edited shape in the DrawLayer.
|
void |
setLineWidth(float width)
Set the width (in pixels) for the line drawing the current shape.
|
void |
setMode(DrawMode mode)
Set the current drawing mode of the DrawLayer.
|
void |
setMouseWheelZooming(boolean zoomEnabled)
Specify whether this map or Layer will zoom the map if the mouse wheel is adjusted.
|
void |
setStroke(java.awt.BasicStroke s,
java.lang.String strokeType)
Set the line stroke type to be used for the currently edited shape.
|
void |
setTransparency(int transparency)
Set the current transparency (alpha) value for drawing the current shape.
|
actionPerformed, addComponentListener, added, addInfoDisplayListener, addLayerStatusListener, addMouseListener, addVetoableChangeListener, childrenAdded, childrenRemoved, clearListeners, connectToBeanContext, createWindowSupport, disconnectFromBeanContext, dispose, 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, getGUI, getIcon, getMaxScale, getMinScale, getPackage, getPalette, getProjection, getProperties, getPropertyInfo, getPropertyPrefix, getWindowSupport, hasGUI, hidePalette, isAutoPalette, isProjectionOK, isReadyToPaint, isRemovable, notifyHideHack, prependDataPathPrefix, putAttribute, removeComponentListener, removeConfirmed, removed, removeInfoDisplayListener, removeLayerStatusListener, removeVetoableChangeListener, renderDataForProjection, repaint, resetPalette, setAddAsBackground, setAddToBeanContext, setAutoPalette, setBeanContext, setCoordTransform, setIcon, setLayerProperties, setMaxScale, setMinScale, setName, setPaletteVisible, setProjection, setProjection, setProperties, setProperties, setPropertyPrefix, setReadyToPaint, setRemovable, setVisible, setWindowSupport, showPalette
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, 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, hide, 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, getAccessibleContext, 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, 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 java.lang.String DRAW_MOUSE_MODE_NAME
public DrawLayer(GeographicalMap geoMap, com.bbn.openmap.MouseDelegator mouseDelegator)
geoMap
- GeographicalMap containing this DrawLayermouseDelegator
- MouseDelegator indicating which mouse mode the MapBean will sendmouse data to this overlaypublic void registerMouseMode(com.bbn.openmap.MouseDelegator mouseDelegator)
mouseDelegator
- MouseDelegator handling distribution of mouse events to different map layerspublic com.bbn.openmap.event.MapMouseListener getMapMouseListener()
getMapMouseListener
in class com.bbn.openmap.Layer
public java.lang.String[] getMouseModeServiceList()
getMouseModeServiceList
in interface com.bbn.openmap.event.MapMouseListener
public boolean isMouseWheelZooming()
isMouseWheelZooming
in interface MouseWheelCanZoomMap
public void setMouseWheelZooming(boolean zoomEnabled)
setMouseWheelZooming
in interface MouseWheelCanZoomMap
zoomEnabled
- boolean true if mouse wheel motion zooms the mappublic java.awt.Color getLineColor()
public void setLineColor(java.awt.Color lineColor)
lineColor
- Color to drw the current shape withpublic int getTransparency()
public void setTransparency(int transparency)
transparency
- the int transparency value from 0 (completely transparent and invisible) to 255 (completely opaque)public boolean mousePressed(java.awt.event.MouseEvent mouseEvent)
mousePressed
in interface com.bbn.openmap.event.MapMouseListener
public boolean mouseReleased(java.awt.event.MouseEvent mouseEvent)
mouseReleased
in interface com.bbn.openmap.event.MapMouseListener
public boolean mouseClicked(java.awt.event.MouseEvent mouseEvent)
mouseClicked
in interface com.bbn.openmap.event.MapMouseListener
public void mouseEntered(java.awt.event.MouseEvent mouseEvent)
mouseEntered
in interface com.bbn.openmap.event.MapMouseListener
public void mouseExited(java.awt.event.MouseEvent mouseEvent)
mouseExited
in interface com.bbn.openmap.event.MapMouseListener
public boolean mouseDragged(java.awt.event.MouseEvent mouseEvent)
mouseDragged
in interface com.bbn.openmap.event.MapMouseListener
public boolean mouseMoved(java.awt.event.MouseEvent mouseEvent)
mouseMoved
in interface com.bbn.openmap.event.MapMouseListener
public void mouseMoved()
mouseMoved
in interface com.bbn.openmap.event.MapMouseListener
public void keyPressed(java.awt.event.KeyEvent e)
KeyEvent
for a definition of
a key pressed event.keyPressed
in interface java.awt.event.KeyListener
public void keyTyped(java.awt.event.KeyEvent e)
KeyEvent
for a definition of
a key typed event.keyTyped
in interface java.awt.event.KeyListener
public void keyReleased(java.awt.event.KeyEvent e)
KeyEvent
for a definition of
a key released event.keyReleased
in interface java.awt.event.KeyListener
public void componentHidden(java.awt.event.ComponentEvent e)
componentHidden
in interface java.awt.event.ComponentListener
public void componentResized(java.awt.event.ComponentEvent e)
componentResized
in interface java.awt.event.ComponentListener
public void componentMoved(java.awt.event.ComponentEvent e)
componentMoved
in interface java.awt.event.ComponentListener
public void componentShown(java.awt.event.ComponentEvent e)
componentShown
in interface java.awt.event.ComponentListener
public void projectionChanged(com.bbn.openmap.event.ProjectionEvent projectionEvent)
Layers are expected to recompute their graphics (if this makes
sense), and then repaint()
themselves.
projectionChanged
in interface com.bbn.openmap.event.ProjectionListener
projectionEvent
- ProjectionEventpublic void paint(java.awt.Graphics g)
paint
in class javax.swing.JComponent
g
- Graphics object to use for renderingpublic void clearSelectedDrawable()
public DrawMode getMode()
public void setMode(DrawMode mode)
mode
- DrawMode to usepublic void addDrawable(AbstractDrawable drawable)
drawable
- AbstractDrawable instance to addpublic void setStroke(java.awt.BasicStroke s, java.lang.String strokeType)
s
- BasicStroke of the objectstrokeType
- name of the generic stroke typepublic void setLineWidth(float width)
width
- int width in pixelspublic java.awt.BasicStroke getlineStroke1Pixel()
public java.lang.String getLineStrokeType()
public float getLineWidth()
public void save(java.io.DataOutput dos) throws java.io.IOException
dos
- DataOutput object to write the shapes tojava.io.IOException
- if write fails for any reasonpublic void saveCSV(java.io.PrintStream ps, boolean latBeforeLon)
ps
- PrintStream to write the CSV records tolatBeforeLon
- boolean true if latitude in first column and longitude in second,
false if longitude first and then latitudepublic void saveKML(java.io.PrintStream ps)
ps
- PrintStream to write the XML data topublic void load(java.io.DataInput din) throws java.io.IOException
din
- DataInput to read the shapes fromjava.io.IOException
- if read fails for any reasonpublic void loadCSV(java.io.DataInput din, boolean latBeforeLon) throws java.io.IOException
din
- DataInput to read the CSV records fromlatBeforeLon
- boolean true if latitude is before longitude in the CSV record, false if longitude before latitudejava.io.IOException
- if read fails for any reason other than end-of-filepublic void loadGPX(java.io.InputStream din) throws java.io.IOException
din
- DataInput of the GPX filejava.io.IOException
- if the file could not be read for any reasonpublic void loadKML(java.io.InputStream din) throws java.io.IOException
din
- DataInput of the KML filejava.io.IOException
- if file cannot be read for any reasonpublic void addGraphicList(com.bbn.openmap.omGraphics.OMGraphicList gl)
gl
- OMGraphicListpublic void loadDrawing()
public void saveDrawing()