use of com.revolsys.geometry.geomgraph.DirectedEdge in project com.revolsys.open by revolsys.
the class BufferSubgraph method getEnvelope.
/**
* Computes the envelope of the edges in the subgraph.
* The envelope is cached after being computed.
*
* @return the envelope of the graph.
*/
public BoundingBox getEnvelope() {
if (this.env == null) {
double[] bounds = null;
for (final DirectedEdge dirEdge : this.dirEdgeList) {
final Edge edge = dirEdge.getEdge();
final LineString points = edge.getLineString();
for (int i = 0; i < points.getVertexCount(); i++) {
final Point point = points.getPoint(i);
if (bounds == null) {
bounds = RectangleUtil.newBounds(2, point);
} else {
RectangleUtil.expand(bounds, 2, point);
}
}
}
this.env = new BoundingBoxDoubleXY(bounds);
}
return this.env;
}
use of com.revolsys.geometry.geomgraph.DirectedEdge in project com.revolsys.open by revolsys.
the class BufferSubgraph method add.
/**
* 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 add(final Node node, final Stack<Node> nodeStack) {
node.setVisited(true);
this.nodes.add(node);
for (final Object element : (DirectedEdgeStar) node.getEdges()) {
final DirectedEdge de = (DirectedEdge) element;
this.dirEdgeList.add(de);
final DirectedEdge sym = de.getSym();
final Node symNode = sym.getNode();
/**
* NOTE: this is a depth-first traversal of the graph.
* This will cause a large depth of recursion.
* It might be better to do a breadth-first traversal.
*/
if (!symNode.isVisited()) {
nodeStack.push(symNode);
}
}
}
use of com.revolsys.geometry.geomgraph.DirectedEdge in project com.revolsys.open by revolsys.
the class BufferSubgraph method computeDepth.
public void computeDepth(final int outsideDepth) {
clearVisitedEdges();
// find an outside edge to assign depth to
final DirectedEdge de = this.finder.getEdge();
// right side of line returned by finder is on the outside
de.setEdgeDepths(Position.RIGHT, outsideDepth);
copySymDepths(de);
// computeNodeDepth(n, de);
computeDepths(de);
}
Aggregations