org.geotools.image.io.mosaic
Class MosaicController

java.lang.Object
  extended by org.geotools.image.io.mosaic.MosaicController
All Implemented Interfaces:
javax.imageio.IIOParamController

public class MosaicController
extends java.lang.Object
implements javax.imageio.IIOParamController

The default controller for mosaic parameters. Controllers are implemented by objects that can determine the settings of IIOParam objects, either by putting up a GUI to obtain values from a user, or by other means. Whether the controller puts up a GUI or merely computes a set of values is irrelevant to this class.

Two kinds of IIOParam can be setup by MosaicController:

The activate methods are executed only when explicitly invoked, typically through a call to IIOParam.activateController(). They are not invoked automatically by mosaic image reader or writer. This is different than configure(org.geotools.image.io.mosaic.Tile, javax.imageio.IIOParam), which is always invoked automatically by the above.

Users can create a subclass of MosaicController and pass it to IIOParam.setController(javax.imageio.IIOParamController) in order to control the configuration of a mosaic to be read or written.

Since:
2.5
Version:
$Id: MosaicController.java 30729 2008-06-16 09:26:48Z desruisseaux $
Author:
Martin Desruisseaux

Constructor Summary
protected MosaicController()
          Creates a default mosaic controller.
 
Method Summary
 boolean activate(javax.imageio.IIOParam parameters)
          Activates the mosaic controller.
protected  boolean activateForTile(javax.imageio.IIOParam parameters)
          Invoked by activate for every tile read parameters or tile write parameters.
protected  void configure(Tile tile, javax.imageio.IIOParam parameters)
          Automatically invoked by MosaicImageReader or MosaicImageWriter when a tile is about to be read or written.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MosaicController

protected MosaicController()
Creates a default mosaic controller. This constructor is for subclassing only. For other uses, an instance can be obtained with MosaicImageReadParam.getDefaultController().

Method Detail

activate

public boolean activate(javax.imageio.IIOParam parameters)
Activates the mosaic controller. This method is not invoked automatically, but only when IIOParam.activateController() is invoked explicitly.

When reading, the default implementation creates parameters for tile readers if not already done, then delegates the activation to their controllers. It returns true only if activation succeed for every tile readers.

When writting, the default implementation creates parameters for tile writers if not already done, then delegates the activation to their controllers. It returns true only if activation succeed for every tile writers.

Specified by:
activate in interface javax.imageio.IIOParamController
Parameters:
parameters - The parameters to be modified. It should be an instance of MosaicImageReadParam or MosaicImageWriteParam, but this is not mandatory.
Returns:
true if the parameters are ready for use, or false if the user canceled the operation.

activateForTile

protected boolean activateForTile(javax.imageio.IIOParam parameters)
Invoked by activate for every tile read parameters or tile write parameters. Note that this method is not necessarly invoked for every tiles, but only for every readers or writers to be used with tiles. For example this method is invoked only once if every tiles are to be read with the same image reader.

The default implementation delegates to IIOParam.activateController(). Subclasses can override this method is more control is wanted.

Parameters:
parameters - The parameters to be used for reading tiles. This is not the same than the parameters given to activate(javax.imageio.IIOParam), and is usually unrelated to mosaic parameters.
Returns:
true if the parameters are ready for use, or false if the user canceled the operation.

configure

protected void configure(Tile tile,
                         javax.imageio.IIOParam parameters)
Automatically invoked by MosaicImageReader or MosaicImageWriter when a tile is about to be read or written. The parameters setting are determined by reader or writer before to invoke this method and usually don't need to be changed. This method is provided as a hook allowing subclasses to performs additional setting.

The default implementation does nothing.

Parameters:
tile - The tile which is about to be read or written.
parameters - The parameter to be given to the image reader or writer.


Copyright © 1996-2010 Geotools. All Rights Reserved.