ruby-graphviz_c 1.1.0
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.
- checksums.yaml +7 -0
- data/.gemrc +0 -0
- data/.gitignore +9 -0
- data/.travis.yml +7 -0
- data/AUTHORS.rdoc +33 -0
- data/CHANGELOG.rdoc +287 -0
- data/COPYING.rdoc +133 -0
- data/Gemfile +4 -0
- data/README.rdoc +206 -0
- data/Rakefile +71 -0
- data/bin/dot2ruby +91 -0
- data/bin/gem2gv +165 -0
- data/bin/git2gv +167 -0
- data/bin/ruby2gv +234 -0
- data/bin/xml2gv +96 -0
- data/examples/dot/JSP.dot +52 -0
- data/examples/dot/balanced.dot +36 -0
- data/examples/dot/cluster.dot +30 -0
- data/examples/dot/dotgraph.dot +28 -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 +33 -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/rank.dot +6 -0
- data/examples/dot/sdh.dot +284 -0
- data/examples/dot/siblings.dot +492 -0
- data/examples/dot/so-sample001.gv +30 -0
- data/examples/dot/so-sample002.gv +33 -0
- data/examples/dot/so-sample003.gv +45 -0
- data/examples/dot/test.dot +17 -0
- data/examples/dot/test_parse.rb +13 -0
- data/examples/dot/this_crach_with_dot_2.20.dot +24 -0
- data/examples/dot/unix.dot +104 -0
- data/examples/graphml/attributes.ext.graphml +12 -0
- data/examples/graphml/attributes.graphml +40 -0
- data/examples/graphml/cluster.graphml +75 -0
- data/examples/graphml/failed_graph.graphml +461 -0
- data/examples/graphml/hyper.graphml +29 -0
- data/examples/graphml/nested.graphml +54 -0
- data/examples/graphml/port.graphml +32 -0
- data/examples/graphml/simple.graphml +30 -0
- data/examples/hello.png +0 -0
- data/examples/rgv/rgv.ps +125 -0
- data/examples/rgv/test_rgv.rb +12 -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 +25 -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/sample26.rb +8 -0
- data/examples/sample27.rb +8 -0
- data/examples/sample28.rb +12 -0
- data/examples/sample29.rb +8 -0
- data/examples/sample30.rb +12 -0
- data/examples/sample31.rb +10 -0
- data/examples/sample32.rb +14 -0
- data/examples/sample33.rb +43 -0
- data/examples/sample34.rb +29 -0
- data/examples/sample35.rb +43 -0
- data/examples/sample36.rb +35 -0
- data/examples/sample37.rb +87 -0
- data/examples/sample38.rb +12 -0
- data/examples/sample39.rb +11 -0
- data/examples/sample40.rb +17 -0
- data/examples/sample41.rb +8 -0
- data/examples/sample42.rb +35 -0
- data/examples/sample43.rb +26 -0
- data/examples/sample44.rb +97 -0
- data/examples/sample45.rb +24 -0
- data/examples/sample46.rb +43 -0
- data/examples/sample47.rb +7 -0
- data/examples/sample48.rb +62 -0
- data/examples/sample49.rb +10 -0
- data/examples/sample50.rb +215 -0
- data/examples/sample51.rb +37 -0
- data/examples/sample52.rb +62 -0
- data/examples/sample53.rb +26 -0
- data/examples/sample54.rb +26 -0
- data/examples/sample55.rb +9 -0
- data/examples/sample56.rb +10 -0
- data/examples/sample57.rb +8 -0
- data/examples/sample58.rb +33 -0
- data/examples/sample59.rb +14 -0
- data/examples/sample60.rb +12 -0
- data/examples/sample61.rb +12 -0
- data/examples/sample62.rb +24 -0
- data/examples/sample63.rb +32 -0
- data/examples/sample64.rb +31 -0
- data/examples/sample65.rb +9 -0
- data/examples/sample66.rb +4 -0
- data/examples/sample67.rb +10 -0
- data/examples/sample68.rb +27 -0
- data/examples/sample69.rb +23 -0
- data/examples/sample70.rb +9 -0
- data/examples/sample99.rb +70 -0
- data/examples/sdlshapes/README +2 -0
- data/examples/sdlshapes/sdl.ps +655 -0
- data/examples/sdlshapes/sdlshapes.dot +78 -0
- data/examples/test.xml +26 -0
- data/examples/theory/pert.rb +47 -0
- data/examples/theory/tests.rb +87 -0
- data/lib/ext/gvpr/dot2ruby.g +185 -0
- data/lib/graphviz/attrs.rb +73 -0
- data/lib/graphviz/constants.rb +294 -0
- data/lib/graphviz/core_ext.rb +64 -0
- data/lib/graphviz/dot2ruby.rb +59 -0
- data/lib/graphviz/dot_script.rb +109 -0
- data/lib/graphviz/dsl.rb +67 -0
- data/lib/graphviz/edge.rb +197 -0
- data/lib/graphviz/elements.rb +39 -0
- data/lib/graphviz/ext.rb +17 -0
- data/lib/graphviz/family_tree/couple.rb +63 -0
- data/lib/graphviz/family_tree/generation.rb +39 -0
- data/lib/graphviz/family_tree/person.rb +120 -0
- data/lib/graphviz/family_tree/sibling.rb +13 -0
- data/lib/graphviz/family_tree.rb +118 -0
- data/lib/graphviz/graphml.rb +268 -0
- data/lib/graphviz/math/matrix.rb +221 -0
- data/lib/graphviz/node.rb +160 -0
- data/lib/graphviz/nothugly/nothugly.xsl +321 -0
- data/lib/graphviz/nothugly.rb +63 -0
- data/lib/graphviz/theory.rb +321 -0
- data/lib/graphviz/types/arrow_type.rb +32 -0
- data/lib/graphviz/types/color.rb +58 -0
- data/lib/graphviz/types/color_list.rb +24 -0
- data/lib/graphviz/types/esc_string.rb +20 -0
- data/lib/graphviz/types/gv_bool.rb +49 -0
- data/lib/graphviz/types/gv_double.rb +32 -0
- data/lib/graphviz/types/html_string.rb +18 -0
- data/lib/graphviz/types/lbl_string.rb +22 -0
- data/lib/graphviz/types/rect.rb +35 -0
- data/lib/graphviz/types/spline_type.rb +77 -0
- data/lib/graphviz/types.rb +22 -0
- data/lib/graphviz/utils/colors.rb +1018 -0
- data/lib/graphviz/utils.rb +70 -0
- data/lib/graphviz/xml.rb +119 -0
- data/lib/graphviz.rb +967 -0
- data/lib/ruby-graphviz.rb +1 -0
- data/man/dot2ruby.1 +66 -0
- data/man/dot2ruby.1.ronn +55 -0
- data/man/gem2gv.1 +60 -0
- data/man/gem2gv.1.ronn +47 -0
- data/man/git2gv.1 +48 -0
- data/man/git2gv.1.ronn +40 -0
- data/man/ruby2gv.1 +60 -0
- data/man/ruby2gv.1.ronn +47 -0
- data/man/xml2gv.1 +48 -0
- data/man/xml2gv.1.ronn +39 -0
- data/ruby-graphviz.gemspec +47 -0
- data/setup.rb +1585 -0
- data/test/helper.rb +13 -0
- data/test/support.rb +95 -0
- data/test/test_dot_script.rb +47 -0
- data/test/test_examples.rb +151 -0
- data/test/test_graph.rb +115 -0
- data/test/test_search.rb +29 -0
- data/test/test_subgraph.rb +27 -0
- data/test/test_theory.rb +98 -0
- data/test/test_types.rb +65 -0
- data/test/test_utils_colors.rb +52 -0
- metadata +301 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# Copyright (C) 2004 - 2011 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 Node
|
|
22
|
+
include GraphViz::Constants
|
|
23
|
+
|
|
24
|
+
# List of nodes that are directly accessible from given node (in a directed graph neighbors == incidents)
|
|
25
|
+
attr_reader :neighbors
|
|
26
|
+
# List of nodes that are incident to the given node (in a directed graph neighbors == incidents)
|
|
27
|
+
attr_reader :incidents
|
|
28
|
+
|
|
29
|
+
# Create a new node
|
|
30
|
+
#
|
|
31
|
+
# * node_id : ID of the node
|
|
32
|
+
# * parent_graph : Graph
|
|
33
|
+
def initialize( node_id, parent_graph )
|
|
34
|
+
@neighbors = []
|
|
35
|
+
@incidents = []
|
|
36
|
+
@node_id = node_id
|
|
37
|
+
@parent_graph = parent_graph
|
|
38
|
+
@node_attributes = GraphViz::Attrs::new( nil, "node", NODESATTRS )
|
|
39
|
+
@index = nil
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Get the node ID
|
|
43
|
+
def id
|
|
44
|
+
@node_id.clone
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Return the node index
|
|
48
|
+
def index
|
|
49
|
+
@index
|
|
50
|
+
end
|
|
51
|
+
def index=(i) #:nodoc:
|
|
52
|
+
@index = i if @index == nil
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Return the root graph
|
|
56
|
+
def root_graph
|
|
57
|
+
return( (self.pg.nil?) ? nil : self.pg.root_graph )
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Set value +attribute_value+ to the node attribute +attribute_name+
|
|
61
|
+
def []=( attribute_name, attribute_value )
|
|
62
|
+
attribute_value = attribute_value.to_s if attribute_value.class == Symbol
|
|
63
|
+
@node_attributes[attribute_name.to_s] = attribute_value
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Get the value of the node attribute +attribute_name+
|
|
67
|
+
def []( attribute_name )
|
|
68
|
+
if Hash === attribute_name
|
|
69
|
+
attribute_name.each do |key, value|
|
|
70
|
+
self[key] = value
|
|
71
|
+
end
|
|
72
|
+
return self
|
|
73
|
+
else
|
|
74
|
+
(@node_attributes[attribute_name.to_s].nil?)?nil:@node_attributes[attribute_name.to_s].clone
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Calls block once for each attribute of the node, passing the name and value to the
|
|
79
|
+
# block as a two-element array.
|
|
80
|
+
#
|
|
81
|
+
# If global is set to false, the block does not receive the attributes set globally
|
|
82
|
+
def each_attribute(global = true, &b)
|
|
83
|
+
attrs = @node_attributes.to_h
|
|
84
|
+
if global
|
|
85
|
+
attrs = pg.node.to_h.merge attrs
|
|
86
|
+
end
|
|
87
|
+
attrs.each do |k,v|
|
|
88
|
+
yield(k,v)
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
def each_attribut(global = true, &b)
|
|
92
|
+
warn "`GraphViz::Node#each_attribut` is deprecated, please use `GraphViz::Node#each_attribute`"
|
|
93
|
+
each_attribute(global, &b)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Create an edge between the current node and the node +node+
|
|
97
|
+
def <<( node )
|
|
98
|
+
if( node.class == Array )
|
|
99
|
+
node.each do |no|
|
|
100
|
+
self << no
|
|
101
|
+
end
|
|
102
|
+
else
|
|
103
|
+
return GraphViz::commonGraph( node, self ).add_edges( self, node )
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
alias :> :<<
|
|
107
|
+
alias :- :<<
|
|
108
|
+
alias :>> :<<
|
|
109
|
+
|
|
110
|
+
# Set node attributes
|
|
111
|
+
#
|
|
112
|
+
# Example :
|
|
113
|
+
# n = graph.add_nodes( ... )
|
|
114
|
+
# ...
|
|
115
|
+
# n.set { |_n|
|
|
116
|
+
# _n.color = "blue"
|
|
117
|
+
# _n.fontcolor = "red"
|
|
118
|
+
# }
|
|
119
|
+
#
|
|
120
|
+
def set( &b )
|
|
121
|
+
yield( self )
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# Add node options
|
|
125
|
+
# use node.<option>=<value> or node.<option>( <value> )
|
|
126
|
+
def method_missing( idName, *args, &block ) #:nodoc:
|
|
127
|
+
xName = idName.id2name
|
|
128
|
+
|
|
129
|
+
self[xName.gsub( /=$/, "" )]=args[0]
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def pg #:nodoc:
|
|
133
|
+
@parent_graph
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def output #:nodoc:
|
|
137
|
+
#node_id = @node_id.clone
|
|
138
|
+
#node_id = '"' << node_id << '"' if node_id.match( /^[a-zA-Z_]+[a-zA-Z0-9_\.]*$/ ).nil?
|
|
139
|
+
node_id = GraphViz.escape(@node_id)
|
|
140
|
+
|
|
141
|
+
xOut = "" << node_id
|
|
142
|
+
xAttr = ""
|
|
143
|
+
xSeparator = ""
|
|
144
|
+
|
|
145
|
+
if @node_attributes.data.has_key?("label") and @node_attributes.data.has_key?("html")
|
|
146
|
+
@node_attributes.data.delete("label")
|
|
147
|
+
end
|
|
148
|
+
@node_attributes.data.each do |k, v|
|
|
149
|
+
xAttr << xSeparator + k + " = " + v.to_gv
|
|
150
|
+
xSeparator = ", "
|
|
151
|
+
end
|
|
152
|
+
if xAttr.length > 0
|
|
153
|
+
xOut << " [" + xAttr + "]"
|
|
154
|
+
end
|
|
155
|
+
xOut << ";"
|
|
156
|
+
|
|
157
|
+
return( xOut )
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
end
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
<?xml version="1.0" ?>
|
|
2
|
+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
|
|
3
|
+
xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg">
|
|
4
|
+
<xsl:output method="xml" indent="yes"
|
|
5
|
+
doctype-public="-//W3C//DTD SVG 1.0//EN"
|
|
6
|
+
doctype-system="http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"/>
|
|
7
|
+
|
|
8
|
+
<xsl:template match="@*|node()">
|
|
9
|
+
<xsl:copy>
|
|
10
|
+
<xsl:apply-templates select="@*|node()"/>
|
|
11
|
+
</xsl:copy>
|
|
12
|
+
</xsl:template>
|
|
13
|
+
|
|
14
|
+
<xsl:template match="svg:svg">
|
|
15
|
+
<svg xmlns="http://www.w3.org/2000/svg">
|
|
16
|
+
<!-- Order is important here, so the attributes below overrides the
|
|
17
|
+
originals, which are copied "wholesale" -->
|
|
18
|
+
<xsl:apply-templates select="@*" />
|
|
19
|
+
|
|
20
|
+
<defs>
|
|
21
|
+
<linearGradient id="white" x1="0%" y1="0%" x2="0%" y2="0%">
|
|
22
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
23
|
+
</linearGradient>
|
|
24
|
+
|
|
25
|
+
<linearGradient id="aquamarine" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
26
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
27
|
+
<stop offset="100%" style="stop-color:rgb(127,255,212);stop-opacity:1"/>
|
|
28
|
+
</linearGradient>
|
|
29
|
+
|
|
30
|
+
<linearGradient id="azure" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
31
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
32
|
+
<stop offset="100%" style="stop-color:rgb(240,255,255);stop-opacity:1"/>
|
|
33
|
+
</linearGradient>
|
|
34
|
+
|
|
35
|
+
<linearGradient id="blue" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
36
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
37
|
+
<stop offset="100%" style="stop-color:rgb(0,0,255);stop-opacity:1"/>
|
|
38
|
+
</linearGradient>
|
|
39
|
+
|
|
40
|
+
<linearGradient id="blueviolet" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
41
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
42
|
+
<stop offset="100%" style="stop-color:rgb(138,43,226);stop-opacity:1"/>
|
|
43
|
+
</linearGradient>
|
|
44
|
+
|
|
45
|
+
<linearGradient id="brown" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
46
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
47
|
+
<stop offset="100%" style="stop-color:rgb(165,42,42);stop-opacity:1"/>
|
|
48
|
+
</linearGradient>
|
|
49
|
+
|
|
50
|
+
<linearGradient id="cadetblue" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
51
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
52
|
+
<stop offset="100%" style="stop-color:rgb(95,158,160);stop-opacity:1"/>
|
|
53
|
+
</linearGradient>
|
|
54
|
+
|
|
55
|
+
<linearGradient id="chocolate" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
56
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
57
|
+
<stop offset="100%" style="stop-color:rgb(210,105,30);stop-opacity:1"/>
|
|
58
|
+
</linearGradient>
|
|
59
|
+
|
|
60
|
+
<linearGradient id="cornflowerblue" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
61
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
62
|
+
<stop offset="100%" style="stop-color:rgb(100,149,237);stop-opacity:1"/>
|
|
63
|
+
</linearGradient>
|
|
64
|
+
|
|
65
|
+
<linearGradient id="crimson" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
66
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
67
|
+
<stop offset="100%" style="stop-color:rgb(220,20,60);stop-opacity:1"/>
|
|
68
|
+
</linearGradient>
|
|
69
|
+
|
|
70
|
+
<linearGradient id="cyan" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
71
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
72
|
+
<stop offset="100%" style="stop-color:rgb(0,255,255);stop-opacity:1"/>
|
|
73
|
+
</linearGradient>
|
|
74
|
+
|
|
75
|
+
<linearGradient id="darkgreen" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
76
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
77
|
+
<stop offset="100%" style="stop-color:rgb(0,100,0);stop-opacity:1"/>
|
|
78
|
+
</linearGradient>
|
|
79
|
+
|
|
80
|
+
<linearGradient id="darkorange" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
81
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
82
|
+
<stop offset="100%" style="stop-color:rgb(255,140,0);stop-opacity:1"/>
|
|
83
|
+
</linearGradient>
|
|
84
|
+
|
|
85
|
+
<linearGradient id="gold" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
86
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
87
|
+
<stop offset="100%" style="stop-color:rgb(255,215,0);stop-opacity:1"/>
|
|
88
|
+
</linearGradient>
|
|
89
|
+
|
|
90
|
+
<linearGradient id="gray" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
91
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
92
|
+
<stop offset="100%" style="stop-color:rgb(192,192,192);stop-opacity:1"/>
|
|
93
|
+
</linearGradient>
|
|
94
|
+
|
|
95
|
+
<linearGradient id="greenyellow" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
96
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
97
|
+
<stop offset="100%" style="stop-color:rgb(173,255,47);stop-opacity:1"/>
|
|
98
|
+
</linearGradient>
|
|
99
|
+
|
|
100
|
+
<linearGradient id="green" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
101
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
102
|
+
<stop offset="100%" style="stop-color:rgb(0,255,0);stop-opacity:1"/>
|
|
103
|
+
</linearGradient>
|
|
104
|
+
|
|
105
|
+
<linearGradient id="grey" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
106
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
107
|
+
<stop offset="100%" style="stop-color:rgb(192,192,192);stop-opacity:1"/>
|
|
108
|
+
</linearGradient>
|
|
109
|
+
|
|
110
|
+
<linearGradient id="hotpink" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
111
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
112
|
+
<stop offset="100%" style="stop-color:rgb(255,105,180);stop-opacity:1"/>
|
|
113
|
+
</linearGradient>
|
|
114
|
+
|
|
115
|
+
<linearGradient id="indianred" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
116
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
117
|
+
<stop offset="100%" style="stop-color:rgb(205,92,92);stop-opacity:1"/>
|
|
118
|
+
</linearGradient>
|
|
119
|
+
|
|
120
|
+
<linearGradient id="indigo" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
121
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
122
|
+
<stop offset="100%" style="stop-color:rgb(75,0,130);stop-opacity:1"/>
|
|
123
|
+
</linearGradient>
|
|
124
|
+
|
|
125
|
+
<linearGradient id="lavender" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
126
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
127
|
+
<stop offset="100%" style="stop-color:rgb(230,230,250);stop-opacity:1"/>
|
|
128
|
+
</linearGradient>
|
|
129
|
+
|
|
130
|
+
<linearGradient id="lightblue" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
131
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
132
|
+
<stop offset="100%" style="stop-color:rgb(173,216,230);stop-opacity:1"/>
|
|
133
|
+
</linearGradient>
|
|
134
|
+
|
|
135
|
+
<linearGradient id="lightgray" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
136
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
137
|
+
<stop offset="100%" style="stop-color:rgb(211,211,211);stop-opacity:1"/>
|
|
138
|
+
</linearGradient>
|
|
139
|
+
|
|
140
|
+
<linearGradient id="lightgrey" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
141
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
142
|
+
<stop offset="100%" style="stop-color:rgb(211,211,211);stop-opacity:1"/>
|
|
143
|
+
</linearGradient>
|
|
144
|
+
|
|
145
|
+
<linearGradient id="magenta" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
146
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
147
|
+
<stop offset="100%" style="stop-color:rgb(255,0,255);stop-opacity:1"/>
|
|
148
|
+
</linearGradient>
|
|
149
|
+
|
|
150
|
+
<linearGradient id="maroon" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
151
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
152
|
+
<stop offset="100%" style="stop-color:rgb(176,48,96);stop-opacity:1"/>
|
|
153
|
+
</linearGradient>
|
|
154
|
+
|
|
155
|
+
<linearGradient id="mediumblue" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
156
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
157
|
+
<stop offset="100%" style="stop-color:rgb(0,0,205);stop-opacity:1"/>
|
|
158
|
+
</linearGradient>
|
|
159
|
+
|
|
160
|
+
<linearGradient id="mediumpurple" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
161
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
162
|
+
<stop offset="100%" style="stop-color:rgb(147,112,219);stop-opacity:1"/>
|
|
163
|
+
</linearGradient>
|
|
164
|
+
|
|
165
|
+
<linearGradient id="orange" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
166
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
167
|
+
<stop offset="100%" style="stop-color:rgb(255,165,0);stop-opacity:1"/>
|
|
168
|
+
</linearGradient>
|
|
169
|
+
|
|
170
|
+
<linearGradient id="pink" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
171
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
172
|
+
<stop offset="100%" style="stop-color:rgb(255,192,203);stop-opacity:1"/>
|
|
173
|
+
</linearGradient>
|
|
174
|
+
|
|
175
|
+
<linearGradient id="purple" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
176
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
177
|
+
<stop offset="100%" style="stop-color:rgb(160,32,240);stop-opacity:1"/>
|
|
178
|
+
</linearGradient>
|
|
179
|
+
|
|
180
|
+
<linearGradient id="red" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
181
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
182
|
+
<stop offset="100%" style="stop-color:rgb(255,0,0);stop-opacity:1"/>
|
|
183
|
+
</linearGradient>
|
|
184
|
+
|
|
185
|
+
<linearGradient id="steelblue" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
186
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
187
|
+
<stop offset="100%" style="stop-color:rgb(70,130,180);stop-opacity:1"/>
|
|
188
|
+
</linearGradient>
|
|
189
|
+
|
|
190
|
+
<linearGradient id="violet" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
191
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
192
|
+
<stop offset="100%" style="stop-color:rgb(238,130,238);stop-opacity:1"/>
|
|
193
|
+
</linearGradient>
|
|
194
|
+
|
|
195
|
+
<linearGradient id="yellow" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
196
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
197
|
+
<stop offset="100%" style="stop-color:rgb(255,255,0);stop-opacity:1"/>
|
|
198
|
+
</linearGradient>
|
|
199
|
+
|
|
200
|
+
<linearGradient id="none" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
201
|
+
<stop offset="0%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
202
|
+
<stop offset="100%" style="stop-color:rgb(255,255,255);stop-opacity:1"/>
|
|
203
|
+
</linearGradient>
|
|
204
|
+
</defs>
|
|
205
|
+
|
|
206
|
+
<xsl:apply-templates />
|
|
207
|
+
</svg>
|
|
208
|
+
</xsl:template>
|
|
209
|
+
|
|
210
|
+
<!-- Match the top most "g" -->
|
|
211
|
+
<xsl:template match="/svg:svg/svg:g">
|
|
212
|
+
<g>
|
|
213
|
+
<xsl:apply-templates select="@*"/>
|
|
214
|
+
<!-- Graphviz uses a polygon as the background. Don't want a gradient there -->
|
|
215
|
+
<xsl:for-each select="svg:polygon">
|
|
216
|
+
<xsl:copy><xsl:apply-templates select="@*" /></xsl:copy>
|
|
217
|
+
</xsl:for-each>
|
|
218
|
+
<xsl:apply-templates select="svg:title|svg:g" />
|
|
219
|
+
</g>
|
|
220
|
+
</xsl:template>
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
<xsl:template match="svg:text">
|
|
224
|
+
<text>
|
|
225
|
+
<xsl:apply-templates select="@*" />
|
|
226
|
+
<xsl:attribute name="style">font-size:10px; font-family:Verdana</xsl:attribute>
|
|
227
|
+
<xsl:apply-templates select="text()"/>
|
|
228
|
+
</text>
|
|
229
|
+
</xsl:template>
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
<xsl:template match="svg:g">
|
|
233
|
+
<xsl:copy>
|
|
234
|
+
<xsl:apply-templates select="@*" />
|
|
235
|
+
|
|
236
|
+
<xsl:for-each select="svg:polygon|svg:ellipse">
|
|
237
|
+
<xsl:call-template name="poly-shadow" />
|
|
238
|
+
</xsl:for-each>
|
|
239
|
+
|
|
240
|
+
<xsl:choose>
|
|
241
|
+
<xsl:when test="@class='node'">
|
|
242
|
+
<xsl:for-each select="svg:path">
|
|
243
|
+
<xsl:call-template name="path-shadow" />
|
|
244
|
+
</xsl:for-each>
|
|
245
|
+
</xsl:when>
|
|
246
|
+
<xsl:otherwise>
|
|
247
|
+
<xsl:for-each select="svg:path">
|
|
248
|
+
<xsl:call-template name="path-shadow-edge" />
|
|
249
|
+
</xsl:for-each>
|
|
250
|
+
</xsl:otherwise>
|
|
251
|
+
</xsl:choose>
|
|
252
|
+
|
|
253
|
+
<xsl:for-each select="svg:polygon|svg:ellipse|svg:polyline">
|
|
254
|
+
<xsl:sort select="@ry" order="descending" />
|
|
255
|
+
<xsl:call-template name="poly-main" />
|
|
256
|
+
</xsl:for-each>
|
|
257
|
+
|
|
258
|
+
<xsl:choose>
|
|
259
|
+
<xsl:when test="@class='node'">
|
|
260
|
+
<xsl:for-each select="svg:path">
|
|
261
|
+
<xsl:call-template name="path-main" />
|
|
262
|
+
</xsl:for-each>
|
|
263
|
+
</xsl:when>
|
|
264
|
+
<xsl:otherwise>
|
|
265
|
+
<xsl:for-each select="svg:path">
|
|
266
|
+
<path><xsl:apply-templates select="@*" /></path>
|
|
267
|
+
</xsl:for-each>
|
|
268
|
+
</xsl:otherwise>
|
|
269
|
+
</xsl:choose>
|
|
270
|
+
|
|
271
|
+
<xsl:apply-templates select="svg:text" />
|
|
272
|
+
</xsl:copy>
|
|
273
|
+
</xsl:template>
|
|
274
|
+
|
|
275
|
+
<xsl:template name="poly-shadow">
|
|
276
|
+
<xsl:element name="{name()}">
|
|
277
|
+
<xsl:apply-templates select="@*"/>
|
|
278
|
+
<xsl:attribute name="style">fill: black; stroke: none; fill-opacity:0.3</xsl:attribute>
|
|
279
|
+
<xsl:attribute name="transform">translate(3,3)</xsl:attribute>
|
|
280
|
+
</xsl:element>
|
|
281
|
+
</xsl:template>
|
|
282
|
+
|
|
283
|
+
<xsl:template name="path-shadow">
|
|
284
|
+
<xsl:element name="{name()}">
|
|
285
|
+
<xsl:apply-templates select="@*"/>
|
|
286
|
+
<!-- For some reason this comes out twice, so the opacity is set to 0.15 instead of 0.3 -->
|
|
287
|
+
<xsl:attribute name="style">fill: black; stroke: none; fill-opacity:0.15</xsl:attribute>
|
|
288
|
+
<xsl:attribute name="transform">translate(3,3)</xsl:attribute>
|
|
289
|
+
</xsl:element>
|
|
290
|
+
</xsl:template>
|
|
291
|
+
|
|
292
|
+
<xsl:template name="path-shadow-edge">
|
|
293
|
+
<xsl:element name="{name()}">
|
|
294
|
+
<xsl:apply-templates select="@*"/>
|
|
295
|
+
<xsl:attribute name="style">fill: none; stroke: black; stroke-opacity:0.3</xsl:attribute>
|
|
296
|
+
<xsl:attribute name="transform">translate(3,3)</xsl:attribute>
|
|
297
|
+
</xsl:element>
|
|
298
|
+
</xsl:template>
|
|
299
|
+
|
|
300
|
+
<xsl:template name="poly-main">
|
|
301
|
+
<xsl:element name="{name()}">
|
|
302
|
+
<xsl:apply-templates select="@*" />
|
|
303
|
+
<xsl:choose>
|
|
304
|
+
<xsl:when test="@fill != ''">
|
|
305
|
+
<xsl:attribute name="style">fill:url(#<xsl:value-of select="@fill"/>);stroke:black;</xsl:attribute></xsl:when>
|
|
306
|
+
<xsl:otherwise><xsl:attribute name="style">fill:url(#<xsl:value-of select="normalize-space(substring-after(substring-before(@style,';'),'fill:'))"/>);stroke:<xsl:value-of select="normalize-space(substring-after(substring-after(@style,';'),'stroke:'))"/>;</xsl:attribute></xsl:otherwise>
|
|
307
|
+
</xsl:choose>
|
|
308
|
+
</xsl:element>
|
|
309
|
+
</xsl:template>
|
|
310
|
+
|
|
311
|
+
<xsl:template name="path-main">
|
|
312
|
+
<path>
|
|
313
|
+
<xsl:apply-templates select="@*" />
|
|
314
|
+
<!-- This is somewhat broken - the gradient is set based on the position/size of the element it is used with; as a result it doesn't line up properly with the main polygon -->
|
|
315
|
+
<xsl:attribute name="style">fill:url(#<xsl:value-of select="normalize-space(substring-after(substring-before(../svg:polygon/@style,';'),'fill:'))"/>);stroke:black;</xsl:attribute>
|
|
316
|
+
</path>
|
|
317
|
+
</xsl:template>
|
|
318
|
+
|
|
319
|
+
</xsl:stylesheet>
|
|
320
|
+
|
|
321
|
+
|