indicesOf method

List<LinearLocation> indicesOf(
  1. Geometry subLine
)

Implementation

List<LinearLocation> indicesOf(Geometry subLine) {
  Coordinate startPt =
      (subLine.getGeometryN(0) as LineString).getCoordinateN(0);
  LineString lastLine =
      subLine.getGeometryN(subLine.getNumGeometries() - 1) as LineString;
  Coordinate endPt = lastLine.getCoordinateN(lastLine.getNumPoints() - 1);

  LocationIndexOfPoint locPt = new LocationIndexOfPoint(linearGeom);
  List<LinearLocation> subLineLoc = [];
  subLineLoc[0] = locPt.indexOf(startPt);

  // check for case where subline is zero length
  if (subLine.getLength() == 0.0) {
    subLineLoc[1] = subLineLoc[0].copy();
  } else {
    subLineLoc[1] = locPt.indexOfAfter(endPt, subLineLoc[0]);
  }
  return subLineLoc;
}