gistoolkit.datasources.terraserver
Class TerraserverDataSource

java.lang.Object
  extended bygistoolkit.datasources.terraserver.TerraserverDataSource
All Implemented Interfaces:
DataSource, RasterDatasource

public class TerraserverDataSource
extends java.lang.Object
implements DataSource, RasterDatasource

Allows the retrieval of image data from terraserver.

Author:
ithaqua

Field Summary
static int DOQ
           
static int DRG
           
 java.lang.String myDiskCache
          Location of the disk cache.
static int TILE_HEIGHT
           
static int TILE_WIDTH
           
 
Constructor Summary
TerraserverDataSource()
          Creates new TerraserverDataSource
 
Method Summary
 void addDataSourceListener(DataSourceListener inDataSourceListener)
          Adds a datasource listener to this datasource.
 void commit()
          Update Terraserver, ....
 void delete(Record inRecord)
          Delete data from Terraserver, ....
 int getColor(double inX, double inY, int inUTMZone, int inResolution, int inScaleFactor, TerraserverPerformanceLog inLog)
          returns the color of the pixel at the given location in UTM coordinates.
 java.lang.String getDiskCache()
          Return the location on the disk where the caching of tiles should take place
static int[] getDOQResolutions()
          Retrieve the list of valid resolutions
static int[] getDRGResolutions()
          Retrieve the list of valid resolutions
 Envelope getEnvelope()
          Returns the bounding rectangle of all the shapes in the shape file.
 Filter getFilter()
          Terraserver datasource does not use filters, always returns null.
 Projection getFromProjection()
          Gets the projection to use to convert from the storage media, source projection.
 int getImageHeight()
          Return the height of the image to generate
 int getImageType()
          Return the type of image to retrieve, choices are DOQ, or DRG
 int getImageWidth()
          Return the width of the image to generate
 int getMaxRetrySeconds()
          Get the Maximum retry time.
 int getMemoryCache()
          Return the number of tiles to keep in memory.
 java.lang.String getName()
          Return the name of this datasource for display to the user.
 Node getNode()
          Get the configuration information for this data source
 int getOptimization()
          Retrieve the optimization level for this image
 Style getStyle()
          Get the style to use with this datasource.
 Projection getToProjection()
          Return the projection this data source is to project to.
 java.lang.String getURLBase()
          Returns the URL location of the tile.asp script on terraserver
 void insert(Record inRecord)
          Update Terraserver, ....
 boolean isUpdateable()
          Determines if this datasource is updateable.
 void load(java.util.Properties inProperties)
          Initialize the data source from the properties.
 GISDataset readDataset()
          Reading all data from terraserver is not an option, nothing is returned.
 GISDataset readDataset(Envelope inEnvelope)
          Reads only the items from the datasource that are within the envelope.
 void removeDataSourceListener(DataSourceListener inDataSourceListener)
          Removes the datasource lisener from this datasource.
 void rollback()
          Update Terraserver, ....
 void setDiskCache(java.lang.String inDirectory)
          Set the location on the disk where the caching of tiles should take place
 void setFilter(Filter inFilter)
          Terraserver datasource does not use filters, nothing is done with these.
 void setFromProjection(Projection inProjection)
          Sets the projection to use to convert from the storage media, source projection.
 void setImageHeight(int inHeight)
          Set the height of the image.
 void setImageType(int inImageType)
          Set the type of image to retrieve, choices are DOQ, or DRG
 void setImageWidth(int inWidth)
          Set the width of the image.
 void setMaxRetrySeconds(int inSeconds)
          Set the Maximum retry time.
 void setMemoryCache(int inMemoryCache)
          Set the number of tiles to keep in memory.
 void setName(java.lang.String inName)
          Set the name of this datasource for display purposes.
 void setNode(Node inNode)
          Set the configuration information for this data source
 void setOptimization(int inOptimize)
          Set the optimization level for this image
 void setPerformanceOutputStream(java.io.PrintStream inOutputStream)
           
 void setResolution(int inResolution)
          Set the resolution to use.
 void setToProjection(Projection inProjection, boolean inCacheProjected)
          Allows another projection to be used to convert to the screen projection.
 void setURLBase(java.lang.String inURLBase)
          Sets the URL location of the tile.asp script on terraserver
 void update(Record inRecord)
          Update Terraserver, ....
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TILE_WIDTH

public static final int TILE_WIDTH
See Also:
Constant Field Values

TILE_HEIGHT

public static final int TILE_HEIGHT
See Also:
Constant Field Values

DOQ

public static final int DOQ
See Also:
Constant Field Values

DRG

public static final int DRG
See Also:
Constant Field Values

myDiskCache

public java.lang.String myDiskCache
Location of the disk cache. Since downloading imagery several times can be burdensom on the network and computing resources involved, the disk cache may assist

Constructor Detail

TerraserverDataSource

public TerraserverDataSource()
Creates new TerraserverDataSource

Method Detail

setPerformanceOutputStream

public void setPerformanceOutputStream(java.io.PrintStream inOutputStream)

getDOQResolutions

public static int[] getDOQResolutions()
Retrieve the list of valid resolutions


getDRGResolutions

public static int[] getDRGResolutions()
Retrieve the list of valid resolutions


getImageType

public int getImageType()
Return the type of image to retrieve, choices are DOQ, or DRG


setImageType

public void setImageType(int inImageType)
Set the type of image to retrieve, choices are DOQ, or DRG


setResolution

public void setResolution(int inResolution)
                   throws java.lang.Exception
Set the resolution to use. Zero indicates that I should use the best guess.

Throws:
java.lang.Exception

setMaxRetrySeconds

public void setMaxRetrySeconds(int inSeconds)
Set the Maximum retry time. Occasionally, Terraserver will fail with a communications error of some time. This parameter specifies The maximum amount of time the applicaiton will spend retrying types while generating an image.


getMaxRetrySeconds

public int getMaxRetrySeconds()
Get the Maximum retry time. Occasionally, Terraserver will fail with a communications error of some time. This parameter specifies The maximum amount of time the applicaiton will spend retrying types while generating an image.


getName

public java.lang.String getName()
Return the name of this datasource for display to the user.

Specified by:
getName in interface DataSource

setName

public void setName(java.lang.String inName)
Set the name of this datasource for display purposes.

Specified by:
setName in interface DataSource

setFromProjection

public void setFromProjection(Projection inProjection)
                       throws java.lang.Exception
Sets the projection to use to convert from the storage media, source projection. It is expected that this projection will be run in reverse, to reverse project already projected data, and that it will not change often so it is OK for this to be done just once. This can not be set for this projection because it uses the same from projection.

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

getFromProjection

public Projection getFromProjection()
Description copied from interface: DataSource
Gets the projection to use to convert from the storage media, source projection. It is expected that this projection will be run in reverse, to reverse project already projected data, and that it will not change often so it is OK for this to be done just once.

Specified by:
getFromProjection in interface DataSource

setToProjection

public void setToProjection(Projection inProjection,
                            boolean inCacheProjected)
                     throws java.lang.Exception
Allows another projection to be used to convert to the screen projection. The CacheProjected flag indicates to the Data source that the to projection will not be changing often, and it is OK to project once and cache it. Setting this flag to false indicates to the DataSource that the toProjection will be changing often.

Specified by:
setToProjection in interface DataSource
Throws:
java.lang.Exception

getToProjection

public Projection getToProjection()
Return the projection this data source is to project to.

Specified by:
getToProjection in interface DataSource

setImageWidth

public void setImageWidth(int inWidth)
Set the width of the image. Images with a width of 0 or less will be optimized differently

Specified by:
setImageWidth in interface RasterDatasource

getImageWidth

public int getImageWidth()
Return the width of the image to generate


setImageHeight

public void setImageHeight(int inHeight)
Set the height of the image. Images with a height of 0 or less will be optimized differently

Specified by:
setImageHeight in interface RasterDatasource

getImageHeight

public int getImageHeight()
Return the height of the image to generate


setOptimization

public void setOptimization(int inOptimize)
Set the optimization level for this image


getOptimization

public int getOptimization()
Retrieve the optimization level for this image


getEnvelope

public Envelope getEnvelope()
                     throws java.lang.Exception
Returns the bounding rectangle of all the shapes in the shape file. This is more or less the entire USA, I am going to have to punt on this one.

Specified by:
getEnvelope in interface DataSource
Throws:
java.lang.Exception

update

public void update(Record inRecord)
            throws java.lang.Exception
Update Terraserver, .... Ya Right Update the data source with the changed record.

Specified by:
update in interface DataSource
Throws:
java.lang.Exception

commit

public void commit()
            throws java.lang.Exception
Update Terraserver, .... Ya Right Commit all changes since the last commit.

Specified by:
commit in interface DataSource
Throws:
java.lang.Exception

delete

public void delete(Record inRecord)
            throws java.lang.Exception
Delete data from Terraserver, .... Ya Right Delete this record from the database.

Specified by:
delete in interface DataSource
Throws:
java.lang.Exception

insert

public void insert(Record inRecord)
            throws java.lang.Exception
Update Terraserver, .... Ya Right Inserts the given record into the datasource.

Specified by:
insert in interface DataSource
Throws:
java.lang.Exception

rollback

public void rollback()
              throws java.lang.Exception
Update Terraserver, .... Ya Right Rollbacks are completely out of the question Rollback any changes to this datasource since the last commit.

Specified by:
rollback in interface DataSource
Throws:
java.lang.Exception

isUpdateable

public boolean isUpdateable()
Determines if this datasource is updateable. Uh, NO, Like I am so shure.

Specified by:
isUpdateable in interface DataSource

readDataset

public GISDataset readDataset()
                       throws java.lang.Exception
Reading all data from terraserver is not an option, nothing is returned.

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

readDataset

public GISDataset readDataset(Envelope inEnvelope)
                       throws java.lang.Exception
Reads only the items from the datasource that are within the envelope.

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

addDataSourceListener

public void addDataSourceListener(DataSourceListener inDataSourceListener)
Adds a datasource listener to this datasource.

Specified by:
addDataSourceListener in interface DataSource

removeDataSourceListener

public void removeDataSourceListener(DataSourceListener inDataSourceListener)
Removes the datasource lisener from this datasource.

Specified by:
removeDataSourceListener in interface DataSource

load

public void load(java.util.Properties inProperties)
Initialize the data source from the properties.


getURLBase

public java.lang.String getURLBase()
Returns the URL location of the tile.asp script on terraserver


setURLBase

public void setURLBase(java.lang.String inURLBase)
Sets the URL location of the tile.asp script on terraserver


getColor

public int getColor(double inX,
                    double inY,
                    int inUTMZone,
                    int inResolution,
                    int inScaleFactor,
                    TerraserverPerformanceLog inLog)
             throws java.net.MalformedURLException
returns the color of the pixel at the given location in UTM coordinates.

Throws:
java.net.MalformedURLException

setMemoryCache

public void setMemoryCache(int inMemoryCache)
Set the number of tiles to keep in memory. Each tile is 200x200 integers, so the amount of memory in bytes is 200x200x2 or 80,000 bytes for each tile.


getMemoryCache

public int getMemoryCache()
Return the number of tiles to keep in memory.


setDiskCache

public void setDiskCache(java.lang.String inDirectory)
Set the location on the disk where the caching of tiles should take place


getDiskCache

public java.lang.String getDiskCache()
Return the location on the disk where the caching of tiles should take place


getNode

public Node getNode()
Get the configuration information for this data source

Specified by:
getNode in interface DataSource

setNode

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

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

setFilter

public void setFilter(Filter inFilter)
Terraserver datasource does not use filters, nothing is done with these.

Specified by:
setFilter in interface DataSource

getFilter

public Filter getFilter()
Terraserver datasource does not use filters, always returns null.

Specified by:
getFilter in interface DataSource

getStyle

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

Specified by:
getStyle in interface DataSource