use of com.revolsys.geometry.model.Polygonal in project com.revolsys.open by revolsys.
the class ConnectedInteriorTester method visitShellInteriors.
/**
* Mark all the edges for the edgeRings corresponding to the shells
* of the input polygons.
* Only ONE ring gets marked for each shell - if there are others which remain unmarked
* this indicates a disconnected interior.
*/
private void visitShellInteriors(final Geometry g, final PlanarGraph graph) {
if (g instanceof Polygon) {
final Polygon p = (Polygon) g;
visitInteriorRing(p.getShell(), graph);
} else if (g instanceof Polygonal) {
final Polygonal polygonal = (Polygonal) g;
for (final Polygon polygon : polygonal.polygons()) {
visitInteriorRing(polygon.getShell(), graph);
}
}
}
use of com.revolsys.geometry.model.Polygonal in project com.revolsys.open by revolsys.
the class GmlGeometryFieldType method geometry.
private void geometry(final XmlWriter out, final Object value, final boolean writeSrsName) {
if (value instanceof Geometry) {
final Geometry geometry = (Geometry) value;
if (geometry instanceof Point) {
final Point point = (Point) geometry;
point(out, point, writeSrsName);
} else if (geometry instanceof LineString) {
final LineString line = (LineString) geometry;
lineString(out, line, writeSrsName);
} else if (geometry instanceof Polygon) {
final Polygon polygon = (Polygon) geometry;
polygon(out, polygon, writeSrsName);
} else if (geometry instanceof Punctual) {
final Punctual punctual = (Punctual) geometry;
multiPoint(out, punctual, writeSrsName);
} else if (geometry instanceof Lineal) {
final Lineal lineal = (Lineal) geometry;
multiLineString(out, lineal, writeSrsName);
} else if (geometry instanceof Polygonal) {
final Polygonal polygonal = (Polygonal) geometry;
multiPolygon(out, polygonal, writeSrsName);
} else if (geometry.isGeometryCollection()) {
geometryCollection(out, geometry, writeSrsName);
}
}
}
use of com.revolsys.geometry.model.Polygonal in project com.revolsys.open by revolsys.
the class GeometryCoordinatesTableModel method setGeometry.
public void setGeometry(final Geometry geometry) {
final LayerRecordForm form = this.geometryCoordinatesPanel.getForm();
final LayerRecord record = form.getRecord();
final Geometry oldGeometry = record.getGeometry();
if (oldGeometry != geometry) {
final AbstractRecordLayer layer = record.getLayer();
final String geometryFieldName = record.getGeometryFieldName();
final UndoableEdit setGeometryUndo = layer.newSetFieldUndo(record, geometryFieldName, oldGeometry, geometry);
final UndoManager undoManager = form.getUndoManager();
undoManager.addEdit(setGeometryUndo);
}
if (this.geometry != geometry) {
this.geometry = geometry;
if (geometry == null) {
this.geometryFactory = GeometryFactory.DEFAULT_3D;
this.vertexIndexMap = Collections.emptyMap();
this.vertexIndices = Collections.emptyList();
} else {
this.geometryFactory = geometry.getGeometryFactory();
this.vertexIndexMap = getIndexOfVertices(geometry);
this.vertexIndices = new ArrayList<>(this.vertexIndexMap.keySet());
}
this.axisCount = this.geometryFactory.getAxisCount();
this.axisNames = new ArrayList<>();
if (geometry.isGeometryCollection()) {
this.axisNames.add("P");
}
if (geometry instanceof Polygonal) {
this.axisNames.add("R");
}
this.vertexIndexColumn = this.axisNames.size();
this.axisNames.add("#");
this.segmentIndexColumn = this.axisNames.size();
this.axisNames.add("S #");
this.numIndexItems = this.axisNames.size();
this.axisNames.add("X");
this.axisNames.add("Y");
if (this.axisCount > 2) {
this.axisNames.add("Z");
}
if (this.axisCount > 3) {
this.axisNames.add("M");
}
this.columnCount = this.axisNames.size();
fireTableStructureChanged();
}
}
use of com.revolsys.geometry.model.Polygonal in project com.revolsys.open by revolsys.
the class MultiPolygonVertex method hasNext.
@Override
public boolean hasNext() {
if (getGeometry().isEmpty()) {
return false;
} else {
final Polygonal polygonal = getPolygonal();
int partIndex = this.partIndex;
int ringIndex = this.ringIndex;
int vertexIndex = this.vertexIndex + 1;
while (partIndex < polygonal.getGeometryCount()) {
final Polygon polygon = polygonal.getPolygon(partIndex);
while (ringIndex < polygon.getRingCount()) {
final LinearRing ring = polygon.getRing(ringIndex);
if (vertexIndex < ring.getVertexCount()) {
return true;
} else {
ringIndex++;
vertexIndex = 0;
}
}
partIndex++;
ringIndex = 0;
vertexIndex = 0;
}
return false;
}
}
use of com.revolsys.geometry.model.Polygonal in project com.revolsys.open by revolsys.
the class EWktWriter method write.
public static void write(final Writer out, final Geometry geometry) {
if (geometry != null) {
if (geometry instanceof Point) {
final Point point = (Point) geometry;
write(out, point);
} else if (geometry instanceof Punctual) {
final Punctual punctual = (Punctual) geometry;
write(out, punctual);
} else if (geometry instanceof LinearRing) {
final LinearRing line = (LinearRing) geometry;
write(out, line);
} else if (geometry instanceof LineString) {
final LineString line = (LineString) geometry;
write(out, line);
} else if (geometry instanceof Lineal) {
final Lineal lineal = (Lineal) geometry;
write(out, lineal);
} else if (geometry instanceof Polygon) {
final Polygon polygon = (Polygon) geometry;
write(out, polygon);
} else if (geometry instanceof Polygonal) {
final Polygonal polygonal = (Polygonal) geometry;
write(out, polygonal);
} else if (geometry.isGeometryCollection()) {
writeGeometryCollection(out, geometry);
} else {
throw new IllegalArgumentException("Unknown geometry type" + geometry.getClass());
}
}
}
Aggregations