Class Node

  • Direct Known Subclasses:
    FlowNode, GridNode

    public abstract class Node
    extends Object
    A superclass representing a node.
    Author:
    Andrea Antonello (www.hydrologis.com)
    • Field Detail

      • row

        public final int row
      • col

        public final int col
      • cols

        public final int cols
      • rows

        public final int rows
      • isValid

        protected boolean isValid
      • touchesBound

        protected boolean touchesBound
      • touchesNovalue

        protected boolean touchesNovalue
      • gridIter

        protected final javax.media.jai.iterator.RandomIter gridIter
      • doubleNovalue

        protected double doubleNovalue
      • floatNovalue

        protected float floatNovalue
      • intNovalue

        protected int intNovalue
    • Constructor Detail

      • Node

        public Node​(javax.media.jai.iterator.RandomIter gridIter,
                    int cols,
                    int rows,
                    int col,
                    int row,
                    Double novalue)
    • Method Detail

      • getValueFromMap

        public double getValueFromMap​(javax.media.jai.iterator.RandomIter map)
        Get the value from a map. Default to getting a double value.
        Parameters:
        map - the map to read from.
        Returns:
        the float value read.
      • getFloatValueFromMap

        public float getFloatValueFromMap​(javax.media.jai.iterator.RandomIter map)
        Get the float value of another map in the current node position.
        Parameters:
        map - the map from which to get the value.
        Returns:
        the float value or a novalue.
      • getIntValueFromMap

        public int getIntValueFromMap​(javax.media.jai.iterator.RandomIter map)
        Get the int value of another map in the current node position.
        Parameters:
        map - the map from which to get the value.
        Returns:
        the int value or a novalue.
      • getDoubleValueFromMap

        public double getDoubleValueFromMap​(javax.media.jai.iterator.RandomIter map)
        Get the double value of another map in the current node position.
        Parameters:
        map - the map from which to get the value.
        Returns:
        the double value or a novalue.
      • setValueInMap

        public void setValueInMap​(javax.media.jai.iterator.WritableRandomIter map,
                                  double value)
      • setFloatValueInMap

        public void setFloatValueInMap​(javax.media.jai.iterator.WritableRandomIter map,
                                       float value)
        Utility method to set the value of a certain map in the current node position.
        Parameters:
        map - the map to set the value in. if null, it is ignored.
        value - the value to set.
      • setIntValueInMap

        public void setIntValueInMap​(javax.media.jai.iterator.WritableRandomIter map,
                                     int value)
      • setDoubleValueInMap

        public void setDoubleValueInMap​(javax.media.jai.iterator.WritableRandomIter map,
                                        double value)
      • isValid

        public boolean isValid()
        Checks if the node is valid.

        A node is valid if

        • it is placed inside the raster bounds
        • its value is not novalue
        Returns:
        true if the node is valid.
      • touchesBound

        public boolean touchesBound()
        Returns:
        true if this node touches a boundary.
      • touchesNovalue

        public boolean touchesNovalue()
        Returns:
        true if this node touches a novalue.