Search in sources :

Example 1 with EdgeIntersectionList

use of com.revolsys.geometry.geomgraph.EdgeIntersectionList in project com.revolsys.open by revolsys.

the class IsValidOp method checkNoSelfIntersectingRings.

/**
 * Check that there is no ring which self-intersects (except of course at its endpoints).
 * This is required by OGC topology rules (but not by other models
 * such as ESRI SDE, which allow inverted shells and exverted holes).
 *
 * @param graph the topology graph of the geometry
 */
private boolean checkNoSelfIntersectingRings(final GeometryGraph graph) {
    boolean valid = true;
    for (final Edge edge : graph.edges()) {
        final EdgeIntersectionList edgeIntersectionList = edge.getEdgeIntersectionList();
        valid &= checkNoSelfIntersectingRing(edgeIntersectionList);
        if (isErrorReturn()) {
            return false;
        }
    }
    return valid;
}
Also used : EdgeIntersectionList(com.revolsys.geometry.geomgraph.EdgeIntersectionList) Edge(com.revolsys.geometry.geomgraph.Edge)

Example 2 with EdgeIntersectionList

use of com.revolsys.geometry.geomgraph.EdgeIntersectionList in project com.revolsys.open by revolsys.

the class IsValidOp method findPtNotNode.

/**
 * Find a point from the list of testCoords
 * that is NOT a node in the edge for the list of searchCoords
 *
 * @return the point found, or <code>null</code> if none found
 */
public static Point findPtNotNode(final LineString testLine, final LinearRing searchRing, final GeometryGraph graph) {
    // find edge corresponding to searchRing.
    final Edge searchEdge = graph.findEdge(searchRing);
    // find a point in the testCoords which is not a node of the searchRing
    final EdgeIntersectionList eiList = searchEdge.getEdgeIntersectionList();
    // somewhat inefficient - is there a better way? (Use a node map, for
    // instance?)
    final int vertexCount = testLine.getVertexCount();
    for (int vertexIndex = 0; vertexIndex < vertexCount; vertexIndex++) {
        final double x = testLine.getX(vertexIndex);
        final double y = testLine.getY(vertexIndex);
        if (!eiList.isIntersection(x, y)) {
            return new PointDoubleXY(x, y);
        }
    }
    return null;
}
Also used : EdgeIntersectionList(com.revolsys.geometry.geomgraph.EdgeIntersectionList) PointDoubleXY(com.revolsys.geometry.model.impl.PointDoubleXY) Edge(com.revolsys.geometry.geomgraph.Edge) Point(com.revolsys.geometry.model.Point)

Example 3 with EdgeIntersectionList

use of com.revolsys.geometry.geomgraph.EdgeIntersectionList in project com.revolsys.open by revolsys.

the class EdgeEndBuilder method computeEdgeEnds.

/**
 * Creates stub edges for all the intersections in this
 * Edge (if any) and inserts them into the graph.
 */
public void computeEdgeEnds(final Edge edge, final List<EdgeEnd> l) {
    final EdgeIntersectionList eiList = edge.getEdgeIntersectionList();
    // Debug.print(eiList);
    // ensure that the list has entries for the first and last point of the edge
    eiList.addEndpoints();
    final Iterator<EdgeIntersection> it = eiList.iterator();
    EdgeIntersection eiPrev = null;
    EdgeIntersection eiCurr = null;
    // no intersections, so there is nothing to do
    if (!it.hasNext()) {
        return;
    }
    EdgeIntersection eiNext = it.next();
    do {
        eiPrev = eiCurr;
        eiCurr = eiNext;
        eiNext = null;
        if (it.hasNext()) {
            eiNext = it.next();
        }
        if (eiCurr != null) {
            newEdgeEndForPrev(edge, l, eiCurr, eiPrev);
            newEdgeEndForNext(edge, l, eiCurr, eiNext);
        }
    } while (eiCurr != null);
}
Also used : EdgeIntersectionList(com.revolsys.geometry.geomgraph.EdgeIntersectionList) EdgeIntersection(com.revolsys.geometry.geomgraph.EdgeIntersection)

Aggregations

EdgeIntersectionList (com.revolsys.geometry.geomgraph.EdgeIntersectionList)3 Edge (com.revolsys.geometry.geomgraph.Edge)2 EdgeIntersection (com.revolsys.geometry.geomgraph.EdgeIntersection)1 Point (com.revolsys.geometry.model.Point)1 PointDoubleXY (com.revolsys.geometry.model.impl.PointDoubleXY)1