org.geotools.coverage.processing
Class BufferedProcessor

java.lang.Object
  extended byorg.geotools.coverage.processing.AbstractProcessor
      extended byorg.geotools.coverage.processing.BufferedProcessor

public class BufferedProcessor
extends AbstractProcessor

A coverage processor caching the result of any operations. Since a grid coverage may be expensive to compute and consumes a lot of memory, we can save a lot of resources by returning cached instances every time the same operation with the same parameters is applied on the same coverage. Coverages are cached using weak references.

Since:
2.2
Version:
$Id: BufferedProcessor.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Martin Desruisseaux

Field Summary
protected  AbstractProcessor processor
          The underlying processor.
 
Fields inherited from class org.geotools.coverage.processing.AbstractProcessor
LOGGER, OPERATION
 
Constructor Summary
BufferedProcessor(AbstractProcessor processor)
          Creates a new buffered processor backed by the specified processor.
BufferedProcessor(java.awt.RenderingHints hints)
          Creates a buffered processor backed by a default processor using the specified hints.
 
Method Summary
 org.opengis.coverage.Coverage doOperation(org.opengis.parameter.ParameterValueGroup parameters)
          Applies an operation.
 org.opengis.coverage.processing.Operation getOperation(java.lang.String name)
          Returns the operation for the specified name.
 java.util.Collection getOperations()
          Retrieves grid processing operations information.
 
Methods inherited from class org.geotools.coverage.processing.AbstractProcessor
getInstance, getLocale, listOperations, main, printOperations
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

processor

protected final AbstractProcessor processor
The underlying processor.

Constructor Detail

BufferedProcessor

public BufferedProcessor(java.awt.RenderingHints hints)
Creates a buffered processor backed by a default processor using the specified hints. Null or empty hints are legal, but consider using the default instance in such case.


BufferedProcessor

public BufferedProcessor(AbstractProcessor processor)
Creates a new buffered processor backed by the specified processor. If the specified processor is an instance of DefaultProcessor, consider using the constructor expecting hints instead, for efficienty.

Method Detail

getOperations

public java.util.Collection getOperations()
Retrieves grid processing operations information. The default implementation forward the call directly to the underlying processor.

Specified by:
getOperations in class AbstractProcessor

getOperation

public org.opengis.coverage.processing.Operation getOperation(java.lang.String name)
                                                       throws org.opengis.coverage.processing.OperationNotFoundException
Returns the operation for the specified name. The default implementation forward the call directly to the underlying processor.

Specified by:
getOperation in class AbstractProcessor
Parameters:
name - Name of the operation.
Returns:
The operation for the given name.
Throws:
org.opengis.coverage.processing.OperationNotFoundException - if there is no operation for the specified name.

doOperation

public org.opengis.coverage.Coverage doOperation(org.opengis.parameter.ParameterValueGroup parameters)
                                          throws org.opengis.coverage.processing.OperationNotFoundException
Applies an operation. The default implementation first checks if a coverage has already been created from the same parameters. If such a coverage is found, it is returned. Otherwise, this method forward the call to the underlying processor and caches the result.

Specified by:
doOperation in class AbstractProcessor
Parameters:
parameters - Parameters required for the operation.
Returns:
The result as a coverage.
Throws:
org.opengis.coverage.processing.OperationNotFoundException - if there is no operation for the parameter group name.


Copyright © GeoTools. All Rights Reserved.