Search in sources :

Example 21 with Punctual

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

the class EWktWriter method write.

private static void write(final Writer out, final Geometry geometry, final int axisCount) throws IOException {
    if (geometry != null) {
        if (geometry instanceof Point) {
            final Point point = (Point) geometry;
            write(out, point, axisCount);
        } else if (geometry instanceof Punctual) {
            final Punctual punctual = (Punctual) geometry;
            write(out, punctual, axisCount);
        } else if (geometry instanceof LinearRing) {
            final LinearRing line = (LinearRing) geometry;
            write(out, line, axisCount);
        } else if (geometry instanceof LineString) {
            final LineString line = (LineString) geometry;
            write(out, line, axisCount);
        } else if (geometry instanceof Lineal) {
            final Lineal lineal = (Lineal) geometry;
            write(out, lineal, axisCount);
        } else if (geometry instanceof Polygon) {
            final Polygon polygon = (Polygon) geometry;
            write(out, polygon, axisCount);
        } else if (geometry instanceof Polygonal) {
            final Polygonal polygonal = (Polygonal) geometry;
            write(out, polygonal, axisCount);
        } else if (geometry.isGeometryCollection()) {
            writeGeometryCollection(out, geometry, axisCount);
        } else {
            throw new IllegalArgumentException("Unknown geometry type" + geometry.getClass());
        }
    }
}
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)

Example 22 with Punctual

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

the class WktWriter method write.

public static void write(final Writer out, final Geometry geometry) {
    if (geometry != null) {
        if (geometry instanceof Point) {
            final Point point = (Point) geometry;
            write(out, point);
        } else if (geometry instanceof Punctual) {
            final Punctual punctual = (Punctual) geometry;
            write(out, punctual);
        } else if (geometry instanceof LinearRing) {
            final LinearRing line = (LinearRing) geometry;
            write(out, line);
        } else if (geometry instanceof LineString) {
            final LineString line = (LineString) geometry;
            write(out, line);
        } else if (geometry instanceof Lineal) {
            final Lineal lineal = (Lineal) geometry;
            write(out, lineal);
        } else if (geometry instanceof Polygon) {
            final Polygon polygon = (Polygon) geometry;
            write(out, polygon);
        } else if (geometry instanceof Polygonal) {
            final Polygonal polygonal = (Polygonal) geometry;
            write(out, polygonal);
        } else if (geometry.isGeometryCollection()) {
            writeGeometryCollection(out, geometry);
        } else {
            throw new IllegalArgumentException("Unknown geometry type" + geometry.getClass());
        }
    }
}
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)

Example 23 with Punctual

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

the class WktWriter method write.

public static void write(final Writer out, final Geometry geometry, final int axisCount) {
    try {
        if (geometry != null) {
            if (geometry instanceof Point) {
                final Point point = (Point) geometry;
                write(out, point, axisCount);
            } else if (geometry instanceof Punctual) {
                final Punctual punctual = (Punctual) geometry;
                write(out, punctual, axisCount);
            } else if (geometry instanceof LinearRing) {
                final LinearRing line = (LinearRing) geometry;
                write(out, line, axisCount);
            } else if (geometry instanceof LineString) {
                final LineString line = (LineString) geometry;
                write(out, line, axisCount);
            } else if (geometry instanceof Lineal) {
                final Lineal lineal = (Lineal) geometry;
                write(out, lineal, axisCount);
            } else if (geometry instanceof Polygon) {
                final Polygon polygon = (Polygon) geometry;
                write(out, polygon, axisCount);
            } else if (geometry instanceof Polygonal) {
                final Polygonal polygonal = (Polygonal) geometry;
                write(out, polygonal, axisCount);
            } else if (geometry.isGeometryCollection()) {
                writeGeometryCollection(out, geometry, axisCount);
            } else {
                throw new IllegalArgumentException("Unknown geometry type" + geometry.getClass());
            }
        }
    } catch (final IOException e) {
        throw Exceptions.wrap(e);
    }
}
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) IOException(java.io.IOException) LinearRing(com.revolsys.geometry.model.LinearRing) Polygon(com.revolsys.geometry.model.Polygon)

Example 24 with Punctual

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

the class TextOnCurveConverter method write.

@Override
public void write(final OsnSerializer serializer, final Object object) throws IOException {
    if (object instanceof Punctual) {
        final Punctual punctual = (Punctual) object;
        serializer.startObject(SaifConstants.TEXT_ON_CURVE);
        serializer.fieldName("characters");
        serializer.startCollection("List");
        final OsnConverter osnConverter = this.converters.getConverter(SaifConstants.TEXT_LINE);
        for (final Point point : punctual.points()) {
            osnConverter.write(serializer, point);
        }
        serializer.endCollection();
        serializer.endAttribute();
        serializer.endObject();
    }
}
Also used : Punctual(com.revolsys.geometry.model.Punctual) TextLinePoint(com.revolsys.record.io.format.saif.geometry.TextLinePoint) Point(com.revolsys.geometry.model.Point)

Example 25 with Punctual

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

the class PostgreSQLGeometryWrapper method writeGeometry.

private static void writeGeometry(final PrintWriter out, final Geometry geometry, final int axisCount) {
    if (geometry != null) {
        if (geometry instanceof Point) {
            final Point point = (Point) geometry;
            writePoint(out, point, axisCount);
        } else if (geometry instanceof Punctual) {
            final Punctual punctual = (Punctual) geometry;
            writeMultiPoint(out, punctual, axisCount);
        } else if (geometry instanceof LinearRing) {
            final LinearRing line = (LinearRing) geometry;
            writeLinearRing(out, line, axisCount);
        } else if (geometry instanceof LineString) {
            final LineString line = (LineString) geometry;
            writeLineString(out, line, axisCount);
        } else if (geometry instanceof Lineal) {
            final Lineal lineal = (Lineal) geometry;
            writeMultiLineString(out, lineal, axisCount);
        } else if (geometry instanceof Polygon) {
            final Polygon polygon = (Polygon) geometry;
            writePolygon(out, polygon, axisCount);
        } else if (geometry instanceof Polygonal) {
            final Polygonal polygonal = (Polygonal) geometry;
            writeMultiPolygon(out, polygonal, axisCount);
        } else if (geometry.isGeometryCollection()) {
            writeGeometryCollection(out, geometry, axisCount);
        } else {
            throw new IllegalArgumentException("Unknown geometry type" + geometry.getClass());
        }
    }
}
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)

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