org.esa.beam.framework.gpf.pointop
Class PointOperator

java.lang.Object
  extended by org.esa.beam.framework.gpf.Operator
      extended by org.esa.beam.framework.gpf.pointop.PointOperator
Direct Known Subclasses:
PixelOperator, SampleOperator

public abstract class PointOperator
extends Operator

The PointOperator class serves as a base class for operators

  1. that compute single pixels independently of their neighbours and
  2. whose target product and all source products share the same grid and coordinate reference system.
More specifically, the target product and all source products must share the same raster size and GeoCoding.

Since:
BEAM 4.9
Author:
Norman Fomferra

Constructor Summary
PointOperator()
           
 
Method Summary
protected  void checkRasterSize()
          Checks if all source products share the same raster size, otherwise throws an exception.
protected abstract  void configureSourceSamples(SampleConfigurer sampleConfigurer)
          Configures all source samples that this operator requires for the computation of target samples.
protected  void configureTargetProduct(ProductConfigurer productConfigurer)
          Configures the target product via the given ProductConfigurer.
protected abstract  void configureTargetSamples(SampleConfigurer sampleConfigurer)
          Configures all target samples computed by this operator.
protected  Product createTargetProduct()
          Creates the target product instance.
 void initialize()
          Configures this PointOperator by performing a number of initialisation steps in the given order: prepareInputs() createTargetProduct() configureTargetProduct(ProductConfigurer) configureSourceSamples(SampleConfigurer) configureTargetSamples(SampleConfigurer) This method cannot be overridden by intention (template method).
protected  void prepareInputs()
          Prepares the inputs for this operator.
 
Methods inherited from class org.esa.beam.framework.gpf.Operator
checkForCancellation, computeTile, computeTileStack, deactivateComputeTileMethod, dispose, finalize, getId, getLogger, getParameter, getSourceProduct, getSourceProduct, getSourceProductId, getSourceProducts, getSourceTile, getSourceTile, getSpi, getTargetProduct, getTargetProperty, setLogger, setParameter, setRequiresAllBands, setSourceProduct, setSourceProduct, setSourceProducts, setSpi, setTargetProduct, stopTileComputationObservation, update
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PointOperator

public PointOperator()
Method Detail

initialize

public final void initialize()
                      throws OperatorException
Configures this PointOperator by performing a number of initialisation steps in the given order:
  1. prepareInputs()
  2. createTargetProduct()
  3. configureTargetProduct(ProductConfigurer)
  4. configureSourceSamples(SampleConfigurer)
  5. configureTargetSamples(SampleConfigurer)
This method cannot be overridden by intention (template method). Instead clients may wish to override the methods that are called during the initialisation sequence.

Specified by:
initialize in class Operator
Throws:
OperatorException - If the configuration cannot be performed.
See Also:
Operator.getTargetProduct()

prepareInputs

protected void prepareInputs()
                      throws OperatorException
Prepares the inputs for this operator. Called by initialize().

Clients may override to perform some extra validation of parameters and source products and/or to load external, auxiliary resources. External resources that may be opened by this method and that must remain open during the Operator's lifetime shall be closed by a dedicated override of the Operator.dispose() method.

Failures of input preparation shall be indicated by throwing an OperatorException.

The default implementation checks whether all source products have the same raster size. Clients that require a similar behaviour in their operator shall first call the super method in their implementation.

Throws:
OperatorException - If the validation of input fails.

createTargetProduct

protected Product createTargetProduct()
                               throws OperatorException
Creates the target product instance. Called by initialize().

The default implementation creates a target product instance given the raster size of the (first) source product.

Returns:
A new target product instance.
Throws:
OperatorException - If the target product cannot be created.

configureTargetProduct

protected void configureTargetProduct(ProductConfigurer productConfigurer)
Configures the target product via the given ProductConfigurer. Called by initialize().

Client implementations of this method usually add product components to the given target product, such as bands to be computed by this operator, virtual bands, masks or sample codings.

The default implementation retrieves the (first) source product and copies to the target product

Clients that require a similar behaviour in their operator shall first call the super method in their implementation.

Parameters:
productConfigurer - The target product configurer.
Throws:
OperatorException - If the target product cannot be configured.
See Also:
Product.addBand(org.esa.beam.framework.datamodel.Band), Product.addBand(String, String), Product.addTiePointGrid(org.esa.beam.framework.datamodel.TiePointGrid), Product.getMaskGroup()

configureSourceSamples

protected abstract void configureSourceSamples(SampleConfigurer sampleConfigurer)
                                        throws OperatorException
Configures all source samples that this operator requires for the computation of target samples. Source sample are defined by using the provided SampleConfigurer.

The method is called by initialize().

Parameters:
sampleConfigurer - The configurer that defines the layout of a pixel.
Throws:
OperatorException - If the source samples cannot be configured.

configureTargetSamples

protected abstract void configureTargetSamples(SampleConfigurer sampleConfigurer)
                                        throws OperatorException
Configures all target samples computed by this operator. Target samples are defined by using the provided SampleConfigurer.

The method is called by initialize().

Parameters:
sampleConfigurer - The configurer that defines the layout of a pixel.
Throws:
OperatorException - If the target samples cannot be configured.

checkRasterSize

protected void checkRasterSize()
                        throws OperatorException
Checks if all source products share the same raster size, otherwise throws an exception. Called by initialize().

Throws:
OperatorException - If the source product's raster sizes are not equal.


Copyright © 2002-2013 Brockmann Consult GmbH. All Rights Reserved.