rwlogo

Rogue Wave Views
Maps Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
List of all members | Public Member Functions | Protected Member Functions
IlvShapeSHPReader Class Reference

This class reads geometries from .shp files. More...

#include <ilviews/maps/format/shapefile/shpreader.h>

Inheritance diagram for IlvShapeSHPReader:
IlvLookAheadFeatureIterator IlvMapFeatureIterator

Public Member Functions

 IlvShapeSHPReader (const char *fileName, const char *shxName=0)
 Initializes an IlvShapeSHPReader to read from the Shapefile file whose name is specified. You can also specify an index (.shx) file name if you want to perform random access on geometries through the getFeatureAt method. More...
 
 IlvShapeSHPReader (IL_STDPREF istream &stream)
 Initializes an IlvShapeSHPReader to read from the specified input stream. More...
 
 IlvShapeSHPReader (IL_STDPREF istream &shpStream, IL_STDPREF istream &shxStream)
 Initializes an 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. More...
 
IlvFeatureRenderergetDefaultFeatureRenderer (IlvDisplay *display)
 Returns the default renderer for this feature iterator. More...
 
virtual const IlvMapFeaturegetFeatureAt (IlInt index, IlvMapsError &status)
 Returns the feature located at the specified index. More...
 
const IlvFeatureAttributeInfogetFeatureAttributeInfo (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...
 
IlvMapInputgetMapInput ()
 Returns the map input of this reader.
 
const IlvMapFeaturegetNextFeature (IlvMapsError &status)
 Returns the next available feature. More...
 
virtual IlvMapFeatureIdgetNextFeatureId (IlvMapsError &status)
 
virtual IlInt getNextFeatureIndex ()
 Returns the index of the next feature that is read. More...
 
const IlvProjectiongetProjection () const
 Returns the projection of geometries of this feature iterator. More...
 
IlvShapeFileIndexgetShapeFileIndex ()
 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.
 
void setSourceProjection (IlvProjection *projection)
 Sets the projection of geometries generated by this feature iterator. This method is to be used when feature source is not georeferenced. More...
 
virtual IlBoolean skipNextFeature (IlvMapsError &status)
 Skips the next feature available from this feature iterator.
 
- Public Member Functions inherited from IlvLookAheadFeatureIterator
virtual ~IlvLookAheadFeatureIterator ()
 Destructor.
 
- Public Member Functions inherited from IlvMapFeatureIterator
virtual IlvClassInfogetClassInfo () const =0
 Returns the class information for this feature iterator. More...
 

Protected Member Functions

IlvMapInputgetInput ()
 Returns the map input of this reader.
 
virtual IlvMapFeaturereadMultiPointMShape (IlvMapsError &status)
 Reads a MULTIPOINTM from the Shapefile. More...
 
virtual IlvMapFeaturereadMultiPointShape (IlvMapsError &status)
 Reads a MULTIPOINT from the Shapefile. More...
 
virtual IlvMapFeaturereadMultiPointZShape (IlvMapsError &status)
 Reads a MULTIPOINTZ from the Shapefile. More...
 
virtual IlvMapFeaturereadPointMShape (IlvMapsError &status)
 Reads a POINTM shape. More...
 
virtual IlvMapFeaturereadPointShape (IlvMapsError &status)
 Reads a POINT shape. More...
 
virtual IlvMapFeaturereadPointZShape (IlvMapsError &status)
 Reads a POINTZ shape. More...
 
virtual IlvMapFeaturereadPolygonMShape (IlvMapsError &status)
 Reads a POLYGONM from the Shapefile. More...
 
virtual IlvMapFeaturereadPolygonShape (IlvMapsError &status)
 Reads a POLYGON from the Shapefile. More...
 
virtual IlvMapFeaturereadPolygonZShape (IlvMapsError &status)
 Reads a POLYGONZ from the Shapefile. More...
 
virtual IlvMapFeaturereadPolylineMShape (IlvMapsError &status)
 Reads a POLYLINEM from the Shapefile. More...
 
virtual IlvMapFeaturereadPolylineShape (IlvMapsError &status)
 Reads a POLYLINE from the Shapefile. More...
 
virtual IlvMapFeaturereadPolylineZShape (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 IlvClassInfoClassInfo ()
 Returns the class information of the class. More...
 
static IlvClassInfo ** ClassInfoRef ()
 Returns the address of the class information of the class. More...
 

Detailed Description

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.

See Also
IlvShapeFileReader, IlvShapeDBFReader.

Constructor & Destructor Documentation

IlvShapeSHPReader::IlvShapeSHPReader ( const char *  fileName,
const char *  shxName = 0 
)

Initializes an IlvShapeSHPReader to read from the Shapefile file whose name is specified. You can also specify an index (.shx) file name if you want to perform random access on geometries through the getFeatureAt method.

Parameters
fileNameThe name of the .shp input file.
shxNameThe name of an .shx input file.
IlvShapeSHPReader::IlvShapeSHPReader ( IL_STDPREF istream &  stream)

Initializes an IlvShapeSHPReader to read from the specified input stream.

Warning
On PC, the stream must be opened on an in binary mode.
Parameters
streamThe input stream.
IlvShapeSHPReader::IlvShapeSHPReader ( IL_STDPREF istream &  shpStream,
IL_STDPREF istream &  shxStream 
)

Initializes an 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.

Warning
On PCs, the streams must be opened in binary mode.
Parameters
shpStreamThe input stream opened on an .shp file.
shxStreamThe input stream opened on an .shx file.

Member Function Documentation

IlvFeatureRenderer* IlvShapeSHPReader::getDefaultFeatureRenderer ( IlvDisplay display)
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.

Parameters
displayThe IlvDisplay the graphic objects are attached to.
Returns
A renderer to be used to translate the map features to graphic objects.

Implements IlvMapFeatureIterator.

virtual const IlvMapFeature* IlvShapeSHPReader::getFeatureAt ( IlInt  index,
IlvMapsError &  status 
)
virtual

Returns the feature located at the specified index.

Note
This only works if this IlvShapeSHPReader has been constructed with a .shx file.
Parameters
indexThe location of the feature.
statusAn IlvMapsError if an error occurs.
Returns
The IlvMapFeature 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.

Returns
The 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 a null value.
IlvMapsError IlvShapeSHPReader::getInitStatus ( ) const
virtual

Checks the initialization status of this reader.

Returns
IlvMaps::NoError() if the initialization of this reader is successful, or an error if an error occured during the initalization.

Implements IlvMapFeatureIterator.

IlBoolean IlvShapeSHPReader::getLowerRightCorner ( IlvCoordinate result) const
virtual

Returns the lower right corner of the rectangle containing all the map features of this iterator.

Parameters
resultAn IlvCoordinate to store the result.
Returns
IlFalse if lower right is unknown.

Implements IlvMapFeatureIterator.

const IlvMapFeature* IlvShapeSHPReader::getNextFeature ( IlvMapsError &  status)
virtual

Returns the next available feature.

Returns the next map feature of the iterator, of null if the iteration is finished. The returned feature is owned by the iterator, and therefore must not be deleted by the application.

Parameters
statusAn IlvMapsError to store the read status.
Returns
The next feature available from this feature iterator.

Implements IlvMapFeatureIterator.

virtual IlvMapFeatureId* IlvShapeSHPReader::getNextFeatureId ( IlvMapsError &  status)
virtual

Returns the ID of the next feature. For Shapefiles, IDs are created as IlvMapFeatureIntegerId.

Returns
An ID created using new IlvMapFeatureIntegerId(getNextFeatureIndex()).

Implements IlvLookAheadFeatureIterator.

virtual IlInt IlvShapeSHPReader::getNextFeatureIndex ( )
virtual

Returns the index of the next feature that is read.

Note
This will return the index of the next feature, even if the end of file is reached.
const IlvProjection* IlvShapeSHPReader::getProjection ( ) const
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 null if the feature iterator returns ungeoreferenced map features.

Returns
The projection in which the geometric coordinates are specified.

Implements IlvMapFeatureIterator.

IlvShapeFileIndex* IlvShapeSHPReader::getShapeFileIndex ( )

Returns the Shapefile index reader.

Returns
The Shapefile index if this reader was constructed with a valid .shx file name. If not, this method returns 0.
IlvShapeType IlvShapeSHPReader::getShapeType ( ) const

Returns the shape type of the objects contained in the file.

See Also
IlvShapeType
Returns
The type of objects.
IlBoolean IlvShapeSHPReader::getUpperLeftCorner ( IlvCoordinate result) const
virtual

Returns the upper left corner of the rectangle containing all the map features of this iterator.

Parameters
resultAn IlvCoordinate to store the result.
Returns
IlFalse if upper left is unknown.

Implements IlvMapFeatureIterator.

virtual IlvMapFeature* IlvShapeSHPReader::readMultiPointMShape ( IlvMapsError &  status)
protectedvirtual

Reads a MULTIPOINTM from the Shapefile.

The read measures are set as attributes.

Parameters
statusContains the read status.
Returns
The read feature.
virtual IlvMapFeature* IlvShapeSHPReader::readMultiPointShape ( IlvMapsError &  status)
protectedvirtual

Reads a MULTIPOINT from the Shapefile.

Parameters
statusContains the read status.
Returns
The read feature.
virtual IlvMapFeature* IlvShapeSHPReader::readMultiPointZShape ( IlvMapsError &  status)
protectedvirtual

Reads a MULTIPOINTZ from the Shapefile.

The read measures and altitudes are set as attributes.

Parameters
statusContains the read status.
Returns
The read feature.
virtual IlvMapFeature* IlvShapeSHPReader::readPointMShape ( IlvMapsError &  status)
protectedvirtual

Reads a POINTM shape.

The read measures are set as attributes.

Parameters
statusContains the read status.
Returns
The read feature.
virtual IlvMapFeature* IlvShapeSHPReader::readPointShape ( IlvMapsError &  status)
protectedvirtual

Reads a POINT shape.

Parameters
statusContains the read status.
Returns
The read feature.
virtual IlvMapFeature* IlvShapeSHPReader::readPointZShape ( IlvMapsError &  status)
protectedvirtual

Reads a POINTZ shape.

The read measures and altitudes are set as attributes.

Parameters
statusContains the read status.
Returns
The read feature.
virtual IlvMapFeature* IlvShapeSHPReader::readPolygonMShape ( IlvMapsError &  status)
protectedvirtual

Reads a POLYGONM from the Shapefile.

The read measures are set as attributes.

Parameters
statusContains the read status.
Returns
The read feature.
virtual IlvMapFeature* IlvShapeSHPReader::readPolygonShape ( IlvMapsError &  status)
protectedvirtual

Reads a POLYGON from the Shapefile.

Parameters
statusContains the read status.
Returns
The read feature.
virtual IlvMapFeature* IlvShapeSHPReader::readPolygonZShape ( IlvMapsError &  status)
protectedvirtual

Reads a POLYGONZ from the Shapefile.

The read measures and altitudes are set as attributes.

Parameters
statusContains the read status.
Returns
The read feature.
virtual IlvMapFeature* IlvShapeSHPReader::readPolylineMShape ( IlvMapsError &  status)
protectedvirtual

Reads a POLYLINEM from the Shapefile.

The read measures are set as attributes.

Parameters
statusContains the read status.
Returns
The read feature.
virtual IlvMapFeature* IlvShapeSHPReader::readPolylineShape ( IlvMapsError &  status)
protectedvirtual

Reads a POLYLINE from the Shapefile.

Parameters
statusContains the read status.
Returns
The read feature.
virtual IlvMapFeature* IlvShapeSHPReader::readPolylineZShape ( IlvMapsError &  status)
protectedvirtual

Reads a POLYLINEZ from the Shapefile.

The read measures and altitudes are set as attributes.

Parameters
statusContains the read status.
Returns
The read feature.
virtual void IlvShapeSHPReader::setInitStatus ( IlvMapsError  status)
protectedvirtual

Sets the initialization status of this reader.

Parameters
statusThe new initialization status.
void IlvShapeSHPReader::setSourceProjection ( IlvProjection projection)
virtual

Sets the projection of geometries generated by this feature iterator. This method is to be used when feature source is not georeferenced.

Parameters
projectionThe projection to be set. This projection becomes shared and is locked by this feature iterator.

Reimplemented from IlvMapFeatureIterator.


© Copyright 2015, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.