Changeset 78 for trunk/src/org/expeditee/items/ItemUtils.java
- Timestamp:
- 05/26/08 09:11:05 (16 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 8 8 testdummyaudio 9 9 tests_apollos 10 *.txt
-
- Property svn:ignore
-
trunk/src/org/expeditee/items/ItemUtils.java
r72 r78 12 12 import java.util.Collection; 13 13 import java.util.HashMap; 14 import java.util.HashSet;15 14 import java.util.LinkedHashSet; 16 15 import java.util.LinkedList; … … 71 70 72 71 public static final int TAG_STAT_TEMPLATE = 18; 72 73 public static final int TAG_VECTOR = 19; 74 75 public static final int TAG_BITMAP_IMAGE = 20; 73 76 74 77 public static final int TAG_MIN = 0; 75 78 76 public static final int TAG_MAX = 18;79 public static final int TAG_MAX = 20; 77 80 78 81 /** … … 115 118 * is found 116 119 */ 117 public static TextFindTag(List<Item> items, int tag) {120 public static Item FindTag(List<Item> items, int tag) { 118 121 return FindTag(items, GetTag(tag)); 119 122 } … … 139 142 } 140 143 141 public static TextFindExactTag(List<Item> items, String toFind) {144 public static Item FindExactTag(List<Item> items, String toFind) { 142 145 for (Item i : items) { 143 146 if (i instanceof Text && i.isAnnotation()) 144 147 if (((Text) i).getTextNoList().trim().equalsIgnoreCase(toFind)) 145 return ( Text) i;148 return (Item) i; 146 149 } 147 150 … … 149 152 } 150 153 151 public static TextFindExactTag(List<Item> items, int tag) {154 public static Item FindExactTag(List<Item> items, int tag) { 152 155 return FindExactTag(items, GetTag(tag)); 153 156 } … … 285 288 case TAG_OVERLAY: 286 289 return "@o"; 290 case TAG_VECTOR: 291 return "@v"; 287 292 case TAG_ACTIVE_OVERLAY: 288 293 return "@ao"; … … 307 312 case TAG_FRAME_IMAGE: 308 313 return "@f"; 314 case TAG_BITMAP_IMAGE: 315 return "@b"; 309 316 case TAG_BACKUP: 310 317 return "@old"; … … 418 425 } 419 426 420 public static Picture CreateFrame Picture(Text source, ImageObserver observer) {427 public static Picture CreateFrameImage(Text source, ImageObserver observer) { 421 428 String size = source.getFirstLine(); 422 429 … … 426 433 427 434 try { 428 Picture pic = new Picture(source, null, size, observer);435 Picture pic = new FrameImage(source, size, observer); 429 436 return pic; 430 437 } catch (Exception e) { … … 433 440 } 434 441 } 442 443 public static Picture CreateFrameBitmap(Text source, ImageObserver observer) { 444 String size = source.getFirstLine(); 445 446 // remove @b tag 447 size = size.replaceFirst("@b", ""); 448 size = size.trim(); 449 450 try { 451 Picture pic = new FrameBitmap(source, size, observer); 452 return pic; 453 } catch (Exception e) { 454 // e.printStackTrace(); 455 return null; 456 } 457 } 435 458 436 459 /** … … 450 473 451 474 // list of dots at the end of lines 452 Collection<Item> lineEnds = new HashSet<Item>();453 Collection<Line> lines = new HashSet<Line>();454 Collection<Constraint> constraints = new HashSet<Constraint>();455 456 Collection<Item> singles = new HashSet<Item>();475 Collection<Item> lineEnds = new LinkedHashSet<Item>(); 476 Collection<Line> lines = new LinkedHashSet<Line>(); 477 Collection<Constraint> constraints = new LinkedHashSet<Constraint>(); 478 479 Collection<Item> singles = new LinkedHashSet<Item>(); 457 480 458 481 Map<Item, Item> lineEndMap = new HashMap<Item, Item>(); … … 529 552 for (Line line : lines) { 530 553 Line lineCopy = line.copy(); 531 lineCopy.setEndItem(lineEndMap.get(line.getEndItem())); 532 lineCopy.setStartItem(lineEndMap.get(line.getStartItem())); 554 //get the lineEnd we copied above if it is in the MAPPING 555 Item originalLineEnd = line.getEndItem(); 556 Item actualLineEnd = lineEndMap.get(originalLineEnd); 557 if (actualLineEnd == null) 558 lineCopy.setEndItem(originalLineEnd); 559 else 560 lineCopy.setEndItem(actualLineEnd); 561 562 Item originalLineStart = line.getStartItem(); 563 Item actualLineStart = lineEndMap.get(originalLineStart); 564 if (actualLineStart == null) 565 lineCopy.setStartItem(originalLineStart); 566 else 567 lineCopy.setStartItem(actualLineStart); 568 533 569 copies.add(lineCopy); 534 570 }
Note:
See TracChangeset
for help on using the changeset viewer.