use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.
the class PreparedGeometryTeeOperation method checkAllPrepOps.
private void checkAllPrepOps(final Geometry g1, final Geometry g2) {
final Geometry prepGeom = g1.prepare();
checkIntersects(g1, prepGeom, g2);
checkContains(g1, prepGeom, g2);
checkContainsProperly(g1, prepGeom, g2);
checkCovers(g1, prepGeom, g2);
}
use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.
the class GeometryTestUtil method multiLineString.
public static Lineal multiLineString(final GeometryFactory geometryFactory, final int geometryCount, final int vertexCount, final double delta) {
final List<Geometry> geometries = new ArrayList<>();
for (int i = 0; i < geometryCount; i++) {
final Geometry geometry = lineString(geometryFactory, vertexCount + i, delta * (vertexCount + i * 3));
geometries.add(geometry);
}
return geometryFactory.lineal(geometries);
}
use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.
the class GeometryTestUtil method multiPoint.
public static Punctual multiPoint(final GeometryFactory geometryFactory, final int geometryCount, final double delta) {
final List<Geometry> geometries = new ArrayList<>();
for (int i = 0; i < geometryCount; i++) {
final Geometry geometry = point(geometryFactory, delta * i);
geometries.add(geometry);
}
final Punctual multiPoint = geometryFactory.punctual(geometries);
return multiPoint;
}
use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.
the class BufferTest method performanceTest.
public static void performanceTest() throws Throwable {
// JTS takes 3.4 seconds
final PathResource resource = new PathResource("/Users/paustin/Development/ALL/com.revolsys.open/com.revolsys.open.core/src/test/resources/com/revolsys/jts/test/data/world.wkt");
List<Geometry> geometries = new ArrayList<>();
try (Reader<Geometry> reader = GeometryReader.newGeometryReader(resource)) {
geometries = reader.toList();
}
for (final Geometry geometry : geometries) {
geometry.buffer(5);
}
final long time = System.currentTimeMillis();
for (final Geometry geometry : geometries) {
geometry.buffer(5);
}
System.out.println(System.currentTimeMillis() - time);
}
use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.
the class AffineTransformationTest method checkTransformation.
void checkTransformation(final String geomStr) throws IOException, ParseException, NoninvertibleTransformationException {
final Geometry geom = geometryFactory.geometry(geomStr);
final AffineTransformation trans = AffineTransformation.rotationInstance(Math.PI / 2);
final AffineTransformation inv = trans.getInverse();
final Geometry transGeom = trans.transform(geom);
final Geometry invGeom = inv.transform(transGeom);
// check if transformed geometry is equal to original
final boolean isEqual = geom.equalsExact(invGeom, 0.0005);
assertTrue(isEqual);
}
Aggregations