]> granicus.if.org Git - graphviz/commitdiff
Adjust bounding box calculations. It now ignores virtual nodes, since the
authorerg <devnull@localhost>
Wed, 22 Nov 2006 17:54:52 +0000 (17:54 +0000)
committererg <devnull@localhost>
Wed, 22 Nov 2006 17:54:52 +0000 (17:54 +0000)
space alloted for these is not part of the drawing and can cause too much
space around the graph. Spline control points have always been used in the
bb calculation. The only other change to is to make sure ordinary edge
labels are included in the bb.

lib/dotgen/dotsplines.c
lib/dotgen/position.c

index 5790df6644590537f6b5f7c744a434039118991c..bf25b1c727c89346536c738ffd1e5d79737139e0 100644 (file)
@@ -373,8 +373,10 @@ void dot_splines(graph_t * g)
 
     /* place regular edge labels */
     for (n = GD_nlist(g); n; n = ND_next(n)) {
-       if ((ND_node_type(n) == VIRTUAL) && (ND_label(n)))
+       if ((ND_node_type(n) == VIRTUAL) && (ND_label(n))) {
            place_vnlabel(n);
+           updateBB(g, ND_label(n));
+       }
     }
 
     /* normalize splines so they always go from tail to head */
index 85559625109e8b24f4e809368293f1d69d73b628..85e8a57c48098fb827ac34aec0898a8ba3dd3c9c 100644 (file)
@@ -882,11 +882,15 @@ static void dot_compute_bb(graph_t * g, graph_t * root)
                continue;
            if ((v = GD_rank(g)[r].v[0]) == NULL)
                continue;
-           x = ND_coord_i(v).x - ND_lw_i(v);
-           LL.x = MIN(LL.x, x);
+           if (ND_node_type(v) == NORMAL) {
+               x = ND_coord_i(v).x - ND_lw_i(v);
+               LL.x = MIN(LL.x, x);
+           }
            v = GD_rank(g)[r].v[GD_rank(g)[r].n - 1];
-           x = ND_coord_i(v).x + ND_rw_i(v);
-           UR.x = MAX(UR.x, x);
+           if (ND_node_type(v) == NORMAL) {
+               x = ND_coord_i(v).x + ND_rw_i(v);
+               UR.x = MAX(UR.x, x);
+           }
        }
        offset = CL_OFFSET;
        for (c = 1; c <= GD_n_cluster(g); c++) {