Ejemplo n.º 1
0
  public void findEdge(List dirEdgeList) {
    /**
     * Check all forward DirectedEdges only. This is still general, because each edge has a forward
     * DirectedEdge.
     */
    for (Iterator i = dirEdgeList.iterator(); i.hasNext(); ) {
      DirectedEdge de = (DirectedEdge) i.next();
      if (!de.isForward()) continue;
      checkForRightmostCoordinate(de);
    }

    /**
     * If the rightmost point is a node, we need to identify which of the incident edges is
     * rightmost.
     */
    Assert.isTrue(
        minIndex != 0 || minCoord.equals(minDe.getCoordinate()),
        "inconsistency in rightmost processing");
    if (minIndex == 0) {
      findRightmostEdgeAtNode();
    } else {
      findRightmostEdgeAtVertex();
    }
    /** now check that the extreme side is the R side. If not, use the sym instead. */
    orientedDe = minDe;
    int rightmostSide = getRightmostSide(minDe, minIndex);
    if (rightmostSide == Position.LEFT) {
      orientedDe = minDe.getSym();
    }
  }
 private void add(List edges) {
   for (Iterator i = edges.iterator(); i.hasNext(); ) {
     Edge edge = (Edge) i.next();
     // edge is its own group
     add(edge, edge);
   }
 }
Ejemplo n.º 3
0
 /**
  * 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 void buildSubgraphs(List subgraphList, PolygonBuilder polyBuilder) {
   List processedGraphs = new ArrayList();
   for (Iterator i = subgraphList.iterator(); i.hasNext(); ) {
     BufferSubgraph subgraph = (BufferSubgraph) i.next();
     Coordinate p = subgraph.getRightmostCoordinate();
     //      int outsideDepth = 0;
     //      if (polyBuilder.containsPoint(p))
     //        outsideDepth = 1;
     SubgraphDepthLocater locater = new SubgraphDepthLocater(processedGraphs);
     int outsideDepth = locater.getDepth(p);
     //      try {
     subgraph.computeDepth(outsideDepth);
     //      }
     //      catch (RuntimeException ex) {
     //        // debugging only
     //        //subgraph.saveDirEdges();
     //        throw ex;
     //      }
     subgraph.findResultEdges();
     processedGraphs.add(subgraph);
     polyBuilder.add(subgraph.getDirectedEdges(), subgraph.getNodes());
   }
 }
 private void add(List edges, Object edgeSet) {
   for (Iterator i = edges.iterator(); i.hasNext(); ) {
     Edge edge = (Edge) i.next();
     add(edge, edgeSet);
   }
 }