use of com.revolsys.geometry.geomgraph.Node 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);
}
}
use of com.revolsys.geometry.geomgraph.Node in project com.revolsys.open by revolsys.
the class RelateComputer 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)
*/
private void copyNodesAndLabels(final int argIndex) {
for (final Iterator i = this.arg[argIndex].getNodeIterator(); i.hasNext(); ) {
final Node graphNode = (Node) i.next();
final Node newNode = this.nodes.addNode(graphNode);
newNode.setLabel(argIndex, graphNode.getLabel().getLocation(argIndex));
// node.print(System.out);
}
}
use of com.revolsys.geometry.geomgraph.Node in project com.revolsys.open by revolsys.
the class RelateComputer method labelIsolatedNodes.
/**
* Isolated nodes are nodes whose labels are incomplete
* (e.g. the location for one Geometry is null).
* This is the case 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.
*/
private void labelIsolatedNodes() {
for (final Object element : this.nodes) {
final Node n = (Node) element;
final Label label = n.getLabel();
// isolated nodes should always have at least one geometry in their label
Assert.isTrue(label.getGeometryCount() > 0, "node with empty label found");
if (n.isIsolated()) {
if (label.isNull(0)) {
labelIsolatedNode(n, 0);
} else {
labelIsolatedNode(n, 1);
}
}
}
}
use of com.revolsys.geometry.geomgraph.Node in project com.revolsys.open by revolsys.
the class OverlayOp method copyPoints.
/**
* 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 previously computed label of BOUNDARY,
* but in the original arg Geometry it is actually
* in the interior due to the Boundary Determination Rule)
*/
private void copyPoints(final int argIndex) {
for (final Iterator<Node> i = this.arg[argIndex].getNodeIterator(); i.hasNext(); ) {
final Node graphNode = i.next();
final Node newNode = this.graph.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 OverlayOp method computeLabelling.
/**
* Compute initial labelling for all DirectedEdges at each node.
* In this step, DirectedEdges will acquire a complete labelling
* (i.e. one with labels for both Geometries)
* only if they
* are incident on a node which has edges for both Geometries
*/
private void computeLabelling() {
for (final Node node : this.graph.getNodes()) {
node.getEdges().computeLabelling(this.arg);
}
mergeSymLabels();
updateNodeLabelling();
}
Aggregations