1
2
3
4
5
6
7
8
9
10
11 package pl.edu.agh.cast.tool;
12
13 import org.eclipse.draw2d.Graphics;
14 import org.eclipse.draw2d.Shape;
15 import org.eclipse.draw2d.geometry.Point;
16 import org.eclipse.draw2d.geometry.Rectangle;
17
18
19
20
21
22
23 public class TargetShape extends Shape {
24
25
26
27
28 protected void fillShape(Graphics graphics) {
29
30
31 }
32
33
34
35
36 protected void outlineShape(Graphics graphics) {
37 Rectangle bounds = getClientArea().getCopy();
38
39
40
41 bounds.width -= 1;
42 bounds.height -= 1;
43 Point center = bounds.getCenter();
44 Point bottom = new Point(bounds.x+bounds.width, bounds.height+bounds.y);
45 Point top = new Point(bounds.x, bounds.y);
46
47 graphics.drawLine(center.x, top.y, center.x, center.y-2);
48 graphics.drawLine(center.x+2, center.y, bottom.x, center.y);
49 graphics.drawLine(center.x, center.y+2, center.x, bottom.y);
50 graphics.drawLine(top.x, center.y, center.x-2, center.y);
51
52 bounds.shrink(bounds.width/4, bounds.height/4);
53 bounds.width -=1;
54 bounds.height -=1;
55
56
57 graphics.drawOval(bounds);
58
59 }
60
61 }