gistoolkit.datasources.imagefile
Class ImageDirectoryDataSource

java.lang.Object
  extended bygistoolkit.datasources.SimpleDataSource
      extended bygistoolkit.datasources.imagefile.ImageDirectoryDataSource
All Implemented Interfaces:
DataSource, java.awt.image.ImageObserver

public class ImageDirectoryDataSource
extends SimpleDataSource
implements java.awt.image.ImageObserver

The idea is that there will be a directory on disk that will contain mayn Tif/tfw files. These files will be indexed by this data source, and only the images that need to be read will be.


Field Summary
 
Fields inherited from class gistoolkit.datasources.SimpleDataSource
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ImageDirectoryDataSource()
          Creates new ImageDirectoryDataSource
ImageDirectoryDataSource(java.io.File inDirectory)
          Creates new ImageDirectoryDataSource with the given file.
 
Method Summary
 java.lang.String getImageDirectory()
          Get the name of the directory where the images are stored.
 java.lang.String getIndexFileName()
          Get the name of the index file.
 Node getNode()
          Get the configuration information for this layer.
 Style getStyle()
          Get the style to use with this datasource.
 boolean imageUpdate(java.awt.Image image, int param, int param2, int param3, int param4, int param5)
           
 Envelope loadEnvelope(java.io.File inImageFile)
          Check for a world file from which to load the Envelope.
 void loadIndex()
          Create the index should it not exist.
 GISDataset readDataset()
          Reads all the objects from the data source.
 GISDataset readDataset(Envelope inEnvelope)
          Reads only the objects from the data source that intersect these envelope.
 Envelope readEnvelope()
          Returns the bounding rectangle of all the shapes in the Data Source.
protected  GISDataset readShapes(Envelope inEnvelope)
          This method should return the shapes from the data source
 void saveIndex()
          Save the index to a file.
 void setFromProjection(Projection inProjection)
          Set the projection from which this data should be projected.
 void setImageDirectory(java.lang.String inImageDirectory)
          Set the name of the directory where the images are stored.
 void setIndexFileName(java.lang.String inIndexFileName)
          Set the name of the index file.
 void setNode(Node inNode)
          Set the configuration information for this layer.
 
Methods inherited from class gistoolkit.datasources.SimpleDataSource
addDataSourceListener, clearCache, commit, delete, doCommit, doDelete, doInsert, doRollback, doUpdate, filterDataset, fireCommit, fireDelete, fireInsert, fireRead, fireRollBack, fireUpdate, getCached, getCacheDataset, getCacheEnvelope, getEnvelope, getFilter, getFromProjection, getName, getToProjection, getValidShapeTypes, insert, isCachedProjected, isUpdateable, projectBackward, projectForward, queryFromCache, removeDataSourceListener, rollback, setCache, setCached, setFilter, setName, setProjection, setToProjection, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageDirectoryDataSource

public ImageDirectoryDataSource()
Creates new ImageDirectoryDataSource


ImageDirectoryDataSource

public ImageDirectoryDataSource(java.io.File inDirectory)
                         throws java.lang.Exception
Creates new ImageDirectoryDataSource with the given file.

Method Detail

setImageDirectory

public void setImageDirectory(java.lang.String inImageDirectory)
                       throws java.io.FileNotFoundException
Set the name of the directory where the images are stored.

Throws:
java.io.FileNotFoundException

getImageDirectory

public java.lang.String getImageDirectory()
Get the name of the directory where the images are stored.


setFromProjection

public void setFromProjection(Projection inProjection)
                       throws java.lang.Exception
Set the projection from which this data should be projected.

Specified by:
setFromProjection in interface DataSource
Overrides:
setFromProjection in class SimpleDataSource
Throws:
java.lang.Exception

getNode

public Node getNode()
Get the configuration information for this layer.

Specified by:
getNode in interface DataSource
Overrides:
getNode in class SimpleDataSource

setNode

public void setNode(Node inNode)
             throws java.lang.Exception
Set the configuration information for this layer.

Specified by:
setNode in interface DataSource
Overrides:
setNode in class SimpleDataSource
Throws:
java.lang.Exception

readEnvelope

public Envelope readEnvelope()
                      throws java.lang.Exception
Returns the bounding rectangle of all the shapes in the Data Source.

Specified by:
readEnvelope in class SimpleDataSource
Throws:
java.lang.Exception

readDataset

public GISDataset readDataset(Envelope inEnvelope)
                       throws java.lang.Exception
Reads only the objects from the data source that intersect these envelope.

Specified by:
readDataset in interface DataSource
Overrides:
readDataset in class SimpleDataSource
Throws:
java.lang.Exception

readDataset

public GISDataset readDataset()
                       throws java.lang.Exception
Reads all the objects from the data source.

Specified by:
readDataset in interface DataSource
Overrides:
readDataset in class SimpleDataSource
Throws:
java.lang.Exception

readShapes

protected GISDataset readShapes(Envelope inEnvelope)
                         throws java.lang.Exception
This method should return the shapes from the data source

Specified by:
readShapes in class SimpleDataSource
Throws:
java.lang.Exception

setIndexFileName

public void setIndexFileName(java.lang.String inIndexFileName)
Set the name of the index file.


getIndexFileName

public java.lang.String getIndexFileName()
Get the name of the index file.


loadIndex

public void loadIndex()
Create the index should it not exist.


loadEnvelope

public Envelope loadEnvelope(java.io.File inImageFile)
Check for a world file from which to load the Envelope.


saveIndex

public void saveIndex()
               throws java.io.IOException
Save the index to a file.

The format of the file will be:

FileNameOfImageFile (relative to directory)|minX|minY|maxX|maxY

All lines beginning with a # are ignored.

Throws:
java.io.IOException

imageUpdate

public boolean imageUpdate(java.awt.Image image,
                           int param,
                           int param2,
                           int param3,
                           int param4,
                           int param5)
Specified by:
imageUpdate in interface java.awt.image.ImageObserver

getStyle

public Style getStyle()
Get the style to use with this datasource.

Specified by:
getStyle in interface DataSource
Overrides:
getStyle in class SimpleDataSource