1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 package org.ximtec.igesture.app.showcaseapp.descriptor;
28
29 import java.awt.Graphics2D;
30 import java.awt.RenderingHints;
31
32 import org.sigtec.ink.Note;
33 import org.ximtec.igesture.core.DigitalDescriptor;
34
35
36
37
38
39
40
41 public class ArrowDescriptor extends DigitalDescriptor {
42
43 private static final int SPACE = 20;
44
45
46 public ArrowDescriptor() {
47 super();
48 }
49
50
51 @Override
52 public void getDigitalObject(Graphics2D graphic, Note note) {
53 int x1 = (int)note.getBounds2D().getMinX();
54 int x2 = (int)note.getBounds2D().getMaxX();
55 int y = (int)((note.getBounds2D().getMinY() + note.getBounds2D().getMaxY()) / 2);
56 int diff = (int)((note.getBounds2D().getMinY() - note.getBounds2D()
57 .getMaxY()) / 2);
58 graphic.setRenderingHint(RenderingHints.KEY_RENDERING,
59 RenderingHints.VALUE_RENDER_QUALITY);
60 graphic.drawLine(x1, y, x2, y);
61 graphic.drawLine(x2, y, x2 - SPACE, y - diff);
62 graphic.drawLine(x2, y, x2 - SPACE, y + diff);
63 }
64
65
66 @Override
67 public String getName() {
68 return this.getClass().getSimpleName();
69 }
70
71 }