1 package org.catacomb.dataview.gui;
2
3 import org.catacomb.dataview.formats.DataHandler;
4 import org.catacomb.druid.gui.base.DruDataDisplay;
5 import org.catacomb.druid.gui.edit.DruListPanel;
6 import org.catacomb.interlish.annotation.ControlPoint;
7 import org.catacomb.interlish.annotation.Editable;
8 import org.catacomb.interlish.annotation.IOPoint;
9 import org.catacomb.interlish.content.DoubleValue;
10 import org.catacomb.interlish.structure.Controller;
11 import org.catacomb.interlish.structure.FrameDisplay;
12 import org.catacomb.interlish.structure.Value;
13 import org.catacomb.interlish.structure.ValueWatcher;
14
15
16 public class Mesh2plusTimeController implements Controller, FrameDisplay, ValueWatcher {
17
18 @IOPoint(xid="dataDisplay")
19 public DruDataDisplay dataDisplay;
20
21 @Editable(xid="cmin")
22 public DoubleValue cmin;
23
24 @Editable(xid="cmax")
25 public DoubleValue cmax;
26
27 @Editable(xid="zval")
28 public DoubleValue zval;
29
30 @IOPoint(xid="variables")
31 public DruListPanel variableList;
32
33 @ControlPoint(xid="frameController")
34 public FramePlayerController frameController;
35
36
37 private DataHandler dataHandler;
38
39
40
41 public Mesh2plusTimeController() {
42 cmin = new DoubleValue(0.);
43 cmax = new DoubleValue(100.);
44 zval = new DoubleValue(0.);
45
46 cmin.addValueWatcher(this);
47 cmax.addValueWatcher(this);
48 zval.addValueWatcher(this);
49 }
50
51
52 public void setDataHandler(DataHandler dh) {
53 dataHandler = dh;
54 dataDisplay.attachGraphicsController(dh);
55 variableList.setItems(dataHandler.getPlotNames());
56 frameController.applyData(dataHandler.getFrameValues());
57 }
58
59
60 public void resetRange() {
61 double ca = dataHandler.getMinValue();
62 double cb = dataHandler.getMaxValue();
63 cmin.reportableSetDouble(ca, this);
64 cmax.reportableSetDouble(cb, this);
65 exportColorRange();
66 }
67
68
69
70 public void attached() {
71 frameController.setFrameDisplay(this);
72 }
73
74
75
76 public void showFrame(int ifr) {
77 dataHandler.setFrame(ifr);
78 dataDisplay.repaint();
79 }
80
81
82 public void setPlot(String s) {
83
84 dataHandler.setPlot(s);
85 dataDisplay.repaint();
86 }
87
88
89 public void valueChangedBy(Value pv, Object src) {
90 exportColorRange();
91 }
92
93
94 public void exportColorRange() {
95 double clo = cmin.getDouble();
96 double chi = cmax.getDouble();
97 dataHandler.setZValue(zval.getDouble());
98
99 dataDisplay.setColorRange(clo, chi);
100 dataDisplay.repaint();
101 }
102
103
104 public void repaint() {
105 dataDisplay.repaint();
106
107 }
108
109 }