Graphviz 12.0.1~dev.20240716.0800
Loading...
Searching...
No Matches
patchwork.c File Reference
#include <cgraph/alloc.h>
#include <stdio.h>
#include <stdlib.h>
#include <patchwork/patchwork.h>
#include <patchwork/tree_map.h>
#include <common/render.h>
Include dependency graph for patchwork.c:

Go to the source code of this file.

Data Structures

struct  treenode_t
 

Macros

#define DFLT_SZ   1.0
 
#define SCALE   1000.0 /* scale up so that 1 is a reasonable default size */
 
#define INSERT(cp)   if(!first) first=cp; if(prev) prev->rightsib=cp; prev=cp;
 

Typedefs

typedef struct treenode_t treenode_t
 

Functions

static double fullArea (treenode_t *p, attrsym_t *mp)
 
static double getArea (void *obj, attrsym_t *ap)
 
static treenode_tmkTreeNode (Agnode_t *n, attrsym_t *ap)
 
static treenode_tmkTree (Agraph_t *g, attrsym_t *gp, attrsym_t *ap, attrsym_t *mp)
 
static int nodecmp (const void *x, const void *y)
 
static void layoutTree (treenode_t *tree)
 
static void finishNode (node_t *n)
 
static void walkTree (treenode_t *tree)
 
static void freeTree (treenode_t *tp)
 
void patchworkLayout (Agraph_t *g)
 

Macro Definition Documentation

◆ DFLT_SZ

#define DFLT_SZ   1.0

Definition at line 32 of file patchwork.c.

◆ INSERT

#define INSERT (   cp)    if(!first) first=cp; if(prev) prev->rightsib=cp; prev=cp;

Definition at line 81 of file patchwork.c.

◆ SCALE

#define SCALE   1000.0 /* scale up so that 1 is a reasonable default size */

Definition at line 33 of file patchwork.c.

Typedef Documentation

◆ treenode_t

typedef struct treenode_t treenode_t

Definition at line 18 of file patchwork.c.

Function Documentation

◆ finishNode()

static void finishNode ( node_t n)
static

Definition at line 203 of file patchwork.c.

References agxget(), agxset(), common_init_node(), N_fontsize, ND_ht, and str.

Referenced by walkTree().

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

◆ freeTree()

static void freeTree ( treenode_t tp)
static

Definition at line 257 of file patchwork.c.

References free(), freeTree(), treenode_t::leftchild, treenode_t::n_children, and treenode_t::rightsib.

Referenced by freeTree(), and patchworkLayout().

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

◆ fullArea()

static double fullArea ( treenode_t p,
attrsym_t mp 
)
static

Definition at line 53 of file patchwork.c.

References treenode_t::child_area, late_double(), treenode_t::subg, and treenode_t::u.

Referenced by mkTree().

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

◆ getArea()

static double getArea ( void *  obj,
attrsym_t ap 
)
static

Definition at line 60 of file patchwork.c.

References DFLT_SZ, late_double(), and SCALE.

Referenced by mkTree(), and mkTreeNode().

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

◆ layoutTree()

static void layoutTree ( treenode_t tree)
static

Definition at line 145 of file patchwork.c.

References AGRAPH, treenode_t::area, delta, free(), gv_calloc(), treenode_t::kind, layoutTree(), treenode_t::leftchild, treenode_t::n_children, nodecmp(), treenode_t::r, treenode_t::rightsib, rectangle::size, tree, tree_map(), Verbose, and rectangle::x.

Referenced by layoutTree(), and patchworkLayout().

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

◆ mkTree()

static treenode_t * mkTree ( Agraph_t g,
attrsym_t gp,
attrsym_t ap,
attrsym_t mp 
)
static

Definition at line 87 of file patchwork.c.

References agfstnode(), agnxtnode(), AGRAPH, treenode_t::area, treenode_t::child_area, fullArea(), GD_clust, GD_n_cluster, getArea(), gv_alloc(), INSERT, treenode_t::kind, treenode_t::leftchild, mkTree(), mkTreeNode(), treenode_t::n_children, prev, SPARENT, treenode_t::subg, and treenode_t::u.

Referenced by mkTree(), and patchworkLayout().

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

◆ mkTreeNode()

static treenode_t * mkTreeNode ( Agnode_t n,
attrsym_t ap 
)
static

Definition at line 70 of file patchwork.c.

References AGNODE, treenode_t::area, getArea(), gv_alloc(), treenode_t::kind, treenode_t::n, and treenode_t::u.

Referenced by mkTree().

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

◆ nodecmp()

static int nodecmp ( const void *  x,
const void *  y 
)
static

Definition at line 133 of file patchwork.c.

Referenced by layoutTree().

Here is the caller graph for this function:

◆ patchworkLayout()

void patchworkLayout ( Agraph_t g)

Definition at line 273 of file patchwork.c.

References agfindgraphattr, agfindnodeattr, treenode_t::area, freeTree(), layoutTree(), mkTree(), treenode_t::r, and walkTree().

Referenced by patchwork_layout().

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

◆ walkTree()

static void walkTree ( treenode_t tree)
static

Definition at line 216 of file patchwork.c.

References agnameof(), AGRAPH, agraphof(), center(), finishNode(), GD_bb, GD_flip, gv_nodesize(), treenode_t::leftchild, boxf::LL, ND_coord, ND_height, ND_ht, ND_width, ND_xsize, PS2INCH, treenode_t::rightsib, rectangle::size, tree, boxf::UR, Verbose, walkTree(), point::x, pointf_s::x, rectangle::x, point::y, and pointf_s::y.

Referenced by patchworkLayout(), and walkTree().

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