Interface IPolyline

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void add​(Vertex v)
      Adds a vertex to the polyline feature.
      void complete()
      Called to indicate that the feature is complete and that no further vertices will be added to it.
      Rectangle2D getBounds()
      Gets the bounds of the feature.
      double getLength()
      Gets the total length of the feature.
      double getNominalPointSpacing()
      Get the average distance between points for the feature.
      List<Vertex> getVertices()
      Gets the vertices for this feature.
      boolean isPolygon()
      Indicates whether the instance represents a polygon.
      boolean isValid()
      Indicates that sufficient information has been stored in the polyline to establish a valid geometry.
      IPolyline refactor​(Iterable<Vertex> geometry)
      Creates a new polyline feature with the specified geometry and transfers any data elements defined by the implementing class from the current object to the newly created one.
    • Method Detail

      • add

        void add​(Vertex v)
        Adds a vertex to the polyline feature. Implementations of this interface are expected to ensure that all vertices are unique and that no vertices are repeated.
        Parameters:
        v - a valid instance
      • complete

        void complete()
        Called to indicate that the feature is complete and that no further vertices will be added to it. Some implementing classes may perform lightweight sanity checking on the feature instance.

        Multiple calls to complete are benign and will be ignored. If vertices are added after complete is called, the behavior is undefined.

      • getBounds

        Rectangle2D getBounds()
        Gets the bounds of the feature.

        Caution: Implementations of this method expose the Rectangle2D object used by the feature instance. Although this approach supports efficiency for the potentially intense processing conducted by the Tinfour classes, it does not provide a safe implementation for careless developers. Therefore, applications should not manipulate or modify the rectangle instance returned by this routine at any time.

        Returns:
        a valid, potentially empty rectangle instance.
      • getLength

        double getLength()
        Gets the total length of the feature. The length is the accumulated sum of the lengths of the line segments that comprise the feature. In the case of a closed polygon feature, the length is the perimeter of the polygon.
        Returns:
        if the feature geometry is defined, a positive floating point value, otherwise a zero.
      • getNominalPointSpacing

        double getNominalPointSpacing()
        Get the average distance between points for the feature.
        Returns:
        if the feature contains more than one point, a floating point value greater than zero; otherwise a NaN.
      • getVertices

        List<Vertex> getVertices()
        Gets the vertices for this feature. The vertices define a non-self-intersecting chain of line segments (that is, no line segments intersect except at their endpoints). The vertices are assumed to be unique and far enough apart that they are stable in numeric operations.
        Returns:
        a valid list of two or more unique vertices.
      • isValid

        boolean isValid()
        Indicates that sufficient information has been stored in the polyline to establish a valid geometry.
        Returns:
        true if the polyline has a valid geometry; otherwise, false.
      • isPolygon

        boolean isPolygon()
        Indicates whether the instance represents a polygon. Some implementations may define a constant value for this method, others may determine it dynamically.
        Returns:
        true if the instance is a polygon; otherwise, false.
      • refactor

        IPolyline refactor​(Iterable<Vertex> geometry)
        Creates a new polyline feature with the specified geometry and transfers any data elements defined by the implementing class from the current object to the newly created one.

        This method is intended to be used in cases where application code performs some kind of transformation on the geometry of the existing object and produces a new object. In doing so, the application code treats the existing object on a read-only basis, but is free to transfer any implementation-specific data from the old object to the new. Examples of possible transformations include an implementation of a point-reduction technique such as Visvalingam's algorithm or point-addition techniques such as curve smoothing.

        Parameters:
        geometry - a list or other iterable instance that can be used as a source of vertices.
        Returns:
        if successful, a new instance of the implementing class.