ilog.views.maps.format.shapefile
Class IlvShapeSpatialIndex

java.lang.Object
  extended by ilog.views.maps.format.shapefile.IlvShapeSpatialIndex

public class IlvShapeSpatialIndex
extends Object

An IlvShapeSpatialIndex is used to store and retrieve tile information for a given Shapefile.
When an IlvShapeSpatialIndex is written to a file, it uses a format that is internal to ILOG JViews.

Since:
JViews 4.0

Constructor Summary
IlvShapeSpatialIndex(int columnNum, int rowNum, IlvCoordinate origin, double tileWidth, double tileHeight)
          Constructs an empty spatial index with the specified parameters.
IlvShapeSpatialIndex(String indexFilename)
          Constructs a spatial index whose values are read from the specified file.
IlvShapeSpatialIndex(URL url)
          Constructs a spatial index whose values are read from the specified url.
 
Method Summary
 void add(int c, int r, int id)
          Adds the object whose ID is specified in the spatial index, at the specified position.
 int getColumnCount()
          Returns the number of tile columns covered by this index.
 int[] getIdArray(int column, int row)
          Returns an array containing the IDs of all the shape features contained within the specified tile.
 IlvCoordinate getOrigin()
          Returns the origin of the tile grid.
 int getRowCount()
          Returns the number of tile rows covered by this index.
 double getTileHeight()
          Returns the height of one tile.
 double getTileWidth()
          Returns the width of one tile.
 void save(String filename)
          Saves this spatial index to the file specified.
 void write(DataOutput output)
          Writes this spatial index to the specified data output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlvShapeSpatialIndex

public IlvShapeSpatialIndex(int columnNum,
                            int rowNum,
                            IlvCoordinate origin,
                            double tileWidth,
                            double tileHeight)
Constructs an empty spatial index with the specified parameters.

Parameters:
columnNum - The number of columns.
rowNum - The number of rows.
origin - The origin of the grid defined by this index.
tileWidth - The width of one tile, in manager coordinates.
tileHeight - The height of one tile, in manager coordinates.

IlvShapeSpatialIndex

public IlvShapeSpatialIndex(String indexFilename)
                     throws IOException
Constructs a 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:
indexFilename - The name of the spatial index file.
Throws:
IOException - if an error occurs while reading the index file.

IlvShapeSpatialIndex

public IlvShapeSpatialIndex(URL url)
                     throws IOException
Constructs a spatial index whose values are read from the specified url. 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:
url - The url of the spatial index file.
Throws:
IOException - if an error occurs while reading the index file.
Since:
JViews 7.5
Method Detail

getIdArray

public int[] getIdArray(int column,
                        int row)
                 throws IOException
Returns an array containing the IDs of all the shape features contained within the specified tile. IDs are coded as int type and can be accessed using IlvSHPReader.getFeatureAt().

Parameters:
column - The column of the tile.
row - The row of the tile.
Throws:
IOException - if tile information cannot be read from the file containing this spatial index.
See Also:
IlvSHPReader.getFeatureAt(int)

add

public void add(int c,
                int r,
                int id)
Adds the object whose ID is specified in the spatial index, at the specified position.

Parameters:
c - The column position.
r - The row position.
id - The ID to add.
Throws:
UnsupportedOperationException - if this spatial index is read-only.

getColumnCount

public int getColumnCount()
Returns the number of tile columns covered by this index.


getRowCount

public int getRowCount()
Returns the number of tile rows covered by this index.


getOrigin

public IlvCoordinate getOrigin()
Returns the origin of the tile grid.


getTileWidth

public double getTileWidth()
Returns the width of one tile.


getTileHeight

public double getTileHeight()
Returns the height of one tile.


write

public void write(DataOutput output)
           throws IOException
Writes this spatial index to the specified data output.

Parameters:
output - The data output to write this spatial index to.
Throws:
IOException

save

public void save(String filename)
          throws IOException
Saves this spatial index to the file specified.

Parameters:
filename - The name of the file to save this spatial index to.
Throws:
IOException


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.