public class IlvShapeFileReader extends Object implements IlvLookAheadFeatureIterator
.shp
extension)
containing the geometries, an index file (.shx
extension)
allowing direct access to objects in the main file, and an attribute
table (.dbf
in dBASE
format).IlvManager
.
IlvMapLoader loader = new IlvMapLoader(manager); IlvShapeFileReader reader = new IlvShapeFileReader("file.shp", "file.dbf"); IlvFeatureRenderer renderer = new IlvDefaultFeatureRenderer(); loader.load(reader, renderer);
Constructor and Description |
---|
IlvShapeFileReader(IlvSHPReader shpReader,
IlvDBFReader dbfReader)
Creates an instance of
IlvShapeFileReader that uses the
specified specialized readers. |
IlvShapeFileReader(IlvSHPReader shpReader,
IlvDBFReader dbfReader,
IlvShapeFileIndex shxReader)
Creates an instance of
IlvShapeFileReader that uses the
specified specialized readers. |
IlvShapeFileReader(String shapeFileName,
String dbfFileName)
Creates an instance of
IlvShapeFileReader for the specified files. |
IlvShapeFileReader(String shapeFileName,
String dbfFileName,
String shxFileName)
Creates an instance of
IlvShapeFileReader for the specified
files. |
IlvShapeFileReader(URL shapeURL,
URL dbfURL)
Creates an instance of
IlvShapeFileReader for the specified
URLs. |
IlvShapeFileReader(URL shape,
URL dbf,
URL shx)
Creates an instance of
IlvShapeFileReader for the specified
URL. |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Releases the resources allocated to the reader.
|
void |
finalize()
Called by the Java Garbage Collector to release
the resources allocated to the reader.
|
IlvCoordinateSystem |
getCoordinateSystem()
Returns the spatial reference system that describes the coordinate
system of geometric coordinates of the map features.
|
IlvDBFReader |
getDBFReader()
Returns the reader of the
.dbf file. |
IlvFeatureRenderer |
getDefaultFeatureRenderer()
Returns the default feature renderer for this reader.
|
IlvMapFeature |
getFeatureAt(int index)
Returns the feature located at the specified index.
|
IlvCoordinate |
getLowerRightCorner()
Returns the lower-right corner of the bounding box that delimits the
content of the
.shp file. |
IlvMapFeature |
getNextFeature()
Returns the next map feature read from the Shapefile.
|
Object |
getNextFeatureId()
Returns the ID of the next feature.
|
int |
getNextFeatureIndex()
Returns the index of the next feature that is read.
|
IlvSHPReader |
getSHPReader()
Returns the reader of the
.shp file. |
IlvCoordinate |
getUpperLeftCorner()
Returns the upper-left corner of the bounding box that delimits the
content of the
.shp file. |
boolean |
isGeoreferenced()
Returns
false unless the IlvSHPReader has
been subclassed. |
boolean |
isLoadingAttributes()
Specifies whether this reader is reading auxiliary attributes.
|
void |
setCoordinateSystem(IlvCoordinateSystem cs)
Sets the coordinate system for this reader.
|
boolean |
skipNextFeature()
Skips the next feature available from this feature iterator.
|
public IlvShapeFileReader(String shapeFileName, String dbfFileName) throws IOException
IlvShapeFileReader
for the specified files.shapeFileName
- The name of the Shapefile
(with a .shp
or .SHP
extension).dbfFileName
- The name of the attribute file
(with a .dbf
or .DBF
extension).IOException
public IlvShapeFileReader(String shapeFileName, String dbfFileName, String shxFileName) throws IOException
IlvShapeFileReader
for the specified
files. This constructor is the only one that allows direct access to
all Shapefiles, using the .shx
file to access graphic
objects.shapeFileName
- The name of the Shapefile
(with a .shp
or .SHP
extension).dbfFileName
- The name of the attribute file
(with a .dbf
or .DBF
extension).
If null
, no attribute is read.shxFileName
- The name of the index file
(with a .shx
or .SHX
extension).IOException
public IlvShapeFileReader(URL shape, URL dbf, URL shx) throws IOException
IlvShapeFileReader
for the specified
URL. This constructor allows direct access to
all Shapefiles, using the .shx
file to access graphic
objects.shape
- The name of the Shapefile
(with a .shp
or .SHP
extension).dbf
- The name of the attribute file
(with a .dbf
or .DBF
extension).
If null
, no attribute is read.shx
- The name of the index file
(with a .shx
or .SHX
extension).IOException
public IlvShapeFileReader(IlvSHPReader shpReader, IlvDBFReader dbfReader) throws IOException
IlvShapeFileReader
that uses the
specified specialized readers.shpReader
- The reader for the .shp
file.dbfReader
- The reader for the .dbf
file.IOException
public IlvShapeFileReader(IlvSHPReader shpReader, IlvDBFReader dbfReader, IlvShapeFileIndex shxReader) throws IOException
IlvShapeFileReader
that uses the
specified specialized readers.shpReader
- The reader for the .shp
file.dbfReader
- The reader for the .dbf
file.shxReader
- The reader for the .shx
file.IOException
public IlvShapeFileReader(URL shapeURL, URL dbfURL) throws IOException
IlvShapeFileReader
for the specified
URLs.shapeURL
- The URL of the Shapefile.dbfURL
- The URL of the attribute file.IOException
public IlvMapFeature getNextFeature() throws IOException
getNextFeature
is called again.getNextFeature
in interface IlvMapFeatureIterator
IlvMapFeature
read.IOException
- if an error occurs while reading the data.public IlvMapFeature getFeatureAt(int index) throws IOException
IlvShapeFileReader
has been constructed with
a .shx
file.index
- The location of the feature.IlvMapFeature
read or null
if an error occurs.IOException
- if an error occurs.UnsupportedOperationException
- if this operation is not
supported on this IlvShapeFileReader
.IllegalArgumentException
- if there is no feature at the
specified index.public int getNextFeatureIndex()
public Object getNextFeatureId() throws IOException
java.lang.Integer
.getNextFeatureId
in interface IlvLookAheadFeatureIterator
new java.lang.Integer(getNextFeatureIndex())
.IOException
public void setCoordinateSystem(IlvCoordinateSystem cs)
public boolean skipNextFeature() throws IOException
skipNextFeature
in interface IlvLookAheadFeatureIterator
true
if the skipped feature is not the last feature. In JViews 4.0, the
return type of this method was void
.IOException
public boolean isLoadingAttributes()
public boolean isGeoreferenced()
false
unless the IlvSHPReader
has
been subclassed.isGeoreferenced
in interface IlvMapFeatureIterator
public IlvCoordinateSystem getCoordinateSystem()
getCoordinateSystem
in interface IlvMapFeatureIterator
null
if the coordinate system is unknown.public IlvCoordinate getUpperLeftCorner()
.shp
file.getUpperLeftCorner
in interface IlvMapFeatureIterator
public IlvCoordinate getLowerRightCorner()
.shp
file.getLowerRightCorner
in interface IlvMapFeatureIterator
public IlvFeatureRenderer getDefaultFeatureRenderer()
getDefaultFeatureRenderer
in interface IlvMapFeatureIterator
public void dispose()
dispose
in interface IlvMapFeatureIterator
public IlvSHPReader getSHPReader()
.shp
file.
This reader should not be modified
or used to read geometries or it might be left in an
inconsistent state.public IlvDBFReader getDBFReader()
.dbf
file.
This reader should not be modified
or used to read attributes or it might be left in an
inconsistent state.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.