com.bbn.openmap.gui
Class EmbeddedScaleDisplayPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.bbn.openmap.gui.OMComponentPanel
                      extended by com.bbn.openmap.gui.EmbeddedScaleDisplayPanel
All Implemented Interfaces:
ProjectionListener, LightMapHandlerChild, PropertyConsumer, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class EmbeddedScaleDisplayPanel
extends OMComponentPanel
implements ProjectionListener

A panel that listens for projection changes and draws a little legend line on itself with a distance. Can be modified with Properties.

 
 unitOfMeasure=km (or any value from the Length class)
 locationXoffset=-10 (value off the edge of the component to have legend)
 locationYoffset=-10 
 width=pixel width of component
 height=pixel height of component
 

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
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
protected  DrawingAttributes dAttributes
           
protected  int defaultHeight
           
protected  java.lang.String defaultLineColorString
           
protected  int defaultLocationXoffset
           
protected  int defaultLocationYoffset
           
protected  java.lang.String defaultTextColorString
           
protected  java.lang.String defaultUnitOfMeasureString
           
protected  int defaultWidth
           
protected  int height
           
static java.lang.String HeightProperty
           
protected  OMGraphicList legend
           
protected  int locationXoffset
           
static java.lang.String LocationXOffsetProperty
           
protected  int locationYoffset
           
static java.lang.String LocationYOffsetProperty
           
static java.util.logging.Logger logger
           
protected  MapBean mapBean
           
static java.lang.String UnitOfMeasureProperty
           
protected  Length uom
           
protected  int width
           
static java.lang.String WidthProperty
           
 
Fields inherited from class com.bbn.openmap.gui.OMComponentPanel
beanContextChildSupport, i18n, isolated, orientation, propertyPrefix, 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 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
EmbeddedScaleDisplayPanel()
           
EmbeddedScaleDisplayPanel(DrawingAttributes dAtts, Length units)
           
 
Method Summary
 void findAndInit(java.lang.Object someObj)
           
 void findAndUndo(java.lang.Object someObj)
           
 java.awt.Component getGUI()
          Creates the interface palette.
 OMGraphicList getLegend()
           
protected  int getPtAtDistanceFromLatLon(LatLonPoint loc2, double unitDist, Projection projection, Length uom)
           
 java.lang.String getUnitOfMeasure()
          Getter for property unitOfMeasure.
 void paint(java.awt.Graphics g)
           
 void projectionChanged(ProjectionEvent e)
          Invoked when there has been a fundamental change to the Map.
protected  double scopeDistance(double dist)
          Take a given distance and round it down to the nearest 1, 2, or 5 (or tens/hundreds version of those increments) multiple of that number.
 void setLegend(OMGraphicList legend)
           
 void setProperties(java.lang.String prefix, java.util.Properties properties)
          Sets the properties for the Layer.
 void setUnitOfMeasure(java.lang.String unitOfMeasure)
          Setter for property unitOfMeasure.
 
Methods inherited from class com.bbn.openmap.gui.OMComponentPanel
addVetoableChangeListener, childrenAdded, childrenRemoved, findAndInit, fireVetoableChange, getBeanContext, getOrientation, getProperties, getPropertyInfo, getPropertyPrefix, getWindowSupport, isIsolated, removeVetoableChangeListener, setBeanContext, setIsolated, setOrientation, setProperties, setPropertyPrefix, setWindowSupport
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, 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, setVisible, unregisterKeyboardAction, update
 
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, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, 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, removeComponentListener, 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, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.beans.beancontext.BeanContextChild
addPropertyChangeListener, removePropertyChangeListener
 

Field Detail

defaultLineColorString

protected java.lang.String defaultLineColorString

defaultTextColorString

protected java.lang.String defaultTextColorString

defaultUnitOfMeasureString

protected java.lang.String defaultUnitOfMeasureString

defaultLocationXoffset

protected int defaultLocationXoffset

defaultLocationYoffset

protected int defaultLocationYoffset

defaultWidth

protected int defaultWidth

defaultHeight

protected int defaultHeight

UnitOfMeasureProperty

public static final java.lang.String UnitOfMeasureProperty
See Also:
Constant Field Values

LocationXOffsetProperty

public static final java.lang.String LocationXOffsetProperty
See Also:
Constant Field Values

LocationYOffsetProperty

public static final java.lang.String LocationYOffsetProperty
See Also:
Constant Field Values

WidthProperty

public static final java.lang.String WidthProperty
See Also:
Constant Field Values

HeightProperty

public static final java.lang.String HeightProperty
See Also:
Constant Field Values

uom

protected Length uom

locationXoffset

protected int locationXoffset

locationYoffset

protected int locationYoffset

width

protected int width

height

protected int height

dAttributes

protected DrawingAttributes dAttributes

legend

protected OMGraphicList legend

logger

public static java.util.logging.Logger logger

mapBean

protected MapBean mapBean
Constructor Detail

EmbeddedScaleDisplayPanel

public EmbeddedScaleDisplayPanel()

EmbeddedScaleDisplayPanel

public EmbeddedScaleDisplayPanel(DrawingAttributes dAtts,
                                 Length units)
Method Detail

setProperties

public void setProperties(java.lang.String prefix,
                          java.util.Properties properties)
Sets the properties for the Layer. This allows Layer s to get a richer set of parameters than the setArgs method.

Specified by:
setProperties in interface PropertyConsumer
Overrides:
setProperties in class OMComponentPanel
Parameters:
prefix - the token to prefix the property names
properties - the Properties object

getUnitOfMeasure

public java.lang.String getUnitOfMeasure()
Getter for property unitOfMeasure.

Returns:
Value of property unitOfMeasure.

setUnitOfMeasure

public void setUnitOfMeasure(java.lang.String unitOfMeasure)
Setter for property unitOfMeasure.

Parameters:
unitOfMeasure - New value of property unitOfMeasure.

getGUI

public java.awt.Component getGUI()
Creates the interface palette.


projectionChanged

public void projectionChanged(ProjectionEvent e)
Description copied from interface: ProjectionListener
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:
e - ProjectionEvent

getPtAtDistanceFromLatLon

protected int getPtAtDistanceFromLatLon(LatLonPoint loc2,
                                        double unitDist,
                                        Projection projection,
                                        Length uom)

scopeDistance

protected double scopeDistance(double dist)
Take a given distance and round it down to the nearest 1, 2, or 5 (or tens/hundreds version of those increments) multiple of that number.

Parameters:
dist -
Returns:
scoped value of distance, incremented properly

getLegend

public OMGraphicList getLegend()

setLegend

public void setLegend(OMGraphicList legend)

paint

public void paint(java.awt.Graphics g)
Overrides:
paint in class javax.swing.JComponent

findAndInit

public void findAndInit(java.lang.Object someObj)
Specified by:
findAndInit in interface LightMapHandlerChild
Overrides:
findAndInit in class OMComponentPanel

findAndUndo

public void findAndUndo(java.lang.Object someObj)
Specified by:
findAndUndo in interface LightMapHandlerChild
Overrides:
findAndUndo in class OMComponentPanel


Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details