public class LocationIndexedLine extends Object
Geometry
using LinearLocation
s as the index.Constructor and Description |
---|
LocationIndexedLine(Geometry linearGeom)
Constructs an object which allows linear referencing along
a given linear
Geometry . |
Modifier and Type | Method and Description |
---|---|
LinearLocation |
clampIndex(LinearLocation index)
Computes a valid index for this line
by clamping the given index to the valid range of index values
|
Geometry |
extractLine(LinearLocation startIndex,
LinearLocation endIndex)
Computes the
LineString for the interval
on the line between the given indices. |
Coordinate |
extractPoint(LinearLocation index)
Computes the
Coordinate for the point
on the line at the given index. |
Coordinate |
extractPoint(LinearLocation index,
double offsetDistance)
Computes the
Coordinate for the point
on the line at the given index, offset by the given distance. |
LinearLocation |
getEndIndex()
Returns the index of the end of the line
|
LinearLocation |
getStartIndex()
Returns the index of the start of the line
|
LinearLocation |
indexOf(Coordinate pt)
Computes the index for a given point on the line.
|
LinearLocation |
indexOfAfter(Coordinate pt,
LinearLocation minIndex)
Finds the index for a point on the line
which is greater than the given index.
|
LinearLocation[] |
indicesOf(Geometry subLine)
Computes the indices for a subline of the line.
|
boolean |
isValidIndex(LinearLocation index)
Tests whether an index is in the valid index range for the line.
|
LinearLocation |
project(Coordinate pt)
Computes the index for the closest point on the line to the given point.
|
public Coordinate extractPoint(LinearLocation 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 Z-ordinate of the computed point will be interpolated from
the Z-ordinates of the line segment containing it, if they exist.index
- the index of the desired pointpublic Coordinate extractPoint(LinearLocation 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 Z-ordinate of the computed point will be interpolated from
the Z-ordinates 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(LinearLocation startIndex, LinearLocation endIndex)
LineString
for the interval
on the line between the given indices.
If the start location is after the end location,
the computed linear geometry has reverse orientation to the input line.startIndex
- the index of the start of the intervalendIndex
- the index of the end of the intervalpublic LinearLocation indexOf(Coordinate pt)
The supplied point does not necessarily have to lie precisely
on the line, but if it is far from the line the accuracy and
performance of this function is not guaranteed.
Use 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 LinearLocation indexOfAfter(Coordinate pt, LinearLocation 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 LinearLocation[] indicesOf(Geometry subLine)
subLine
- a subLine of the linepublic LinearLocation project(Coordinate pt)
pt
- a point on the linepublic LinearLocation getStartIndex()
public LinearLocation getEndIndex()
public boolean isValidIndex(LinearLocation index)
index
- the index to testtrue
if the index is in the valid rangepublic LinearLocation clampIndex(LinearLocation index)
Copyright © 2022. All rights reserved.