Package org.geotools.coverage.processing
Class CoverageProcessor
Object
CoverageProcessor
Base class for coverage processor implementations.
- Since:
- 2.2
- Author:
- Martin Desruisseaux (IRD), Simone Giannecchini, GeoSolutions S.A.S.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final HintsThe rendering hints for ImageN operations (nevernull).static final LoggerThe logger for coverage processing operations.static final LevelThe logging level for reporting coverage operations.protected final FactoryRegistryThe service registry for findingOperationimplementations. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a coverage processor.CoverageProcessor(RenderingHints hints) Constructs a default coverage processor. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddOperation(Operation operation) Add the specified operation to this processor.doOperation(ParameterValueGroup parameters) Applies a process operation to a coverage.doOperation(ParameterValueGroup parameters, Hints hints) Applies a process operation to a coverage.static CoverageProcessorReturns a default processor instance.static CoverageProcessorgetInstance(Hints hints) Returns a default processor instance.The locale for logging message or reporting errors.getOperation(String name) Returns the operation for the specified name.Retrieves grid processing operations information.static ObjectgetParameter(ParameterBlockImageN parameters, String paramName) final ObjectReturns a rendering hint.voidlistOperations(Writer out) Lists a summary of all operations to the specified stream.static voidDumps to the standard output stream a list of operations for the default processor.voidprintOperations(Writer out, String[] names) Prints a description of operations to the specified stream.protected voidremoveOperation(Operation operation) Removes the specified operation to this processor.voidScans for factory plug-ins on the application class path.static voidThis method is called when the user has registered anotherOperationDescriptorfor an operation and requires to update the various CoverageProcessors.
-
Field Details
-
LOGGER
The logger for coverage processing operations. -
OPERATION
The logging level for reporting coverage operations. This level is equals or slightly lower thanLevel.INFO. -
hints
The rendering hints for ImageN operations (nevernull). This field is usually given as argument toOperationJAImethods. -
registry
The service registry for findingOperationimplementations.
-
-
Constructor Details
-
CoverageProcessor
public CoverageProcessor()Constructs a coverage processor. -
CoverageProcessor
Constructs a default coverage processor. ThescanForPlugins()method will be automatically invoked the first time an operation is required. Additional operations can be added by subclasses with theaddOperation(org.geotools.api.coverage.processing.Operation)method. Rendering hints will be initialized with the following hints:JAI#KEY_REPLACE_INDEX_COLOR_MODELset toBoolean.FALSE.JAI#KEY_TRANSFORM_ON_COLORMAPset toBoolean.FALSE.
- Parameters:
hints- A set of additional rendering hints, ornullif none.
-
-
Method Details
-
getInstance
Returns a default processor instance.Note: this is a temporary method, until we have GeoAPI interface for coverage processor and a factory finder for their implementations.
-
getInstance
Returns a default processor instance.Note: this is a temporary method, until we have GeoAPI interface for coverage processor and a factory finder for their implementations.
-
updateProcessors
public static void updateProcessors()This method is called when the user has registered anotherOperationDescriptorfor an operation and requires to update the various CoverageProcessors. -
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. -
listOperations
Lists a summary of all operations to the specified stream.- Parameters:
out- The destination stream.- Throws:
IOException- if an error occured 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 thenamesarray 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, ornullfor all.- Throws:
IOException- if an error occured will writing to the stream.OperationNotFoundException- if an operation named innameswas not found.
-
addOperation
Add 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.
-
removeOperation
Removes 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 remove.
-
getOperations
Retrieves grid processing operations information. Each operation information contains the name of the operation as well as a list of its parameters. -
getOperation
Returns the operation for the specified name.- 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
Returns a rendering hint.- Parameters:
key- The hint key (e.g.Hints.JAI_INSTANCE).- Returns:
- The hint value for the specified key, or
nullif there is no hint for the specified key.
-
doOperation
Applies a process operation to a coverage. The default implementation checks if source coverages use an interpolation, and then invokesAbstractOperation.doOperation(org.geotools.api.parameter.ParameterValueGroup, org.geotools.util.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).- Parameters:
parameters- Parameters required for the operation. The easiest way to construct them is to invokeoperation.and to modify the returned group.getParameters()- Returns:
- The result as a coverage.
- Throws:
OperationNotFoundException- if there is no operation for the parameter group name.
-
doOperation
Applies a process operation to a coverage. The default implementation checks if source coverages use an interpolation, and then invokesAbstractOperation.doOperation(org.geotools.api.parameter.ParameterValueGroup, org.geotools.util.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).- Parameters:
parameters- Parameters required for the operation. The easiest way to construct them is to invokeoperation.and to modify the returned group.getParameters()- Returns:
- The result as a coverage.
- Throws:
OperationNotFoundException- if there is no operation for the parameter group name.
-
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. -
main
Dumps to the standard output stream a list of operations for the default processor. If no argument is provided, then only a summary of operations is printed. If arguments are provided, then the operation parameters are printed for all operation names given in arguments. This method can been invoked from the command line. For example:
Note for Windows users: If the output contains strange symbols, try to supply an "java org.geotools.coverage.processing.DefaultProcessor Interpolate
-encoding" argument. Example:
The codepage number (850 in the previous example) can be fetch from the DOS command line by entering the "java org.geotools.coverage.processing.DefaultProcessor -encoding Cp850
chcp" command with no arguments. -
getParameter
-