From 5bef6682fe5094adcfb5b9fae15733e2b90a81f8 Mon Sep 17 00:00:00 2001 From: erg Date: Thu, 28 May 2009 23:07:11 +0000 Subject: [PATCH] Fix putGraphs to use user sort information in packing graphs --- lib/pack/pack.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/pack/pack.c b/lib/pack/pack.c index ea530d7e3..2fbf8a640 100644 --- a/lib/pack/pack.c +++ b/lib/pack/pack.c @@ -907,10 +907,11 @@ polyGraphs(int ng, Agraph_t ** gs, Agraph_t * root, pack_info * pinfo) point *putGraphs(int ng, Agraph_t ** gs, Agraph_t * root, pack_info * pinfo) { - int i; + int i, v; boxf* bbs; Agraph_t* g; point* pts; + char* s; if (ng <= 0) return NULL; @@ -925,8 +926,20 @@ point *putGraphs(int ng, Agraph_t ** gs, Agraph_t * root, bbs[i] = GD_bb(g); } - if (pinfo->mode == l_array) + if (pinfo->mode == l_array) { + if (pinfo->flags & PK_USER_VALS) { + pinfo->vals = N_NEW(ng, unsigned char); + for (i = 0; i < ng; i++) { + s = agget (gs[i], "sortv"); + if (s && (sscanf (s, "%d", &v) > 0) && (v >= 0)) + pinfo->vals[i] = v; + } + + } pts = arrayRects (ng, bbs, pinfo); + if (pinfo->flags & PK_USER_VALS) + free (pinfo->vals); + } free (bbs); -- 2.40.0