This class reads geometries from .shp
files.
More...
#include <ilviews/maps/format/shapefile/shpreader.h>
Public Member Functions | |
IlvShapeSHPReader (const char *fileName, const char *shxName=0) | |
Initializes a new IlvShapeSHPReader to read from a Shapefile file. More... | |
IlvShapeSHPReader (std::istream &shpStream, std::istream &shxStream) | |
Initializes a new IlvShapeSHPReader to read from the specified input streams. More... | |
IlvShapeSHPReader (std::istream &stream) | |
Initializes a new IlvShapeSHPReader to read from an input stream. More... | |
IlvFeatureRenderer * | getDefaultFeatureRenderer (IlvDisplay *display) |
Returns the default renderer for this feature iterator. More... | |
virtual const IlvMapFeature * | getFeatureAt (IlInt index, IlvMapsError &status) |
Returns the feature located at the specified index. More... | |
const IlvFeatureAttributeInfo * | getFeatureAttributeInfo (IlvMapsError &status) const |
Returns the description of the attributes that are generated by the shape reader. More... | |
IlvMapsError | getInitStatus () const |
Checks the initialization status of this reader. More... | |
IlBoolean | getLowerRightCorner (IlvCoordinate &result) const |
Returns the lower right corner of the rectangle containing all the map features of this iterator. More... | |
IlvMapInput * | getMapInput () |
Returns the map input of this reader. More... | |
const IlvMapFeature * | getNextFeature (IlvMapsError &status) |
Returns the next available feature. More... | |
virtual IlvMapFeatureId * | getNextFeatureId (IlvMapsError &status) |
Returns the ID of the next feature. More... | |
virtual IlInt | getNextFeatureIndex () |
Returns the index of the next feature that is read. More... | |
const IlvProjection * | getProjection () const |
Returns the projection of geometries of this feature iterator. More... | |
IlvShapeFileIndex * | getShapeFileIndex () const |
Returns the Shapefile index reader. More... | |
IlvShapeType | getShapeType () const |
Returns the shape type of the objects contained in the file. More... | |
IlBoolean | getUpperLeftCorner (IlvCoordinate &result) const |
Returns the upper left corner of the rectangle containing all the map features of this iterator. More... | |
virtual void | setNextFeatureIndex (IlInt index) |
Sets the index of the next feature that is read. More... | |
void | setSourceProjection (IlvProjection *projection) |
Sets the projection of geometries generated by this feature iterator. More... | |
virtual IlBoolean | skipNextFeature (IlvMapsError &status) |
Skips the next feature available from this feature iterator. More... | |
Public Member Functions inherited from IlvLookAheadFeatureIterator | |
virtual | ~IlvLookAheadFeatureIterator () |
Destructor. | |
Public Member Functions inherited from IlvMapFeatureIterator | |
virtual IlvClassInfo * | getClassInfo () const =0 |
Returns the class information for this feature iterator. More... | |
Protected Member Functions | |
IlvMapInput & | getInput () |
Returns the map input of this reader. More... | |
virtual IlvMapFeature * | readMultiPointMShape (IlvMapsError &status) |
Reads a MULTIPOINTM from the Shapefile. More... | |
virtual IlvMapFeature * | readMultiPointShape (IlvMapsError &status) |
Reads a MULTIPOINT from the Shapefile. More... | |
virtual IlvMapFeature * | readMultiPointZShape (IlvMapsError &status) |
Reads a MULTIPOINTZ from the Shapefile. More... | |
virtual IlvMapFeature * | readPointMShape (IlvMapsError &status) |
Reads a POINTM shape. More... | |
virtual IlvMapFeature * | readPointShape (IlvMapsError &status) |
Reads a POINT shape. More... | |
virtual IlvMapFeature * | readPointZShape (IlvMapsError &status) |
Reads a POINTZ shape. More... | |
virtual IlvMapFeature * | readPolygonMShape (IlvMapsError &status) |
Reads a POLYGONM from the Shapefile. More... | |
virtual IlvMapFeature * | readPolygonShape (IlvMapsError &status) |
Reads a POLYGON from the Shapefile. More... | |
virtual IlvMapFeature * | readPolygonZShape (IlvMapsError &status) |
Reads a POLYGONZ from the Shapefile. More... | |
virtual IlvMapFeature * | readPolylineMShape (IlvMapsError &status) |
Reads a POLYLINEM from the Shapefile. More... | |
virtual IlvMapFeature * | readPolylineShape (IlvMapsError &status) |
Reads a POLYLINE from the Shapefile. More... | |
virtual IlvMapFeature * | readPolylineZShape (IlvMapsError &status) |
Reads a POLYLINEZ from the Shapefile. More... | |
virtual void | setInitStatus (IlvMapsError status) |
Sets the initialization status of this reader. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from IlvMapFeatureIterator | |
static IlvClassInfo * | ClassInfo () |
Returns the class information of the class. More... | |
static IlvClassInfo ** | ClassInfoRef () |
Returns the address of the class information of the class. More... | |
This class reads geometries from .shp
files.
Library: ilvmaps
This class can be used to read Shapefiles with the .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 implementation reads only 2D geometries and stores the additonnal values of 3D geometries with values as attribute.
IlvShapeFileReader
, IlvShapeDBFReader
. IlvShapeSHPReader::IlvShapeSHPReader | ( | const char * | fileName, |
const char * | shxName = 0 |
||
) |
Initializes a new IlvShapeSHPReader
to read from a Shapefile file.
You can also specify an index (.shx
) file name if you want to perform random access on geometries through the getFeatureAt()
method.
fileName | The name of the .shp input file. |
shxName | The name of an .shx input file. |
IlvShapeSHPReader::IlvShapeSHPReader | ( | std::istream & | stream | ) |
Initializes a new IlvShapeSHPReader
to read from an input stream.
stream | The input stream. |
IlvShapeSHPReader::IlvShapeSHPReader | ( | std::istream & | shpStream, |
std::istream & | shxStream | ||
) |
Initializes a new IlvShapeSHPReader
to read from the specified input streams.
With this constructor, in addition to the stream opened on a Shapefile file, you can specify a stream opened on an index file (.shx
) in order to perform random access on geometries through the getFeatureAt()
method.
shpStream | The input stream opened on an .shp file. |
shxStream | The input stream opened on an .shx file. |
|
virtual |
Returns the default renderer for this feature iterator.
Returns a renderer that can be used to translate the map features returned by this iterator into graphic objects. Feature iterators that store some rendering information in the attributes of the map features, such as color, text font, line thickness and so on, can return a specific renderer which is able to take these attributes into account during the rendering process.
display | The display instance the graphic objects are attached to. |
Implements IlvMapFeatureIterator.
|
virtual |
Returns the feature located at the specified index.
IlvShapeSHPReader
has been constructed with a .shx
file. index | The location of the feature. |
status | Set to the status of this reader on return. |
IlvMapFeature
that was read or 0
if an error occurs. const IlvFeatureAttributeInfo* IlvShapeSHPReader::getFeatureAttributeInfo | ( | IlvMapsError & | status | ) | const |
Returns the description of the attributes that are generated by the shape reader.
status | Set to the status of this reader on return. |
IlvFeatureAttributeInfo
that describes additional attributes to store the measurements of POINTM
, POLYLINEM
, POLYGONM
and MULTIPOINTM
, and to store the elevations and measurements of POINTZ
, POLYLINEZ
, POLYGONZ
and MULTIPOINTZ
. If the shape type does not require additional attributes, this method returns 0
.
|
virtual |
Checks the initialization status of this reader.
IlvMaps::NoError()
if the initialization of this reader is successful, or an error if an error occured during the initalization. Implements IlvMapFeatureIterator.
|
protected |
Returns the map input of this reader.
|
virtual |
Returns the lower right corner of the rectangle containing all the map features of this iterator.
result | Set to the result on return. |
IlFalse
if lower right is unknown. Implements IlvMapFeatureIterator.
IlvMapInput* IlvShapeSHPReader::getMapInput | ( | ) |
Returns the map input of this reader.
|
virtual |
Returns the next available feature.
status | An IlvMapsError to store the read status. |
0
if the iteration is finished. The returned feature is owned by the iterator, and therefore must not be deleted by the application. Implements IlvMapFeatureIterator.
|
virtual |
Returns the ID of the next feature.
For Shapefiles, IDs are created as IlvMapFeatureIntegerId
.
new IlvMapFeatureIntegerId(getNextFeatureIndex())
. Implements IlvLookAheadFeatureIterator.
|
virtual |
Returns the index of the next feature that is read.
|
virtual |
Returns the projection of geometries of this feature iterator.
Returns the projection in which the geometric coordinates of the map features are expressed or 0
if the feature iterator returns ungeoreferenced map features.
Implements IlvMapFeatureIterator.
IlvShapeFileIndex* IlvShapeSHPReader::getShapeFileIndex | ( | ) | const |
Returns the Shapefile index reader.
.shx
file name. If not, this method returns 0
. IlvShapeType IlvShapeSHPReader::getShapeType | ( | ) | const |
Returns the shape type of the objects contained in the file.
|
virtual |
Returns the upper left corner of the rectangle containing all the map features of this iterator.
result | Set to the result on return. |
IlFalse
if upper left is unknown. Implements IlvMapFeatureIterator.
|
protectedvirtual |
Reads a MULTIPOINTM
from the Shapefile.
The read measures are set as attributes.
status | Set to the status of this reader on return. |
|
protectedvirtual |
Reads a MULTIPOINT
from the Shapefile.
status | Set to the status of this reader on return. |
|
protectedvirtual |
Reads a MULTIPOINTZ
from the Shapefile.
The read measures and altitudes are set as attributes.
status | Set to the status of this reader on return. |
|
protectedvirtual |
Reads a POINTM
shape.
The read measures are set as attributes.
status | Set to the status of this reader on return. |
|
protectedvirtual |
Reads a POINT
shape.
status | Set to the status of this reader on return. |
|
protectedvirtual |
Reads a POINTZ
shape.
The read measures and altitudes are set as attributes.
status | Set to the status of this reader on return. |
|
protectedvirtual |
Reads a POLYGONM
from the Shapefile.
The read measures are set as attributes.
status | Set to the status of this reader on return. |
|
protectedvirtual |
Reads a POLYGON
from the Shapefile.
status | Set to the status of this reader on return. |
|
protectedvirtual |
Reads a POLYGONZ
from the Shapefile.
The read measures and altitudes are set as attributes.
status | Set to the status of this reader on return. |
|
protectedvirtual |
Reads a POLYLINEM
from the Shapefile.
The read measures are set as attributes.
status | Set to the status of this reader on return. |
|
protectedvirtual |
Reads a POLYLINE
from the Shapefile.
status | Set to the status of this reader on return. |
|
protectedvirtual |
Reads a POLYLINEZ
from the Shapefile.
The read measures and altitudes are set as attributes.
status | Set to the status of this reader on return. |
|
protectedvirtual |
Sets the initialization status of this reader.
status | The new initialization status. |
|
virtual |
Sets the index of the next feature that is read.
index | The index of the next feature that is read. |
|
virtual |
Sets the projection of geometries generated by this feature iterator.
This method is to be used when feature source is not georeferenced.
projection | The projection to be set. This projection becomes shared and is locked by this feature iterator. |
Reimplemented from IlvMapFeatureIterator.
|
virtual |
Skips the next feature available from this feature iterator.
status | Set to the status of this reader on return. |
IlTrue
if the feature is skipped properly, and IlFalse
if an error occurs. Implements IlvLookAheadFeatureIterator.