]> granicus.if.org Git - graphviz/commitdiff
Fix bug 791
authorellson <devnull@localhost>
Tue, 18 Oct 2005 21:10:58 +0000 (21:10 +0000)
committerellson <devnull@localhost>
Tue, 18 Oct 2005 21:10:58 +0000 (21:10 +0000)
lib/common/splines.c
lib/dotgen/dotsplines.c

index 2545ba6b1c3d71b06f35b3750f47f4129b20a5f9..315f4809bb4a5083f15803823814a3f25f2ebb2a 100644 (file)
@@ -380,7 +380,12 @@ void add_box(path * P, box b)
  * boxes assuming an inverted node. Note that compassPort already does
  * some flipping. Even better would be to allow the *_path function
  * to provide a polygon.
+ *
+ * The extra space provided by FUDGE-2 prevents the edge from getting
+ * too close the side of the node.
  */
+#define FUDGE 2
+
 void
 beginpath(path * P, edge_t * e, int et, pathend_t * endp, bool merge)
 {
@@ -421,7 +426,7 @@ beginpath(path * P, edge_t * e, int et, pathend_t * endp, bool merge)
                b0.LL.y = P->start.p.y;
                b0.UR.x = b.UR.x;
                b0.UR.y = ND_coord_i(n).y + ND_ht_i(n)/2 + GD_ranksep(n->graph)/2;
-               b.UR.x = ND_coord_i(n).x - ND_lw_i(n) - 2;
+               b.UR.x = ND_coord_i(n).x - ND_lw_i(n) - (FUDGE-2);
                b.UR.y = b0.LL.y;
                b.LL.y = ND_coord_i(n).y - ND_ht_i(n)/2;
                b.LL.x -= 1;
@@ -434,7 +439,7 @@ beginpath(path * P, edge_t * e, int et, pathend_t * endp, bool merge)
                /* b0.LL.y = ND_coord_i(n).y + ND_ht_i(n)/2; */
                b0.UR.x = b.UR.x+1;
                b0.UR.y = ND_coord_i(n).y + ND_ht_i(n)/2 + GD_ranksep(n->graph)/2;
-               b.LL.x = ND_coord_i(n).x + ND_rw_i(n) + 2;
+               b.LL.x = ND_coord_i(n).x + ND_rw_i(n) + (FUDGE-2);
                b.UR.y = b0.LL.y;
                b.LL.y = ND_coord_i(n).y - ND_ht_i(n)/2;
                b.UR.x += 1;
@@ -490,7 +495,7 @@ beginpath(path * P, edge_t * e, int et, pathend_t * endp, bool merge)
                b0.UR.x = b.UR.x+1;
                b0.LL.x = P->start.p.x;
                b0.LL.y = b0.UR.y - GD_ranksep(n->graph)/2;
-               b.LL.x = ND_coord_i(n).x + ND_rw_i(n) + 2;
+               b.LL.x = ND_coord_i(n).x + ND_rw_i(n) + (FUDGE-2);
                b.LL.y = b0.UR.y;
                b.UR.y = ND_coord_i(n).y + ND_ht_i(n)/2;
                b.UR.x += 1;
@@ -616,7 +621,7 @@ void endpath(path * P, edge_t * e, int et, pathend_t * endp, bool merge)
                b0.UR.y = P->end.p.y;
                b0.UR.x = b.UR.x;
                b0.LL.y = ND_coord_i(n).y - ND_ht_i(n)/2 - GD_ranksep(n->graph)/2;
-               b.UR.x = ND_coord_i(n).x - ND_lw_i(n) - 2;
+               b.UR.x = ND_coord_i(n).x - ND_lw_i(n) - (FUDGE-2);
                b.LL.y = b0.UR.y;
                b.UR.y = ND_coord_i(n).y + ND_ht_i(n)/2;
                b.LL.x -= 1;
@@ -629,7 +634,7 @@ void endpath(path * P, edge_t * e, int et, pathend_t * endp, bool merge)
                /* b0.UR.y = ND_coord_i(n).y - ND_ht_i(n)/2; */
                b0.UR.x = b.UR.x+1;
                b0.LL.y = ND_coord_i(n).y - ND_ht_i(n)/2 - GD_ranksep(n->graph)/2;
-               b.LL.x = ND_coord_i(n).x + ND_rw_i(n) + 2;
+               b.LL.x = ND_coord_i(n).x + ND_rw_i(n) + (FUDGE-2);
                b.LL.y = b0.UR.y;
                b.UR.y = ND_coord_i(n).y + ND_ht_i(n)/2;
                b.UR.x += 1;
index 34bbc19a044b59795135b62bcfe8cda0b95ee00d..339e705a142bdad582534033b8395d2cde280c4e 100644 (file)
@@ -2036,7 +2036,12 @@ node_t *n, *adj;
  * Return an initial bounding box to be used for building the
  * beginning or ending of the path of boxes.
  * Height reflects height of tallest node on rank.
+ * The extra space provided by FUDGE allows begin/endpath to create a box
+ * FUDGE-2 away from the node, so the routing can avoid the node and the
+ * box is at least 2 wide.
  */
+#define FUDGE 4
+
 static box maximal_bbox(spline_info_t* sp, node_t* vn, edge_t* ie, edge_t* oe)
 {
     int nb, b;
@@ -2047,7 +2052,7 @@ static box maximal_bbox(spline_info_t* sp, node_t* vn, edge_t* ie, edge_t* oe)
     left_cl = right_cl = NULL;
 
     /* give this node all the available space up to its neighbors */
-    b = ND_coord_i(vn).x - ND_lw_i(vn);
+    b = ND_coord_i(vn).x - ND_lw_i(vn) - FUDGE;
     if ((left = neighbor(vn, ie, oe, -1))) {
        if ((left_cl = cl_bound(vn, left)))
            nb = GD_bb(left_cl).UR.x + sp->Splinesep;
@@ -2065,10 +2070,10 @@ static box maximal_bbox(spline_info_t* sp, node_t* vn, edge_t* ie, edge_t* oe)
        rv.LL.x = MIN(b, sp->LeftBound);
 
     /* we have to leave room for our own label! */
-    if (ND_label(vn))
+    if ((ND_node_type(vn) == VIRTUAL) && (ND_label(vn)))
        b = ND_coord_i(vn).x + 10;
     else
-       b = ND_coord_i(vn).x + ND_rw_i(vn);
+       b = ND_coord_i(vn).x + ND_rw_i(vn) + FUDGE;
     if ((right = neighbor(vn, ie, oe, 1))) {
        if ((right_cl = cl_bound(vn, right)))
            nb = GD_bb(right_cl).LL.x - sp->Splinesep;