Views
Maps Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Public Member Functions | Protected Member Functions
IlvShapeFileReader Class Reference

This class reads geometries and attributes from Shape files. More...

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

Inheritance diagram for IlvShapeFileReader:
IlvLookAheadFeatureIterator IlvMapFeatureIterator

Public Member Functions

 IlvShapeFileReader (const char *shpFileName, const char *dbfFileName, const char *shxFileName=0)
 Initializes a new instance of IlvShapeFileReader to read features from files. More...
 
 IlvShapeFileReader (IlvShapeSHPReader *shpReader, IlvShapeDBFReader *dbfReader, IlBoolean ownerOfReaders=IlFalse)
 Initializes a new instance of IlvShapeFileReader to read features from an IlvShapeSHPReader and an IlvShapeDBFReader. More...
 
 IlvShapeFileReader (IlvShapeSHPReader *shpReader, IlvShapeDBFReader *dbfReader, IlvShapeFileIndex *shxIndex, IlBoolean ownerOfReaders=IlFalse)
 Initializes a new instance of IlvShapeFileReader to read features from an IlvShapeSHPReader, an IlvShapeDBFReader and an IlvSHapeFileIndex. More...
 
IlvShapeDBFReadergetDBFReader ()
 Returns the IlvShapeDBFReader used by this reader. More...
 
virtual 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...
 
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...
 
const IlvMapFeaturegetNextFeature (IlvMapsError &status)
 Returns the next available feature. More...
 
virtual IlvMapFeatureIdgetNextFeatureId (IlvMapsError &status)
 Returns the index of the next feature that is read. More...
 
const IlvProjectiongetProjection () const
 Returns the projection of geometries of this feature iterator. More...
 
IlvShapeSHPReadergetSHPReader ()
 Returns the IlvShapeSHPReader used by this reader. More...
 
IlvShapeFileIndexgetSHXReader ()
 Returns the IlvShapeFileIndex used by this reader. More...
 
IlBoolean getUpperLeftCorner (IlvCoordinate &result) const
 Returns the upper left corner of the rectangle containing all the map features of this iterator. More...
 
IlBoolean isLoadingAttributes ()
 Specifies whether this reader is reading auxiliary attributes. 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 IlvClassInfogetClassInfo () const =0
 Returns the class information for this feature iterator. More...
 

Protected Member Functions

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 and attributes from Shape files.

Library: ilvmaps

The IlvShapeFileReader class combines a IlvShapeSHPReader and a IlvShapeDBFReader to read geometries and attributes from ESRI Arc/Info shape files.

See also
IlvShapeSHPReader, IlvShapeDBFReader.

Constructor & Destructor Documentation

◆ IlvShapeFileReader() [1/3]

IlvShapeFileReader::IlvShapeFileReader ( const char *  shpFileName,
const char *  dbfFileName,
const char *  shxFileName = 0 
)

Initializes a new instance of IlvShapeFileReader to read features from files.

Parameters
shpFileNameThe name of the .shp file to read.
dbfFileNameThe name of the .dbf file to read. If 0, no attributes are read.
shxFileNameThe name of the index file to read (with a .shx or .SHX extension).

◆ IlvShapeFileReader() [2/3]

IlvShapeFileReader::IlvShapeFileReader ( IlvShapeSHPReader shpReader,
IlvShapeDBFReader dbfReader,
IlBoolean  ownerOfReaders = IlFalse 
)

Initializes a new instance of IlvShapeFileReader to read features from an IlvShapeSHPReader and an IlvShapeDBFReader.

The flag ownerOfReaders indicates if this IlvShapeFileReader must delete the readers when it is is deleted.

Parameters
shpReaderThe IlvShapeSHPReader.
dbfReaderThe IlvShapeDBFReader. If 0, no attributes are read.
ownerOfReadersIf IlTrue, the readers are owned by this IlvShapeFileReader, so that they will be deleted when this instance is deleted.

◆ IlvShapeFileReader() [3/3]

IlvShapeFileReader::IlvShapeFileReader ( IlvShapeSHPReader shpReader,
IlvShapeDBFReader dbfReader,
IlvShapeFileIndex shxIndex,
IlBoolean  ownerOfReaders = IlFalse 
)

Initializes a new instance of IlvShapeFileReader to read features from an IlvShapeSHPReader, an IlvShapeDBFReader and an IlvSHapeFileIndex.

The flag ownerOfReaders indicates if IlvShapeFileReader must delete the readers when IlvShapeFileReader is deleted.

Parameters
shpReaderThe IlvShapeSHPReader.
dbfReaderThe IlvShapeDBFReader. If 0, no attributes are read.
shxIndexThe IlvShapeFileIndex. If 0, the getFeatureAt() method will not work.
ownerOfReadersIf IlTrue, the readers are owned by this IlvShapeFileReader, so that they will be deleted when this instance is deleted.

Member Function Documentation

◆ getDBFReader()

IlvShapeDBFReader* IlvShapeFileReader::getDBFReader ( )

Returns the IlvShapeDBFReader used by this reader.

Returns the reader of the .dbf file.

Returns
The attribute reader. This reader should not be modified or used to read attributes or it might be left in an inconsistent status.

◆ getDefaultFeatureRenderer()

virtual IlvFeatureRenderer* IlvShapeFileReader::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 display instance the graphic objects are attached to.
Returns
A renderer to be used to translate the map features to graphic objects.

Implements IlvMapFeatureIterator.

◆ getFeatureAt()

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

Returns the feature located at the specified index.

Note that this only works if this IlvShapeFileReader has been constructed with a .shx file.

Parameters
indexThe location of the feature.
statusSet to the read status on return.
Returns
The IlvMapFeature that was read read or 0 if an error occurs.

◆ getInitStatus()

IlvMapsError IlvShapeFileReader::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.

◆ getLowerRightCorner()

IlBoolean IlvShapeFileReader::getLowerRightCorner ( IlvCoordinate result) const
virtual

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

Parameters
resultSet to the result on return.
Returns
IlFalse if lower right is unknown.

Implements IlvMapFeatureIterator.

◆ getNextFeature()

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

Returns the next available feature.

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

Parameters
statusSet to the read status on return.
Returns
The next feature available from this feature iterator.

Implements IlvMapFeatureIterator.

◆ getNextFeatureId()

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

Returns the index of the next feature that is read.

Parameters
statusSet to the read status on return.
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.

Implements IlvLookAheadFeatureIterator.

◆ getProjection()

const IlvProjection* IlvShapeFileReader::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 0 if the feature iterator returns ungeoreferenced map features.

Returns
The projection in which the geometric coordinates are specified.

Implements IlvMapFeatureIterator.

◆ getSHPReader()

IlvShapeSHPReader* IlvShapeFileReader::getSHPReader ( )

Returns the IlvShapeSHPReader used by this reader.

Returns the reader of the .shp file.

Returns
The geometry reader. This reader should not be modified or used to read geometries or it might be left in an inconsistent status.

◆ getSHXReader()

IlvShapeFileIndex* IlvShapeFileReader::getSHXReader ( )

Returns the IlvShapeFileIndex used by this reader.

Returns the reader of the .shx file.

Returns
The shape file index reader. This reader should not be modified

◆ getUpperLeftCorner()

IlBoolean IlvShapeFileReader::getUpperLeftCorner ( IlvCoordinate result) const
virtual

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

Parameters
resultSet to the result on return.
Returns
IlFalse if upper left is unknown.

Implements IlvMapFeatureIterator.

◆ isLoadingAttributes()

IlBoolean IlvShapeFileReader::isLoadingAttributes ( )

Specifies whether this reader is reading auxiliary attributes.

Returns
IlTrue if this reader is reading auxiliary attributes.

◆ setInitStatus()

virtual void IlvShapeFileReader::setInitStatus ( IlvMapsError  status)
protectedvirtual

Sets the initialization status of this reader.

Parameters
statusThe new initialization status.

◆ setSourceProjection()

void IlvShapeFileReader::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.

◆ skipNextFeature()

virtual IlBoolean IlvShapeFileReader::skipNextFeature ( IlvMapsError &  status)
virtual

Skips the next feature available from this feature iterator.

Parameters
statusSet to the read status on return.
Returns
IlTrue if the feature is skipped properly, and IlFalse if an error occurs.

Implements IlvLookAheadFeatureIterator.