예제 #1
0
 public static boolean continuityCheck(List<LayoutNode> set) {
   for (int s = 0; s < set.size(); s++) {
     LayoutNode node = set.get(s);
     for (Enumeration<LayoutNode> e = node.links().elements(); e.hasMoreElements(); )
       if (!set.contains(e.nextElement())) return false;
   }
   return true;
 }
예제 #2
0
 public void clipLongStreets() {
   @SuppressWarnings("unchecked")
   Vector<LayoutNode> set2 = (Vector<LayoutNode>) set().clone();
   for (Enumeration<LayoutNode> e = set2.elements(); e.hasMoreElements(); ) {
     LayoutNode p = e.nextElement();
     if (isUsed(p) && p.isStreetLike())
       for (int d = 0; d < 4; d++)
         if (p.getLink(d) == null) {
           LayoutNode p2 = getNextNode(p, d);
           if ((p2 != null) && (!p.links().containsValue(p2))) {
             Enumeration<LayoutNode> nodes = p.links().elements();
             LayoutNode p_1 = nodes.nextElement();
             LayoutNode p_2 = nodes.nextElement();
             p.deLink();
             p_1.crossLink(p_2);
             unUse(p);
             LayoutNode p3 = makeNextNode(p2, Directions.getOpDirectionCode(d));
             p2.crossLink(p3);
             use(p3, LayoutTypes.leaf);
             break;
           }
         }
   }
 }
예제 #3
0
 public void fillInFlags() {
   for (Enumeration<LayoutNode> e = set().elements(); e.hasMoreElements(); ) {
     LayoutNode n = e.nextElement();
     int[] dirs = new int[n.links().size()];
     int x = 0;
     for (Integer dirLink : n.links().keySet()) dirs[x++] = dirLink.intValue();
     n.setExits(dirs);
     if ((dirs.length == 1) && (!n.isFlagged(LayoutFlags.gate))) n.reType(LayoutTypes.leaf);
   }
   for (Enumeration<LayoutNode> e = set().elements(); e.hasMoreElements(); ) {
     LayoutNode n = e.nextElement();
     if (n.links().size() == 2) {
       LayoutFlags flag = null;
       if (n.type() == LayoutTypes.interior)
         for (Integer dirLink : n.links().keySet()) {
           LayoutNode n2 = n.links().get(dirLink);
           if ((n2 != null) && (n2.type() == LayoutTypes.leaf)) flag = LayoutFlags.offleaf;
         }
       if (flag != null) n.flag(flag);
       else {
         Enumeration<Integer> dirs = n.links().keys();
         Integer lN1 = dirs.nextElement();
         Integer lN2 = dirs.nextElement();
         if (lN1.intValue() != Directions.getOpDirectionCode(lN2.intValue()))
           n.flag(LayoutFlags.corner);
       }
     } else if ((n.links().size() == 3)
         && (((n.type() == LayoutTypes.street) || (n.type() != LayoutTypes.surround)))) {
       boolean allStreet = true;
       for (Integer dirLink : n.links().keySet()) {
         LayoutNode n2 = n.links().get(dirLink);
         if ((n2 == null)
             || ((n2.type() != LayoutTypes.street) && (n2.type() != LayoutTypes.surround)))
           allStreet = false;
       }
       if (allStreet) n.flag(LayoutFlags.tee);
     } else if ((n.links().size() == 4)
         && (((n.type() == LayoutTypes.street) || (n.type() != LayoutTypes.surround)))) {
       boolean allStreet = true;
       for (Integer dirLink : n.links().keySet()) {
         LayoutNode n2 = n.links().get(dirLink);
         if ((n2 == null)
             || ((n2.type() != LayoutTypes.street) && (n2.type() != LayoutTypes.surround)))
           allStreet = false;
       }
       if (allStreet) n.flag(LayoutFlags.intersection);
     }
   }
 }