Package org.locationtech.jts.linearref
Class LengthIndexOfPoint
- java.lang.Object
-
- org.locationtech.jts.linearref.LengthIndexOfPoint
-
class LengthIndexOfPoint extends java.lang.ObjectComputes the length index of the point on a linearGeometrynearest a givenCoordinate. The nearest point is not necessarily unique; this class always computes the nearest point closest to the start of the geometry.
-
-
Field Summary
Fields Modifier and Type Field Description private GeometrylinearGeom
-
Constructor Summary
Constructors Constructor Description LengthIndexOfPoint(Geometry linearGeom)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description doubleindexOf(Coordinate inputPt)Find the nearest location along a linearGeometryto a given point.static doubleindexOf(Geometry linearGeom, Coordinate inputPt)doubleindexOfAfter(Coordinate inputPt, double minIndex)Finds the nearest index along the linearGeometryto a givenCoordinateafter the specified minimum index.static doubleindexOfAfter(Geometry linearGeom, Coordinate inputPt, double minIndex)private doubleindexOfFromStart(Coordinate inputPt, double minIndex)private doublesegmentNearestMeasure(LineSegment seg, Coordinate inputPt, double segmentStartMeasure)
-
-
-
Field Detail
-
linearGeom
private Geometry linearGeom
-
-
Constructor Detail
-
LengthIndexOfPoint
public LengthIndexOfPoint(Geometry linearGeom)
-
-
Method Detail
-
indexOf
public static double indexOf(Geometry linearGeom, Coordinate inputPt)
-
indexOfAfter
public static double indexOfAfter(Geometry linearGeom, Coordinate inputPt, double minIndex)
-
indexOf
public double indexOf(Coordinate inputPt)
Find the nearest location along a linearGeometryto a given point.- Parameters:
inputPt- the coordinate to locate- Returns:
- the location of the nearest point
-
indexOfAfter
public double indexOfAfter(Coordinate inputPt, double minIndex)
Finds the nearest index along the linearGeometryto a givenCoordinateafter the specified minimum index. If possible the location returned will be strictly greater than theminLocation. If this is not possible, the value returned will equalminLocation. (An example where this is not possible is when minLocation = [end of line] ).- Parameters:
inputPt- the coordinate to locateminIndex- the minimum location for the point location- Returns:
- the location of the nearest point
-
indexOfFromStart
private double indexOfFromStart(Coordinate inputPt, double minIndex)
-
segmentNearestMeasure
private double segmentNearestMeasure(LineSegment seg, Coordinate inputPt, double segmentStartMeasure)
-
-