Search in sources :

Example 21 with Lineal

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

the class MultiLineStringEditorTest method testSetY.

@Test
public void testSetY() {
    final LinealEditor editor = LINEAL.newGeometryEditor(3);
    editor.setY(1, 1, 10);
    final Lineal newGeometry = editor.newGeometry();
    Assert.assertNotSame(LINEAL, newGeometry);
    Assert.assertEquals(10.0, newGeometry.getY(1, 1), 0.0);
}
Also used : LinealEditor(com.revolsys.geometry.model.editor.LinealEditor) Lineal(com.revolsys.geometry.model.Lineal) Test(org.junit.Test)

Example 22 with Lineal

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

the class MultiLineStringEditorTest method testNotModified.

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

Example 23 with Lineal

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

the class MultiLineStringEditorTest method testSetCoordinates.

@Test
public void testSetCoordinates() {
    for (int i = 0; i < 4; i++) {
        final LinealEditor editor = LINEAL.newGeometryEditor(4);
        final double newValue = LINEAL.getCoordinate(1, 1, i);
        editor.setCoordinate(1, 1, i, newValue);
        final Lineal newGeometry = editor.newGeometry();
        Assert.assertNotSame(LINEAL, newGeometry);
        Assert.assertEquals(newValue, newGeometry.getCoordinate(1, 1, i), 0.0);
    }
}
Also used : LinealEditor(com.revolsys.geometry.model.editor.LinealEditor) Lineal(com.revolsys.geometry.model.Lineal) Test(org.junit.Test)

Example 24 with Lineal

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

the class MultiLineStringEditorTest method testSetZ.

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

Example 25 with Lineal

use of com.revolsys.geometry.model.Lineal 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);
}
Also used : Punctual(com.revolsys.geometry.model.Punctual) Lineal(com.revolsys.geometry.model.Lineal) LineString(com.revolsys.geometry.model.LineString) Polygonal(com.revolsys.geometry.model.Polygonal) Point(com.revolsys.geometry.model.Point) LinearRing(com.revolsys.geometry.model.LinearRing) Polygon(com.revolsys.geometry.model.Polygon) LineStringDouble(com.revolsys.geometry.model.impl.LineStringDouble)

Aggregations

Lineal (com.revolsys.geometry.model.Lineal)38 LineString (com.revolsys.geometry.model.LineString)20 Point (com.revolsys.geometry.model.Point)19 Polygon (com.revolsys.geometry.model.Polygon)11 Punctual (com.revolsys.geometry.model.Punctual)11 Polygonal (com.revolsys.geometry.model.Polygonal)9 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)8 LinearRing (com.revolsys.geometry.model.LinearRing)7 Test (org.junit.Test)7 LinealEditor (com.revolsys.geometry.model.editor.LinealEditor)6 BoundingBox (com.revolsys.geometry.model.BoundingBox)5 Geometry (com.revolsys.geometry.model.Geometry)5 ArrayList (java.util.ArrayList)4 QuadEdgeDelaunayTinBuilder (com.revolsys.elevation.tin.quadedge.QuadEdgeDelaunayTinBuilder)2 Edge (com.revolsys.geometry.graph.Edge)2 AbstractLineString (com.revolsys.geometry.model.impl.AbstractLineString)2 LinkedList (java.util.LinkedList)2 List (java.util.List)2 NoSuchElementException (java.util.NoSuchElementException)2 DataType (com.revolsys.datatype.DataType)1