View Javadoc

1   package org.catacomb.graph.drawing;
2   
3   import org.catacomb.be.Position;
4   import org.catacomb.graph.gui.AbsLocated;
5   import org.catacomb.graph.gui.PickablePoint;
6   
7   
8   
9   public class ShapePoint implements AbsLocated {
10  
11      Shape parentShape;
12  
13      Position pAbs;
14      Position pCache;
15  
16      PickablePoint pickablePoint;
17  
18      String type;
19      int index;
20  
21  
22  
23      public ShapePoint(Shape parent, Position p, int icol) {
24          parentShape = parent;
25          pAbs = new Position(p);
26          pCache = new Position(p);
27          pickablePoint = new PickablePoint(p, this, icol);
28      }
29  
30      public void setColor(int icol) {
31          pickablePoint.setColor(icol);
32      }
33  
34  
35      public void setType(String s) {
36          type = s;
37      }
38  
39      public String getType() {
40          return type;
41      }
42  
43      public boolean isType(String s) {
44          return (type != null && type.equals(s));
45      }
46  
47      public void setIndex(int i) {
48          index = i;
49      }
50  
51      public int getIndex() {
52          return index;
53      }
54  
55  
56      public Shape getParent() {
57          return parentShape;
58      }
59  
60      public void shiftFromCache(Position p) {
61          pAbs.set(pCache);
62          pAbs.add(p);
63      }
64  
65      public void setPosition(Position p) {
66          pAbs.set(p);
67          parentShape.flagPointMoved();
68      }
69  
70  
71  
72      public Position getAbsolutePosition() {
73          return pAbs;
74      }
75  
76      public Position getPosition() {
77          return pAbs;
78      }
79  
80      public PickablePoint getPickablePoint() {
81          return pickablePoint;
82      }
83  
84  
85      /*
86      public void saveOffset(Position pcen) {
87         pRel.set(pAbs);
88         pRel.subtract(pcen);
89      }
90  
91  
92      public void applyOffset(Position pcen) {
93         pAbs.set(pcen);
94         pAbs.add(pRel);
95      }
96  
97      public Position getPosition() {
98         return pAbs;
99      }
100     */
101 
102 
103 
104     public void cachePosition() {
105         pCache.set(getPosition());
106     }
107 
108     public Position getCachedPosition() {
109         return pCache;
110     }
111 
112 
113 }