Class LineString

Hierarchy: Object , Geometry, LineString
All Implemented Interfaces: Cloneable , Comparable , Serializable , Lineal
Direct Known Subclasses: LinearRing
public class LineString
extends Geometry
implements Lineal
Models an OGC-style LineString. A LineString consists of a sequence of two or more vertices, along with all points along the linearly-interpolated curves (line segments) between each pair of consecutive vertices. Consecutive vertices may be equal. The line segments in the line may intersect each other (in other words, the linestring may "curl back" in itself and self-intersect. Linestrings with exactly two identical points are invalid.

A linestring must have either 0 or 2 or more points. If these conditions are not met, the constructors throw an IllegalArgumentException

Other

  • version: 1.7
public LineString(Coordinate[] points, PrecisionModel precisionModel, int SRID)
Deprecation:
Use GeometryFactory instead
public LineString(CoordinateSequence points, GeometryFactory factory)
Constructs a LineString with the given points.
Parameters:
points - points the points of the linestring, or null to create the empty geometry.
Throws:
IllegalArgumentException - IllegalArgumentException if too few points are provided
public Coordinate[] getCoordinates()
public CoordinateSequence getCoordinateSequence()
public Coordinate getCoordinateN(int n)
public Coordinate getCoordinate()
public int getDimension()
public int getBoundaryDimension()
public boolean isEmpty()
public int getNumPoints()
public Point getPointN(int n)
public Point getStartPoint()
public Point getEndPoint()
public boolean isClosed()
public boolean isRing()
public String getGeometryType()
public double getLength()
Returns the length of this LineString
Returns:
the length of the linestring
public Geometry getBoundary()
Gets the boundary of this geometry. The boundary of a lineal geometry is always a zero-dimensional geometry (which may be empty).
See also:
Geometry#getBoundary
Returns:
the boundary geometry
public LineString reverse()
Creates a LineString whose coordinates are in the reverse order of this objects
Returns:
a LineString with coordinates in the reverse order
protected LineString reverseInternal()
public boolean isCoordinate(Coordinate pt)
Returns true if the given point is a vertex of this LineString.
Parameters:
pt - pt the Coordinate to check
Returns:
true if pt is one of this LineString 's vertices
protected Envelope computeEnvelopeInternal()
public boolean equalsExact(Geometry other, double tolerance)
public void apply(CoordinateFilter filter)
public void apply(CoordinateSequenceFilter filter)
public void apply(GeometryFilter filter)
public void apply(GeometryComponentFilter filter)
public Object clone()
Creates and returns a full copy of this LineString object. (including all coordinates contained by it).
Returns:
a clone of this instance
protected LineString copyInternal()
public void normalize()
Normalizes a LineString. A normalized linestring has the first point which is not equal to it's reflected point less than the reflected point.
protected boolean isEquivalentClass(Geometry other)
protected int compareToSameClass(Object o)
protected int compareToSameClass(Object o, CoordinateSequenceComparator comp)
protected int getTypeCode()