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 StringconvertBeamUnitToDimapUnit(String unit)Converts a given BEAMunitinto a DIMAP conform unit.static StringconvertDimapUnitToBeamUnit(String unit)Converts a given DIMAPunitinto a BEAM conform unit.static ColorcreateColor(org.jdom2.Element colorElem)static FileFiltercreateDimapFileFilter()Creates aFileFilterfor BEAM-DIMAP files.static org.jdom2.DocumentcreateDom(InputStream inputStream)Creates a parsedDocumentfrom the giveninputStream.static GeoCoding[]createGeoCoding(org.jdom2.Document dom, Product product)static ProductcreateProduct(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 aStringobject from the given dom which points to the data for the band with the given name.static org.opengis.referencing.crs.CoordinateReferenceSystemgetCRS(org.jdom2.Document dom)static StringgetTiePointDataFile(org.jdom2.Document dom, String tiePointGridName)Extract aStringobject from the given dom which points to the data for the tie point grid with the given name.static intgetTiePointDataType(org.jdom2.Element rootElement, String tiePointGridName)static voidprintColorTag(int indent, Color color, XmlWriter pw)static voidprintColorTag(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 aStringobject 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
Mapobject which contains all the band data references from the given jDom.
Returns an emptyMapif 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 aStringobject 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
Stringobject 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 aFileFilterfor BEAM-DIMAP files.- Returns:
- a FileFilter for use with a
JFileChooser
-
createDom
public static org.jdom2.Document createDom(InputStream inputStream)
Creates a parsedDocumentfrom the giveninputStream.- Parameters:
inputStream- the stream to be parsed- Returns:
- a parsed inputStream
-
convertBeamUnitToDimapUnit
public static String convertBeamUnitToDimapUnit(String unit)
Converts a given BEAMunitinto 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 DIMAPunitinto 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)
-
-