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);
}
}
}
}
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;
}
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;
}
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;
}
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;
}
Aggregations