path *P;
spline_info_t sd;
#ifndef WITH_CGRAPH
- int et = EDGE_TYPE(g->root);
+ int et = EDGE_TYPE(g);
#else /* WITH_CGRAPH */
- int et = EDGE_TYPE(agroot(g));
+ int et = EDGE_TYPE(g);
#endif /* WITH_CGRAPH */
if (et == ET_NONE) return;
for (e0 = e; e0; e0 = ED_to_virt(e0)) {
ED_path(e0) =
getPath(e0, vconfig, 0, objl->obs, objl->cnt);
- makeSpline(e0, objl->obs, objl->cnt, FALSE);
+ makeSpline(g, e0, objl->obs, objl->cnt, FALSE);
}
resetObjlist(objl);
}
* if necessary, and adding edge labels
*/
static void
-finishEdge (edge_t* e, Ppoly_t spl, int flip, pointf p, pointf q)
+finishEdge (graph_t* g, edge_t* e, Ppoly_t spl, int flip, pointf p, pointf q)
{
int j;
pointf *spline = N_GNEW(spl.pn, pointf);
clip_and_install(e, aghead(e), spline, spl.pn, &sinfo);
free(spline);
- addEdgeLabels(e, p1, q1);
+ addEdgeLabels(g, e, p1, q1);
}
#define EQPT(p,q) (((p).x==(q).x)&&((p).y==(q).y))
* Return 0 on success.
*/
static int
-genroute(tripoly_t * trip, int s, int t, edge_t * e, int doPolyline)
+genroute(graph_t* g, tripoly_t * trip, int s, int t, edge_t * e, int doPolyline)
{
pointf eps[2];
Pvector_t evs[2];
}
tweakPath (poly, s, t, pl);
Proutespline(medges, poly.pn, pl, evs, &spl);
- finishEdge (e, spl, aghead(e) != head, eps[0], eps[1]);
+ finishEdge (g, e, spl, aghead(e) != head, eps[0], eps[1]);
free(medges);
return 0;
tweakPath (poly, 0, pl.pn-1, mmpl);
Proutespline(medges, poly.pn, mmpl, evs, &spl);
}
- finishEdge (e, spl, aghead(e) != head, eps[0], eps[1]);
+ finishEdge (g, e, spl, aghead(e) != head, eps[0], eps[1]);
e = ED_to_virt(e);
}
* so avoid in neato spline code.
* Return 0 on success.
*/
-int makeMultiSpline(edge_t* e, router_t * rtr, int doPolyline)
+int makeMultiSpline(graph_t* g, edge_t* e, router_t * rtr, int doPolyline)
{
Ppolyline_t line = ED_path(e);
node_t *t = agtail(e);
free(sp);
/* Generate multiple splines using polygon */
- ret = genroute(poly, 0, idx, e, doPolyline);
+ ret = genroute(g, poly, 0, idx, e, doPolyline);
freeTripoly (poly);
resetGraph(rtr->tg, rtr->tn, ecnt);
extern void freeRouter (router_t* rtr);
extern router_t* mkRouter (Ppoly_t** obs, int npoly);
-extern int makeMultiSpline(edge_t* e, router_t * rtr, int);
+extern int makeMultiSpline(graph_t* g, edge_t* e, router_t * rtr, int);
#endif
nodeInduce(gc);
neatoLayout(g, gc, layoutMode, model, &am);
removeOverlapWith(gc, &am);
+ setEdgeType (gc, ET_LINE);
spline_edges(gc);
}
if (n_cc > 1) {
#define extern
#endif
- extern void addEdgeLabels(edge_t * e, pointf rp, pointf rq);
+ extern void addEdgeLabels(graph_t* g, edge_t * e, pointf rp, pointf rq);
extern int allow_edits(int);
extern void avoid_cycling(graph_t *, Agnode_t *, double *);
extern int checkStart(graph_t * G, int nG, int);
extern Ppoly_t *makeObstacle(node_t * n, expand_t* );
extern void makeStraightEdge(graph_t * g, edge_t * e, int doPolyline);
extern void makeSelfArcs(path * P, edge_t * e, int stepx);
- extern void makeSpline(edge_t *, Ppoly_t **, int, boolean);
+ extern void makeSpline(graph_t*, edge_t *, Ppoly_t **, int, boolean);
extern void make_spring(graph_t *, Agnode_t *, Agnode_t *, double);
extern void move_node(graph_t *, int, Agnode_t *);
extern int init_nop(graph_t * g, int);
* significantly from rp and rq, but if the spline is degenerate (e.g.,
* the nodes overlap), we use rp and rq.
*/
-void addEdgeLabels(edge_t * e, pointf rp, pointf rq)
+void addEdgeLabels(graph_t* g, edge_t * e, pointf rp, pointf rq)
{
- int et = EDGE_TYPE (agroot(agraphof(aghead(e))));
+ int et = EDGE_TYPE (g);
pointf p, q;
pointf d; /* midpoint of segment p-q */
point ld;
q = dumb[2] = dumb[3] = add_pointf(ND_coord(head), ED_head_port(e).p);
if ((e_cnt == 1) || Concentrate) {
clip_and_install(e, aghead(e), dumb, 4, &sinfo);
- addEdgeLabels(e, p, q);
+ addEdgeLabels(g, e, p, q);
return;
}
else
clip_and_install(e0, aghead(e0), dumber, 4, &sinfo);
- addEdgeLabels(e0, p, q);
+ addEdgeLabels(g, e0, p, q);
e0 = ED_to_virt(e0);
dumb[1].x += del.x;
dumb[1].y += del.y;
/* makePolyline:
*/
static void
-makePolyline(edge_t * e)
+makePolyline(graph_t* g, edge_t * e)
{
Ppolyline_t spl, line = ED_path(e);
Ppoint_t p0, q0;
if (Verbose > 1)
fprintf(stderr, "polyline %s %s\n", agnameof(agtail(e)), agnameof(aghead(e)));
clip_and_install(e, aghead(e), spl.ps, spl.pn, &sinfo);
- addEdgeLabels(e, p0, q0);
+ addEdgeLabels(g, e, p0, q0);
}
/* makeSpline:
* is on or inside one of the obstacles and, if so, tells the shortest path
* computation to ignore them.
*/
-void makeSpline(edge_t * e, Ppoly_t ** obs, int npoly, boolean chkPts)
+void makeSpline(graph_t* g, edge_t * e, Ppoly_t ** obs, int npoly, boolean chkPts)
{
Ppolyline_t line, spline;
Pvector_t slopes[2];
fprintf(stderr, "spline %s %s\n", agnameof(agtail(e)), agnameof(aghead(e)));
clip_and_install(e, aghead(e), spline.ps, spline.pn, &sinfo);
free(barriers);
- addEdgeLabels(e, p, q);
+ addEdgeLabels(g, e, p, q);
}
/* True if either head or tail has a port on its boundary */
/* fprintf (stderr, "%s -- %s %d\n", agnameof(agtail(e)), agnameof(aghead(e)), ED_count(e)); */
node_t *head = aghead(e);
if (useEdges && ED_spl(e)) {
- addEdgeLabels(e,
+ addEdgeLabels(g, e,
add_pointf(ND_coord(n), ED_tail_port(e).p),
add_pointf(ND_coord(head), ED_head_port(e).p));
}
makeStraightEdge(g, e, edgetype == ET_PLINE);
else {
if (!rtr) rtr = mkRouter (obs, npoly);
- fail = makeMultiSpline(e, rtr, edgetype == ET_PLINE);
+ fail = makeMultiSpline(g, e, rtr, edgetype == ET_PLINE);
}
if (!fail) continue;
}
e0 = e;
for (i = 0; i < cnt; i++) {
if (edgetype == ET_SPLINE)
- makeSpline(e0, obs, npoly, TRUE);
+ makeSpline(g, e0, obs, npoly, TRUE);
else
- makePolyline(e0);
+ makePolyline(g, e0);
e0 = ED_to_virt(e0);
}
} else {
*/
void spline_edges0(graph_t * g)
{
- int et = EDGE_TYPE (g->root);
+ int et = EDGE_TYPE (g);
neato_set_aspect(g);
if (et == ET_NONE) return;
#ifndef ORTHO
nodeInduce(sg);
circleLayout(sg, c);
adjustNodes(sg);
+ setEdgeType (sg, ET_LINE);
spline_edges(sg);
}
free(ND_alg(agfstnode(g)));