|
|||||||||
| 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 overlay| Method Detail |
|---|
public void registerMouseMode(MouseDelegator mouseDelegator)
mouseDelegator - MouseDelegator handling distribution of mouse events to different map layerspublic MapMouseListener getMapMouseListener()
getMapMouseListener in class Layerpublic java.lang.String[] getMouseModeServiceList()
getMouseModeServiceList in interface MapMouseListenerpublic 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 MapMouseListenerpublic boolean mouseReleased(java.awt.event.MouseEvent mouseEvent)
mouseReleased in interface MapMouseListenerpublic boolean mouseClicked(java.awt.event.MouseEvent mouseEvent)
mouseClicked in interface MapMouseListenerpublic void mouseEntered(java.awt.event.MouseEvent mouseEvent)
mouseEntered in interface MapMouseListenerpublic void mouseExited(java.awt.event.MouseEvent mouseEvent)
mouseExited in interface MapMouseListenerpublic boolean mouseDragged(java.awt.event.MouseEvent mouseEvent)
mouseDragged in interface MapMouseListenerpublic boolean mouseMoved(java.awt.event.MouseEvent mouseEvent)
mouseMoved in interface MapMouseListenerpublic void mouseMoved()
mouseMoved in interface MapMouseListenerpublic void keyPressed(java.awt.event.KeyEvent e)
KeyEvent for a definition of
a key pressed event.
keyPressed in interface java.awt.event.KeyListenerpublic void keyTyped(java.awt.event.KeyEvent e)
KeyEvent for a definition of
a key typed event.
keyTyped in interface java.awt.event.KeyListenerpublic void keyReleased(java.awt.event.KeyEvent e)
KeyEvent for a definition of
a key released event.
keyReleased in interface java.awt.event.KeyListenerpublic void componentHidden(java.awt.event.ComponentEvent e)
componentHidden in interface java.awt.event.ComponentListenerpublic void componentResized(java.awt.event.ComponentEvent e)
componentResized in interface java.awt.event.ComponentListenerpublic void componentMoved(java.awt.event.ComponentEvent e)
componentMoved in interface java.awt.event.ComponentListenerpublic void componentShown(java.awt.event.ComponentEvent e)
componentShown in interface java.awt.event.ComponentListenerpublic void projectionChanged(ProjectionEvent projectionEvent)
Layers are expected to recompute their graphics (if this makes
sense), and then repaint() themselves.
projectionChanged in interface ProjectionListenerprojectionEvent - ProjectionEventpublic void paint(java.awt.Graphics g)
paint in class javax.swing.JComponentg - 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 reason
public 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 reason
public 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 reason
public 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 reason
public 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-file
public 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 reason
public 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 | ||||||||