Class LinearRing
java.lang.Object
org.locationtech.jts.geom.Geometry
org.locationtech.jts.geom.LineString
org.locationtech.jts.geom.LinearRing
- All Implemented Interfaces:
Serializable, Cloneable, Comparable, Lineal
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 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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe minimum number of vertices allowed in a valid non-empty ring.Fields inherited from class LineString
pointsFields inherited from class Geometry
envelope, factory, SRID, TYPECODE_GEOMETRYCOLLECTION, TYPECODE_LINEARRING, TYPECODE_LINESTRING, TYPECODE_MULTILINESTRING, TYPECODE_MULTIPOINT, TYPECODE_MULTIPOLYGON, TYPECODE_POINT, TYPECODE_POLYGON, TYPENAME_GEOMETRYCOLLECTION, TYPENAME_LINEARRING, TYPENAME_LINESTRING, TYPENAME_MULTILINESTRING, TYPENAME_MULTIPOINT, TYPENAME_MULTIPOLYGON, TYPENAME_POINT, TYPENAME_POLYGON -
Constructor Summary
ConstructorsConstructorDescriptionLinearRing(Coordinate[] points, PrecisionModel precisionModel, int SRID) Deprecated.Use GeometryFactory insteadLinearRing(CoordinateSequence points, GeometryFactory factory) Constructs aLinearRingwith the vertices specified by the givenCoordinateSequence. -
Method Summary
Modifier and TypeMethodDescriptionprotected LinearRingAn internal method to copy subclass-specific geometry data.intReturnsDimension.FALSE, since by definition LinearRings do not have a boundary.Returns the name of this Geometry's actual class.protected intbooleanisClosed()Tests whether this ring is closed.reverse()Creates aLineStringwhose coordinates are in the reverse order of this objectsMethods inherited from class LineString
apply, apply, apply, apply, clone, compareToSameClass, compareToSameClass, computeEnvelopeInternal, equalsExact, getBoundary, getCoordinate, getCoordinateN, getCoordinates, getCoordinateSequence, getDimension, getEndPoint, getLength, getNumPoints, getPointN, getStartPoint, isCoordinate, isEmpty, isEquivalentClass, isRing, normalizeMethods inherited from class Geometry
buffer, buffer, buffer, compare, compareTo, compareTo, contains, convexHull, copy, coveredBy, covers, crosses, difference, disjoint, distance, equal, equals, equals, equalsExact, equalsNorm, equalsTopo, geometryChanged, geometryChangedAction, getArea, getCentroid, getEnvelope, getEnvelopeInternal, getFactory, getGeometryN, getInteriorPoint, getNumGeometries, getPrecisionModel, getSRID, getUserData, hasDimension, hashCode, hasNonEmptyElements, hasNullElements, intersection, intersects, isGeometryCollection, isRectangle, isSimple, isValid, isWithinDistance, norm, overlaps, relate, relate, setSRID, setUserData, symDifference, toString, toText, touches, union, union, within
-
Field Details
-
MINIMUM_VALID_SIZE
public static final int MINIMUM_VALID_SIZEThe minimum number of vertices allowed in a valid non-empty ring. Empty rings with 0 vertices are also valid.- See Also:
-
-
Constructor Details
-
LinearRing
Deprecated.Use GeometryFactory insteadConstructs aLinearRingwith the given points.- Parameters:
points- points forming a closed and simple linestring, ornullor an empty array to create the empty geometry. This array must not containnullelements.precisionModel- the specification of the grid of allowable points for thisLinearRingSRID- the ID of the Spatial Reference System used by thisLinearRing- Throws:
IllegalArgumentException- if the ring is not closed, or has too few points
-
LinearRing
Constructs aLinearRingwith the vertices specified by the givenCoordinateSequence.- Parameters:
points- a sequence points forming a closed and simple linestring, ornullto create the empty geometry.- Throws:
IllegalArgumentException- if the ring is not closed, or has too few points
-
-
Method Details
-
getBoundaryDimension
public int getBoundaryDimension()ReturnsDimension.FALSE, since by definition LinearRings do not have a boundary.- Overrides:
getBoundaryDimensionin classLineString- Returns:
- Dimension.FALSE
-
isClosed
public boolean isClosed()Tests whether this ring is closed. Empty rings are closed by definition.- Overrides:
isClosedin classLineString- Returns:
- true if this ring is closed
-
getGeometryType
Description copied from class:GeometryReturns the name of this Geometry's actual class.- Overrides:
getGeometryTypein classLineString- Returns:
- the name of this
Geometrys actual class
-
getTypeCode
protected int getTypeCode()- Overrides:
getTypeCodein classLineString
-
copyInternal
Description copied from class:GeometryAn internal method to copy subclass-specific geometry data.- Overrides:
copyInternalin classLineString- Returns:
- a copy of the target geometry object.
-
reverse
Description copied from class:LineStringCreates aLineStringwhose coordinates are in the reverse order of this objects- Overrides:
reversein classLineString- Returns:
- a
LineStringwith coordinates in the reverse order
-
reverseInternal
- Overrides:
reverseInternalin classLineString
-