indexOfAfter method
Finds the nearest index along the linear {@link Geometry}
to a given {@link Coordinate}
after the specified minimum index.
If possible the location returned will be strictly greater than the
minLocation
.
If this is not possible, the
value returned will equal minLocation
.
(An example where this is not possible is when
minLocation = end of line
).
@param inputPt the coordinate to locate @param minIndex the minimum location for the point location @return the location of the nearest point
Implementation
double indexOfAfter(Coordinate inputPt, double minIndex) {
if (minIndex < 0.0) return indexOf(inputPt);
// sanity check for minIndex at or past end of line
double endIndex = linearGeom.getLength();
if (endIndex < minIndex) return endIndex;
double closestAfter = indexOfFromStart(inputPt, minIndex);
/**
* Return the minDistanceLocation found.
*/
Assert.isTrue(closestAfter >= minIndex,
"computed index is before specified minimum index");
return closestAfter;
}