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);
}
}
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);
}
}
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);
}
}
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));
}
}
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);
}
}
}
Aggregations