|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bbn.openmap.plugin.AbstractPlugIn com.bbn.openmap.plugin.BeanContextAbstractPlugIn com.bbn.openmap.plugin.esri.EsriPlugIn
public class EsriPlugIn
EsriPlugIn loads Esri shape file sets from web servers or local file systems, and it enables the creation of shape file sets. It needs to be inserted into a PlugInLayer to use within OpenMap.
To create a file from a remote location:
To open a shape file set from the local file system:
URL shp = new URL("http://www.webserver.com/file.shp");
URL dbf = new URL("http://www.webserver.com/file.dbf");
URL shx = new URL("http://www.webserver.com/file.shx");
EsriPlugIn epi = new EsriPlugIn("name", dbf, shp, shx);
PlugInLayer pil = new PlugInLayer();
pil.setPlugIn(epi);
To create a zero content shape file set from which the user can add shapes at
runtime:
File dbf = new File("c:/data/file.dbf");
File shp = new File("c:/data/file.shp");
File shx = new File("c:/data/file.shx");
EsriPlugIn epi = new EsriPlugIn("name", dbf.toURI().toURL(), shp.toURI().toURL(), shx.toURI().toURL());
PlugInLayer pil = new PlugInLayer();
pil.setPlugIn(epi);
To add features to an EsriLayer:
EsriPlugIn epi = new EsriPlugIn("name", EsriLayer.TYPE_POLYLINE);
To configure an EsriLayer through a properties file, specify file references
in terms of URLs, full or relative file paths.
To reference a file on Windows 2000:
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");
plugin.addRecord(shapeData, tabularData);
plugin.repaint(); // assumes that plugin added to PlugInLayer
To reference a file on RedHat Linux 6.2:
esri.class = com.bbn.openmap.plugin.esri.EsriPlugIn
esri.prettyName = Esri Example
esri.shp = file:///c:/data/shapefile.shp
# -or-
esri.shp = c:/data/shapefile.shp
esri.dbf = file:///c:/data/shapefile.dbf
esri.shx = file:///c:/data/shapefile.shx
To reference a file on a web server:
esri.class = com.bbn.openmap.plugin.esri.EsriPlugIn
esri.prettyName = Esri Example
esri.shp = file:///home/dvanauke/resources/shapefile.shp
# - or -
esri.shp = /home/dvanauke/resources/shapefile.shp
esri.dbf = file:///home/dvanauke/resources/shapefile.dbf
esri.shx = file:///home/dvanauke/resources/shapefile.shx
The PlugIn has been updated to use the properties from the DrawingAttributes
object in order to specify how it's objects should be rendered:
esri.class = com.bbn.openmap.plugin.esri.EsriPlugIn
esri.prettyName = Esri Example
esri.shp = http://www.webserver.com/shapefile.shp
esri.dbf = http://www.webserver.com/shapefile.dbf
esri.shx = http://www.webserver.com/shapefile.shx
See DrawingAttributes for more options. Also, as of OpenMap 4.5.4, you don't
have to specify the location of the .dbf and .shx files. If you don't, the
plugin assumes that those files are next to the .shp file.
esri.class = com.bbn.openmap.plugin.esri.EsriPlugIn
esri.prettyName = Esri Example
esri.lineColor = AARRGGBB (hex ARGB color)
esri.fillColor = AARRGGBB (hex ARGB color)
esri.selectColor = AARRGGBB (hex ARGB color)
esri.lineWidth = AARRGGBB (hex ARGB color)
Field Summary | |
---|---|
protected javax.swing.JPanel |
daGUI
|
protected DrawingAttributes |
drawingAttributes
|
protected int |
graphicIndex
This marks the index of the OMGraphic that is "selected" |
protected javax.swing.ListSelectionModel |
lsm
|
protected Layer |
parentLayer
|
protected Projection |
proj
The last projection. |
protected OMGraphicList |
selectedGraphics
A simple list mechanism that will let selected OMGraphics to be drawn on top of all the others. |
protected javax.swing.JTable |
table
|
protected javax.swing.JFrame |
tableFrame
|
Fields inherited from class com.bbn.openmap.plugin.BeanContextAbstractPlugIn |
---|
beanContextChildSupport |
Fields inherited from class com.bbn.openmap.plugin.AbstractPlugIn |
---|
addToBeanContext, component, i18n, mml, name, prefix, removable, RemovableProperty |
Fields inherited from interface com.bbn.openmap.PropertyConsumer |
---|
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty |
Constructor Summary | |
---|---|
EsriPlugIn()
Creates an EsriPlugIn that will be configured through the setProperties() method |
|
EsriPlugIn(java.lang.String name,
int type,
int columnCount)
Creates an empty EsriPlugIn, usable for adding features at run-time. |
|
EsriPlugIn(java.lang.String name,
java.net.URL dbf,
java.net.URL shp,
java.net.URL shx)
Creates an EsriPlugIn 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. |
DataBounds |
getDataBounds()
DataBoundsInformer interface. |
java.lang.String |
getDescription(int index)
Builds a description in HTML for a tool tip for the specified OMGraphic |
DrawingAttributes |
getDrawingAttributes()
Get the drawing attributes for the graphics on the list. |
EsriGraphicList |
getEsriGraphicList()
Returns the EsriGraphicList for this layer |
EsriGraphicList |
getGeometry(java.net.URL shp)
Reads the contents of the SHP file. |
EsriGraphicList |
getGeometry(java.net.URL shp,
java.net.URL shx)
Deprecated. Use getGeometry(URL) instead, the shx file isn't used. |
java.awt.Component |
getGUI()
Gives the PlugIn a chance to present components that control its attributes. |
DbfTableModel |
getModel()
Returns the associated table model for this layer |
java.util.Properties |
getProperties(java.util.Properties props)
Method to fill in a Properties object, reflecting the current values of the PropertyConsumer. |
java.util.Properties |
getPropertyInfo(java.util.Properties props)
Method to fill in a Properties object with values reflecting the properties able to be set on this PropertyConsumer. |
OMGraphicList |
getRectangle(Projection p)
The getRectangle call is the main call into the PlugIn module. |
javax.swing.JTable |
getTable()
Needs to be called before displaying the DbfTableModel. |
int |
getType()
Returns whether this layer is of type 0 (point), 3 (polyline), or 5(polygon) |
static void |
main(java.lang.String[] argv)
|
boolean |
mouseClicked(java.awt.event.MouseEvent e)
Handle a mouse click on the map. |
boolean |
mouseMoved(java.awt.event.MouseEvent e)
Handle mouse moved events (Used for firing tool tip descriptions over graphics) |
void |
query(java.lang.String query)
Filters the DbfTableModel given a SQL like string |
void |
selectEntry(OMGraphic graphic)
Given a graphic, highlight its entry in the table. |
void |
selectGraphic(int index)
Mark a graphic as selected on the map. |
void |
selectGraphic(OMGraphic graphic)
Mark the graphic as selected, and generate if necessary. |
void |
setDrawingAttributes(DrawingAttributes da)
Set the drawing attributes for the graphics on the list. |
void |
setDrawingAttributes(OMGraphic omg)
Sets the drawing attributes to those of a particular OMGraphic. |
void |
setModel(DbfTableModel model)
Sets the DbfTableModel |
void |
setProperties(java.lang.String prefix,
java.util.Properties properties)
Sets the properties for the Layer . |
void |
showTable()
Show the table in its own frame. |
Methods inherited from class com.bbn.openmap.plugin.BeanContextAbstractPlugIn |
---|
addPropertyChangeListener, addVetoableChangeListener, childrenAdded, childrenRemoved, findAndInit, findAndInit, findAndUndo, firePropertyChange, fireVetoableChange, getBeanContext, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext |
Methods inherited from class com.bbn.openmap.plugin.AbstractPlugIn |
---|
dispose, doPrepare, getAddToBeanContext, getComponent, getMapMouseListener, getMouseModeServiceList, getName, getPropertyPrefix, isRemovable, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, removed, repaint, setAddToBeanContext, setComponent, setMapMouseListener, setName, setProperties, setPropertyPrefix, setRemovable |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.bbn.openmap.util.DataBoundsProvider |
---|
getName |
Field Detail |
---|
protected OMGraphicList selectedGraphics
protected Projection proj
protected DrawingAttributes drawingAttributes
protected javax.swing.JTable table
protected javax.swing.ListSelectionModel lsm
protected Layer parentLayer
protected javax.swing.JPanel daGUI
protected javax.swing.JFrame tableFrame
protected int graphicIndex
Constructor Detail |
---|
public EsriPlugIn()
setProperties()
method
public EsriPlugIn(java.lang.String name, int type, int columnCount) throws java.lang.Exception
name
- The name of the layertype
- The type of layercolumnCount
- The number of columns in the dbf model
java.lang.Exception
public EsriPlugIn(java.lang.String name, java.net.URL dbf, java.net.URL shp, java.net.URL shx)
name
- The name of the layer that may be used to reference the layerdbf
- The url referencing the dbf extension fileshp
- The url referencing the shp extension fileshx
- The url referencing the shx extension fileMethod Detail |
---|
public void setDrawingAttributes(DrawingAttributes da)
public DrawingAttributes getDrawingAttributes()
public void addRecord(OMGraphic graphic, java.util.ArrayList<java.lang.Object> record)
graphic
- An OMGraphic to add the graphics listrecord
- A record to add to the DbfTableModelpublic EsriGraphicList getEsriGraphicList()
public static void main(java.lang.String[] argv)
public OMGraphicList getRectangle(Projection p)
getRectangle
in interface PlugIn
getRectangle
in class AbstractPlugIn
p
- projection of the screen, holding scale, center coords, height,
width. May be null if the parent component hasn't been given a
projection.
Projection
,
OMGraphicList
public EsriGraphicList getGeometry(java.net.URL shp, java.net.URL shx)
shp
- The url of the SHP fileshx
- The url of the SHX file (not used, OK if null).
public EsriGraphicList getGeometry(java.net.URL shp)
shp
- The url of the SHP file
public DbfTableModel getModel()
public int getType()
public void query(java.lang.String query)
query
- A SQL like string to filter the DbfTableModelpublic void setModel(DbfTableModel model)
model
- The DbfModel to set for this layerpublic void setProperties(java.lang.String prefix, java.util.Properties properties)
Layer
.
setProperties
in interface PropertyConsumer
setProperties
in class AbstractPlugIn
prefix
- the token to prefix the property namesproperties
- the Properties
objectpublic java.util.Properties getProperties(java.util.Properties props)
AbstractPlugIn
getProperties
in interface PropertyConsumer
getProperties
in class AbstractPlugIn
props
- a Properties object to load the PropertyConsumer
properties into. If getList equals null, then a new Properties
object should be created.
public java.util.Properties getPropertyInfo(java.util.Properties props)
AbstractPlugIn
getPropertyInfo
in interface PropertyConsumer
getPropertyInfo
in class AbstractPlugIn
props
- a Properties object to load the PropertyConsumer properties
into. If getList equals null, then a new Properties object should
be created.
public java.awt.Component getGUI()
PlugIn
getGUI
in interface PlugIn
getGUI
in class AbstractPlugIn
public void setDrawingAttributes(OMGraphic omg)
public javax.swing.JTable getTable()
public void selectGraphic(int index)
index
- the index, from 0, of the graphic on the list.public void selectGraphic(OMGraphic graphic)
public void selectEntry(OMGraphic graphic)
public void showTable()
public boolean mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface MapMouseListener
mouseClicked
in class AbstractPlugIn
e
- MouseEvent
public boolean mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface MapMouseListener
mouseMoved
in class AbstractPlugIn
e
- MouseEvent
public java.lang.String getDescription(int index)
index
- the index of the graphic in the tablepublic DataBounds getDataBounds()
getDataBounds
in interface DataBoundsProvider
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |