From f54d3f4ad44f5da33f0fd4d19094447fca7dd34b Mon Sep 17 00:00:00 2001 From: erg Date: Mon, 6 Oct 2008 21:53:28 +0000 Subject: [PATCH] Fix spline_edges0 to handle graphs with clusters --- lib/neatogen/neatosplines.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/lib/neatogen/neatosplines.c b/lib/neatogen/neatosplines.c index 7754a8f86..740bcc96c 100644 --- a/lib/neatogen/neatosplines.c +++ b/lib/neatogen/neatosplines.c @@ -961,11 +961,26 @@ void spline_edges0(graph_t * g) spline_edges1(g, et); } +/* shiftClusters: + */ +static void +shiftClusters (graph_t * g, pointf offset) +{ + int i; + + for (i = 1; i <= GD_n_cluster(g); i++) { + shiftClusters (GD_clust(g)[i], offset); + } + + GD_bb(g).UR.x -= offset.x; + GD_bb(g).UR.y -= offset.y; + GD_bb(g).LL.x -= offset.x; + GD_bb(g).LL.y -= offset.y; +} + /* spline_edges: * Compute bounding box, translate graph to origin, - * then construct all edges. We assume the graph - * has no clusters, and only nodes have been - * positioned. + * then construct all edges. */ void spline_edges(graph_t * g) { @@ -979,10 +994,8 @@ void spline_edges(graph_t * g) ND_pos(n)[0] -= offset.x; ND_pos(n)[1] -= offset.y; } - GD_bb(g).UR.x -= GD_bb(g).LL.x; - GD_bb(g).UR.y -= GD_bb(g).LL.y; - GD_bb(g).LL.x = 0; - GD_bb(g).LL.y = 0; + + shiftClusters (g, GD_bb(g).LL); spline_edges0(g); } -- 2.40.0