From: Costa Shulyupin Date: Mon, 2 May 2022 03:10:07 +0000 (+0300) Subject: fix emitSearchGraph, use layout=neato and pos=x,y! X-Git-Tag: 4.0.0~11^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ac628025d328904fe8d8adc69c3742860ecba089;p=graphviz fix emitSearchGraph, use layout=neato and pos=x,y! Function emitSearchGraph dumps internal state of orthogonal routing search graph in dot format for debugging. Output of the function is not used for final user output. The functions already receives coordinates of nodes. These coordinates should be used verbatim. Before this patch `dot` changes locations of search graph nodes and rendered output image is not useful. This patch - adds dummy layout `neato` because attribute `pos` is meaningful for only for `neato` and `fdp`. - adds "!" to force fixed positions by default. Finally layout engine doesn't changes layout and positions of nodes. References: - https://graphviz.org/docs/attrs/pos/ - https://graphviz.org/docs/attr-types/point/ --- diff --git a/lib/ortho/ortho.c b/lib/ortho/ortho.c index f9cbfe671..025ef2629 100644 --- a/lib/ortho/ortho.c +++ b/lib/ortho/ortho.c @@ -1511,6 +1511,7 @@ emitSearchGraph (FILE* fp, sgraph* sg) int i; fputs ("graph G {\n", fp); fputs (" node[shape=point]\n", fp); + fputs (" layout=neato\n", fp); for (i = 0; i < sg->nnodes; i++) { np = sg->nodes+i; cp = np->cells[0]; @@ -1523,7 +1524,7 @@ emitSearchGraph (FILE* fp, sgraph* sg) if (IsNode(cp)) cp = np->cells[1]; p = coordOf (cp, np); } - fprintf (fp, " %d [pos=\"%d,%d\"]\n", i, p.x, p.y); + fprintf (fp, " %d [pos=\"%d,%d!\"]\n", i, p.x, p.y); } for (i = 0; i < sg->nedges; i++) { ep = sg->edges+i;