Package hec.io

Class TinContainer

All Implemented Interfaces:
Serializable, Cloneable

public class TinContainer extends DataContainer implements Cloneable, Serializable
The TinContainer class holds data and basic metadata for a TIN (triangulated irregular network) as 2D vertices (pairs of longitude/latitude or easting/northing coordinates) and the values reported at those vertices. Each vertex also has a label, which may be empty.

To retrieve X, Y, and value for vertex n from TinContainer tc:

        X = tc.xCoords[n];
        Y = tc.yCoords[n];
        value = tc.value[n];

Each vertex has list of the other vertices it connects to via a triangle edge. This is represented as an int array. No other topological data is kept in this class. A vertex can be present in the TIN data set, but disabled, i.e. not a part of any triangles. In this case the vertex's connection array has only one member, with a value of -1.

An object of this class does not know where its data came from (or is going). It does not contain any reference or connection to any database or file, but is used as an intermediate data structure for moving data to or from a database or for plot and tabulate functions.

See Also:
  • Field Details

    • SpatialReferenceSystem

      public String SpatialReferenceSystem
      Gives a complete definition of the coordinate system for the TIN
    • SRSType

      public int SRSType
      Enumerated value indicating the type of string used to define the coordinate system.
    • UNKNOWN_SRS_DEFINITION_TYPE

      public static final int UNKNOWN_SRS_DEFINITION_TYPE
      SRS string type is unknown
      See Also:
    • WKT_ESRI_SRS_DEFINITION_TYPE

      public static final int WKT_ESRI_SRS_DEFINITION_TYPE
      SRS string type is ESRI variant of "Well Known Text"
      See Also:
    • WKT_OGC_SRS_DEFINITION_TYPE

      public static final int WKT_OGC_SRS_DEFINITION_TYPE
      SRS string type is OGC-type "Well Known Text"
      See Also:
    • SRSName

      public String SRSName
      Short name or label for coordinate system
    • SRSUnits

      public String SRSUnits
      Units for coordinate system
    • units

      public String units
      Units for values represented by TIN surface, e.g. "mm" for precipitation
    • type

      public String type
      Data type for values represented by TIN surface, e.g. "PER-CUM", "INST-VAL", etc.
    • timeZoneName

      public String timeZoneName
      Label for time zone applied to data values
    • numberPoints

      public int numberPoints
      Number of vertices (including inactive ones) present in this TIN
    • slendernessRatio

      public double slendernessRatio
      Used to weed out "skinny" triangles from TIN
    • xCoordinate

      public double[] xCoordinate
      Array of X coordinates. Vertex n's X coordinate is xCoordinate[n]
    • yCoordinate

      public double[] yCoordinate
      Array of Y coordinates. Vertex n's Y coordinate is yCoordinate[n]
    • value

      public double[] value
      Array of values at vertices. Vertex n's value is xCoordinate[n]
    • pointType

      public int[] pointType
      Array of vertex types as enumerated values.
    • DCP_VERTEX

      public static final int DCP_VERTEX
      TIN vertex type is "DCP"
      See Also:
    • OBSERVER_GAGE_VERTEX

      public static final int OBSERVER_GAGE_VERTEX
      TIN vertex type is OBSERVER_GAGE_VERTEX
      See Also:
    • GRID_CELL_VERTEX

      public static final int GRID_CELL_VERTEX
      TIN vertex type is GRID_CELL_VERTEX
      See Also:
    • connection

      public int[][] connection
      Array of vertex indices that this vertex connects to via triangle edges in this TIN. In a TIN composed of one triangle, vertices 0, 1, and 2 will connect as shown:
              connection[0] = {1, 2};
              connection[1] = {0, 2};
              connection[2] = {0, 1};
      Array length of 1 (value = -1) for disabled vertices; i.e. if vertex n is disabled,
              connection[n] = {-1};
       
    • label

      public String[] label
      Array of vertex labels
    • minXCoordinate

      public double minXCoordinate
      The TIN bounds are expressed as {min X, min Y, max X, max Y}.
    • minYCoordinate

      public double minYCoordinate
    • maxXCoordinate

      public double maxXCoordinate
    • maxYCoordinate

      public double maxYCoordinate
    • minValue

      public double minValue
      Minimum value of data at the vertices, not including nulls or disabled points
    • maxValue

      public double maxValue
      Maximum value of data at the vertices, not including nulls or disabled points
    • meanValue

      public double meanValue
      Mean value of data at the vertices, not including nulls or disabled points
  • Constructor Details

    • TinContainer

      public TinContainer()
    • TinContainer

      public TinContainer(double[] xs, double[] ys, double[] vs)
  • Method Details

    • clone

      public void clone(TinContainer tc)
    • getBounds

      public double[] getBounds()
      Forces updateStatistics action if minXCoordinate (or any of the other bounding coordinates) is equal to UNDEFINED_FLOAT.
      Returns:
      -- Bounds array as double[]
              {minimum X, minimum Y, maximum X, maximum Y}
    • getTimeWindow

      public boolean getTimeWindow(HecTime startTime, HecTime endTime)
      Gets the time window for the data, from the fullname attribute inherited from dataContainer. Returns true if instantaneous, false if period value or undefined (check startTime to see if undefined)
      Parameters:
      startTime - -- an HecTime object to be set to the TIN's start time
      endTime - -- an HecTime object to be set to the TIN's end time
      Returns:
      -- True if the TIN is an INST- type and the start time is defined False if the TIN is a PER- type or if the start time is undefined
    • getMaxValue

      public double getMaxValue()
      Forces updateStatistics action if statistics are undefined.
      Returns:
      -- maxVaue
    • getMinValue

      public double getMinValue()
      Forces updateStatistics action if statistics are undefined.
      Returns:
      -- minVaue
    • getMeanValue

      public double getMeanValue()
      Forces updateStatistics action if statistics are undefined.
      Returns:
      -- meanVaue
    • updateStatistics

      public void updateStatistics()
      Computes minValue, meanValue, maxValue and the bounds (minXCoordinate etc.) of the TIN.

      Locations of disabled points are included in the computation of the TIN bounds, but the values at disabled points are not included in min, mean, max computations.

    • pointToString

      protected static String pointToString(TinContainer c, int i)
    • toString

      public String toString()
      Overrides:
      toString in class DataContainer