use of com.revolsys.geometry.model.Polygon in project com.revolsys.open by revolsys.
the class KmlXmlWriter method writeGeometry.
public void writeGeometry(final Geometry geometry, final int axisCount) {
if (geometry != null) {
final int numGeometries = geometry.getGeometryCount();
if (numGeometries > 1) {
startTag(Kml22Constants.MULTI_GEOMETRY);
for (int i = 0; i < numGeometries; i++) {
writeGeometry(geometry.getGeometry(i), axisCount);
}
endTag();
} else {
final Geometry geoGraphicsGeom = geometry.convertGeometry(GeometryFactory.floating(Kml22Constants.COORDINATE_SYSTEM_ID, axisCount));
if (geoGraphicsGeom instanceof Point) {
final Point point = (Point) geoGraphicsGeom;
writePoint(point);
} else if (geoGraphicsGeom instanceof LinearRing) {
final LinearRing line = (LinearRing) geoGraphicsGeom;
writeLinearRing(line);
} else if (geoGraphicsGeom instanceof LineString) {
final LineString line = (LineString) geoGraphicsGeom;
writeLineString(line);
} else if (geoGraphicsGeom instanceof Polygon) {
final Polygon polygon = (Polygon) geoGraphicsGeom;
writePolygon(polygon);
} else if (geoGraphicsGeom.isGeometryCollection()) {
writeMultiGeometry(geoGraphicsGeom, axisCount);
}
}
}
}
use of com.revolsys.geometry.model.Polygon in project com.revolsys.open by revolsys.
the class WktWriter method write.
private static void write(final Writer out, final Polygonal polygonal, final int axisCount) throws IOException {
writeGeometryType(out, "MULTIPOLYGON", axisCount);
if (polygonal.isEmpty()) {
out.write(" EMPTY");
} else {
out.write("(");
Polygon polygon = (Polygon) polygonal.getGeometry(0);
writePolygon(out, polygon, axisCount);
for (int i = 1; i < polygonal.getGeometryCount(); i++) {
out.write(",");
polygon = (Polygon) polygonal.getGeometry(i);
writePolygon(out, polygon, axisCount);
}
out.write(")");
}
}
use of com.revolsys.geometry.model.Polygon in project com.revolsys.open by revolsys.
the class PolygonEditorTest method testSetZ.
@Test
public void testSetZ() {
final Polygon polygon = POLYGON;
final PolygonEditor polygonEditor = polygon.newGeometryEditor(3);
polygonEditor.setZ(1, 1, 10);
final Polygon newPolygon = polygonEditor.newGeometry();
Assert.assertNotSame(polygon, newPolygon);
Assert.assertEquals(10.0, newPolygon.getZ(1, 1), 0.0);
}
use of com.revolsys.geometry.model.Polygon in project com.revolsys.open by revolsys.
the class PolygonEditorTest method testSetM.
@Test
public void testSetM() {
final Polygon polygon = POLYGON;
final PolygonEditor polygonEditor = polygon.newGeometryEditor(4);
polygonEditor.setM(1, 1, 10);
final Polygon newPolygon = polygonEditor.newGeometry();
Assert.assertNotSame(polygon, newPolygon);
Assert.assertEquals(10.0, newPolygon.getM(1, 1), 0.0);
}
use of com.revolsys.geometry.model.Polygon in project com.revolsys.open by revolsys.
the class PolygonEditorTest method testSetY.
@Test
public void testSetY() {
final Polygon polygon = POLYGON;
final PolygonEditor polygonEditor = polygon.newGeometryEditor(3);
polygonEditor.setY(1, 1, 10);
final Polygon newPolygon = polygonEditor.newGeometry();
Assert.assertNotSame(polygon, newPolygon);
Assert.assertEquals(10.0, newPolygon.getY(1, 1), 0.0);
}
Aggregations