Skip to content

Commit

Permalink
Added visualization of in and out edges for a Connection to dot repre…
Browse files Browse the repository at this point in the history
…sentation.
  • Loading branch information
blumenthal committed Jan 18, 2016
1 parent 57cd7d4 commit d7979db
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/wm_function_blocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ int main(int argc, char **argv) {
vector<brics_3d::rsg::Id> output;
vector<brics_3d::rsg::Id> output2;
// wm->executeFunctionBlock("pointcloudloader", input, output);
wmStructureVisualizer->setIsActive(false);
wmStructureVisualizer->setIsActive(true);
wm->executeFunctionBlock("osmloader", input, output);
wmStructureVisualizer->setIsActive(true);
wm->executeFunctionBlock("octreefilter", output, output2); // "stack them together"
Expand Down
18 changes: 18 additions & 0 deletions src/brics_3d/worldModel/sceneGraph/DotGraphGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,24 @@ void DotGraphGenerator::doHandleConnection(Connection* connection) {
nodes << "fillcolor=lightblue ";
nodes <<"]";
nodes << ";" << std::endl;

/* Add further edges for in going arcs */
for (unsigned int sourceIndex = 0; sourceIndex < connection->getNumberOfSourceNodes(); ++sourceIndex) {
if(config.abbreviateIds) {
edges << "\"" << uuidToUnsignedInt(connection->getSourceNode(sourceIndex)->getId()) << "\"" << " -> " << "\"" << uuidToUnsignedInt(connection->getId()) << "\"" << " [ style=dashed, label=\"in\" ] " << ";" << std::endl;
} else {
edges << "\"" << connection->getSourceNode(sourceIndex)->getId() << "\"" << " -> " << "\"" << connection->getId() << "\"" << " [ style=dashed, label=\"in\" ] " << ";" << std::endl;
}
}
/* Add further edges for out going arcs */
for (unsigned int targetIndex = 0; targetIndex < connection->getNumberOfTargetNodes(); ++targetIndex) {
if(config.abbreviateIds) {
edges << "\"" << uuidToUnsignedInt(connection->getId()) << "\"" << " -> " << "\"" << uuidToUnsignedInt(connection->getTargetNode(targetIndex)->getId()) << "\"" << " [ style=dashed, label=\"out\" ] " << ";" << std::endl;
} else {
edges << "\"" << connection->getId() << "\"" << " -> " << "\"" << connection->getTargetNode(targetIndex)->getId() << "\"" << " [ style=dashed, label=\"out\" ] " << ";" << std::endl;
}
}

}

void DotGraphGenerator::doHandleTransform(Transform* node) {
Expand Down

0 comments on commit d7979db

Please sign in to comment.