Beispiel #1
0
 private boolean isCoincidentEdge(DirectedEdge de0, DirectedEdge de1) {
   if (de0.getAngle() == de1.getAngle()) {
     //        System.out.println("found coincident edge");
     //        RoadSegment rs = (RoadSegment) de0.getEdge();
     //        System.out.println(rs.getLine());
     return true;
   }
   return false;
 }
Beispiel #2
0
 /**
  * Checks for any coincident ends of edges.
  *
  * @return a List of the coincident edges, if any
  */
 public Set checkCoincidentEdges() {
   Set coincidentEdges = new HashSet();
   for (Iterator i = nodeIterator(); i.hasNext(); ) {
     Node node = (Node) i.next();
     DirectedEdgeStar deStar = node.getOutEdges();
     DirectedEdge firstDE = null;
     DirectedEdge prevDE = null;
     for (Iterator j = deStar.iterator(); j.hasNext(); ) {
       DirectedEdge de = (DirectedEdge) j.next();
       if (firstDE == null) firstDE = de;
       if (prevDE != null) {
         if (isCoincidentEdge(de, prevDE)) {
           coincidentEdges.add(de.getEdge());
           coincidentEdges.add(prevDE.getEdge());
         }
       }
       prevDE = de;
     }
     if (firstDE != prevDE)
       if (isCoincidentEdge(firstDE, prevDE)) {
         coincidentEdges.add(firstDE.getEdge());
         coincidentEdges.add(prevDE.getEdge());
       }
   }
   return coincidentEdges;
 }