use of com.revolsys.geometry.geomgraph.DirectedEdge 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);
}
}
}
use of com.revolsys.geometry.geomgraph.DirectedEdge in project com.revolsys.open by revolsys.
the class LineBuilder method collectLines.
private void collectLines(final int opCode) {
for (final Object element : this.op.getGraph().getEdgeEnds()) {
final DirectedEdge de = (DirectedEdge) element;
collectLineEdge(de, opCode, this.lineEdgesList);
collectBoundaryTouchEdge(de, opCode, this.lineEdgesList);
}
}
use of com.revolsys.geometry.geomgraph.DirectedEdge 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.DirectedEdge in project com.revolsys.open by revolsys.
the class ConnectedInteriorTester method buildEdgeRings.
/**
* Form DirectedEdges in graph into Minimal EdgeRings.
* (Minimal Edgerings must be used, because only they are guaranteed to provide
* a correct isHole computation)
*/
private List buildEdgeRings(final Collection dirEdges) {
final List edgeRings = new ArrayList();
for (final Iterator it = dirEdges.iterator(); it.hasNext(); ) {
final DirectedEdge de = (DirectedEdge) it.next();
// if this edge has not yet been processed
if (de.isInResult() && de.getEdgeRing() == null) {
final MaximalEdgeRing er = new MaximalEdgeRing(de, this.geometryFactory);
er.linkDirectedEdgesForMinimalEdgeRings();
final List minEdgeRings = er.buildMinimalRings();
edgeRings.addAll(minEdgeRings);
}
}
return edgeRings;
}
use of com.revolsys.geometry.geomgraph.DirectedEdge in project com.revolsys.open by revolsys.
the class ConnectedInteriorTester method hasUnvisitedShellEdge.
/**
* Check if any shell ring has an unvisited edge.
* A shell ring is a ring which is not a hole and which has the interior
* of the parent area on the RHS.
* (Note that there may be non-hole rings with the interior on the LHS,
* since the interior of holes will also be polygonized into CW rings
* by the linkAllDirectedEdges() step)
*
* @return true if there is an unvisited edge in a non-hole ring
*/
private boolean hasUnvisitedShellEdge(final List edgeRings) {
for (int i = 0; i < edgeRings.size(); i++) {
final EdgeRing er = (EdgeRing) edgeRings.get(i);
// don't check hole rings
if (er.isHole()) {
continue;
}
final List edges = er.getEdges();
DirectedEdge de = (DirectedEdge) edges.get(0);
// (MD - this check may now be irrelevant)
if (de.getLabel().getLocation(0, Position.RIGHT) != Location.INTERIOR) {
continue;
}
/**
* the edgeRing is CW ring which surrounds the INT of the area, so check all
* edges have been visited. If any are unvisited, this is a disconnected part of the interior
*/
for (int j = 0; j < edges.size(); j++) {
de = (DirectedEdge) edges.get(j);
// Debug.print("visted? "); Debug.println(de);
if (!de.isVisited()) {
// Debug.print("not visited "); Debug.println(de);
this.disconnectedRingcoord = de.getCoordinate();
return true;
}
}
}
return false;
}
Aggregations