void circo_init_graph(graph_t * g)
{
- setEdgeType (g, ET_LINE);
+ setEdgeType (g, EDGETYPE_LINE);
/* GD_ndim(g) = late_int(g,agfindattr(g,"dim"),2,2); */
Ndim = GD_ndim(g) = 2; /* The algorithm only makes sense in 2D */
circular_init_node_edge(g);
*/
/* edge types */
-#define ET_NONE (0 << 1)
-#define ET_LINE (1 << 1)
-#define ET_CURVED (2 << 1)
-#define ET_PLINE (3 << 1)
-#define ET_ORTHO (4 << 1)
-#define ET_SPLINE (5 << 1)
-#define ET_COMPOUND (6 << 1)
+#define EDGETYPE_NONE (0 << 1)
+#define EDGETYPE_LINE (1 << 1)
+#define EDGETYPE_CURVED (2 << 1)
+#define EDGETYPE_PLINE (3 << 1)
+#define EDGETYPE_ORTHO (4 << 1)
+#define EDGETYPE_SPLINE (5 << 1)
+#define EDGETYPE_COMPOUND (6 << 1)
/* New ranking is used */
#define NEW_RANK (1 << 4)
* TODO: interaction with spline=ortho
*/
/* True if edges geometries were computed and this edge has a geometry */
-#define HAVE_EDGE(ep) ((et != ET_NONE) && (ED_spl(ep) != NULL))
+#define HAVE_EDGE(ep) ((et != EDGETYPE_NONE) && (ED_spl(ep) != NULL))
static void addXLabels(Agraph_t * gp)
{
pointf dumb[4];
node_t *n;
node_t *head;
- bool curved = et == ET_CURVED;
+ bool curved = et == EDGETYPE_CURVED;
pointf perp;
pointf del;
edge_t *e0;
dumber[3 - j] = dumb[j];
}
}
- if (et == ET_PLINE) {
+ if (et == EDGETYPE_PLINE) {
Ppoint_t pts[4];
Ppolyline_t spl, line;
if (APPROXEQPT(p, q, MILLIPOINT)) { /* degenerate spline */
spf = p;
}
- else if (et == ET_SPLINE || et == ET_CURVED) {
+ else if (et == EDGETYPE_SPLINE || et == EDGETYPE_CURVED) {
d.x = (q.x + p.x) / 2.;
d.y = (p.y + q.y) / 2.;
spf = dotneato_closest(ED_spl(e), d);
}
- else { /* ET_PLINE, ET_ORTHO or ET_LINE */
+ else { /* EDGETYPE_PLINE, EDGETYPE_ORTHO or EDGETYPE_LINE */
spf = polylineMidpoint (ED_spl(e), &p, &q);
}
}
if (*s == '0') { /* false */
- return ET_LINE;
+ return EDGETYPE_LINE;
} else if (*s >= '1' && *s <= '9') { /* true */
- return ET_SPLINE;
+ return EDGETYPE_SPLINE;
} else if (strcasecmp(s, "curved") == 0) {
- return ET_CURVED;
+ return EDGETYPE_CURVED;
} else if (strcasecmp(s, "compound") == 0) {
- return ET_COMPOUND;
+ return EDGETYPE_COMPOUND;
} else if (strcasecmp(s, "false") == 0) {
- return ET_LINE;
+ return EDGETYPE_LINE;
} else if (strcasecmp(s, "line") == 0) {
- return ET_LINE;
+ return EDGETYPE_LINE;
} else if (strcasecmp(s, "none") == 0) {
- return ET_NONE;
+ return EDGETYPE_NONE;
} else if (strcasecmp(s, "no") == 0) {
- return ET_LINE;
+ return EDGETYPE_LINE;
} else if (strcasecmp(s, "ortho") == 0) {
- return ET_ORTHO;
+ return EDGETYPE_ORTHO;
} else if (strcasecmp(s, "polyline") == 0) {
- return ET_PLINE;
+ return EDGETYPE_PLINE;
} else if (strcasecmp(s, "spline") == 0) {
- return ET_SPLINE;
+ return EDGETYPE_SPLINE;
} else if (strcasecmp(s, "true") == 0) {
- return ET_SPLINE;
+ return EDGETYPE_SPLINE;
} else if (strcasecmp(s, "yes") == 0) {
- return ET_SPLINE;
+ return EDGETYPE_SPLINE;
}
agerr(AGWARN, "Unknown \"splines\" value: \"%s\" - ignored\n", s);
* If the attribute is not defined, use default.
* If the attribute is "", use NONE.
* If attribute value matches (case indepedent), use match.
- * ortho => ET_ORTHO
- * none => ET_NONE
- * line => ET_LINE
- * polyline => ET_PLINE
- * spline => ET_SPLINE
- * If attribute is boolean, true means ET_SPLINE, false means ET_LINE.
+ * ortho => EDGETYPE_ORTHO
+ * none => EDGETYPE_NONE
+ * line => EDGETYPE_LINE
+ * polyline => EDGETYPE_PLINE
+ * spline => EDGETYPE_SPLINE
+ * If attribute is boolean, true means EDGETYPE_SPLINE, false means EDGETYPE_LINE.
* Else warn and use default.
*/
void setEdgeType (graph_t* g, int dflt)
et = dflt;
}
else if (*s == '\0') {
- et = ET_NONE;
+ et = EDGETYPE_NONE;
}
else et = edgeType (s, dflt);
GD_flags(g) |= et;
aspect_t* asp;
int maxphase = late_int(g, agfindgraphattr(g,"phase"), -1, 1);
- setEdgeType (g, ET_SPLINE);
+ setEdgeType (g, EDGETYPE_SPLINE);
asp = setAspect (g, &aspect);
dot_init_subg(g,g);
fwdedgea.out.base.data = (Agrec_t*)&fwdedgeai;
fwdedgeb.out.base.data = (Agrec_t*)&fwdedgebi;
- if (et == ET_NONE) return;
- if (et == ET_CURVED) {
+ if (et == EDGETYPE_NONE) return;
+ if (et == EDGETYPE_CURVED) {
resetRW (g);
if (GD_has_labels(g->root) & EDGE_LABEL) {
agerr (AGWARN, "edge labels with splines=curved not supported in dot - use xlabels\n");
}
}
#ifdef ORTHO
- if (et == ET_ORTHO) {
+ if (et == EDGETYPE_ORTHO) {
resetRW (g);
if (GD_has_labels(g->root) & EDGE_LABEL) {
setEdgeLabelPos (g);
P->boxes = N_NEW(n_nodes + 20 * 2 * NSUB, boxf);
sd.Rank_box = N_NEW(i, boxf);
- if (et == ET_LINE) {
+ if (et == EDGETYPE_LINE) {
/* place regular edge labels */
for (n = GD_nlist(g); n; n = ND_next(n)) {
if (ND_node_type(n) == VIRTUAL && ND_label(n)) {
break;
}
- if (et == ET_CURVED) {
+ if (et == EDGETYPE_CURVED) {
int ii;
edge_t* e0;
edge_t** edgelist;
/* end vladimir */
#ifdef ORTHO
- if (et != ET_ORTHO && et != ET_CURVED) {
+ if (et != EDGETYPE_ORTHO && et != EDGETYPE_CURVED) {
#else
- if (et != ET_CURVED) {
+ if (et != EDGETYPE_CURVED) {
#endif
free(edges);
free(P->boxes);
}
poly.pn = 8;
poly.ps = (Ppoint_t*)points;
- ps = simpleSplineRoute (tp, hp, poly, &pn, et == ET_PLINE);
+ ps = simpleSplineRoute (tp, hp, poly, &pn, et == EDGETYPE_PLINE);
if (pn == 0) return;
ED_label(e)->pos.x = ctrx;
ED_label(e)->pos.y = ctry;
}
poly.pn = 8;
poly.ps = (Ppoint_t*)points;
- ps = simpleSplineRoute (tp, hp, poly, &pn, et == ET_PLINE);
+ ps = simpleSplineRoute (tp, hp, poly, &pn, et == EDGETYPE_PLINE);
if (pn == 0) return;
clip_and_install(e, aghead(e), ps, pn, &sinfo);
}
for (i = 0; i < cnt; i++) {
e = edges[ind + i];
pointn = 0;
- if (et == ET_SPLINE || et == ET_LINE) {
+ if (et == EDGETYPE_SPLINE || et == EDGETYPE_LINE) {
points[pointn++] = tp;
points[pointn++] = pointfof((2 * tp.x + hp.x) / 3, dy);
points[pointn++] = pointfof((2 * hp.x + tp.x) / 3, dy);
points[pointn++] = hp;
}
- else { /* ET_PLINE */
+ else { /* EDGETYPE_PLINE */
points[pointn++] = tp;
points[pointn++] = tp;
points[pointn++] = pointfof((2 * tp.x + hp.x) / 3, dy);
ED_label(e)->pos = ND_coord(ln);
ED_label(e)->set = TRUE;
- if (et == ET_LINE) {
+ if (et == EDGETYPE_LINE) {
pointf startp, endp, lp;
startp = add_pointf(ND_coord(tn), ED_tail_port(e).p);
for (size_t j = 0; j < boxn; j++) add_box(P, boxes[j]);
for (i = hend.boxn - 1; i >= 0; i--) add_box(P, hend.boxes[i]);
- if (et == ET_SPLINE) ps = routesplines(P, &pn);
+ if (et == EDGETYPE_SPLINE) ps = routesplines(P, &pn);
else ps = routepolylines(P, &pn);
if (pn == 0) return;
}
return;
}
- if (et == ET_LINE) {
+ if (et == EDGETYPE_LINE) {
makeSimpleFlat (agtail(e), aghead(e), edges, ind, cnt, et);
return;
}
hside = ED_head_port(e).side;
if ((tside == BOTTOM && hside != TOP) ||
(hside == BOTTOM && tside != TOP)) {
- make_flat_bottom_edges (g, sp, P, edges, ind, cnt, e, et == ET_SPLINE);
+ make_flat_bottom_edges (g, sp, P, edges, ind, cnt, e, et == EDGETYPE_SPLINE);
return;
}
for (size_t k = 0; k < boxn; k++) add_box(P, boxes[k]);
for (j = hend.boxn - 1; j >= 0; j--) add_box(P, hend.boxes[j]);
- if (et == ET_SPLINE) ps = routesplines(P, &pn);
+ if (et == EDGETYPE_SPLINE) ps = routesplines(P, &pn);
else ps = routepolylines(P, &pn);
if (pn == 0)
return;
/* compute the spline points for the edge */
- if ((et == ET_LINE) && (pointn = makeLineEdge (g, fe, pointfs, &hn))) {
+ if ((et == EDGETYPE_LINE) && (pointn = makeLineEdge (g, fe, pointfs, &hn))) {
}
else {
- bool is_spline = et == ET_SPLINE;
+ bool is_spline = et == EDGETYPE_SPLINE;
boxes_t boxes = {0};
pointn = 0;
segfirst = e;
if (is_spline) ps = routesplines(P, &pn);
else {
ps = routepolylines (P, &pn);
- if ((et == ET_LINE) && (pn > 4)) {
+ if ((et == EDGETYPE_LINE) && (pn > 4)) {
ps[1] = ps[0];
ps[3] = ps[2] = ps[pn-1];
pn = 4;
boxes_free(&boxes);
if (is_spline) ps = routesplines(P, &pn);
else ps = routepolylines (P, &pn);
- if (et == ET_LINE && pn > 4) {
+ if (et == EDGETYPE_LINE && pn > 4) {
/* Here we have used the polyline case to handle
* an edge between two nodes on adjacent ranks. If the
* results really is a polyline, straighten it.
static void fdp_init_graph(Agraph_t * g)
{
- setEdgeType (g, ET_LINE);
+ setEdgeType (g, EDGETYPE_LINE);
GD_alg(g) = NEW(gdata); /* freed in cleanup_graph */
GD_ndim(g) = late_int(g, agattr(g,AGRAPH, "dim", NULL), 2, 2);
Ndim = GD_ndim(g) = MIN(GD_ndim(g), MAXDIM);
int trySplines = 0;
int et = EDGE_TYPE(g);
- if (et > ET_ORTHO) {
- if (et == ET_COMPOUND) {
- trySplines = splineEdges(g, compoundEdges, ET_SPLINE);
+ if (et > EDGETYPE_ORTHO) {
+ if (et == EDGETYPE_COMPOUND) {
+ trySplines = splineEdges(g, compoundEdges, EDGETYPE_SPLINE);
/* When doing the edges again, accept edges done by compoundEdges */
if (trySplines)
Nop = 2;
}
- if (trySplines || et != ET_COMPOUND) {
+ if (trySplines || et != EDGETYPE_COMPOUND) {
if (HAS_CLUST_EDGE(g)) {
agerr(AGWARN,
"splines and cluster edges not supported - using line segments\n");
- et = ET_LINE;
+ et = EDGETYPE_LINE;
} else {
spline_edges1(g, et);
}
}
neato_set_aspect(g);
- if (EDGE_TYPE(g) != ET_NONE) fdpSplines (g);
+ if (EDGE_TYPE(g) != EDGETYPE_NONE) fdpSplines (g);
gv_postprocess(g, 0);
PSinputscale = save_scale;
{
int outdim;
- setEdgeType (g, ET_LINE);
+ setEdgeType (g, EDGETYPE_LINE);
outdim = late_int(g, agfindgraphattr(g, "dimen"), 2, 2);
GD_ndim(agroot(g)) = late_int(g, agfindgraphattr(g, "dim"), outdim, 2);
Ndim = GD_ndim(g->root) = MIN(GD_ndim(g->root), MAXDIM);
nodeInduce(gc);
neatoLayout(g, gc, layoutMode, model, &am);
removeOverlapWith(gc, &am);
- setEdgeType (gc, ET_LINE);
+ setEdgeType (gc, EDGETYPE_LINE);
if (noTranslate) doEdges(gc);
else spline_edges(gc);
}
* remain in the cluster's bounding box and, conversely, a cluster's box
* is not altered to reflect intra-cluster edges.
* If Nop > 1 and the spline exists, it is just copied.
- * NOTE: if edgetype = ET_NONE, we shouldn't be here.
+ * NOTE: if edgetype = EDGETYPE_NONE, we shouldn't be here.
*/
static int _spline_edges(graph_t * g, expand_t* pmargin, int edgetype)
{
#endif
/* build configuration */
- if (edgetype >= ET_PLINE) {
+ if (edgetype >= EDGETYPE_PLINE) {
obs = N_NEW(agnnodes(g), Ppoly_t *);
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
- obp = makeObstacle(n, pmargin, edgetype == ET_ORTHO);
+ obp = makeObstacle(n, pmargin, edgetype == EDGETYPE_ORTHO);
if (obp) {
ND_lim(n) = i;
obs[i++] = obp;
npoly = i;
if (obs) {
if ((legal = Plegal_arrangement(obs, npoly))) {
- if (edgetype != ET_ORTHO) vconfig = Pobsopen(obs, npoly);
+ if (edgetype != EDGETYPE_ORTHO) vconfig = Pobsopen(obs, npoly);
}
else {
- if (edgetype == ET_ORTHO)
+ if (edgetype == EDGETYPE_ORTHO)
agerr(AGWARN, "the bounding boxes of some nodes touch - falling back to straight line edges\n");
else
agerr(AGWARN, "some nodes with margin (%.02f,%.02f) touch - falling back to straight line edges\n", pmargin->x, pmargin->y);
/* route edges */
if (Verbose)
fprintf(stderr, "Creating edges using %s\n",
- (legal && edgetype == ET_ORTHO) ? "orthogonal lines" :
- (vconfig ? (edgetype == ET_SPLINE ? "splines" : "polylines") :
+ (legal && edgetype == EDGETYPE_ORTHO) ? "orthogonal lines" :
+ (vconfig ? (edgetype == EDGETYPE_SPLINE ? "splines" : "polylines") :
"line segments"));
if (vconfig) {
/* path-finding pass */
}
}
#ifdef ORTHO
- else if (legal && edgetype == ET_ORTHO) {
+ else if (legal && edgetype == EDGETYPE_ORTHO) {
orthoEdges (g, 0);
useEdges = 1;
}
P->boxes = N_NEW(agnnodes(g) + 20 * 2 * 9, boxf);
}
makeSelfArcs(P, e, GD_nodesep(g->root));
- } else if (vconfig) { /* ET_SPLINE or ET_PLINE */
+ } else if (vconfig) { /* EDGETYPE_SPLINE or EDGETYPE_PLINE */
#ifdef HAVE_GTS
if (ED_count(e) > 1 || BOUNDARY_PORT(e)) {
int fail = 0;
makeStraightEdge(g, e, edgetype, &sinfo);
else {
if (!rtr) rtr = mkRouter (obs, npoly);
- fail = makeMultiSpline(g, e, rtr, edgetype == ET_PLINE);
+ fail = makeMultiSpline(g, e, rtr, edgetype == EDGETYPE_PLINE);
}
if (!fail) continue;
}
if (Concentrate) cnt = 1; /* only do representative */
e0 = e;
for (i = 0; i < cnt; i++) {
- if (edgetype == ET_SPLINE)
+ if (edgetype == EDGETYPE_SPLINE)
makeSpline(g, e0, obs, npoly, TRUE);
else
makePolyline(g, e0);
{
int et = EDGE_TYPE (g);
if (set_aspect) neato_set_aspect(g);
- if (et == ET_NONE) return;
+ if (et == EDGETYPE_NONE) return;
#ifndef ORTHO
- if (et == ET_ORTHO) {
+ if (et == EDGETYPE_ORTHO) {
agerr (AGWARN, "Orthogonal edges not yet supported\n");
- et = ET_PLINE;
- GD_flags(g->root) &= ~ET_ORTHO;
- GD_flags(g->root) |= ET_PLINE;
+ et = EDGETYPE_PLINE;
+ GD_flags(g->root) &= ~EDGETYPE_ORTHO;
+ GD_flags(g->root) |= EDGETYPE_PLINE;
}
#endif
spline_edges1(g, et);
Agnode_t *n;
Agedge_t *e;
- setEdgeType (g, ET_LINE);
+ setEdgeType (g, EDGETYPE_LINE);
Ndim = GD_ndim(g)=2; /* The algorithm only makes sense in 2D */
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
}
else {
int et = EDGE_TYPE (g);
- if (et != ET_NONE) spline_edges1(g, et);
+ if (et != EDGETYPE_NONE) spline_edges1(g, et);
}
dotneato_postprocess(g);
}
static void patchwork_init_graph(graph_t * g)
{
N_shape = agattr(g, AGNODE, "shape","box");
- setEdgeType (g, ET_LINE);
+ setEdgeType (g, EDGETYPE_LINE);
/* GD_ndim(g) = late_int(g,agfindattr(g,"dim"),2,2); */
Ndim = GD_ndim(g) = 2; /* The algorithm only makes sense in 2D */
mkClusters(g, NULL, g);
{
int outdim;
- setEdgeType(g, ET_LINE);
+ setEdgeType(g, EDGETYPE_LINE);
outdim = late_int(g, agfindgraphattr(g, "dimen"), 2, 2);
GD_ndim(agroot(g)) = late_int(g, agfindgraphattr(g, "dim"), outdim, 2);
Ndim = GD_ndim(agroot(g)) = MIN(GD_ndim(agroot(g)), MAXDIM);
nodeInduce(sg);
sfdpLayout(sg, ctrl, hops, pad);
if (doAdjust) removeOverlapWith(sg, &am);
- setEdgeType(sg, ET_LINE);
+ setEdgeType(sg, EDGETYPE_LINE);
spline_edges(sg);
}
packSubgraphs(ncc, ccs, g, &pinfo);
void twopi_init_graph(graph_t * g)
{
- setEdgeType (g, ET_LINE);
+ setEdgeType (g, EDGETYPE_LINE);
/* GD_ndim(g) = late_int(g,agfindgraphattr(g,"dim"),2,2); */
Ndim = GD_ndim(g)=2; /* The algorithm only makes sense in 2D */
twopi_init_node_edge(g);
gvputs(job, "</Misc>\n");
gvputs(job, "<Layout>\n");
- gvprintf(job, "<ShapeRouteStyle>%d</ShapeRouteStyle>\n", edgeType == ET_LINE ? LORouteCenterToCenter : LORouteRightAngle);
+ gvprintf(job, "<ShapeRouteStyle>%d</ShapeRouteStyle>\n", edgeType == EDGETYPE_LINE ? LORouteCenterToCenter : LORouteRightAngle);
gvputs(job, "<ConFixedCode>6</ConFixedCode>\n");
- gvprintf(job, "<ConLineRouteExt>%d</ConLineRouteExt>\n", edgeType == ET_LINE || edgeType == ET_PLINE ? LORouteExtStraight : LORouteExtNURBS);
+ gvprintf(job, "<ConLineRouteExt>%d</ConLineRouteExt>\n", edgeType == EDGETYPE_LINE || edgeType == EDGETYPE_PLINE ? LORouteExtStraight : LORouteExtNURBS);
gvputs(job, "<ShapeSplittable>1</ShapeSplittable>\n");
gvputs(job, "</Layout>\n");
PrintTexts(job);
/* output Line, Fill, Geom */
- graphic.Print(job, first, last, edgeType != ET_LINE && edgeType != ET_PLINE);
+ graphic.Print(job, first, last, edgeType != EDGETYPE_LINE && edgeType != EDGETYPE_PLINE);
gvputs(job, "</Shape>\n");
return true;