rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Maps Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

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

List of all members.

Public Member Functions

 IlvShapeFileReader (IlvShapeSHPReader *shpReader, IlvShapeDBFReader *dbfReader, IlvShapeFileIndex *shxIndex, IlBoolean ownerOfReaders=IlFalse)
 Creates a new instance of IlvShapeFileReader to read features from the specified IlvShapeSHPReader a IlvShapeDBFReader and a IlvSHapeFileIndex. The flag ownerOfReaders indicates if IlvShapeFileReader must delete the readers when IlvShapeFileReader is deleted.
 IlvShapeFileReader (IlvShapeSHPReader *shpReader, IlvShapeDBFReader *dbfReader, IlBoolean ownerOfReaders=IlFalse)
 Creates a new instance of IlvShapeFileReader to read features from the specified IlvShapeSHPReader and IlvShapeDBFReader. The flag ownerOfReaders indicates if IlvShapeFileReader must delete the readers when IlvShapeFileReader is deleted.
 IlvShapeFileReader (const char *shpFileName, const char *dbfFileName, const char *shxFileName=0)
 Creates a new instance of IlvShapeFileReader to read features from files whose names are specified.
IlvShapeDBFReadergetDBFReader ()
 Returns the IlvShapeDBFReader used by this reader.
virtual 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.
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.
const IlvMapFeaturegetNextFeature (IlvMapsError &status)
 Returns the next available feature.
virtual IlvMapFeatureIdgetNextFeatureId (IlvMapsError &status)
 Returns the index of the next feature that is read.
const IlvProjectiongetProjection () const
 Returns the projection of geometries of this feature iterator.
IlvShapeSHPReadergetSHPReader ()
 Returns the IlvShapeSHPReader used by this reader.
IlvShapeFileIndexgetSHXReader ()
 Returns the IlvShapeFileIndex used by this reader.
IlBoolean getUpperLeftCorner (IlvCoordinate &result) const
 Returns the upper left corner of the rectangle containing all the map features of this iterator.
IlBoolean isLoadingAttributes ()
 Specifies whether this reader is reading auxiliary attributes.
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

virtual void setInitStatus (IlvMapsError status)
 Sets the initialization status of this reader.

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::IlvShapeFileReader ( const char *  shpFileName,
const char *  dbfFileName,
const char *  shxFileName = 0 
)

Creates a new instance of IlvShapeFileReader to read features from files whose names are specified.

Parameters:
shpFileName The name of the .shp file.
dbfFileName The name of the .dbf file. If 0, no attributes are read.
shxFileName The name of the index file (with a .shx or .SHX extension).
IlvShapeFileReader::IlvShapeFileReader ( IlvShapeSHPReader shpReader,
IlvShapeDBFReader dbfReader,
IlBoolean  ownerOfReaders = IlFalse 
)

Creates a new instance of IlvShapeFileReader to read features from the specified IlvShapeSHPReader and IlvShapeDBFReader. The flag ownerOfReaders indicates if IlvShapeFileReader must delete the readers when IlvShapeFileReader is deleted.

Parameters:
shpReader The IlvShapeSHPReader.
dbfReader The IlvShapeDBFReader. If 0, no attributes are read.
ownerOfReaders If IlTrue, the readers are owned by this IlvShapeFileReader.
IlvShapeFileReader::IlvShapeFileReader ( IlvShapeSHPReader shpReader,
IlvShapeDBFReader dbfReader,
IlvShapeFileIndex shxIndex,
IlBoolean  ownerOfReaders = IlFalse 
)

Creates a new instance of IlvShapeFileReader to read features from the specified IlvShapeSHPReader a IlvShapeDBFReader and a IlvSHapeFileIndex. The flag ownerOfReaders indicates if IlvShapeFileReader must delete the readers when IlvShapeFileReader is deleted.

Parameters:
shpReader The IlvShapeSHPReader.
dbfReader The IlvShapeDBFReader. If 0, no attributes are read.
shxFileName The IlvShapeFileIndex. If 0, the getFeatureAt method won't work.
ownerOfReaders If IlTrue, the readers are owned by this IlvShapeFileReader.

Member Function Documentation

IlvShapeDBFReader* IlvShapeFileReader::getDBFReader (  ) 

Returns the IlvShapeDBFReader used by this reader.

Returns the reader of the .dbf file. This reader should not be modified or used to read attributes or it might be left in an inconsistent status.

Returns:
The attribute reader.
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:
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* 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:
index The location of the feature.
status An IlvMapsError if an error occurs.
Returns:
The IlvMapFeature read or 0 if an error occurs.
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.

IlBoolean IlvShapeFileReader::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* 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:
status An IlvMapsError to store the read status.
Returns:
The next feature available from this feature iterator.

Implements IlvMapFeatureIterator.

virtual IlvMapFeatureId* IlvShapeFileReader::getNextFeatureId ( IlvMapsError &  status  )  [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.

Implements IlvLookAheadFeatureIterator.

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.

IlvShapeSHPReader* IlvShapeFileReader::getSHPReader (  ) 

Returns the IlvShapeSHPReader used by this reader.

Returns the reader of the .shp file. This reader should not be modified. or used to read geometries or it might be left in an inconsistent status.

Returns:
The geometry reader.
IlvShapeFileIndex* IlvShapeFileReader::getSHXReader (  ) 

Returns the IlvShapeFileIndex used by this reader.

Returns the reader of the .shx file. This reader should not be modified

Returns:
The shape file index reader.
IlBoolean IlvShapeFileReader::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.

IlBoolean IlvShapeFileReader::isLoadingAttributes (  ) 

Specifies whether this reader is reading auxiliary attributes.

Returns:
IlTrue if this reader is reading auxiliary attributes.
virtual void IlvShapeFileReader::setInitStatus ( IlvMapsError  status  )  [protected, virtual]

Sets the initialization status of this reader.

Parameters:
status The new initialization status.
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:
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.