private void runExtractLine( String wkt, LinearLocation start, LinearLocation end, String expected) { Geometry geom = read(wkt); LocationIndexedLine lil = new LocationIndexedLine(geom); Geometry result = lil.extractLine(start, end); // System.out.println(result); checkExpected(result, expected); }
protected boolean indexOfAfterCheck(Geometry linearGeom, Coordinate testPt, Coordinate afterPt) { LocationIndexedLine indexedLine = new LocationIndexedLine(linearGeom); // check that computed location is after check location LinearLocation afterLoc = indexedLine.indexOf(afterPt); LinearLocation testLoc = indexedLine.indexOfAfter(testPt, afterLoc); if (testLoc.compareTo(afterLoc) < 0) return false; return true; }
protected boolean indexOfAfterCheck(Geometry linearGeom, Coordinate testPt) { LocationIndexedLine indexedLine = new LocationIndexedLine(linearGeom); // check locations are consecutive LinearLocation loc1 = indexedLine.indexOf(testPt); LinearLocation loc2 = indexedLine.indexOfAfter(testPt, loc1); if (loc2.compareTo(loc1) <= 0) return false; // check extracted points are the same as the input Coordinate pt1 = indexedLine.extractPoint(loc1); Coordinate pt2 = indexedLine.extractPoint(loc2); if (!pt1.equals2D(testPt)) return false; if (!pt2.equals2D(testPt)) return false; return true; }
protected Coordinate extractOffsetAt( Geometry linearGeom, Coordinate testPt, double offsetDistance) { LocationIndexedLine indexedLine = new LocationIndexedLine(linearGeom); LinearLocation index = indexedLine.indexOf(testPt); return indexedLine.extractPoint(index, offsetDistance); }
protected Geometry indicesOfThenExtract(Geometry input, Geometry subLine) { LocationIndexedLine indexedLine = new LocationIndexedLine(input); LinearLocation[] loc = indexedLine.indicesOf(subLine); Geometry result = indexedLine.extractLine(loc[0], loc[1]); return result; }