|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
com.bbn.openmap.Layer
org.ka2ddo.yaac.gui.drawlayer.DrawLayer
public class DrawLayer
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.
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 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 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 |
---|
public static final java.lang.String DRAW_MOUSE_MODE_NAME
Constructor Detail |
---|
public DrawLayer(MouseDelegator mouseDelegator)
mouseDelegator
- MouseDelegator indicating which mouse mode the MapBean will sendmouse data to this overlayMethod Detail |
---|
public void registerMouseMode(MouseDelegator mouseDelegator)
mouseDelegator
- MouseDelegator handling distribution of mouse events to different map layerspublic MapMouseListener getMapMouseListener()
getMapMouseListener
in class Layer
public java.lang.String[] getMouseModeServiceList()
getMouseModeServiceList
in interface MapMouseListener
public 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 MapMouseListener
public boolean mouseReleased(java.awt.event.MouseEvent mouseEvent)
mouseReleased
in interface MapMouseListener
public boolean mouseClicked(java.awt.event.MouseEvent mouseEvent)
mouseClicked
in interface MapMouseListener
public void mouseEntered(java.awt.event.MouseEvent mouseEvent)
mouseEntered
in interface MapMouseListener
public void mouseExited(java.awt.event.MouseEvent mouseEvent)
mouseExited
in interface MapMouseListener
public boolean mouseDragged(java.awt.event.MouseEvent mouseEvent)
mouseDragged
in interface MapMouseListener
public boolean mouseMoved(java.awt.event.MouseEvent mouseEvent)
mouseMoved
in interface MapMouseListener
public void mouseMoved()
mouseMoved
in interface 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(ProjectionEvent projectionEvent)
Layers are expected to recompute their graphics (if this makes
sense), and then repaint()
themselves.
projectionChanged
in interface ProjectionListener
projectionEvent
- ProjectionEventpublic void paint(java.awt.Graphics g)
paint
in class javax.swing.JComponent
g
- Graphics object to use for renderingpublic DrawMode getMode()
public void setMode(DrawMode mode)
public 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 float getLineWidth()
public void save(java.io.DataOutput dos) throws java.io.IOException
dos
- DataOutput object to write the shapes to
java.io.IOException
- if write fails for any reasonpublic void saveCSV(java.io.PrintStream ps, boolean lonBeforeLat) throws java.io.IOException
ps
- PrintStream to write the CSV records tolonBeforeLat
- ignored
java.io.IOException
- if write fails for any reasonpublic void saveKML(java.io.PrintStream ps) throws java.io.IOException
ps
- PrintStream to write the XML data to
java.io.IOException
- if write fails for any reasonpublic void load(java.io.DataInput din) throws java.io.IOException
din
- DataInput to read the shapes from
java.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 latitude
java.io.IOException
- if read fails for any reason other than end-of-filepublic void loadGPX(NonshareableBufferedDataInputStream din) throws java.io.IOException
din
- DataInput of the GPX file
java.io.IOException
- if the file could not be read for any reasonpublic void loadKML(NonshareableBufferedDataInputStream din) throws java.io.IOException
din
- DataInput of the KML file
java.io.IOException
- if file cannot be read for any reasonpublic void addGraphicList(OMGraphicList gl)
gl
- OMGraphicListpublic void loadDrawing()
public void saveDrawing()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |