Search in sources :

Example 26 with Polygonal

use of com.revolsys.geometry.model.Polygonal 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 27 with Polygonal

use of com.revolsys.geometry.model.Polygonal 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 28 with Polygonal

use of com.revolsys.geometry.model.Polygonal 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 29 with Polygonal

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

the class RandomPointsBuilder method setExtent.

/**
 * Sets a polygonal mask.
 *
 * @param mask
 * @throws IllegalArgumentException if the mask is not polygonal
 */
public void setExtent(final Geometry mask) {
    if (!(mask instanceof Polygonal)) {
        throw new IllegalArgumentException("Only polygonal extents are supported");
    }
    this.maskPoly = mask;
    setExtent(mask.getBoundingBox());
    this.extentLocator = new IndexedPointInAreaLocator(mask);
}
Also used : IndexedPointInAreaLocator(com.revolsys.geometry.algorithm.locate.IndexedPointInAreaLocator) Polygonal(com.revolsys.geometry.model.Polygonal)

Example 30 with Polygonal

use of com.revolsys.geometry.model.Polygonal 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

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