Search in sources :

Example 66 with GeometryFactory

use of com.revolsys.geometry.model.GeometryFactory in project com.revolsys.open by revolsys.

the class UnaryUnionTest method doTest.

private void doTest(final String expectedWKT, final String... inputWKT) throws ParseException {
    Geometry result;
    final Collection<Geometry> geoms = GeometryUtils.readWKT(inputWKT);
    if (geoms.size() == 0) {
        final GeometryFactory geometryFactory = GeometryFactory.DEFAULT_3D;
        result = UnaryUnionOp.union(geoms, geometryFactory);
    } else {
        result = UnaryUnionOp.union(geoms);
    }
    Assert.assertEquals(GeometryUtils.readWKT(expectedWKT), result);
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) GeometryFactory(com.revolsys.geometry.model.GeometryFactory)

Example 67 with GeometryFactory

use of com.revolsys.geometry.model.GeometryFactory in project com.revolsys.open by revolsys.

the class SimpleRayCrossingStressTest method testGrid.

public void testGrid() {
    // Use fixed PM to try and get at least some points hitting the boundary
    final GeometryFactory geomFactory = GeometryFactory.fixed2d(0, 1.0, 1.0);
    // GeometryFactoryI geomFactory = new GeometryFactoryI();
    final PerturbedGridPolygonBuilder gridBuilder = new PerturbedGridPolygonBuilder(geomFactory);
    gridBuilder.setNumLines(20);
    gridBuilder.setLineWidth(10.0);
    final Geometry area = gridBuilder.getGeometry();
    final SimpleRayCrossingPointInAreaLocator pia = new SimpleRayCrossingPointInAreaLocator(area);
    final PointInAreaStressTester gridTester = new PointInAreaStressTester(geomFactory, area);
    gridTester.setNumPoints(100000);
    gridTester.setPIA(pia);
    final boolean isCorrect = gridTester.run();
    assertTrue(isCorrect);
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) GeometryFactory(com.revolsys.geometry.model.GeometryFactory) PerturbedGridPolygonBuilder(com.revolsys.geometry.test.old.algorithm.PerturbedGridPolygonBuilder)

Example 68 with GeometryFactory

use of com.revolsys.geometry.model.GeometryFactory in project com.revolsys.open by revolsys.

the class TriangulationFunctions method delaunayEdges.

public static Lineal delaunayEdges(final Geometry geom) {
    GeometryFactory geometryFactory = geom.getGeometryFactory();
    geometryFactory = geometryFactory.convertScales(0, 0, 0);
    final QuadEdgeDelaunayTinBuilder builder = new QuadEdgeDelaunayTinBuilder(geometryFactory);
    builder.insertVertices(geom);
    final Lineal edges = builder.getEdges();
    return edges;
}
Also used : GeometryFactory(com.revolsys.geometry.model.GeometryFactory) Lineal(com.revolsys.geometry.model.Lineal) QuadEdgeDelaunayTinBuilder(com.revolsys.elevation.tin.quadedge.QuadEdgeDelaunayTinBuilder)

Example 69 with GeometryFactory

use of com.revolsys.geometry.model.GeometryFactory in project com.revolsys.open by revolsys.

the class TriangulationFunctions method conformingDelaunayEdgesWithTolerance.

public static Lineal conformingDelaunayEdgesWithTolerance(final Geometry sites, final Geometry constraints, final double tol) {
    final QuadEdgeConformingDelaunayTinBuilder builder = new QuadEdgeConformingDelaunayTinBuilder();
    builder.setSites(sites);
    builder.setConstraints(constraints);
    builder.setTolerance(tol);
    final GeometryFactory geomFact = sites != null ? sites.getGeometryFactory() : constraints.getGeometryFactory();
    final Lineal triangles = builder.getEdgesLineal(geomFact);
    return triangles;
}
Also used : GeometryFactory(com.revolsys.geometry.model.GeometryFactory) Lineal(com.revolsys.geometry.model.Lineal) QuadEdgeConformingDelaunayTinBuilder(com.revolsys.elevation.tin.quadedge.QuadEdgeConformingDelaunayTinBuilder)

Example 70 with GeometryFactory

use of com.revolsys.geometry.model.GeometryFactory in project com.revolsys.open by revolsys.

the class TriangulationFunctions method delaunayEdgesWithTolerance.

public static Geometry delaunayEdgesWithTolerance(final Geometry geom, final double tolerance) {
    GeometryFactory geometryFactory = geom.getGeometryFactory();
    geometryFactory = geometryFactory.convertScales(tolerance, tolerance, tolerance);
    final QuadEdgeDelaunayTinBuilder builder = new QuadEdgeDelaunayTinBuilder(geometryFactory);
    builder.insertVertices(geom);
    final Lineal edges = builder.getEdges();
    return edges;
}
Also used : GeometryFactory(com.revolsys.geometry.model.GeometryFactory) Lineal(com.revolsys.geometry.model.Lineal) QuadEdgeDelaunayTinBuilder(com.revolsys.elevation.tin.quadedge.QuadEdgeDelaunayTinBuilder)

Aggregations

GeometryFactory (com.revolsys.geometry.model.GeometryFactory)360 Point (com.revolsys.geometry.model.Point)142 Geometry (com.revolsys.geometry.model.Geometry)72 BoundingBox (com.revolsys.geometry.model.BoundingBox)70 LineString (com.revolsys.geometry.model.LineString)61 ArrayList (java.util.ArrayList)45 DataType (com.revolsys.datatype.DataType)25 FieldDefinition (com.revolsys.record.schema.FieldDefinition)24 Polygon (com.revolsys.geometry.model.Polygon)22 List (java.util.List)18 RecordDefinition (com.revolsys.record.schema.RecordDefinition)17 Test (org.junit.Test)16 CoordinateSystem (com.revolsys.geometry.cs.CoordinateSystem)15 Vertex (com.revolsys.geometry.model.vertex.Vertex)14 Record (com.revolsys.record.Record)14 IOException (java.io.IOException)13 PathName (com.revolsys.io.PathName)12 LinearRing (com.revolsys.geometry.model.LinearRing)10 PointDoubleXY (com.revolsys.geometry.model.impl.PointDoubleXY)10 QuadEdgeDelaunayTinBuilder (com.revolsys.elevation.tin.quadedge.QuadEdgeDelaunayTinBuilder)8