Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.ka2ddo.yaac.gui.drawlayer
Class DrawLayer

    java.lang.Object
      java.awt.Component
          java.awt.Container
              javax.swing.JComponent
                  com.bbn.openmap.Layer
                      org.ka2ddo.yaac.gui.drawlayer.DrawLayer

All Implemented Interfaces:
  MapMouseListener, ProjectionListener, ProjectionPainter, PropertyConsumer, java.awt.event.ActionListener, java.awt.event.ComponentListener, java.awt.event.KeyListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.io.Serializable, java.util.EventListener, CommonCustomRendererConstants

    public class DrawLayer

extends Layer
implements MapMouseListener, java.awt.event.KeyListener, java.awt.event.ComponentListener, CommonCustomRendererConstants

This class implements an overlay on the OpenMap map panel that permits the user to draw arbitrary geometrical lines and objects, suitable for marking and highlighting areas of interest on the map. Note that these overlays are completely independent of the information drawn from the OpenStreetMap data sets and from received APRS stations and objects.

See Also:
  Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from class javax.swing.JComponent
`javax.swing.JComponent.AccessibleJComponent`

Nested classes/interfaces inherited from class java.awt.Container
`java.awt.Container.AccessibleAWTContainer`

Nested classes/interfaces inherited from class java.awt.Component
`java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy`

Field Summary
`static java.lang.String` | `DRAW_MOUSE_MODE_NAME` Mouse mode name for this Layer.

Fields inherited from class com.bbn.openmap.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, RedrawCmd, removable, RemovableProperty, SWING_PACKAGE, TransformProperty, 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 org.ka2ddo.yaac.gui.CommonCustomRendererConstants
`BRIGHTER_RED, BRIGHTER_TEXT_BACKGROUND, DARK_GREEN, DARKER_MAGENTA, DARKER_RED, MINUTES_30`

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
`DrawLayer(MouseDelegator mouseDelegator)` Create a DrawLayer for the specified MouseDelegator.

Method Summary
`void` | `addGraphicList(OMGraphicList gl)` load a list of OMGraphic objects into the DrawLayer.
`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.
`float` | `getLineWidth()` Get the width (in pixels) for the line drawing the current shape.
`MapMouseListener` | `getMapMouseListener()` Get the listener to be informed of MapMouseEvents.
`DrawMode` | `getMode()`
`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.
`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(NonshareableBufferedDataInputStream din)` Load a polyline from a GPX file.
`void` | `loadKML(NonshareableBufferedDataInputStream 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(ProjectionEvent projectionEvent)` Invoked when there has been a fundamental change to the Map.
`void` | `registerMouseMode(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 lonBeforeLat)` 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)`
`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.

Methods inherited from class com.bbn.openmap.Layer
`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, 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, setRemovable, setVisible, setWindowSupport, showPalette`

Methods inherited from class javax.swing.JComponent
`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, 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`

Methods inherited from class java.awt.Container
`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, 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, 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, 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`

Field Detail

### DRAW_MOUSE_MODE_NAME

    public static final java.lang.String DRAW_MOUSE_MODE_NAME

  Mouse mode name for this Layer.

  See Also:
    Constant Field Values

Constructor Detail

### DrawLayer

    public DrawLayer(MouseDelegator mouseDelegator)

  Create a DrawLayer for the specified MouseDelegator.

  Parameters:
    `mouseDelegator` - MouseDelegator indicating which mouse mode the MapBean will sendmouse data to this overlay

Method Detail

### registerMouseMode

    public void registerMouseMode(MouseDelegator mouseDelegator)

  Register the drawing mode of this layer with the MouseDelegator.

  Parameters:
    `mouseDelegator` - MouseDelegator handling distribution of mouse events to different map layers

### getMapMouseListener

    public MapMouseListener getMapMouseListener()

  Get the listener to be informed of MapMouseEvents.

  Overrides:
    `getMapMouseListener` in class `Layer`
  Returns:
    MapMouseListener implementaion

### getMouseModeServiceList

    public java.lang.String[] getMouseModeServiceList()

  Get the MapBean mouse modes that this DrawLayer services.

  Specified by:
    `getMouseModeServiceList` in interface `MapMouseListener`
  Returns:
    an array of the mouse modes serviced

### getLineColor

    public java.awt.Color getLineColor()

  Get the current color selected for drawing lines.

  Returns:
    drawing Color

### setLineColor

    public void setLineColor(java.awt.Color lineColor)

  Set the RGB Color for drawing the currently edited shape in the DrawLayer.

  Parameters:
    `lineColor` - Color to drw the current shape with

### getTransparency

    public int getTransparency()

  Get the current transparency (alpha) value for drawing the current shape.

  Returns:
    the int transparency value from 0 (completely transparent and invisible) to 255 (completely opaque)

### setTransparency

    public void setTransparency(int transparency)

  Set the current transparency (alpha) value for drawing the current shape.

  Parameters:
    `transparency` - the int transparency value from 0 (completely transparent and invisible) to 255 (completely opaque)

### mousePressed

    public boolean mousePressed(java.awt.event.MouseEvent mouseEvent)

  Specified by:
    `mousePressed` in interface `MapMouseListener`

### mouseReleased

    public boolean mouseReleased(java.awt.event.MouseEvent mouseEvent)

  Specified by:
    `mouseReleased` in interface `MapMouseListener`

### mouseClicked

    public boolean mouseClicked(java.awt.event.MouseEvent mouseEvent)

  Specified by:
    `mouseClicked` in interface `MapMouseListener`

### mouseEntered

    public void mouseEntered(java.awt.event.MouseEvent mouseEvent)

  Specified by:
    `mouseEntered` in interface `MapMouseListener`

### mouseExited

    public void mouseExited(java.awt.event.MouseEvent mouseEvent)

  Specified by:
    `mouseExited` in interface `MapMouseListener`

### mouseDragged

    public boolean mouseDragged(java.awt.event.MouseEvent mouseEvent)

  Specified by:
    `mouseDragged` in interface `MapMouseListener`

### mouseMoved

    public boolean mouseMoved(java.awt.event.MouseEvent mouseEvent)

  Specified by:
    `mouseMoved` in interface `MapMouseListener`

### mouseMoved

    public void mouseMoved()

  Specified by:
    `mouseMoved` in interface `MapMouseListener`

### keyPressed

    public void keyPressed(java.awt.event.KeyEvent e)

  Invoked when a key has been pressed. See the class description for `KeyEvent` for a definition of a key pressed event.

  Specified by:
    `keyPressed` in interface `java.awt.event.KeyListener`

### keyTyped

    public void keyTyped(java.awt.event.KeyEvent e)

  Invoked when a key has been typed. See the class description for `KeyEvent` for a definition of a key typed event.

  Specified by:
    `keyTyped` in interface `java.awt.event.KeyListener`

### keyReleased

    public void keyReleased(java.awt.event.KeyEvent e)

  Invoked when a key has been released. See the class description for `KeyEvent` for a definition of a key released event.

  Specified by:
    `keyReleased` in interface `java.awt.event.KeyListener`

### componentHidden

    public void componentHidden(java.awt.event.ComponentEvent e)

  Invoked when the component has been made invisible.

  Specified by:
    `componentHidden` in interface `java.awt.event.ComponentListener`

### componentResized

    public void componentResized(java.awt.event.ComponentEvent e)

  Invoked when the component's size changes.

  Specified by:
    `componentResized` in interface `java.awt.event.ComponentListener`

### componentMoved

    public void componentMoved(java.awt.event.ComponentEvent e)

  Invoked when the component's position changes.

  Specified by:
    `componentMoved` in interface `java.awt.event.ComponentListener`

### componentShown

    public void componentShown(java.awt.event.ComponentEvent e)

  Invoked when the component has been made visible.

  Specified by:
    `componentShown` in interface `java.awt.event.ComponentListener`

### projectionChanged

    public void projectionChanged(ProjectionEvent projectionEvent)

  Invoked when there has been a fundamental change to the Map.

  Layers are expected to recompute their graphics (if this makes sense), and then `repaint()` themselves.

  Specified by:
    `projectionChanged` in interface `ProjectionListener`
  Parameters:
    `projectionEvent` - ProjectionEvent

### paint

    public void paint(java.awt.Graphics g)

  Render this layer's content into the MapBean. Note that we reproject on every draw to deal with map pans/zooms/resizes.

  Overrides:
    `paint` in class `javax.swing.JComponent`
  Parameters:
    `g` - Graphics object to use for rendering

### getMode

    public DrawMode getMode()

### setMode

    public void setMode(DrawMode mode)

### setStroke

    public void setStroke(java.awt.BasicStroke s,
                          java.lang.String strokeType)

  Set the line stroke type to be used for the currently edited shape.

  Parameters:
    `s` - BasicStroke of the object
    `strokeType` - name of the generic stroke type

### setLineWidth

    public void setLineWidth(float width)

  Set the width (in pixels) for the line drawing the current shape.

  Parameters:
    `width` - int width in pixels

### getLineWidth

    public float getLineWidth()

  Get the width (in pixels) for the line drawing the current shape.

  Returns:
    int width in pixels

### save

    public void save(java.io.DataOutput dos)
              throws java.io.IOException

  Write the current set of drawn shapes to a save file in binary format.

  Parameters:
    `dos` - DataOutput object to write the shapes to
  Throws:
    `java.io.IOException` - if write fails for any reason

### saveCSV

    public void saveCSV(java.io.PrintStream ps,
                        boolean lonBeforeLat)
                 throws java.io.IOException

  Save all the polylines in the DrawLayer in a CSV file of longitude and latitude tuples (altitude is always reported as zero).

  Parameters:
    `ps` - PrintStream to write the CSV records to
    `lonBeforeLat` - ignored
  Throws:
    `java.io.IOException` - if write fails for any reason

### saveKML

    public void saveKML(java.io.PrintStream ps)
                 throws java.io.IOException

  Save all the polylines currently in the DrawLayer as a KML file.

  Parameters:
    `ps` - PrintStream to write the XML data to
  Throws:
    `java.io.IOException` - if write fails for any reason

### load

    public void load(java.io.DataInput din)
              throws java.io.IOException

  Read one drawable shape from a binary file.

  Parameters:
    `din` - DataInput to read the shapes from
  Throws:
    `java.io.IOException` - if read fails for any reason

### loadCSV

    public void loadCSV(java.io.DataInput din,
                        boolean latBeforeLon)
                 throws java.io.IOException

  Load a polyline from a CSV file (one vertex per line), using the current stroke and color settings.

  Parameters:
    `din` - DataInput to read the CSV records from
    `latBeforeLon` - boolean true if latitude is before longitude in the CSV record, false if longitude before latitude
  Throws:
    `java.io.IOException` - if read fails for any reason other than end-of-file

### loadGPX

    public void loadGPX(NonshareableBufferedDataInputStream din)
                 throws java.io.IOException

  Load a polyline from a GPX file.

  Parameters:
    `din` - DataInput of the GPX file
  Throws:
    `java.io.IOException` - if the file could not be read for any reason

### loadKML

    public void loadKML(NonshareableBufferedDataInputStream din)
                 throws java.io.IOException

  Read polylines from a KML file.

  Parameters:
    `din` - DataInput of the KML file
  Throws:
    `java.io.IOException` - if file cannot be read for any reason

### addGraphicList

    public void addGraphicList(OMGraphicList gl)

  load a list of OMGraphic objects into the DrawLayer.

  Parameters:
    `gl` - OMGraphicList

### loadDrawing

    public void loadDrawing()

  Load drawing overlay.

### saveDrawing

    public void saveDrawing()

  Save drawing overlay.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD