Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
layout.c File Reference
#include "config.h"
#include <assert.h>
#include <float.h>
#include <limits.h>
#include <inttypes.h>
#include <cgraph/list.h>
#include <common/render.h>
#include <common/utils.h>
#include <fdpgen/tlayout.h>
#include <math.h>
#include <neatogen/neatoprocs.h>
#include <neatogen/adjust.h>
#include <fdpgen/comp.h>
#include <pack/pack.h>
#include <fdpgen/clusteredges.h>
#include <fdpgen/dbg.h>
#include <stddef.h>
#include <stdbool.h>
#include <util/alloc.h>
Include dependency graph for layout.c:

Go to the source code of this file.

Data Structures

struct  layout_info
 
struct  erec
 

Macros

#define FDP_PRIVATE   1
 
#define NEW_EDGE(e)   (ED_to_virt(e) == 0)
 
#define BSZ   1000
 
#define ANG   (M_PI/90) /* Maximum angular change: 2 degrees */
 

Functions

static void finalCC (graph_t *g, size_t c_cnt, graph_t **cc, pointf *pts, graph_t *rg, layout_info *infop)
 
static node_tmkDeriveNode (graph_t *dg, char *name)
 
static void freeDeriveNode (node_t *n)
 
static void freeGData (graph_t *g)
 
static void freeDerivedGraph (graph_t *g, graph_t **cc)
 
static void evalPositions (graph_t *g, graph_t *rootg)
 
static char * portName (graph_t *g, bport_t *p)
 
static void chkPos (graph_t *g, node_t *n, layout_info *infop, boxf *bbp)
 
static void addEdge (edge_t *de, edge_t *e)
 
static void copyAttr (graph_t *g, graph_t *dg, char *attr)
 
static graph_tderiveGraph (graph_t *g, layout_info *infop)
 
static int ecmp (const void *v1, const void *v2)
 
static erecgetEdgeList (node_t *n, graph_t *g)
 
static int genPorts (node_t *n, erec *er, bport_t *pp, int idx, double bnd)
 
static graph_texpandCluster (node_t *n, graph_t *cg)
 
static void setClustNodes (graph_t *root)
 
static int layout (graph_t *g, layout_info *infop)
 
static void setBB (graph_t *g)
 
static void init_info (graph_t *g, layout_info *infop)
 
static void mkClusters (graph_t *g, clist_t *pclist, graph_t *parent)
 
static void fdp_init_graph (Agraph_t *g)
 
static int fdpLayout (graph_t *g)
 
static void fdpSplines (graph_t *g)
 
void fdp_layout (graph_t *g)
 

Macro Definition Documentation

◆ ANG

#define ANG   (M_PI/90) /* Maximum angular change: 2 degrees */

Definition at line 551 of file layout.c.

◆ BSZ

#define BSZ   1000

Definition at line 277 of file layout.c.

◆ FDP_PRIVATE

#define FDP_PRIVATE   1

Definition at line 29 of file layout.c.

◆ NEW_EDGE

#define NEW_EDGE (   e)    (ED_to_virt(e) == 0)

Definition at line 67 of file layout.c.

Function Documentation

◆ addEdge()

static void addEdge ( edge_t de,
edge_t e 
)
static

Definition at line 349 of file layout.c.

References cnt(), ED_count, ED_to_virt, and gv_recalloc().

Referenced by deriveGraph(), and getval().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ chkPos()

static void chkPos ( graph_t g,
node_t n,
layout_info infop,
boxf bbp 
)
static

Definition at line 306 of file layout.c.

References agnameof(), agparent(), agwarningf(), agxget(), layout_info::G_coord, boxf::LL, ND_pinned, P_FIX, P_PIN, P_SET, parent, PSinputscale, layout_info::rootg, boxf::UR, pointf_s::x, and pointf_s::y.

Referenced by deriveGraph().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ copyAttr()

static void copyAttr ( graph_t g,
graph_t dg,
char *  attr 
)
static

Definition at line 365 of file layout.c.

References agattr(), AGRAPH, agxget(), agxset(), and NULL.

Referenced by deriveGraph(), and getval().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deriveGraph()

static graph_t * deriveGraph ( graph_t g,
layout_info infop 
)
static

Definition at line 387 of file layout.c.

References addEdge(), agbindrec(), agedge(), agerrorf(), agfstnode(), agfstout(), aghead, agnameof(), agnxtnode(), agnxtout(), agopen(), agroot(), Agstrictdirected, chkPos(), copyAttr(), DNODE, do_graph_label(), ED_dist, ED_factor, layout_info::G_coord, GD_alg, GD_clust, GD_n_cluster, GD_ndim, layout_info::gid, gv_alloc(), gv_calloc(), IS_CLUST_NODE, boxf::LL, mkDeriveNode(), ND_clust, ND_height, ND_ht, ND_id, ND_lw, ND_pinned, ND_pos, ND_rw, ND_shape, ND_shape_info, ND_width, NEW_EDGE, NULL, PARENT, portName(), boxf::UR, Verbose, pointf_s::x, and pointf_s::y.

Referenced by layout().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ecmp()

static int ecmp ( const void *  v1,
const void *  v2 
)
static

Definition at line 535 of file layout.c.

References erec::alpha, and erec::dist2.

Referenced by getEdgeList().

Here is the caller graph for this function:

◆ evalPositions()

static void evalPositions ( graph_t g,
graph_t rootg 
)
static

Definition at line 240 of file layout.c.

References agfstnode(), agnxtnode(), evalPositions(), GD_clust, GD_n_cluster, boxf::LL, ND_pos, PARENT, boxf::UR, pointf_s::x, and pointf_s::y.

Referenced by evalPositions(), and fdpLayout().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ expandCluster()

static graph_t * expandCluster ( node_t n,
graph_t cg 
)
static

Definition at line 673 of file layout.c.

References erec::alpha, cg(), erec::e, free(), genPorts(), getEdgeList(), gv_calloc(), M_PI, and ND_clust.

Referenced by layout().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fdp_init_graph()

static void fdp_init_graph ( Agraph_t g)
static

Definition at line 1021 of file layout.c.

References agattr(), AGRAPH, agroot(), EDGETYPE_LINE, fdp_init_node_edge(), fdp_initParams(), GD_alg, GD_ndim, gv_alloc(), late_int(), MAXDIM, MIN, mkClusters(), Ndim, NULL, and setEdgeType().

Referenced by fdp_layout().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fdp_layout()

void fdp_layout ( graph_t g)

Definition at line 1082 of file layout.c.

References EDGE_TYPE, EDGETYPE_NONE, fdp_init_graph(), fdpLayout(), fdpSplines(), get_inputscale(), gv_postprocess(), neato_set_aspect(), and PSinputscale.

Here is the call graph for this function:

◆ fdpLayout()

static int fdpLayout ( graph_t g)
static

Definition at line 1033 of file layout.c.

References evalPositions(), init_info(), layout(), setBB(), and setClustNodes().

Referenced by fdp_layout().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fdpSplines()

static void fdpSplines ( graph_t g)
static

Definition at line 1055 of file layout.c.

References agwarningf(), compoundEdges(), EDGE_TYPE, EDGETYPE_COMPOUND, EDGETYPE_LINE, EDGETYPE_ORTHO, EDGETYPE_SPLINE, GVSPLINES, HAS_CLUST_EDGE, Nop, spline_edges1(), splineEdges(), and State.

Referenced by fdp_layout().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ finalCC()

static void finalCC ( graph_t g,
size_t  c_cnt,
graph_t **  cc,
pointf pts,
graph_t rg,
layout_info infop 
)
static

Definition at line 78 of file layout.c.

References agfstnode(), agnxtnode(), BOTTOM_IX, cg(), CL_OFFSET, DEFAULT_NODEHEIGHT, DEFAULT_NODEWIDTH, del(), layout_info::G_height, G_margin, layout_info::G_width, GD_bb, GD_border, GD_label, late_int(), boxf::LL, ND_pos, POINTS, PS2INCH, layout_info::rootg, TOP_IX, boxf::UR, pointf_s::x, and pointf_s::y.

Referenced by layout().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ freeDerivedGraph()

static void freeDerivedGraph ( graph_t g,
graph_t **  cc 
)
static

Definition at line 205 of file layout.c.

References agclose(), agdelrec(), agfstnode(), agfstout(), agnxtnode(), agnxtout(), cg(), ED_to_virt, free(), freeDeriveNode(), and freeGData().

Referenced by layout().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ freeDeriveNode()

static void freeDeriveNode ( node_t n)
static

Definition at line 193 of file layout.c.

References agdelrec(), free(), ND_alg, and ND_pos.

Referenced by freeDerivedGraph().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ freeGData()

static void freeGData ( graph_t g)
static

Definition at line 200 of file layout.c.

References free(), and GD_alg.

Referenced by freeDerivedGraph().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ genPorts()

static int genPorts ( node_t n,
erec er,
bport_t *  pp,
int  idx,
double  bnd 
)
static

Definition at line 624 of file layout.c.

References aghead, agtail, erec::alpha, ANG, cnt(), delta, DNODE, erec::e, ED_count, and ED_to_virt.

Referenced by expandCluster().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getEdgeList()

static erec * getEdgeList ( node_t n,
graph_t g 
)
static

Definition at line 558 of file layout.c.

References agfstedge(), aghead, agnxtedge(), agtail, alpha, erec::alpha, ANG, delta, erec::dist2, dx, dy, erec::e, ecmp(), gv_calloc(), M_PI, and ND_pos.

Referenced by expandCluster().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_info()

static void init_info ( graph_t g,
layout_info infop 
)
static

Definition at line 962 of file layout.c.

References agattr(), AGRAPH, CL_OFFSET, layout_info::G_coord, layout_info::G_height, layout_info::G_width, getPackInfo(), layout_info::gid, l_node, pack_info::mode, NULL, layout_info::pack, and layout_info::rootg.

Referenced by fdpLayout().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layout()

static int layout ( graph_t g,
layout_info infop 
)
static

Definition at line 811 of file layout.c.

References agdelete(), agfstnode(), agnameof(), agnnodes(), agnxtnode(), cg(), compute_bb(), deriveGraph(), DNODE, expandCluster(), fdp_tLayout(), fdp_xLayout(), finalCC(), findCComp(), pack_info::fixed, free(), freeDerivedGraph(), gv_calloc(), layout(), ND_clust, ND_height, ND_ht, ND_lw, ND_pos, ND_rw, ND_width, normalize(), NULL, layout_info::pack, POINTS_PER_INCH, putGraphs(), layout_info::rootg, Verbose, pointf_s::x, and pointf_s::y.

Referenced by btn_clicked(), dotneato_args_initialize(), fdpLayout(), gdiplus_free_layout(), gdiplus_textlayout(), gdiplusgen_textspan(), get_pango_layout(), glCompCreatePangoTexture(), gvevent_layout(), gvevent_read(), gvlayout_select(), layout(), pango_free_layout(), pango_textlayout(), and quartzgen_textspan().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mkClusters()

static void mkClusters ( graph_t g,
clist_t *  pclist,
graph_t parent 
)
static

Definition at line 980 of file layout.c.

References agbindrec(), agfstsubg(), agnxtsubg(), agroot(), GD_alg, GD_clust, GD_n_cluster, GD_ndim, gv_alloc(), is_a_cluster(), mkClusters(), NULL, and parent.

Referenced by fdp_init_graph(), and mkClusters().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mkDeriveNode()

static node_t * mkDeriveNode ( graph_t dg,
char *  name 
)
static

Definition at line 181 of file layout.c.

References agbindrec(), agnode(), GD_ndim, gv_alloc(), gv_calloc(), ND_alg, and ND_pos.

Referenced by deriveGraph().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ portName()

static char * portName ( graph_t g,
bport_t *  p 
)
static

Definition at line 286 of file layout.c.

References aghead, agnameof(), AGSEQ, agtail, BSZ, and ND_id.

Referenced by deriveGraph().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setBB()

static void setBB ( graph_t g)
static

Definition at line 943 of file layout.c.

References GD_bb, GD_clust, GD_n_cluster, boxf::LL, POINTS_PER_INCH, setBB(), boxf::UR, pointf_s::x, and pointf_s::y.

Referenced by fdpLayout(), and setBB().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setClustNodes()

static void setClustNodes ( graph_t root)
static

Definition at line 728 of file layout.c.

References agfstnode(), agnxtnode(), DEFAULT_NODEPENWIDTH, INCH2PS, IS_CLUST_NODE, late_double(), boxf::LL, MIN_NODEPENWIDTH, N_penwidth, ND_height, ND_ht, ND_lw, ND_outline_height, ND_outline_width, ND_pos, ND_rw, ND_shape_info, ND_width, PARENT, penwidth, boxf::UR, pointf_s::x, and pointf_s::y.

Referenced by fdpLayout().

Here is the call graph for this function:
Here is the caller graph for this function: