Class JGrassMapEnvironment


  • public class JGrassMapEnvironment
    extends Object
    Represents the structure around a map inside a grass database.

    Given a map file path, all the related files to that map in the GRASS Location/Mapset are defined.

    Since:
    3.0
    Author:
    Andrea Antonello (www.hydrologis.com)
    • Field Detail

      • defaultMapMin

        public static double defaultMapMin
        A minimum value to be used when no range is available for a map.
      • defaultMapMax

        public static double defaultMapMax
        A maximum value to be used when no range is available for a map.
    • Constructor Detail

      • JGrassMapEnvironment

        public JGrassMapEnvironment​(File cellFile)
        Constructs an instance of JGrassMapEnvironment.
        Parameters:
        cellFile - the absolute path to a grass raster map, through which the environment is defined.
      • JGrassMapEnvironment

        public JGrassMapEnvironment​(File mapsetFile,
                                    String mapName)
        Constructs an instance of JGrassMapEnvironment.

        This constructor is a facility method in the case the mapset file and the name of the GRASS raster map are passed.

        Parameters:
        mapsetFile - file of the mapset path
        mapName - name of the GRASS raster map
    • Method Detail

      • setReclassed

        public void setReclassed​(String reclassedMapset,
                                 String reclassedMap)
        Reclasses the environment.

        In the case a reclassed map was found, this method has to be called, in order to set the current environment to the new reclassed one.

        Parameters:
        reclassedMapset - the name of the mapset holding the reclassed map
        reclassedMap - the name of the reclassed map
      • getMapName

        public String getMapName()
        Getter for mapName.
        Returns:
        the map name.
      • getPERMANENT_MAPSET

        public File getPERMANENT_MAPSET()
        Getter for PERMANENT MAPSET folder.
        Returns:
        the PERMANENT MAPSET folder file.
      • getMAPSET

        public File getMAPSET()
        Getter for MAPSET folder.
        Returns:
        the MAPSET folder file.
      • getLOCATION

        public File getLOCATION()
        Getter for LOCATION folder.
        Returns:
        the LOCATION file folder.
      • getDEFAULT_WIND

        public File getDEFAULT_WIND()
        Getter for DEFAULT_WIND file.
        Returns:
        the DEFAULT_WIND file.
      • getPROJ_INFO

        public File getPROJ_INFO()
        Getter for PROJ_INFO file.
        Returns:
        the PROJ_INFO file.
      • getPROJ_WKT

        public File getPROJ_WKT()
        Getter for PROJ_WKT file.
        Returns:
        the PROJ_WKT file.
      • getPROJ_UNITS

        public File getPROJ_UNITS()
        Getter for PROJ_UNITS file.
        Returns:
        the PROJ_UNITS file.
      • getWIND

        public File getWIND()
        Getter for WIND file.
        Returns:
        the WIND file.
      • getFCELL

        public File getFCELL()
        Getter for FCELL file.
        Returns:
        the FCELL file.
      • getFcellFolder

        public File getFcellFolder()
        Getter for FCELL folder.
        Returns:
        the FCELL folder file.
      • getCELL

        public File getCELL()
        Getter for CELL file, i.e. the main map file.
        Returns:
        the CELL file.
      • getMapFile

        public File getMapFile()
        Getter for the main map file.
        Returns:
        the main map file.
      • getCellFolder

        public File getCellFolder()
        Getter for CELL folder.
        Returns:
        the CELL folder file.
      • getCATS

        public File getCATS()
        Getter for CATS file.
        Returns:
        the CATS file.
      • getCatsFolder

        public File getCatsFolder()
        Getter for CATS folder.
        Returns:
        the CATS folder file.
      • getHIST

        public File getHIST()
        Getter for the history file.
        Returns:
        the HIST file.
      • getCELLHD

        public File getCELLHD()
        Getter for CELLHD file.
        Returns:
        the CELLHD file.
      • getCOLR

        public File getCOLR()
        Getter for COLR file.
        Returns:
        the COLR file.
      • getColrFolder

        public File getColrFolder()
        Getter for COLR folder.
        Returns:
        the COLR folder file.
      • getCELLMISC_FORMAT

        public File getCELLMISC_FORMAT()
        Getter for CELLMISC_FORMAT file.
        Returns:
        the CELLMISC_FORMAT file.
      • getCELLMISC_QUANT

        public File getCELLMISC_QUANT()
        Getter for CELLMISC_QUANT file.
        Returns:
        the CELLMISC_QUANT file.
      • getCELLMISC_RANGE

        public File getCELLMISC_RANGE()
        Getter for CELLMISC_RANGE file.
        Returns:
        the CELLMISC_RANGE file.
      • getCELLMISC_NULL

        public File getCELLMISC_NULL()
        Getter for CELLMISC_NULL file.
        Returns:
        the CELLMISC_NULL file.
      • getRECLASSEDENVIRONMENT

        public JGrassMapEnvironment getRECLASSEDENVIRONMENT()
        Getter for RECLASSEDENVIRONMENT.
        Returns:
        the RECLASSEDENVIRONMENT.
      • getColorRules

        public List<String> getColorRules​(double[] range)
                                   throws IOException
        Read the colorrules for the map wrapped by this JGrassMapEnvironment.
        Parameters:
        range - the range to use for the default colortable, in the case of missing color file. Can be null.
        Returns:
        a List of color rules in string format.
        Throws:
        IOException
      • getCategories

        public List<String> getCategories()
                                   throws IOException
        Reads the categories for the map wrapped by this JGrassMapEnvironment.

        The categories are returned in a List of strings that may be of two types:

        • value:categorytext
        • value1-value2:categorytext
        Returns:
        the list of categories in text format.
        Throws:
        IOException
      • getRangeFromColorTable

        public double[] getRangeFromColorTable()
                                        throws IOException
        Reads the data range from a color table file, if existing.
        Returns:
        the data range or null if no range could be read.
        Throws:
        IOException
      • getRangeFromRangeFile

        public double[] getRangeFromRangeFile()
                                       throws IOException
        Reads the data range from the GRASS range file.
        Returns:
        the data range or null if the content is infinite or NaN.
        Throws:
        IOException
      • getRangeFromMapScan

        public double[] getRangeFromMapScan()
                                     throws IOException
        Reads the data range by reading the map.
        Returns:
        the data range.
        Throws:
        IOException
      • getLegendString

        public String getLegendString()
                               throws IOException
        Getter for the legend string.
        Returns:
        the legendstring.
        Throws:
        IOException
      • getCategoriesString

        public String getCategoriesString()
                                   throws IOException
        Getter for the categories string.
        Returns:
        the categories string.
        Throws:
        IOException