1 package org.catacomb.graph.gui;
2
3
4 import org.catacomb.be.Position;
5
6 import java.awt.Color;
7
8
9
10 public class PickablePoint implements Pickable {
11
12
13
14 Position p_position;
15
16 Color p_color;
17 String p_tip;
18
19 int p_size;
20 int p_range;
21
22
23 final static int SQUARE = 1;
24 final static int CIRCLE = 2;
25 int p_style;
26 int p_icache;
27
28 Object p_ref;
29
30 private AbsLocated p_absLocated;
31
32
33 public PickablePoint() {
34 this(0.0, 0.0, null);
35 }
36
37
38 public PickablePoint(Object obj) {
39 this(0., 0., obj);
40 }
41
42
43 public PickablePoint(double cx, double cy) {
44 this(cx, cy, null);
45 }
46
47
48 public PickablePoint(Position p, Object obj) {
49 this(p.getX(), p.getY(), obj);
50 }
51
52
53 public PickablePoint(Position p, Object obj, int icol) {
54 this(p.getX(), p.getY(), obj);
55 p_color = new Color(icol);
56 }
57
58
59 public PickablePoint(double cx, double cy, Object oref) {
60 this(cx, cy, Color.red, oref);
61 }
62
63
64 public PickablePoint(double cx, double cy, Color col, Object oref) {
65 this(cx, cy, col, oref, 4, 8);
66 }
67
68
69 public PickablePoint(double cx, double cy, Color col, Object oref, int isize, int irange) {
70 p_position = new Position(cx, cy);
71 p_color = col;
72 p_ref = oref;
73
74 if (oref instanceof AbsLocated) {
75 p_absLocated = (AbsLocated)oref;
76 }
77
78
79 p_size = isize;
80 p_range = irange;
81 }
82
83
84 public void moveTo(double x, double y) {
85 p_position.set(x, y);
86 }
87
88
89 public Object getRef() {
90 return p_ref;
91 }
92
93
94 public void setCache(int i) {
95 p_icache = i;
96 }
97
98
99 public int getCache() {
100 return p_icache;
101 }
102
103
104 public void moveTo(Position pos) {
105 setPosition(pos);
106 }
107
108
109 public void setPosition(Position p) {
110 setPosition(p.getX(), p.getY());
111 }
112
113
114 public void setPosition(double x, double y) {
115 p_position.set(x, y);
116 }
117
118
119 public int getRange() {
120 return p_range;
121 }
122
123
124 public int getSize() {
125 return p_size;
126 }
127
128
129
130
131 public void setColor(int icol) {
132 setColor(new Color(icol));
133 }
134
135
136
137 public void setColor(Color c) {
138 p_color = c;
139 }
140
141
142 public void setSize(int sz) {
143 p_size = sz;
144 }
145
146
147 public void setRange(int rn) {
148 p_range = rn;
149 }
150
151
152 public Position getPosition() {
153 Position ret = null;
154 if (p_absLocated == null) {
155 ret = p_position;
156 } else {
157 ret = p_absLocated.getAbsolutePosition();
158 }
159 return ret;
160 }
161
162
163
164 public Color getColor() {
165 return p_color;
166 }
167
168
169 }