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

This class allows applications to take advantage of ESRI Shapefile index files (.shx files).
More...

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

Public Member Functions

 IlvShapeFileIndex (const char *shxFileName)
 Initializes an IlvShapeFileIndex from the .shx file specified. More...
 
 IlvShapeFileIndex (istream &istr)
 Initializes an IlvShapeFileIndex from an istream. 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 the shape file corresponding to this index reader. More...
 
IlInt getRecordCount () const
 Returns the number of objects in this index. More...
 
IlvMapsError getRecordLength (IlInt index, IlInt &length)
 Retrieves the record length of the object at the specified index. More...
 
IlvMapsError getRecordOffset (IlInt index, IlInt &offset)
 Retrieves the file offset of the object at the specified index. More...
 
IlBoolean getUpperLeftCorner (IlvCoordinate &result) const
 Returns the upper left corner of the rectangle containing all the map features of the shape file corresponding to this index reader. More...
 

Protected Member Functions

const IlvMapInputgetInput () const
 Returns the map input of this reader. More...
 
virtual void setInitStatus (IlvMapsError status)
 Sets the initialization status of this reader. More...
 

Detailed Description

This class allows applications to take advantage of ESRI Shapefile index files (.shx files).

Library: ilvmaps

Index files allow direct access to geometries in the main Shapefile (.shp file). Index files map record indexes to file offsets.

Index files are typically used to load geometries on demand.

Constructor & Destructor Documentation

◆ IlvShapeFileIndex() [1/2]

IlvShapeFileIndex::IlvShapeFileIndex ( const char *  shxFileName)

Initializes an IlvShapeFileIndex from the .shx file specified.

Parameters
shxFileNameThe file name of the .shx file.

◆ IlvShapeFileIndex() [2/2]

IlvShapeFileIndex::IlvShapeFileIndex ( istream &  istr)

Initializes an IlvShapeFileIndex from an istream.

Parameters
istrThe input stream opened on the shape data.

Member Function Documentation

◆ getInitStatus()

IlvMapsError IlvShapeFileIndex::getInitStatus ( ) const

Checks the initialization status of this reader.

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

◆ getInput()

const IlvMapInput& IlvShapeFileIndex::getInput ( ) const
protected

Returns the map input of this reader.

Returns
A reference to the IlvMapInput of the reader.

◆ getLowerRightCorner()

IlBoolean IlvShapeFileIndex::getLowerRightCorner ( IlvCoordinate result) const

Returns the lower right corner of the rectangle containing all the map features of the shape file corresponding to this index reader.

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

◆ getRecordCount()

IlInt IlvShapeFileIndex::getRecordCount ( ) const

Returns the number of objects in this index.

Returns
The number of objects in this index.

◆ getRecordLength()

IlvMapsError IlvShapeFileIndex::getRecordLength ( IlInt  index,
IlInt length 
)

Retrieves the record length of the object at the specified index.

The index of objects is in the range [0, getRecordCount()].

Note
The length is specified as the content length of the record. It does not include the 4 byte header.
Parameters
indexThe index of objects.
lengthThe returned length, in bytes.
Returns
IlvMaps::NoError() if no error occurs.

◆ getRecordOffset()

IlvMapsError IlvShapeFileIndex::getRecordOffset ( IlInt  index,
IlInt offset 
)

Retrieves the file offset of the object at the specified index.

The index of objects is in the range [0, getRecordCount()].

The file offset is expressed in bytes, from the start of the files. As there is a 100 bytes header in the .shx file, the index of the first object is at offset 100.

Parameters
indexThe index of the objects.
offsetThe returned offset.

◆ getUpperLeftCorner()

IlBoolean IlvShapeFileIndex::getUpperLeftCorner ( IlvCoordinate result) const

Returns the upper left corner of the rectangle containing all the map features of the shape file corresponding to this index reader.

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

◆ setInitStatus()

virtual void IlvShapeFileIndex::setInitStatus ( IlvMapsError  status)
protectedvirtual

Sets the initialization status of this reader.

Parameters
statusThe new initialization status.