Search in sources :

Example 11 with DirectedEdge

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

the class LineBuilder method findCoveredLineEdges.

/**
 * Find and mark L edges which are "covered" by the result area (if any).
 * L edges at nodes which also have A edges can be checked by checking
 * their depth at that node.
 * L edges at nodes which do not have A edges can be checked by doing a
 * point-in-polygon test with the previously computed result areas.
 */
private void findCoveredLineEdges() {
    // first set covered for all L edges at nodes which have A edges too
    for (final Object element : this.op.getGraph().getNodes()) {
        final Node node = (Node) element;
        // node.print(System.out);
        ((DirectedEdgeStar) node.getEdges()).findCoveredLineEdges();
    }
    /**
     * For all L edges which weren't handled by the above,
     * use a point-in-poly test to determine whether they are covered
     */
    for (final Object element : this.op.getGraph().getEdgeEnds()) {
        final DirectedEdge de = (DirectedEdge) element;
        final Edge e = de.getEdge();
        if (de.isLineEdge() && !e.isCoveredSet()) {
            final boolean isCovered = this.op.isCoveredByA(de.getX1(), de.getY1());
            e.setCovered(isCovered);
        }
    }
}
Also used : DirectedEdge(com.revolsys.geometry.geomgraph.DirectedEdge) DirectedEdgeStar(com.revolsys.geometry.geomgraph.DirectedEdgeStar) Node(com.revolsys.geometry.geomgraph.Node) DirectedEdge(com.revolsys.geometry.geomgraph.DirectedEdge) Edge(com.revolsys.geometry.geomgraph.Edge)

Example 12 with DirectedEdge

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

the class LineBuilder method collectLines.

private void collectLines(final int opCode) {
    for (final Object element : this.op.getGraph().getEdgeEnds()) {
        final DirectedEdge de = (DirectedEdge) element;
        collectLineEdge(de, opCode, this.lineEdgesList);
        collectBoundaryTouchEdge(de, opCode, this.lineEdgesList);
    }
}
Also used : DirectedEdge(com.revolsys.geometry.geomgraph.DirectedEdge)

Example 13 with DirectedEdge

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

the class Buffer method buildSubgraphs.

/**
 * Completes the building of the input subgraphs by depth-labelling them,
 * and adds them to the PolygonBuilder.
 * The subgraph list must be sorted in rightmost-coordinate order.
 *
 * @param subgraphList the subgraphs to build
 * @param polyBuilder the PolygonBuilder which will build the final polygons
 */
private static void buildSubgraphs(final List<BufferSubgraph> subgraphList, final PolygonBuilder polyBuilder) {
    final List<BufferSubgraph> processedGraphs = new ArrayList<>();
    for (final BufferSubgraph subgraph : subgraphList) {
        final Point p = subgraph.getRightmostCoordinate();
        final int outsideDepth = getDepth(processedGraphs, p);
        subgraph.computeDepth(outsideDepth);
        subgraph.findResultEdges();
        processedGraphs.add(subgraph);
        final List<DirectedEdge> edges = subgraph.getDirectedEdges();
        final List<Node> nodes = subgraph.getNodes();
        polyBuilder.add(edges, nodes);
    }
}
Also used : DirectedEdge(com.revolsys.geometry.geomgraph.DirectedEdge) Node(com.revolsys.geometry.geomgraph.Node) ArrayList(java.util.ArrayList) Point(com.revolsys.geometry.model.Point) Point(com.revolsys.geometry.model.Point)

Example 14 with DirectedEdge

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

the class ConnectedInteriorTester method buildEdgeRings.

/**
 * Form DirectedEdges in graph into Minimal EdgeRings.
 * (Minimal Edgerings must be used, because only they are guaranteed to provide
 * a correct isHole computation)
 */
private List buildEdgeRings(final Collection dirEdges) {
    final List edgeRings = new ArrayList();
    for (final Iterator it = dirEdges.iterator(); it.hasNext(); ) {
        final DirectedEdge de = (DirectedEdge) it.next();
        // if this edge has not yet been processed
        if (de.isInResult() && de.getEdgeRing() == null) {
            final MaximalEdgeRing er = new MaximalEdgeRing(de, this.geometryFactory);
            er.linkDirectedEdgesForMinimalEdgeRings();
            final List minEdgeRings = er.buildMinimalRings();
            edgeRings.addAll(minEdgeRings);
        }
    }
    return edgeRings;
}
Also used : DirectedEdge(com.revolsys.geometry.geomgraph.DirectedEdge) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) MaximalEdgeRing(com.revolsys.geometry.operation.overlay.MaximalEdgeRing)

Example 15 with DirectedEdge

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

the class ConnectedInteriorTester method hasUnvisitedShellEdge.

/**
 * Check if any shell ring has an unvisited edge.
 * A shell ring is a ring which is not a hole and which has the interior
 * of the parent area on the RHS.
 * (Note that there may be non-hole rings with the interior on the LHS,
 * since the interior of holes will also be polygonized into CW rings
 * by the linkAllDirectedEdges() step)
 *
 * @return true if there is an unvisited edge in a non-hole ring
 */
private boolean hasUnvisitedShellEdge(final List edgeRings) {
    for (int i = 0; i < edgeRings.size(); i++) {
        final EdgeRing er = (EdgeRing) edgeRings.get(i);
        // don't check hole rings
        if (er.isHole()) {
            continue;
        }
        final List edges = er.getEdges();
        DirectedEdge de = (DirectedEdge) edges.get(0);
        // (MD - this check may now be irrelevant)
        if (de.getLabel().getLocation(0, Position.RIGHT) != Location.INTERIOR) {
            continue;
        }
        /**
         * the edgeRing is CW ring which surrounds the INT of the area, so check all
         * edges have been visited.  If any are unvisited, this is a disconnected part of the interior
         */
        for (int j = 0; j < edges.size(); j++) {
            de = (DirectedEdge) edges.get(j);
            // Debug.print("visted? "); Debug.println(de);
            if (!de.isVisited()) {
                // Debug.print("not visited "); Debug.println(de);
                this.disconnectedRingcoord = de.getCoordinate();
                return true;
            }
        }
    }
    return false;
}
Also used : DirectedEdge(com.revolsys.geometry.geomgraph.DirectedEdge) EdgeRing(com.revolsys.geometry.geomgraph.EdgeRing) MaximalEdgeRing(com.revolsys.geometry.operation.overlay.MaximalEdgeRing) ArrayList(java.util.ArrayList) List(java.util.List) Point(com.revolsys.geometry.model.Point)

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