com.vividsolutions.jts.geom

Class LineString

Implemented Interfaces:
Cloneable, Comparable, Serializable
Known Direct Subclasses:
LinearRing

public class LineString
extends Geometry

Basic implementation of LineString.
Version:
1.6

Field Summary

Fields inherited from class com.vividsolutions.jts.geom.Geometry

SRID, envelope

Constructor Summary

LineString(CoordinateSequence points, GeometryFactory factory)
LineString(points[] , PrecisionModel precisionModel, int SRID)
Deprecated. Use GeometryFactory instead

Method Summary

void
apply(CoordinateFilter filter)
void
apply(GeometryComponentFilter filter)
void
apply(GeometryFilter filter)
Object
clone()
protected int
compareToSameClass(Object o)
protected Envelope
computeEnvelopeInternal()
boolean
equalsExact(Geometry other, double tolerance)
Geometry
getBoundary()
int
getBoundaryDimension()
Coordinate
getCoordinate()
Coordinate
getCoordinateN(int n)
CoordinateSequence
getCoordinateSequence()
Coordinate[]
getCoordinates()
int
getDimension()
Point
getEndPoint()
String
getGeometryType()
double
getLength()
Returns the length of this LineString
int
getNumPoints()
Point
getPointN(int n)
Point
getStartPoint()
boolean
isClosed()
boolean
isCoordinate(Coordinate pt)
Returns true if the given point is a vertex of this LineString .
boolean
isEmpty()
protected boolean
isEquivalentClass(Geometry other)
boolean
isRing()
boolean
isSimple()
void
normalize()
Normalizes a LineString.

Methods inherited from class com.vividsolutions.jts.geom.Geometry

apply, apply, apply, buffer, buffer, checkNotGeometryCollection, clone, compare, compareTo, compareToSameClass, computeEnvelopeInternal, contains, convexHull, crosses, difference, disjoint, distance, equal, equals, equalsExact, equalsExact, geometryChanged, geometryChangedAction, getArea, getBoundary, getBoundaryDimension, getCentroid, getCoordinate, getCoordinates, getDimension, getEnvelope, getEnvelopeInternal, getFactory, getGeometryN, getGeometryType, getInteriorPoint, getLength, getNumGeometries, getNumPoints, getPrecisionModel, getSRID, getUserData, hasNonEmptyElements, hasNullElements, intersection, intersects, isEmpty, isEquivalentClass, isRectangle, isSimple, isValid, isWithinDistance, normalize, overlaps, relate, relate, setSRID, setUserData, symDifference, toString, toText, touches, union, within

Constructor Details

LineString

public LineString(CoordinateSequence points,
                  GeometryFactory factory)
Parameters:
points - the points of the linestring, or null to create the empty geometry. Consecutive points may not be equal.

LineString

public LineString(points[] ,
                  PrecisionModel precisionModel,
                  int SRID)

Deprecated. Use GeometryFactory instead

Method Details

apply

public void apply(CoordinateFilter filter)
Overrides:
apply in interface Geometry

apply

public void apply(GeometryComponentFilter filter)
Overrides:
apply in interface Geometry

apply

public void apply(GeometryFilter filter)
Overrides:
apply in interface Geometry

clone

public Object clone()
Overrides:
clone in interface Geometry

compareToSameClass

protected int compareToSameClass(Object o)
Overrides:
compareToSameClass in interface Geometry

computeEnvelopeInternal

protected Envelope computeEnvelopeInternal()
Overrides:
computeEnvelopeInternal in interface Geometry

equalsExact

public boolean equalsExact(Geometry other,
                           double tolerance)
Overrides:
equalsExact in interface Geometry

getBoundary

public Geometry getBoundary()
Overrides:
getBoundary in interface Geometry

getBoundaryDimension

public int getBoundaryDimension()
Overrides:
getBoundaryDimension in interface Geometry

getCoordinate

public Coordinate getCoordinate()
Overrides:
getCoordinate in interface Geometry

getCoordinateN

public Coordinate getCoordinateN(int n)

getCoordinateSequence

public CoordinateSequence getCoordinateSequence()

getCoordinates

public Coordinate[] getCoordinates()
Overrides:
getCoordinates in interface Geometry

getDimension

public int getDimension()
Overrides:
getDimension in interface Geometry

getEndPoint

public Point getEndPoint()

getGeometryType

public String getGeometryType()
Overrides:
getGeometryType in interface Geometry

getLength

public double getLength()
Returns the length of this LineString
Overrides:
getLength in interface Geometry
Returns:
the area of the polygon

getNumPoints

public int getNumPoints()
Overrides:
getNumPoints in interface Geometry

getPointN

public Point getPointN(int n)

getStartPoint

public Point getStartPoint()

isClosed

public boolean isClosed()

isCoordinate

public boolean isCoordinate(Coordinate pt)
Returns true if the given point is a vertex of this LineString .
Parameters:
pt - the Coordinate to check
Returns:
true if pt is one of this LineString 's vertices

isEmpty

public boolean isEmpty()
Overrides:
isEmpty in interface Geometry

isEquivalentClass

protected boolean isEquivalentClass(Geometry other)
Overrides:
isEquivalentClass in interface Geometry

isRing

public boolean isRing()

isSimple

public boolean isSimple()
Overrides:
isSimple in interface Geometry

normalize

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.
Overrides:
normalize in interface Geometry