public class IlvSHPReader extends Object implements IlvLookAheadFeatureIterator
.shp
extension.
It implements the IlvMapFeatureIterator
class.
This class does not read the Shapefile attributes that are stored in
.dbf
files. To read .shp
and .dbf
files together, you must use an IlvShapeFileReader
.This implBeforeementation reads only 2D geometries and stores the additional values of 3D geometries and of geometries associated with values as attributes.
IlvShapeFileReader
Modifier and Type | Field and Description |
---|---|
static int |
MULTIPATCH
The Multiple Surface Patch shape type
|
static int |
MULTIPOINT
The MULTIPOINT shape type
|
static int |
MULTIPOINTM
The Measure MULTIPOINT shape type
|
static int |
MULTIPOINTZ
The 3D MULTIPOINT shape type
|
static int |
NULL
The NULL shape type
|
static int |
POINT
The POINT shape type
|
static int |
POINTM
The Measure POINT shape type
|
static int |
POINTZ
The 3D POINT shape type
|
static int |
POLYGON
The POLYGON shape type
|
static int |
POLYGONM
The Measure POLYGON shape type
|
static int |
POLYGONZ
The 3D POLYGON shape type
|
static int |
POLYLINE
The POLYLINE shape type
|
static int |
POLYLINEM
The Measure POLYLINE shape type
|
static int |
POLYLINEZ
The 3D POLYLINE shape type
|
Constructor and Description |
---|
IlvSHPReader(DataInput dataInput)
Initializes an
IlvSHPReader for the specified
DataInput . |
IlvSHPReader(String fileName)
Initializes an
IlvSHPReader for the specified file. |
IlvSHPReader(String shpFile,
String shxFile)
Initializes an
IlvSHPReader to read data from the specified file,
with the specified index file. |
IlvSHPReader(URL url)
Initializes an
IlvSHPReader for the specified URL. |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Releases the resources allocated to the reader.
|
void |
finalize()
Is called by the Java Garbage Collector to release
the resources allocated to the reader.
|
IlvAttributeInfoProperty |
getAttributeInfo()
Returns the description of the attributes that are generated
by the shape reader.
|
IlvCoordinateSystem |
getCoordinateSystem()
Returns the spatial reference system that describes the coordinate
system of geometric coordinates of the map features.
|
IlvFeatureRenderer |
getDefaultFeatureRenderer()
Returns the default renderer used to display the map features returned
by the reader.
|
IlvMapFeature |
getFeatureAt(int index)
Returns the feature located at the specified index.
|
protected IlvMapInput |
getInput()
Returns the
IlvMapInput instance used to
read the Shapefile. |
IlvCoordinate |
getLowerRightCorner()
Returns the lower-right corner of the bounding box that delimits the objects
read from the file.
|
double |
getMaxMeasure()
Returns the maximum value of the measurements.
|
double |
getMinMeasure()
Returns the minimum value of the measurements.
|
IlvMapFeature |
getNextFeature()
Reads the next record from the file.
|
Object |
getNextFeatureId()
Returns the ID of the next feature.
|
int |
getNextFeatureIndex()
Returns the index of the next feature that is read.
|
int |
getShapeType()
Returns the shape type of the objects contained in the file.
|
String |
getShapeTypeDescription()
Returns a string describing the shape type contained in the file.
|
IlvCoordinate |
getUpperLeftCorner()
Returns the upper-left corner of the bounding box that delimits the objects
read from the file.
|
double |
getZMax()
Returns the maximum elevation.
|
double |
getZMin()
Returns the minimum elevation.
|
boolean |
isGeoreferenced()
This function of the
IlvMapFeatureIterator interface
returns true if a coordinate system has been set and
false otherwise . |
protected IlvMapFeature |
readMultiPointMShape()
Reads a MULTIPOINTM shape.
|
protected IlvMapFeature |
readMultiPointShape()
Reads a MULTIPOINT shape.
|
protected IlvMapFeature |
readMultiPointZShape()
Reads a MULTIPOINTZ shape.
|
protected IlvMapFeature |
readNullShape()
Returns a shape where geometry and attributes of the map feature returned
are set to
null . |
protected IlvMapFeature |
readPointMShape()
Reads a POINTM shape.
|
protected IlvMapFeature |
readPointShape()
Reads a POINT shape.
|
protected IlvMapFeature |
readPointZShape()
Reads a POINTZ shape.
|
protected IlvMapFeature |
readPolygonMShape()
Reads a POLYGONM shape.
|
protected IlvMapFeature |
readPolygonShape()
Reads a POLYGON from the Shapefile, that is, a
IlvMapMultiArea . |
protected IlvMapFeature |
readPolygonZShape()
Reads a POLYGONZ shape.
|
protected IlvMapFeature |
readPolylineMShape()
Reads a POLYLINEM shape.
|
protected IlvMapFeature |
readPolylineShape()
Reads a POLYLINE from the Shapefile, that is, a
IlvMapMultiCurve . |
protected IlvMapFeature |
readPolylineZShape()
Reads a POLYLINEZ shape.
|
void |
setCoordinateSystem(IlvCoordinateSystem cs)
Sets the coordinate system for this reader.
|
boolean |
skipNextFeature()
Skips the next feature available from this feature iterator.
|
public static final int NULL
public static final int POINT
public static final int POLYLINE
public static final int POLYGON
public static final int MULTIPOINT
public static final int POINTZ
public static final int POLYLINEZ
public static final int POLYGONZ
public static final int MULTIPOINTZ
public static final int POINTM
public static final int POLYLINEM
public static final int POLYGONM
public static final int MULTIPOINTM
public static final int MULTIPATCH
public IlvSHPReader(String fileName) throws IOException, IlvMapFormatException
IlvSHPReader
for the specified file.fileName
- The name of the Shapefile (with the .shp
extension).IOException
- If an error occurs while opening the file.IlvMapFormatException
- If the file contains a format error.public IlvSHPReader(String shpFile, String shxFile) throws IOException, IlvMapFormatException
IlvSHPReader
to read data from the specified file,
with the specified index file.shpFile
- The name of the Shapefile (with the .shp
extension).shxFile
- The name of the Shapefile index (with the .shx
extension).IOException
- If an error occurs while opening the file.IlvMapFormatException
- If the file contains a format error.public IlvSHPReader(URL url) throws IOException, IlvMapFormatException
IlvSHPReader
for the specified URL.url
- The URL of the Shapefile (with the .shp
extension).IOException
- If an error occurs while opening the file.IlvMapFormatException
- If the file contains a format error.public IlvSHPReader(DataInput dataInput) throws IOException, IlvMapFormatException
IlvSHPReader
for the specified
DataInput
.dataInput
- The data input containing the shape data.IOException
- If an error occurs while reading the input stream.IlvMapFormatException
- If the file contains a format error.public IlvAttributeInfoProperty getAttributeInfo()
null
value.public void dispose()
dispose
in interface IlvMapFeatureIterator
public void finalize()
dispose
method
was not called, it releases the resources used by the reader.public final int getShapeType()
public String getShapeTypeDescription()
public IlvCoordinate getUpperLeftCorner()
getUpperLeftCorner
in interface IlvMapFeatureIterator
public IlvCoordinate getLowerRightCorner()
getLowerRightCorner
in interface IlvMapFeatureIterator
public double getZMin()
public double getZMax()
public double getMinMeasure()
public double getMaxMeasure()
public IlvMapFeature getFeatureAt(int index) throws IOException
IlvSHPReader
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 IlvSHPReader
.IllegalArgumentException
- If there is no feature at the
specified index.public IlvMapFeature getNextFeature() throws IOException, IlvMapFormatException
getNextFeature
in interface IlvMapFeatureIterator
IOException
- If an error occurs while reading the file.IlvMapFormatException
- If the file contains a format error.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
- If an error occurs while reading the file.IlvMapFormatException
- If the file contains a format error.EOFException
- If there are no more features to skip.public int getNextFeatureIndex()
public Object getNextFeatureId() throws IOException
java.lang.Integer
.getNextFeatureId
in interface IlvLookAheadFeatureIterator
new java.lang.Integer(getNextFeatureIndex())
.IOException
protected IlvMapFeature readNullShape() throws IOException
null
.null
shape.IOException
- If an error occurs while reading the data.protected IlvMapFeature readPointShape() throws IOException
IOException
- If an error occurs while reading the data.protected IlvMapFeature readPointMShape() throws IOException
IOException
- If an error occurs while reading the data.protected IlvMapFeature readPointZShape() throws IOException
IException
- If an error occurs while reading the data.IOException
protected IlvMapFeature readMultiPointShape() throws IOException
IOException
- If an error occurs while reading the data.protected IlvMapFeature readMultiPointMShape() throws IOException
IOException
- If an error occurs while reading the data.protected IlvMapFeature readMultiPointZShape() throws IOException
IOException
- If an error occurs while reading the file.protected IlvMapFeature readPolylineShape() throws IOException
IlvMapMultiCurve
.IOException
- If an error occurs while reading the data.protected IlvMapFeature readPolylineMShape() throws IOException
IOException
- If an error occurs while reading the data.protected IlvMapFeature readPolylineZShape() throws IOException
IOException
- If an error occurs while reading the data.protected IlvMapFeature readPolygonShape() throws IOException
IlvMapMultiArea
.IOException
- If an error occurs while reading the data.protected IlvMapFeature readPolygonMShape() throws IOException
IOException
- If an error occurs while reading the data.protected IlvMapFeature readPolygonZShape() throws IOException
IOException
- If an error occurs while reading the data.protected IlvMapInput getInput()
IlvMapInput
instance used to
read the Shapefile.public IlvCoordinateSystem getCoordinateSystem()
getCoordinateSystem
in interface IlvMapFeatureIterator
setCoordinateSystem
method.public void setCoordinateSystem(IlvCoordinateSystem cs)
public boolean isGeoreferenced()
IlvMapFeatureIterator
interface
returns true
if a coordinate system has been set and
false
otherwise .isGeoreferenced
in interface IlvMapFeatureIterator
public IlvFeatureRenderer getDefaultFeatureRenderer()
getDefaultFeatureRenderer
in interface IlvMapFeatureIterator
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.