|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectFactory
TileManagerFactory
public class TileManagerFactory
Creates TileManager instances from a collection or a directory of tiles.
| coverage/geotk-coverageio (download) | View source code for this class |
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class Factory |
|---|
Factory.Availability, Factory.Organizer |
| Field Summary | |
|---|---|
static TileManagerFactory |
DEFAULT
The default instance. |
| Fields inherited from class Factory |
|---|
EMPTY_HINTS, hints |
| Constructor Summary | |
|---|---|
protected |
TileManagerFactory(Hints hints)
Creates a new factory from the specified hints. |
| Method Summary | |
|---|---|
TileManager[] |
create(Collection<Tile> tiles)
Creates tile managers from the specified collection of tiles. |
TileManager[] |
create(File file)
Creates a tile manager from the given file or directory. |
TileManager[] |
create(File directory,
FileFilter filter,
ImageReaderSpi spi)
Creates tile managers from the files found in the given directory. |
TileManager[] |
create(Tile... tiles)
Creates tile managers from the specified array of tiles. |
TileManager[] |
createFromObject(Object tiles)
Creates tile managers from the specified object, which may be null. |
protected TileManager |
createGeneric(Tile[] tiles)
Creates a single tile manager from the given array of tiles. |
List<Tile> |
listTiles(ImageReaderSpi provider,
File... inputs)
Returns a list of tiles constructed from the given array of files. |
| Methods inherited from class Factory |
|---|
availability, dispose, equals, getImplementationHints, hasCompatibleHints, hashCode, setOrdering, toString |
| Methods inherited from class Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final TileManagerFactory DEFAULT
| Constructor Detail |
|---|
protected TileManagerFactory(Hints hints)
hints - Optional hints, or null if none.| Method Detail |
|---|
public TileManager[] createFromObject(Object tiles)
throws IOException,
IllegalArgumentException
null. If non-null, the
object shall be an instance of TileManager[], TileManager, Tile[],
Collection<Tile> or File.
tiles - The tiles, or null.
null if tiles was null.
IllegalArgumentException - if tiles is not an instance of a valid class,
or if it is an array or a collection containing null elements.
IOException - If an I/O operation was required and failed.MosaicImageReader.Spi.getInputTypes()
public TileManager[] create(File file)
throws IOException
".serialized"
suffix, then this method deserializes the object in the given file and passes it to
createFromObject(Object).create(File, FileFilter, ImageReaderSpi) which scan
all image files found in the directory.IOException is thrown.
file - The serialized file or the directory to scan.
IOException - If the given file is not recognized, or an I/O operation failed.
public TileManager[] create(File directory,
FileFilter filter,
ImageReaderSpi spi)
throws IOException
First, this method fetches the list of all filtered files in the directory and sub-directories.
Then this method invokes the listTiles(ImageReaderSpi, File[]) method for converting
the list of files into a list of Tile instances. Note that in current implementation,
this implies that each image file in the given directory shall have a
World File of the same name,
typically with the ".tfw" extension. Finally this method builds the tiles manager
using the create(Collection) method.
If the file filter is null, a default file filter will be created from the given SPI. If the given SPI is null, a SPI will be inferred automatically for each image files found in the directory.
directory - The directory to scan.filter - An optional file filter, or null for a default filter.spi - An optional image provider, or null for auto-detect.
IOException - If the given file is not a directory, or an I/O operation failed.
public TileManager[] create(Tile... tiles)
throws IOException
tiles - The tiles to give to a tile manager.
IOException - If an I/O operation was required and failed.
public TileManager[] create(Collection<Tile> tiles)
throws IOException
tiles - The tiles to give to a tile manager.
IOException - If an I/O operation was required and failed.
protected TileManager createGeneric(Tile[] tiles)
throws IOException
create methods.
The tile array has already been cloned and can be stored directly by the
tile manager constructors.
Subclasses can override this method if they want to create other kinds of tile managers.
tiles - A copy of user-supplied tiles.
IOException - If an I/O operation was required and failed.
public List<Tile> listTiles(ImageReaderSpi provider,
File... inputs)
throws IOException
".tfw" (for TIFF images) or ".jgw" (for JPEG images).
This method loads the World Files and fetches the image sizes immediately. The world file applies to the first image in the file. If the file contains more than one image, then each additional image is assumed to represent the same data than the first image at a different resolution.
Customization
If the files contain many images but those images are not overviews of
the first image at different resolution, then subclasses can use only a specific image
by overriding this method as below, where imageIndex is the index of the image
to use (typically 0):
public List<Tile> listTiles(final ImageReaderSpi provider, final File... inputs) throws IOException {
final List<Tile> tiles = new ArrayList<Tile>(inputs.length);
for (final File input : inputs) {
tiles.add(new Tile(provider, input, imageIndex));
}
return tiles;
}
This method is invoked by create(File, FileFilter, ImageReaderSpi), so it can be
overridden for controlling the tiles to be built when TileManagerFactory scans a
directory.
provider - The image reader provider to use. If null, the provider will be
inferred from each input. If it can't be inferred, then an exception is thrown.inputs - The image files.
IOException - If no World File were found for a given image file, or
if an error occurred while reading a file.Tile.Tile(ImageReaderSpi, File, int)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||