Package org.locationtech.jts.geom
Class LinearRing
- java.lang.Object
-
- org.locationtech.jts.geom.Geometry
-
- org.locationtech.jts.geom.LineString
-
- org.locationtech.jts.geom.LinearRing
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable
,Lineal
public class LinearRing extends LineString
Models an OGC SFSLinearRing
. ALinearRing
is aLineString
which is both closed and simple. In other words, the first and last coordinate in the ring must be equal, and the ring must not self-intersect. Either orientation of the ring is allowed.A ring must have either 0 or 3 or more points. The first and last points must be equal (in 2D). If these conditions are not met, the constructors throw an
IllegalArgumentException
. A ring with 3 points is invalid, because it is collapsed and thus has a self-intersection. It is allowed to be constructed so that it can be represented, and repaired if needed.- Version:
- 1.7
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
MINIMUM_VALID_SIZE
The minimum number of vertices allowed in a valid non-empty ring.-
Fields inherited from class org.locationtech.jts.geom.Geometry
TYPENAME_GEOMETRYCOLLECTION, TYPENAME_LINEARRING, TYPENAME_LINESTRING, TYPENAME_MULTILINESTRING, TYPENAME_MULTIPOINT, TYPENAME_MULTIPOLYGON, TYPENAME_POINT, TYPENAME_POLYGON
-
-
Constructor Summary
Constructors Constructor Description LinearRing(Coordinate[] points, PrecisionModel precisionModel, int SRID)
Deprecated.Use GeometryFactory insteadLinearRing(CoordinateSequence points, GeometryFactory factory)
Constructs aLinearRing
with the vertices specified by the givenCoordinateSequence
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getBoundaryDimension()
ReturnsDimension.FALSE
, since by definition LinearRings do not have a boundary.java.lang.String
getGeometryType()
Returns the name of this Geometry's actual class.boolean
isClosed()
Tests whether this ring is closed.LinearRing
reverse()
Creates aLineString
whose coordinates are in the reverse order of this objectsLinearRing
reverseInternal()
-
Methods inherited from class org.locationtech.jts.geom.LineString
apply, apply, apply, apply, clone, equalsExact, getBoundary, getCoordinate, getCoordinateN, getCoordinates, getCoordinateSequence, getDimension, getEndPoint, getLength, getNumPoints, getPointN, getStartPoint, isCoordinate, isEmpty, isRing, normalize
-
Methods inherited from class org.locationtech.jts.geom.Geometry
buffer, buffer, buffer, compareTo, compareTo, contains, convexHull, copy, coveredBy, covers, crosses, difference, disjoint, distance, equals, equals, equalsExact, equalsNorm, equalsTopo, geometryChanged, getArea, getCentroid, getEnvelope, getEnvelopeInternal, getFactory, getGeometryN, getInteriorPoint, getNumGeometries, getPrecisionModel, getSRID, getUserData, hashCode, intersection, intersects, isRectangle, isSimple, isValid, isWithinDistance, norm, overlaps, relate, relate, setSRID, setUserData, symDifference, toString, toText, touches, union, union, within
-
-
-
-
Field Detail
-
MINIMUM_VALID_SIZE
public static final int MINIMUM_VALID_SIZE
The minimum number of vertices allowed in a valid non-empty ring. Empty rings with 0 vertices are also valid.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
LinearRing
public LinearRing(Coordinate[] points, PrecisionModel precisionModel, int SRID)
Deprecated.Use GeometryFactory insteadConstructs aLinearRing
with the given points.- Parameters:
points
- points forming a closed and simple linestring, ornull
or an empty array to create the empty geometry. This array must not containnull
elements.precisionModel
- the specification of the grid of allowable points for thisLinearRing
SRID
- the ID of the Spatial Reference System used by thisLinearRing
- Throws:
java.lang.IllegalArgumentException
- if the ring is not closed, or has too few points
-
LinearRing
public LinearRing(CoordinateSequence points, GeometryFactory factory)
Constructs aLinearRing
with the vertices specified by the givenCoordinateSequence
.- Parameters:
points
- a sequence points forming a closed and simple linestring, ornull
to create the empty geometry.- Throws:
java.lang.IllegalArgumentException
- if the ring is not closed, or has too few points
-
-
Method Detail
-
getBoundaryDimension
public int getBoundaryDimension()
ReturnsDimension.FALSE
, since by definition LinearRings do not have a boundary.- Overrides:
getBoundaryDimension
in classLineString
- Returns:
- Dimension.FALSE
-
isClosed
public boolean isClosed()
Tests whether this ring is closed. Empty rings are closed by definition.- Overrides:
isClosed
in classLineString
- Returns:
- true if this ring is closed
-
getGeometryType
public java.lang.String getGeometryType()
Description copied from class:Geometry
Returns the name of this Geometry's actual class.- Overrides:
getGeometryType
in classLineString
- Returns:
- the name of this
Geometry
s actual class
-
reverse
public LinearRing reverse()
Description copied from class:LineString
Creates aLineString
whose coordinates are in the reverse order of this objects- Overrides:
reverse
in classLineString
- Returns:
- a
LineString
with coordinates in the reverse order
-
reverseInternal
public LinearRing reverseInternal()
-
-