Class ContourBuilderForTin


  • public class ContourBuilderForTin
    extends Object
    Provides data elements and methods for constructing contours from a Delaunay Triangulation. It is assumed that the data represented by the triangulation can be treated as a continuous surface with no null values. Constrained Delaunay Triangulations are allowed.

    Under development. At this time, the contouring implementation does not support not-a-number or infinity values. At this time, the contouring implememtation does not support discrete (non-continuous) data.

    Contour left-and-right index: The left and right index elements for the contours created by this class are set to the array index of the zContour array supplied to the constructor. For example, in the case of a zContour array that specified a single contour value, the right-index of the contours would be assigned the value 0 and the left-index would be assigned the value 1. The maximum possible left-index value is always the zContour.length. The minimum possible right-index value is always zero, except in the special case of perimeter contours. Perimeter contours are those that lie on the outer edges of the TIN and represent the boundary between "data and no-data". The right index value for perimeter contours is -1.

    Tinfour defines contours as specifying a boundary between two regions on a surface over a plane. The region to the left of the contour is treated as including points with vertical coordinates greater than or equal to the contour's vertical coordinate. The values to the right are treated as including points with vertical coordinates less than the contour's vertical coordinate. Thus, in an elevation set, a hill would be represented with a set of closed-loop contours taken in counterclockwise order. A valley would be represented as a set of closed-loop contours taken in clockwise order.

    • Constructor Detail

      • ContourBuilderForTin

        public ContourBuilderForTin​(IIncrementalTin tin,
                                    IVertexValuator vertexValuator,
                                    double[] zContour,
                                    boolean buildRegions)
        Creates a set of contours at the specified vertical coordinates from the Delaunay Triangulation. It is assumed that the data represented by the triangulation can be treated as a continuous surface with no null values. Constrained Delaunay Triangulations are allowed.

        The constructor for this class always builds a list of contours that is maintained internally. Contours are defined as line features. If you wish, you may set the buildRegions argument to true to connect the contours into closed polygons.

        The vertex-valuator argument allows you to specify an alternate method for obtaining the vertical coordinates from the vertices in the triangulation. If you wish to use the values from the vertices directly (i.e. the z coordinates of the vertices), you may do so by supplying a null reference for the valuator argument. The primary intended use of the valuator is to support the use of a smoothing filter, though many other applications are feasible.

        The values in the zContour array must be unique and monotonically increasing.

        Parameters:
        tin - a valid TIN.
        vertexValuator - an optional valuator or a null reference if the default is to be used.
        zContour - a value array of contour values.
        buildRegions - indicates whether the builder should produce region (polygon) structures in addition to contours.
    • Method Detail

      • simplify

        public void simplify​(double areaThreshold)
        Simplifies line features using an implementation of Visvalingam's algorithm. See the Tinfour VisvalingamLineSimplification class for documentation on how this method works.
        Parameters:
        areaThreshold - the minimum-area threshold for simplification.
      • getContours

        public List<Contour> getContours()
        Gets a list of the contours that were constructed by this class.
        Returns:
        a valid, potentially empty list.
      • getRegions

        public List<ContourRegion> getRegions()
        Gets a list of the contour regions (polygon features) that were built by the constructor, if any.
        Returns:
        a valid, potentially empty list of regions.
      • getEnvelope

        public double[] getEnvelope()
        Gets the Cartesian coordinates of the convex hull of the triangulation that was used to construct the contours for this instance. This information in intended mainly for diagnostic and debugging purposes, by may also be used for rendering.

        Coordinates are stored in an array of doubles in the order { (x0,y0), (x1,y1), (x2,y2), etc. }.

        Returns:
        a valid array of coordinates.
      • summarize

        public void summarize​(PrintStream ps,
                              double areaFactor)
        Provides a summary of statistics and measurements for the contour building process and resulting data.
        Parameters:
        ps - a valid PrintStream instance, such as System.out.
        areaFactor - a unit-conversion factor for scaling area values