ilog.views.maps.format.shapefile
Class IlvShapeFileTileLoader

java.lang.Object
  extended by ilog.views.maps.format.IlvMapTileLoader
      extended by ilog.views.maps.format.shapefile.IlvShapeFileTileLoader
All Implemented Interfaces:
IlvPersistentObject, IlvTileLoader

public class IlvShapeFileTileLoader
extends IlvMapTileLoader

This class implements a tile loader to read tiles from an ESRI Shapefile whose spatial index has been created.
An ESRI Shapefile can be opened in load-on-demand mode if:

If an attribute table (.dbf file) is available, the attributes can be attached to objects.
Since JViews 5.0, this tile loader uses the following policy to find files whose names are used to create this tile loader:

Since:
JViews 4.0
See Also:
IlvMapDataPathManager, IlvInputStream.getDocumentBase()

Constructor Summary
IlvShapeFileTileLoader(IlvInputStream stream)
          Reads an IlvShapeFileTileLoader from the specified input stream.
IlvShapeFileTileLoader(String shpFilename, String dbfFilename, String shxFilename, String indexFilename)
          Constructs a new .shp file tile loader.
IlvShapeFileTileLoader(URL shpURL, URL dbfURL, URL shxURL, URL indexURL)
          Constructs a new .shp file tile loader.
 
Method Summary
 IlvCoordinateSystem getCoordinateSystem()
          Returns the spatial reference system that describes the coordinate system of the tile loader.
 String getDBFFilename()
          Returns the .dbf file from which this tile loader loads attributes.
 IlvFeatureRenderer getDefaultFeatureRenderer()
          Returns the default feature renderer for this tile loader.
 IlvMapFeatureIterator getFeatureIterator(IlvTile tile)
          Returns the feature iterator to load features from the specified tile.
 IlvCoordinate getLowerRightCorner()
          Returns the lower right corner of data read by this tile loader.
protected  IlvShapeFileReader getReader(String shpFilename, String dbfFilename, String shxFilename)
          Creates the IlvShapeFileReader to read from specified files.
protected  IlvShapeFileReader getReader(URL shp, URL dbf, URL shx)
          Creates the IlvShapeFileReader to read from specified files.
 String getSHPFilename()
          Returns the .shp file from which this tile loader loads geometries.
 String getSHXFilename()
          Returns the .shx file used as the shape index file.
 String getSpatialIndexFilename()
          Returns the spatial index file used by this tile loader to index geometries by tile.
 String getStringEncoding()
          Returns the character encoding used when reading the .dbf attribute table.
 IlvRect getTileOrigin()
          Returns the tile origin.
 IlvCoordinate getUpperLeftCorner()
          Returns the upper left corner of data read by this tile loader.
 boolean isPersistent()
          Returns true if the object is persistent.
 void setCoordinateSystem(IlvCoordinateSystem cs)
          Used to specify the source coordinate system of the geometries handled by this tile loader.
 void setStringEncoding(String encoding)
          Specifies the character encoding used when reading the .dbf attribute table.
 void write(IlvOutputStream stream)
          Writes this tile loader to the specified stream.
 
Methods inherited from class ilog.views.maps.format.IlvMapTileLoader
getFeatureRenderer, isAttachingAttributes, load, release, setAttachingAttributes, setFeatureRenderer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlvShapeFileTileLoader

public IlvShapeFileTileLoader(String shpFilename,
                              String dbfFilename,
                              String shxFilename,
                              String indexFilename)
                       throws IOException
Constructs a new .shp file tile loader.

Parameters:
shpFilename - The name of the .shp filename.
dbfFilename - The name of the .dbf filename.
shxFilename - The name of the .shx filename.
indexFilename - The name of the ILOG JViews spatial index filename.
Throws:
IOException

IlvShapeFileTileLoader

public IlvShapeFileTileLoader(URL shpURL,
                              URL dbfURL,
                              URL shxURL,
                              URL indexURL)
                       throws IOException
Constructs a new .shp file tile loader.

Parameters:
shpURL - The URL of the .shp filename.
dbfURL - The URL of the .dbf filename.
shxURL - The URL of the .shx filename.
indexURL - The URL of the ILOG JViews spatial index filename.
Throws:
IOException
Since:
JViews 7.5

IlvShapeFileTileLoader

public IlvShapeFileTileLoader(IlvInputStream stream)
                       throws IlvReadFileException,
                              IOException
Reads an IlvShapeFileTileLoader from the specified input stream.

Parameters:
stream - The input stream.
Throws:
IlvReadFileException - If a tile loader cannot be read from the specified stream.
IOException - If an I/O error occurs.
Method Detail

write

public void write(IlvOutputStream stream)
           throws IOException
Writes this tile loader to the specified stream.

Specified by:
write in interface IlvPersistentObject
Specified by:
write in interface IlvTileLoader
Overrides:
write in class IlvMapTileLoader
Parameters:
stream - The output stream.
Throws:
IOException - thrown when an exception occurs during the write operation for this object.

getTileOrigin

public IlvRect getTileOrigin()
Returns the tile origin.


getUpperLeftCorner

public IlvCoordinate getUpperLeftCorner()
Returns the upper left corner of data read by this tile loader.


getLowerRightCorner

public IlvCoordinate getLowerRightCorner()
Returns the lower right corner of data read by this tile loader.


getFeatureIterator

public IlvMapFeatureIterator getFeatureIterator(IlvTile tile)
                                         throws Exception
Returns the feature iterator to load features from the specified tile.
This implementation returns an IlvLookAheadFeatureIterator to read features for the specified tile.

Specified by:
getFeatureIterator in class IlvMapTileLoader
Parameters:
tile - The tile.
Returns:
The feature iterator to load features for this tile, or null if no features are to be loaded.
Throws:
Exception
See Also:
IlvLookAheadFeatureIterator

getDefaultFeatureRenderer

public IlvFeatureRenderer getDefaultFeatureRenderer()
Returns the default feature renderer for this tile loader.

Specified by:
getDefaultFeatureRenderer in class IlvMapTileLoader

isPersistent

public boolean isPersistent()
Returns true if the object is persistent.

Specified by:
isPersistent in interface IlvTileLoader
Specified by:
isPersistent in class IlvMapTileLoader

setStringEncoding

public void setStringEncoding(String encoding)
Specifies the character encoding used when reading the .dbf attribute table. The default is to use the default character encoding of the platform. See the Java internationalization documentation for the set of supported encodings.

Parameters:
encoding - The string encoding, or null to read attributes using the default encoding of the platform.

getStringEncoding

public String getStringEncoding()
Returns the character encoding used when reading the .dbf attribute table. The default is to use the default character encoding of the platform.

Returns:
The string encoding or null if using the default encoding of the platform.

setCoordinateSystem

public void setCoordinateSystem(IlvCoordinateSystem cs)
Used to specify the source coordinate system of the geometries handled by this tile loader.

Parameters:
cs - The coordinate system of the tile loader.
Since:
JViews 5.0

getCoordinateSystem

public IlvCoordinateSystem getCoordinateSystem()
Returns the spatial reference system that describes the coordinate system of the tile loader.

Returns:
The coordinate system.
Since:
JViews 5.0

getReader

protected IlvShapeFileReader getReader(String shpFilename,
                                       String dbfFilename,
                                       String shxFilename)
                                throws IOException
Creates the IlvShapeFileReader to read from specified files. Subclasses of IlvShapeFileTileLoader can override this method to produce a reader with the customized parameters for specific applications.

Parameters:
shpFilename - The name of the .shp filename.
dbfFilename - The name of the .dbf filename.
shxFilename - The name of the .shx filename.
Returns:
The default implementation returns an IlvShapeFileReader with the specified files.
Throws:
IOException
See Also:
getFeatureIterator(ilog.views.tiling.IlvTile)

getReader

protected IlvShapeFileReader getReader(URL shp,
                                       URL dbf,
                                       URL shx)
                                throws IOException
Creates the IlvShapeFileReader to read from specified files. Subclasses of IlvShapeFileTileLoader can override this method to produce a reader with the customized parameters for specific applications.

Parameters:
shp - The URL of the .shp filename.
dbf - The URL of the .dbf filename.
shx - The URL of the .shx filename.
Returns:
The default implementation returns an IlvShapeFileReader with the specified files.
Throws:
IOException
Since:
JViews 7.5
See Also:
getFeatureIterator(ilog.views.tiling.IlvTile)

getSHPFilename

public final String getSHPFilename()
Returns the .shp file from which this tile loader loads geometries.


getSHXFilename

public final String getSHXFilename()
Returns the .shx file used as the shape index file.


getDBFFilename

public final String getDBFFilename()
Returns the .dbf file from which this tile loader loads attributes.


getSpatialIndexFilename

public final String getSpatialIndexFilename()
Returns the spatial index file used by this tile loader to index geometries by tile.



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