19 #define YDIR(y) (Y_invert ? (Y_off - (y)) : (y))
20 #define YFDIR(y) (Y_invert ? (YF_off - (y)) : (y))
30 static int (*putstr) (
void *chan,
const char *
str);
32 static void agputs (
const char*
s, FILE* fp)
34 putstr ((
void*)fp, s);
36 static void agputc (
int c, FILE* fp)
38 static char buf[2] = {
'\0',
'\0'};
40 putstr ((
void*)fp, buf);
44 static void printstring(FILE * f,
char *prefix,
char *s)
46 if (prefix) agputs(prefix, f);
50 static void printint(FILE * f,
char *prefix,
int i)
54 if (prefix) agputs(prefix, f);
55 sprintf(buf,
"%d", i);
59 static void printdouble(FILE * f,
char *prefix,
double v)
63 if (prefix) agputs(prefix, f);
64 sprintf(buf,
"%.5g", v);
68 static void printpoint(FILE * f,
pointf p)
80 static void setYInvert(
graph_t * g)
91 static char* canon (
graph_t *g,
char* s)
106 printstring(f,
" ", name);
115 int i, j, splinePoints;
128 printdouble(f,
"graph ", job->
zoom);
143 printstring(f,
" ", lbl);
145 printstring(f,
" ",
ND_shape(n)->name);
148 if (fillcolor[0] ==
'\0')
150 printstring(f,
" ", fillcolor);
157 if (!(tport =
agget(e,
"tailport")))
159 if (!(hport =
agget(e,
"headport")))
166 for (i = 0; i <
ED_spl(e)->size; i++) {
168 splinePoints += bz.
size;
170 printstring(f,
NULL,
"edge");
171 writenodeandport(f,
agtail(e), tport);
172 writenodeandport(f,
aghead(e), hport);
173 printint(f,
" ", splinePoints);
174 for (i = 0; i <
ED_spl(e)->size; i++) {
176 for (j = 0; j < bz.
size; j++)
177 printpoint(f, bz.
list[j]);
198 sprintf(buf,
"%.5g,%.5g,%.5g,%.5g ",
205 for (i = 0; i < f->
n_flds; i++)
206 set_record_rects(n, f->
fld[i], xb);
215 sprintf(buf,
"%.5g,%.5g,%.5g,%.5g",
GD_bb(g).LL.x,
YDIR(
GD_bb(g).LL.y),
220 sprintf(buf,
"%.5g,%.5g", pt.
x,
YDIR(pt.
y));
223 sprintf(buf,
"%.2f",
PS2INCH(pt.
x));
225 sprintf(buf,
"%.2f",
PS2INCH(pt.
y));
229 rec_attach_bb(
GD_clust(g)[c], bbsym, lpsym, lwsym, lhsym);
238 unsigned char xbuffer[BUFSIZ];
250 e_arrows = s_arrows = 0;
280 for (k = 3; k <
GD_odim(g); k++) {
287 agset(n,
"pos", buf);
295 sprintf(buf,
"%.5g,%.5g", ptf.
x,
YDIR(ptf.
y));
296 agset(n,
"xlp", buf);
298 if (strcmp(
ND_shape(n)->name,
"record") == 0) {
309 char *p =
agget(n,
"samplepoints");
317 for (i = 0; i < sides; i++) {
320 if (poly->
sides >= 3)
321 sprintf(buf,
"%.5g %.5g",
325 sprintf(buf,
"%.5g %.5g",
326 ND_width(n) / 2.0 * cos(i / (
double) sides *
M_PI * 2.0),
327 YFDIR(
ND_height(n) / 2.0 * sin(i / (
double) sides * M_PI * 2.0)));
339 for (i = 0; i <
ED_spl(e)->size; i++) {
342 if (
ED_spl(e)->list[i].sflag) {
344 sprintf(buf,
"s,%.5g,%.5g ",
349 if (
ED_spl(e)->list[i].eflag) {
351 sprintf(buf,
"e,%.5g,%.5g ",
356 for (j = 0; j <
ED_spl(e)->list[i].size; j++) {
359 ptf =
ED_spl(e)->list[i].list[j];
360 sprintf(buf,
"%.5g,%.5g", ptf.
x,
YDIR(ptf.
y));
367 sprintf(buf,
"%.5g,%.5g", ptf.
x,
YDIR(ptf.
y));
372 sprintf(buf,
"%.5g,%.5g", ptf.
x,
YDIR(ptf.
y));
373 agset(e,
"xlp", buf);
377 sprintf(buf,
"%.5g,%.5g", ptf.
x,
YDIR(ptf.
y));
378 agset(e,
"head_lp", buf);
382 sprintf(buf,
"%.5g,%.5g", ptf.
x,
YDIR(ptf.
y));
383 agset(e,
"tail_lp", buf);
388 rec_attach_bb(g, bbsym, lpsym, lwsym, lhsym);
attrsym_t * safe_dcl(graph_t *g, int obj_kind, char *name, char *def)
void gv_fixLocale(int set)
char * late_nnstring(void *obj, attrsym_t *attr, char *def)
CGRAPH_API char * agcanonStr(char *str)
int agxset(void *obj, Agsym_t *sym, char *value)
EXTERN Agsym_t * N_height
void undoClusterEdges(graph_t *g)
size_t agxbput(agxbuf *xb, const char *s)
CGRAPH_API Agedge_t * agfstout(Agraph_t *g, Agnode_t *n)
#define PS2INCH(a_points)
char * agget(void *obj, char *name)
CGRAPH_API Agraph_t * agraphof(void *obj)
CGRAPH_API Agnode_t * agtail(Agedge_t *e)
void write_plain(GVJ_t *job, graph_t *g, FILE *f, boolean extend)
void attach_attrs_and_arrows(graph_t *g, int *sp, int *ep)
int agset(void *obj, char *name, char *value)
CGRAPH_API Agnode_t * agnxtnode(Agraph_t *g, Agnode_t *n)
CGRAPH_API Agnode_t * aghead(Agedge_t *e)
CGRAPH_API char * agnameof(void *)
EXTERN Agsym_t * N_vertices
CGRAPH_API int agstrfree(Agraph_t *, char *)
CGRAPH_API char * agstrdup(Agraph_t *, char *)
void agxbinit(agxbuf *xb, unsigned int hint, unsigned char *init)
CGRAPH_API Agnode_t * agfstnode(Agraph_t *g)
Agnode_t * node(Agraph_t *g, char *name)
#define HAS_CLUST_EDGE(g)
int(* putstr)(void *chan, const char *str)
boolean isPolygon(node_t *)
char * agxget(void *obj, Agsym_t *sym)
CGRAPH_API Agedge_t * agnxtout(Agraph_t *g, Agedge_t *e)
void attach_attrs(graph_t *g)
void agxbfree(agxbuf *xb)
EXTERN Agsym_t * N_fillcolor