Search in sources :

Example 26 with LineString

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

the class MultiLineStringVertex method getLineCoordinateRelative.

@Override
public double getLineCoordinateRelative(final int vertexOffset, final int axisIndex) {
    if (isEmpty()) {
        return java.lang.Double.NaN;
    } else {
        final int vertexIndex = getVertexIndex();
        final LineString line = getLineString();
        return line.getCoordinate(vertexIndex + vertexOffset, axisIndex);
    }
}
Also used : LineString(com.revolsys.geometry.model.LineString)

Example 27 with LineString

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

the class MultiLineStringVertex method hasNext.

@Override
public boolean hasNext() {
    if (getGeometry().isEmpty()) {
        return false;
    } else {
        final Lineal lineal = getLineal();
        int partIndex = this.partIndex;
        int vertexIndex = this.vertexIndex + 1;
        while (partIndex < lineal.getGeometryCount()) {
            final LineString lineString = lineal.getLineString(partIndex);
            if (vertexIndex < lineString.getVertexCount()) {
                return true;
            } else {
                partIndex++;
                vertexIndex = 0;
            }
        }
        return false;
    }
}
Also used : Lineal(com.revolsys.geometry.model.Lineal) LineString(com.revolsys.geometry.model.LineString)

Example 28 with LineString

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

the class PolygonVertex method getLineNext.

@Override
public Vertex getLineNext() {
    final LineString ring = getRing();
    if (ring != null) {
        int newVertexIndex = this.vertexIndex + 1;
        final int vertexCount = ring.getVertexCount();
        if (newVertexIndex == vertexCount - 1) {
            newVertexIndex = 1;
        } else if (newVertexIndex < vertexCount - 1) {
            return new PolygonVertex(getPolygon(), this.ringIndex, newVertexIndex);
        }
    }
    return null;
}
Also used : LineString(com.revolsys.geometry.model.LineString)

Example 29 with LineString

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

the class GeometryTransformer method transformMultiLineString.

protected Lineal transformMultiLineString(final Lineal lineal) {
    boolean updated = false;
    final List<LineString> newLines = new ArrayList<>();
    for (final LineString line : lineal.lineStrings()) {
        final LineString newLine = transformLineString(line);
        if (newLine == null || newLine.isEmpty()) {
            updated = true;
        } else {
            newLines.add(newLine);
            if (newLine != line) {
                updated = true;
            }
        }
    }
    if (updated) {
        return lineal;
    } else {
        return this.factory.lineal(newLines);
    }
}
Also used : LineString(com.revolsys.geometry.model.LineString) ArrayList(java.util.ArrayList)

Example 30 with LineString

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

the class PlanarPolygon3D method locate.

private Location locate(final Point pt, final LineString ring) {
    final LineString seq = ring;
    final LineString seqProj = project(seq, this.facingPlane);
    final Point ptProj = project(pt, this.facingPlane);
    return RayCrossingCounter.locatePointInRing(ptProj, seqProj);
}
Also used : LineString(com.revolsys.geometry.model.LineString) Point(com.revolsys.geometry.model.Point)

Aggregations

LineString (com.revolsys.geometry.model.LineString)380 Point (com.revolsys.geometry.model.Point)184 Geometry (com.revolsys.geometry.model.Geometry)65 ArrayList (java.util.ArrayList)62 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)51 Polygon (com.revolsys.geometry.model.Polygon)37 LineStringGraph (com.revolsys.geometry.graph.linestring.LineStringGraph)24 Edge (com.revolsys.geometry.graph.Edge)22 List (java.util.List)22 BoundingBox (com.revolsys.geometry.model.BoundingBox)20 Lineal (com.revolsys.geometry.model.Lineal)20 Test (org.junit.Test)20 LinearRing (com.revolsys.geometry.model.LinearRing)19 Record (com.revolsys.record.Record)17 Iterator (java.util.Iterator)14 LineStringEditor (com.revolsys.geometry.model.editor.LineStringEditor)13 Punctual (com.revolsys.geometry.model.Punctual)12 LineStringDouble (com.revolsys.geometry.model.impl.LineStringDouble)12 LineSegment (com.revolsys.geometry.model.segment.LineSegment)10 Polygonal (com.revolsys.geometry.model.Polygonal)9