public class LengthIndexedLine extends Object
Geometry
using the length along the line as the index.
Negative length values are taken as measured in the reverse direction
from the end of the geometry.
Outofrange index values are handled by clamping
them to the valid range of values.
Nonsimple lines (i.e. which loop back to cross or touch
themselves) are supported.Constructor and Description 

LengthIndexedLine(Geometry linearGeom)
Constructs an object which allows a linear
Geometry
to be linearly referenced using length as an index. 
Modifier and Type  Method and Description 

double 
clampIndex(double index)
Computes a valid index for this line
by clamping the given index to the valid range of index values

Geometry 
extractLine(double startIndex,
double endIndex)
Computes the
LineString for the interval
on the line between the given indices. 
Coordinate 
extractPoint(double index)
Computes the
Coordinate for the point
on the line at the given index. 
Coordinate 
extractPoint(double index,
double offsetDistance)
Computes the
Coordinate for the point
on the line at the given index, offset by the given distance. 
double 
getEndIndex()
Returns the index of the end of the line

double 
getStartIndex()
Returns the index of the start of the line

double 
indexOf(Coordinate pt)
Computes the minimum index for a point on the line.

double 
indexOfAfter(Coordinate pt,
double minIndex)
Finds the index for a point on the line
which is greater than the given index.

double[] 
indicesOf(Geometry subLine)
Computes the indices for a subline of the line.

boolean 
isValidIndex(double index)
Tests whether an index is in the valid index range for the line.

double 
project(Coordinate pt)
Computes the index for the closest point on the line to the given point.

public Coordinate extractPoint(double index)
Coordinate
for the point
on the line at the given index.
If the index is out of range the first or last point on the
line will be returned.
The Zordinate of the computed point will be interpolated from
the Zordinates of the line segment containing it, if they exist.index
 the index of the desired pointpublic Coordinate extractPoint(double index, double offsetDistance)
Coordinate
for the point
on the line at the given index, offset by the given distance.
If the index is out of range the first or last point on the
line will be returned.
The computed point is offset to the left of the line if the offset distance is
positive, to the right if negative.
The Zordinate of the computed point will be interpolated from
the Zordinates of the line segment containing it, if they exist.index
 the index of the desired pointoffsetDistance
 the distance the point is offset from the segment
(positive is to the left, negative is to the right)public Geometry extractLine(double startIndex, double endIndex)
LineString
for the interval
on the line between the given indices.
If the endIndex lies before the startIndex,
the computed geometry is reversed.startIndex
 the index of the start of the intervalendIndex
 the index of the end of the intervalpublic double indexOf(Coordinate pt)
project(org.locationtech.jts.geom.Coordinate)
to compute a guaranteed result for points
which may be far from the line.pt
 a point on the lineproject(Coordinate)
public double indexOfAfter(Coordinate pt, double minIndex)
project(org.locationtech.jts.geom.Coordinate)
to compute a guaranteed result for points
which may be far from the line.pt
 a point on the lineminIndex
 the value the returned index must be greater thanproject(Coordinate)
public double[] indicesOf(Geometry subLine)
subLine
 a subLine of the linepublic double project(Coordinate pt)
pt
 a point on the linepublic double getStartIndex()
public double getEndIndex()
public boolean isValidIndex(double index)
index
 the index to testtrue
if the index is in the valid rangepublic double clampIndex(double index)
Copyright © 2020. All rights reserved.