-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModelChartView.cpp
62 lines (46 loc) · 1.91 KB
/
ModelChartView.cpp
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include "MobiView2.h"
#include "ModelChartView.h"
ModelChartView::ModelChartView(MobiView2 *parent) : parent(parent) {
CtrlLayout(*this, "MobiView2 model graph and index editing");
Sizeable().Zoomable();
model_graph_tab.Add(model_graph_scroll.HSizePosZ(0, 0).VSizePosZ(0, 30));
model_graph_tab.Add(show_properties.LeftPos(5, 105).BottomPos(0, 30));
show_properties.SetLabel("Show properties");
show_properties.SetData(model_graph.show_properties);
show_properties.WhenAction << THISBACK(rebuild);
model_graph_tab.Add(show_flux_labels.LeftPos(110, 210).BottomPos(0, 30));
show_flux_labels.SetLabel("Show flux labels");
show_flux_labels.SetData(model_graph.show_flux_labels);
show_flux_labels.WhenAction << THISBACK(rebuild);
model_graph_tab.Add(short_names.LeftPos(215, 300).BottomPos(0, 30));
short_names.SetLabel("Short names");
short_names.SetData(model_graph.show_short_names);
short_names.WhenAction << THISBACK(rebuild);
view_tabs.Add(model_graph_tab.SizePos(), "Flux graph");
distrib_graph_tab.Add(distrib_graph_scroll.SizePos());
view_tabs.Add(distrib_graph_tab.SizePos(), "Distribution graph");
view_tabs.WhenAction << THISBACK(rebuild);
}
void
ModelChartView::rebuild() {
model_graph_scroll.ClearPane();
distrib_graph_scroll.ClearPane();
int tab = view_tabs.GetData();
if(tab == 0) {
model_graph.show_properties = show_properties.GetData();
model_graph.show_flux_labels = show_flux_labels.GetData();
model_graph.show_short_names = short_names.GetData();
}
try {
if(!parent->model_is_loaded())
model_graph.rebuild_image(nullptr, tab);
model_graph.rebuild_image(parent->app, tab);
} catch(int) {
parent->log_warnings_and_errors();
}
Size sz = model_graph.image.GetSize();
if(tab == 0)
model_graph_scroll.AddPane(model_graph.LeftPos(0, sz.cx).TopPos(0, sz.cy), sz);
else if(tab == 1)
distrib_graph_scroll.AddPane(model_graph.LeftPos(0, sz.cx).TopPos(0, sz.cy), sz);
}