Search in sources :

Example 6 with Node

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

the class OverlayOp method updateNodeLabelling.

private void updateNodeLabelling() {
    // because it is a point in one of the input geometries)
    for (final Node node : this.graph.getNodes()) {
        final Label label = ((DirectedEdgeStar) node.getEdges()).getLabel();
        node.getLabel().merge(label);
    }
}
Also used : DirectedEdgeStar(com.revolsys.geometry.geomgraph.DirectedEdgeStar) Node(com.revolsys.geometry.geomgraph.Node) Label(com.revolsys.geometry.geomgraph.Label)

Example 7 with Node

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

the class OverlayOp method labelIncompleteNodes.

/**
 * Incomplete nodes are nodes whose labels are incomplete.
 * (e.g. the location for one Geometry is null).
 * These are either isolated nodes,
 * or nodes which have edges from only a single Geometry incident on them.
 *
 * Isolated nodes are found because nodes in one graph which don't intersect
 * nodes in the other are not completely labelled by the initial process
 * of adding nodes to the nodeList.
 * To complete the labelling we need to check for nodes that lie in the
 * interior of edges, and in the interior of areas.
 * <p>
 * When each node labelling is completed, the labelling of the incident
 * edges is updated, to complete their labelling as well.
 */
private void labelIncompleteNodes() {
    for (final Node n : this.graph.getNodes()) {
        final Label label = n.getLabel();
        if (n.isIsolated()) {
            if (label.isNull(0)) {
                labelIncompleteNode(n, 0);
            } else {
                labelIncompleteNode(n, 1);
            }
        }
        // now update the labelling for the DirectedEdges incident on this node
        ((DirectedEdgeStar) n.getEdges()).updateLabelling(label);
    }
}
Also used : DirectedEdgeStar(com.revolsys.geometry.geomgraph.DirectedEdgeStar) Node(com.revolsys.geometry.geomgraph.Node) Label(com.revolsys.geometry.geomgraph.Label)

Example 8 with Node

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

the class BufferSubgraph method addReachable.

/**
 * Adds all nodes and edges reachable from this node to the subgraph.
 * Uses an explicit stack to avoid a large depth of recursion.
 *
 * @param node a node known to be in the subgraph
 */
private void addReachable(final Node startNode) {
    final Stack<Node> nodeStack = new Stack<>();
    nodeStack.add(startNode);
    while (!nodeStack.empty()) {
        final Node node = nodeStack.pop();
        add(node, nodeStack);
    }
}
Also used : Node(com.revolsys.geometry.geomgraph.Node) Stack(java.util.Stack)

Example 9 with Node

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

the class RelateNodeGraph method copyNodesAndLabels.

/**
 * Copy all nodes from an arg geometry into this graph.
 * The node label in the arg geometry overrides any previously computed
 * label for that argIndex.
 * (E.g. a node may be an intersection node with
 * a computed label of BOUNDARY,
 * but in the original arg Geometry it is actually
 * in the interior due to the Boundary Determination Rule)
 */
public void copyNodesAndLabels(final GeometryGraph geomGraph, final int argIndex) {
    for (final Node graphNode : geomGraph.getNodeMap()) {
        final Node newNode = this.nodes.addNode(graphNode);
        newNode.setLabel(argIndex, graphNode.getLabel().getLocation(argIndex));
    }
}
Also used : Node(com.revolsys.geometry.geomgraph.Node)

Example 10 with Node

use of com.revolsys.geometry.geomgraph.Node 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)

Aggregations

Node (com.revolsys.geometry.geomgraph.Node)17 DirectedEdgeStar (com.revolsys.geometry.geomgraph.DirectedEdgeStar)7 DirectedEdge (com.revolsys.geometry.geomgraph.DirectedEdge)5 Label (com.revolsys.geometry.geomgraph.Label)3 ArrayList (java.util.ArrayList)2 Iterator (java.util.Iterator)2 LineIntersector (com.revolsys.geometry.algorithm.LineIntersector)1 Edge (com.revolsys.geometry.geomgraph.Edge)1 Point (com.revolsys.geometry.model.Point)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 Stack (java.util.Stack)1