if (calcLength == 0 || featureLength == 0) continue; Geometry extracted = lengthIndexedLine.extractLine( startOffset * calcLength / featureLength, stopOffset * calcLength / featureLength); if (calcLength == 0 || featureLength == 0) continue; Geometry extracted = lengthIndexedLine.extractLine( startOffset * calcLength / featureLength, calcLength); if (calcLength == 0 || featureLength == 0) continue; Geometry extracted = lengthIndexedLine.extractLine( 0, stopOffset * calcLength / featureLength); if (extracted.isEmpty() || extracted.getLength() == 0.0) {
public void runExtractedLine(String wkt, double start, double end) throws ParseException { System.out.println("========================="); Geometry g1 = rdr.read(wkt); System.out.println("Input Geometry: " + g1); System.out.println("Indices to extract: " + start + " " + end); LengthIndexedLine indexedLine = new LengthIndexedLine(g1); Geometry subLine = indexedLine.extractLine(start, end); System.out.println("Extracted Line: " + subLine); double[] index = indexedLine.indicesOf(subLine); System.out.println("Indices of extracted line: " + index[0] + " " + index[1]); Coordinate midpt = indexedLine.extractPoint((index[0] + index[1]) / 2); System.out.println("Midpoint of extracted line: " + midpt); } }
public static Geometry extractLine(Geometry g, @Metadata(title="Start length") double start, @Metadata(title="End length") double end) { LengthIndexedLine ll = new LengthIndexedLine(g); return ll.extractLine(start, end); } public static Geometry project(Geometry g, Geometry g2)
protected Geometry indicesOfThenExtract(Geometry linearGeom, Geometry subLine) { LengthIndexedLine indexedLine = new LengthIndexedLine(linearGeom); double[] loc = indexedLine.indicesOf(subLine); Geometry result = indexedLine.extractLine(loc[0], loc[1]); return result; }
private void checkExtractLine(String wkt, double start, double end, String expected) { Geometry linearGeom = read(wkt); LengthIndexedLine indexedLine = new LengthIndexedLine(linearGeom); Geometry result = indexedLine.extractLine(start, end); checkExpected(result, expected); }