use of com.revolsys.geometry.planargraph.DirectedEdge in project com.revolsys.open by revolsys.
the class MiscellaneousTest2 method testDirectedEdgeComparator.
public void testDirectedEdgeComparator() {
final DirectedEdge d1 = new DirectedEdge(new Node(0, 0), new Node(10, 10), new PointDoubleXY(10, 10), true);
final DirectedEdge d2 = new DirectedEdge(new Node(0, 0), new Node(20, 20), new PointDoubleXY(20, 20), false);
assertEquals(0, d2.compareTo(d1));
}
use of com.revolsys.geometry.planargraph.DirectedEdge in project com.revolsys.open by revolsys.
the class MiscellaneousTest2 method testDirectedEdgeToEdges.
public void testDirectedEdgeToEdges() {
final DirectedEdge d1 = new DirectedEdge(new Node(0, 0), new Node(10, 10), new PointDoubleXY(10, 10), true);
final DirectedEdge d2 = new DirectedEdge(new Node(20, 0), new Node(20, 10), new PointDoubleXY(20, 10), false);
final List edges = DirectedEdge.toEdges(Arrays.asList(d1, d2));
assertEquals(2, edges.size());
assertNull(edges.get(0));
assertNull(edges.get(1));
}
use of com.revolsys.geometry.planargraph.DirectedEdge in project com.revolsys.open by revolsys.
the class ConnectedSubgraphFinder method addEdges.
/**
* Adds the argument node and all its out edges to the subgraph.
* @param node the node to add
* @param nodeStack the current set of nodes being traversed
*/
private void addEdges(final Node node, final Stack nodeStack, final Subgraph subgraph) {
node.setVisited(true);
for (final Object element : node.getOutEdges()) {
final DirectedEdge de = (DirectedEdge) element;
subgraph.add(de.getEdge());
final Node toNode = de.getToNode();
if (!toNode.isVisited()) {
nodeStack.push(toNode);
}
}
}
Aggregations