Search in sources :

Example 11 with LinearRing

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

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

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

Example 14 with LinearRing

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

the class PolygonVertex method getCoordinate.

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

Example 15 with LinearRing

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

the class EdgeRing method getPolygon.

/**
 * Computes the {@link Polygon} formed by this ring and any contained holes.
 *
 * @return the {@link Polygon} formed by this ring and its holes.
 */
public Polygon getPolygon() {
    final List<LinearRing> rings = new ArrayList<>();
    rings.add(this.ring);
    if (this.holes != null) {
        rings.addAll(this.holes);
    }
    final Polygon poly = this.factory.polygon(rings);
    return poly;
}
Also used : ArrayList(java.util.ArrayList) LinearRing(com.revolsys.geometry.model.LinearRing) Polygon(com.revolsys.geometry.model.Polygon)

Aggregations

LinearRing (com.revolsys.geometry.model.LinearRing)95 Polygon (com.revolsys.geometry.model.Polygon)53 Point (com.revolsys.geometry.model.Point)44 ArrayList (java.util.ArrayList)21 LineString (com.revolsys.geometry.model.LineString)19 Geometry (com.revolsys.geometry.model.Geometry)14 Polygonal (com.revolsys.geometry.model.Polygonal)11 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)9 BoundingBox (com.revolsys.geometry.model.BoundingBox)8 Lineal (com.revolsys.geometry.model.Lineal)7 Punctual (com.revolsys.geometry.model.Punctual)6 List (java.util.List)4 NoSuchElementException (java.util.NoSuchElementException)4 IOException (java.io.IOException)3 MCPointInRing (com.revolsys.geometry.algorithm.MCPointInRing)2 PointDoubleXY (com.revolsys.geometry.model.impl.PointDoubleXY)2 Vertex (com.revolsys.geometry.model.vertex.Vertex)2 BigDecimal (java.math.BigDecimal)2 PointInRing (com.revolsys.geometry.algorithm.PointInRing)1 EdgeRing (com.revolsys.geometry.geomgraph.EdgeRing)1