com.bbn.openmap.plugin.esri
Class EsriLayer

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.plugin.esri.EsriLayer
All Implemented Interfaces:
ShapeConstants, ProjectionListener, GestureResponsePolicy, OMGraphicHandler, ProjectionPainter, PropertyConsumer, 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

public class EsriLayer
extends OMGraphicHandlerLayer
implements ShapeConstants

EsriLayer loads Esri shape file sets from web servers or local file systems, and it enables the creation of shape file sets. To create a shape file set from a remote location:

 URL dbf = new URL("http://www.webserver.com/file.dbf");URL shp = new URL("http://www.webserver.com/file.shp");
    URL shx = new URL("http://www.webserver.com/file.shx");
    EsriLayer layer = new EsriLayer("name", dbf, shp, shx);
  
 
To open a shape file set from the local file system:
 String dbf = "c:/data/file.dbf";String shp = "c:/data/file.shp";
    String shx = "c:/data/file.shx";
    EsriLayer layer = new EsriLayer("name", dbf, shp, shx, DrawingAttributes.DEFAULT);
  
 
To create a zero content shape file set from which the user can add shapes at runtime:
 EsriLayer layer = new EsriLayer("name", EsriLayer.TYPE_POLYLINE);
 
To add features to an EsriLayer:
 
OMGraphicList shapeData = new OMGraphicList(); ArrayList tabularData = new ArrayList(); float[] part0 = new float[]{35.0f, -120.0f, -25.0f, -95.0f, 56.0f, -30.0f}; float[] part1 = new float[]{-15.0f, -110.0f, 13.0f, -80.0f, -25.0f, 10.0f}; OMPoly poly0 = new OMPoly(part0, OMGraphic.DECIMAL_DEGREES, OMGraphic.LINETYPE_RHUMB); OMPoly poly1 = new OMPoly(part1, OMGraphic.DECIMAL_DEGREES, OMGraphic.LINETYPE_RHUMB); shapeData.add(poly0); //part 1 shapeData.add(poly1); //part 2 shapeData.generate(_mapBean.getProjection()); tabularData.add(0, "a value"); layer.addRecord(shapeData, tabularData); layer.repaint();
To configure an EsriLayer through a properties file, specify file references in terms of resources, files or URLs. To reference a file on Windows 2000:
   esri.class = com.bbn.openmap.plugin.esri.EsriLayer
   esri.prettyName = Esri Example
   esri.dbf = file:///c:/data/shapefile.dbf
   esri.shp = file:///c:/data/shapefile.shp
   esri.shx = file:///c:/data/shapefile.shx
 
To reference a file on RedHat Linux 6.2:
   esri.class = com.bbn.openmap.plugin.esri.EsriLayer
   esri.prettyName = Esri Example
   esri.dbf = /home/dvanauke/resources/shapefile.dbf
   esri.shp = /home/dvanauke/resources/shapefile.shp
   esri.shx = /home/dvanauke/resources/shapefile.shx
 
To reference a file on a web server:
   esri.class = com.bbn.openmap.plugin.esri.EsriLayer
   esri.prettyName = Esri Example
   esri.dbf = http://www.webserver.com/shapefile.dbf
   esri.shp = http://www.webserver.com/shapefile.shp
   esri.shx = http://www.webserver.com/shapefile.shx
 

Author:
Doug Van Auken
See Also:
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  DbfTableModel _model
           
protected  java.lang.String dbf
           
protected  DrawingAttributes drawingAttributes
           
protected  java.lang.String shp
           
protected  java.lang.String shx
           
 
Fields inherited from class com.bbn.openmap.layer.OMGraphicHandlerLayer
consumeEvents, ConsumeEventsProperty, filter, interruptable, InterruptableProperty, layerWorker, LAYERWORKER_LOCK, layerWorkerQueue, logger, 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.dataAccess.shape.ShapeConstants
DBF_ATTRIBUTE, DBF_AUTOINCREMENT, DBF_BINARY, DBF_CHARACTER, DBF_DATE, DBF_DOUBLE, DBF_FLOAT, DBF_LOGICAL, DBF_LONG, DBF_MEMO, DBF_NUMERIC, DBF_OLE, DBF_TIMESTAMP, DBF_TYPE_AUTOINCREMENT, DBF_TYPE_BINARY, DBF_TYPE_CHARACTER, DBF_TYPE_DATE, DBF_TYPE_DOUBLE, DBF_TYPE_FLOAT, DBF_TYPE_LOGICAL, DBF_TYPE_LONG, DBF_TYPE_MEMO, DBF_TYPE_NUMERIC, DBF_TYPE_OLE, DBF_TYPE_TIMESTAMP, PARAM_DBF, PARAM_SHP, PARAM_SHX, SHAPE_BOUNDS_ATTRIBUTE, SHAPE_DBF_DASHPATTERN, SHAPE_DBF_DASHPHASE, SHAPE_DBF_DESCRIPTION, SHAPE_DBF_FILLCOLOR, SHAPE_DBF_INFO_ATTRIBUTE, SHAPE_DBF_LINECOLOR, SHAPE_DBF_LINEWIDTH, SHAPE_DBF_SELECTCOLOR, SHAPE_FILE_HEADER_LENGTH, SHAPE_FILE_RECORD_HEADER_LENGTH, SHAPE_INDEX_ATTRIBUTE, SHAPE_MAX_MEASURE_ATTRIBUTE, SHAPE_MAX_Z_ATTRIBUTE, SHAPE_MEASURE_ATTRIBUTE, SHAPE_MIN_MEASURE_ATTRIBUTE, SHAPE_MIN_Z_ATTRIBUTE, SHAPE_TYPE_ARC, SHAPE_TYPE_MULTIPATCH, SHAPE_TYPE_MULTIPOINT, SHAPE_TYPE_MULTIPOINTM, SHAPE_TYPE_MULTIPOINTZ, SHAPE_TYPE_NULL, SHAPE_TYPE_POINT, SHAPE_TYPE_POINTM, SHAPE_TYPE_POINTZ, SHAPE_TYPE_POLYGON, SHAPE_TYPE_POLYGONM, SHAPE_TYPE_POLYGONZ, SHAPE_TYPE_POLYLINE, SHAPE_TYPE_POLYLINEM, SHAPE_TYPE_POLYLINEZ, SHAPE_Z_ATTRIBUTE
 
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
EsriLayer()
          Creates an EsriLayer that will be configured through the setProperties() method
EsriLayer(java.lang.String name, int type, int columnCount)
          Creates an empty EsriLayer, usable for adding features at run-time
EsriLayer(java.lang.String name, java.lang.String dbf, java.lang.String shp, java.lang.String shx, DrawingAttributes da)
          Creates an EsriLayer from a set of shape files
EsriLayer(java.lang.String name, java.net.URL dbf, java.net.URL shp, java.net.URL shx)
          Creates an EsriLayer from a set of shape files
EsriLayer(java.lang.String name, java.net.URL dbf, java.net.URL shp, java.net.URL shx, DrawingAttributes da)
          Creates an EsriLayer from a set of shape files
 
Method Summary
 void addRecord(OMGraphic graphic, java.util.ArrayList<java.lang.Object> record)
          Handles adding records to the geometry list and the DbfTableModel
 EsriGraphicList getEsriGraphicList()
          Returns the EsriGraphicList for this layer
 DbfTableModel getModel()
          Returns the associated table model for this layer
 java.util.Properties getProperties(java.util.Properties properties)
          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.
 int getType()
          Returns whether this layer is of type 0 (point), 3 (polyline), or 5(polygon)
 void query(java.lang.String query)
          Filters the DbfTableModel given a SQL like string
 void setModel(DbfTableModel model)
          Sets the DbfTableModel
 void setProperties(java.lang.String prefix, java.util.Properties properties)
          Sets the properties for the Layer.
 
Methods inherited from class com.bbn.openmap.layer.OMGraphicHandlerLayer
actionPerformed, canSetList, copy, createLayerWorker, cut, deselect, dispose, doAction, doPrepare, filter, filter, filter, getConsumeEvents, getDefaultSettingsPanel, getFilter, getInfoText, getItemsForMapMenu, getItemsForOMGraphicMenu, getLayerWorker, getList, getMapMouseListener, getMouseEventInterpreter, getMouseModeIDsForEvents, getProjectionChangePolicy, getRedrawButton, getRenderPolicy, getSelected, getSettingsButton, getToolTipTextFor, getTransparency, getTransparencyAdjustmentPanel, highlight, isCancelled, isHighlightable, isInterruptable, isSelectable, isWorking, leftClick, mouseOver, paint, paste, prepare, 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, getGUI, getIcon, getMaxScale, getMinScale, getPackage, getPalette, getProjection, getPropertyPrefix, getWindowSupport, hasGUI, hidePalette, isAutoPalette, isProjectionOK, isReadyToPaint, isRemovable, notifyHideHack, prependDataPathPrefix, putAttribute, removeComponentListener, removeConfirmed, removed, 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.beans.beancontext.BeanContextChild
addPropertyChangeListener, removePropertyChangeListener
 

Field Detail

_model

protected DbfTableModel _model

dbf

protected java.lang.String dbf

shx

protected java.lang.String shx

shp

protected java.lang.String shp

drawingAttributes

protected DrawingAttributes drawingAttributes
Constructor Detail

EsriLayer

public EsriLayer()
Creates an EsriLayer that will be configured through the setProperties() method


EsriLayer

public EsriLayer(java.lang.String name,
                 int type,
                 int columnCount)
          throws java.lang.Exception
Creates an empty EsriLayer, usable for adding features at run-time

Parameters:
name - The name of the layer
type - The type of layer
columnCount - The number of columns in the dbf model
Throws:
java.lang.Exception

EsriLayer

public EsriLayer(java.lang.String name,
                 java.lang.String dbf,
                 java.lang.String shp,
                 java.lang.String shx,
                 DrawingAttributes da)
          throws java.net.MalformedURLException
Creates an EsriLayer from a set of shape files

Parameters:
name - The name of the layer that may be used to reference the layer
dbf - The url referencing the dbf extension file
shp - The url referencing the shp extension file
shx - The url referencing the shx extension file
Throws:
java.net.MalformedURLException

EsriLayer

public EsriLayer(java.lang.String name,
                 java.net.URL dbf,
                 java.net.URL shp,
                 java.net.URL shx)
Creates an EsriLayer from a set of shape files

Parameters:
name - The name of the layer that may be used to reference the layer
dbf - The url referencing the dbf extension file
shp - The url referencing the shp extension file
shx - The url referencing the shx extension file

EsriLayer

public EsriLayer(java.lang.String name,
                 java.net.URL dbf,
                 java.net.URL shp,
                 java.net.URL shx,
                 DrawingAttributes da)
Creates an EsriLayer from a set of shape files

Parameters:
name - The name of the layer that may be used to reference the layer
dbf - The url referencing the dbf extension file
shp - The url referencing the shp extension file
shx - The url referencing the shx extension file
da - DrawingAttributes to use to render the layer contents.
Method Detail

addRecord

public void addRecord(OMGraphic graphic,
                      java.util.ArrayList<java.lang.Object> record)
Handles adding records to the geometry list and the DbfTableModel

Parameters:
graphic - An OMGraphic to add the graphics list
record - A record to add to the DbfTableModel

getEsriGraphicList

public EsriGraphicList getEsriGraphicList()
Returns the EsriGraphicList for this layer

Returns:
The EsriGraphicList for this layer

getModel

public DbfTableModel getModel()
Returns the associated table model for this layer

Returns:
The associated table model for this layer

getType

public int getType()
Returns whether this layer is of type 0 (point), 3 (polyline), or 5(polygon)

Returns:
An int representing the type of layer, as specified in Esri's shape file format specification

query

public void query(java.lang.String query)
Filters the DbfTableModel given a SQL like string

Parameters:
query - A SQL like string to filter the DbfTableModel

setModel

public void setModel(DbfTableModel model)
Sets the DbfTableModel

Parameters:
model - The DbfModel to set for this layer

setProperties

public void setProperties(java.lang.String prefix,
                          java.util.Properties properties)
Sets the properties for the Layer.

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

getProperties

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

Specified by:
getProperties in interface PropertyConsumer
Overrides:
getProperties in class OMGraphicHandlerLayer
Parameters:
properties - the Properties object
Returns:
the Properties object

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.


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