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

An IlvShapeSpatialIndex is used to store and retrieve tile information for a given Shapefile. More...

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

Public Member Functions

 IlvShapeSpatialIndex (const char *indexFilename)
 Initializes a new spatial index whose values are read from the specified file. More...
 
 IlvShapeSpatialIndex (IlInt columNum, IlInt rowNum, IlvCoordinate *origin, IlDouble tileWidth, IlDouble tileHeight)
 Initializes a new, empty, spatial index. More...
 
IlBoolean add (IlInt c, IlInt r, IlInt id)
 Adds the object whose ID is specified in the spatial index, at the specified position. More...
 
IlInt getColumnCount () const
 Returns the number of tile columns covered by this index. More...
 
IlvMapsError getIdArray (IlInt column, IlInt row, IlInt *&ret, IlUInt &size)
 Returns an array containing the IDs of all the shape features contained within the specified tile. More...
 
IlvMapsError getInitStatus () const
 Returns the status. More...
 
IlvCoordinategetOrigin () const
 Returns the origin of the tile grid. More...
 
IlInt getRowCount () const
 Returns the number of tile rows covered by this index. More...
 
IlDouble getTileHeight () const
 Returns the height of one tile. More...
 
IlDouble getTileWidth () const
 Returns the width of one tile. More...
 
IlvMapsError save (const char *filename)
 Writes this spatial index to the specified file. More...
 

Detailed Description

An IlvShapeSpatialIndex is used to store and retrieve tile information for a given Shapefile.

Library: ilvmaps

When an IlvShapeSpatialIndex is written to a file, it uses a format that is internal to Rogue Wave Views Maps.

Constructor & Destructor Documentation

◆ IlvShapeSpatialIndex() [1/2]

IlvShapeSpatialIndex::IlvShapeSpatialIndex ( IlInt  columNum,
IlInt  rowNum,
IlvCoordinate origin,
IlDouble  tileWidth,
IlDouble  tileHeight 
)

Initializes a new, empty, spatial index.

Parameters
columNumThe number of columns.
rowNumThe number of rows.
originThe origin of the grid defined by this index.
tileWidthThe width of one tile, in manager coordinates.
tileHeightThe height of one tile, in manager coordinates.

◆ IlvShapeSpatialIndex() [2/2]

IlvShapeSpatialIndex::IlvShapeSpatialIndex ( const char *  indexFilename)

Initializes a new spatial index whose values are read from the specified file.

When a spatial index is created with this constructor, it is read-only, meaning that the add() method does not work.
The specified file must have been written using the save() method of an IlvShapeFileIndex.

Parameters
indexFilenameThe name of the spatial index file.

Member Function Documentation

◆ add()

IlBoolean IlvShapeSpatialIndex::add ( IlInt  c,
IlInt  r,
IlInt  id 
)

Adds the object whose ID is specified in the spatial index, at the specified position.

Parameters
cThe column position.
rThe row position.
idThe ID to add.
Returns
IlFalse if the IlvShapeSpatialIndex is read only, IlTrue otherwise.

◆ getColumnCount()

IlInt IlvShapeSpatialIndex::getColumnCount ( ) const

Returns the number of tile columns covered by this index.

Returns
The number of tile columns.

◆ getIdArray()

IlvMapsError IlvShapeSpatialIndex::getIdArray ( IlInt  column,
IlInt  row,
IlInt *&  ret,
IlUInt size 
)

Returns an array containing the IDs of all the shape features contained within the specified tile.

IDs are coded as IlInt type and can be accessed using IlvShapeSHPReader::getFeatureAt().

Parameters
columnThe column of the tile.
rowThe row of the tile.
retA returned array of IlInt containing the IDs of all the shape features contained within the specified tile. This array, if not 0, must be deleted by the caller by using the delete [] operator.
sizeThe size of the returned array of IDs.
Returns
An IlvMapsError if the array cannot be read, IlvMaps::NoError() otherwise.

◆ getInitStatus()

IlvMapsError IlvShapeSpatialIndex::getInitStatus ( ) const

Returns the status.

This status is set when constructing a IlvShapeSpatialIndex a file name.

Returns
A potential error.

◆ getOrigin()

IlvCoordinate* IlvShapeSpatialIndex::getOrigin ( ) const

Returns the origin of the tile grid.

Returns
The origin of the tile grid.

◆ getRowCount()

IlInt IlvShapeSpatialIndex::getRowCount ( ) const

Returns the number of tile rows covered by this index.

Returns
The number of tile rows.

◆ getTileHeight()

IlDouble IlvShapeSpatialIndex::getTileHeight ( ) const

Returns the height of one tile.

Returns
The tile height.

◆ getTileWidth()

IlDouble IlvShapeSpatialIndex::getTileWidth ( ) const

Returns the width of one tile.

Returns
The tile width.

◆ save()

IlvMapsError IlvShapeSpatialIndex::save ( const char *  filename)

Writes this spatial index to the specified file.

Parameters
filenameThe name of the output file to write this spatial index to.
Returns
A potential error.