use of com.revolsys.geometry.linearref.LengthIndexedLine in project com.revolsys.open by revolsys.
the class LengthIndexedLineTest method indicesOfThenExtract.
@Override
protected Geometry indicesOfThenExtract(final Geometry linearGeom, final Geometry subLine) {
final LengthIndexedLine indexedLine = new LengthIndexedLine(linearGeom);
final double[] loc = indexedLine.indicesOf(subLine);
final Geometry result = indexedLine.extractLine(loc[0], loc[1]);
return result;
}
use of com.revolsys.geometry.linearref.LengthIndexedLine in project com.revolsys.open by revolsys.
the class LengthIndexedLineTest method testComputeZNaN.
/**
* Tests that if the input does not have Z ordinates, neither does the output.
*/
public void testComputeZNaN() {
final Geometry linearGeom = read("LINESTRING (0 0, 10 10 10)");
final LengthIndexedLine indexedLine = new LengthIndexedLine(linearGeom);
final double projIndex = indexedLine.project(new PointDoubleXY(5, 5));
final Point projPt = indexedLine.extractPoint(projIndex);
assertTrue(Double.isNaN(projPt.getZ()));
}
use of com.revolsys.geometry.linearref.LengthIndexedLine in project com.revolsys.open by revolsys.
the class LengthIndexedLineTest method checkExtractLine.
private void checkExtractLine(final String wkt, final double start, final double end, final String expected) {
final Geometry linearGeom = read(wkt);
final LengthIndexedLine indexedLine = new LengthIndexedLine(linearGeom);
final Geometry result = indexedLine.extractLine(start, end);
checkExpected(result, expected);
}
use of com.revolsys.geometry.linearref.LengthIndexedLine in project com.revolsys.open by revolsys.
the class LengthIndexedLineTest method testProjectPointWithDuplicateCoords.
public void testProjectPointWithDuplicateCoords() {
final Geometry linearGeom = read("LINESTRING (0 0, 10 0, 10 0, 20 0)");
final LengthIndexedLine indexedLine = new LengthIndexedLine(linearGeom);
final double projIndex = indexedLine.project(new PointDoubleXY(10, 1));
assertTrue(projIndex == 10.0);
}
use of com.revolsys.geometry.linearref.LengthIndexedLine in project com.revolsys.open by revolsys.
the class LengthIndexedLineTest method extractOffsetAt.
@Override
protected Point extractOffsetAt(final Geometry linearGeom, final Point testPt, final double offsetDistance) {
final LengthIndexedLine indexedLine = new LengthIndexedLine(linearGeom);
final double index = indexedLine.indexOf(testPt);
return indexedLine.extractPoint(index, offsetDistance);
}
Aggregations