Changeset 50 for trunk/src/org/expeditee/items/ItemUtils.java
- Timestamp:
- 05/16/08 10:25:28 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/items/ItemUtils.java
r26 r50 450 450 for (Constraint c : consts) { 451 451 if (c.contains(line.getEndItem())) { 452 if (c.get ConstraintType() == Constraint.VERTICAL) {452 if (c.getType() == Constraint.VERTICAL) { 453 453 vConst.add(line.getStartItem()); 454 454 vConst.add(line.getEndItem()); … … 659 659 _seen.clear(); 660 660 661 // get all dots on the Frame662 List< Dot> dots = new ArrayList<Dot>(0);661 // get all lineEnds on the Frame 662 List<Item> lineEnds = new ArrayList<Item>(0); 663 663 for (Item i : items) { 664 if (i instanceof Dot) { 665 Dot d = (Dot) i; 666 d.setEnclosedList(null); 667 668 if (d.getLines().size() == 2) 669 dots.add(d); 670 } 671 } 672 673 // if there are no dots on the Frame, then there can't be an enclosure 674 if (dots.size() == 0) 664 if (i.isLineEnd()) { 665 i.setEnclosedList(null); 666 667 if (i.getLines().size() == 2) 668 lineEnds.add(i); 669 } 670 } 671 672 // if there are no line endpoints on the Frame, then there can't be an enclosure 673 if (lineEnds.size() == 0) 675 674 return; 676 675 677 676 //TODO optimise this code!! 678 // iterate through all the dots679 for ( Dot searchFor : dots) {677 // iterate through all the lineEnds 678 for (Item searchFor : lineEnds) { 680 679 _seen.clear(); 681 680 … … 683 682 _seen.add(l); 684 683 if (traverse(searchFor, l.getOppositeEnd(searchFor))) { 685 _path.add( (Dot)l.getOppositeEnd(searchFor));686 687 for ( Dot d: _path)688 d.setEnclosedList(_path);689 690 _path = new ArrayList< Dot>(0);684 _path.add(l.getOppositeEnd(searchFor)); 685 686 for (Item i : _path) 687 i.setEnclosedList(_path); 688 689 _path = new ArrayList<Item>(0); 691 690 692 691 break; … … 699 698 private static List<Line> _seen = new ArrayList<Line>(); 700 699 701 private static List< Dot> _path = new ArrayList<Dot>();702 703 private static boolean traverse( DottoFind, Item searchFrom) {700 private static List<Item> _path = new ArrayList<Item>(); 701 702 private static boolean traverse(Item toFind, Item searchFrom) { 704 703 if (toFind == null || searchFrom == null 705 || ! (searchFrom instanceof Dot))704 || !searchFrom.isLineEnd()) 706 705 return false; 707 706 … … 716 715 _seen.add(l); 717 716 if (traverse(toFind, l.getOppositeEnd(searchFrom))) { 718 _path.add( (Dot)l.getOppositeEnd(searchFrom));717 _path.add(l.getOppositeEnd(searchFrom)); 719 718 return true; 720 719 }
Note:
See TracChangeset
for help on using the changeset viewer.