9 .. module:: pygraphvizfactory
11 :synopsis: Repackaging of the limiting ROS qt_dotgraph.pygraphvizfactory module.
13 Oh my spaghettified magnificence,
14 Bless my noggin with a tickle from your noodly appendages!
35 def get_graph(self, graph_type='digraph', rank='same', simplify=True, rankdir='TB', ranksep=0.2, compound=True):
36 graph = pygraphviz.AGraph(directed=(graph_type ==
'digraph'), ranksep=ranksep, rankdir=rankdir, rank=rank, compound=
True, simplify=simplify)
48 creates a node item for this factory, adds it to the graph.
49 Node name can vary from label but must always be same for the same node label
51 if nodename
is None or nodename ==
'':
52 raise ValueError(
'Empty Node name')
57 if tooltip
is not None:
58 kwargs[
'tooltip'] = tooltip
60 kwargs[
'color'] = color
62 graph.add_node(nodename, label=str(nodelabel), shape=shape, url=url, **kwargs)
76 creates a cluster subgraph item for this factory, adds it to the graph.
77 cluster name can vary from label but must always be same for the same node label.
78 Most layouters require cluster names to start with cluster.
80 if subgraphlabel
is None or subgraphlabel ==
'':
81 raise ValueError(
'Empty subgraph label')
83 sg = graph.add_subgraph(name=
"cluster_%s" % subgraphlabel, ranksep=ranksep, rankdir=rankdir, rank=rank, compound=compound, label=str(subgraphlabel), style=style, color=color)
87 def add_edge_to_graph(self, graph, nodename1, nodename2, label=None, url=None, simplify=True, style=None, penwidth=1, color=None):
90 kwargs[
'label'] = label
92 kwargs[
'style'] = style
93 kwargs[
'penwidth'] = str(penwidth)
95 kwargs[
'colorR'] = str(color[0])
96 kwargs[
'colorG'] = str(color[1])
97 kwargs[
'colorB'] = str(color[2])
98 graph.add_edge(nodename1, nodename2, **kwargs)
103 return graph.string().replace(
"\\\n",
"")