com.bbn.openmap.layer
Class ScaleDisplayLayer

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--com.bbn.openmap.Layer
                          |
                          +--com.bbn.openmap.layer.OMGraphicHandlerLayer
                                |
                                +--com.bbn.openmap.layer.ScaleDisplayLayer
All Implemented Interfaces:
java.awt.event.ActionListener, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.util.EventListener, GestureResponsePolicy, java.awt.image.ImageObserver, java.awt.MenuContainer, ProjectionListener, ProjectionPainter, PropertyConsumer, java.io.Serializable

public class ScaleDisplayLayer
extends OMGraphicHandlerLayer

Layer objects are components which can be added to the MapBean to make a map.

Layers implement the ProjectionListener interface to listen for ProjectionEvents. When the projection changes, they may need to refetch, regenerate their graphics, and then repaint themselves into the new view.

### Layer used by the overview handler
scaleLayer.class=com.rolands.jtlsweb.map.layer.ScaleDisplayLayer
scaleLayer.prettyName=Scale
scaleLayer.lineColor=ff777777
scaleLayer.textColor=ff000000
scaleLayer.unitOfMeasure=nm
scaleLayer.locationXoffset=-10
scaleLayer.locationYoffset=-20
scaleLayer.width=150
scaleLayer.height=10

unitOfMeasure - any com.bbn.openmap.proj.Length instance returned by Length.get(string).
locationXoffset - offset in pixels from left/right, positive from left edge, negative from right edge
locationYoffset - offset in pixels from top/bottom, positive from top edge, negative from bottom edge
width - width of scale indidator bar in pixels
height - height of scale indidator bar in pixels

See Also:
Serialized Form

Field Summary
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  java.awt.Color lineColor
           
static java.lang.String LineColorProperty
           
protected  int locationXoffset
           
static java.lang.String LocationXOffsetProperty
           
protected  int locationYoffset
           
static java.lang.String LocationYOffsetProperty
           
protected  java.awt.Color textColor
           
static java.lang.String TextColorProperty
           
protected  java.lang.String unitOfMeasure
           
static java.lang.String UnitOfMeasureProperty
           
protected  Length uom
           
protected  java.lang.String uomAbbr
           
protected  int width
           
static java.lang.String WidthProperty
           
 
Fields inherited from class com.bbn.openmap.layer.OMGraphicHandlerLayer
cancelled, CANCELLED_LOCK, consumeEvents, ConsumeEventsProperty, filter, layerWorker, LAYERWORKER_LOCK, mouseEventInterpreter, mouseModeIDs, MouseModesProperty, projectionChangePolicy, ProjectionChangePolicyProperty, renderPolicy, RenderPolicyProperty, selectedList
 
Fields inherited from class com.bbn.openmap.Layer
addAsBackground, AddAsBackgroundProperty, addToBeanContext, AddToBeanContextProperty, autoPalette, AutoPaletteProperty, beanContextChildSupport, DisplayPaletteCmd, DisplayPropertiesCmd, doHack, HidePaletteCmd, i18n, IDListeners, localHackList, lsListeners, palette, paletteListener, PrettyNameProperty, propertyPrefix, RedrawCmd, removable, RemovableProperty, RemoveableProperty, SWING_PACKAGE, 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
ScaleDisplayLayer()
           
 
Method Summary
 java.awt.Component getGUI()
          Creates the interface palette.
 java.lang.String getUnitOfMeasure()
          Getter for property unitOfMeasure.
 OMGraphicList prepare()
          This is the main method you should be concerned with when overriding this class.
 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.layer.OMGraphicHandlerLayer
canSetList, copy, cut, deselect, doAction, doPrepare, filter, filter, filter, getConsumeEvents, getFilter, getInfoText, getItemsForMapMenu, getItemsForOMGraphicMenu, getLayerWorker, getList, getMapMouseListener, getMouseEventInterpreter, getMouseModeIDsForEvents, getProjectionChangePolicy, getProperties, getPropertyInfo, getRenderPolicy, getSelected, getToolTipTextFor, highlight, interrupt, isCancelled, isHighlightable, isSelectable, isWorking, leftClick, mouseOver, paint, paste, projectionChanged, receivesMapEvents, renderDataForProjection, resetFiltering, select, setCancelled, setConsumeEvents, setFilter, setLayerWorker, setList, setMouseEventInterpreter, setMouseModeIDsForEvents, setProjectionChangePolicy, setRenderPolicy, supportsSQL, unhighlight, workerComplete
 
Methods inherited from class com.bbn.openmap.Layer
actionPerformed, addComponentListener, added, addInfoDisplayListener, addLayerStatusListener, addMouseListener, addVetoableChangeListener, childrenAdded, childrenRemoved, clearListeners, connectToBeanContext, createWindowSupport, finalize, findAndInit, findAndInit, findAndUndo, fireHideToolTip, fireHideToolTip, firePaletteEvent, fireRequestBrowserContent, fireRequestBrowserContent, fireRequestCursor, fireRequestInfoLine, fireRequestInfoLine, fireRequestInfoLine, fireRequestMessage, fireRequestMessage, fireRequestToolTip, fireRequestToolTip, fireRequestToolTip, fireRequestToolTip, fireRequestURL, fireRequestURL, fireStatusUpdate, fireStatusUpdate, fireVetoableChange, getAddAsBackground, getAddToBeanContext, getBeanContext, getPackage, getPalette, getProjection, getPropertyPrefix, getWindowSupport, hidePalette, isRemovable, isRemoveable, notifyHideHack, removeComponentListener, removeConfirmed, removed, removeInfoDisplayListener, removeLayerStatusListener, removeVetoableChangeListener, repaint, resetPalette, setAddAsBackground, setAddToBeanContext, setBeanContext, setName, setPaletteVisible, setProjection, setProjection, setProperties, setPropertyPrefix, setRemovable, setRemoveable, setVisible, setWindowSupport, showPalette
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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

lineColor

protected java.awt.Color lineColor

textColor

protected java.awt.Color textColor

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

LineColorProperty

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

TextColorProperty

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

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

unitOfMeasure

protected java.lang.String unitOfMeasure

uom

protected Length uom

uomAbbr

protected java.lang.String uomAbbr

locationXoffset

protected int locationXoffset

locationYoffset

protected int locationYoffset

width

protected int width

height

protected int height
Constructor Detail

ScaleDisplayLayer

public ScaleDisplayLayer()
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 OMGraphicHandlerLayer
Parameters:
prefix - the token to prefix the property names
properties - the Properties object

prepare

public OMGraphicList prepare()
Description copied from class: OMGraphicHandlerLayer
This is the main method you should be concerned with when overriding this class. You have to make sure that this method returns an OMGraphicList that is ready to be rendered. That means they need to be generated with the current projection, which can be retrieved by calling getProjection().

This method will be called in a separate thread if doPrepare() is called on the layer. This will automatically cause repaint() to be called, which lets java know to call paint() on this class.

Note that the default action of this method is to get the OMGraphicList as it is currently set in the layer, reprojects the list with the current projection (calls generate() on them), and then returns the current list.

If your layer needs to change what is on the list based on what the current projection is, you can either clear() the list yourself and add new OMGraphics to it (remember to call generate(Projection) on them), and return the list. You also have the option of setting a ListResetPCPolicy, which will automatically set the list to null when the projection changes before calling this method. The OMGraphicHandlerList will ignore a null OMGraphicList.

NOTE: If you call prepare directly, you may need to call repaint(), too. With all invocations of this method that are cause by a projection change, repaint() will be called for you. The method is synchronized in case renderDataForProjection() gets called while in the middle of this method. For a different projection, that would be bad.

Overrides:
prepare in class OMGraphicHandlerLayer

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.
Throws:
PropertyVetoException

getGUI

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

Overrides:
getGUI in class Layer
Returns:
java.awt.Component or null


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