org.geotoolkit.coverage.processing
Class AbstractCoverageProcessor

Object
  extended by Factory
      extended by AbstractCoverageProcessor
All Implemented Interfaces:
Localized, GridCoverageProcessor
Direct Known Subclasses:
CachingCoverageProcessor, DefaultCoverageProcessor

@ThreadSafe
public abstract class AbstractCoverageProcessor
extends Factory
implements GridCoverageProcessor, Localized

Provides operations for different ways of accessing the grid coverage values as well as image processing functionality. The list of available processing operations is implementation dependent. The class has a discovery mechanism to determine the available processing operations.

These processing operations will transform values within a single sample dimension, and leave the values in other sample dimensions unaffected. The modified sample dimension may also change its type (e.g. from UNSIGNED_4BITS to UNSIGNED_1BIT). The actual underlying grid data remains unchanged.

The class has been designed to allow the adaptations to be done in a "pipe-lined" manner. The class operates on Coverage to create new a Coverage. The class does not need to make a copy of the source grid data. Instead, it can return a grid coverage object which applies the adaptations on the original grid coverage whenever a block of data is requested. In this way, a pipeline of several grid coverages can be constructed cheaply.

This class can perform any of the following:

Since:
2.2
Version:
3.00
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
static Logger LOGGER
          The logger for coverage processing operations.
static Level OPERATION
          The logging level for reporting coverage operations.
 
Fields inherited from class Factory
EMPTY_HINTS, hints
 
Constructor Summary
protected AbstractCoverageProcessor()
          Constructs a coverage processor.
 
Method Summary
abstract  Coverage doOperation(ParameterValueGroup parameters)
          Applies an operation.
static AbstractCoverageProcessor getInstance()
          Returns a default processor instance.
 Locale getLocale()
          The locale for logging message or reporting errors.
abstract  Operation getOperation(String name)
          Returns the operation for the specified name.
abstract  Collection<Operation> getOperations()
          Retrieves grid processing operations information.
 void listOperations(Writer out)
          Lists a summary of all operations to the specified stream.
 void printOperations(Writer out, String[] names)
          Prints a description of operations to the specified stream.
 
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

LOGGER

public static final Logger LOGGER
The logger for coverage processing operations.


OPERATION

public static final Level OPERATION
The logging level for reporting coverage operations. This level is equals or slightly lower than Level.INFO.

Constructor Detail

AbstractCoverageProcessor

protected AbstractCoverageProcessor()
Constructs a coverage processor.

Method Detail

getInstance

public static AbstractCoverageProcessor getInstance()
Returns a default processor instance. This method is a shortcut for CoverageFactoryFinder.getCoverageProcessor(Hints) with hints asking for an instance of AbstractCoverageProcessor.

Returns:
The default processor instance.

getOperations

public abstract 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
Returns:
The available processing operations

getOperation

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

Parameters:
name - Name of the operation.
Returns:
The operation for the given name.
Throws:
OperationNotFoundException - if there is no operation for the specified name.

doOperation

public abstract Coverage doOperation(ParameterValueGroup parameters)
                              throws OperationNotFoundException,
                                     CoverageProcessingException
Applies an operation.

Parameters:
parameters - Parameters required for the operation.
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.

getLocale

public Locale getLocale()
The locale for logging message or reporting errors. The default implementations returns the default locale. Subclasses can override this method if a different locale is wanted.

Specified by:
getLocale in interface Localized
Returns:
The locale for logging message.

listOperations

public void listOperations(Writer out)
                    throws IOException
Lists a summary of all operations to the specified stream.

Parameters:
out - The destination stream.
Throws:
IOException - if an error occurred will writing to the stream.

printOperations

public void printOperations(Writer out,
                            String[] names)
                     throws OperationNotFoundException,
                            IOException
Prints a description of operations to the specified stream. If the names array is non-null, then only the specified operations are printed. Otherwise, all operations are printed. The description details include operation names and lists of parameters.

Parameters:
out - The destination stream.
names - The operation to print, or an empty array for none, or null for all.
Throws:
IOException - if an error occurred will writing to the stream.
OperationNotFoundException - if an operation named in names was not found.


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