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

Method generate

tools/monitor/NodeGenerator.cpp:137–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135}
136
137void
138Monitor::NodeGenerator::generate(TreeNode *t, QGraphicsScene *nodeScene, int w, int h, Node* parent)
139{
140 static int xpos = 0;
141 static int ypos = 0;
142
143 if (t == 0) {
144 return;
145 }
146
147 Node *node = 0;
148
149 QString text;
150 if (isNodeValid(t, text)) {
151
152 xpos = w * 100;
153 ypos += 50;
154
155 node = new Node(text, xpos, ypos, t);
156 node->setParent(parent);
157
158 // populate tooltips with the children
159 TreeNode *c;
160 std::ostringstream ttip;
161 for (int i = 0; i < t->size(); ++i) {
162 c = t->operator[](i);
163 std::string k = c->column(0).toString().toLocal8Bit().constData();
164 std::string v = c->column(1).toString().toLocal8Bit().constData();
165
166 ttip << k << " : " << v << std::endl;
167 }
168
169 node->setToolTip(ttip.str().c_str());
170
171 // this takes ownership of the node so the nodeScene will
172 // cleanup all nodes when it's destroyed
173 // TODO: This make each nodes parent the nodeScene. change this
174 // so parent is the actual parent node using setParent()
175 nodeScene->addItem(node);
176
177 // connect us to our parent with a dashed line
178 // connect us to the parent
179 if (parent && !nodeOpt_.hideParentChild()) {
180 // give edge an actual parent so that z-order works
181 Edge *edge = new Edge(parent, node, false, parent);
182 nodeScene->addItem(edge);
183 parent->addEdge(edge);
184 node->addEdge(edge);
185 }
186 // store node
187 if (parent && !nodeOpt_.hidePubSub()) {
188 nMap_[t] = node;
189 }
190 }
191
192 // draw the child nodes
193 ++w;
194 for (int i = 0; i < t->size(); ++i) {

Callers

nothing calls this directly

Calls 9

generateFunction · 0.85
columnMethod · 0.80
hideParentChildMethod · 0.80
addEdgeMethod · 0.80
hidePubSubMethod · 0.80
sizeMethod · 0.45
operator[]Method · 0.45
toStringMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected