luquet-ruby-graphviz 0.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/AUTHORS +7 -0
- data/COPYING +340 -0
- data/ChangeLog +66 -0
- data/README.rdoc +69 -0
- data/bin/ruby2gv +194 -0
- data/examples/HTML-Labels.rb +20 -0
- data/examples/arrowhead.rb +97 -0
- data/examples/dot/cluster.dot +31 -0
- data/examples/dot/fsm.dot +20 -0
- data/examples/dot/genetic.dot +118 -0
- data/examples/dot/hello.dot +1 -0
- data/examples/dot/hello_test.rb +14 -0
- data/examples/dot/lion_share.dot +103 -0
- data/examples/dot/prof.dot +150 -0
- data/examples/dot/psg.dot +28 -0
- data/examples/dot/sdh.dot +284 -0
- data/examples/dot/siblings.dot +492 -0
- data/examples/dot/test.dot +17 -0
- data/examples/dot/unix.dot +104 -0
- data/examples/graphviz.org/TrafficLights.rb +62 -0
- data/examples/graphviz.org/cluster.rb +62 -0
- data/examples/graphviz.org/hello_world.rb +10 -0
- data/examples/graphviz.org/lion_share.rb +215 -0
- data/examples/graphviz.org/process.rb +37 -0
- data/examples/maketest.sh +85 -0
- data/examples/p2p.rb +35 -0
- data/examples/sample01.rb +32 -0
- data/examples/sample02.rb +42 -0
- data/examples/sample03.rb +31 -0
- data/examples/sample04.rb +22 -0
- data/examples/sample05.rb +32 -0
- data/examples/sample06.rb +46 -0
- data/examples/sample07.rb +23 -0
- data/examples/sample08.rb +34 -0
- data/examples/sample09.rb +50 -0
- data/examples/sample10.rb +50 -0
- data/examples/sample11.rb +42 -0
- data/examples/sample12.rb +55 -0
- data/examples/sample13.rb +48 -0
- data/examples/sample14.rb +44 -0
- data/examples/sample15.rb +23 -0
- data/examples/sample16.rb +8 -0
- data/examples/sample17.rb +92 -0
- data/examples/sample18.rb +24 -0
- data/examples/sample19.rb +59 -0
- data/examples/sample20.rb +47 -0
- data/examples/sample21.rb +12 -0
- data/examples/sample22.rb +10 -0
- data/examples/sample23.rb +11 -0
- data/examples/sample24.rb +11 -0
- data/examples/sample25.rb +11 -0
- data/examples/shapes.rb +24 -0
- data/examples/test.xml +26 -0
- data/examples/testorder.rb +43 -0
- data/examples/testxml.rb +7 -0
- data/lib/graphviz.rb +655 -0
- data/lib/graphviz/attrs.rb +51 -0
- data/lib/graphviz/constants.rb +246 -0
- data/lib/graphviz/dot.treetop +97 -0
- data/lib/graphviz/edge.rb +130 -0
- data/lib/graphviz/node.rb +129 -0
- data/lib/graphviz/parser.rb +249 -0
- data/lib/graphviz/xml.rb +131 -0
- data/setup.rb +1585 -0
- metadata +176 -0
@@ -0,0 +1,51 @@
|
|
1
|
+
# Copyright (C) 2004, 2005, 2006, 2007, 2008 Gregoire Lejeune <gregoire.lejeune@free.fr>
|
2
|
+
#
|
3
|
+
# This program is free software; you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU General Public License as published by
|
5
|
+
# the Free Software Foundation; either version 2 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with this program; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
16
|
+
|
17
|
+
class GraphViz
|
18
|
+
class Attrs
|
19
|
+
@data
|
20
|
+
@name
|
21
|
+
@attributs
|
22
|
+
@graphviz
|
23
|
+
|
24
|
+
attr_accessor :data
|
25
|
+
|
26
|
+
def initialize( gviz, name, attributs )
|
27
|
+
@name = name
|
28
|
+
@attributs = attributs
|
29
|
+
@data = Hash::new( )
|
30
|
+
@graphviz = gviz
|
31
|
+
end
|
32
|
+
|
33
|
+
def []( xKey )
|
34
|
+
if @data.key?( xKey.to_s ) == false
|
35
|
+
nil
|
36
|
+
end
|
37
|
+
@data[xKey.to_s]
|
38
|
+
end
|
39
|
+
|
40
|
+
def []=( xKey, xValue )
|
41
|
+
if @attributs.index( xKey.to_s ).nil? == true
|
42
|
+
raise ArgumentError, "#{@name} attribut '#{xKey.to_s}' invalid"
|
43
|
+
end
|
44
|
+
@data[xKey.to_s] = xValue.to_s
|
45
|
+
|
46
|
+
if @graphviz.nil? == false
|
47
|
+
@graphviz.set_position( @name, xKey.to_s, xValue.to_s )
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,246 @@
|
|
1
|
+
# Copyright (C) 2004, 2005, 2006, 2007, 2008 Gregoire Lejeune <gregoire.lejeune@free.fr>
|
2
|
+
#
|
3
|
+
# This program is free software; you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU General Public License as published by
|
5
|
+
# the Free Software Foundation; either version 2 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with this program; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
16
|
+
|
17
|
+
module Constants
|
18
|
+
RGV_VERSION = "0.9.4"
|
19
|
+
|
20
|
+
## Const: Output formats
|
21
|
+
FORMATS = [
|
22
|
+
"bmp",
|
23
|
+
"canon",
|
24
|
+
"dot",
|
25
|
+
"xdot",
|
26
|
+
"cmap",
|
27
|
+
"dia",
|
28
|
+
"eps",
|
29
|
+
"fig",
|
30
|
+
"gd",
|
31
|
+
"gd2",
|
32
|
+
"gif",
|
33
|
+
"gtk",
|
34
|
+
"hpgl",
|
35
|
+
"ico",
|
36
|
+
"imap",
|
37
|
+
"cmapx",
|
38
|
+
"imap_np",
|
39
|
+
"cmapx_np",
|
40
|
+
"ismap",
|
41
|
+
"jpeg",
|
42
|
+
"jpg",
|
43
|
+
"jpe",
|
44
|
+
"mif",
|
45
|
+
"mp",
|
46
|
+
"pcl",
|
47
|
+
"pdf",
|
48
|
+
"pic",
|
49
|
+
"plain",
|
50
|
+
"plain-ext",
|
51
|
+
"png",
|
52
|
+
"ps",
|
53
|
+
"ps2",
|
54
|
+
"svg",
|
55
|
+
"svgz",
|
56
|
+
"tga",
|
57
|
+
"tiff",
|
58
|
+
"tif",
|
59
|
+
"vml",
|
60
|
+
"vmlz",
|
61
|
+
"vrml",
|
62
|
+
"vtx",
|
63
|
+
"wbmp",
|
64
|
+
"xlib",
|
65
|
+
"none"
|
66
|
+
]
|
67
|
+
|
68
|
+
## Const: programs
|
69
|
+
PROGRAMS = [
|
70
|
+
"dot",
|
71
|
+
"neato",
|
72
|
+
"twopi",
|
73
|
+
"fdp",
|
74
|
+
"circo"
|
75
|
+
]
|
76
|
+
|
77
|
+
## Const: graphs type
|
78
|
+
GRAPHTYPE = [
|
79
|
+
"digraph",
|
80
|
+
"graph"
|
81
|
+
]
|
82
|
+
|
83
|
+
def self.getAttrsFor( x )
|
84
|
+
r = []
|
85
|
+
GENCS_ATTRS.each { |k,v|
|
86
|
+
r << k if /#{x}/.match( x.to_s ) and not r.include?( k )
|
87
|
+
}
|
88
|
+
r
|
89
|
+
end
|
90
|
+
|
91
|
+
# E, N, G, S and C represent edges, nodes, the root graph, subgraphs and cluster subgraphs, respectively
|
92
|
+
GENCS_ATTRS = {
|
93
|
+
"Damping" => "G",
|
94
|
+
"K" => "GC",
|
95
|
+
"URL" => "ENGC",
|
96
|
+
"arrowhead" => "E",
|
97
|
+
"arrowsize" => "E",
|
98
|
+
"arrowtail" => "E",
|
99
|
+
"bb" => "G",
|
100
|
+
"bgcolor" => "GC",
|
101
|
+
# "bottomlabel" => "N",
|
102
|
+
"center" => "G",
|
103
|
+
"charset" => "G",
|
104
|
+
"clusterrank" => "G",
|
105
|
+
"color" => "ENC",
|
106
|
+
"colorscheme" => "ENCG",
|
107
|
+
"comment" => "ENG",
|
108
|
+
"compound" => "G",
|
109
|
+
"concentrate" => "G",
|
110
|
+
"constraint" => "E",
|
111
|
+
"decorate" => "E",
|
112
|
+
"defaultdist" => "G",
|
113
|
+
"dim" => "G",
|
114
|
+
"dir" => "E",
|
115
|
+
"diredgeconstraints" => "G",
|
116
|
+
"distortion" => "N",
|
117
|
+
"dpi" => "G",
|
118
|
+
"edgeURL" => "E",
|
119
|
+
"edgehref" => "E",
|
120
|
+
"edgetarget" => "E",
|
121
|
+
"edgetooltip" => "E",
|
122
|
+
"epsilon" => "G",
|
123
|
+
"esep" => "G",
|
124
|
+
"fillcolor" => "NC",
|
125
|
+
"fixedsize" => "N",
|
126
|
+
"fontcolor" => "ENGC",
|
127
|
+
"fontname" => "ENGC",
|
128
|
+
"fontnames" => "G",
|
129
|
+
"fontpath" => "G",
|
130
|
+
"fontsize" => "ENGC",
|
131
|
+
"group" => "N",
|
132
|
+
"headURL" => "E",
|
133
|
+
"headclip" => "E",
|
134
|
+
"headhref" => "E",
|
135
|
+
"headlabel" => "E",
|
136
|
+
"headport" => "E",
|
137
|
+
"headtarget" => "E",
|
138
|
+
"headtooltip" => "E",
|
139
|
+
"height" => "N",
|
140
|
+
"href" => "E",
|
141
|
+
"html" => "N", # API extension
|
142
|
+
"image" => "N",
|
143
|
+
"imagescale" => "N",
|
144
|
+
"label" => "ENGC",
|
145
|
+
"labelURL" => "E",
|
146
|
+
"labelangle" => "E",
|
147
|
+
"labeldistance" => "E",
|
148
|
+
"labelfloat" => "E",
|
149
|
+
"labelfontcolor" => "E",
|
150
|
+
"labelfontname" => "E",
|
151
|
+
"labelfontsize" => "E",
|
152
|
+
"labelhref" => "E",
|
153
|
+
"labeljust" => "GC",
|
154
|
+
"labelloc" => "GCN",
|
155
|
+
"labeltarget" => "E",
|
156
|
+
"labeltooltip" => "E",
|
157
|
+
"landscape" => "G",
|
158
|
+
"layer" => "EN",
|
159
|
+
"layers" => "G",
|
160
|
+
"layersep" => "G",
|
161
|
+
"len" => "E",
|
162
|
+
"levelsgap" => "G",
|
163
|
+
"lhead" => "E",
|
164
|
+
"lp" => "EGC",
|
165
|
+
"ltail" => "E",
|
166
|
+
"margin" => "NG",
|
167
|
+
"maxiter" => "G",
|
168
|
+
"mclimit" => "G",
|
169
|
+
"mindist" => "G",
|
170
|
+
"minlen" => "E",
|
171
|
+
"mode" => "G",
|
172
|
+
"model" => "G",
|
173
|
+
"mosek" => "G",
|
174
|
+
"nodesep" => "G",
|
175
|
+
"nojustify" => "GCNE",
|
176
|
+
"normalize" => "G",
|
177
|
+
"nslimit" => "G",
|
178
|
+
"nslimit1" => "G",
|
179
|
+
"ordering" => "G",
|
180
|
+
"orientation" => "NG",
|
181
|
+
"outputorder" => "G",
|
182
|
+
"overlap" => "G",
|
183
|
+
"pack" => "G",
|
184
|
+
"packmode" => "G",
|
185
|
+
"pad" => "G",
|
186
|
+
"page" => "G",
|
187
|
+
"pagedir" => "G",
|
188
|
+
"pencolor" => "C",
|
189
|
+
"penwidth" => "CNE",
|
190
|
+
"peripheries" => "NC",
|
191
|
+
"pin" => "N",
|
192
|
+
"pos" => "EN",
|
193
|
+
"quantum" => "G",
|
194
|
+
"rank" => "S",
|
195
|
+
"rankdir" => "G",
|
196
|
+
"ranksep" => "G",
|
197
|
+
"ratio" => "G",
|
198
|
+
"rects" => "N",
|
199
|
+
"regular" => "N",
|
200
|
+
"remincross" => "G",
|
201
|
+
"resolution" => "G",
|
202
|
+
"root" => "GN",
|
203
|
+
"rotate" => "G",
|
204
|
+
"samehead" => "E",
|
205
|
+
"sametail" => "E",
|
206
|
+
"samplepoints" => "G",
|
207
|
+
"searchsize" => "G",
|
208
|
+
"sep" => "G",
|
209
|
+
"shape" => "N",
|
210
|
+
"shapefile" => "N",
|
211
|
+
"showboxes" => "ENG",
|
212
|
+
"sides" => "N",
|
213
|
+
"size" => "G",
|
214
|
+
"skew" => "N",
|
215
|
+
"splines" => "G",
|
216
|
+
"start" => "G",
|
217
|
+
"style" => "ENC",
|
218
|
+
"stylesheet" => "G",
|
219
|
+
"tailURL" => "E",
|
220
|
+
"tailclip" => "E",
|
221
|
+
"tailhref" => "E",
|
222
|
+
"taillabel" => "E",
|
223
|
+
"tailport" => "E",
|
224
|
+
"tailtarget" => "E",
|
225
|
+
"tailtooltip" => "E",
|
226
|
+
"target" => "ENGC",
|
227
|
+
"tooltip" => "NEC",
|
228
|
+
# "toplabel" => "N",
|
229
|
+
"truecolor" => "G",
|
230
|
+
"vertices" => "N",
|
231
|
+
"viewport" => "G",
|
232
|
+
"voro_margin" => "G",
|
233
|
+
"weight" => "E",
|
234
|
+
"width" => "N",
|
235
|
+
"z" => "N"
|
236
|
+
}
|
237
|
+
|
238
|
+
## Const: Graph attributs
|
239
|
+
GRAPHSATTRS = Constants::getAttrsFor( :G ) + Constants::getAttrsFor( :S ) + Constants::getAttrsFor( :C )
|
240
|
+
|
241
|
+
## Const: Node attributs
|
242
|
+
NODESATTRS = Constants::getAttrsFor( :N )
|
243
|
+
|
244
|
+
## Const: Edge attributs
|
245
|
+
EDGESATTRS = Constants::getAttrsFor( :E )
|
246
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
grammar Dot
|
2
|
+
rule graph
|
3
|
+
space type:("graph" / "digraph") blank name:string space cluster:cluster space <GraphViz::Parser::Graph>
|
4
|
+
end
|
5
|
+
|
6
|
+
rule cluster
|
7
|
+
"{" content:(preference / node / edge / subgraph / rank)* "}" <GraphViz::Parser::Cluster>
|
8
|
+
end
|
9
|
+
|
10
|
+
rule preference
|
11
|
+
graph_preference / named_graph_preference / node_preference / edge_preference
|
12
|
+
end
|
13
|
+
|
14
|
+
rule graph_preference
|
15
|
+
space key:name blank "=" blank value:string separator <GraphViz::Parser::GraphPreference>
|
16
|
+
end
|
17
|
+
|
18
|
+
rule named_graph_preference
|
19
|
+
space "graph" blank options:options? separator <GraphViz::Parser::NamedGraphPreference>
|
20
|
+
end
|
21
|
+
|
22
|
+
rule node_preference
|
23
|
+
space "node" blank options:options? separator <GraphViz::Parser::NodePreference>
|
24
|
+
end
|
25
|
+
|
26
|
+
rule edge_preference
|
27
|
+
space "edge" blank options:options? separator <GraphViz::Parser::EdgePreference>
|
28
|
+
end
|
29
|
+
|
30
|
+
rule node
|
31
|
+
space name:string blank options:options? separator <GraphViz::Parser::Node>
|
32
|
+
end
|
33
|
+
|
34
|
+
rule edge
|
35
|
+
direct_edge / undirect_edge
|
36
|
+
end
|
37
|
+
|
38
|
+
rule direct_edge
|
39
|
+
space node_one:string blank "->" blank node_two:string blank other_nodes:("->" blank next_node:string blank)* options:options? separator <GraphViz::Parser::Edge>
|
40
|
+
end
|
41
|
+
|
42
|
+
rule undirect_edge
|
43
|
+
space node_one:string blank "--" blank node_two:string blank other_nodes:("--" blank next_node:string blank)* options:options? separator <GraphViz::Parser::Edge>
|
44
|
+
end
|
45
|
+
|
46
|
+
rule subgraph
|
47
|
+
space "subgraph" blank name:string space cluster:cluster space <GraphViz::Parser::Subgraph>
|
48
|
+
end
|
49
|
+
|
50
|
+
rule options
|
51
|
+
"[" space (name blank "=" blank string comma space)* name blank "=" blank string space "]" <GraphViz::Parser::Options>
|
52
|
+
end
|
53
|
+
|
54
|
+
rule string
|
55
|
+
name / quoted_string
|
56
|
+
end
|
57
|
+
|
58
|
+
rule comma
|
59
|
+
space ","
|
60
|
+
end
|
61
|
+
|
62
|
+
rule separator
|
63
|
+
blank ";" space
|
64
|
+
end
|
65
|
+
|
66
|
+
rule quoted_string
|
67
|
+
'"' [^"]* '"'
|
68
|
+
end
|
69
|
+
|
70
|
+
rule name
|
71
|
+
[a-zA-Z0-9_\.]+
|
72
|
+
end
|
73
|
+
|
74
|
+
rule blank
|
75
|
+
[\ \t]*
|
76
|
+
end
|
77
|
+
|
78
|
+
rule space
|
79
|
+
[\s\n\r\t]*
|
80
|
+
end
|
81
|
+
|
82
|
+
rule newline
|
83
|
+
CR LF
|
84
|
+
end
|
85
|
+
|
86
|
+
rule CR
|
87
|
+
[\r]?
|
88
|
+
end
|
89
|
+
|
90
|
+
rule LF
|
91
|
+
[\n]?
|
92
|
+
end
|
93
|
+
|
94
|
+
rule rank
|
95
|
+
space cluster:cluster space <GraphViz::Parser::Rank>
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,130 @@
|
|
1
|
+
# Copyright (C) 2004, 2005, 2006, 2007, 2008 Gregoire Lejeune <gregoire.lejeune@free.fr>
|
2
|
+
#
|
3
|
+
# This program is free software; you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU General Public License as published by
|
5
|
+
# the Free Software Foundation; either version 2 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with this program; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
16
|
+
|
17
|
+
require 'graphviz/attrs'
|
18
|
+
require 'graphviz/constants'
|
19
|
+
|
20
|
+
class GraphViz
|
21
|
+
class Edge
|
22
|
+
include Constants
|
23
|
+
@xNodeOne
|
24
|
+
@xNodeTwo
|
25
|
+
@oAttrEdge
|
26
|
+
@oGParrent
|
27
|
+
|
28
|
+
#
|
29
|
+
# Create a new edge
|
30
|
+
#
|
31
|
+
# In:
|
32
|
+
# * vNodeOne : First node
|
33
|
+
# * vNodeTwo : Second node
|
34
|
+
# * oGParrent : Graph
|
35
|
+
#
|
36
|
+
def initialize( vNodeOne, vNodeTwo, oGParrent = nil )
|
37
|
+
if vNodeOne.class == String
|
38
|
+
@xNodeOne = vNodeOne
|
39
|
+
else
|
40
|
+
@xNodeOne = vNodeOne.name
|
41
|
+
end
|
42
|
+
|
43
|
+
if vNodeTwo.class == String
|
44
|
+
@xNodeTwo = vNodeTwo
|
45
|
+
else
|
46
|
+
@xNodeTwo = vNodeTwo.name
|
47
|
+
end
|
48
|
+
|
49
|
+
@oGParrent = oGParrent
|
50
|
+
|
51
|
+
@oAttrEdge = GraphViz::Attrs::new( nil, "edge", EDGESATTRS )
|
52
|
+
end
|
53
|
+
|
54
|
+
#
|
55
|
+
# Set value +xAttrValue+ to the edge attribut +xAttrName+
|
56
|
+
#
|
57
|
+
def []=( xAttrName, xAttrValue )
|
58
|
+
xAttrValue = xAttrValue.to_s if xAttrValue.class == Symbol
|
59
|
+
@oAttrEdge[xAttrName.to_s] = xAttrValue
|
60
|
+
end
|
61
|
+
|
62
|
+
#
|
63
|
+
# Get the value of the node attribut +xAttrName+
|
64
|
+
#
|
65
|
+
def []( xAttrName )
|
66
|
+
@oAttrEdge[xAttrName.to_s].clone
|
67
|
+
end
|
68
|
+
|
69
|
+
def <<( oNode ) #:nodoc:
|
70
|
+
n = @oGParrent.get_node(@xNodeTwo)
|
71
|
+
|
72
|
+
GraphViz::commonGraph( oNode, n ).add_edge( n, oNode )
|
73
|
+
end
|
74
|
+
alias :> :<< #:nodoc:
|
75
|
+
alias :- :<< #:nodoc:
|
76
|
+
alias :>> :<< #:nodoc:
|
77
|
+
|
78
|
+
#
|
79
|
+
# Set edge attributs
|
80
|
+
#
|
81
|
+
# Example :
|
82
|
+
# e = graph.add_edge( ... )
|
83
|
+
# ...
|
84
|
+
# e.set { |_e|
|
85
|
+
# _e.color = "blue"
|
86
|
+
# _e.fontcolor = "red"
|
87
|
+
# }
|
88
|
+
#
|
89
|
+
def set( &b )
|
90
|
+
yield( self )
|
91
|
+
end
|
92
|
+
|
93
|
+
# Add edge options
|
94
|
+
# use edge.<option>=<value> or edge.<option>( <value> )
|
95
|
+
def method_missing( idName, *args, &block ) #:nodoc:
|
96
|
+
xName = idName.id2name
|
97
|
+
|
98
|
+
self[xName.gsub( /=$/, "" )]=args[0]
|
99
|
+
end
|
100
|
+
|
101
|
+
def output( oGraphType ) #:nodoc:
|
102
|
+
xLink = " -> "
|
103
|
+
if oGraphType == "graph"
|
104
|
+
xLink = " -- "
|
105
|
+
end
|
106
|
+
|
107
|
+
#xNodeNameOne = @xNodeOne.clone
|
108
|
+
#xNodeNameOne = '"' << xNodeNameOne << '"' if xNodeNameOne.match( /^[a-zA-Z_]+[a-zA-Z0-9_\.]*$/ ).nil?
|
109
|
+
xNodeNameOne = GraphViz.escape(@xNodeOne)
|
110
|
+
|
111
|
+
#xNodeNameTwo = @xNodeTwo.clone
|
112
|
+
#xNodeNameTwo = '"' << xNodeNameTwo << '"' if xNodeNameTwo.match( /^[a-zA-Z_]+[a-zA-Z0-9_\.]*$/ ).nil?
|
113
|
+
xNodeNameTwo = GraphViz.escape(@xNodeTwo)
|
114
|
+
|
115
|
+
xOut = xNodeNameOne + xLink + xNodeNameTwo
|
116
|
+
xAttr = ""
|
117
|
+
xSeparator = ""
|
118
|
+
@oAttrEdge.data.each do |k, v|
|
119
|
+
xAttr << xSeparator + k + " = " + GraphViz.escape(v, true)
|
120
|
+
xSeparator = ", "
|
121
|
+
end
|
122
|
+
if xAttr.length > 0
|
123
|
+
xOut << " [" + xAttr + "]"
|
124
|
+
end
|
125
|
+
xOut + ";"
|
126
|
+
|
127
|
+
return( xOut )
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|