* 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)
{
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;
/* 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;
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;
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;
/* 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;
* 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;
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;
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;