Mercurial > hg > camir-aes2014
comparison toolboxes/graph_visualisation/include/graphviz/types.h @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e9a9cd732c1e |
---|---|
1 /* $Id: types.h,v 1.101 2009/08/28 19:46:42 erg Exp $ $Revision: 1.101 $ */ | |
2 /* vim:set shiftwidth=4 ts=8: */ | |
3 | |
4 /********************************************************** | |
5 * This software is part of the graphviz package * | |
6 * http://www.graphviz.org/ * | |
7 * * | |
8 * Copyright (c) 1994-2004 AT&T Corp. * | |
9 * and is licensed under the * | |
10 * Common Public License, Version 1.0 * | |
11 * by AT&T Corp. * | |
12 * * | |
13 * Information and Software Systems Research * | |
14 * AT&T Research, Florham Park NJ * | |
15 **********************************************************/ | |
16 | |
17 #ifndef GV_TYPES_H | |
18 #define GV_TYPES_H | |
19 | |
20 #include <stdio.h> | |
21 #include <assert.h> | |
22 #include <signal.h> | |
23 | |
24 typedef unsigned char boolean; | |
25 #ifndef NOT | |
26 #define NOT(v) (!(v)) | |
27 #endif | |
28 #ifndef FALSE | |
29 #define FALSE 0 | |
30 #endif | |
31 #ifndef TRUE | |
32 #define TRUE NOT(FALSE) | |
33 #endif | |
34 | |
35 #include "geom.h" | |
36 #include "gvcext.h" | |
37 #include "pathgeom.h" | |
38 #include "textpara.h" | |
39 | |
40 #ifdef __cplusplus | |
41 extern "C" { | |
42 #endif | |
43 | |
44 typedef int (*qsort_cmpf) (const void *, const void *); | |
45 typedef int (*bsearch_cmpf) (const void *, const void *); | |
46 | |
47 #ifdef WITH_CGRAPH | |
48 #include <cgraph.h> | |
49 typedef struct Agraph_s graph_t; | |
50 typedef struct Agnode_s node_t; | |
51 typedef struct Agedge_s edge_t; | |
52 typedef struct Agsym_s attrsym_t; | |
53 #define TAIL_ID "tailport" | |
54 #define HEAD_ID "headport" | |
55 #else | |
56 typedef struct Agraph_t graph_t; | |
57 typedef struct Agnode_t node_t; | |
58 typedef struct Agedge_t edge_t; | |
59 typedef struct Agsym_t attrsym_t; | |
60 #endif | |
61 | |
62 typedef struct htmllabel_t htmllabel_t; | |
63 | |
64 typedef union inside_t { | |
65 struct { | |
66 pointf* p; | |
67 double* r; | |
68 } a; | |
69 struct { | |
70 node_t* n; | |
71 boxf* bp; | |
72 } s; | |
73 } inside_t; | |
74 | |
75 typedef struct port { /* internal edge endpoint specification */ | |
76 pointf p; /* aiming point relative to node center */ | |
77 double theta; /* slope in radians */ | |
78 boxf *bp; /* if not null, points to bbox of | |
79 * rectangular area that is port target | |
80 */ | |
81 boolean defined; /* if true, edge has port info at this end */ | |
82 boolean constrained; /* if true, constraints such as theta are set */ | |
83 boolean clip; /* if true, clip end to node/port shape */ | |
84 boolean dyna; /* if true, assign compass point dynamically */ | |
85 unsigned char order; /* for mincross */ | |
86 unsigned char side; /* if port is on perimeter of node, this | |
87 * contains the bitwise OR of the sides (TOP, | |
88 * BOTTOM, etc.) it is on. | |
89 */ | |
90 char *name; /* port name, if it was explicitly given, otherwise NULL */ | |
91 } port; | |
92 | |
93 typedef struct { | |
94 boolean(*swapEnds) (edge_t * e); /* Should head and tail be swapped? */ | |
95 boolean(*splineMerge) (node_t * n); /* Is n a node in the middle of an edge? */ | |
96 boolean ignoreSwap; /* Test for swapped edges if false */ | |
97 } splineInfo; | |
98 | |
99 typedef struct pathend_t { | |
100 boxf nb; /* the node box */ | |
101 pointf np; /* node port */ | |
102 int sidemask; | |
103 int boxn; | |
104 boxf boxes[20]; | |
105 } pathend_t; | |
106 | |
107 typedef struct path { /* internal specification for an edge spline */ | |
108 port start, end; | |
109 int nbox; /* number of subdivisions */ | |
110 boxf *boxes; /* rectangular regions of subdivision */ | |
111 void *data; | |
112 } path; | |
113 | |
114 typedef struct bezier { | |
115 pointf *list; | |
116 int size; | |
117 int sflag, eflag; | |
118 pointf sp, ep; | |
119 } bezier; | |
120 | |
121 typedef struct splines { | |
122 bezier *list; | |
123 int size; | |
124 boxf bb; | |
125 } splines; | |
126 | |
127 typedef struct textlabel_t { | |
128 char *text, *fontname, *fontcolor; | |
129 int charset; | |
130 double fontsize; | |
131 pointf dimen; /* the diagonal size of the label (estimated by layout) */ | |
132 pointf space; /* the diagonal size of the space for the label */ | |
133 /* the rendered label is aligned in this box */ | |
134 /* space does not include pad or margin */ | |
135 pointf pos; /* the center of the space for the label */ | |
136 union { | |
137 struct { | |
138 textpara_t *para; | |
139 short nparas; | |
140 } txt; | |
141 htmllabel_t *html; | |
142 } u; | |
143 char valign; /* 't' 'c' 'b' */ | |
144 boolean set; /* true if position is set */ | |
145 boolean html; /* true if html label */ | |
146 } textlabel_t; | |
147 | |
148 typedef struct polygon_t { /* mutable shape information for a node */ | |
149 int regular; /* true for symmetric shapes */ | |
150 int peripheries; /* number of periphery lines */ | |
151 int sides; /* number of sides */ | |
152 double orientation; /* orientation of shape (+ve degrees) */ | |
153 double distortion; /* distortion factor - as in trapezium */ | |
154 double skew; /* skew factor - as in parallelogram */ | |
155 int option; /* ROUNDED, DIAGONAL corners, etc. */ | |
156 pointf *vertices; /* array of vertex points */ | |
157 } polygon_t; | |
158 | |
159 typedef struct stroke_t { /* information about a single stroke */ | |
160 /* we would have called it a path if that term wasn't already used */ | |
161 int nvertices; /* number of points in the stroke */ | |
162 int flags; /* stroke style flags */ | |
163 pointf *vertices; /* array of vertex points */ | |
164 } stroke_t; | |
165 | |
166 /* flag definitions for stroke_t */ | |
167 #define STROKE_CLOSED (1 << 0) | |
168 #define STROKE_FILLED (1 << 1) | |
169 #define STROKE_PENDOWN (1 << 2) | |
170 #define STROKE_VERTICES_ALLOCATED (1 << 3) | |
171 | |
172 typedef struct shape_t { /* mutable shape information for a node */ | |
173 int nstrokes; /* number of strokes in array */ | |
174 stroke_t *strokes; /* array of strokes */ | |
175 /* The last stroke must always be closed, but can be pen_up. | |
176 * It is used as the clipping path */ | |
177 } shape_t; | |
178 | |
179 typedef struct shape_functions { /* read-only shape functions */ | |
180 void (*initfn) (node_t *); /* initializes shape from node u.shape_info structure */ | |
181 void (*freefn) (node_t *); /* frees shape from node u.shape_info structure */ | |
182 port(*portfn) (node_t *, char *, char *); /* finds aiming point and slope of port */ | |
183 boolean(*insidefn) (inside_t * inside_context, pointf); /* clips incident gvc->e spline on shape of gvc->n */ | |
184 int (*pboxfn)(node_t* n, port* p, int side, boxf rv[], int *kptr); /* finds box path to reach port */ | |
185 void (*codefn) (GVJ_t * job, node_t * n); /* emits graphics code for node */ | |
186 } shape_functions; | |
187 | |
188 typedef enum { SH_UNSET, SH_POLY, SH_RECORD, SH_POINT, SH_EPSF} shape_kind; | |
189 | |
190 typedef struct shape_desc { /* read-only shape descriptor */ | |
191 char *name; /* as read from graph file */ | |
192 shape_functions *fns; | |
193 polygon_t *polygon; /* base polygon info */ | |
194 boolean usershape; | |
195 } shape_desc; | |
196 | |
197 #include "usershape.h" /* usershapes needed by gvc */ | |
198 | |
199 typedef struct nodequeue { | |
200 node_t **store, **limit, **head, **tail; | |
201 } nodequeue; | |
202 | |
203 typedef struct adjmatrix_t { | |
204 int nrows, ncols; | |
205 char *data; | |
206 } adjmatrix_t; | |
207 | |
208 typedef struct rank_t { | |
209 int n; /* number of nodes in this rank */ | |
210 node_t **v; /* ordered list of nodes in rank */ | |
211 int an; /* globally allocated number of nodes */ | |
212 node_t **av; /* allocated list of nodes in rank */ | |
213 int ht1, ht2; /* height below/above centerline */ | |
214 int pht1, pht2; /* as above, but only primitive nodes */ | |
215 boolean candidate; /* for transpose () */ | |
216 boolean valid; | |
217 int cache_nc; /* caches number of crossings */ | |
218 adjmatrix_t *flat; | |
219 } rank_t; | |
220 | |
221 typedef enum { R_NONE = | |
222 0, R_VALUE, R_FILL, R_COMPRESS, R_AUTO, R_EXPAND } ratio_t; | |
223 | |
224 typedef struct layout_t { | |
225 double quantum; | |
226 double scale; | |
227 double ratio; /* set only if ratio_kind == R_VALUE */ | |
228 double dpi; | |
229 pointf margin; | |
230 pointf page; | |
231 pointf size; | |
232 boolean filled; | |
233 boolean landscape; | |
234 boolean centered; | |
235 ratio_t ratio_kind; | |
236 void* xdots; | |
237 } layout_t; | |
238 | |
239 /* for "record" shapes */ | |
240 typedef struct field_t { | |
241 pointf size; /* its dimension */ | |
242 boxf b; /* its placement in node's coordinates */ | |
243 int n_flds; | |
244 textlabel_t *lp; /* n_flds == 0 */ | |
245 struct field_t **fld; /* n_flds > 0 */ | |
246 char *id; /* user's identifier */ | |
247 unsigned char LR; /* if box list is horizontal (left to right) */ | |
248 unsigned char sides; /* sides of node exposed to field */ | |
249 } field_t; | |
250 | |
251 typedef struct nlist_t { | |
252 node_t **list; | |
253 int size; | |
254 } nlist_t; | |
255 | |
256 typedef struct elist { | |
257 edge_t **list; | |
258 int size; | |
259 } elist; | |
260 | |
261 #define GUI_STATE_ACTIVE (1<<0) | |
262 #define GUI_STATE_SELECTED (1<<1) | |
263 #define GUI_STATE_VISITED (1<<2) | |
264 #define GUI_STATE_DELETED (1<<3) | |
265 | |
266 #define elist_fastapp(item,L) do {L.list[L.size++] = item; L.list[L.size] = NULL;} while(0) | |
267 #define elist_append(item,L) do {L.list = ALLOC(L.size + 2,L.list,edge_t*); L.list[L.size++] = item; L.list[L.size] = NULL;} while(0) | |
268 #define alloc_elist(n,L) do {L.size = 0; L.list = N_NEW(n + 1,edge_t*); } while (0) | |
269 #define free_list(L) do {if (L.list) free(L.list);} while (0) | |
270 | |
271 typedef enum {NATIVEFONTS,PSFONTS,SVGFONTS} fontname_kind; | |
272 | |
273 typedef struct Agraphinfo_t { | |
274 #ifdef WITH_CGRAPH | |
275 Agrec_t hdr; | |
276 #endif | |
277 /* to generate code */ | |
278 layout_t *drawing; | |
279 textlabel_t *label; /* if the cluster has a title */ | |
280 boxf bb; /* bounding box */ | |
281 pointf border[4]; /* sizes of margins for graph labels */ | |
282 unsigned char gui_state; /* Graph state for GUI ops */ | |
283 unsigned char has_labels; | |
284 boolean has_images; | |
285 unsigned char charset; /* input character set */ | |
286 int rankdir; | |
287 int ht1, ht2; /* below and above extremal ranks */ | |
288 unsigned short flags; | |
289 void *alg; | |
290 GVC_t *gvc; /* context for "globals" over multiple graphs */ | |
291 void (*cleanup) (graph_t * g); /* function to deallocate layout-specific data */ | |
292 | |
293 #ifndef DOT_ONLY | |
294 /* to place nodes */ | |
295 node_t **neato_nlist; | |
296 int move; | |
297 double **dist, **spring, **sum_t, ***t; | |
298 unsigned short ndim; | |
299 unsigned short odim; | |
300 #endif | |
301 #ifndef NEATO_ONLY | |
302 /* to have subgraphs */ | |
303 int n_cluster; | |
304 graph_t **clust; /* clusters are in clust[1..n_cluster] !!! */ | |
305 node_t *nlist; | |
306 rank_t *rank; | |
307 /* fast graph node list */ | |
308 nlist_t comp; | |
309 /* connected components */ | |
310 node_t *minset, *maxset; /* set leaders */ | |
311 long n_nodes; | |
312 /* includes virtual */ | |
313 short minrank, maxrank; | |
314 | |
315 /* various flags */ | |
316 boolean has_flat_edges; | |
317 unsigned char showboxes; | |
318 boolean cluster_was_collapsed; | |
319 fontname_kind fontnames; /* to override mangling in SVG */ | |
320 | |
321 int nodesep, ranksep; | |
322 node_t *ln, *rn; /* left, right nodes of bounding box */ | |
323 | |
324 | |
325 /* for clusters */ | |
326 node_t *leader, **rankleader; | |
327 boolean expanded; | |
328 char installed; | |
329 char set_type; | |
330 char label_pos; | |
331 boolean exact_ranksep; | |
332 #endif | |
333 | |
334 } Agraphinfo_t; | |
335 | |
336 #ifdef WITH_CGRAPH | |
337 #define GD_u(g)(((Agraphinfo_t*)AGDATA(g))) | |
338 #define GD_drawing(g) (((Agraphinfo_t*)AGDATA(g))->drawing) | |
339 #define GD_bb(g) (((Agraphinfo_t*)AGDATA(g))->bb) | |
340 #define GD_gvc(g) (((Agraphinfo_t*)AGDATA(g))->gvc) | |
341 #define GD_cleanup(g) (((Agraphinfo_t*)AGDATA(g))->cleanup) | |
342 #define GD_dist(g) (((Agraphinfo_t*)AGDATA(g))->dist) | |
343 #define GD_alg(g) (((Agraphinfo_t*)AGDATA(g))->alg) | |
344 #define GD_border(g) (((Agraphinfo_t*)AGDATA(g))->border) | |
345 #define GD_cl_cnt(g) (((Agraphinfo_t*)AGDATA(g))->cl_nt) | |
346 #define GD_clust(g) (((Agraphinfo_t*)AGDATA(g))->clust) | |
347 #define GD_cluster_was_collapsed(g) (((Agraphinfo_t*)AGDATA(g))->cluster_was_collapsed) | |
348 #define GD_comp(g) (((Agraphinfo_t*)AGDATA(g))->comp) | |
349 #define GD_exact_ranksep(g) (((Agraphinfo_t*)AGDATA(g))->exact_ranksep) | |
350 #define GD_expanded(g) (((Agraphinfo_t*)AGDATA(g))->expanded) | |
351 #define GD_flags(g) (((Agraphinfo_t*)AGDATA(g))->flags) | |
352 #define GD_gui_state(g) (((Agraphinfo_t*)AGDATA(g))->gui_state) | |
353 #define GD_charset(g) (((Agraphinfo_t*)AGDATA(g))->charset) | |
354 #define GD_has_labels(g) (((Agraphinfo_t*)AGDATA(g))->has_labels) | |
355 #define GD_has_images(g) (((Agraphinfo_t*)AGDATA(g))->has_images) | |
356 #define GD_has_flat_edges(g) (((Agraphinfo_t*)AGDATA(g))->has_flat_edges) | |
357 #define GD_ht1(g) (((Agraphinfo_t*)AGDATA(g))->ht1) | |
358 #define GD_ht2(g) (((Agraphinfo_t*)AGDATA(g))->ht2) | |
359 #define GD_inleaf(g) (((Agraphinfo_t*)AGDATA(g))->inleaf) | |
360 #define GD_installed(g) (((Agraphinfo_t*)AGDATA(g))->installed) | |
361 #define GD_label(g) (((Agraphinfo_t*)AGDATA(g))->label) | |
362 #define GD_leader(g) (((Agraphinfo_t*)AGDATA(g))->leader) | |
363 #define GD_rankdir2(g) (((Agraphinfo_t*)AGDATA(g))->rankdir) | |
364 #define GD_rankdir(g) (((Agraphinfo_t*)AGDATA(g))->rankdir & 0x3) | |
365 #define GD_flip(g) (GD_rankdir(g) & 1) | |
366 #define GD_realrankdir(g) ((((Agraphinfo_t*)AGDATA(g))->rankdir) >> 2) | |
367 #define GD_realflip(g) (GD_realrankdir(g) & 1) | |
368 #define GD_ln(g) (((Agraphinfo_t*)AGDATA(g))->ln) | |
369 #define GD_maxrank(g) (((Agraphinfo_t*)AGDATA(g))->maxrank) | |
370 #define GD_maxset(g) (((Agraphinfo_t*)AGDATA(g))->maxset) | |
371 #define GD_minrank(g) (((Agraphinfo_t*)AGDATA(g))->minrank) | |
372 #define GD_minset(g) (((Agraphinfo_t*)AGDATA(g))->minset) | |
373 #define GD_move(g) (((Agraphinfo_t*)AGDATA(g))->move) | |
374 #define GD_n_cluster(g) (((Agraphinfo_t*)AGDATA(g))->n_cluster) | |
375 #define GD_n_nodes(g) (((Agraphinfo_t*)AGDATA(g))->n_nodes) | |
376 #define GD_ndim(g) (((Agraphinfo_t*)AGDATA(g))->ndim) | |
377 #define GD_odim(g) (((Agraphinfo_t*)AGDATA(g))->odim) | |
378 #define GD_neato_nlist(g) (((Agraphinfo_t*)AGDATA(g))->neato_nlist) | |
379 #define GD_nlist(g) (((Agraphinfo_t*)AGDATA(g))->nlist) | |
380 #define GD_nodesep(g) (((Agraphinfo_t*)AGDATA(g))->nodesep) | |
381 #define GD_outleaf(g) (((Agraphinfo_t*)AGDATA(g))->outleaf) | |
382 #define GD_rank(g) (((Agraphinfo_t*)AGDATA(g))->rank) | |
383 #define GD_rankleader(g) (((Agraphinfo_t*)AGDATA(g))->rankleader) | |
384 #define GD_ranksep(g) (((Agraphinfo_t*)AGDATA(g))->ranksep) | |
385 #define GD_rn(g) (((Agraphinfo_t*)AGDATA(g))->rn) | |
386 #define GD_set_type(g) (((Agraphinfo_t*)AGDATA(g))->set_type) | |
387 #define GD_label_pos(g) (((Agraphinfo_t*)AGDATA(g))->label_pos) | |
388 #define GD_showboxes(g) (((Agraphinfo_t*)AGDATA(g))->showboxes) | |
389 #define GD_fontnames(g) (((Agraphinfo_t*)AGDATA(g))->fontnames) | |
390 #define GD_spring(g) (((Agraphinfo_t*)AGDATA(g))->spring) | |
391 #define GD_sum_t(g) (((Agraphinfo_t*)AGDATA(g))->sum_t) | |
392 #define GD_t(g) (((Agraphinfo_t*)AGDATA(g))->t) | |
393 | |
394 #else | |
395 | |
396 #define GD_alg(g) (g)->u.alg | |
397 #define GD_bb(g) (g)->u.bb | |
398 #define GD_border(g) (g)->u.border | |
399 #define GD_cl_cnt(g) (g)->u.cl_cnt | |
400 #define GD_cleanup(g) (g)->u.cleanup | |
401 #define GD_clust(g) (g)->u.clust | |
402 #define GD_cluster_was_collapsed(g) (g)->u.cluster_was_collapsed | |
403 #define GD_comp(g) (g)->u.comp | |
404 #define GD_dist(g) (g)->u.dist | |
405 #define GD_drawing(g) (g)->u.drawing | |
406 #define GD_exact_ranksep(g) (g)->u.exact_ranksep | |
407 #define GD_expanded(g) (g)->u.expanded | |
408 #define GD_flags(g) (g)->u.flags | |
409 #define GD_gui_state(g) (g)->u.gui_state | |
410 #define GD_gvc(g) (g)->u.gvc | |
411 #define GD_charset(g) (g)->u.charset | |
412 #define GD_has_labels(g) (g)->u.has_labels | |
413 #define GD_has_images(g) (g)->u.has_images | |
414 #define GD_has_flat_edges(g) (g)->u.has_flat_edges | |
415 #define GD_ht1(g) (g)->u.ht1 | |
416 #define GD_ht2(g) (g)->u.ht2 | |
417 #define GD_inleaf(g) (g)->u.inleaf | |
418 #define GD_installed(g) (g)->u.installed | |
419 #define GD_label(g) (g)->u.label | |
420 #define GD_leader(g) (g)->u.leader | |
421 #define GD_rankdir(g) ((g)->u.rankdir & 0x3) | |
422 #define GD_flip(g) (GD_rankdir(g) & 1) | |
423 #define GD_realrankdir(g) ((g)->u.rankdir >> 2) | |
424 #define GD_realflip(g) (GD_realrankdir(g) & 1) | |
425 #define GD_ln(g) (g)->u.ln | |
426 #define GD_maxrank(g) (g)->u.maxrank | |
427 #define GD_maxset(g) (g)->u.maxset | |
428 #define GD_minrank(g) (g)->u.minrank | |
429 #define GD_minset(g) (g)->u.minset | |
430 #define GD_move(g) (g)->u.move | |
431 #define GD_n_cluster(g) (g)->u.n_cluster | |
432 #define GD_n_nodes(g) (g)->u.n_nodes | |
433 #define GD_ndim(g) (g)->u.ndim | |
434 #define GD_odim(g) (g)->u.odim | |
435 #define GD_neato_nlist(g) (g)->u.neato_nlist | |
436 #define GD_nlist(g) (g)->u.nlist | |
437 #define GD_nodesep(g) (g)->u.nodesep | |
438 #define GD_outleaf(g) (g)->u.outleaf | |
439 #define GD_rank(g) (g)->u.rank | |
440 #define GD_rankleader(g) (g)->u.rankleader | |
441 #define GD_ranksep(g) (g)->u.ranksep | |
442 #define GD_rn(g) (g)->u.rn | |
443 #define GD_set_type(g) (g)->u.set_type | |
444 #define GD_label_pos(g) (g)->u.label_pos | |
445 #define GD_showboxes(g) (g)->u.showboxes | |
446 #define GD_fontnames(g) (g)->u.fontnames | |
447 #define GD_spring(g) (g)->u.spring | |
448 #define GD_sum_t(g) (g)->u.sum_t | |
449 #define GD_t(g) (g)->u.t | |
450 #endif | |
451 | |
452 typedef struct Agnodeinfo_t { | |
453 #ifdef WITH_CGRAPH | |
454 Agrec_t hdr; | |
455 #endif | |
456 shape_desc *shape; | |
457 void *shape_info; | |
458 pointf coord; | |
459 double width, height; /* inches */ | |
460 boxf bb; | |
461 double ht, lw, rw; | |
462 textlabel_t *label; | |
463 textlabel_t *xlabel; | |
464 void *alg; | |
465 char state; | |
466 unsigned char gui_state; /* Node state for GUI ops */ | |
467 boolean clustnode; | |
468 | |
469 #ifndef DOT_ONLY | |
470 unsigned char pinned; | |
471 short xsize, ysize; | |
472 int id, heapindex, hops; | |
473 double *pos, dist; | |
474 #endif | |
475 #ifndef NEATO_ONLY | |
476 unsigned char showboxes; | |
477 boolean has_port; | |
478 | |
479 /* fast graph */ | |
480 char node_type, mark, onstack; | |
481 char ranktype, weight_class; | |
482 node_t *next, *prev; | |
483 elist in, out, flat_out, flat_in, other; | |
484 graph_t *clust; | |
485 | |
486 /* for union-find and collapsing nodes */ | |
487 int UF_size; | |
488 node_t *UF_parent; | |
489 node_t *inleaf, *outleaf; | |
490 | |
491 /* for placing nodes */ | |
492 int rank, order; /* initially, order = 1 for ordered edges */ | |
493 int mval; | |
494 elist save_in, save_out; | |
495 | |
496 /* for network-simplex */ | |
497 elist tree_in, tree_out; | |
498 edge_t *par; | |
499 int low, lim; | |
500 int priority; | |
501 | |
502 double pad[1]; | |
503 #endif | |
504 | |
505 } Agnodeinfo_t; | |
506 | |
507 #ifdef WITH_CGRAPH | |
508 #define ND_id(n) (((Agnodeinfo_t*)AGDATA(n))->id) | |
509 #define ND_alg(n) (((Agnodeinfo_t*)AGDATA(n))->alg) | |
510 #define ND_UF_parent(n) (((Agnodeinfo_t*)AGDATA(n))->UF_parent) | |
511 #define ND_UF_size(n) (((Agnodeinfo_t*)AGDATA(n))->UF_size) | |
512 #define ND_bb(n) (((Agnodeinfo_t*)AGDATA(n))->bb) | |
513 #define ND_clust(n) (((Agnodeinfo_t*)AGDATA(n))->clust) | |
514 #define ND_coord(n) (((Agnodeinfo_t*)AGDATA(n))->coord) | |
515 #define ND_dist(n) (((Agnodeinfo_t*)AGDATA(n))->dist) | |
516 #define ND_flat_in(n) (((Agnodeinfo_t*)AGDATA(n))->flat_in) | |
517 #define ND_flat_out(n) (((Agnodeinfo_t*)AGDATA(n))->flat_out) | |
518 #define ND_gui_state(n) (((Agnodeinfo_t*)AGDATA(n))->gui_state) | |
519 #define ND_has_port(n) (((Agnodeinfo_t*)AGDATA(n))->has_port) | |
520 #define ND_heapindex(n) (((Agnodeinfo_t*)AGDATA(n))->heapindex) | |
521 #define ND_height(n) (((Agnodeinfo_t*)AGDATA(n))->height) | |
522 #define ND_hops(n) (((Agnodeinfo_t*)AGDATA(n))->hops) | |
523 #define ND_ht(n) (((Agnodeinfo_t*)AGDATA(n))->ht) | |
524 #define ND_in(n) (((Agnodeinfo_t*)AGDATA(n))->in) | |
525 #define ND_inleaf(n) (((Agnodeinfo_t*)AGDATA(n))->inleaf) | |
526 #define ND_label(n) (((Agnodeinfo_t*)AGDATA(n))->label) | |
527 #define ND_xlabel(n) (((Agnodeinfo_t*)AGDATA(n))->xlabel) | |
528 #define ND_lim(n) (((Agnodeinfo_t*)AGDATA(n))->lim) | |
529 #define ND_low(n) (((Agnodeinfo_t*)AGDATA(n))->low) | |
530 #define ND_lw(n) (((Agnodeinfo_t*)AGDATA(n))->lw) | |
531 #define ND_mark(n) (((Agnodeinfo_t*)AGDATA(n))->mark) | |
532 #define ND_mval(n) (((Agnodeinfo_t*)AGDATA(n))->mval) | |
533 #define ND_n_cluster(n) (((Agnodeinfo_t*)AGDATA(n))->n_cluster) | |
534 #define ND_next(n) (((Agnodeinfo_t*)AGDATA(n))->next) | |
535 #define ND_node_type(n) (((Agnodeinfo_t*)AGDATA(n))->node_type) | |
536 #define ND_onstack(n) (((Agnodeinfo_t*)AGDATA(n))->onstack) | |
537 #define ND_order(n) (((Agnodeinfo_t*)AGDATA(n))->order) | |
538 #define ND_other(n) (((Agnodeinfo_t*)AGDATA(n))->other) | |
539 #define ND_out(n) (((Agnodeinfo_t*)AGDATA(n))->out) | |
540 #define ND_outleaf(n) (((Agnodeinfo_t*)AGDATA(n))->outleaf) | |
541 #define ND_par(n) (((Agnodeinfo_t*)AGDATA(n))->par) | |
542 #define ND_pinned(n) (((Agnodeinfo_t*)AGDATA(n))->pinned) | |
543 #define ND_pos(n) (((Agnodeinfo_t*)AGDATA(n))->pos) | |
544 #define ND_prev(n) (((Agnodeinfo_t*)AGDATA(n))->prev) | |
545 #define ND_priority(n) (((Agnodeinfo_t*)AGDATA(n))->priority) | |
546 #define ND_rank(n) (((Agnodeinfo_t*)AGDATA(n))->rank) | |
547 #define ND_ranktype(n) (((Agnodeinfo_t*)AGDATA(n))->ranktype) | |
548 #define ND_rw(n) (((Agnodeinfo_t*)AGDATA(n))->rw) | |
549 #define ND_save_in(n) (((Agnodeinfo_t*)AGDATA(n))->save_in) | |
550 #define ND_save_out(n) (((Agnodeinfo_t*)AGDATA(n))->save_out) | |
551 #define ND_shape(n) (((Agnodeinfo_t*)AGDATA(n))->shape) | |
552 #define ND_shape_info(n) (((Agnodeinfo_t*)AGDATA(n))->shape_info) | |
553 #define ND_showboxes(n) (((Agnodeinfo_t*)AGDATA(n))->showboxes) | |
554 #define ND_state(n) (((Agnodeinfo_t*)AGDATA(n))->state) | |
555 #define ND_clustnode(n) (((Agnodeinfo_t*)AGDATA(n))->clustnode) | |
556 #define ND_tree_in(n) (((Agnodeinfo_t*)AGDATA(n))->tree_in) | |
557 #define ND_tree_out(n) (((Agnodeinfo_t*)AGDATA(n))->tree_out) | |
558 #define ND_weight_class(n) (((Agnodeinfo_t*)AGDATA(n))->weight_class) | |
559 #define ND_width(n) (((Agnodeinfo_t*)AGDATA(n))->width) | |
560 #define ND_xsize(n) (((Agnodeinfo_t*)AGDATA(n))->xsize) | |
561 #define ND_ysize(n) (((Agnodeinfo_t*)AGDATA(n))->ysize) | |
562 | |
563 #else | |
564 | |
565 #define ND_UF_parent(n) (n)->u.UF_parent | |
566 #define ND_UF_size(n) (n)->u.UF_size | |
567 #define ND_alg(n) (n)->u.alg | |
568 #define ND_bb(n) (n)->u.bb | |
569 #define ND_clust(n) (n)->u.clust | |
570 #define ND_coord(n) (n)->u.coord | |
571 #define ND_dist(n) (n)->u.dist | |
572 #define ND_flat_in(n) (n)->u.flat_in | |
573 #define ND_flat_out(n) (n)->u.flat_out | |
574 #define ND_gui_state(n) (n)->u.gui_state | |
575 #define ND_has_port(n) (n)->u.has_port | |
576 #define ND_heapindex(n) (n)->u.heapindex | |
577 #define ND_height(n) (n)->u.height | |
578 #define ND_hops(n) (n)->u.hops | |
579 #define ND_ht(n) (n)->u.ht | |
580 #define ND_id(n) (n)->u.id | |
581 #define ND_in(n) (n)->u.in | |
582 #define ND_inleaf(n) (n)->u.inleaf | |
583 #define ND_label(n) (n)->u.label | |
584 #define ND_xlabel(n) (n)->u.xlabel | |
585 #define ND_lim(n) (n)->u.lim | |
586 #define ND_low(n) (n)->u.low | |
587 #define ND_lw(n) (n)->u.lw | |
588 #define ND_mark(n) (n)->u.mark | |
589 #define ND_mval(n) (n)->u.mval | |
590 #define ND_n_cluster(n) (n)->u.n_cluster | |
591 #define ND_next(n) (n)->u.next | |
592 #define ND_node_type(n) (n)->u.node_type | |
593 #define ND_onstack(n) (n)->u.onstack | |
594 #define ND_order(n) (n)->u.order | |
595 #define ND_other(n) (n)->u.other | |
596 #define ND_out(n) (n)->u.out | |
597 #define ND_outleaf(n) (n)->u.outleaf | |
598 #define ND_par(n) (n)->u.par | |
599 #define ND_pinned(n) (n)->u.pinned | |
600 #define ND_pos(n) (n)->u.pos | |
601 #define ND_prev(n) (n)->u.prev | |
602 #define ND_priority(n) (n)->u.priority | |
603 #define ND_rank(n) (n)->u.rank | |
604 #define ND_ranktype(n) (n)->u.ranktype | |
605 #define ND_rw(n) (n)->u.rw | |
606 #define ND_save_in(n) (n)->u.save_in | |
607 #define ND_save_out(n) (n)->u.save_out | |
608 #define ND_shape(n) (n)->u.shape | |
609 #define ND_shape_info(n) (n)->u.shape_info | |
610 #define ND_showboxes(n) (n)->u.showboxes | |
611 #define ND_state(n) (n)->u.state | |
612 #define ND_clustnode(n) (n)->u.clustnode | |
613 #define ND_tree_in(n) (n)->u.tree_in | |
614 #define ND_tree_out(n) (n)->u.tree_out | |
615 #define ND_weight_class(n) (n)->u.weight_class | |
616 #define ND_width(n) (n)->u.width | |
617 #define ND_xsize(n) (n)->u.xsize | |
618 #define ND_ysize(n) (n)->u.ysize | |
619 #endif | |
620 | |
621 typedef struct Agedgeinfo_t { | |
622 #ifdef WITH_CGRAPH | |
623 Agrec_t hdr; | |
624 #endif | |
625 splines *spl; | |
626 port tail_port, head_port; | |
627 textlabel_t *label, *head_label, *tail_label, *xlabel; | |
628 char edge_type; | |
629 char adjacent; /* true for flat edge with adjacent nodes */ | |
630 char label_ontop; | |
631 unsigned char gui_state; /* Edge state for GUI ops */ | |
632 edge_t *to_orig; /* for dot's shapes.c */ | |
633 void *alg; | |
634 | |
635 #ifndef DOT_ONLY | |
636 double factor; | |
637 double dist; | |
638 Ppolyline_t path; | |
639 #endif | |
640 #ifndef NEATO_ONLY | |
641 unsigned char showboxes; | |
642 boolean conc_opp_flag; | |
643 short xpenalty; | |
644 int weight; | |
645 int cutvalue, tree_index; | |
646 short count; | |
647 unsigned short minlen; | |
648 edge_t *to_virt; | |
649 #endif | |
650 } Agedgeinfo_t; | |
651 | |
652 #ifdef WITH_CGRAPH | |
653 #define ED_alg(e) (((Agedgeinfo_t*)AGDATA(e))->alg) | |
654 #define ED_conc_opp_flag(e) (((Agedgeinfo_t*)AGDATA(e))->conc_opp_flag) | |
655 #define ED_count(e) (((Agedgeinfo_t*)AGDATA(e))->count) | |
656 #define ED_cutvalue(e) (((Agedgeinfo_t*)AGDATA(e))->cutvalue) | |
657 #define ED_edge_type(e) (((Agedgeinfo_t*)AGDATA(e))->edge_type) | |
658 #define ED_adjacent(e) (((Agedgeinfo_t*)AGDATA(e))->adjacent) | |
659 #define ED_factor(e) (((Agedgeinfo_t*)AGDATA(e))->factor) | |
660 #define ED_gui_state(e) (((Agedgeinfo_t*)AGDATA(e))->gui_state) | |
661 #define ED_head_label(e) (((Agedgeinfo_t*)AGDATA(e))->head_label) | |
662 #define ED_head_port(e) (((Agedgeinfo_t*)AGDATA(e))->head_port) | |
663 #define ED_label(e) (((Agedgeinfo_t*)AGDATA(e))->label) | |
664 #define ED_xlabel(e) (((Agedgeinfo_t*)AGDATA(e))->xlabel) | |
665 #define ED_label_ontop(e) (((Agedgeinfo_t*)AGDATA(e))->label_ontop) | |
666 #define ED_minlen(e) (((Agedgeinfo_t*)AGDATA(e))->minlen) | |
667 #define ED_path(e) (((Agedgeinfo_t*)AGDATA(e))->path) | |
668 #define ED_showboxes(e) (((Agedgeinfo_t*)AGDATA(e))->showboxes) | |
669 #define ED_spl(e) (((Agedgeinfo_t*)AGDATA(e))->spl) | |
670 #define ED_tail_label(e) (((Agedgeinfo_t*)AGDATA(e))->tail_label) | |
671 #define ED_tail_port(e) (((Agedgeinfo_t*)AGDATA(e))->tail_port) | |
672 #define ED_to_orig(e) (((Agedgeinfo_t*)AGDATA(e))->to_orig) | |
673 #define ED_to_virt(e) (((Agedgeinfo_t*)AGDATA(e))->to_virt) | |
674 #define ED_tree_index(e) (((Agedgeinfo_t*)AGDATA(e))->tree_index) | |
675 #define ED_xpenalty(e) (((Agedgeinfo_t*)AGDATA(e))->xpenalty) | |
676 #define ED_dist(e) (((Agedgeinfo_t*)AGDATA(e))->dist) | |
677 #define ED_weight(e) (((Agedgeinfo_t*)AGDATA(e))->weight) | |
678 | |
679 #else | |
680 | |
681 #define ED_alg(e) (e)->u.alg | |
682 #define ED_conc_opp_flag(e) (e)->u.conc_opp_flag | |
683 #define ED_count(e) (e)->u.count | |
684 #define ED_cutvalue(e) (e)->u.cutvalue | |
685 #define ED_dist(e) (e)->u.dist | |
686 #define ED_edge_type(e) (e)->u.edge_type | |
687 #define ED_adjacent(e) (e)->u.adjacent | |
688 #define ED_factor(e) (e)->u.factor | |
689 #define ED_gui_state(e) (e)->u.gui_state | |
690 #define ED_head_label(e) (e)->u.head_label | |
691 #define ED_head_port(e) (e)->u.head_port | |
692 #define ED_label(e) (e)->u.label | |
693 #define ED_xlabel(e) (e)->u.xlabel | |
694 #define ED_label_ontop(e) (e)->u.label_ontop | |
695 #define ED_minlen(e) (e)->u.minlen | |
696 #define ED_path(e) (e)->u.path | |
697 #define ED_showboxes(e) (e)->u.showboxes | |
698 #define ED_spl(e) (e)->u.spl | |
699 #define ED_tail_label(e) (e)->u.tail_label | |
700 #define ED_tail_port(e) (e)->u.tail_port | |
701 #define ED_to_orig(e) (e)->u.to_orig | |
702 #define ED_to_virt(e) (e)->u.to_virt | |
703 #define ED_tree_index(e) (e)->u.tree_index | |
704 #define ED_weight(e) (e)->u.weight | |
705 #define ED_xpenalty(e) (e)->u.xpenalty | |
706 #endif | |
707 | |
708 #ifdef WITH_CGRAPH | |
709 #include "cgraph.h" | |
710 #define SET_RANKDIR(g,rd) (GD_rankdir2(g) = rd) | |
711 #define agfindedge(g,t,h) (agedge(g,t,h,NULL,0)) | |
712 #define agfindnode(g,n) (agnode(g,n,0)) | |
713 #define agfindgraphattr(g,a) (agattr(g,AGRAPH,a,NULL)) | |
714 #define agfindnodeattr(g,a) (agattr(g,AGNODE,a,NULL)) | |
715 #define agfindedgeattr(g,a) (agattr(g,AGEDGE,a,NULL)) | |
716 #else | |
717 #include "graph.h" | |
718 #define SET_RANKDIR(g,rd) ((g)->u.rankdir = (rd)) | |
719 #define agnameof(x) ((x)->name) | |
720 /* warning, agraphof doesn't work for edges */ | |
721 #define agraphof(n) ((n)->graph) | |
722 #define agroot(g) ((g)->root) | |
723 #define aghead(e) ((e)->head) | |
724 #define agtail(e) ((e)->tail) | |
725 #define agisdirected(g) ((g)->kind & AGFLAG_DIRECTED) | |
726 #define AGID(x) ((x)->id) | |
727 #define agfindgraphattr(g,a) agfindattr((g)->root,a) | |
728 #define agfindnodeattr(g,a) agfindattr((g)->proto->n,a) | |
729 #define agfindedgeattr(g,a) agfindattr((g)->proto->e,a) | |
730 #define agcanonStr(s) agcanonical(s) | |
731 #endif | |
732 | |
733 | |
734 typedef struct { | |
735 int useGrid; /* use grid for speed up */ | |
736 int useNew; /* encode x-K into attractive force */ | |
737 int numIters; /* actual iterations in layout */ | |
738 int unscaled; /* % of iterations used in pass 1 */ | |
739 double C; /* Repulsion factor in xLayout */ | |
740 double Tfact; /* scale temp from default expression */ | |
741 double K; /* spring constant; ideal distance */ | |
742 double T0; /* initial temperature */ | |
743 } fdpParms_t; | |
744 | |
745 typedef struct { | |
746 int flags; | |
747 } gvlayout_features_t; | |
748 | |
749 #ifdef __cplusplus | |
750 } | |
751 #endif | |
752 #endif |