Search in sources :

Example 6 with LengthIndexedLine

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;
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) LengthIndexedLine(com.revolsys.geometry.linearref.LengthIndexedLine)

Example 7 with LengthIndexedLine

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()));
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) LengthIndexedLine(com.revolsys.geometry.linearref.LengthIndexedLine) PointDoubleXY(com.revolsys.geometry.model.impl.PointDoubleXY) Point(com.revolsys.geometry.model.Point)

Example 8 with LengthIndexedLine

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);
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) LengthIndexedLine(com.revolsys.geometry.linearref.LengthIndexedLine)

Example 9 with LengthIndexedLine

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);
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) LengthIndexedLine(com.revolsys.geometry.linearref.LengthIndexedLine) PointDoubleXY(com.revolsys.geometry.model.impl.PointDoubleXY)

Example 10 with LengthIndexedLine

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);
}
Also used : LengthIndexedLine(com.revolsys.geometry.linearref.LengthIndexedLine)

Aggregations

LengthIndexedLine (com.revolsys.geometry.linearref.LengthIndexedLine)11 Geometry (com.revolsys.geometry.model.Geometry)7 Point (com.revolsys.geometry.model.Point)6 PointDoubleXY (com.revolsys.geometry.model.impl.PointDoubleXY)5 PointDoubleXYZ (com.revolsys.geometry.model.impl.PointDoubleXYZ)1