]> granicus.if.org Git - graphviz/commitdiff
Fix use of extra data. Originally, we used ND_alg but this needs to be
authorerg <devnull@localhost>
Tue, 31 May 2011 15:46:20 +0000 (15:46 +0000)
committererg <devnull@localhost>
Tue, 31 May 2011 15:46:20 +0000 (15:46 +0000)
freed, as some spline routing uses it. But when splines=compound, we
also need the PARENT field. So we now use the dot part of Agnodeinfo_t
to provide the parent and dnode fields.

lib/fdpgen/fdp.h
lib/fdpgen/fdpinit.c
lib/fdpgen/layout.c

index 22fed91c83852104821fc115e537bd294ec392b7..8afceed850665db08d4f6742b74feb4faca20b7a 100644 (file)
@@ -53,6 +53,7 @@ typedef struct {
 #define GORIG(g)    (GDATA(g)->orig)
 #endif
 
+#if 0
 /* ndata is attached to nodes in real graphs.
  * Real nodes also use "builtin" fields:
  *   pos   - position information
@@ -69,6 +70,23 @@ typedef struct {
 #define NDATA(n) ((ndata*)(ND_alg(n)))
 #define DNODE(n) (NDATA(n)->dn)
 #define PARENT(n) (NDATA(n)->parent)
+#endif
+
+/* 
+ * Real nodes use "builtin" fields:
+ *   ND_pos   - position information
+ *   ND_width,ND_height     - node dimensions
+ *   ND_pinned
+ *   ND_lw,ND_rw,ND_ht      - node dimensions in points
+ *   ND_id
+ *   ND_shape, ND_shape_info
+ *
+ * In addition, we use two of the dot fields for parent and derived node. 
+ * Previously, we attached these via ND_alg, but ND_alg may be needed for
+ * spline routing, and splines=compound also requires the parent field. 
+ */
+#define DNODE(n) (ND_next(n))
+#define PARENT(n) (ND_clust(n))
 
 /* dndata is attached to nodes in derived graphs.
  * Derived nodes also use "builtin" fields:
index e1cc410eea0a84b8390421bb80d8c0cd8b0edf7e..cdc3bfd71b9a1247205c6bf491e92d1a8f955da7 100644 (file)
@@ -98,7 +98,7 @@ void fdp_init_node_edge(graph_t * g)
     edge_t *e;
     int nn;
     int i;
-    ndata* alg;
+    /* ndata* alg; */
 
     processClusterEdges(g);
 
@@ -106,12 +106,12 @@ void fdp_init_node_edge(graph_t * g)
      * add new nodes.
      */
     nn = agnnodes(g);
-    alg = N_NEW(nn, ndata);
+    /* alg = N_NEW(nn, ndata); */
     GD_neato_nlist(g) = N_NEW(nn + 1, node_t *);
 
     for (i = 0, n = agfstnode(g); n; n = agnxtnode(g, n)) {
        neato_init_node (n);
-       ND_alg(n) = alg + i;
+       /* ND_alg(n) = alg + i; */
        GD_neato_nlist(g)[i] = n;
        ND_id(n) = i++;
     }
index 6c1e5f22668e9402cc51ae822b6b2f755196dd30..6f2290c472fe93cfcd38f0dfe04304b33543250a 100644 (file)
@@ -1187,13 +1187,15 @@ fdpSplines (graph_t * g)
 
 void fdp_layout(graph_t * g)
 {
-    Agnode_t* n;
+    /* Agnode_t* n; */
 
     fdp_init_graph(g);
     fdpLayout(g);
+#if 0
     /* free ND_alg field so it can be used in spline routing */
     if ((n = agfstnode(g)))
        free(ND_alg(n));
+#endif
     neato_set_aspect(g);
 
     if (EDGE_TYPE(g) != ET_NONE) fdpSplines (g);