gravatar
kpeter (Peter Kovacs)
kpeter@inf.elte.hu
Small fixes in graph_to_eps_demo.cc
0 1 0
default
1 file changed with 12 insertions and 12 deletions:
↑ Collapse diff ↑
Ignore white space 32 line context
... ...
@@ -7,34 +7,34 @@
7 7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
8 8
 *
9 9
 * Permission to use, modify and distribute this software is granted
10 10
 * provided that this copyright notice appears in all copies. For
11 11
 * precise terms see the accompanying LICENSE file.
12 12
 *
13 13
 * This software is provided "AS IS" with no warranty of any kind,
14 14
 * express or implied, and with no claim as to its suitability for any
15 15
 * purpose.
16 16
 *
17 17
 */
18 18

	
19 19
/// \ingroup demos
20 20
/// \file
21 21
/// \brief Demo of the graph drawing function \ref graphToEps()
22 22
///
23
/// This demo program shows examples how to  use the function \ref
24
/// graphToEps(). It takes no input but simply creates  six
23
/// This demo program shows examples how to use the function \ref
24
/// graphToEps(). It takes no input but simply creates seven
25 25
/// <tt>.eps</tt> files demonstrating the capability of \ref
26 26
/// graphToEps(), and showing how to draw directed graphs,
27 27
/// how to handle parallel egdes, how to change the properties (like
28 28
/// color, shape, size, title etc.) of nodes and arcs individually
29 29
/// using appropriate \ref maps-page "graph maps".
30 30
///
31 31
/// \include graph_to_eps_demo.cc
32 32

	
33 33
#include<lemon/list_graph.h>
34 34
#include<lemon/graph_utils.h>
35 35
#include<lemon/graph_to_eps.h>
36 36
#include<lemon/math.h>
37 37

	
38 38
using namespace std;
39 39
using namespace lemon;
40 40

	
... ...
@@ -68,33 +68,33 @@
68 68
  coords[n3]=Point(70,70);  sizes[n3]=1; colors[n3]=3; shapes[n3]=0;
69 69
  coords[n4]=Point(70,50);  sizes[n4]=2; colors[n4]=4; shapes[n4]=1;
70 70
  coords[n5]=Point(85,60);  sizes[n5]=3; colors[n5]=5; shapes[n5]=2;
71 71

	
72 72
  Arc a;
73 73

	
74 74
  a=g.addArc(n1,n2); acolors[a]=0; widths[a]=1;
75 75
  a=g.addArc(n2,n3); acolors[a]=0; widths[a]=1;
76 76
  a=g.addArc(n3,n5); acolors[a]=0; widths[a]=3;
77 77
  a=g.addArc(n5,n4); acolors[a]=0; widths[a]=1;
78 78
  a=g.addArc(n4,n1); acolors[a]=0; widths[a]=1;
79 79
  a=g.addArc(n2,n4); acolors[a]=1; widths[a]=2;
80 80
  a=g.addArc(n3,n4); acolors[a]=2; widths[a]=1;
81 81

	
82 82
  IdMap<ListDigraph,Node> id(g);
83 83

	
84
  // Create five .eps files showing the digraph with different options
84
  // Create .eps files showing the digraph with different options
85 85
  cout << "Create 'graph_to_eps_demo_out_1_pure.eps'" << endl;
86 86
  graphToEps(g,"graph_to_eps_demo_out_1_pure.eps").
87 87
    coords(coords).
88 88
    title("Sample .eps figure").
89 89
    copyright("(C) 2003-2008 LEMON Project").
90 90
    run();
91 91

	
92 92
  cout << "Create 'graph_to_eps_demo_out_2.eps'" << endl;
93 93
  graphToEps(g,"graph_to_eps_demo_out_2.eps").
94 94
    coords(coords).
95 95
    title("Sample .eps figure").
96 96
    copyright("(C) 2003-2008 LEMON Project").
97 97
    absoluteNodeSizes().absoluteArcWidths().
98 98
    nodeScale(2).nodeSizes(sizes).
99 99
    nodeShapes(shapes).
100 100
    nodeColors(composeMap(palette,colors)).
... ...
@@ -105,103 +105,103 @@
105 105

	
106 106
  cout << "Create 'graph_to_eps_demo_out_3_arr.eps'" << endl;
107 107
  graphToEps(g,"graph_to_eps_demo_out_3_arr.eps").
108 108
    title("Sample .eps figure (with arrowheads)").
109 109
    copyright("(C) 2003-2008 LEMON Project").
110 110
    absoluteNodeSizes().absoluteArcWidths().
111 111
    nodeColors(composeMap(palette,colors)).
112 112
    coords(coords).
113 113
    nodeScale(2).nodeSizes(sizes).
114 114
    nodeShapes(shapes).
115 115
    arcColors(composeMap(palette,acolors)).
116 116
    arcWidthScale(.4).arcWidths(widths).
117 117
    nodeTexts(id).nodeTextSize(3).
118 118
    drawArrows().arrowWidth(2).arrowLength(2).
119 119
    run();
120 120

	
121
  // Add more arcs to the digraph
121 122
  a=g.addArc(n1,n4); acolors[a]=2; widths[a]=1;
122 123
  a=g.addArc(n4,n1); acolors[a]=1; widths[a]=2;
123 124

	
124 125
  a=g.addArc(n1,n2); acolors[a]=1; widths[a]=1;
125 126
  a=g.addArc(n1,n2); acolors[a]=2; widths[a]=1;
126 127
  a=g.addArc(n1,n2); acolors[a]=3; widths[a]=1;
127 128
  a=g.addArc(n1,n2); acolors[a]=4; widths[a]=1;
128 129
  a=g.addArc(n1,n2); acolors[a]=5; widths[a]=1;
129 130
  a=g.addArc(n1,n2); acolors[a]=6; widths[a]=1;
130 131
  a=g.addArc(n1,n2); acolors[a]=7; widths[a]=1;
131 132

	
132
  cout << "Create 'graph_to_eps_demo_out_par.eps'" << endl;
133
  graphToEps(g,"graph_to_eps_demo_out_par.eps").
134
    //scale(10).
133
  cout << "Create 'graph_to_eps_demo_out_4_par.eps'" << endl;
134
  graphToEps(g,"graph_to_eps_demo_out_4_par.eps").
135 135
    title("Sample .eps figure (parallel arcs)").
136 136
    copyright("(C) 2003-2008 LEMON Project").
137 137
    absoluteNodeSizes().absoluteArcWidths().
138 138
    nodeShapes(shapes).
139 139
    coords(coords).
140 140
    nodeScale(2).nodeSizes(sizes).
141 141
    nodeColors(composeMap(palette,colors)).
142 142
    arcColors(composeMap(palette,acolors)).
143 143
    arcWidthScale(.4).arcWidths(widths).
144 144
    nodeTexts(id).nodeTextSize(3).
145 145
    enableParallel().parArcDist(1.5).
146 146
    run();
147 147

	
148
  cout << "Create 'graph_to_eps_demo_out_4_par_arr.eps'" << endl;
149
  graphToEps(g,"graph_to_eps_demo_out_4_par_arr.eps").
148
  cout << "Create 'graph_to_eps_demo_out_5_par_arr.eps'" << endl;
149
  graphToEps(g,"graph_to_eps_demo_out_5_par_arr.eps").
150 150
    title("Sample .eps figure (parallel arcs and arrowheads)").
151 151
    copyright("(C) 2003-2008 LEMON Project").
152 152
    absoluteNodeSizes().absoluteArcWidths().
153 153
    nodeScale(2).nodeSizes(sizes).
154 154
    coords(coords).
155 155
    nodeShapes(shapes).
156 156
    nodeColors(composeMap(palette,colors)).
157 157
    arcColors(composeMap(palette,acolors)).
158 158
    arcWidthScale(.3).arcWidths(widths).
159 159
    nodeTexts(id).nodeTextSize(3).
160 160
    enableParallel().parArcDist(1).
161 161
    drawArrows().arrowWidth(1).arrowLength(1).
162 162
    run();
163 163

	
164
  cout << "Create 'graph_to_eps_demo_out_5_par_arr_a4.eps'" << endl;
165
  graphToEps(g,"graph_to_eps_demo_out_5_par_arr_a4.eps").
164
  cout << "Create 'graph_to_eps_demo_out_6_par_arr_a4.eps'" << endl;
165
  graphToEps(g,"graph_to_eps_demo_out_6_par_arr_a4.eps").
166 166
    title("Sample .eps figure (fits to A4)").
167 167
    copyright("(C) 2003-2008 LEMON Project").
168 168
    scaleToA4().
169 169
    absoluteNodeSizes().absoluteArcWidths().
170 170
    nodeScale(2).nodeSizes(sizes).
171 171
    coords(coords).
172 172
    nodeShapes(shapes).
173 173
    nodeColors(composeMap(palette,colors)).
174 174
    arcColors(composeMap(palette,acolors)).
175 175
    arcWidthScale(.3).arcWidths(widths).
176 176
    nodeTexts(id).nodeTextSize(3).
177 177
    enableParallel().parArcDist(1).
178 178
    drawArrows().arrowWidth(1).arrowLength(1).
179 179
    run();
180 180

	
181 181
  // Create an .eps file showing the colors of a default Palette
182 182
  ListDigraph h;
183 183
  ListDigraph::NodeMap<int> hcolors(h);
184 184
  ListDigraph::NodeMap<Point> hcoords(h);
185 185

	
186 186
  int cols=int(sqrt(double(palette.size())));
187 187
  for(int i=0;i<int(paletteW.size());i++) {
188 188
    Node n=h.addNode();
189 189
    hcoords[n]=Point(1+i%cols,1+i/cols);
190 190
    hcolors[n]=i;
191 191
  }
192 192

	
193
  cout << "Create 'graph_to_eps_demo_out_6_colors.eps'" << endl;
194
  graphToEps(h,"graph_to_eps_demo_out_6_colors.eps").
193
  cout << "Create 'graph_to_eps_demo_out_7_colors.eps'" << endl;
194
  graphToEps(h,"graph_to_eps_demo_out_7_colors.eps").
195 195
    scale(60).
196 196
    title("Sample .eps figure (Palette demo)").
197 197
    copyright("(C) 2003-2008 LEMON Project").
198 198
    coords(hcoords).
199 199
    absoluteNodeSizes().absoluteArcWidths().
200 200
    nodeScale(.45).
201 201
    distantColorNodeTexts().
202 202
    nodeTexts(hcolors).nodeTextSize(.6).
203 203
    nodeColors(composeMap(paletteW,hcolors)).
204 204
    run();
205 205

	
206 206
  return 0;
207 207
}
0 comments (0 inline)