Class LinearRing

All Implemented Interfaces:
Serializable, Cloneable, Comparable, Lineal

public class LinearRing extends LineString
Models an OGC SFS LinearRing. A LinearRing is a LineString which is both closed and simple. In other words, the first and last coordinate in the ring must be equal, and the interior of the ring must not self-intersect. Either orientation of the ring is allowed.

A ring must have either 0 or 4 or more points. The first and last points must be equal (in 2D). If these conditions are not met, the constructors throw an IllegalArgumentException

Version:
1.7
See Also:
  • Field Details

    • MINIMUM_VALID_SIZE

      public static final int MINIMUM_VALID_SIZE
      The minimum number of vertices allowed in a valid non-empty ring (= 4). Empty rings with 0 vertices are also valid.
      See Also:
    • serialVersionUID

      private static final long serialVersionUID
      See Also:
  • Constructor Details

    • LinearRing

      public LinearRing(Coordinate[] points, PrecisionModel precisionModel, int SRID)
      Deprecated.
      Use GeometryFactory instead
      Constructs a LinearRing with the given points.
      Parameters:
      points - points forming a closed and simple linestring, or null or an empty array to create the empty geometry. This array must not contain null elements.
      precisionModel - the specification of the grid of allowable points for this LinearRing
      SRID - the ID of the Spatial Reference System used by this LinearRing
      Throws:
      IllegalArgumentException - if the ring is not closed, or has too few points
    • LinearRing

      private LinearRing(Coordinate[] points, GeometryFactory factory)
      This method is ONLY used to avoid deprecation warnings.
      Parameters:
      points -
      factory -
      Throws:
      IllegalArgumentException - if the ring is not closed, or has too few points
    • LinearRing

      public LinearRing(CoordinateSequence points, GeometryFactory factory)
      Constructs a LinearRing with the vertices specified by the given CoordinateSequence.
      Parameters:
      points - a sequence points forming a closed and simple linestring, or null to create the empty geometry.
      Throws:
      IllegalArgumentException - if the ring is not closed, or has too few points
  • Method Details

    • validateConstruction

      private void validateConstruction()
    • getBoundaryDimension

      public int getBoundaryDimension()
      Returns Dimension.FALSE, since by definition LinearRings do not have a boundary.
      Overrides:
      getBoundaryDimension in class LineString
      Returns:
      Dimension.FALSE
    • isClosed

      public boolean isClosed()
      Tests whether this ring is closed. Empty rings are closed by definition.
      Overrides:
      isClosed in class LineString
      Returns:
      true if this ring is closed
    • getGeometryType

      public String getGeometryType()
      Description copied from class: Geometry
      Returns the name of this Geometry's actual class.
      Overrides:
      getGeometryType in class LineString
      Returns:
      the name of this Geometrys actual class
    • getSortIndex

      protected int getSortIndex()
      Overrides:
      getSortIndex in class LineString
    • copy

      public LinearRing copy()
      Description copied from class: LineString
      Creates and returns a full copy of this LineString object. (including all coordinates contained by it).
      Overrides:
      copy in class LineString
      Returns:
      a copy of this instance
    • reverse

      public Geometry reverse()
      Description copied from class: LineString
      Creates a LineString whose coordinates are in the reverse order of this objects
      Overrides:
      reverse in class LineString
      Returns:
      a LineString with coordinates in the reverse order