|
Graphviz
2.29.20120523.0446
|
00001 /* $Id$ $Revision$ */ 00002 /* vim:set shiftwidth=4 ts=8: */ 00003 00004 /************************************************************************* 00005 * Copyright (c) 2011 AT&T Intellectual Property 00006 * All rights reserved. This program and the accompanying materials 00007 * are made available under the terms of the Eclipse Public License v1.0 00008 * which accompanies this distribution, and is available at 00009 * http://www.eclipse.org/legal/epl-v10.html 00010 * 00011 * Contributors: See CVS logs. Details at http://www.graphviz.org/ 00012 *************************************************************************/ 00013 00014 #ifndef FDP_H 00015 #define FDP_H 00016 00017 #include <render.h> 00018 00019 #ifdef FDP_PRIVATE 00020 00021 #define NDIM 2 00022 00023 typedef struct bport_s { 00024 edge_t *e; 00025 node_t *n; 00026 double alpha; 00027 } bport_t; 00028 00029 /* gdata is attached to the root graph, each cluster graph, 00030 * and to each derived graph. 00031 * Graphs also use "builtin" fields: 00032 * n_cluster, clust - to record clusters 00033 */ 00034 typedef struct { 00035 bport_t *ports; /* boundary ports. 0-terminated */ 00036 int nports; /* no. of ports */ 00037 boxf bb; /* bounding box of graph */ 00038 int flags; 00039 int level; /* depth in graph hierarchy */ 00040 graph_t *parent; /* smallest containing cluster */ 00041 #ifdef DEBUG 00042 graph_t *orig; /* original of derived graph */ 00043 #endif 00044 } gdata; 00045 00046 #define GDATA(g) ((gdata*)(GD_alg(g))) 00047 #define BB(g) (GDATA(g)->bb) 00048 #define PORTS(g) (GDATA(g)->ports) 00049 #define NPORTS(g) (GDATA(g)->nports) 00050 #define LEVEL(g) (GDATA(g)->level) 00051 #define GPARENT(g) (GDATA(g)->parent) 00052 #ifdef DEBUG 00053 #define GORIG(g) (GDATA(g)->orig) 00054 #endif 00055 00056 #if 0 00057 /* ndata is attached to nodes in real graphs. 00058 * Real nodes also use "builtin" fields: 00059 * pos - position information 00060 * width,height - node dimensions 00061 * xsize,ysize - node dimensions in points 00062 */ 00063 typedef struct { 00064 node_t *dn; /* points to corresponding derived node, 00065 * which may represent the node or its 00066 * containing cluster. */ 00067 graph_t *parent; /* smallest containing cluster */ 00068 } ndata; 00069 00070 #define NDATA(n) ((ndata*)(ND_alg(n))) 00071 #define DNODE(n) (NDATA(n)->dn) 00072 #define PARENT(n) (NDATA(n)->parent) 00073 #endif 00074 00075 /* 00076 * Real nodes use "builtin" fields: 00077 * ND_pos - position information 00078 * ND_width,ND_height - node dimensions 00079 * ND_pinned 00080 * ND_lw,ND_rw,ND_ht - node dimensions in points 00081 * ND_id 00082 * ND_shape, ND_shape_info 00083 * 00084 * In addition, we use two of the dot fields for parent and derived node. 00085 * Previously, we attached these via ND_alg, but ND_alg may be needed for 00086 * spline routing, and splines=compound also requires the parent field. 00087 */ 00088 #define DNODE(n) (ND_next(n)) 00089 #define PARENT(n) (ND_clust(n)) 00090 00091 /* dndata is attached to nodes in derived graphs. 00092 * Derived nodes also use "builtin" fields: 00093 * clust - for cluster nodes, points to cluster in real graph. 00094 * pos - position information 00095 * width,height - node dimensions 00096 */ 00097 typedef struct { 00098 int deg; /* degree of node */ 00099 int wdeg; /* weighted degree of node */ 00100 node_t *dn; /* If derived node is not a cluster, */ 00101 /* dn points real node. */ 00102 double disp[NDIM]; /* incremental displacement */ 00103 } dndata; 00104 00105 #define DNDATA(n) ((dndata*)(ND_alg(n))) 00106 #define DISP(n) (DNDATA(n)->disp) 00107 #define ANODE(n) (DNDATA(n)->dn) 00108 #define DEG(n) (DNDATA(n)->deg) 00109 #define WDEG(n) (DNDATA(n)->wdeg) 00110 #define IS_PORT(n) (!ANODE(n) && !ND_clust(n)) 00111 00112 #endif /* FDP_PRIVATE */ 00113 00114 #ifdef __cplusplus 00115 extern "C" { 00116 #endif 00117 00118 extern void fdp_layout(Agraph_t * g); 00119 extern void fdp_nodesize(node_t *, boolean); 00120 extern void fdp_init_graph(Agraph_t * g); 00121 extern void fdp_init_node_edge(Agraph_t * g); 00122 extern void fdp_cleanup(Agraph_t * g); 00123 00124 #ifdef __cplusplus 00125 } 00126 #endif 00127 #endif
1.7.5