Search in sources :

Example 81 with GeometryFactory

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

the class RecordIoTestSuite method assertGeometry.

private static void assertGeometry(final Geometry expectedGeometry, final Geometry actualGeometry) {
    Assert.assertEquals("Empty", expectedGeometry.isEmpty(), actualGeometry.isEmpty());
    if (!expectedGeometry.isEmpty()) {
        final GeometryFactory expectedGeometryFactory = expectedGeometry.getGeometryFactory();
        final GeometryFactory actualGeometryFactory = actualGeometry.getGeometryFactory();
        Assert.assertEquals("Geometry Factory", expectedGeometryFactory, actualGeometryFactory);
        final int axisCount = expectedGeometry.getAxisCount();
        Assert.assertEquals("Axis Count", axisCount, actualGeometry.getAxisCount());
        if (!actualGeometry.equals(axisCount, expectedGeometry)) {
            // Allow for conversion of multi part to single part
            if (expectedGeometry.getGeometryCount() != 1 || !actualGeometry.equals(axisCount, expectedGeometry.getGeometry(0))) {
                TestUtil.failNotEquals("Geometry Equal Exact", expectedGeometry, actualGeometry);
            }
        }
    }
}
Also used : GeometryFactory(com.revolsys.geometry.model.GeometryFactory)

Example 82 with GeometryFactory

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

the class PointCloud method newTriangulatedIrregularNetwork.

default TriangulatedIrregularNetwork newTriangulatedIrregularNetwork(final Predicate<? super Point> filter) {
    final GeometryFactory geometryFactory = getGeometryFactory();
    final QuadEdgeDelaunayTinBuilder tinBuilder = new QuadEdgeDelaunayTinBuilder(geometryFactory);
    forEachPoint((point) -> {
        if (filter.test(point)) {
            tinBuilder.insertVertex(point);
        }
    });
    final TriangulatedIrregularNetwork tin = tinBuilder.newTriangulatedIrregularNetwork();
    return tin;
}
Also used : TriangulatedIrregularNetwork(com.revolsys.elevation.tin.TriangulatedIrregularNetwork) GeometryFactory(com.revolsys.geometry.model.GeometryFactory) QuadEdgeDelaunayTinBuilder(com.revolsys.elevation.tin.quadedge.QuadEdgeDelaunayTinBuilder)

Example 83 with GeometryFactory

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

the class LasPointCloud method newTriangulatedIrregularNetwork.

@Override
public TriangulatedIrregularNetwork newTriangulatedIrregularNetwork() {
    final GeometryFactory geometryFactory = getGeometryFactory();
    final QuadEdgeDelaunayTinBuilder tinBuilder = new QuadEdgeDelaunayTinBuilder(geometryFactory);
    forEachPoint((lasPoint) -> {
        tinBuilder.insertVertex(lasPoint);
    });
    final TriangulatedIrregularNetwork tin = tinBuilder.newTriangulatedIrregularNetwork();
    return tin;
}
Also used : TriangulatedIrregularNetwork(com.revolsys.elevation.tin.TriangulatedIrregularNetwork) GeometryFactory(com.revolsys.geometry.model.GeometryFactory) QuadEdgeDelaunayTinBuilder(com.revolsys.elevation.tin.quadedge.QuadEdgeDelaunayTinBuilder)

Example 84 with GeometryFactory

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

the class ProjectedCoordinateSystem method getAreaBoundingBox.

@Override
public BoundingBox getAreaBoundingBox() {
    if (this.areaBoundingBox == null) {
        final GeometryFactory geographicGeometryFactory = this.geographicCoordinateSystem.getGeometryFactory();
        BoundingBox boundingBox;
        if (this.area == null) {
            boundingBox = geographicGeometryFactory.newBoundingBox(-180, -90, 180, 90);
        } else {
            final BoundingBox latLonBounds = this.area.getLatLonBounds();
            boundingBox = latLonBounds.convert(geographicGeometryFactory);
        }
        final GeometryFactory geometryFactory = getGeometryFactory();
        this.areaBoundingBox = boundingBox.convert(geometryFactory);
    }
    return this.areaBoundingBox;
}
Also used : GeometryFactory(com.revolsys.geometry.model.GeometryFactory) BoundingBox(com.revolsys.geometry.model.BoundingBox)

Example 85 with GeometryFactory

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

the class AbstractGeometryCollectionEditor method insertVertex.

@Override
public GeometryEditor<?> insertVertex(final int[] vertexId, final Point point) {
    if (vertexId == null || vertexId.length < 1) {
    } else {
        final int partIndex = vertexId[0];
        final GE editor = getEditor(partIndex);
        if (editor != null) {
            final int[] childVertexId = Arrays.copyOfRange(vertexId, 1, vertexId.length);
            final GeometryEditor<?> newEditor = editor.insertVertex(childVertexId, point);
            if (newEditor != editor) {
                final List<GeometryEditor<?>> editors = new ArrayList<>(this.editors);
                editors.set(partIndex, newEditor);
                final GeometryFactory geometryFactory = getGeometryFactory();
                return new GeometryCollectionImplEditor(geometryFactory, editors);
            }
        }
    }
    return this;
}
Also used : GeometryFactory(com.revolsys.geometry.model.GeometryFactory) ArrayList(java.util.ArrayList) Point(com.revolsys.geometry.model.Point)

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