1 package org.catacomb.dataview;
2
3 import java.awt.Color;
4
5 import org.catacomb.datalish.Box;
6 import org.catacomb.graph.gui.Painter;
7
8
9 public class StringPlotElement extends PlotElement {
10
11 double xpt;
12 double ypt;
13 String txt;
14
15 int dxo = 0;
16 int dyo = 0;
17
18 public StringPlotElement(double x, double y, String s) {
19 this(x, y, Color.white, s);
20 }
21
22 public StringPlotElement(double x, double y, Color c, String s) {
23 this(x, y, Color.white, s, 0, 0);
24 }
25
26 public StringPlotElement(double x, double y, Color c, String s, int xo, int yo) {
27 xpt = x;
28 ypt = y;
29 col = c;
30 txt = s;
31 dxo = xo;
32 dyo = yo;
33 }
34
35
36
37 public void instruct(Painter p) {
38 p.setColor(col);
39 if (dxo == 0 && dyo == 0) {
40 p.drawText(txt, xpt, ypt);
41 } else {
42 p.drawLineOffsetText(txt, xpt, ypt, dxo, dyo);
43 }
44 }
45
46
47 public void push(Box b) {
48 b.push(xpt, ypt);
49 }
50
51 }