| 101 | } |
| 102 | |
| 103 | void |
| 104 | Monitor::GraphGenerator::generate(TreeNode *t) |
| 105 | { |
| 106 | if (t == 0) { |
| 107 | return; |
| 108 | } |
| 109 | |
| 110 | bool hasSubG = false; // used to know when to push '}' to end subgraphs |
| 111 | bool stopDescent = false; // flag to stop visiting children. |
| 112 | |
| 113 | // print this node |
| 114 | // skip the root and make sure we have a key AND a value |
| 115 | if (t != root_ && t->width() >= 2) { |
| 116 | if (!honorDisplayFlag_ || (honorDisplayFlag_ && t->display())) { |
| 117 | std::string key = t->column(0).toString().toLocal8Bit().constData(); |
| 118 | std::string val = t->column(1).toString().toLocal8Bit().constData(); |
| 119 | htmlEncode(key); |
| 120 | htmlEncode(val); |
| 121 | QColor kc = (t->color(0)).value<QColor>(); |
| 122 | QColor vc = (t->color(1)).value<QColor>(); |
| 123 | |
| 124 | // host and process nodes |
| 125 | if ((key == "Host" && !gvOpt_.ignoreHosts()) || |
| 126 | (key == "Process" && !gvOpt_.ignoreProcs()) || |
| 127 | (key == "DomainParticipant")) { |
| 128 | |
| 129 | if (key == "DomainParticipant" && gvOpt_.abbrGUIDs()) { |
| 130 | val = abbr(val); |
| 131 | } |
| 132 | |
| 133 | hasSubG = true; |
| 134 | |
| 135 | std::string id("\"cluster_"); |
| 136 | id += nodeName(); |
| 137 | id += "\""; |
| 138 | fout << "subgraph " << id << " {" << std::endl; |
| 139 | fout << " label=\"" << key << ":" << val << "\";" << std::endl; |
| 140 | lifo_.push("}\n"); |
| 141 | } |
| 142 | else if ((key == "Publisher" && !gvOpt_.ignorePubs()) || |
| 143 | (key == "Subscriber" && !gvOpt_.ignoreSubs())) { |
| 144 | hasSubG = true; |
| 145 | |
| 146 | std::string id("\"cluster_"); |
| 147 | id += nodeName(); |
| 148 | |
| 149 | fout << "subgraph " << id << "\" {" << std::endl; |
| 150 | fout << " label=\"" << key << ":" << val << "\";" << std::endl; |
| 151 | |
| 152 | lifo_.push("}\n"); |
| 153 | } |
| 154 | else if (key == "Topic" && !gvOpt_.hideTopics()) { |
| 155 | // TODO: The Topic and Transport logic is ugly. It needs to be refactored |
| 156 | // Perhaps break this long if..else clause into seaprate methods |
| 157 | // for each type of node. |
| 158 | |
| 159 | // Topic is a node has GUID and TopicName |
| 160 | stopDescent = true; // no need to go below a topic |
nothing calls this directly
no test coverage detected