34 /Y exch %.5g sub def\n\
35 /X exch %.5g sub def\n\
36 /y exch %.5g sub def\n\
37 /x exch %.5g sub def\n\
44/dbgstart { gsave %.5g %.5g translate } def\n\
46/arrowwidth arrowlength 2 div def\n\
53 arrowlength arrowwidth 2 div rlineto\n\
54 0 arrowwidth neg rlineto\n\
59 currentpoint exch pop sub exch currentpoint pop sub atan\n\
79 /X exch neg %.5g sub def\n\
80 /Y exch %.5g sub def\n\
81 /x exch neg %.5g sub def\n\
82 /y exch %.5g sub def\n\
108 for (
size_t j = 0; j <
ED_spl(e)->size; j++) {
110 for (
size_t k = 0; k < bz.
size; k++)
211 p.
x += xlp->
sz.
x / 2.0;
212 p.
y += xlp->
sz.
y / 2.0;
221 " xlabels force=%d bb=(%.02f,%.02f) (%.02f,%.02f)\n",
225 fprintf(stderr,
"objects\n");
226 for (
size_t i = 0; i < n_objs; i++) {
228 fprintf(stderr,
" [%" PRISIZE_T "] (%.02f,%.02f) (%.02f,%.02f) %p \"%s\"\n",
233 fprintf(stderr,
"xlabels\n");
234 for (
size_t i = 0; i < n_lbls; i++) {
235 fprintf(stderr,
" [%" PRISIZE_T "] %p set %d (%.02f,%.02f) (%.02f,%.02f) %s\n",
339 objp->
pos.
x -= objp->
sz.
x / 2.0;
340 objp->
pos.
y -= objp->
sz.
y / 2.0;
362 objp->
pos.
x -= objp->
sz.
x / 2.0;
363 objp->
pos.
y -= objp->
sz.
y / 2.0;
399#define HAVE_EDGE(ep) ((et != EDGETYPE_NONE) && (ED_spl(ep) != NULL))
411 size_t n_set_lbls = 0;
465 size_t n_lbls = n_nlbls + n_elbls;
466 if (n_lbls == 0)
return;
471 size_t n_objs = (size_t)
agnnodes(gp) + n_set_lbls + n_clbls + n_elbls;
475 bb.
UR = (
pointf){-DBL_MAX, -DBL_MAX};
486 pointf ignored = { 0.0, 0.0 };
502 agwarningf(
"no position for edge with label %s\n",
517 agwarningf(
"no position for edge with tail label %s\n",
532 agwarningf(
"no position for edge with head label %s\n",
547 agwarningf(
"no position for edge with xlabel %s\n",
568 printData(objs, n_objs, lbls, n_lbls, ¶ms);
572 for (
size_t i = 0; i < n_lbls; i++) {
585 else if (
cnt != n_lbls)
602 pointf dimen = { 0., 0. };
632 GD_bb(g).LL.y -= diff;
633 GD_bb(g).UR.y += diff;
651 GD_bb(g).LL.x -= diff;
652 GD_bb(g).UR.x += diff;
656 if (allowTranslation) {
Dynamically expanding string buffers.
static int agxbprint(agxbuf *xb, const char *fmt,...)
Printf-style output to an agxbuf.
static char * agxbdisown(agxbuf *xb)
Memory allocation wrappers that exit on failure.
static void * gv_calloc(size_t nmemb, size_t size)
void updateBB(graph_t *g, textlabel_t *lp)
void gv_nodesize(node_t *n, bool flip)
bool late_bool(void *obj, attrsym_t *attr, bool defaultValue)
pointf ccwrotatepf(pointf p, int ccwrot)
#define INCH2PS(a_inches)
static int cnt(Dict_t *d, Dtlink_t **set)
int agnnodes(Agraph_t *g)
Agedge_t * agfstout(Agraph_t *g, Agnode_t *n)
Agedge_t * agnxtout(Agraph_t *g, Agedge_t *e)
void agwarningf(const char *fmt,...)
void agerrorf(const char *fmt,...)
#define agfindgraphattr(g, a)
Agnode_t * agnxtnode(Agraph_t *g, Agnode_t *n)
Agnode_t * agfstnode(Agraph_t *g)
char * agnameof(void *)
returns a string descriptor for the object.
Agraph_t * agroot(void *obj)
type-generic dynamically expanding list
#define LIST_PREPEND(list, item)
#define LIST_IS_EMPTY(list)
static pointf edgeTailpoint(Agedge_t *e)
static boxf adjustBB(object_t *objp, boxf bb)
void translate_bb(graph_t *g, int rankdir)
static void place_root_label(graph_t *g, pointf d)
static void place_flip_graph_label(graph_t *g)
static boxf addNodeObj(node_t *np, object_t *objp, boxf bb)
static void map_edge(edge_t *e)
void place_graph_label(graph_t *g)
static size_t countClusterLabels(Agraph_t *g)
static cinfo_t addClusterObj(Agraph_t *g, cinfo_t info)
static pointf centerPt(xlabel_t *xlp)
void dotneato_postprocess(Agraph_t *g)
static void printData(object_t *objs, size_t n_objs, xlabel_t *lbls, size_t n_lbls, label_params_t *params)
static pointf edgeHeadpoint(Agedge_t *e)
static void addXLabels(Agraph_t *gp)
void gv_postprocess(Agraph_t *g, int allowTranslation)
static void translate_drawing(graph_t *g)
static boxf addLabelObj(textlabel_t *lp, object_t *objp, boxf bb)
static pointf map_point(pointf p)
static void addXLabel(textlabel_t *lp, object_t *objp, xlabel_t *xlp, int initObj, pointf pos)
splines * getsplinepoints(edge_t *e)
pointf edgeMidpoint(graph_t *g, edge_t *e)
bool force
if true, all labels must be placed
int placeLabels(object_t *objs, size_t n_objs, xlabel_t *lbls, size_t n_lbls, label_params_t *params)