use of com.revolsys.geometry.model.GeometryFactory in project com.revolsys.open by revolsys.
the class AbstractGeometryCollectionEditor method appendVertex.
@SuppressWarnings("unchecked")
@Override
public GeometryEditor<?> appendVertex(final int[] geometryId, final GeometryDataType<?, ?> partDataType, final Point point) {
if (geometryId == null || geometryId.length < 1) {
} else {
final int partIndex = geometryId[0];
GE editor = getEditor(partIndex);
if (editor == null && partIndex == this.editors.size()) {
final GeometryDataType<?, ?> thisPartDataType = getPartDataType();
if (thisPartDataType == null || thisPartDataType.equals(partDataType)) {
editor = (GE) partDataType.newGeometryEditor(getGeometryFactory());
addEditor(editor);
}
}
if (editor != null) {
final int[] childGeometryId = Arrays.copyOfRange(geometryId, 1, geometryId.length);
final GeometryEditor<?> newEditor = editor.appendVertex(childGeometryId, 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;
}
use of com.revolsys.geometry.model.GeometryFactory in project com.revolsys.open by revolsys.
the class AbstractGeometryCollectionEditor method getCurrentGeometry.
@Override
public Geometry getCurrentGeometry() {
final List<Geometry> geometries = new ArrayList<>();
for (final GE editor : this.editors) {
final Geometry currentGeometry = editor.getCurrentGeometry();
geometries.add(currentGeometry);
}
final GeometryFactory geometryFactory = getGeometryFactory();
return geometryFactory.geometry(geometries);
}
use of com.revolsys.geometry.model.GeometryFactory in project com.revolsys.open by revolsys.
the class LineStringEditor method newPolygon.
public Polygon newPolygon() {
final LinearRing ring = newLinearRing();
final GeometryFactory geometryFactory = getGeometryFactory();
return geometryFactory.polygon(ring);
}
use of com.revolsys.geometry.model.GeometryFactory in project com.revolsys.open by revolsys.
the class LinearRingEditor method getCurrentGeometry.
@Override
public Geometry getCurrentGeometry() {
final GeometryFactory geometryFactory = getGeometryFactory();
final int vertexCount = getVertexCount();
if (vertexCount == 0) {
return newLineStringEmpty();
} else if (vertexCount == 1) {
return newPoint();
} else if (vertexCount == 2 || !isClosed()) {
return newLineString(geometryFactory, this.axisCount, vertexCount, this.coordinates);
} else {
return this;
}
}
use of com.revolsys.geometry.model.GeometryFactory in project com.revolsys.open by revolsys.
the class MultiPointEditor method appendVertex.
public void appendVertex(final Point point) {
if (point != null && !point.isEmpty()) {
final GeometryFactory geometryFactory = getGeometryFactory();
final Point newPoint = point.convertGeometry(geometryFactory);
final PointEditor pointEditor = newPoint.newGeometryEditor(this);
addEditor(pointEditor);
}
}
Aggregations