1 package org.catacomb.graph.gui;
2
3 import org.catacomb.datalish.Box;
4
5
6
7 public class Labeller {
8
9
10 int nlabellee;
11 Labellee[] labellees;
12
13
14
15 public Labeller(int nle) {
16 nlabellee = nle;
17 labellees = new Labellee[nlabellee];
18 }
19
20 public void updateLabellee(int ile, Labellee lle) {
21 labellees[ile] = lle;
22 }
23
24
25
26
27 public void initLabels(Box b) {
28 double xmin = b.getXmin();
29 double xmax = b.getXmax();
30 double ymin = b.getYmin();
31 double ymax = b.getYmax();
32
33 int io = 0;
34 double xl = xmin + (0.1 * xmax - xmin);
35
36 for (int i = 0; i < nlabellee; i++) {
37 if (labellees[i] != null) {
38 double yl = ymax + (io+2) * (ymin - ymax)/ 10.;
39 io++;
40 labellees[i].setLabelPosition(xl, yl);
41
42 }
43 }
44
45 }
46
47
48
49 public void adjustLabels(Box b) {
50
51 }
52
53
54 public void instruct(Painter p) {
55 for (int i = 0; i < labellees.length; i++) {
56 if (labellees[i] != null) {
57 labellees[i].instruct(p);
58 }
59 }
60 }
61
62
63 }