add attribute notranslate to allow the user to avoid a translation.
<TR><TD><A NAME=a:normalize HREF=#d:normalize>normalize</A>
</TD><TD>G</TD><TD>double<BR><A HREF=#k:bool>bool</A>
</TD><TD ALIGN="CENTER">false</TD><TD></TD><TD>not dot</TD> </TR>
+ <TR><TD><A NAME=a:notranslate HREF=#d:notranslate>notranslate</A>
+</TD><TD>G</TD><TD><A HREF=#k:bool>bool</A>
+</TD><TD ALIGN="CENTER">false</TD><TD></TD><TD>neato only</TD> </TR>
<TR><TD><A NAME=a:nslimit HREF=#d:nslimit>nslimit</A>
<BR><A NAME=a:nslimit1 HREF=#d:nslimit1>nslimit1</A>
</TD><TD>G</TD><TD>double</TD><TD ALIGN="CENTER"></TD><TD></TD><TD>dot only</TD> </TR>
corresponding to 0 degrees. <B>NOTE:</B> Since the attribute is evaluated first as a number,
0 and 1 cannot be used for false and true.
+<DT><A NAME=d:notranslate HREF=#a:notranslate><STRONG>notranslate</STRONG></A>
+<DD> By default, the final layout is translated so that the lower-left corner of the bounding box is
+ at the origin. This can be annoying if some nodes are pinned or if the user runs <TT>neato -n</TT>.
+ To avoid this translation, set <TT>notranslate</TT> to true.
+
<DT><A NAME=d:nslimit HREF=#a:nslimit><STRONG>nslimit</STRONG></A>
,<DT><A NAME=d:nslimit1 HREF=#a:nslimit1><STRONG>nslimit1</STRONG></A>
<DD> Used to set number of iterations in
difference between the old and new coordinates will give the translation,
which can then be subtracted from all of the appropriate coordinates.
<P>
- After 27 Feb 2014, this translation is no longer done. However, if the graph
+ After 27 Feb 2014, this translation can be avoided in neato by setting the
+ <A HREF="#d:notranslate">notranslate</A> to TRUE. However, if the graph
specifies <A HREF="#d:overlap">node overlap removal</A> or a change in
<A HREF="#d:ratio">aspect ratio</A>, node coordinates may still change.
If <TT>normalize</TT> is not a number, it is evaluated as a <TT>bool</TT>, with true
corresponding to 0 degrees. <B>NOTE:</B> Since the attribute is evaluated first as a number,
0 and 1 cannot be used for false and true.
+:notranslate:G:bool:false; neato
+By default, the final layout is translated so that the lower-left corner of the bounding box is
+at the origin. This can be annoying if some nodes are pinned or if the user runs <TT>neato -n</TT>.
+To avoid this translation, set <TT>notranslate</TT> to true.
:nslimit/nslimit1:G:double; dot
Used to set number of iterations in
network simplex applications. <B>nslimit</B> is used in
difference between the old and new coordinates will give the translation,
which can then be subtracted from all of the appropriate coordinates.
<P>
-After 27 Feb 2014, this translation is no longer done. However, if the graph
+After 27 Feb 2014, this translation can be avoided in neato by setting the
+<A HREF="#d:notranslate">notranslate</A> to TRUE. However, if the graph
specifies <A HREF="#d:overlap">node overlap removal</A> or a change in
<A HREF="#d:ratio">aspect ratio</A>, node coordinates may still change.
:pos:EN:point/splineType;
attrsym_t *G_bb = agfindgraphattr(g, "bb");
int didAdjust = 0; /* Have nodes been moved? */
int haveBackground;
+ boolean translate = !mapBool(agget(g, "notranslate"), FALSE);
/* If G_bb not defined, define it */
if (!G_bb)
}
}
else {
- boolean didShift = neato_set_aspect(g);
+ boolean didShift;
+ if (translate && !haveBackground && ((GD_bb(g).LL.x != 0)||(GD_bb(g).LL.y != 0)))
+ neato_translate (g);
+ didShift = neato_set_aspect(g);
/* if we have some edge positions and we either shifted or adjusted, free edge positions */
if ((posEdges != NoEdges) && (didShift || didAdjust)) {
freeEdgeInfo (g);
}
else gv_postprocess(g, 0);
} else {
+ boolean noTranslate = mapBool(agget(g, "notranslate"), FALSE);
PSinputscale = get_inputscale (g);
neato_init_graph(g);
layoutMode = neatoMode(g);
neatoLayout(g, gc, layoutMode, model, &am);
removeOverlapWith(gc, &am);
setEdgeType (gc, ET_LINE);
- doEdges(gc);
+ if (noTranslate) doEdges(g);
+ else spline_edges(g);
}
if (pin) {
bp = N_NEW(n_cc, boolean);
else {
neatoLayout(g, g, layoutMode, model, &am);
removeOverlapWith(g, &am);
- doEdges(g);
+ if (noTranslate) doEdges(g);
+ else spline_edges(g);
}
compute_bb(g);
addZ (g);
neatoLayout(g, g, layoutMode, model, &am);
removeOverlapWith(g, &am);
addZ (g);
- doEdges(g);
+ if (noTranslate) doEdges(g);
+ else spline_edges(g);
}
gv_postprocess(g, 0);
}
extern int spline_edges1(graph_t * g, int);
extern int splineEdges(graph_t *,
int (*edgefn) (graph_t *, expand_t*, int), int);
+ extern void neato_translate(Agraph_t * g);
extern boolean neato_set_aspect(graph_t * g);
extern void toggle(int);
extern int user_pos(Agsym_t *, Agsym_t *, Agnode_t *, int);
translateG(GD_clust(g)[i], offset);
}
-/* translate:
+/* neato_translate:
*/
-static void translate(Agraph_t * g)
+void neato_translate(Agraph_t * g)
{
node_t *n;
edge_t *e;
{
double xf, yf, actual, desired;
node_t *n;
+ boolean translated = FALSE;
if (g->root != g)
return FALSE;
/* compute_bb(g); */
if (GD_drawing(g)->ratio_kind) {
- if (ROUND(abs(GD_bb(g).LL.x)) || ROUND(abs(GD_bb(g).LL.y)))
- translate (g);
+ if ((abs(GD_bb(g).LL.x)) || (abs(GD_bb(g).LL.y))) {
+ translated = TRUE;
+ neato_translate (g);
+ }
/* normalize */
if (GD_flip(g)) {
double t = GD_bb(g).UR.x;
if (GD_drawing(g)->ratio_kind == R_FILL) {
/* fill is weird because both X and Y can stretch */
if (GD_drawing(g)->size.x <= 0)
- return FALSE;
+ return (translated || FALSE);
xf = (double) GD_drawing(g)->size.x / GD_bb(g).UR.x;
yf = (double) GD_drawing(g)->size.y / GD_bb(g).UR.y;
/* handle case where one or more dimensions is too big */
}
} else if (GD_drawing(g)->ratio_kind == R_EXPAND) {
if (GD_drawing(g)->size.x <= 0)
- return FALSE;
+ return (translated || FALSE);
xf = (double) GD_drawing(g)->size.x / GD_bb(g).UR.x;
yf = (double) GD_drawing(g)->size.y / GD_bb(g).UR.y;
if ((xf > 1.0) && (yf > 1.0)) {
double scale = MIN(xf, yf);
xf = yf = scale;
} else
- return FALSE;
+ return (translated || FALSE);
} else if (GD_drawing(g)->ratio_kind == R_VALUE) {
desired = GD_drawing(g)->ratio;
actual = (GD_bb(g).UR.y) / (GD_bb(g).UR.x);
yf = 1.0;
}
} else
- return FALSE;
+ return (translated || FALSE);
if (GD_flip(g)) {
double t = xf;
xf = yf;