org.geotoolkit.coverage.processing
Class DefaultCoverageProcessor

Object
  extended by Factory
      extended by AbstractCoverageProcessor
          extended by DefaultCoverageProcessor
All Implemented Interfaces:
Localized, GridCoverageProcessor

@ThreadSafe
public class DefaultCoverageProcessor
extends AbstractCoverageProcessor

Default implementation of a Coverage processor. This default implementation makes the following assumptions:

Note: This implementation does not cache produced coverages. Since coverages may be big, consider wrapping DefaultCoverageProcessor instances in CachingCoverageProcessor.

Since:
1.2
Version:
3.02
Author:
Martin Desruisseaux (IRD)
Module:
coverage/geotk-coverage (download)    View source code for this class

Nested Class Summary
 
Nested classes/interfaces inherited from class Factory
Factory.Availability, Factory.Organizer
 
Field Summary
 
Fields inherited from class AbstractCoverageProcessor
LOGGER, OPERATION
 
Fields inherited from class Factory
EMPTY_HINTS, hints
 
Constructor Summary
DefaultCoverageProcessor(Hints userHints)
          Constructs a coverage processor from the given hints.
 
Method Summary
protected  void addOperation(Operation operation)
          Adds the specified operation to this processor.
 Coverage doOperation(ParameterValueGroup parameters)
          Applies a process operation to a coverage.
 Operation getOperation(String name)
          Returns the operation for the specified name.
 Collection<Operation> getOperations()
          Retrieves grid processing operations information.
 Object getRenderingHint(RenderingHints.Key key)
          Returns a rendering hint.
 void scanForPlugins()
          Scans for factory plug-ins on the application class path.
 
Methods inherited from class AbstractCoverageProcessor
getInstance, getLocale, listOperations, printOperations
 
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
 

Constructor Detail

DefaultCoverageProcessor

public DefaultCoverageProcessor(Hints userHints)
Constructs a coverage processor from the given hints. The scanForPlugins() method will be automatically invoked the first time an operation is required. Additional operations can be added by subclasses with the addOperation(org.opengis.coverage.processing.Operation) method.

Rendering hints will be initialized with the following hints:

Parameters:
userHints - A set of additional rendering hints, or null if none.
Method Detail

addOperation

protected void addOperation(Operation operation)
                     throws IllegalStateException
Adds the specified operation to this processor. This method is usually invoked at construction time before this processor is made accessible.

Parameters:
operation - The operation to add.
Throws:
IllegalStateException - if an operation already exists with the same name.

getOperations

public Collection<Operation> getOperations()
Retrieves grid processing operations information. Each operation information contains the name of the operation as well as a list of its parameters.

Specified by:
getOperations in interface GridCoverageProcessor
Specified by:
getOperations in class AbstractCoverageProcessor
Returns:
The available processing operations

getOperation

public Operation getOperation(String name)
                       throws OperationNotFoundException
Returns the operation for the specified name.

Specified by:
getOperation in class AbstractCoverageProcessor
Parameters:
name - Name of the operation (case insensitive).
Returns:
The operation for the given name.
Throws:
OperationNotFoundException - if there is no operation for the specified name.

getRenderingHint

public final Object getRenderingHint(RenderingHints.Key key)
Returns a rendering hint.

Parameters:
key - The hint key (e.g. Hints.JAI_INSTANCE).
Returns:
The hint value for the specified key, or null if there is no hint for the specified key.

doOperation

public Coverage doOperation(ParameterValueGroup parameters)
                     throws CoverageProcessingException,
                            OperationNotFoundException
Applies a process operation to a coverage. The default implementation checks if source coverages use an interpolation, and then invokes AbstractOperation.doOperation(org.opengis.parameter.ParameterValueGroup, org.geotoolkit.factory.Hints). If all source coverages used the same interpolation, then this interpolation is applied to the resulting coverage (except if the resulting coverage has already an interpolation).

Specified by:
doOperation in class AbstractCoverageProcessor
Parameters:
parameters - Parameters required for the operation. The easiest way to construct them is to invoke operation.getParameters() and to modify the returned group.
Returns:
The result as a coverage.
Throws:
OperationNotFoundException - if there is no operation for the parameter group name.
CoverageProcessingException - if the operation can not be executed.

scanForPlugins

public void scanForPlugins()
Scans for factory plug-ins on the application class path. This method is needed because the application class path can theoretically change, or additional plug-ins may become available. Rather than re-scanning the classpath on every invocation of the API, the class path is scanned automatically only on the first invocation. Clients can call this method to prompt a re-scan. Thus this method need only be invoked by sophisticated applications which dynamically make new plug-ins available at runtime.



Copyright © 2009-2013 Geotoolkit.org. All Rights Reserved.