2
This software may only be used by you under license from AT&T Corp.
3
("AT&T"). A copy of AT&T's Source Code Agreement is available at
4
AT&T's Internet website having the URL:
5
<http://www.research.att.com/sw/tools/graphviz/license/source.html>
6
If you received this software without first entering into a license
7
with AT&T, you have an infringing copy of this software and cannot use
8
it without violating AT&T's intellectual property rights.
21
static void place_flip_graph_label(graph_t* g);
24
"/pathbox { /Y exch %d sub def /X exch %d sub def /y exch %d sub def /x exch %d sub def newpath x y moveto X y lineto X Y lineto x Y lineto closepath stroke } def\n"
26
"/pathbox { /X exch neg %d sub def /Y exch %d sub def /x exch neg %d sub def /y exch %d sub def newpath x y moveto X y lineto X Y lineto x Y lineto closepath stroke } def\n"
34
if (Flip) { p.x = -y - Offset.x; p.y = x - Offset.y; }
35
else { p.x = x - Offset.x; p.y = y - Offset.y; }
45
if (e->u.spl == NULL) {
46
if ((Concentrate == FALSE) || (e->u.edge_type != IGNORED))
47
fprintf(stderr,"lost %s %s edge\n",e->tail->name,e->head->name);
50
for (j = 0; j < e->u.spl->size; j++) {
51
bz = e->u.spl->list[j];
52
for (k = 0; k < bz.size; k++)
53
bz.list[k] = map_point(bz.list[k]);
55
e->u.spl->list[j].sp = map_point (e->u.spl->list[j].sp);
57
e->u.spl->list[j].ep = map_point (e->u.spl->list[j].ep);
59
if (e->u.label) e->u.label->p = map_point(e->u.label->p);
61
if (e->u.head_label) e->u.head_label->p = map_point(e->u.head_label->p);
62
if (e->u.tail_label) e->u.tail_label->p = map_point(e->u.tail_label->p);
65
void translate_bb(graph_t* g, int lr)
72
new_bb.LL = map_point(pointof(bb.LL.x,bb.UR.y));
73
new_bb.UR = map_point(pointof(bb.UR.x,bb.LL.y));
76
new_bb.LL = map_point(pointof(bb.LL.x,bb.LL.y));
77
new_bb.UR = map_point(pointof(bb.UR.x,bb.UR.y));
81
g->u.label->p = map_point(g->u.label->p);
83
for (c = 1; c <= g->u.n_cluster; c++) translate_bb(g->u.clust[c],lr);
86
static void translate_drawing(graph_t* g, nodesizefn_t ns)
91
for (v = agfstnode(g); v; v = agnxtnode(g,v)) {
93
v->u.coord = map_point(v->u.coord);
94
for (e = agfstout(g,v); e; e = agnxtout(g,e)) map_edge(e);
96
translate_bb(g,g->u.left_to_right);
100
place_root_label (graph_t* g)
104
d = cvt2pt(g->u.label->dimen);
106
p.y = (g->u.bb.LL.y + g->u.bb.UR.y)/2;
107
p.x = g->u.bb.LL.x + d.y/2;
110
p.x = (g->u.bb.LL.x + g->u.bb.UR.x)/2;
111
p.y = g->u.bb.LL.y + d.y/2;
116
void dotneato_postprocess(Agraph_t *g, nodesizefn_t ns)
118
Flip = g->u.left_to_right;
119
if (Flip) place_flip_graph_label(g);
120
else place_graph_label(g);
123
int yd = POINTS(g->u.label->dimen.x);
124
g->u.bb.LL.x -= POINTS(g->u.label->dimen.y);
125
/* in case label is wide than the rest of the drawing */
126
if (yd > g->u.bb.UR.y - g->u.bb.LL.y) {
128
g->u.bb.LL.y -= yd; g->u.bb.UR.y += yd;
131
Offset.x = -g->u.bb.UR.y;
132
Offset.y = g->u.bb.LL.x;
136
int xd = POINTS(g->u.label->dimen.x);
137
g->u.bb.LL.y -= POINTS(g->u.label->dimen.y);
138
if (xd > g->u.bb.UR.x - g->u.bb.LL.x) {
140
g->u.bb.LL.x -= xd; g->u.bb.UR.x += xd;
145
translate_drawing(g, ns);
146
if (g->u.label) place_root_label (g);
150
fprintf (stderr, M2, Offset.x, Offset.y, Offset.x, Offset.y);
152
fprintf (stderr, M1, Offset.y, Offset.x, Offset.y, Offset.x);
156
void osize_label(textlabel_t *label, int *b, int* t ,int *l, int *r)
159
sz2.x = POINTS(label->dimen.x)/2;
160
sz2.y = POINTS(label->dimen.y)/2;
161
pt = add_points(label->p,sz2);
162
if (*r < pt.x) *r = pt.x;
163
if (*t < pt.y) *t = pt.y;
164
pt = sub_points(label->p,sz2);
165
if (*l > pt.x) *l = pt.x;
166
if (*b > pt.y) *b = pt.y;
169
/* place_flip_graph_label:
170
* Put cluster labels recursively in the flip case.
172
static void place_flip_graph_label(graph_t* g)
179
if ((g != g->root) && (g->u.label)) {
180
d = cvt2pt(g->u.label->dimen);
181
pos = agget(g,"labeljust");
182
if (pos && (pos[0] == 'r')) {
183
p.y = g->u.bb.LL.y + d.x/2;
185
if (g->root->u.bb.UR.y < maxy) g->root->u.bb.UR.y = maxy;
188
p.y = g->u.bb.UR.y - d.x/2;
190
if (g->root->u.bb.LL.y > miny) g->root->u.bb.LL.y = miny;
193
pos = agget(g,"labelloc");
194
if (pos && (pos[0] == 'b')) {
195
p.x = g->u.bb.LL.x - d.y/2;
196
minx = g->u.bb.LL.x - d.y;
197
if (g->root->u.bb.LL.x > minx) g->root->u.bb.LL.x = minx;
200
p.x = g->u.bb.UR.x + d.y/2;
201
maxx = g->u.bb.UR.x + d.y;
202
if (g->root->u.bb.UR.x < maxx) g->root->u.bb.UR.x = maxx;
207
for (c = 1; c <= g->u.n_cluster; c++)
208
place_flip_graph_label(g->u.clust[c]);
211
/* place_graph_label:
212
* Put cluster labels recursively in the non-flip case.
214
void place_graph_label(graph_t* g)
222
if ((g != g->root) && (g->u.label)) {
223
d = cvt2pt(g->u.label->dimen);
224
pos = agget(g,"labeljust");
225
if (pos && (pos[0] == 'r')) {
226
p.x = g->u.bb.UR.x - d.x/2;
228
if (g->root->u.bb.LL.x > minx) g->root->u.bb.LL.x = minx;
231
p.x = g->u.bb.LL.x + d.x/2;
233
if (g->root->u.bb.UR.x < maxx) g->root->u.bb.UR.x = maxx;
235
pos = agget(g,"labelloc");
236
if (pos && (pos[0] == 'b')) {
237
p.y = g->u.bb.LL.y + d.y/2;
239
/* remove this code - fixed the graph labeling nightmare. */
240
miny = g->u.bb.LL.y - d.y;
241
if (g->root->u.bb.LL.y > miny) g->root->u.bb.LL.y = miny;
245
p.y = g->u.bb.UR.y - d.y/2;
247
maxy = g->u.bb.UR.y + d.y;
248
if (g->root->u.bb.UR.y < maxy) g->root->u.bb.UR.y = maxy;
254
for (c = 1; c <= g->u.n_cluster; c++)
255
place_graph_label(g->u.clust[c]);