ucar.visad
Class ShapefileAdapter

java.lang.Object
  extended by ucar.visad.ShapefileAdapter

public class ShapefileAdapter
extends Object

Provides support for ShapeFiles in VisAD.

Author:
Don Murray?

Field Summary
static String ATTR_POINTS
          map xml attribute
protected  UnionSet mapLines
          resulting maplines
protected  EsriShapefile shapefile
          shapefile
static String TAG_POLYGON
          map xml tag
 
Constructor Summary
ShapefileAdapter(EsriShapefile shapefile)
          From an ESRI shapefile extract all features into an in-memory structure.
ShapefileAdapter(InputStream iStream)
          Read an ESRI shapefile and extract all features into an in-memory structure.
ShapefileAdapter(InputStream iStream, Rectangle2D bBox)
          Read an ESRI shapefile and extract all features into an in-memory structure.
ShapefileAdapter(InputStream iStream, Rectangle2D bBox, double coarseness)
          Read an ESRI shapefile and extract all features into an in-memory structure.
ShapefileAdapter(InputStream iStream, String filename)
          constructor
ShapefileAdapter(String filename)
          Read an ESRI shapefile and extract all features into an in-memory structure.
ShapefileAdapter(String filename, double coarseness)
          Read an ESRI shapefile and extract all features into an in-memory structure.
ShapefileAdapter(String filename, Rectangle2D bBox)
          Read an ESRI shapefile and extract all features into an in-memory structure.
ShapefileAdapter(String filename, Rectangle2D bBox, double coarseness)
          Read an ESRI shapefile and extract all features into an in-memory structure.
ShapefileAdapter(URL url)
          Read an ESRI shapefile from a URL and extract all features into an in-memory structure.
ShapefileAdapter(URL url, double coarseness)
          Read an ESRI shapefile from a URL and extract all features into an in-memory structure.
ShapefileAdapter(URL url, Rectangle2D bBox)
          Read an ESRI shapefile and extract the subset of features that have bounding boxes that intersect a specified bounding box
ShapefileAdapter(URL url, Rectangle2D bBox, double coarseness)
          Read an ESRI shapefile and extract the subset of features that have bounding boxes that intersect a specified bounding box
 
Method Summary
 UnionSet getData()
          getData creates a VisAD UnionSet type with the MathType specified thru one of the other methods.
 DbaseFile getDbFile()
          Get the db file.
 int getFeatureType()
          What is the feature type
static UnionSet makeSet(List sets)
          Utility to make a set
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TAG_POLYGON

public static final String TAG_POLYGON
map xml tag

See Also:
Constant Field Values

ATTR_POINTS

public static final String ATTR_POINTS
map xml attribute

See Also:
Constant Field Values

shapefile

protected EsriShapefile shapefile
shapefile


mapLines

protected UnionSet mapLines
resulting maplines

Constructor Detail

ShapefileAdapter

public ShapefileAdapter(String filename)
                 throws IOException,
                        VisADException
Read an ESRI shapefile and extract all features into an in-memory structure.

Parameters:
filename - name of ESRI shapefile (typically has ".shp" extension)
Throws:
IOException
VisADException

ShapefileAdapter

public ShapefileAdapter(URL url)
                 throws IOException,
                        VisADException
Read an ESRI shapefile from a URL and extract all features into an in-memory structure.

Parameters:
url - URL of ESRI shapefile
Throws:
IOException
VisADException

ShapefileAdapter

public ShapefileAdapter(URL url,
                        Rectangle2D bBox)
                 throws IOException,
                        VisADException
Read an ESRI shapefile and extract the subset of features that have bounding boxes that intersect a specified bounding box

Parameters:
url - URL of ESRI shapefile
bBox - bounding box specifying which features to select, namely those whose bounding boxes intersect this one. If null, bounding box of whole shapefile is used
Throws:
IOException
VisADException

ShapefileAdapter

public ShapefileAdapter(String filename,
                        Rectangle2D bBox)
                 throws IOException,
                        VisADException
Read an ESRI shapefile and extract all features into an in-memory structure.

Parameters:
filename - name of ESRI shapefile
bBox - bounding box specifying which features to select, namely those whose bounding boxes intersect this one. If null, bounding box of whole shapefile is used
Throws:
IOException
VisADException

ShapefileAdapter

public ShapefileAdapter(String filename,
                        double coarseness)
                 throws IOException,
                        VisADException
Read an ESRI shapefile and extract all features into an in-memory structure.

Parameters:
filename - name of ESRI shapefile (typically has ".shp" extension)
coarseness - resolution vs. speed parameter. 0.0 for best resolution, 0.1 for good resolution with 10:1 zooms, etc.
Throws:
IOException
VisADException

ShapefileAdapter

public ShapefileAdapter(URL url,
                        double coarseness)
                 throws IOException,
                        VisADException
Read an ESRI shapefile from a URL and extract all features into an in-memory structure.

Parameters:
url - URL of ESRI shapefile
coarseness - resolution vs. speed parameter. 0.0 for best resolution, 0.1 for good resolution with 10:1 zooms, etc.
Throws:
IOException
VisADException

ShapefileAdapter

public ShapefileAdapter(URL url,
                        Rectangle2D bBox,
                        double coarseness)
                 throws IOException,
                        VisADException
Read an ESRI shapefile and extract the subset of features that have bounding boxes that intersect a specified bounding box

Parameters:
url - URL of ESRI shapefile
bBox - bounding box specifying which features to select, namely those whose bounding boxes intersect this one. If null, bounding box of whole shapefile is used
coarseness - resolution vs. speed parameter. 0.0 for best resolution, 0.1 for good resolution with 10:1 zooms, etc.
Throws:
IOException
VisADException

ShapefileAdapter

public ShapefileAdapter(String filename,
                        Rectangle2D bBox,
                        double coarseness)
                 throws IOException,
                        VisADException
Read an ESRI shapefile and extract all features into an in-memory structure.

Parameters:
filename - name of ESRI shapefile
bBox - bounding box specifying which features to select, namely those whose bounding boxes intersect this one. If null, bounding box of whole shapefile is used
coarseness - resolution vs. speed parameter. 0.0 for best resolution, 0.1 for good resolution with 10:1 zooms, etc.
Throws:
IOException
VisADException

ShapefileAdapter

public ShapefileAdapter(InputStream iStream)
                 throws IOException,
                        VisADException
Read an ESRI shapefile and extract all features into an in-memory structure.

Parameters:
iStream - input from which to read
Throws:
IOException
VisADException

ShapefileAdapter

public ShapefileAdapter(InputStream iStream,
                        Rectangle2D bBox)
                 throws IOException,
                        VisADException
Read an ESRI shapefile and extract all features into an in-memory structure.

Parameters:
iStream - input from which to read
bBox - bounding box specifying which features to select, namely those whose bounding boxes intersect this one. If null, bounding box of whole shapefile is used
Throws:
IOException
VisADException

ShapefileAdapter

public ShapefileAdapter(InputStream iStream,
                        String filename)
                 throws IOException,
                        VisADException
constructor

Parameters:
iStream - Inputstream
filename - Filename where we got the input stream
Throws:
IOException - On badness
VisADException - On badness

ShapefileAdapter

public ShapefileAdapter(InputStream iStream,
                        Rectangle2D bBox,
                        double coarseness)
                 throws IOException,
                        VisADException
Read an ESRI shapefile and extract all features into an in-memory structure.

Parameters:
iStream - input from which to read
bBox - bounding box specifying which features to select, namely those whose bounding boxes intersect this one. If null, bounding box of whole shapefile is used
coarseness - of plotting, 0.0 for best resolution, 0.1 for good resoution at 10:1 zoom, etc. Higher values make things display a bit faster.
Throws:
IOException
VisADException

ShapefileAdapter

public ShapefileAdapter(EsriShapefile shapefile)
                 throws VisADException
From an ESRI shapefile extract all features into an in-memory structure.

Parameters:
shapefile - input from which to extract features
Throws:
VisADException
Method Detail

makeSet

public static UnionSet makeSet(List sets)
                        throws VisADException
Utility to make a set

Parameters:
sets - List of sets
Throws:
VisADException - On badness

getFeatureType

public int getFeatureType()
What is the feature type

Returns:
Feature type

getDbFile

public DbaseFile getDbFile()
Get the db file. May be null.

Returns:
db file

getData

public UnionSet getData()
getData creates a VisAD UnionSet type with the MathType specified thru one of the other methods. By default, the MathType is a RealTupleType of Latitude,Longitude, so the UnionSet (a union of Gridded2DSets) will have lat/lon values. Each Gridded2DSet is a line segment that is supposed to be drawn as a continuous line. The UnionSet is null if there are no maplines in the domain of the display.

Returns:
the data as a UnionSet