25 #include "../model/State.h"
26 #include "../model/Transition.h"
40 #include <QApplication>
41 #include <QDesktopWidget>
46 graphvizContext(gvContext),
49 m_graph = std::make_shared<LockableGraph>();
50 std::unique_lock lock(m_graph->mutex);
51 m_graph->graph = agopen(name.toLatin1().data(), Agdirected, NULL);
52 ARMARX_INFO_S << m_graph->graph <<
" Creating Graph with name " << name.toLatin1().data();
54 int dpiX = qApp->desktop()->logicalDpiX();
57 agattr(m_graph->graph, AGRAPH, (
char*)
"dpi", (
char*)
"72");
58 agattr(m_graph->graph, AGRAPH, (
char*)
"bb", (
char*)
"0,0,1210,744");
59 agattr(m_graph->graph, AGRAPH, (
char*)
"size", (
char*)
"5,5");
60 agattr(m_graph->graph, AGRAPH, (
char*)
"overlap", (
char*)
"prism");
61 agattr(m_graph->graph, AGRAPH, (
char*)
"splines", (
char*)
"true");
62 agattr(m_graph->graph, AGRAPH, (
char*)
"pad", (
char*)
"0.2");
63 agattr(m_graph->graph, AGRAPH, (
char*)
"nodesep", (
char*)
"0.4");
64 agattr(m_graph->graph, AGRAPH, (
char*)
"sep", (
char*)
"1");
65 agattr(m_graph->graph, AGRAPH, (
char*)
"overlap_shrink", (
char*)
"true");
66 agattr(m_graph->graph, AGRAPH, (
char*)
"rankdir", (
char*)
"LR");
67 agattr(m_graph->graph, AGRAPH, (
char*)
"ratio", (
char*)
"compress");
79 agattr(m_graph->graph, AGNODE, (
char*)
"margin", (
char*)
"0,0");
80 agattr(m_graph->graph, AGNODE, (
char*)
"fontsize", (
char*)
"7");
81 agattr(m_graph->graph, AGEDGE, (
char*)
"fontsize", (
char*)
"14");
85 double test1 = atof(agget(m_graph->graph, (
char*)
"dpi"));
87 QString nodePtsWidth = QString(
"%1").arg(node_size / test1);
93 agattr(m_graph->graph, AGEDGE,
const_cast<char*
>(
"label"),
const_cast<char*
>(
""));
94 agattr(m_graph->graph, AGEDGE,
const_cast<char*
>(
"fontsize"),
const_cast<char*
>(
"25"));
100 std::unique_lock lock(m_graph->mutex);
101 agclose(m_graph->graph);
111 auto start = IceUtil::Time::now();
113 if (
true || layoutAll)
116 layoutWithAlgo(
"dot");
122 layoutWithAlgo(
"nop");
125 ARMARX_INFO_S << name <<
": Layouting took " << (IceUtil::Time::now() - start).toMilliSecondsDouble();
127 emit layoutingFinished();
134 emit buildGraph(m_graph);
138 void armarx::LayoutWorker::layoutWithAlgo(std::string algorithm)
140 std::unique_lock lock(m_graph->mutex);
145 gvLayout(graphvizContext, m_graph->graph, algorithm.c_str());
149 attach_attrs(m_graph->graph);
152 gvFreeLayout(graphvizContext, m_graph->graph);