ilog.views.maps.format.shapefile
Class IlvShapeFileTiler

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

public class IlvShapeFileTiler
extends Object

An IlvShapeFileTiler is used to generate and to save tile information for a given Shapefile.
There are two ways to use this class :
A direct way, tile information is written in one call :

 IlvShapeFileTiler.CreateShapeSpatialIndex(sourceFileName,
                                           targetFileName,
                                           tileWidth,
                                           tileHeight);
 
or a step by step way, allowing to update a progress bar,
 IlvShapeFileTiler tiler = new IlvShapeFileTiler(sourceFileName,
                                                 shxFileName,
                                                 targetFileName,
                                                 tileWidth,
                                                 tileHeight);
 while(tiler.getNextFeature() != null) {
           updateProgressBar();
           tiler.addInfo();
 }
 tiler.close();
 

Since:
JViews 5.0

Constructor Summary
IlvShapeFileTiler(String shpFilename, String shxFileName, String targetFileName, double tileWidth, double tileHeight)
          Constructs a new IlvShapeFileTiler providing a shapefile name, a shx file name, a target index file name, and a tile size.
IlvShapeFileTiler(String shpFilename, String shxFileName, String targetFileName, int numColumns, int numRows)
          Constructs a new IlvShapeFileTiler providing a shapefile name, an shx file name, a target index file name, the number of columns, and the number of rows.
 
Method Summary
 void addInfo()
          Adds a single object in the spatial index.
 void close()
          Saves the tiling information, and closes the readers.
static void CreateShapeSpatialIndex(String shpFilename, String targetFileName, double tileWidth, double tileHeight)
          Creates a shape spatial index in one call.
static void CreateShapeSpatialIndex(String shpFilename, String targetFileName, int numColumns, int numRows)
          Creates a shape spatial index in one call.
 double getColumnCount()
          Returns the number of columns.
 int getCurrentCount()
          Returns the number of objects currently processed.
 int getFeatureCount()
          Returns the total number of objects to process, or 0 if the index file could not be opened.
 IlvCoordinate getLowerRightCorner()
          Returns the lower right coordinate of the bounding box that delimits the objects contained in the shape file.
 IlvMapFeature getNextFeature()
          Returns the next feature from the shape file.
 IlvCoordinate getOrigin()
          Returns the origin of the tile grid.
 double getRowCount()
          Returns the number of rows.
 double getTileHeight()
          Returns the height of a tile in manager coordinates.
 double getTileWidth()
          Returns the width of a tile in manager coordinates.
 IlvCoordinate getUpperLeftCorner()
          Returns the upper left coordinate of the bounding box that delimits the objects contained in the shape file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlvShapeFileTiler

public IlvShapeFileTiler(String shpFilename,
                         String shxFileName,
                         String targetFileName,
                         double tileWidth,
                         double tileHeight)
                  throws IOException
Constructs a new IlvShapeFileTiler providing a shapefile name, a shx file name, a target index file name, and a tile size.

Parameters:
shpFilename - The source shape file name.
shxFileName - The name of the shx file, or null if no progress information is needed.
targetFileName - The target spatial index file name.
tileWidth - The width of one tile, in manager coordinates.
tileHeight - The height of one tile, in manager coordinates.
Throws:
IOException

IlvShapeFileTiler

public IlvShapeFileTiler(String shpFilename,
                         String shxFileName,
                         String targetFileName,
                         int numColumns,
                         int numRows)
                  throws IOException
Constructs a new IlvShapeFileTiler providing a shapefile name, an shx file name, a target index file name, the number of columns, and the number of rows.

Parameters:
shpFilename - The source shape file name.
shxFileName - The name of the shx file, or null if no progress information is needed.
targetFileName - The target spatial index file name.
numColumns - The number of columns.
numRows - The number of rows.
Throws:
IOException
Method Detail

getUpperLeftCorner

public IlvCoordinate getUpperLeftCorner()
Returns the upper left coordinate of the bounding box that delimits the objects contained in the shape file.


getLowerRightCorner

public IlvCoordinate getLowerRightCorner()
Returns the lower right coordinate of the bounding box that delimits the objects contained in the shape file.


CreateShapeSpatialIndex

public static void CreateShapeSpatialIndex(String shpFilename,
                                           String targetFileName,
                                           int numColumns,
                                           int numRows)
                                    throws Exception
Creates a shape spatial index in one call.

Parameters:
shpFilename - The source shape file name.
targetFileName - The target spatial index file name.
numColumns - The number of columns.
numRows - The number of rows.
Throws:
Exception

CreateShapeSpatialIndex

public static void CreateShapeSpatialIndex(String shpFilename,
                                           String targetFileName,
                                           double tileWidth,
                                           double tileHeight)
                                    throws Exception
Creates a shape spatial index in one call.

Parameters:
shpFilename - The source shape file name.
targetFileName - The target spatial index file name.
tileWidth - The tile width.
tileHeight - The tile height.
Throws:
Exception

addInfo

public void addInfo()
             throws IOException
Adds a single object in the spatial index.

Throws:
IOException

getNextFeature

public IlvMapFeature getNextFeature()
                             throws IOException
Returns the next feature from the shape file.

Throws:
IOException

close

public void close()
           throws IOException
Saves the tiling information, and closes the readers.

Throws:
IOException

getOrigin

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


getTileWidth

public double getTileWidth()
Returns the width of a tile in manager coordinates.


getTileHeight

public double getTileHeight()
Returns the height of a tile in manager coordinates.


getColumnCount

public double getColumnCount()
Returns the number of columns.


getRowCount

public double getRowCount()
Returns the number of rows.


getCurrentCount

public int getCurrentCount()
Returns the number of objects currently processed.


getFeatureCount

public int getFeatureCount()
Returns the total number of objects to process, or 0 if the index file could not be opened.



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