]> granicus.if.org Git - graphviz/commitdiff
Remove xsize and ysize attributes. These are vestiges of int-based data structures,
authorerg <devnull@localhost>
Tue, 15 Feb 2011 16:27:53 +0000 (16:27 +0000)
committererg <devnull@localhost>
Tue, 15 Feb 2011 16:27:53 +0000 (16:27 +0000)
and are redundant given rw, lw and ht.

lib/circogen/circularinit.c
lib/common/geom.h
lib/common/types.h
lib/common/utils.c
lib/fdpgen/layout.c

index 11c3100cc0d02c7dbf46619021c745d77410e14c..f1f82f94134a6769b2483c1e07851cf2d2e8a57a 100644 (file)
@@ -89,8 +89,10 @@ static node_t *makeDerivedNode(graph_t * dg, char *name, int isNode,
     ND_alg(n) = (void *) NEW(cdata);
     if (isNode) {
        ND_pos(n) = N_NEW(Ndim, double);
+#if 0
        ND_xsize(n) = ND_xsize((node_t *) orig);
        ND_ysize(n) = ND_ysize((node_t *) orig);
+#endif
        ORIGN(n) = (node_t *) orig;
     } else
        ORIGG(n) = (graph_t *) orig;
index 0c214b742bbe40b6227636bc4043428dfa454ea4..2c8492295e7b8082d21ac2c398e01ab4a379b18c 100644 (file)
@@ -68,6 +68,7 @@ typedef struct { pointf LL, UR; } boxf;
 #define POINTS_PER_MM          ((double)POINTS_PER_INCH * 0.0393700787)
 
 #define POINTS(a_inches)       (ROUND((a_inches)*POINTS_PER_INCH))
+#define INCH2PS(a_inches)      ((a_inches)*(double)POINTS_PER_INCH)
 #define PS2INCH(a_points)      ((a_points)/(double)POINTS_PER_INCH)
 
 #define P2PF(p,pf)             ((pf).x = (p).x,(pf).y = (p).y)
index f2e790e3f4bc638e8c45906f08e40cca82dc1be5..b09203585a56e9ffe8dfd0711d29b2f59256801a 100644 (file)
@@ -481,7 +481,6 @@ typedef enum {NATIVEFONTS,PSFONTS,SVGFONTS} fontname_kind;
 
 #ifndef DOT_ONLY
        unsigned char pinned;
-       short xsize, ysize;
        int id, heapindex, hops;
        double *pos, dist;
 #endif
@@ -576,8 +575,8 @@ typedef enum {NATIVEFONTS,PSFONTS,SVGFONTS} fontname_kind;
 #define ND_tree_out(n) (((Agnodeinfo_t*)AGDATA(n))->tree_out)
 #define ND_weight_class(n) (((Agnodeinfo_t*)AGDATA(n))->weight_class)
 #define ND_width(n) (((Agnodeinfo_t*)AGDATA(n))->width)
-#define ND_xsize(n) (((Agnodeinfo_t*)AGDATA(n))->xsize)
-#define ND_ysize(n) (((Agnodeinfo_t*)AGDATA(n))->ysize)
+#define ND_xsize(n) (ND_lw(n)+ND_rw(n))
+#define ND_ysize(n) (ND_ht(n))
 
 #else
 
@@ -633,8 +632,8 @@ typedef enum {NATIVEFONTS,PSFONTS,SVGFONTS} fontname_kind;
 #define ND_tree_out(n) (n)->u.tree_out
 #define ND_weight_class(n) (n)->u.weight_class
 #define ND_width(n) (n)->u.width
-#define ND_xsize(n) (n)->u.xsize
-#define ND_ysize(n) (n)->u.ysize
+#define ND_xsize(n) (ND_lw(n)+ND_rw(n))
+#define ND_ysize(n) (ND_ht(n))
 #endif
 
     typedef struct Agedgeinfo_t {
index 4b5caeabc1c0673fa1569d183706063e4daf72f9..810849d2e77ada321e906527b6f016ea6930c2ea 100644 (file)
@@ -852,8 +852,8 @@ void compute_bb(graph_t * g)
     bb.UR = pointfof(-INT_MAX, -INT_MAX);
     for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
        ptf = coord(n);
-       s2.x = ND_xsize(n) / 2. + 1;
-       s2.y = ND_ysize(n) / 2. + 1;
+       s2.x = ND_xsize(n) / 2.0;
+       s2.y = ND_ysize(n) / 2.0;
        b.LL = sub_pointf(ptf, s2);
        b.UR = add_pointf(ptf, s2);
 
@@ -1872,17 +1872,17 @@ void gv_cleanup_node(node_t * n)
 
 void gv_nodesize(node_t * n, boolean flip)
 {
-    int w;
+    double w;
 
     if (flip) {
-        w = ND_xsize(n) = POINTS(ND_height(n));
+        w = INCH2PS(ND_height(n));
         ND_lw(n) = ND_rw(n) = w / 2;
-        ND_ht(n) = ND_ysize(n) = POINTS(ND_width(n));
+        ND_ht(n) = INCH2PS(ND_width(n));
     } 
     else {
-        w = ND_xsize(n) = POINTS(ND_width(n));
+        w = INCH2PS(ND_width(n));
         ND_lw(n) = ND_rw(n) = w / 2;
-        ND_ht(n) = ND_ysize(n) = POINTS(ND_height(n));
+        ND_ht(n) = INCH2PS(ND_height(n));
     }
 }
 
index 78c0ca4279f86e98f32bd2360c042f3ac52b8420..6c1e5f22668e9402cc51ae822b6b2f755196dd30 100644 (file)
@@ -536,8 +536,9 @@ static graph_t *deriveGraph(graph_t * g, layout_info * infop)
            ND_id(dn) = id++;
            ND_width(dn) = ND_width(n);
            ND_height(dn) = ND_height(n);
-           ND_xsize(dn) = ND_xsize(n);
-           ND_ysize(dn) = ND_ysize(n);
+           ND_lw(dn) = ND_lw(n);
+           ND_rw(dn) = ND_rw(n);
+           ND_ht(dn) = ND_ht(n);
            ND_shape(dn) = ND_shape(n);
            ND_shape_info(dn) = ND_shape_info(n);
            if (ND_pinned(n)) {
@@ -841,7 +842,7 @@ setClustNodes(graph_t* root)
     pointf ctr;
     node_t *n;
     double w, h;
-    int h2, w2, h_i;
+    double h2, w2;
     pointf *vertices;
 
     for (n = agfstnode(root); n; n = agnxtnode(root, n)) {
@@ -853,16 +854,16 @@ setClustNodes(graph_t* root)
        h = bb.UR.y - bb.LL.y;
        ctr.x = w / 2.0;
        ctr.y = h / 2.0;
-       w2 = POINTS(w / 2.0);
-       h2 = POINTS(h / 2.0);
-       h_i = POINTS(h);
+       w2 = INCH2PS(w / 2.0);
+       h2 = INCH2PS(h / 2.0);
+       h = INCH2PS(h);
        ND_pos(n)[0] = ctr.x;
        ND_pos(n)[1] = ctr.y;
        ND_width(n) = w;
        ND_height(n) = h;
-       ND_xsize(n) = POINTS(w);
+       /* ND_xsize(n) = POINTS(w); */
        ND_lw(n) = ND_rw(n) = w2;
-       ND_ht(n) = ND_ysize(n) = h_i;
+       ND_ht(n) = h;
 
        vertices = ((polygon_t *) ND_shape_info(n))->vertices;
        vertices[0].x = ND_rw(n);
@@ -945,8 +946,8 @@ setClustNodes(graph_t* root)
                ND_height(n) = BB(sg).UR.y;
                pt.x = POINTS_PER_INCH * BB(sg).UR.x;
                pt.y = POINTS_PER_INCH * BB(sg).UR.y;
-               ND_xsize(n) = pt.x;
-               ND_ysize(n) = pt.y;
+               ND_rw(n) = ND_lw(n) = pt.x/2;
+               ND_ht(n) = pt.y;
            } else if (IS_PORT(n))
                agdelete(cg, n);        /* remove ports from component */
        }