rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Maps Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IlvShapeSHPReader Class Reference

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

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

Inheritance diagram for IlvShapeSHPReader:
IlvLookAheadFeatureIterator IlvMapFeatureIterator

List of all members.

Public Member Functions

 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.
 IlvShapeSHPReader (IL_STDPREF istream &stream)
 Initializes an IlvShapeSHPReader to read from the specified input stream.
 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.
IlvFeatureRenderergetDefaultFeatureRenderer (IlvDisplay *display)
 Returns the default renderer for this feature iterator.
virtual const IlvMapFeaturegetFeatureAt (IlInt index, IlvMapsError &status)
 Returns the feature located at the specified index.
const IlvFeatureAttributeInfogetFeatureAttributeInfo (IlvMapsError &status) const
 Returns the description of the attributes that are generated by the shape reader.
IlvMapsError getInitStatus () const
 Checks the initialization status of this reader.
IlBoolean getLowerRightCorner (IlvCoordinate &result) const
 Returns the lower right corner of the rectangle containing all the map features of this iterator.
IlvMapInputgetMapInput ()
 Returns the map input of this reader.
const IlvMapFeaturegetNextFeature (IlvMapsError &status)
 Returns the next available feature.
virtual IlvMapFeatureIdgetNextFeatureId (IlvMapsError &status)
virtual IlInt getNextFeatureIndex ()
 Returns the index of the next feature that is read.
const IlvProjectiongetProjection () const
 Returns the projection of geometries of this feature iterator.
IlvShapeFileIndexgetShapeFileIndex ()
 Returns the Shapefile index reader.
IlvShapeType getShapeType () const
 Returns the shape type of the objects contained in the file.
IlBoolean getUpperLeftCorner (IlvCoordinate &result) const
 Returns the upper left corner of the rectangle containing all the map features of this iterator.
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.
virtual IlBoolean skipNextFeature (IlvMapsError &status)
 Skips the next feature available from this feature iterator.

Protected Member Functions

IlvMapInputgetInput ()
 Returns the map input of this reader.
virtual IlvMapFeaturereadMultiPointMShape (IlvMapsError &status)
 Reads a MULTIPOINTM from the Shapefile.
virtual IlvMapFeaturereadMultiPointShape (IlvMapsError &status)
 Reads a MULTIPOINT from the Shapefile.
virtual IlvMapFeaturereadMultiPointZShape (IlvMapsError &status)
 Reads a MULTIPOINTZ from the Shapefile.
virtual IlvMapFeaturereadPointMShape (IlvMapsError &status)
 Reads a POINTM shape.
virtual IlvMapFeaturereadPointShape (IlvMapsError &status)
 Reads a POINT shape.
virtual IlvMapFeaturereadPointZShape (IlvMapsError &status)
 Reads a POINTZ shape.
virtual IlvMapFeaturereadPolygonMShape (IlvMapsError &status)
 Reads a POLYGONM from the Shapefile.
virtual IlvMapFeaturereadPolygonShape (IlvMapsError &status)
 Reads a POLYGON from the Shapefile.
virtual IlvMapFeaturereadPolygonZShape (IlvMapsError &status)
 Reads a POLYGONZ from the Shapefile.
virtual IlvMapFeaturereadPolylineMShape (IlvMapsError &status)
 Reads a POLYLINEM from the Shapefile.
virtual IlvMapFeaturereadPolylineShape (IlvMapsError &status)
 Reads a POLYLINE from the Shapefile.
virtual IlvMapFeaturereadPolylineZShape (IlvMapsError &status)
 Reads a POLYLINEZ from the Shapefile.
virtual void setInitStatus (IlvMapsError status)
 Sets the initialization status of this reader.

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:
fileName The name of the .shp input file.
shxName The 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:
stream The 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:
shpStream The input stream opened on an .shp file.
shxStream The 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:
display The 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.

Warning:
[note] This only works if this IlvShapeSHPReader has been constructed with a .shx file.
Parameters:
index The location of the feature.
status An 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:
result An 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:
status An 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.

Warning:
[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:
result An IlvCoordinate to store the result.
Returns:
IlFalse if upper left is unknown.

Implements IlvMapFeatureIterator.

virtual IlvMapFeature* IlvShapeSHPReader::readMultiPointMShape ( IlvMapsError &  status  )  [protected, virtual]

Reads a MULTIPOINTM from the Shapefile.

The read measures are set as attributes.

Parameters:
status Contains the read status.
Returns:
The read feature.
virtual IlvMapFeature* IlvShapeSHPReader::readMultiPointShape ( IlvMapsError &  status  )  [protected, virtual]

Reads a MULTIPOINT from the Shapefile.

Parameters:
status Contains the read status.
Returns:
The read feature.
virtual IlvMapFeature* IlvShapeSHPReader::readMultiPointZShape ( IlvMapsError &  status  )  [protected, virtual]

Reads a MULTIPOINTZ from the Shapefile.

The read measures and altitudes are set as attributes.

Parameters:
status Contains the read status.
Returns:
The read feature.
virtual IlvMapFeature* IlvShapeSHPReader::readPointMShape ( IlvMapsError &  status  )  [protected, virtual]

Reads a POINTM shape.

The read measures are set as attributes.

Parameters:
status Contains the read status.
Returns:
The read feature.
virtual IlvMapFeature* IlvShapeSHPReader::readPointShape ( IlvMapsError &  status  )  [protected, virtual]

Reads a POINT shape.

Parameters:
status Contains the read status.
Returns:
The read feature.
virtual IlvMapFeature* IlvShapeSHPReader::readPointZShape ( IlvMapsError &  status  )  [protected, virtual]

Reads a POINTZ shape.

The read measures and altitudes are set as attributes.

Parameters:
status Contains the read status.
Returns:
The read feature.
virtual IlvMapFeature* IlvShapeSHPReader::readPolygonMShape ( IlvMapsError &  status  )  [protected, virtual]

Reads a POLYGONM from the Shapefile.

The read measures are set as attributes.

Parameters:
status Contains the read status.
Returns:
The read feature.
virtual IlvMapFeature* IlvShapeSHPReader::readPolygonShape ( IlvMapsError &  status  )  [protected, virtual]

Reads a POLYGON from the Shapefile.

Parameters:
status Contains the read status.
Returns:
The read feature.
virtual IlvMapFeature* IlvShapeSHPReader::readPolygonZShape ( IlvMapsError &  status  )  [protected, virtual]

Reads a POLYGONZ from the Shapefile.

The read measures and altitudes are set as attributes.

Parameters:
status Contains the read status.
Returns:
The read feature.
virtual IlvMapFeature* IlvShapeSHPReader::readPolylineMShape ( IlvMapsError &  status  )  [protected, virtual]

Reads a POLYLINEM from the Shapefile.

The read measures are set as attributes.

Parameters:
status Contains the read status.
Returns:
The read feature.
virtual IlvMapFeature* IlvShapeSHPReader::readPolylineShape ( IlvMapsError &  status  )  [protected, virtual]

Reads a POLYLINE from the Shapefile.

Parameters:
status Contains the read status.
Returns:
The read feature.
virtual IlvMapFeature* IlvShapeSHPReader::readPolylineZShape ( IlvMapsError &  status  )  [protected, virtual]

Reads a POLYLINEZ from the Shapefile.

The read measures and altitudes are set as attributes.

Parameters:
status Contains the read status.
Returns:
The read feature.
virtual void IlvShapeSHPReader::setInitStatus ( IlvMapsError  status  )  [protected, virtual]

Sets the initialization status of this reader.

Parameters:
status The 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:
projection The projection to be set. This projection becomes shared and is locked by this feature iterator.

Reimplemented from IlvMapFeatureIterator.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

© Copyright 2012, 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.