Class CoverageProcessor


  • public class CoverageProcessor
    extends Object
    Base class for coverage processor implementations.
    Since:
    2.2
    Author:
    Martin Desruisseaux (IRD), Simone Giannecchini, GeoSolutions S.A.S.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Hints hints
      The rendering hints for JAI operations (never null).
      static Logger LOGGER
      The logger for coverage processing operations.
      static Level OPERATION
      The logging level for reporting coverage operations.
      protected FactoryRegistry registry
      The service registry for finding Operation implementations.
    • Constructor Summary

      Constructors 
      Constructor Description
      CoverageProcessor()
      Constructs a coverage processor.
      CoverageProcessor​(RenderingHints hints)
      Constructs a default coverage processor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void addOperation​(Operation operation)
      Add the specified operation to this processor.
      Coverage doOperation​(ParameterValueGroup parameters)
      Applies a process operation to a coverage.
      Coverage doOperation​(ParameterValueGroup parameters, Hints hints)
      Applies a process operation to a coverage.
      static CoverageProcessor getInstance()
      Returns a default processor instance.
      static CoverageProcessor getInstance​(Hints hints)
      Returns a default processor instance.
      Locale getLocale()
      The locale for logging message or reporting errors.
      Operation getOperation​(String name)
      Returns the operation for the specified name.
      Collection<Operation> getOperations()
      Retrieves grid processing operations information.
      static Object getParameter​(ParameterBlockJAI parameters, String paramName)  
      Object getRenderingHint​(RenderingHints.Key key)
      Returns a rendering hint.
      void listOperations​(Writer out)
      Lists a summary of all operations to the specified stream.
      static void main​(String[] args)
      Dumps to the standard output stream a list of operations for the default processor.
      void printOperations​(Writer out, String[] names)
      Prints a description of operations to the specified stream.
      protected void removeOperation​(Operation operation)
      Removes the specified operation to this processor.
      static void removeOperationFromProcessors​(String operationName)
      This method is called when the user has registered another OperationDescriptor and must remove the old operation instance from the processors.
      void scanForPlugins()
      Scans for factory plug-ins on the application class path.
      static void updateProcessors()
      This method is called when the user has registered another OperationDescriptor for an operation and requires to update the various CoverageProcessors.
      • Methods inherited from class Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, 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.
      • hints

        protected final Hints hints
        The rendering hints for JAI operations (never null). This field is usually given as argument to OperationJAI methods.
    • Constructor Detail

      • CoverageProcessor

        public CoverageProcessor()
        Constructs a coverage processor.
      • CoverageProcessor

        public CoverageProcessor​(RenderingHints hints)
        Constructs a default coverage processor. 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.geotools.api.coverage.processing.Operation) method. Rendering hints will be initialized with the following hints:

        • JAI.KEY_REPLACE_INDEX_COLOR_MODEL set to Boolean.FALSE.
        • JAI.KEY_TRANSFORM_ON_COLORMAP set to Boolean.FALSE.
        Parameters:
        hints - A set of additional rendering hints, or null if none.
    • Method Detail

      • getInstance

        public static CoverageProcessor 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

        public static CoverageProcessor getInstance​(Hints hints)
        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 another OperationDescriptor for an operation and requires to update the various CoverageProcessors.
      • removeOperationFromProcessors

        public static void removeOperationFromProcessors​(String operationName)
        This method is called when the user has registered another OperationDescriptor and must remove the old operation instance from the processors.
        Parameters:
        operationName - Name of the operation to remove
      • 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.
      • 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 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 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 occured will writing to the stream.
        OperationNotFoundException - if an operation named in names was not found.
      • addOperation

        protected void addOperation​(Operation operation)
                             throws IllegalStateException
        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

        protected void removeOperation​(Operation operation)
        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

        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.
      • getOperation

        public Operation getOperation​(String name)
                               throws OperationNotFoundException
        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

        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.
      • 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

        public static void main​(String[] args)
        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:
         java org.geotools.coverage.processing.DefaultProcessor Interpolate
         
        Note for Windows users: If the output contains strange symbols, try to supply an "-encoding" argument. Example:
         java org.geotools.coverage.processing.DefaultProcessor -encoding Cp850
         
        The codepage number (850 in the previous example) can be fetch from the DOS command line by entering the "chcp" command with no arguments.
      • getParameter

        public static Object getParameter​(ParameterBlockJAI parameters,
                                          String paramName)