Orbiter 2022
Combinatorial Objects
layered_graph_draw_options.cpp
Go to the documentation of this file.
1// layered_graph_draw_options.cpp
2//
3// Anton Betten
4// December 15, 2015
5//
6//
7//
8//
9//
10
11#include "foundations.h"
12
13
14using namespace std;
15
16
17namespace orbiter {
18namespace layer1_foundations {
19namespace graphics {
20
21
22
24{
25
27 paperheight = 0;
29 paperwidth = 0;
30
31
32 xin = 10000;
33 yin = 10000;
36
38
39 f_circle = TRUE;
41 rad = 200;
47 x_stretch = 1.;
49 y_stretch = 1.;
50 f_scale = FALSE;
51 scale = .45;
53 line_width = 1.5;
55
56
59 //select_layers = NULL;
61 layer_select = NULL;
62
69
71 layer1 = 0;
72 node1 = 0;;
73 layer2 = 0;
74 node2 = 0;
75}
76
78{
79};
80
82 int argc, std::string *argv,
83 int verbose_level)
84{
85 int i;
86 int f_v = (verbose_level >= 1);
88
89 if (f_v) {
90 cout << "layered_graph_draw_options::read_arguments" << endl;
91 }
92 for (i = 0; i < argc; i++) {
93
94 if (ST.stringcmp(argv[i], "-paperheight") == 0) {
96 paperheight = ST.strtoi(argv[++i]);
97 if (f_v) {
98 cout << "-paperheight " << paperheight << endl;
99 }
100 }
101 else if (ST.stringcmp(argv[i], "-paperwidth") == 0) {
103 paperwidth = ST.strtoi(argv[++i]);
104 if (f_v) {
105 cout << "-paperwidth " << paperwidth << endl;
106 }
107 }
108 else if (ST.stringcmp(argv[i], "-xin") == 0) {
109 xin = ST.strtoi(argv[++i]);
110 if (f_v) {
111 cout << "-xin " << xin << endl;
112 }
113 }
114 else if (ST.stringcmp(argv[i], "-yin") == 0) {
115 yin = ST.strtoi(argv[++i]);
116 if (f_v) {
117 cout << "-yin " << yin << endl;
118 }
119 }
120 else if (ST.stringcmp(argv[i], "-xout") == 0) {
121 xout = ST.strtoi(argv[++i]);
122 if (f_v) {
123 cout << "-xout " << xout << endl;
124 }
125 }
126 else if (ST.stringcmp(argv[i], "-yout") == 0) {
127 yout = ST.strtoi(argv[++i]);
128 if (f_v) {
129 cout << "-yout " << yout << endl;
130 }
131 }
132 else if (ST.stringcmp(argv[i], "-spanning_tree") == 0) {
134 if (f_v) {
135 cout << "-spanning_tree " << endl;
136 }
137 }
138 else if (ST.stringcmp(argv[i], "-circle") == 0) {
139 f_circle = TRUE;
140 if (f_v) {
141 cout << "-circle " << endl;
142 }
143 }
144 else if (ST.stringcmp(argv[i], "-corners") == 0) {
145 f_corners = TRUE;
146 if (f_v) {
147 cout << "-corners " << endl;
148 }
149 }
150 else if (ST.stringcmp(argv[i], "-radius") == 0) {
151 rad = ST.strtoi(argv[++i]);
152 if (f_v) {
153 cout << "-radius " << rad << endl;
154 }
155 }
156 else if (ST.stringcmp(argv[i], "-embedded") == 0) {
158 if (f_v) {
159 cout << "-embedded " << endl;
160 }
161 }
162 else if (ST.stringcmp(argv[i], "-sideways") == 0) {
164 if (f_v) {
165 cout << "-sideways " << endl;
166 }
167 }
168 else if (ST.stringcmp(argv[i], "-show_level_info") == 0) {
170 if (f_v) {
171 cout << "-show_level_info " << endl;
172 }
173 }
174 else if (ST.stringcmp(argv[i], "-label_edges") == 0) {
176 if (f_v) {
177 cout << "-label_edges " << endl;
178 }
179 }
180 else if (ST.stringcmp(argv[i], "-x_stretch") == 0) {
182 x_stretch = ST.strtof(argv[++i]);
183 if (f_v) {
184 cout << "-x_stretch " << x_stretch << endl;
185 }
186 }
187 else if (ST.stringcmp(argv[i], "-y_stretch") == 0) {
189 y_stretch = ST.strtof(argv[++i]);
190 if (f_v) {
191 cout << "-y_stretch " << y_stretch << endl;
192 }
193 }
194 else if (ST.stringcmp(argv[i], "-scale") == 0) {
195 f_scale = TRUE;
196 scale = ST.strtof(argv[++i]);
197 if (f_v) {
198 cout << "-scale " << scale << endl;
199 }
200 }
201 else if (ST.stringcmp(argv[i], "-line_width") == 0) {
203 line_width = ST.strtof(argv[++i]);
204 if (f_v) {
205 cout << "-line_width " << line_width << endl;
206 }
207 }
208 else if (ST.stringcmp(argv[i], "-rotated") == 0) {
209 f_rotated = TRUE;
210 if (f_v) {
211 cout << "-rotated " << endl;
212 }
213 }
214 else if (ST.stringcmp(argv[i], "-nodes_empty") == 0) {
216 if (f_v) {
217 cout << "-nodes_empty " << endl;
218 }
219 }
220 else if (ST.stringcmp(argv[i], "-select_layers") == 0) {
222 select_layers.assign(argv[++i]);
224 if (f_v) {
225 cout << "-select_layers ";
227 cout << endl;
228 }
229 }
230 else if (ST.stringcmp(argv[i], "-paths_in_between") == 0) {
232 layer1 = ST.strtoi(argv[++i]);
233 node1 = ST.strtoi(argv[++i]);
234 layer2 = ST.strtoi(argv[++i]);
235 node2 = ST.strtoi(argv[++i]);
236 if (f_v) {
237 cout << "-paths_in_between " << layer1 << " " << node1
238 << " " << layer2 << " " << node2 << endl;
239 }
240 }
241 else if (ST.stringcmp(argv[i], "-end") == 0) {
242 if (f_v) {
243 cout << "-end" << endl;
244 }
245 break;
246 }
247 else {
248 cout << "layered_graph_draw_options::read_arguments "
249 "unrecognized option " << argv[i] << endl;
250 exit(1);
251 }
252 } // next i
253 if (f_v) {
254 cout << "layered_graph_draw_options::read_arguments done" << endl;
255 }
256 return i + 1;
257}
258
259
261{
262 //cout << "layered_graph_draw_options::print:" << endl;
263
264
265 if (f_paperheight) {
266 cout << "-paperheight " << paperheight << endl;
267 }
268 if (f_paperwidth) {
269 cout << "-paperwidth " << paperwidth << endl;
270 }
271
272 cout << "xin, xout, yin, yout=" << xin << ", " << xout << ", " << yin << ", " << yout << endl;
273 cout << "radius=" << rad << endl;
274
275 if (f_spanning_tree) {
276 cout << "f_spanning_tree=" << endl;
277 }
278 if (f_circle) {
279 cout << "f_circle" << endl;
280 }
281 if (f_corners) {
282 cout << "f_corners" << endl;
283 }
284 if (f_embedded) {
285 cout << "f_embedded" << endl;
286 }
287 if (f_sideways) {
288 cout << "f_sideways" << endl;
289 }
290 if (f_show_level_info) {
291 cout << "f_show_level_info" << endl;
292 }
293 if (f_label_edges) {
294 cout << "f_label_edges" << endl;
295 }
296 if (f_x_stretch) {
297 cout << "x_stretch=" << x_stretch << endl;
298 }
299 if (f_y_stretch) {
300 cout << "y_stretch=" << y_stretch << endl;
301 }
302 if (f_scale) {
303 cout << "scale=" << scale << endl;
304 }
305 if (f_line_width) {
306 cout << "line_width=" << line_width << endl;
307 }
308 if (f_rotated) {
309 cout << "f_rotated" << endl;
310 }
311 if (f_nodes_empty) {
312 cout << "f_nodes_empty" << endl;
313 }
314 if (f_select_layers) {
315 cout << "select_layers=" << select_layers << endl;
316 }
317 if (nb_layer_select) {
318 cout << "layer_select=";
320 cout << endl;
321 }
322 if (f_paths_in_between) {
323 cout << "f_paths_in_between" << endl;
324 cout << "layer1=" << layer1 << endl;
325 cout << "node1=" << node1 << endl;
326 cout << "layer2=" << layer2 << endl;
327 cout << "node2=" << node2 << endl;
328 }
329}
330
331
332
333
334
335
336}}}
337
functions related to strings and character arrays
void(* draw_ending_callback)(graph_theory::layered_graph *LG, mp_graphics *G, int x_max, int y_max, int f_rotated, int dx, int dy)
Definition: graphics.h:506
void(* draw_begining_callback)(graph_theory::layered_graph *LG, mp_graphics *G, int x_max, int y_max, int f_rotated, int dx, int dy)
Definition: graphics.h:503
void(* draw_vertex_callback)(graph_theory::layered_graph *LG, mp_graphics *G, int layer, int node, int x, int y, int dx, int dy)
Definition: graphics.h:509
int read_arguments(int argc, std::string *argv, int verbose_level)
#define Int_vec_scan(A, B, C)
Definition: foundations.h:716
#define ONE_MILLION
Definition: foundations.h:226
#define TRUE
Definition: foundations.h:231
#define FALSE
Definition: foundations.h:234
#define Int_vec_print(A, B, C)
Definition: foundations.h:685
the orbiter library for the classification of combinatorial objects