MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / draw

Method draw

tools/monitor/GraphGenerator.cpp:25–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23}
24
25void
26Monitor::GraphGenerator::draw ()
27{
28 // setup output file
29 if (gvOpt_.getDot() == "") {
30 throw "Null GvOpts. Can't open output file";
31 }
32
33 // TODO: check for errors and update status if error
34 fout.open(gvOpt_.getDot().c_str());
35
36 if (!fout) {
37 throw "Error opening file";
38 }
39
40 // erase old values
41 // currently, we only call draw once for an instance
42 // of graphgenerator, but this could change.
43 rMap_.clear();
44 wMap_.clear();
45 nMap_.clear();
46
47 while (!lifo_.empty()) {
48 lifo_.pop();
49 }
50
51 fout << "digraph OpenDDS {" << std::endl;
52 if (gvOpt_.lrLayout()) {
53 fout << " rankdir=LR;" << std::endl;
54 }
55 fout << " node [shape=record,height=.08,fontsize=11];" << std::endl;
56
57 generate(root_);
58
59 while (!lifo_.empty()) {
60 fout << lifo_.top();
61 lifo_.pop();
62 }
63
64 connectNodes();
65
66 // close dot file and generate png
67 fout << "}" << std::endl;
68
69 fout.close();
70
71 std::string cmd = gvOpt_.getBin();
72 cmd += " -Tpng ";
73 cmd += gvOpt_.getDot();
74 cmd += " > ";
75 cmd += gvOpt_.getPng();
76 int ret = system(cmd.c_str());
77
78 if (ret == -1) {
79 throw "Error converting dot file to png.";
80 }
81
82}

Callers

nothing calls this directly

Calls 10

generateFunction · 0.85
getDotMethod · 0.80
popMethod · 0.80
lrLayoutMethod · 0.80
getBinMethod · 0.80
getPngMethod · 0.80
openMethod · 0.45
clearMethod · 0.45
emptyMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected