com.bbn.openmap.plugin
Class CSVTiledImagePlugIn

java.lang.Object
  |
  +--com.bbn.openmap.plugin.AbstractPlugIn
        |
        +--com.bbn.openmap.plugin.BeanContextAbstractPlugIn
              |
              +--com.bbn.openmap.plugin.OMGraphicHandlerPlugIn
                    |
                    +--com.bbn.openmap.plugin.CSVTiledImagePlugIn
All Implemented Interfaces:
java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.util.EventListener, MapMouseListener, OMGraphicHandler, PlugIn, PropertyConsumer

public class CSVTiledImagePlugIn
extends OMGraphicHandlerPlugIn

This PlugIn can be used to load image files for background use. The images are automatically scaled to fit the projection. The actual accuracy of matching the scaled images to the map depends on the projection of the images, and the projection type being used for the map. At larger scales, the error may not be noticeable.

This PlugIn uses a csv file to find out about the images that should be loaded. The layer assumes that the csv file has these fields, in this order:

 
 Upper Latitude, Western Longitude, Lower Latitude, Eastern Longitude, URL of image
 42,-73.5,40,-72,file:///data/images/test1.jpg
 40,-73.5,38,-72,file:///data/images/test2.jpg

 
Make sure there are not spaces in the data portion of the file!

The properties for the PlugIn look like this:


 plugin.class=com.bbn.openmap.plugin.CSVTiledImagePlugIn
 plugin.prettyName=Name of Layer
 # URL of the data file
 plugin.tileFile=URL of csv file
 # If the csv file has descriptive header line that should not be used for images. (default = true)
 plugin.fileHasHeader=true

 
The PlugIn doesn't do anything fancy with image caching. The plugin loads all of the images when the layer is turned on. You might have to bump up the heap size of the JVM when loading large or many images.

This class was inspired by, and created from parts of the ImageLayer submission from Adrian Lumsden@sss, on 25-Jan-2002. Use the MediaTracker code from that class.


Field Summary
static java.lang.String CSVFileNameProperty
          The property for the data file - tileFile.
protected  boolean fileHasHeader
           
static java.lang.String FileHasHeaderProperty
          The property for whether the data file has a descriptive header on the first line, to let the reader know to ignore that line - fileHasHeader.
 int lrlatIndex
          Index of column for lower latitude of image in the csv file.
 int lrlonIndex
          Index of column for eastern longitude of image in the csv file.
protected  CSVFile tilefile
           
protected  java.lang.String tileFileName
           
 int ullatIndex
          Index of column for upper latitude of image in the csv file.
 int ullonIndex
          Index of column for western longitude of image in the csv file.
 int urlIndex
          Index of column for URL of image file in the csv file.
 
Fields inherited from class com.bbn.openmap.plugin.OMGraphicHandlerPlugIn
filter, list
 
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
CSVTiledImagePlugIn()
          Default constructor.
CSVTiledImagePlugIn(java.awt.Component comp)
           
 
Method Summary
 java.util.Properties getProperties(java.util.Properties getList)
          Method to fill in a Properties object, reflecting the current values of the PropertyConsumer.
 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.
 OMGraphicList getRectangle(Projection p)
          The getRectangle call is the main call into the PlugIn module.
protected  void loadTiles(java.lang.String csvFileName)
          Takes the URL to a csv file and parses it into OMScaledRasters, adding them to the tiles HashSet.
 void setProperties(java.lang.String prefix, java.util.Properties props)
          PropertyConsumer method, setting the PlugIn with properties that apply to it.
 
Methods inherited from class com.bbn.openmap.plugin.OMGraphicHandlerPlugIn
canSetList, doAction, filter, filter, filter, getFilter, getList, resetFiltering, setFilter, setList, supportsSQL
 
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
doPrepare, getAddToBeanContext, getComponent, getGUI, getMapMouseListener, getMouseModeServiceList, getName, getPropertyPrefix, isRemovable, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, 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
 

Field Detail

CSVFileNameProperty

public static final java.lang.String CSVFileNameProperty
The property for the data file - tileFile.

See Also:
Constant Field Values

FileHasHeaderProperty

public static final java.lang.String FileHasHeaderProperty
The property for whether the data file has a descriptive header on the first line, to let the reader know to ignore that line - fileHasHeader. Default is true.

See Also:
Constant Field Values

tileFileName

protected java.lang.String tileFileName

fileHasHeader

protected boolean fileHasHeader

tilefile

protected CSVFile tilefile

ullatIndex

public int ullatIndex
Index of column for upper latitude of image in the csv file. Default 0.


ullonIndex

public int ullonIndex
Index of column for western longitude of image in the csv file. Default 1.


lrlatIndex

public int lrlatIndex
Index of column for lower latitude of image in the csv file. Default 2.


lrlonIndex

public int lrlonIndex
Index of column for eastern longitude of image in the csv file. Default 3.


urlIndex

public int urlIndex
Index of column for URL of image file in the csv file. Default 4.

Constructor Detail

CSVTiledImagePlugIn

public CSVTiledImagePlugIn()
Default constructor.


CSVTiledImagePlugIn

public CSVTiledImagePlugIn(java.awt.Component comp)
Method Detail

getRectangle

public OMGraphicList getRectangle(Projection p)
The getRectangle call is the main call into the PlugIn module. The module is expected to fill the graphics list with objects that are within the screen parameters passed.

Specified by:
getRectangle in interface PlugIn
Overrides:
getRectangle in class OMGraphicHandlerPlugIn
Parameters:
p - projection of the screen, holding scale, center coords, height, width.

setProperties

public void setProperties(java.lang.String prefix,
                          java.util.Properties props)
PropertyConsumer method, setting the PlugIn with properties that apply to it.

Specified by:
setProperties in interface PropertyConsumer
Overrides:
setProperties in class AbstractPlugIn
Parameters:
prefix - a String used by the PropertyConsumer to prepend to each property value it wants to look up - setList.getProperty(prefix.propertyKey). If the prefix had already been set, then the prefix passed in should replace that previous value.
props - a Properties object that the PropertyConsumer can use to retrieve expected properties it can use for configuration.

loadTiles

protected void loadTiles(java.lang.String csvFileName)
Takes the URL to a csv file and parses it into OMScaledRasters, adding them to the tiles HashSet.


getProperties

public java.util.Properties getProperties(java.util.Properties getList)
Method to fill in a Properties object, reflecting the current values of the PropertyConsumer. If the PropertyConsumer has a prefix set, the property keys should have that prefix plus a separating '.' prepended to each propery key it uses for configuration.

Specified by:
getProperties in interface PropertyConsumer
Overrides:
getProperties in class AbstractPlugIn
Parameters:
getList - 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.

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 AbstractPlugIn
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