Mercurial > projects > dil
annotate trunk/src/docgen/graphutils/dotwriter.d @ 459:1b5f1ce09f38
Fix to the image cache, cleaned stuff.
author | Jari-Matti M?kel? <jmjm@iki.fi> |
---|---|
date | Tue, 30 Oct 2007 16:58:17 +0200 |
parents | 33a4cb255fcc |
children | b7503e02fbe7 |
rev | line source |
---|---|
395
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
1 /** |
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
2 * Author: Aziz Köksal & Jari-Matti Mäkelä |
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
3 * License: GPL3 |
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
4 */ |
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
5 module docgen.graphutils.dotwriter; |
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
6 import docgen.graphutils.writer; |
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
7 |
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
8 import tango.io.Print: Print; |
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
9 import tango.text.convert.Layout : Layout; |
449
757bd048482c
Depgraph test + minor modifications.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
448
diff
changeset
|
10 import tango.io.FilePath; |
454
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
11 import tango.text.Util; |
459
1b5f1ce09f38
Fix to the image cache, cleaned stuff.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
457
diff
changeset
|
12 import tango.text.convert.Sprint; |
457
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
13 debug import tango.io.Stdout; |
395
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
14 |
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
15 /** |
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
16 * Creates a graph rule file for the dot utility. |
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
17 */ |
451
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
18 class DotWriter : AbstractGraphWriter { |
457
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
19 this(GraphWriterFactory factory, PageWriter writer) { |
451
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
20 super(factory, writer); |
395
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
21 } |
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
22 |
459
1b5f1ce09f38
Fix to the image cache, cleaned stuff.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
457
diff
changeset
|
23 char[] generateDepImageFile(Vertex[] vertices, Edge[] edges) { |
1b5f1ce09f38
Fix to the image cache, cleaned stuff.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
457
diff
changeset
|
24 char[] image; |
1b5f1ce09f38
Fix to the image cache, cleaned stuff.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
457
diff
changeset
|
25 auto sprint = new Sprint!(char); |
395
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
26 |
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
27 Vertex[][char[]] verticesByPckgName; |
454
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
28 if (factory.options.graph.groupByFullPackageName || |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
29 factory.options.graph.groupByPackageNames) { |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
30 foreach (mod; vertices) { |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
31 auto parts = mod.name.delimit("."); |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
32 |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
33 if (parts.length>1) { |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
34 auto pkg = parts[0..$-1].join("."); |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
35 verticesByPckgName[pkg] ~= mod; |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
36 } |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
37 } |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
38 } |
395
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
39 |
452
f658ec4a15dd
Simple docgen ui util, some fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
451
diff
changeset
|
40 if (factory.options.graph.highlightCyclicVertices || |
f658ec4a15dd
Simple docgen ui util, some fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
451
diff
changeset
|
41 factory.options.graph.highlightCyclicEdges) |
395
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
42 findCycles(vertices, edges); |
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
43 |
459
1b5f1ce09f38
Fix to the image cache, cleaned stuff.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
457
diff
changeset
|
44 image ~= "Digraph ModuleDependencies {\n"; |
395
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
45 |
454
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
46 foreach (module_; vertices) { |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
47 auto nodeName = |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
48 factory.options.graph.groupByPackageNames ? |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
49 module_.name.split(".")[$-1] : |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
50 module_.name; |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
51 |
459
1b5f1ce09f38
Fix to the image cache, cleaned stuff.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
457
diff
changeset
|
52 image ~= sprint.format( |
453
4e5b35df3060
Parsing bugfixes, cleaned up imports.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
452
diff
changeset
|
53 ` n{0} [label="{1}"{2}];`\n, |
4e5b35df3060
Parsing bugfixes, cleaned up imports.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
452
diff
changeset
|
54 module_.id, |
454
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
55 nodeName, |
453
4e5b35df3060
Parsing bugfixes, cleaned up imports.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
452
diff
changeset
|
56 (module_.isCyclic && factory.options.graph.highlightCyclicVertices ? |
4e5b35df3060
Parsing bugfixes, cleaned up imports.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
452
diff
changeset
|
57 ",style=filled,fillcolor=" ~ factory.options.graph.nodeColor : |
4e5b35df3060
Parsing bugfixes, cleaned up imports.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
452
diff
changeset
|
58 (module_.type == VertexType.UnlocatableModule ? |
4e5b35df3060
Parsing bugfixes, cleaned up imports.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
452
diff
changeset
|
59 ",style=filled,fillcolor=" ~ factory.options.graph.unlocatableNodeColor : |
4e5b35df3060
Parsing bugfixes, cleaned up imports.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
452
diff
changeset
|
60 "" |
4e5b35df3060
Parsing bugfixes, cleaned up imports.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
452
diff
changeset
|
61 ) |
4e5b35df3060
Parsing bugfixes, cleaned up imports.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
452
diff
changeset
|
62 ) |
4e5b35df3060
Parsing bugfixes, cleaned up imports.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
452
diff
changeset
|
63 ); |
454
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
64 } |
395
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
65 |
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
66 foreach (edge; edges) |
459
1b5f1ce09f38
Fix to the image cache, cleaned stuff.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
457
diff
changeset
|
67 image ~= sprint.format( |
395
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
68 ` n{0} -> n{1}{2};`\n, |
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
69 edge.outgoing.id, |
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
70 edge.incoming.id, |
451
3f44c38bf870
Page templates, more flexible writer interfaces, small fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
449
diff
changeset
|
71 (edge.isCyclic ? "[color=" ~ factory.options.graph.cyclicNodeColor ~ "]" : "") |
395
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
72 ); |
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
73 |
454
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
74 if (factory.options.graph.groupByPackageNames) |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
75 |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
76 if (!factory.options.graph.groupByFullPackageName) { |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
77 foreach (packageName, vertices; verticesByPckgName) { |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
78 auto name = packageName.split("."); |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
79 |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
80 if (name.length > 1) { |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
81 char[] pkg; |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
82 foreach(part; name) { |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
83 pkg ~= part ~ "."; |
459
1b5f1ce09f38
Fix to the image cache, cleaned stuff.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
457
diff
changeset
|
84 image ~= sprint.format( |
454
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
85 `subgraph "cluster_{0}" {{`\n` label="{0}"`\n, |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
86 pkg[0..$-1], |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
87 pkg[0..$-1] |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
88 ); |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
89 } |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
90 for (int i=0; i< name.length; i++) { |
459
1b5f1ce09f38
Fix to the image cache, cleaned stuff.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
457
diff
changeset
|
91 image ~= "}\n"; |
454
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
92 } |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
93 } |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
94 } |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
95 } |
395
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
96 foreach (packageName, vertices; verticesByPckgName) { |
459
1b5f1ce09f38
Fix to the image cache, cleaned stuff.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
457
diff
changeset
|
97 image ~= sprint.format( |
454
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
98 ` subgraph "cluster_{0}" {{`\n` label="{0}";color=` |
dbdc9fa5d479
depgraph fixes, better design for multiple doctargets.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
453
diff
changeset
|
99 ~ factory.options.graph.clusterColor ~ `;`\n` `, |
395
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
100 packageName, |
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
101 packageName |
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
102 ); |
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
103 |
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
104 foreach (module_; vertices) |
459
1b5f1ce09f38
Fix to the image cache, cleaned stuff.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
457
diff
changeset
|
105 image ~= sprint.format(`n{0};`, module_.id); |
1b5f1ce09f38
Fix to the image cache, cleaned stuff.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
457
diff
changeset
|
106 image ~= "\n }\n"; |
395
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
107 } |
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
108 |
459
1b5f1ce09f38
Fix to the image cache, cleaned stuff.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
457
diff
changeset
|
109 image ~= "}"; |
1b5f1ce09f38
Fix to the image cache, cleaned stuff.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
457
diff
changeset
|
110 |
1b5f1ce09f38
Fix to the image cache, cleaned stuff.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
457
diff
changeset
|
111 return image; |
395
ac9cd48151b6
Added couple of docgen modules.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
diff
changeset
|
112 } |
457
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
113 |
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
114 void generateImageTag(OutputStream imageFile) { |
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
115 // name of the .dot file |
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
116 char[] fn = (cast(Object)imageFile.conduit).toUtf8(); |
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
117 fn = FilePath(fn).file; |
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
118 |
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
119 fn = fn[0..$-3] ~ imageFormatExts[factory.options.graph.imageFormat]; |
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
120 |
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
121 writer.addGraphics(fn); |
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
122 } |
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
123 |
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
124 protected void generateDepGraph(Vertex[] vertices, Edge[] edges, OutputStream imageFile) { |
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
125 generateImageTag(imageFile); |
459
1b5f1ce09f38
Fix to the image cache, cleaned stuff.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
457
diff
changeset
|
126 |
1b5f1ce09f38
Fix to the image cache, cleaned stuff.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
457
diff
changeset
|
127 auto image = generateDepImageFile(vertices, edges); |
1b5f1ce09f38
Fix to the image cache, cleaned stuff.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
457
diff
changeset
|
128 auto printer = new Print!(char)(new Layout!(char), imageFile); |
1b5f1ce09f38
Fix to the image cache, cleaned stuff.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
457
diff
changeset
|
129 printer(image); |
457
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
130 } |
452
f658ec4a15dd
Simple docgen ui util, some fixes.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
451
diff
changeset
|
131 } |
457
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
132 |
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
133 class CachingDotWriter : DotWriter { |
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
134 CachingGraphWriterFactory factory; |
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
135 |
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
136 this(CachingGraphWriterFactory factory, PageWriter writer) { |
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
137 super(factory, writer); |
459
1b5f1ce09f38
Fix to the image cache, cleaned stuff.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
457
diff
changeset
|
138 this.factory = factory; |
457
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
139 } |
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
140 |
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
141 protected void generateDepGraph(Vertex[] vertices, Edge[] edges, OutputStream imageFile) { |
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
142 generateImageTag(imageFile); |
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
143 |
459
1b5f1ce09f38
Fix to the image cache, cleaned stuff.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
457
diff
changeset
|
144 auto cached = factory.graphCache.getCachedGraph(vertices, edges, GraphFormat.Dot); |
457
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
145 |
459
1b5f1ce09f38
Fix to the image cache, cleaned stuff.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
457
diff
changeset
|
146 auto printer = new Print!(char)(new Layout!(char), imageFile); |
1b5f1ce09f38
Fix to the image cache, cleaned stuff.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
457
diff
changeset
|
147 |
457
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
148 if (cached) { |
459
1b5f1ce09f38
Fix to the image cache, cleaned stuff.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
457
diff
changeset
|
149 printer(cached); |
1b5f1ce09f38
Fix to the image cache, cleaned stuff.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
457
diff
changeset
|
150 } else { |
1b5f1ce09f38
Fix to the image cache, cleaned stuff.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
457
diff
changeset
|
151 auto image = generateDepImageFile(vertices, edges); |
1b5f1ce09f38
Fix to the image cache, cleaned stuff.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
457
diff
changeset
|
152 factory.graphCache.setCachedGraph(vertices, edges, GraphFormat.Dot, image); |
1b5f1ce09f38
Fix to the image cache, cleaned stuff.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
457
diff
changeset
|
153 printer(image); |
457
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
154 } |
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
155 } |
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
156 } |
33a4cb255fcc
Cached images, small fixes, reorganizing.
Jari-Matti M?kel? <jmjm@iki.fi>
parents:
454
diff
changeset
|
157 |