-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModelGraph.cpp
More file actions
61 lines (45 loc) · 1.28 KB
/
ModelGraph.cpp
File metadata and controls
61 lines (45 loc) · 1.28 KB
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
#include "ModelGraph.h"
#include "MobiView2.h"
using namespace Upp;
//#include "support/graph_visualisation.h"
//#include <graphviz/gvc.h>
// TODO: This is a hack. For some reason, we don't get this with the libs we use. Should
// rebuild them?
//Agdesc_t Agdirected = { 1, 0, 0, 1 };
void
ModelGraph::rebuild_image(Model_Application *app, int type) {
/*
if(!app) {
image = Image();
return;
}
#ifndef _DEBUG // NOTE: Currently we don't have debug versions of the graphviz libraries
GVC_t *gvc = gvContext();
Agraph_t *g = agopen("Model graph", Agdirected, 0);
if(type == 0)
build_flux_graph(app, g, show_properties, show_flux_labels, show_short_names);
else if(type == 1)
build_distrib_connection_graph(app, g, show_short_names);
gvLayout(gvc, g, "dot");
char *data = nullptr;
unsigned int len = 0;
int res = gvRenderData(gvc, g, "bmp", &data, &len);
if(res >= 0) { // TODO: Correct error handling
image = StreamRaster::LoadAny(MemReadStream(data, len));
gvFreeRenderData(data);
} else {
fatal_error(Mobius_Error::internal, "Graphviz error when rendering model graph.");
}
gvFreeLayout(gvc, g);
agclose(g);
#endif
*/
Refresh();
}
void
ModelGraph::Paint(Draw& w) {
w.DrawRect(GetSize(), White());
#ifndef _DEBUG
w.DrawImage(0, 0, image);
#endif
}