ilog.views.maps.format.image
Class IlvImageTileLoader

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

public class IlvImageTileLoader
extends IlvMapTileLoader

This class is a IlvTileLoader specialized for loading a set of images, each image representing a tile in a tiled data set. Additionally, this tile loader uses the following policy to find files whose names are used to create this tile loader:

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

Constructor Summary
IlvImageTileLoader(IlvInputStream stream)
          Constructs an IlvImageTileLoader by reading an IlvInputStream.
IlvImageTileLoader(String pattern, String colFormatString, String rowFormatString)
          Creates an IlvImageTileLoader by specifying a pattern and two formats used to construct a URL string for a given IlvTile.
 
Method Summary
 IlvFeatureRenderer getDefaultFeatureRenderer()
          Returns an IlvFeatureRenderer used to render an image.
 IlvMapFeatureIterator getFeatureIterator(IlvTile tile)
          Returns an IlvMapFeatureIterator used to load the tile tile.
protected  String getFileName(IlvTile tile)
          Returns the file name corresponding to the tile tile.
 boolean isPersistent()
          Returns true since this reader is persistent.
 void write(IlvOutputStream stream)
          Writes this tile loader in an IlvOutputStream.
 
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

IlvImageTileLoader

public IlvImageTileLoader(String pattern,
                          String colFormatString,
                          String rowFormatString)
Creates an IlvImageTileLoader by specifying a pattern and two formats used to construct a URL string for a given IlvTile.
The pattern string must contain one %r and one %c specifier.
When a tile is to be loaded, a URL string is built by replacing the %r conversion specifier with the row index of the tile, using the row format string.
The same operation is performed for the column of the tile, replacing the %c conversion specifier with the column index of the tile, using the column format string.
The two format strings are used to construct two DecimalFormat which are used to format the tile row and column.
For example, if the pattern is "ADirectory/file_%c_%r_image.jpg" and the colFormatString is "000" and the colFormatString is "0000", the resulting file name for the tile at (12, 34) will be "ADirectory/file_0034_012_image.jpg".

Parameters:
pattern - The file name pattern, containing one %c and one %r.
colFormatString - A string used to construct a DecimalFormat for the column specifier.
rowFormatString - A string used to construct a DecimalFormat for the row specifier.

IlvImageTileLoader

public IlvImageTileLoader(IlvInputStream stream)
                   throws IlvReadFileException
Constructs an IlvImageTileLoader by reading an IlvInputStream.

Parameters:
stream - The IlvInputStream to read from.
Throws:
IlvReadFileException
Method Detail

getDefaultFeatureRenderer

public IlvFeatureRenderer getDefaultFeatureRenderer()
Returns an IlvFeatureRenderer used to render an image.

Specified by:
getDefaultFeatureRenderer in class IlvMapTileLoader
Returns:
The IlvFeatureRenderer.

getFeatureIterator

public IlvMapFeatureIterator getFeatureIterator(IlvTile tile)
                                         throws Exception
Returns an IlvMapFeatureIterator used to load the tile tile.
This implementation returns an IlvImageReader based on the result of getFileName(IlvTile tile).
If the string returned by getFileName() can be interpreted as a URL, an IlvImageReader reading the image from the URL is returned.
If the string returned by getFileName() cannot be interpreted as a URL, an IlvImageReader reading the image from the file name returned by getFileName() is returned.

Specified by:
getFeatureIterator in class IlvMapTileLoader
Parameters:
tile - The IlvTile to be loaded.
Returns:
The resulting IlvMapFeatureIterator.
Throws:
Exception
See Also:
getFileName(ilog.views.tiling.IlvTile)

isPersistent

public boolean isPersistent()
Returns true since this reader is persistent.

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

getFileName

protected String getFileName(IlvTile tile)
                      throws ParseException
Returns the file name corresponding to the tile tile. This file name is built using the pattern and the formats specified by the constructor of the class. This implementation returns a URL string if the pattern lead to a string suitable for a URL construction. Otherwise, the plain file name is returned.

Parameters:
tile - The tile to be loaded.
Returns:
The resulting file name, or URL string.
Throws:
ParseException

write

public void write(IlvOutputStream stream)
           throws IOException
Writes this tile loader in an IlvOutputStream.

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


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