public abstract class AbstractLineString extends AbstractGeometry implements LineString
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
| Constructor and Description |
|---|
AbstractLineString() |
| Modifier and Type | Method and Description |
|---|---|
<V extends Geometry> |
appendVertex(Point newPoint,
int... geometryId) |
AbstractLineString |
clone()
Creates and returns a full copy of this
LineString object. |
int |
compareToSameClass(Geometry geometry)
Returns whether this
Geometry is greater than, equal to,
or less than another Geometry having the same class. |
protected BoundingBox |
computeBoundingBox()
Returns the minimum and maximum x and y values in this
Geometry
, or a null BoundingBoxDoubleGf if this Geometry is empty. |
protected double[] |
convertCoordinates(GeometryFactory geometryFactory) |
<V extends Geometry> |
copy(GeometryFactory geometryFactory)
Create a copy of the geometry io the requried geometry factory.
|
<V extends Geometry> |
deleteVertex(int... vertexId) |
LineString |
deleteVertex(int vertexIndex) |
double |
distance(int index,
Point point) |
boolean |
doEquals(int axisCount,
Geometry geometry) |
boolean |
equals(int axisCount,
int vertexIndex,
Point point) |
boolean |
equalsExact(Geometry other,
double tolerance)
Returns true if the two
Geometrys are exactly equal,
up to a specified distance tolerance. |
boolean |
equalsVertex(int vertexIndex,
double... coordinates) |
boolean |
equalsVertex(int axisCount,
int vertexIndex1,
int vertexIndex2) |
boolean |
equalsVertex(int axisCount,
int vertexIndex,
LineString line2,
int vertexIndex2) |
boolean |
equalsVertex(int axisCount,
int vertexIndex,
Point point) |
boolean |
equalsVertex(int vertexIndex,
Point point) |
Geometry |
getBoundary()
Gets the boundary of this geometry.
|
int |
getBoundaryDimension()
Returns the dimension of this
Geometrys inherent boundary. |
abstract double[] |
getCoordinates() |
LineString |
getCoordinatesList() |
DataType |
getDataType() |
int |
getDimension()
Returns the dimension of this geometry.
|
Point |
getEndPoint() |
double |
getLength()
Returns the length of this
LineString |
double |
getM(int vertexIndex) |
int |
getMinVertexCount() |
Point |
getPoint()
Returns a vertex of this
Geometry
(usually, but not necessarily, the first one). |
Point |
getPoint(int vertexIndex) |
Point |
getPointWithin() |
LineStringSegment |
getSegment(int... segmentId)
Get the
Segment at the specified vertexId (see Segment.getSegmentId()). |
int |
getSegmentCount() |
Point |
getStartPoint() |
AbstractVertex |
getToVertex(int... vertexId)
Get the
Vertex at the specified vertexId starting at the end of the geometry (see Vertex.getVertexId()). |
AbstractVertex |
getVertex(int... vertexId)
Get the
Vertex at the specified vertexId (see Vertex.getVertexId()). |
double |
getX(int vertexIndex) |
double |
getY(int vertexIndex) |
double |
getZ(int vertexIndex) |
boolean |
hasVertex(Point point) |
<V extends Geometry> |
insertVertex(Point newPoint,
int... vertexId) |
boolean |
intersects(BoundingBox boundingBox) |
boolean |
isClockwise() |
boolean |
isClosed() |
boolean |
isCounterClockwise() |
protected boolean |
isEquivalentClass(Geometry other)
Returns whether the two
Geometrys are equal, from the point
of view of the equalsExact method. |
boolean |
isRing() |
LineString |
merge(LineString line2)
Merge two lines that share common coordinates at either the start or end.
|
LineString |
merge(Point point,
LineString line2) |
LineString |
move(double... deltas) |
protected double[] |
moveCoordinates(double... deltas) |
<V extends Geometry> |
moveVertex(Point newPoint,
int... vertexId) |
LineString |
moveVertex(Point newPoint,
int vertexIndex) |
LineString |
normalize()
Normalizes a LineString.
|
int |
orientationIndex(int index1,
int index2,
int index) |
Iterable<Point> |
points() |
LineString |
prepare()
Deprecated.
|
LineString |
reverse()
Creates a
LineString whose coordinates are in the reverse order of
this objects |
Reader<Segment> |
segments() |
List<LineString> |
split(Point point) |
LineString |
subLine(int vertexCount) |
LineString |
subLine(int fromVertexIndex,
int vertexCount) |
LineString |
subLine(int vertexCount,
Point toPoint) |
LineString |
subLine(Point fromPoint,
int fromVertexIndex,
int vertexCount,
Point toPoint) |
<G extends Geometry> |
toClockwise() |
<G extends Geometry> |
toCounterClockwise() |
Reader<Vertex> |
vertices()
|
buffer, buffer, buffer, checkNotGeometryCollection, compare, compareTo, contains, containsProperly, convert, convert, convexHull, coveredBy, covers, createVertexId, crosses, difference, disjoint, distance, envelopeCovers, envelopesIntersect, equal, equals, equals, equals, equalsExact, equalsNorm, equalsTopo, geometries, getArea, getAxisCount, getBoundingBox, getCentroid, getClassSortIndex, getCoordinateSystem, getEnvelope, getGeometries, getGeometries, getGeometry, getGeometryComponents, getGeometryCount, getGeometryFactory, getGeometryType, getInteriorPoint, getNonZeroGeometryFactory, getSrid, getUserData, getVertexIndex, hashCode, hasInvalidXyCoordinates, hasNonEmptyElements, hasNullElements, intersection, intersects, isAnyTargetComponentInTest, isEmpty, isGeometryCollection, isRectangle, isSimple, isValid, isWithinDistance, overlaps, relate, relate, setUserData, setVertexIndex, symDifference, toString, touches, toWkt, union, union, withinfinalize, getClass, notify, notifyAll, wait, wait, waitgetCoordinatebuffer, buffer, buffer, compareTo, contains, containsProperly, convert, convert, convexHull, coveredBy, covers, crosses, difference, disjoint, distance, equal, equals, equals, equals, equalsExact, equalsNorm, equalsTopo, geometries, getArea, getAxisCount, getBoundingBox, getCentroid, getClassSortIndex, getCoordinateSystem, getEnvelope, getGeometries, getGeometries, getGeometry, getGeometryComponents, getGeometryCount, getGeometryFactory, getGeometryType, getInteriorPoint, getSrid, getUserData, getVertexCount, hashCode, hasInvalidXyCoordinates, intersection, intersects, isEmpty, isRectangle, isSimple, isValid, isWithinDistance, overlaps, relate, relate, setUserData, symDifference, touches, toWkt, union, union, withinpublic <V extends Geometry> V appendVertex(Point newPoint, int... geometryId)
appendVertex in interface Geometrypublic AbstractLineString clone()
LineString object.
(including all coordinates contained by it).clone in interface Geometryclone in interface LineStringclone in class AbstractGeometrypublic int compareToSameClass(Geometry geometry)
AbstractGeometryGeometry is greater than, equal to,
or less than another Geometry having the same class.compareToSameClass in interface GeometrycompareToSameClass in class AbstractGeometrygeometry - a Geometry having the same class as this Geometryo, as
defined in "Normal Form For Geometry" in the JTS Technical
Specificationsprotected BoundingBox computeBoundingBox()
AbstractGeometryGeometry
, or a null BoundingBoxDoubleGf if this Geometry is empty.
Unlike getEnvelopeInternal, this method calculates the BoundingBoxDoubleGf
each time it is called; getEnvelopeInternal caches the result
of this method.computeBoundingBox in class AbstractGeometryGeometrys bounding box; if the Geometry
is empty, BoundingBoxDoubleGf#isNull will return trueprotected double[] convertCoordinates(GeometryFactory geometryFactory)
public <V extends Geometry> V copy(GeometryFactory geometryFactory)
Geometrypublic <V extends Geometry> V deleteVertex(int... vertexId)
deleteVertex in interface Geometrypublic LineString deleteVertex(int vertexIndex)
public double distance(int index,
Point point)
distance in interface LineStringpublic boolean doEquals(int axisCount,
Geometry geometry)
doEquals in class AbstractGeometrypublic boolean equals(int axisCount,
int vertexIndex,
Point point)
equals in interface LineStringpublic boolean equalsExact(Geometry other, double tolerance)
AbstractGeometryGeometrys are exactly equal,
up to a specified distance tolerance.
Two Geometries are exactly equal within a distance tolerance
if and only if:
GeometryFactory, the SRID,
or the userData fields.
To properly test equality between different geometries,
it is usually necessary to AbstractGeometry.normalize() them first.
equalsExact in interface GeometryequalsExact in class AbstractGeometryother - the Geometry with which to compare this Geometrytolerance - distance at or below which two Coordinates
are considered equaltrue if this and the other Geometry
have identical structure and point values, up to the distance tolerance.AbstractGeometry.equals(2,Geometry),
AbstractGeometry.normalize(),
#norm()public boolean equalsVertex(int vertexIndex,
double... coordinates)
equalsVertex in interface LineStringpublic boolean equalsVertex(int axisCount,
int vertexIndex1,
int vertexIndex2)
equalsVertex in interface LineStringpublic boolean equalsVertex(int axisCount,
int vertexIndex,
LineString line2,
int vertexIndex2)
equalsVertex in interface LineStringpublic boolean equalsVertex(int axisCount,
int vertexIndex,
Point point)
equalsVertex in interface LineStringpublic boolean equalsVertex(int vertexIndex,
Point point)
equalsVertex in interface LineStringpublic Geometry getBoundary()
getBoundary in interface GeometrygetBoundary in class AbstractGeometryGeometry.getBoundary()public int getBoundaryDimension()
AbstractGeometryGeometrys inherent boundary.getBoundaryDimension in interface GeometrygetBoundaryDimension in class AbstractGeometryDimension.FALSE if the boundary is the empty geometry.public abstract double[] getCoordinates()
getCoordinates in interface LineStringpublic LineString getCoordinatesList()
getCoordinatesList in interface LineStringpublic DataType getDataType()
getDataType in interface DataTypeProxygetDataType in class AbstractGeometrypublic int getDimension()
AbstractGeometry
Note that this is a different concept to the dimension of
the vertex Coordinatess.
The geometry dimension can never be greater than the coordinate dimension.
For example, a 0-dimensional geometry (e.g. a Point)
may have a coordinate dimension of 3 (X,Y,Z).
getDimension in interface GeometrygetDimension in class AbstractGeometrypublic Point getEndPoint()
getEndPoint in interface LineStringpublic double getLength()
LineStringgetLength in interface GeometrygetLength in class AbstractGeometrypublic double getM(int vertexIndex)
getM in interface LineStringpublic int getMinVertexCount()
public Point getPoint()
AbstractGeometryGeometry
(usually, but not necessarily, the first one).
The returned coordinate should not be assumed
to be an actual Point object used in
the internal representation.getPoint in interface GeometrygetPoint in class AbstractGeometryCoordinates which is a vertex of this Geometry.public final Point getPoint(int vertexIndex)
getPoint in interface LineStringpublic Point getPointWithin()
getPointWithin in interface Geometrypublic LineStringSegment getSegment(int... segmentId)
GeometryGet the Segment at the specified vertexId (see Segment.getSegmentId()).
getSegment in interface Geometrypublic int getSegmentCount()
getSegmentCount in interface LineStringpublic Point getStartPoint()
getStartPoint in interface LineStringpublic AbstractVertex getToVertex(int... vertexId)
GeometryGet the Vertex at the specified vertexId starting at the end of the geometry (see Vertex.getVertexId()).
getToVertex in interface GeometryvertexId - The id of the vertex.public AbstractVertex getVertex(int... vertexId)
GeometryGet the Vertex at the specified vertexId (see Vertex.getVertexId()).
public double getX(int vertexIndex)
getX in interface LineStringpublic double getY(int vertexIndex)
getY in interface LineStringpublic double getZ(int vertexIndex)
getZ in interface LineStringpublic boolean hasVertex(Point point)
hasVertex in interface LineStringpublic <V extends Geometry> V insertVertex(Point newPoint, int... vertexId)
insertVertex in interface Geometrypublic boolean intersects(BoundingBox boundingBox)
intersects in interface Geometrypublic boolean isClockwise()
isClockwise in interface LineStringpublic boolean isClosed()
isClosed in interface LineStringpublic boolean isCounterClockwise()
isCounterClockwise in interface LineStringprotected boolean isEquivalentClass(Geometry other)
AbstractGeometryGeometrys are equal, from the point
of view of the equalsExact method. Called by equalsExact
. In general, two Geometry classes are considered to be
"equivalent" only if they are the same class. An exception is LineString
, which is considered to be equivalent to its subclasses.isEquivalentClass in class AbstractGeometryother - the Geometry with which to compare this Geometry
for equalitytrue if the classes of the two Geometry
s are considered to be equal by the equalsExact method.public boolean isRing()
isRing in interface LineStringpublic LineString merge(LineString line2)
LineStringmerge in interface LineStringpublic LineString merge(Point point, LineString line2)
merge in interface LineStringpublic LineString move(double... deltas)
move in interface Geometrymove in interface LineStringprotected double[] moveCoordinates(double... deltas)
public <V extends Geometry> V moveVertex(Point newPoint, int... vertexId)
moveVertex in interface Geometrypublic LineString moveVertex(Point newPoint, int vertexIndex)
moveVertex in interface LineStringpublic LineString normalize()
normalize in interface Geometrynormalize in interface LineStringnormalize in class AbstractGeometryAbstractGeometry.normalize()public int orientationIndex(int index1,
int index2,
int index)
public Iterable<Point> points()
points in interface LineString@Deprecated public LineString prepare()
prepare in interface Geometryprepare in interface LineStringpublic LineString reverse()
LineString whose coordinates are in the reverse order of
this objectsreverse in interface Geometryreverse in interface LineStringreverse in class AbstractGeometryLineString with coordinates in the reverse orderpublic List<LineString> split(Point point)
split in interface LineStringpublic LineString subLine(int vertexCount)
subLine in interface LineStringpublic LineString subLine(int fromVertexIndex, int vertexCount)
subLine in interface LineStringpublic LineString subLine(int vertexCount, Point toPoint)
subLine in interface LineStringpublic LineString subLine(Point fromPoint, int fromVertexIndex, int vertexCount, Point toPoint)
subLine in interface LineStringpublic <G extends Geometry> G toClockwise()
toClockwise in interface GeometrytoClockwise in class AbstractGeometrypublic <G extends Geometry> G toCounterClockwise()
toCounterClockwise in interface GeometrytoCounterClockwise in class AbstractGeometrypublic Reader<Vertex> vertices()
GeometryGet an Iterable that iterates over the Vertex of the geometry. For memory
efficiency the Vertex returned is the same instance for each call to next
on the iterator. If the vertex is required to track the previous vertex then the
Vertex.clone() method must be called to get a copy of the vertex.
The Iterable.iterator() method always returns the same Iterator instance.
Therefore that method should not be called more than once.
Copyright © 2015 Revolution Systems Inc.. All rights reserved.