com.bbn.openmap.layer.shape
Class ShapeLayer

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by com.bbn.openmap.Layer
                  extended by com.bbn.openmap.layer.OMGraphicHandlerLayer
                      extended by com.bbn.openmap.layer.shape.ShapeLayer
All Implemented Interfaces:
ProjectionListener, GestureResponsePolicy, OMGraphicHandler, ProjectionPainter, PropertyConsumer, DataBoundsProvider, java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.io.Serializable, java.util.EventListener
Direct Known Subclasses:
AreaShapeLayer, BufferedShapeLayer, MultiShapeLayer

public class ShapeLayer
extends OMGraphicHandlerLayer
implements java.awt.event.ActionListener, DataBoundsProvider

An OpenMap Layer that displays shape files. Note that the ESRIRecords have been updated so that the OMGraphics that get created from them are loaded with an Integer object that notes the number of the record as it was read from the .shp file. This lets you align the object with the correct attribute data in the .dbf file.

       
 ############################
 # Properties for a shape layer
 shapeLayer.class=com.bbn.openmap.layer.shape.ShapeLayer
 shapeLayer.prettyName=Name_for_Menu
 shapeLayer.shapeFile=&ltpath to shapefile (.shp)&gt
 shapeLayer.spatialIndex=&ltpath to generated spatial index file (.ssx)&gt
 shapeLayer.lineColor=ff000000
 shapeLayer.fillColor=ff000000
 # plus any other properties used by the DrawingAttributes object.
 shapeLayer.pointImageURL=&ltURL for image to use for point objects&gt
        
        
 # Optionally, Rule marker names specified in space-separated list
 shapeLayer.rules=rule0 rule1
 # global scale settings can be used so work is only performed within scale range of minScale/maxScale
 shapeLayer.maxScale=1000000f
 
 # rule0 definition:
 # CLASS_RTE is a DBF column name
 shapeLayer.rule0.key=CLASS_RTE
 # operation, if key value is less than 2
 shapeLayer.rule0.op=lt
 shapeLayer.rule0.val=2
 # If rule is met, then actions can be performed:
 # DBF Column names can be added together in a label by specifying them in a space-separated list
 shapeLayer.rule0.label=PREFIX PRETYPE NAME TYPE SUFFIX
 # Labels can have scale limits imposed, so they don't appear if map scale is 
 # greater than maxScale or less than minScale
 shapeLayer.rule0.label.maxScale=1000000
 # Visibility can be controlled with respect to scale as well
 shapeLayer.rule0.render=true
 shapeLayer.rule0.render.maxScale=1000000
 # Rendering attributes can be specified.
 shapeLayer.rule0.lineColor=FFFA73
 shapeLayer.rule0.lineWidth=4
 shapeLayer.rule0.mattingColor=55AAAAAA
 
 # rule1 definition:
 shapeLayer.rule1.key=CLASS_RTE
 shapeLayer.rule1.op=all
 shapeLayer.rule1.label=PREFIX PRETYPE NAME TYPE SUFFIX
 shapeLayer.rule1.label.maxScale=200000
 shapeLayer.rule1.render=true
 shapeLayer.rule1.render.maxScale=500000
 shapeLayer.rule1.lineColor=FFFFFF
 shapeLayer.rule1.lineWidth=3
 shapeLayer.rule1.mattingColor=55AAAAAA
 ############################
 
 

Version:
$Revision: 1.29 $ $Date: 2008/10/16 17:58:15 $
Author:
Tom Mitchell
See Also:
SpatialIndex, 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
protected  javax.swing.JPanel box
           
protected  DrawingAttributes drawingAttributes
          The DrawingAttributes object to describe the rendering of graphics.
static java.util.logging.Logger logger
           
static java.lang.String pointImageURLProperty
          The URL of an image to use for point objects.
static java.lang.String shapeFileProperty
          The name of the property that holds the name of the shape file.
protected  SpatialIndex spatialIndex
          The spatial index of the shape file to be rendered.
 
Fields inherited from class com.bbn.openmap.layer.OMGraphicHandlerLayer
consumeEvents, ConsumeEventsProperty, filter, interruptable, InterruptableProperty, layerWorker, LAYERWORKER_LOCK, layerWorkerQueue, mouseEventInterpreter, mouseModeIDs, MouseModesProperty, projectionChangePolicy, ProjectionChangePolicyProperty, renderPolicy, RenderPolicyProperty, selectedList, TransparencyProperty
 
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, readyToPaint, 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 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
ShapeLayer()
          Initializes an empty shape layer.
ShapeLayer(java.lang.String shapeFileName)
           
 
Method Summary
protected  OMGraphicList computeGraphics()
          Deprecated. use prepare() instead.
protected  DbfHandler createDbfHandler(java.lang.String dbfFileName)
          A call-back method to override in case you want to change the BinaryFile used to in the DbfHandler.
 DataBounds getDataBounds()
          DataBoundsInformer interface.
 DrawingAttributes getDrawingAttributes()
           
 java.awt.Component getGUI()
          Gets the gui controls associated with the layer.
 java.lang.String getInfoText(OMGraphic omg)
          If applicable, should return a short, informational string about the OMGraphic to be displayed in the InformationDelegator.
 java.util.Properties getProperties(java.util.Properties props)
          PropertyConsumer method.
 java.util.Properties getPropertyInfo(java.util.Properties list)
          Method to fill in a Properties object with values reflecting the properties able to be set on this PropertyConsumer.
 SpatialIndex getSpatialIndex()
           
 java.lang.String getToolTipTextFor(OMGraphic omg)
          If applicable, should return a tool tip for the OMGraphic.
 OMGraphicList prepare()
          Create the OMGraphics using the shape file and SpatialIndex.
 void removed(java.awt.Container cont)
          Called when the Layer is removed from the MapBean, giving an opportunity to clean up.
 void setDrawingAttributes(DrawingAttributes da)
           
protected  void setFileProperties(java.lang.String realPrefix, java.util.Properties props)
          This method gets called from setProperties.
 void setProperties(java.lang.String prefix, java.util.Properties props)
          Initializes this layer from the given properties.
 void setSpatialIndex(SpatialIndex si)
           
 
Methods inherited from class com.bbn.openmap.layer.OMGraphicHandlerLayer
actionPerformed, canSetList, copy, createLayerWorker, cut, deselect, dispose, doAction, doPrepare, filter, filter, filter, getConsumeEvents, getDefaultSettingsPanel, getFilter, getItemsForMapMenu, getItemsForOMGraphicMenu, getLayerWorker, getList, getMapMouseListener, getMouseEventInterpreter, getMouseModeIDsForEvents, getProjectionChangePolicy, getRedrawButton, getRenderPolicy, getSelected, getSettingsButton, getTransparency, getTransparencyAdjustmentPanel, highlight, isCancelled, isHighlightable, isInterruptable, isSelectable, isWorking, leftClick, mouseOver, paint, paste, projectionChanged, receivesMapEvents, renderDataForProjection, resetFiltering, select, setConsumeEvents, setFilter, setInterruptable, setLayerWorker, setList, setMouseEventInterpreter, setMouseModeIDsForEvents, setProjectionChangePolicy, setRenderPolicy, setTransparency, supportsSQL, unhighlight, workerComplete
 
Methods inherited from class com.bbn.openmap.Layer
addComponentListener, added, addInfoDisplayListener, addLayerStatusListener, addMouseListener, addVetoableChangeListener, childrenAdded, childrenRemoved, clearListeners, connectToBeanContext, createWindowSupport, disconnectFromBeanContext, 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, getIcon, getMaxScale, getMinScale, getPackage, getPalette, getProjection, getPropertyPrefix, getWindowSupport, hasGUI, hidePalette, isAutoPalette, isProjectionOK, isReadyToPaint, isRemovable, notifyHideHack, prependDataPathPrefix, putAttribute, removeComponentListener, removeConfirmed, removeInfoDisplayListener, removeLayerStatusListener, removeVetoableChangeListener, repaint, resetPalette, setAddAsBackground, setAddToBeanContext, setAutoPalette, setBeanContext, setCoordTransform, setIcon, setLayerProperties, setMaxScale, setMinScale, setName, setPaletteVisible, setProjection, setProjection, setProperties, setPropertyPrefix, setReadyToPaint, 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.awt.event.ActionListener
actionPerformed
 
Methods inherited from interface com.bbn.openmap.util.DataBoundsProvider
getName
 
Methods inherited from interface java.beans.beancontext.BeanContextChild
addPropertyChangeListener, removePropertyChangeListener
 

Field Detail

logger

public static java.util.logging.Logger logger

shapeFileProperty

public static final java.lang.String shapeFileProperty
The name of the property that holds the name of the shape file.

See Also:
Constant Field Values

pointImageURLProperty

public static final java.lang.String pointImageURLProperty
The URL of an image to use for point objects.

See Also:
Constant Field Values

spatialIndex

protected SpatialIndex spatialIndex
The spatial index of the shape file to be rendered.


drawingAttributes

protected DrawingAttributes drawingAttributes
The DrawingAttributes object to describe the rendering of graphics.


box

protected transient javax.swing.JPanel box
Constructor Detail

ShapeLayer

public ShapeLayer()
Initializes an empty shape layer.


ShapeLayer

public ShapeLayer(java.lang.String shapeFileName)
Method Detail

setSpatialIndex

public void setSpatialIndex(SpatialIndex si)

getSpatialIndex

public SpatialIndex getSpatialIndex()

createDbfHandler

protected DbfHandler createDbfHandler(java.lang.String dbfFileName)
                               throws FormatException,
                                      java.io.IOException
A call-back method to override in case you want to change the BinaryFile used to in the DbfHandler.

Parameters:
dbfFileName - path to DBF file.
Returns:
DbfHandler with BinaryFile set in it.
Throws:
FormatException
java.io.IOException

setFileProperties

protected void setFileProperties(java.lang.String realPrefix,
                                 java.util.Properties props)
This method gets called from setProperties.

Parameters:
realPrefix - This prefix has already been scoped, which means it is an empty string if setProperties was called with a null prefix, or it's a String ending with a period if it was defined with characters.
props - Properties containing information about files and the layer.

setProperties

public void setProperties(java.lang.String prefix,
                          java.util.Properties props)
Initializes this layer from the given properties.

Specified by:
setProperties in interface PropertyConsumer
Overrides:
setProperties in class OMGraphicHandlerLayer
Parameters:
props - the Properties holding settings for this layer
prefix - the token to prefix the property names

getProperties

public java.util.Properties getProperties(java.util.Properties props)
PropertyConsumer method.

Specified by:
getProperties in interface PropertyConsumer
Overrides:
getProperties in class OMGraphicHandlerLayer
Parameters:
props - a Properties object to load the PropertyConsumer properties into. If props equals null, then a new Properties object should be created.
Returns:
Properties object containing PropertyConsumer property values. If getList was not null, this should equal getList. Otherwise, it should be the Properties object created by the PropertyConsumer.

getPropertyInfo

public java.util.Properties getPropertyInfo(java.util.Properties list)
Method to fill in a Properties object with values reflecting the properties able to be set on this PropertyConsumer. The key for each property should be the raw property name (without a prefix) with a value that is a String that describes what the property key represents, along with any other information about the property that would be helpful (range, default value, etc.).

Specified by:
getPropertyInfo in interface PropertyConsumer
Overrides:
getPropertyInfo in class OMGraphicHandlerLayer
Parameters:
list - a Properties object to load the PropertyConsumer properties into. If getList equals null, then a new Properties object should be created.
Returns:
Properties object containing PropertyConsumer property values. If getList was not null, this should equal getList. Otherwise, it should be the Properties object created by the PropertyConsumer.

setDrawingAttributes

public void setDrawingAttributes(DrawingAttributes da)

getDrawingAttributes

public DrawingAttributes getDrawingAttributes()

getInfoText

public java.lang.String getInfoText(OMGraphic omg)
Description copied from class: OMGraphicHandlerLayer
If applicable, should return a short, informational string about the OMGraphic to be displayed in the InformationDelegator. Return null if nothing should be displayed.

Specified by:
getInfoText in interface GestureResponsePolicy
Overrides:
getInfoText in class OMGraphicHandlerLayer

getToolTipTextFor

public java.lang.String getToolTipTextFor(OMGraphic omg)
If applicable, should return a tool tip for the OMGraphic. Return null if nothing should be shown.

Specified by:
getToolTipTextFor in interface GestureResponsePolicy
Overrides:
getToolTipTextFor in class OMGraphicHandlerLayer

computeGraphics

protected OMGraphicList computeGraphics()
Deprecated. use prepare() instead.

Create the OMGraphics using the shape file and SpatialIndex.

Returns:
OMGraphicList

prepare

public OMGraphicList prepare()
Create the OMGraphics using the shape file and SpatialIndex.

Overrides:
prepare in class OMGraphicHandlerLayer
Returns:
OMGraphicList

getGUI

public java.awt.Component getGUI()
Description copied from class: Layer
Gets the gui controls associated with the layer. This default implementation returns null indicating that the layer has no gui controls.

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

getDataBounds

public DataBounds getDataBounds()
DataBoundsInformer interface.

Specified by:
getDataBounds in interface DataBoundsProvider
Returns:
a DataBounds object describing the area of coverage, may be null if the data hasn't been evaluated yet.

removed

public void removed(java.awt.Container cont)
Called when the Layer is removed from the MapBean, giving an opportunity to clean up.

Overrides:
removed in class Layer
Parameters:
cont - Container


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