Search in sources :

Example 11 with Polygon

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

the class MultiPolygonVertex method getX.

@Override
public double getX() {
    final Polygon polygon = getPolygon();
    final LinearRing ring = polygon.getRing(this.ringIndex);
    if (ring == null) {
        return java.lang.Double.NaN;
    } else {
        return ring.getX(this.vertexIndex);
    }
}
Also used : Polygon(com.revolsys.geometry.model.Polygon) LinearRing(com.revolsys.geometry.model.LinearRing)

Example 12 with Polygon

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

the class PolygonVertex method hasNext.

@Override
public boolean hasNext() {
    if (getGeometry().isEmpty()) {
        return false;
    } else {
        final Polygon polygon = getPolygon();
        int ringIndex = this.ringIndex;
        int vertexIndex = this.vertexIndex;
        while (ringIndex < polygon.getRingCount()) {
            final LinearRing ring = polygon.getRing(ringIndex);
            if (vertexIndex + 1 < ring.getVertexCount()) {
                return true;
            } else {
                ringIndex++;
                vertexIndex = 0;
            }
        }
        return false;
    }
}
Also used : Polygon(com.revolsys.geometry.model.Polygon) LinearRing(com.revolsys.geometry.model.LinearRing)

Example 13 with Polygon

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

the class PolygonVertex method getY.

@Override
public double getY() {
    final Polygon polygon = getPolygon();
    final LinearRing ring = polygon.getRing(this.ringIndex);
    if (ring == null) {
        return java.lang.Double.NaN;
    } else {
        return ring.getY(this.vertexIndex);
    }
}
Also used : Polygon(com.revolsys.geometry.model.Polygon) LinearRing(com.revolsys.geometry.model.LinearRing)

Example 14 with Polygon

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

the class PolygonVertex method getX.

@Override
public double getX() {
    final Polygon polygon = getPolygon();
    final LinearRing ring = polygon.getRing(this.ringIndex);
    if (ring == null) {
        return java.lang.Double.NaN;
    } else {
        return ring.getX(this.vertexIndex);
    }
}
Also used : Polygon(com.revolsys.geometry.model.Polygon) LinearRing(com.revolsys.geometry.model.LinearRing)

Example 15 with Polygon

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

the class PolygonVertex method next.

@Override
public Vertex next() {
    final Polygon polygon = getPolygon();
    this.vertexIndex++;
    while (this.ringIndex < polygon.getRingCount()) {
        final LinearRing ring = polygon.getRing(this.ringIndex);
        if (this.vertexIndex < ring.getVertexCount()) {
            return this;
        } else {
            this.ringIndex++;
            this.vertexIndex = 0;
        }
    }
    throw new NoSuchElementException();
}
Also used : Polygon(com.revolsys.geometry.model.Polygon) LinearRing(com.revolsys.geometry.model.LinearRing) NoSuchElementException(java.util.NoSuchElementException)

Aggregations

Polygon (com.revolsys.geometry.model.Polygon)147 Point (com.revolsys.geometry.model.Point)66 LinearRing (com.revolsys.geometry.model.LinearRing)54 LineString (com.revolsys.geometry.model.LineString)39 Geometry (com.revolsys.geometry.model.Geometry)34 ArrayList (java.util.ArrayList)30 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)22 Polygonal (com.revolsys.geometry.model.Polygonal)17 BoundingBox (com.revolsys.geometry.model.BoundingBox)14 Punctual (com.revolsys.geometry.model.Punctual)12 Test (org.junit.Test)12 Lineal (com.revolsys.geometry.model.Lineal)11 BaseCloseable (com.revolsys.io.BaseCloseable)7 List (java.util.List)7 PolygonEditor (com.revolsys.geometry.model.editor.PolygonEditor)6 PointDoubleXY (com.revolsys.geometry.model.impl.PointDoubleXY)6 Vertex (com.revolsys.geometry.model.vertex.Vertex)6 CoordinateSystem (com.revolsys.geometry.cs.CoordinateSystem)3 ProjectedCoordinateSystem (com.revolsys.geometry.cs.ProjectedCoordinateSystem)3 Graphics2D (java.awt.Graphics2D)3