org.esa.beam.framework.dataio
Class ProductFlipper

java.lang.Object
  extended by org.esa.beam.framework.dataio.AbstractProductReader
      extended by org.esa.beam.framework.dataio.AbstractProductBuilder
          extended by org.esa.beam.framework.dataio.ProductFlipper
All Implemented Interfaces:
ProductReader

public class ProductFlipper
extends AbstractProductBuilder

Version:
$Revision$ $Date$
Author:
Norman Fomferra

Field Summary
static int FLIP_BOTH
           
static int FLIP_HORIZONTAL
           
static int FLIP_VERTICAL
           
 
Fields inherited from class org.esa.beam.framework.dataio.AbstractProductBuilder
bandMap, newProductDesc, newProductName, sceneRasterHeight, sceneRasterWidth, sourceProduct, sourceProductOwner
 
Constructor Summary
ProductFlipper(int flipType)
           
ProductFlipper(int flipType, boolean sourceProductOwner)
           
 
Method Summary
 void close()
          Closes the access to all currently opened resources such as file input streams and all resources of this children directly owned by this reader.
static Product createFlippedProduct(Product sourceProduct, boolean sourceProductOwner, int flipType, String name, String desc)
           
static Product createFlippedProduct(Product sourceProduct, int flipType, String name, String desc)
           
 int getFlipType()
           
 void readBandRasterData(Band destBand, int destOffsetX, int destOffsetY, int destWidth, int destHeight, ProductData destBuffer, com.bc.ceres.core.ProgressMonitor pm)
          Reads raster data from the data source specified by the given destination band into the given in-memory buffer and region.
protected  void readBandRasterDataImpl(int sourceOffsetX, int sourceOffsetY, int sourceWidth, int sourceHeight, int sourceStepX, int sourceStepY, Band destBand, int destOffsetX, int destOffsetY, int destWidth, int destHeight, ProductData destBuffer, com.bc.ceres.core.ProgressMonitor pm)
          The template method which is called by the readBandRasterDataSubSampling method after an optional spatial subset has been applied to the input parameters.
protected  Product readProductNodesImpl()
          Reads a data product and returns a in-memory representation of it.
 
Methods inherited from class org.esa.beam.framework.dataio.AbstractProductBuilder
addAttribString, addFlagCodingsToProduct, addIndexCodingsToProduct, addMetadataToProduct, cloneFlags, cloneIndexes, cloneMetadataAttributes, cloneMetadataElements, cloneMetadataElementsAndAttributes, disposeBandMap, getSceneRasterHeight, getSceneRasterWidth, getSourceProduct, isInstanceOfValidInputType, isSourceProductOwner, readProductNodes, setNewProductDesc, setNewProductName
 
Methods inherited from class org.esa.beam.framework.dataio.AbstractProductReader
configurePreferredTileSize, createTiePointGrid, getGridDiscontinutity, getInput, getProductComponents, getReaderPlugIn, getSubsetDef, isMetadataIgnored, isNodeAccepted, readProductNodes, setInput, setSubsetDef, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FLIP_HORIZONTAL

public static final int FLIP_HORIZONTAL
See Also:
Constant Field Values

FLIP_VERTICAL

public static final int FLIP_VERTICAL
See Also:
Constant Field Values

FLIP_BOTH

public static final int FLIP_BOTH
See Also:
Constant Field Values
Constructor Detail

ProductFlipper

public ProductFlipper(int flipType)

ProductFlipper

public ProductFlipper(int flipType,
                      boolean sourceProductOwner)
Method Detail

createFlippedProduct

public static Product createFlippedProduct(Product sourceProduct,
                                           int flipType,
                                           String name,
                                           String desc)
                                    throws IOException
Throws:
IOException

createFlippedProduct

public static Product createFlippedProduct(Product sourceProduct,
                                           boolean sourceProductOwner,
                                           int flipType,
                                           String name,
                                           String desc)
                                    throws IOException
Throws:
IOException

getFlipType

public int getFlipType()

readProductNodesImpl

protected Product readProductNodesImpl()
                                throws IOException
Reads a data product and returns a in-memory representation of it. This method was called by readProductNodes(input, subsetInfo) of the abstract superclass.

Specified by:
readProductNodesImpl in class AbstractProductBuilder
Returns:
a new product instance
Throws:
IllegalArgumentException - if input type is not one of the supported input sources.
IOException - if an I/O error occurs

close

public void close()
           throws IOException
Closes the access to all currently opened resources such as file input streams and all resources of this children directly owned by this reader. Its primary use is to allow the garbage collector to perform a vanilla job.

This method should be called only if it is for sure that this object instance will never be used again. The results of referencing an instance of this class after a call to close() are undefined.

Overrides of this method should always call super.close(); after disposing this instance.

Specified by:
close in interface ProductReader
Overrides:
close in class AbstractProductBuilder
Throws:
IOException - if an I/O error occurs

readBandRasterData

public void readBandRasterData(Band destBand,
                               int destOffsetX,
                               int destOffsetY,
                               int destWidth,
                               int destHeight,
                               ProductData destBuffer,
                               com.bc.ceres.core.ProgressMonitor pm)
                        throws IOException
Reads raster data from the data source specified by the given destination band into the given in-memory buffer and region.

For a complete description, please refer to the ProductReader.readBandRasterData(org.esa.beam.framework.datamodel.Band, int, int, int, int, org.esa.beam.framework.datamodel.ProductData, com.bc.ceres.core.ProgressMonitor) interface definition} of this method.

The AbstractProductReader implements this method using the Template Method pattern. The template method in this case is the abstract method to which the call is delegated after an optional spatial subset given by AbstractProductReader.getSubsetDef() has been applied to the input parameters.

Specified by:
readBandRasterData in interface ProductReader
Overrides:
readBandRasterData in class AbstractProductReader
Parameters:
destBand - the destination band which identifies the data source from which to read the sample values
destOffsetX - the X-offset in the band's raster co-ordinates
destOffsetY - the Y-offset in the band's raster co-ordinates
destWidth - the width of region to be read given in the band's raster co-ordinates
destHeight - the height of region to be read given in the band's raster co-ordinates
destBuffer - the destination buffer which receives the sample values to be read
pm - a monitor to inform the user about progress
Throws:
IOException - if an I/O error occurs
IllegalArgumentException - if the number of elements destination buffer not equals destWidth * destHeight or the destination region is out of the band's raster
See Also:
readBandRasterDataImpl(int, int, int, int, int, int, org.esa.beam.framework.datamodel.Band, int, int, int, int, org.esa.beam.framework.datamodel.ProductData, com.bc.ceres.core.ProgressMonitor), AbstractProductReader.getSubsetDef(), ProductReader.readBandRasterData(org.esa.beam.framework.datamodel.Band, int, int, int, int, org.esa.beam.framework.datamodel.ProductData, com.bc.ceres.core.ProgressMonitor), RasterDataNode.getRasterWidth(), RasterDataNode.getRasterHeight()

readBandRasterDataImpl

protected void readBandRasterDataImpl(int sourceOffsetX,
                                      int sourceOffsetY,
                                      int sourceWidth,
                                      int sourceHeight,
                                      int sourceStepX,
                                      int sourceStepY,
                                      Band destBand,
                                      int destOffsetX,
                                      int destOffsetY,
                                      int destWidth,
                                      int destHeight,
                                      ProductData destBuffer,
                                      com.bc.ceres.core.ProgressMonitor pm)
                               throws IOException
The template method which is called by the readBandRasterDataSubSampling method after an optional spatial subset has been applied to the input parameters.

The destination band, buffer and region parameters are exactly the ones passed to the original readBandRasterDataSubSampling call. Since the destOffsetX and destOffsetY parameters are already taken into acount in the sourceOffsetX and sourceOffsetY parameters, an implementor of this method is free to ignore them.

Specified by:
readBandRasterDataImpl in class AbstractProductReader
Parameters:
sourceOffsetX - the absolute X-offset in source raster co-ordinates
sourceOffsetY - the absolute Y-offset in source raster co-ordinates
sourceWidth - the width of region providing samples to be read given in source raster co-ordinates
sourceHeight - the height of region providing samples to be read given in source raster co-ordinates
sourceStepX - the sub-sampling in X direction within the region providing samples to be read
sourceStepY - the sub-sampling in Y direction within the region providing samples to be read
destBand - the destination band which identifies the data source from which to read the sample values
destOffsetX - the X-offset in the band's raster co-ordinates
destOffsetY - the Y-offset in the band's raster co-ordinates
destWidth - the width of region to be read given in the band's raster co-ordinates
destHeight - the height of region to be read given in the band's raster co-ordinates
destBuffer - the destination buffer which receives the sample values to be read
pm - a monitor to inform the user about progress
Throws:
IOException - if an I/O error occurs
See Also:
AbstractProductReader.getSubsetDef()


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