Class 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 Detail

      • DimapProductHelpers

        public DimapProductHelpers()
    • 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 format
        defaultProductType - the product type
        regionRasterSize - 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 a String object from the given dom which points to the data for the band with the given name.
        Parameters:
        dom - the JDOM in BEAM-DIMAP format
        product - the product to retrieve the data files for
        inputDir - 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 empty Map 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 a String 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 format
        tiePointGridName - 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
      • printColorTag

        public static void printColorTag​(int indent,
                                         Color color,
                                         XmlWriter pw)
      • printColorTag

        public static void printColorTag​(int indent,
                                         String tag,
                                         Color color,
                                         XmlWriter pw)
      • createColor

        public static Color createColor​(org.jdom2.Element colorElem)
      • createGeoCoding

        public static GeoCoding[] createGeoCoding​(org.jdom2.Document dom,
                                                  Product product)
      • getTiePointDataType

        public static int getTiePointDataType​(org.jdom2.Element rootElement,
                                              String tiePointGridName)
      • createDimapFileFilter

        public static FileFilter createDimapFileFilter()
        Creates a FileFilter for BEAM-DIMAP files.
        Returns:
        a FileFilter for use with a JFileChooser
      • createDom

        public static org.jdom2.Document createDom​(InputStream inputStream)
        Creates a parsed Document from the given inputStream.
        Parameters:
        inputStream - the stream to be parsed
        Returns:
        a parsed inputStream
      • convertBeamUnitToDimapUnit

        public static String convertBeamUnitToDimapUnit​(String unit)
        Converts a given BEAM unit 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 DIMAP unit 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)