From: erg Date: Wed, 16 Feb 2005 14:09:04 +0000 (+0000) Subject: Forgot to add these last night. X-Git-Tag: LAST_LIBGRAPH~32^2~7932 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=35f3c77c1ca586af1f5c37aafb8fdaf9db52fdbe;p=graphviz Forgot to add these last night. --- diff --git a/lib/neatogen/adjust.c b/lib/neatogen/adjust.c index 441a2016e..b79958628 100644 --- a/lib/neatogen/adjust.c +++ b/lib/neatogen/adjust.c @@ -649,7 +649,12 @@ static void updateGraph(Agraph_t * graph) } } -static void normalize(graph_t * g) +/* normalize: + * If normalize is set, move first node to origin, then + * rotate graph so that first edge is horizontal. + * FIX: Generalize to allow rotation determined by graph shape. + */ +void normalize(graph_t * g) { node_t *v; edge_t *e; @@ -723,7 +728,7 @@ static adjust_data *getAdjustMode(char *s) return adjustMode + 1; } -void adjustNodes(graph_t * G) +void removeOverlap(graph_t * G) { /* int userWindow = 0; */ char *flag; @@ -736,7 +741,6 @@ void adjustNodes(graph_t * G) if (agnnodes(G) < 2) return; - normalize(G); flag = agget(G, "overlap"); if (flag == NULL) return; @@ -800,3 +804,12 @@ void adjustNodes(graph_t * G) /* fprintf (stderr, "old scale %.4f sec\n", elapsed_sec()); */ } + +void adjustNodes(graph_t * G) +{ + if (agnnodes(G) < 2) + return; + normalize(G); + removeOverlap (G); +} + diff --git a/lib/neatogen/adjust.h b/lib/neatogen/adjust.h index 251202b2d..4168e8c9b 100644 --- a/lib/neatogen/adjust.h +++ b/lib/neatogen/adjust.h @@ -24,6 +24,8 @@ extern "C" { #endif extern void adjustNodes(graph_t * G); + extern void normalize(graph_t * g); + extern void removeOverlap(graph_t * G); #ifdef __cplusplus }