use of com.revolsys.geometry.model.Polygon in project com.revolsys.open by revolsys.
the class PolygonEditorTest method testNotModified.
@Test
public void testNotModified() {
final Polygon polygon = POLYGON;
final PolygonEditor polygonEditor = polygon.newGeometryEditor();
try {
polygonEditor.setZ(new int[0], 13);
Assert.fail("Invalid index should cause exception");
} catch (final Exception e) {
}
}
use of com.revolsys.geometry.model.Polygon in project com.revolsys.open by revolsys.
the class MiscellaneousTest method testPolygonGetCoordinates.
// public void testGeometryCollectionIsSimple1() throws Exception {
// Geometry g = reader.read("GEOMETRYCOLLECTION("
// + "LINESTRING(0 0, 100 0),"
// + "LINESTRING(0 10, 100 10))");
// assertTrue(g.isSimple());
// }
// public void testGeometryCollectionIsSimple2() throws Exception {
// Geometry g = reader.read("GEOMETRYCOLLECTION("
// + "LINESTRING(0 0, 100 0),"
// + "LINESTRING(50 0, 100 10))");
// assertTrue(! g.isSimple());
// }
/**
* @todo Enable when #isSimple implemented
*/
// public void testMultiLineStringIsSimple1() throws Exception {
// Geometry g = reader.read("MULTILINESTRING("
// + "(0 0, 100 0),"
// + "(0 10, 100 10))");
// assertTrue(g.isSimple());
// }
public void testPolygonGetCoordinates() throws Exception {
final Polygon p = (Polygon) this.geometryFactory.geometry("POLYGON ( (0 0, 100 0, 100 100, 0 100, 0 0), " + " (20 20, 20 80, 80 80, 80 20, 20 20)) ");
assertEquals(10, p.getVertexCount());
}
use of com.revolsys.geometry.model.Polygon in project com.revolsys.open by revolsys.
the class MiscellaneousTest method testEmptyPolygon.
public void testEmptyPolygon() throws Exception {
final Polygon p = this.geometryFactory.polygon();
assertEquals(2, p.getDimension());
assertEquals(BoundingBox.empty(), p.getBoundingBox());
assertTrue(p.isSimple());
}
use of com.revolsys.geometry.model.Polygon in project com.revolsys.open by revolsys.
the class ValidClosedRingTest method testGoodPolygon.
public void testGoodPolygon() {
final Polygon poly = (Polygon) fromWKT("POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0))");
checkIsValid(poly, true);
}
use of com.revolsys.geometry.model.Polygon in project com.revolsys.open by revolsys.
the class GeometryFactoryTest method testCreateGeometry.
private static void testCreateGeometry() {
final LineString pointPoints = new LineStringDouble(2, 0.0, 0);
final LineString point2Points = new LineStringDouble(2, 20.0, 20);
final LineString ringPoints = new LineStringDouble(2, 0.0, 0, 0, 100, 100, 100, 100, 0, 0, 0);
final LineString ring2Points = new LineStringDouble(2, 20.0, 20, 20, 80, 80, 80, 80, 20, 20, 20);
final LineString ring3Points = new LineStringDouble(2, 120.0, 120, 120, 180, 180, 180, 180, 120, 120, 120);
final Point point = GEOMETRY_FACTORY.point(2, 0.0, 0);
assertCopyGeometry(point, pointPoints);
final LineString line = GEOMETRY_FACTORY.lineString(ringPoints);
assertCopyGeometry(line, ringPoints);
final LinearRing linearRing = GEOMETRY_FACTORY.linearRing(ringPoints);
assertCopyGeometry(linearRing, ringPoints);
final Polygon polygon = GEOMETRY_FACTORY.polygon(ringPoints);
assertCopyGeometry(polygon, ringPoints);
final Polygon polygon2 = GEOMETRY_FACTORY.polygon(ringPoints, ring2Points);
assertCopyGeometry(polygon2, ringPoints, ring2Points);
final Punctual multiPoint = GEOMETRY_FACTORY.punctual(pointPoints);
assertCopyGeometry(multiPoint, pointPoints);
final Punctual multiPoint2 = GEOMETRY_FACTORY.punctual(pointPoints, point2Points);
assertCopyGeometry(multiPoint2, pointPoints, point2Points);
final Lineal multiLineString = GEOMETRY_FACTORY.lineal(ringPoints);
assertCopyGeometry(multiLineString, ringPoints);
final Lineal multiLineString2 = GEOMETRY_FACTORY.lineal(ringPoints, ring2Points);
assertCopyGeometry(multiLineString2, ringPoints, ring2Points);
final Polygonal multiPolygon = GEOMETRY_FACTORY.polygonal(ringPoints);
assertCopyGeometry(multiPolygon, ringPoints);
final Polygonal multiPolygon2 = GEOMETRY_FACTORY.polygonal(ringPoints, ring3Points);
assertCopyGeometry(multiPolygon2, ringPoints, ring3Points);
}
Aggregations