use of com.revolsys.geometry.model.LineString in project com.revolsys.open by revolsys.
the class ConvexHullTest method test5.
public void test5() throws Exception {
final Geometry geometry = GEOMETRY_FACTORY_1M.punctual(2, 0, 0, 5, 0, 10, 0);
final LineString convexHull = (LineString) GEOMETRY_FACTORY_1M.geometry("LINESTRING(0 0,10 0)");
assertTrue(convexHull.equals(2, geometry.convexHull()));
}
use of com.revolsys.geometry.model.LineString in project com.revolsys.open by revolsys.
the class GeometryImplTest method testEqualsExactForLineStrings.
public void testEqualsExactForLineStrings() throws Exception {
final LineString x = this.geometryFactory.lineString(2, 0.0, 0, 100.0, 0, 100.0, 100);
final LineString somethingExactlyEqual = this.geometryFactory.lineString(2, 0.0, 0, 100.0, 0, 100.0, 100);
final LineString somethingNotEqualButSameClass = this.geometryFactory.lineString(2, 0.0, 0, 100.0, 0, 100.0, 555);
final LineString sameClassButEmpty = this.geometryFactory.lineString();
final LineString anotherSameClassButEmpty = this.geometryFactory.lineString();
final CollectionFactory collectionFactory = new CollectionFactory() {
@Override
public Geometry newCollection(final Geometry... geometries) {
return GeometryImplTest.this.geometryFactory.lineal(geometries);
}
};
doTestEqualsExact(x, somethingExactlyEqual, somethingNotEqualButSameClass, sameClassButEmpty, anotherSameClassButEmpty, collectionFactory);
final CollectionFactory collectionFactory2 = new CollectionFactory() {
@Override
public Geometry newCollection(final Geometry... geometries) {
return GeometryImplTest.this.geometryFactory.lineal(geometries);
}
};
doTestEqualsExact(x, somethingExactlyEqual, somethingNotEqualButSameClass, sameClassButEmpty, anotherSameClassButEmpty, collectionFactory2);
}
use of com.revolsys.geometry.model.LineString in project com.revolsys.open by revolsys.
the class SegmentDensifier method densify.
public Geometry densify(final double segLength) {
this.newCoords = new PointList();
final LineString seq = this.inputLine;
this.newCoords.add(seq.getPoint(0));
for (int i = 0; i < seq.getVertexCount() - 1; i++) {
final Point p0 = seq.getPoint(i);
final Point p1 = seq.getPoint(i + 1);
densify(p0, p1, segLength);
}
final Point[] newPts = this.newCoords.toPointArray();
return this.inputLine.getGeometryFactory().lineString(newPts);
}
use of com.revolsys.geometry.model.LineString in project com.revolsys.open by revolsys.
the class TriangleTest method newTriangle.
public TriangleImpl newTriangle(final Polygon g) {
final LineString line = g.getShell();
final TriangleImpl t = newTriangle(line);
return t;
}
use of com.revolsys.geometry.model.LineString in project com.revolsys.open by revolsys.
the class RobustLineIntersectionTest method checkIntersection.
void checkIntersection(final String wkt1, final String wkt2, final int expectedIntersectionNum, final double distanceTolerance, final Point... intPt) throws ParseException {
final LineString l1 = (LineString) this.geometryFactory.geometry(wkt1);
final LineString l2 = (LineString) this.geometryFactory.geometry(wkt2);
final Point[] pt = new Point[] { l1.getPoint(0), l1.getPoint(1), l2.getPoint(0), l2.getPoint(1) };
checkIntersection(pt, expectedIntersectionNum, distanceTolerance, intPt);
}
Aggregations