nl.javel.gisbeans.io.esri
Class ShapeFile

java.lang.Object
  extended by nl.javel.gisbeans.io.esri.ShapeFile
All Implemented Interfaces:
Serializable, DataSourceInterface

public class ShapeFile
extends Object
implements DataSourceInterface

This class reads ESRI-shapefiles and returns the shape object

Since:
JDK 1.2
Version:
1.0
Author:
Peter Jacobs
Paul Jacobs
See Also:
Serialized Form

Field Summary
static int MULTIPATCH
          the MULTIPATCH as defined by ESRI
static int MULTIPOINT
          the MULTIPOINT as defined by ESRI
static int MULTIPOINTM
          the MULTIPOINTM as defined by ESRI
static int MULTIPOINTZ
          the MULTIPOINTZ as defined by ESRI
static int NULLSHAPE
          the NULLSHAPE as defined by ESRI
static int POINT
          the POINT as defined by ESRI
static int POINTM
          the POINM as defined by ESRI
static int POINTZ
          the POINTZ as defined by ESRI
static int POLYGON
          the POLYGON as defined by ESRI
static int POLYGONM
          the POLYGONM as defined by ESRI
static int POLYGONZ
          the POLYGONZ as defined by ESRI
static int POLYLINE
          the POLYLINE as defined by ESRI
static int POLYLINEM
          the POLYLINEM as defined by ESRI
static int POLYLINEZ
          the POLYLINEZ as defined by ESRI
 
Constructor Summary
ShapeFile(URL url)
          constructs a new ESRI ShapeFile
 
Method Summary
 String[][] getAttributes()
          returns the attribute data
 String[] getColumnNames()
          returns the columnNames of the attribute data
 URL getDataSource()
          returns the URL of the datasource
 int getNumShapes()
          returns the number of shapes of the particular datasource
 GisObject getShape(int index)
          getter for a specific shape at a certain index point in shapefile
 List getShapes()
          getter for all shapes in a shapefile
 List getShapes(Rectangle2D extent)
          getter for all shapes intersecting with a certain extent
 List getShapes(String attribute, String columnName)
          getter for all shapes intersecting with a certain extent
 int getType()
          getter for the type
 boolean isCache()
           
 void setCache(boolean cache)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULLSHAPE

public static final int NULLSHAPE
the NULLSHAPE as defined by ESRI

See Also:
Constant Field Values

POINT

public static final int POINT
the POINT as defined by ESRI

See Also:
Constant Field Values

POLYLINE

public static final int POLYLINE
the POLYLINE as defined by ESRI

See Also:
Constant Field Values

POLYGON

public static final int POLYGON
the POLYGON as defined by ESRI

See Also:
Constant Field Values

MULTIPOINT

public static final int MULTIPOINT
the MULTIPOINT as defined by ESRI

See Also:
Constant Field Values

POINTZ

public static final int POINTZ
the POINTZ as defined by ESRI

See Also:
Constant Field Values

POLYLINEZ

public static final int POLYLINEZ
the POLYLINEZ as defined by ESRI

See Also:
Constant Field Values

POLYGONZ

public static final int POLYGONZ
the POLYGONZ as defined by ESRI

See Also:
Constant Field Values

MULTIPOINTZ

public static final int MULTIPOINTZ
the MULTIPOINTZ as defined by ESRI

See Also:
Constant Field Values

POINTM

public static final int POINTM
the POINM as defined by ESRI

See Also:
Constant Field Values

POLYLINEM

public static final int POLYLINEM
the POLYLINEM as defined by ESRI

See Also:
Constant Field Values

POLYGONM

public static final int POLYGONM
the POLYGONM as defined by ESRI

See Also:
Constant Field Values

MULTIPOINTM

public static final int MULTIPOINTM
the MULTIPOINTM as defined by ESRI

See Also:
Constant Field Values

MULTIPATCH

public static final int MULTIPATCH
the MULTIPATCH as defined by ESRI

See Also:
Constant Field Values
Constructor Detail

ShapeFile

public ShapeFile(URL url)
          throws IOException
constructs a new ESRI ShapeFile

Parameters:
url - URL may or may not end with their extension.
Throws:
IOException - throws an IOException if the shxFile is not accessable
Method Detail

isCache

public boolean isCache()
Returns:
Returns the cache.

setCache

public void setCache(boolean cache)
Parameters:
cache - The cache to set.

getColumnNames

public String[] getColumnNames()
Description copied from interface: DataSourceInterface
returns the columnNames of the attribute data

Specified by:
getColumnNames in interface DataSourceInterface
Returns:
String[]
See Also:
DataSourceInterface.getColumnNames()

getAttributes

public String[][] getAttributes()
                         throws IOException
Description copied from interface: DataSourceInterface
returns the attribute data

Specified by:
getAttributes in interface DataSourceInterface
Returns:
the attributes
Throws:
IOException - on IOException
See Also:
DataSourceInterface.getAttributes()

getDataSource

public URL getDataSource()
Description copied from interface: DataSourceInterface
returns the URL of the datasource

Specified by:
getDataSource in interface DataSourceInterface
Returns:
URL the URL of the file
See Also:
DataSourceInterface.getDataSource()

getNumShapes

public int getNumShapes()
Description copied from interface: DataSourceInterface
returns the number of shapes of the particular datasource

Specified by:
getNumShapes in interface DataSourceInterface
Returns:
int the number of shapes
See Also:
DataSourceInterface.getNumShapes()

getShape

public GisObject getShape(int index)
                   throws IOException
getter for a specific shape at a certain index point in shapefile

Specified by:
getShape in interface DataSourceInterface
Parameters:
index - the index of the shape
Returns:
Object shape
Throws:
IOException - on IOfailure

getShapes

public List getShapes()
               throws IOException
getter for all shapes in a shapefile

Specified by:
getShapes in interface DataSourceInterface
Returns:
HashMap (Object shape)
Throws:
IOException - on IOfailure

getShapes

public List getShapes(Rectangle2D extent)
               throws IOException
getter for all shapes intersecting with a certain extent

Specified by:
getShapes in interface DataSourceInterface
Parameters:
extent - the extent to get
Returns:
HashMap (Object shape)
Throws:
IOException - on IOfailure

getShapes

public List getShapes(String attribute,
                      String columnName)
               throws IOException
getter for all shapes intersecting with a certain extent

Specified by:
getShapes in interface DataSourceInterface
Parameters:
attribute - the attribute
columnName - the name of the dbfColumn
Returns:
the list of shapes
Throws:
IOException - on IO exception

getType

public int getType()
getter for the type

Specified by:
getType in interface DataSourceInterface
Returns:
int