use of com.revolsys.geometry.linearref.LengthIndexedLine in project com.revolsys.open by revolsys.
the class LinearReferencingFunctions method extractPoint.
public static Geometry extractPoint(final Geometry g, final double index) {
final LengthIndexedLine ll = new LengthIndexedLine(g);
final Point p = ll.extractPoint(index);
return g.getGeometryFactory().point(p);
}
use of com.revolsys.geometry.linearref.LengthIndexedLine in project com.revolsys.open by revolsys.
the class LengthIndexedLineTest method indexOfAfterCheck.
@Override
protected boolean indexOfAfterCheck(final Geometry linearGeom, final Point testPt, final Point checkPt) {
final LengthIndexedLine indexedLine = new LengthIndexedLine(linearGeom);
// check that computed location is after check location
final double checkLoc = indexedLine.indexOf(checkPt);
final double testLoc = indexedLine.indexOfAfter(testPt, checkLoc);
if (testLoc < checkLoc) {
return false;
}
return true;
}
use of com.revolsys.geometry.linearref.LengthIndexedLine in project com.revolsys.open by revolsys.
the class LengthIndexedLineTest method testProjectExtractPoint.
/**
* From GEOS Ticket #323
*/
public void testProjectExtractPoint() {
final Geometry linearGeom = read("MULTILINESTRING ((0 2, 0 0), (-1 1, 1 1))");
final LengthIndexedLine indexedLine = new LengthIndexedLine(linearGeom);
final double index = indexedLine.project(new PointDoubleXY(1, 0));
final Point pt = indexedLine.extractPoint(index);
assertTrue(pt.equals(new PointDoubleXY(0, 0)));
}
use of com.revolsys.geometry.linearref.LengthIndexedLine in project com.revolsys.open by revolsys.
the class LengthIndexedLineTest method testComputeZ.
/**
* Tests that z values are interpolated
*/
public void testComputeZ() {
final Geometry linearGeom = read("LINESTRINGZ(0 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);
// System.out.println(projPt);
assertTrue(projPt.equals(3, new PointDoubleXYZ(5.0, 5, 5)));
}
use of com.revolsys.geometry.linearref.LengthIndexedLine in project com.revolsys.open by revolsys.
the class LengthIndexedLineTest method testExtractPointBeyondRange.
public void testExtractPointBeyondRange() {
final Geometry linearGeom = read("LINESTRING (0 0, 10 10)");
final LengthIndexedLine indexedLine = new LengthIndexedLine(linearGeom);
final Point pt = indexedLine.extractPoint(100);
assertTrue(pt.equals(new PointDoubleXY(10, 10)));
final Point pt2 = indexedLine.extractPoint(0);
assertTrue(pt2.equals(new PointDoubleXY(0, 0)));
}
Aggregations