Package org.esa.snap.core.dataio
Class ProductSubsetDef
- java.lang.Object
-
- org.esa.snap.core.dataio.ProductSubsetDef
-
public class ProductSubsetDef extends Object
TheProductSubsetDef
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 or by geometry. The pixel and geometry regions are mutually exclusive. The spectral subset as a list of band (or channel) names.
- Version:
- $Revision$ $Date$
-
-
Constructor Summary
Constructors Constructor Description ProductSubsetDef()
Constructs a new and empty subset info.ProductSubsetDef(String subsetName)
Constructs a new and empty subset info.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description 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.void
addNodeNames(Set<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()
Deprecated.UsegetSubsetRegion()
instead.HashMap<String,Rectangle>
getRegionMap()
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.Dimension
getSceneRasterSize(int maxWidth, int maxHeight, String bandName)
int
getSubSamplingX()
Gets the sub-sampling in X-direction (horizontal).int
getSubSamplingY()
Gets the sub-sampling in Y-direction (vertical).String
getSubsetName()
AbstractSubsetRegion
getSubsetRegion()
boolean
getTreatVirtualBandsAsRealBands()
boolean
isEntireProductSelected()
Checks whether or not this subset definition select the entire product.boolean
isIgnoreMetadata()
Gets the ignore metadata informationboolean
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 informationvoid
setNodeNames(String[] names)
Sets the names of all product nodes contained in this subset.void
setRegion(int x, int y, int w, int h)
Deprecated.UsesetSubsetRegion(AbstractSubsetRegion)
instead.void
setRegion(Rectangle region)
Deprecated.UsesetSubsetRegion(AbstractSubsetRegion)
instead.void
setRegionMap(HashMap<String,Rectangle> regionMap)
void
setSubSampling(int subSamplingX, int subSamplingY)
Gets the sub-sampling in X- and Y-direction (vertical and horizontal).void
setSubsetName(String subsetName)
void
setSubsetRegion(AbstractSubsetRegion subsetRegion)
void
setTreatVirtualBandsAsRealBands(boolean flag)
-
-
-
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 ofnull
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 ofnull
means all nodes are selected.- Parameters:
names
- the band names, can benull
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 ornull
-
addNodeNames
public void addNodeNames(String[] names)
Adds the given product node names to this subset.- Parameters:
names
- the nodename's to be added
-
addNodeNames
public void addNodeNames(Set<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 returnsfalse
.- 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
@Deprecated public Rectangle getRegion()
Deprecated.UsegetSubsetRegion()
instead.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. TODO TO BE removed in future- Returns:
- the spatial subset as a rectangular region, or
null
if no spatial region was defined
-
setRegion
@Deprecated public void setRegion(Rectangle region)
Deprecated.UsesetSubsetRegion(AbstractSubsetRegion)
instead.Sets the spatial subset as a rectangular region. TODO TO BE removed in future- Parameters:
region
- the spatial subset as a rectangular region,null
if no spatial region shall be defined
-
setRegion
@Deprecated public void setRegion(int x, int y, int w, int h)
Deprecated.UsesetSubsetRegion(AbstractSubsetRegion)
instead.Sets the spatial subset as a rectangular region. TODO TO BE removed in future- Parameters:
x
- the X-offset in pixelsy
- the Y-offset in pixelsw
- the width of the subset in pixelsh
- 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 zerosubSamplingY
- 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 widthmaxHeight
- the maximum raster height- Returns:
- the required raster size, never
null
-
getSceneRasterSize
public Dimension getSceneRasterSize(int maxWidth, int maxHeight, String bandName)
-
setIgnoreMetadata
public void setIgnoreMetadata(boolean ignoreMetadata)
Sets the ignore metadata information- Parameters:
ignoreMetadata
- iftrue
, 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.
-
getSubsetRegion
public AbstractSubsetRegion getSubsetRegion()
-
setSubsetRegion
public void setSubsetRegion(AbstractSubsetRegion subsetRegion)
-
-