hasUnvisitedShellEdge method

bool hasUnvisitedShellEdge(
  1. List edgeRings
)

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

Implementation

bool hasUnvisitedShellEdge(List edgeRings) {
  for (int i = 0; i < edgeRings.length; i++) {
    EdgeRing er = edgeRings[i] as EdgeRing;
    // don't check hole rings
    if (er.isHole()) continue;
    List edges = er.getEdges();
    DirectedEdge de = edges[0] as DirectedEdge;
    // don't check CW rings which are holes
    // (MD - this check may now be irrelevant)
    if (de.getLabel()!.getLocationWithPosIndex(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.length; j++) {
      de = edges[j] as DirectedEdge;
//Debug.print("visted? "); Debug.println(de);
      if (!de.isVisited()) {
//Debug.print("not visited "); Debug.println(de);
        disconnectedRingcoord = de.getCoordinate();
        return true;
      }
    }
  }
  return false;
}