Class ModelsSupporter


  • public class ModelsSupporter
    extends Object

    Facility methods and constants used by the console engine

    Author:
    Andrea Antonello - www.hydrologis.com
    • Field Detail

      • ACTIVEREGIONWINDOW

        public static final String ACTIVEREGIONWINDOW
        name for the JGrass active region constant
        See Also:
        Constant Field Values
      • FEATURECOLLECTION

        public static final String FEATURECOLLECTION
        name for the JGrass featurecollection
        See Also:
        Constant Field Values
      • CONSOLE

        public static final String CONSOLE
        variable telling that the output should be redirected to console
        See Also:
        Constant Field Values
      • UITABLE

        public static final String UITABLE
        variable telling that the output should be redirected to gui table
        See Also:
        Constant Field Values
      • DIR

        public static final int[][] DIR
        The 9 directions around a pixel as ROW/COL of the flowdirections grid.

        Also containing the central position 0,0

        FIXME Erica used to add several {0,0} at the end, in order to catch certain values. Those have to be tracked down.

      • DIR_WITHFLOW_ENTERING

        public static final int[][] DIR_WITHFLOW_ENTERING
        The 8 flowdirections, defined as entering towards the center cell.

        Each array contains [row, col, flowvalue].

        NOTE that these work in ROW/COL order, not COL/ROW!

                -1     0     1 
              +-----+-----+-----+
         -1   |  8  |  7  |  6  |
              +-----+-----+-----+
          0   |  1  |  0  |  5  |
              +-----+-----+-----+
          1   |  2  |  3  |  4  |
              +-----+-----+-----+
              
         
      • DIR_WITHFLOW_EXITING

        public static final int[][] DIR_WITHFLOW_EXITING
        The 8 flowdirections, defined as exiting from the center cell.

        Each array contains [col, row, flowvalue].

                -1     0     1 
              +-----+-----+-----+
         -1   |  4  |  3  |  2  |
              +-----+-----+-----+
          0   |  5  |  0  |  1  |
              +-----+-----+-----+
          1   |  6  |  7  |  8  |
              +-----+-----+-----+
              
         
      • DIR_WITHFLOW_EXITING_INVERTED

        public static final int[][] DIR_WITHFLOW_EXITING_INVERTED
    • Constructor Detail

      • ModelsSupporter

        public ModelsSupporter()
    • Method Detail

      • calculateDirectionFactor

        public static double[] calculateDirectionFactor​(double dx,
                                                        double dy)
        Calculate the drainage direction factor (is used in some horton machine like pitfiller, flow,...)

        Is the distance betwen the central pixel, in a 3x3 kernel, and the neighboured pixels.

        Parameters:
        dx - is the resolution of a raster map in the x direction.
        dy - is the resolution of the raster map in the y direction.
        Returns:
        fact the direction factor or 1/lenght where lenght is the distance of the pixel from the central poxel.
      • getStatusString

        public static String getStatusString​(int statusValue)
      • generateTemplate

        public static String generateTemplate​(Object parent)