Search in sources :

Example 6 with Punctual

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

the class MultiPointImplTest method testEquals.

/**
 * @todo Enable when #isSimple implemented
 */
// public void testIsSimple1() throws Exception {
// MultiPoint m = (MultiPoint)
// reader.read("MULTIPOINT(1.111 2.222, 3.333 4.444, 5.555 6.666)");
// assertTrue(m.isSimple());
// }
public void testEquals() throws Exception {
    final Punctual m1 = (Punctual) this.geometryFactory.geometry("MULTIPOINT((5 6), (7 8))");
    final Punctual m2 = (Punctual) this.geometryFactory.geometry("MULTIPOINT((5 6), (7 8))");
    assertTrue(m1.equals(m2));
}
Also used : Punctual(com.revolsys.geometry.model.Punctual)

Example 7 with Punctual

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

the class GeoJsonRecordWriter method geometry.

private void geometry(final Geometry geometry) {
    this.out.startObject();
    if (geometry instanceof Point) {
        final Point point = (Point) geometry;
        point(point);
    } else if (geometry instanceof LineString) {
        final LineString line = (LineString) geometry;
        line(line);
    } else if (geometry instanceof Polygon) {
        final Polygon polygon = (Polygon) geometry;
        polygon(polygon);
    } else if (geometry instanceof Punctual) {
        final Punctual punctual = (Punctual) geometry;
        multiPoint(punctual);
    } else if (geometry instanceof Lineal) {
        final Lineal lineal = (Lineal) geometry;
        multiLineString(lineal);
    } else if (geometry instanceof Polygonal) {
        final Polygonal polygonal = (Polygonal) geometry;
        multiPolygon(polygonal);
    } else if (geometry.isGeometryCollection()) {
        geometryCollection(geometry);
    }
    this.out.endObject();
}
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) Polygon(com.revolsys.geometry.model.Polygon)

Example 8 with Punctual

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

the class MultiPointEditorTest method testNotModified.

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

Example 9 with Punctual

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

the class MultiPointEditorTest method testSetX.

@Test
public void testSetX() {
    final PunctualEditor editor = PUNCTUAL.newGeometryEditor(3);
    editor.setX(0, 10);
    final Punctual newMultiPoint = editor.newGeometry();
    Assert.assertNotSame(PUNCTUAL, newMultiPoint);
    Assert.assertEquals(10.0, newMultiPoint.getX(0), 0.0);
}
Also used : Punctual(com.revolsys.geometry.model.Punctual) PunctualEditor(com.revolsys.geometry.model.editor.PunctualEditor) Test(org.junit.Test)

Example 10 with Punctual

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

the class MultiPointEditorTest method testSetCoordinates.

@Test
public void testSetCoordinates() {
    for (int i = 0; i < 4; i++) {
        final PunctualEditor editor = PUNCTUAL.newGeometryEditor(4);
        final int newValue = i * 10;
        editor.setCoordinate(0, i, newValue);
        final Punctual newMultiPoint = editor.newGeometry();
        Assert.assertNotSame(PUNCTUAL, newMultiPoint);
        Assert.assertEquals(newValue, newMultiPoint.getCoordinate(0, i), 0.0);
    }
}
Also used : Punctual(com.revolsys.geometry.model.Punctual) PunctualEditor(com.revolsys.geometry.model.editor.PunctualEditor) Test(org.junit.Test)

Aggregations

Punctual (com.revolsys.geometry.model.Punctual)31 Point (com.revolsys.geometry.model.Point)17 LineString (com.revolsys.geometry.model.LineString)11 Lineal (com.revolsys.geometry.model.Lineal)11 Polygon (com.revolsys.geometry.model.Polygon)11 Polygonal (com.revolsys.geometry.model.Polygonal)9 Geometry (com.revolsys.geometry.model.Geometry)8 Test (org.junit.Test)7 BoundingBox (com.revolsys.geometry.model.BoundingBox)6 LinearRing (com.revolsys.geometry.model.LinearRing)6 PunctualEditor (com.revolsys.geometry.model.editor.PunctualEditor)6 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)4 ArrayList (java.util.ArrayList)2 DataType (com.revolsys.datatype.DataType)1 Edge (com.revolsys.geometry.graph.Edge)1 LineStringDouble (com.revolsys.geometry.model.impl.LineStringDouble)1 PointDoubleXY (com.revolsys.geometry.model.impl.PointDoubleXY)1 LineSegment (com.revolsys.geometry.model.segment.LineSegment)1 LineSegmentDoubleGF (com.revolsys.geometry.model.segment.LineSegmentDoubleGF)1 BaseCloseable (com.revolsys.io.BaseCloseable)1