1 package org.catacomb.graph.drawing; 2 3 4 import java.awt.Color; 5 6 import org.catacomb.interlish.content.BasicTouchTime; 7 8 9 public class VectorIcon extends FixedDrawing { 10 11 public String ref; 12 13 BasicTouchTime touchTime; 14 15 16 public VectorIcon() { 17 super(); 18 touchTime = new BasicTouchTime(); 19 } 20 21 22 public VectorIcon copy() { 23 VectorIcon ret = new VectorIcon(); 24 for (FixedDrawingComponent fdc : items) { 25 ret.add(fdc.copy()); 26 } 27 return ret; 28 } 29 30 31 public BasicTouchTime getTouchTime() { 32 return touchTime; 33 } 34 35 public void baseInit() { 36 add(new Square(0., 0., 0.6, 0.6)); 37 } 38 39 40 public boolean hasRef() { 41 return (ref != null); 42 } 43 44 public String getRef() { 45 return ref; 46 } 47 48 49 public static VectorIcon errorIcon() { 50 VectorIcon vir = new VectorIcon(); 51 vir.add(Square.defaultSquare()); 52 return vir; 53 } 54 55 56 public void addSubIcon(VectorIcon icon, double x, double y, double scl) { 57 add(new IconWrapper(icon, x, y, scl)); 58 } 59 60 61 public static VectorIcon makeErrorIcon() { 62 VectorIcon vir = new VectorIcon(); 63 Disc d = new Disc(); 64 d.setSize(0.8, 0.8); 65 d.setFillColor(Color.red); 66 vir.add(d); 67 68 Rectangle r = new Rectangle(0.0, 0.3, 0.1, 0.5); 69 r.setFillColor(Color.white); 70 vir.add(r); 71 72 Rectangle rd = new Rectangle(0.0, -0.5, 0.1, 0.1); 73 rd.setFillColor(Color.white); 74 vir.add(rd); 75 return vir; 76 } 77 78 79 public static VectorIcon makeRefIcon() { 80 VectorIcon vir = new VectorIcon(); 81 82 Rectangle r = new Rectangle(0.0, 0.0, 0.8, 0.8); 83 r.setClosed(); 84 r.setLineColor(Color.black); 85 r.setLineWidth(1.); 86 vir.add(r); 87 return vir; 88 89 } 90 91 92 93 public static VectorIcon makePendingIcon() { 94 VectorIcon vir = new VectorIcon(); 95 Disc d = new Disc(); 96 d.setSize(0.8, 0.8); 97 d.setFillColor(Color.gray); 98 vir.add(d); 99 100 return vir; 101 } 102 103 104 105 106 }