Package org.esa.snap.core.dataio.dimap
Class DimapProductHelpers
- java.lang.Object
-
- org.esa.snap.core.dataio.dimap.DimapProductHelpers
-
public class DimapProductHelpers extends Object
This class defines some static methods used to create and access BEAM DIMAP XML documents.- Version:
- $Revision$ $Date$
-
-
Constructor Summary
Constructors Constructor Description DimapProductHelpers()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
convertBeamUnitToDimapUnit(String unit)
Converts a given BEAMunit
into a DIMAP conform unit.static String
convertDimapUnitToBeamUnit(String unit)
Converts a given DIMAPunit
into a BEAM conform unit.static Color
createColor(org.jdom2.Element colorElem)
static FileFilter
createDimapFileFilter()
Creates aFileFilter
for BEAM-DIMAP files.static org.jdom2.Document
createDom(InputStream inputStream)
Creates a parsedDocument
from the giveninputStream
.static GeoCoding[]
createGeoCoding(org.jdom2.Document dom, Product product)
static Product
createProduct(org.jdom2.Document dom, String defaultProductType, Dimension regionRasterSize)
Creates a in-memory data product represenation from the given DOM (BEAM-DIMAP format).static Map<Band,File>
getBandDataFiles(org.jdom2.Document dom, Product product, File inputDir)
Extract aString
object from the given dom which points to the data for the band with the given name.static org.opengis.referencing.crs.CoordinateReferenceSystem
getCRS(org.jdom2.Document dom)
static String
getTiePointDataFile(org.jdom2.Document dom, String tiePointGridName)
Extract aString
object from the given dom which points to the data for the tie point grid with the given name.static int
getTiePointDataType(org.jdom2.Element rootElement, String tiePointGridName)
static void
printColorTag(int indent, Color color, XmlWriter pw)
static void
printColorTag(int indent, String tag, Color color, XmlWriter pw)
-
-
-
Method Detail
-
createProduct
public static Product createProduct(org.jdom2.Document dom, String defaultProductType, Dimension regionRasterSize)
Creates a in-memory data product represenation from the given DOM (BEAM-DIMAP format).- Parameters:
dom
- the DOM in BEAM-DIMAP formatdefaultProductType
- the product typeregionRasterSize
- the region size to be displayed- Returns:
- an in-memory data product represenation
-
getBandDataFiles
public static Map<Band,File> getBandDataFiles(org.jdom2.Document dom, Product product, File inputDir) throws IllegalArgumentException
Extract aString
object from the given dom which points to the data for the band with the given name.- Parameters:
dom
- the JDOM in BEAM-DIMAP formatproduct
- the product to retrieve the data files forinputDir
- the directory where to search for the data files- Returns:
- a
Map
object which contains all the band data references from the given jDom.
Returns an emptyMap
if the jDom does not contain band data files - Throws:
IllegalArgumentException
- if one of the parameters is null.
-
getTiePointDataFile
public static String getTiePointDataFile(org.jdom2.Document dom, String tiePointGridName) throws IllegalArgumentException
Extract aString
object from the given dom which points to the data for the tie point grid with the given name.- Parameters:
dom
- the DOM in BEAM-DIMAP formattiePointGridName
- the name of the tie point grid- Returns:
- the
String
object which points to the data for the tie point grid. - Throws:
IllegalArgumentException
- if the parameter dom is null or the parameter tiePointGridName is null or empty
-
createColor
public static Color createColor(org.jdom2.Element colorElem)
-
getTiePointDataType
public static int getTiePointDataType(org.jdom2.Element rootElement, String tiePointGridName)
-
createDimapFileFilter
public static FileFilter createDimapFileFilter()
Creates aFileFilter
for BEAM-DIMAP files.- Returns:
- a FileFilter for use with a
JFileChooser
-
createDom
public static org.jdom2.Document createDom(InputStream inputStream)
Creates a parsedDocument
from the giveninputStream
.- Parameters:
inputStream
- the stream to be parsed- Returns:
- a parsed inputStream
-
convertBeamUnitToDimapUnit
public static String convertBeamUnitToDimapUnit(String unit)
Converts a given BEAMunit
into a DIMAP conform unit.- Parameters:
unit
- a BEAM unit- Returns:
- the converted unit
- See Also:
convertDimapUnitToBeamUnit(String)
-
convertDimapUnitToBeamUnit
public static String convertDimapUnitToBeamUnit(String unit)
Converts a given DIMAPunit
into a BEAM conform unit.- Parameters:
unit
- a DIMAP unit- Returns:
- the converted unit
- See Also:
convertBeamUnitToDimapUnit(String)
-
getCRS
public static org.opengis.referencing.crs.CoordinateReferenceSystem getCRS(org.jdom2.Document dom)
-
-