Search in sources :

Example 36 with Polygonal

use of com.revolsys.geometry.model.Polygonal in project com.revolsys.open by revolsys.

the class NormalizeTest method testNormalizeMultiPolygon.

public void testNormalizeMultiPolygon() throws Exception {
    Polygonal actualValue = (Polygonal) this.geometryFactory.geometry("MULTIPOLYGON(((40 360,40 280,140 280,140 360,40 360),(60 340,60 300,120 300,120 340,60 340)),((140 200,260 200,260 100,140 100,140 200),(160 180,240 180,240 120,160 120,160 180)))");
    actualValue = actualValue.normalize();
    final Polygonal expectedValue = (Polygonal) this.geometryFactory.geometry("MULTIPOLYGON(((40 280,40 360,140 360,140 280,40 280),(60 300,120 300,120 340,60 340,60 300)),((140 100,140 200,260 200,260 100,140 100),(160 120,240 120,240 180,160 180,160 120)))");
    assertEqualsExact(expectedValue, actualValue);
}
Also used : Polygonal(com.revolsys.geometry.model.Polygonal)

Example 37 with Polygonal

use of com.revolsys.geometry.model.Polygonal in project com.revolsys.open by revolsys.

the class GeometryTestUtil method multiPolygon.

public static Polygonal multiPolygon(final GeometryFactory geometryFactory, final int geometryCount, final int ringCount, final double delta) {
    final List<Geometry> geometries = new ArrayList<>();
    for (int i = 0; i < geometryCount; i++) {
        final Geometry geometry = polygon(geometryFactory, ringCount, delta * (i + 1));
        geometries.add(geometry);
    }
    final Polygonal multiGeometry = geometryFactory.polygonal(geometries);
    return multiGeometry;
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) Polygonal(com.revolsys.geometry.model.Polygonal) ArrayList(java.util.ArrayList) Point(com.revolsys.geometry.model.Point)

Example 38 with Polygonal

use of com.revolsys.geometry.model.Polygonal in project com.revolsys.open by revolsys.

the class MultiPolygonEditorTest method testSetZ.

@Test
public void testSetZ() {
    final PolygonalEditor editor = POLYGONAL.newGeometryEditor(3);
    editor.setZ(1, 1, 1, 10);
    final Polygonal newGeometry = editor.newGeometry();
    Assert.assertNotSame(POLYGONAL, newGeometry);
    Assert.assertEquals(10.0, newGeometry.getZ(1, 1, 1), 0.0);
}
Also used : PolygonalEditor(com.revolsys.geometry.model.editor.PolygonalEditor) Polygonal(com.revolsys.geometry.model.Polygonal) Test(org.junit.Test)

Example 39 with Polygonal

use of com.revolsys.geometry.model.Polygonal in project com.revolsys.open by revolsys.

the class MultiPolygonEditorTest method testSetX.

@Test
public void testSetX() {
    final PolygonalEditor editor = POLYGONAL.newGeometryEditor(3);
    editor.setX(1, 1, 1, 10);
    final Polygonal newGeometry = editor.newGeometry();
    Assert.assertNotSame(POLYGONAL, newGeometry);
    Assert.assertEquals(10.0, newGeometry.getX(1, 1, 1), 0.0);
}
Also used : PolygonalEditor(com.revolsys.geometry.model.editor.PolygonalEditor) Polygonal(com.revolsys.geometry.model.Polygonal) Test(org.junit.Test)

Example 40 with Polygonal

use of com.revolsys.geometry.model.Polygonal in project com.revolsys.open by revolsys.

the class MultiPolygonEditorTest method testNotModified.

@Test
public void testNotModified() {
    final PolygonalEditor editor = POLYGONAL.newGeometryEditor();
    editor.setZ(new int[0], 13);
    final Polygonal newGeometry = editor.newGeometry();
    Assert.assertSame(POLYGONAL, newGeometry);
}
Also used : PolygonalEditor(com.revolsys.geometry.model.editor.PolygonalEditor) Polygonal(com.revolsys.geometry.model.Polygonal) Test(org.junit.Test)

Aggregations

Polygonal (com.revolsys.geometry.model.Polygonal)41 Polygon (com.revolsys.geometry.model.Polygon)17 LinearRing (com.revolsys.geometry.model.LinearRing)12 Point (com.revolsys.geometry.model.Point)12 LineString (com.revolsys.geometry.model.LineString)9 Lineal (com.revolsys.geometry.model.Lineal)9 Punctual (com.revolsys.geometry.model.Punctual)9 Geometry (com.revolsys.geometry.model.Geometry)8 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)7 PolygonalEditor (com.revolsys.geometry.model.editor.PolygonalEditor)6 Test (org.junit.Test)6 ArrayList (java.util.ArrayList)4 QuadEdgeDelaunayTinBuilder (com.revolsys.elevation.tin.quadedge.QuadEdgeDelaunayTinBuilder)3 BoundingBox (com.revolsys.geometry.model.BoundingBox)2 PathName (com.revolsys.io.PathName)2 Record (com.revolsys.record.Record)2 NoSuchElementException (java.util.NoSuchElementException)2 LocateFailureException (com.revolsys.elevation.tin.quadedge.LocateFailureException)1 QuadEdgeConformingDelaunayTinBuilder (com.revolsys.elevation.tin.quadedge.QuadEdgeConformingDelaunayTinBuilder)1 IndexedPointInAreaLocator (com.revolsys.geometry.algorithm.locate.IndexedPointInAreaLocator)1