org.esa.beam.framework.dataio
Class ProductSubsetDef

java.lang.Object
  extended by org.esa.beam.framework.dataio.ProductSubsetDef

public class ProductSubsetDef
extends Object

The ProductSubsetDef class describes a subset or portion of a remote sensing data product.

Subsets can be spatial or spectral or both. A spatial subset is given through a rectangular region in pixels. The spectral subset as a list of band (or channel) names.

Version:
$Revision$ $Date$
Author:
Norman Fomferra, Sabine Embacher

Constructor Summary
ProductSubsetDef()
          Constructs a new and empty subset info.
ProductSubsetDef(String subsetName)
          Constructs a new and empty subset info.
 
Method Summary
 void addNodeName(String name)
          Adds a new product node name to this subset.
 void addNodeNames(String[] names)
          Adds the given product node names to this subset.
 boolean containsNodeName(String name)
          Checks whether or not a node name is already contained in this subset.
 String[] getNodeNames()
          Gets the names of all product nodes contained in this subset.
 Rectangle getRegion()
          Gets the spatial subset as a rectangular region.
 Dimension getSceneRasterSize(int maxWidth, int maxHeight)
          Gets the required size for a raster required to hold all pixels for the spatial subset for the given maximum raster width and height.
 int getSubSamplingX()
          Gets the sub-sampling in X-direction (horizontal).
 int getSubSamplingY()
          Gets the sub-sampling in Y-direction (vertical).
 String getSubsetName()
           
 boolean getTreatVirtualBandsAsRealBands()
           
 boolean isEntireProductSelected()
          Checks whether or not this subset definition select the entire product.
 boolean isIgnoreMetadata()
          Gets the ignore metadata information
 boolean isNodeAccepted(String name)
          Checks whether or not a node (a band, a tie-point grid or metadata element) with the given name will be part of the product subset.
 boolean removeNodeName(String name)
          Removes a band from the spectral subset.
 void setIgnoreMetadata(boolean ignoreMetadata)
          Sets the ignore metadata information
 void setNodeNames(String[] names)
          Sets the names of all product nodes contained in this subset.
 void setRegion(int x, int y, int w, int h)
          Sets the spatial subset as a rectangular region.
 void setRegion(Rectangle region)
          Sets the spatial subset as a rectangular region.
 void setSubSampling(int subSamplingX, int subSamplingY)
          Gets the sub-sampling in X- and Y-direction (vertical and horizontal).
 void setSubsetName(String subsetName)
           
 void setTreatVirtualBandsAsRealBands(boolean flag)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProductSubsetDef

public ProductSubsetDef()
Constructs a new and empty subset info.


ProductSubsetDef

public ProductSubsetDef(String subsetName)
Constructs a new and empty subset info.

Parameters:
subsetName - The name of the subset to be created.
Method Detail

getSubsetName

public String getSubsetName()

setSubsetName

public void setSubsetName(String subsetName)

setTreatVirtualBandsAsRealBands

public void setTreatVirtualBandsAsRealBands(boolean flag)

getTreatVirtualBandsAsRealBands

public boolean getTreatVirtualBandsAsRealBands()

getNodeNames

public String[] getNodeNames()
Gets the names of all product nodes contained in this subset. A return value of null means all nodes are selected.

Returns:
an array of names, or null if the no node subset is given

setNodeNames

public void setNodeNames(String[] names)
Sets the names of all product nodes contained in this subset. A value of null means all nodes are selected.

Parameters:
names - the band names, can be null in order to reset the node subset

addNodeName

public void addNodeName(String name)
Adds a new product node name to this subset.

Parameters:
name - the node's name, must not be empty or null

addNodeNames

public void addNodeNames(String[] names)
Adds the given product node names to this subset.

Parameters:
names - the nodename's to be added

removeNodeName

public boolean removeNodeName(String name)
Removes a band from the spectral subset. If the band is not contained in this subset, the method returns false.

Parameters:
name - the band's name
Returns:
true for success, false otherwise

containsNodeName

public boolean containsNodeName(String name)
Checks whether or not a node name is already contained in this subset.

Parameters:
name - the node name
Returns:
true if so

isNodeAccepted

public boolean isNodeAccepted(String name)
Checks whether or not a node (a band, a tie-point grid or metadata element) with the given name will be part of the product subset.

Parameters:
name - the node name
Returns:
true if so

getRegion

public Rectangle getRegion()
Gets the spatial subset as a rectangular region. Creates a new rectangle each time it is called. This prevents from modifying this subset by modifying the returned region.

Returns:
the spatial subset as a rectangular region, or null if no spatial region was defined

setRegion

public void setRegion(Rectangle region)
Sets the spatial subset as a rectangular region.

Parameters:
region - the spatial subset as a rectangular region, null if no spatial region shall be defined

setRegion

public void setRegion(int x,
                      int y,
                      int w,
                      int h)
Sets the spatial subset as a rectangular region.

Parameters:
x - the X-offset in pixels
y - the Y-offset in pixels
w - the width of the subset in pixels
h - the height of the subset in pixels

setSubSampling

public void setSubSampling(int subSamplingX,
                           int subSamplingY)
Gets the sub-sampling in X- and Y-direction (vertical and horizontal).

Parameters:
subSamplingX - sub-sampling in X-direction, must always be greater than zero
subSamplingY - sub-sampling in Y-direction, must always be greater than zero

getSubSamplingX

public int getSubSamplingX()
Gets the sub-sampling in X-direction (horizontal).

Returns:
the sub-sampling in X-direction which is always greater than zero

getSubSamplingY

public int getSubSamplingY()
Gets the sub-sampling in Y-direction (vertical).

Returns:
the sub-sampling in Y-direction which is always greater than zero

getSceneRasterSize

public Dimension getSceneRasterSize(int maxWidth,
                                    int maxHeight)
Gets the required size for a raster required to hold all pixels for the spatial subset for the given maximum raster width and height.

Parameters:
maxWidth - the maximum raster width
maxHeight - the maximum raster height
Returns:
the required raster size, never null

setIgnoreMetadata

public void setIgnoreMetadata(boolean ignoreMetadata)
Sets the ignore metadata information

Parameters:
ignoreMetadata - if true, metadata may be ignored during write or read a product.

isIgnoreMetadata

public boolean isIgnoreMetadata()
Gets the ignore metadata information


isEntireProductSelected

public boolean isEntireProductSelected()
Checks whether or not this subset definition select the entire product.



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