Search in sources :

Example 6 with DirectedEdge

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

the class MaximalEdgeRing method linkDirectedEdgesForMinimalEdgeRings.

/**
 * For all nodes in this EdgeRing,
 * link the DirectedEdges at the node to form minimalEdgeRings
 */
public void linkDirectedEdgesForMinimalEdgeRings() {
    DirectedEdge de = this.startDe;
    do {
        final Node node = de.getNode();
        ((DirectedEdgeStar) node.getEdges()).linkMinimalDirectedEdges(this);
        de = de.getNext();
    } while (de != this.startDe);
}
Also used : DirectedEdge(com.revolsys.geometry.geomgraph.DirectedEdge) DirectedEdgeStar(com.revolsys.geometry.geomgraph.DirectedEdgeStar) Node(com.revolsys.geometry.geomgraph.Node)

Example 7 with DirectedEdge

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

the class MaximalEdgeRing method buildMinimalRings.

public List<MinimalEdgeRing> buildMinimalRings() {
    final List<MinimalEdgeRing> minEdgeRings = new ArrayList<>();
    DirectedEdge de = this.startDe;
    do {
        if (de.getMinEdgeRing() == null) {
            final MinimalEdgeRing minEr = new MinimalEdgeRing(de, this.geometryFactory);
            minEdgeRings.add(minEr);
        }
        de = de.getNext();
    } while (de != this.startDe);
    return minEdgeRings;
}
Also used : DirectedEdge(com.revolsys.geometry.geomgraph.DirectedEdge) ArrayList(java.util.ArrayList)

Example 8 with DirectedEdge

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

the class PolygonBuilder method buildMaximalEdgeRings.

/**
 * for all DirectedEdges in result, form them into MaximalEdgeRings
 */
private List<MaximalEdgeRing> buildMaximalEdgeRings(final Collection<DirectedEdge> dirEdges) {
    final List<MaximalEdgeRing> maxEdgeRings = new ArrayList<>();
    for (final DirectedEdge de : dirEdges) {
        if (de.isInResult() && de.getLabel().isArea()) {
            // if this edge has not yet been processed
            if (de.getEdgeRing() == null) {
                final MaximalEdgeRing er = new MaximalEdgeRing(de, this.geometryFactory);
                maxEdgeRings.add(er);
                er.setInResult();
            }
        }
    }
    return maxEdgeRings;
}
Also used : DirectedEdge(com.revolsys.geometry.geomgraph.DirectedEdge) ArrayList(java.util.ArrayList)

Example 9 with DirectedEdge

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

the class ConnectedInteriorTester method visitLinkedDirectedEdges.

protected void visitLinkedDirectedEdges(final DirectedEdge start) {
    final DirectedEdge startDe = start;
    DirectedEdge de = start;
    do {
        Assert.isTrue(de != null, "found null Directed Edge");
        de.setVisited(true);
        de = de.getNext();
    } while (de != startDe);
}
Also used : DirectedEdge(com.revolsys.geometry.geomgraph.DirectedEdge)

Example 10 with DirectedEdge

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

the class ConnectedInteriorTester method visitInteriorRing.

private void visitInteriorRing(final LineString ring, final PlanarGraph graph) {
    final Point pt0 = ring.getVertex(0).newPoint2D();
    /**
     * Find first point in coord list different to initial point.
     * Need special check since the first point may be repeated.
     */
    final Point pt1 = findDifferentPoint(ring, pt0);
    final Edge e = graph.findEdgeInSameDirection(pt0, pt1);
    final DirectedEdge de = (DirectedEdge) graph.findEdgeEnd(e);
    if (de != null) {
        DirectedEdge intDe = null;
        final Label label = de.getLabel();
        if (label.getLocation(0, Position.RIGHT) == Location.INTERIOR) {
            intDe = de;
        } else if (de.getSym().getLabel().getLocation(0, Position.RIGHT) == Location.INTERIOR) {
            intDe = de.getSym();
        }
        Assert.isTrue(intDe != null, "unable to find dirEdge with Interior on RHS");
        visitLinkedDirectedEdges(intDe);
    }
}
Also used : DirectedEdge(com.revolsys.geometry.geomgraph.DirectedEdge) Label(com.revolsys.geometry.geomgraph.Label) Point(com.revolsys.geometry.model.Point) Edge(com.revolsys.geometry.geomgraph.Edge) DirectedEdge(com.revolsys.geometry.geomgraph.DirectedEdge)

Aggregations

DirectedEdge (com.revolsys.geometry.geomgraph.DirectedEdge)23 Point (com.revolsys.geometry.model.Point)8 Edge (com.revolsys.geometry.geomgraph.Edge)7 ArrayList (java.util.ArrayList)6 DirectedEdgeStar (com.revolsys.geometry.geomgraph.DirectedEdgeStar)5 Node (com.revolsys.geometry.geomgraph.Node)5 List (java.util.List)3 Label (com.revolsys.geometry.geomgraph.Label)2 TopologyException (com.revolsys.geometry.model.TopologyException)2 MaximalEdgeRing (com.revolsys.geometry.operation.overlay.MaximalEdgeRing)2 EdgeRing (com.revolsys.geometry.geomgraph.EdgeRing)1 LineString (com.revolsys.geometry.model.LineString)1 BoundingBoxDoubleXY (com.revolsys.geometry.model.impl.BoundingBoxDoubleXY)1 LineSegment (com.revolsys.geometry.model.segment.LineSegment)1 LineSegmentDouble (com.revolsys.geometry.model.segment.LineSegmentDouble)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 LinkedList (java.util.LinkedList)1