Search in sources :

Example 51 with LinearRing

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

the class RectangleXY method forEachGeometry.

@Override
public void forEachGeometry(final Consumer<Geometry> action) {
    final LinearRing ring = getRing(0);
    ring.forEachGeometry(action);
}
Also used : LinearRing(com.revolsys.geometry.model.LinearRing)

Example 52 with LinearRing

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

the class LinearRingDoubleGf method reverse.

@Override
public LinearRing reverse() {
    final int vertexCount = getVertexCount();
    final int axisCount = getAxisCount();
    final double[] coordinates = new double[vertexCount * axisCount];
    for (int vertexIndex = 0; vertexIndex < vertexCount; vertexIndex++) {
        for (int axisIndex = 0; axisIndex < axisCount; axisIndex++) {
            final int coordinateIndex = (vertexCount - 1 - vertexIndex) * axisCount + axisIndex;
            coordinates[coordinateIndex] = getCoordinate(vertexIndex, axisIndex);
        }
    }
    final GeometryFactory geometryFactory = getGeometryFactory();
    final LinearRing reverseLine = geometryFactory.linearRing(axisCount, coordinates);
    return reverseLine;
}
Also used : GeometryFactory(com.revolsys.geometry.model.GeometryFactory) LinearRing(com.revolsys.geometry.model.LinearRing)

Example 53 with LinearRing

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

the class MultiPolygonSegment method hasNext.

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

Example 54 with LinearRing

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

the class MultiPolygonSegment method next.

@Override
public Segment next() {
    this.segmentIndex++;
    final Polygonal polygonal = this.polygonal;
    final int geometryCount = polygonal.getGeometryCount();
    while (this.partIndex < geometryCount) {
        final Polygon polygon = getPolygon();
        final int ringCount = polygon.getRingCount();
        while (this.ringIndex < ringCount) {
            final LinearRing ring = polygon.getRing(this.ringIndex);
            if (this.segmentIndex < ring.getSegmentCount()) {
                return this;
            } else {
                this.ringIndex++;
                this.segmentIndex = 0;
            }
        }
        this.partIndex++;
        this.ringIndex = 0;
        this.segmentIndex = 0;
    }
    throw new NoSuchElementException();
}
Also used : Polygonal(com.revolsys.geometry.model.Polygonal) Polygon(com.revolsys.geometry.model.Polygon) LinearRing(com.revolsys.geometry.model.LinearRing) NoSuchElementException(java.util.NoSuchElementException)

Example 55 with LinearRing

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

the class PolygonSegment method hasNext.

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

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