Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
pack.h
Go to the documentation of this file.
1
22/*************************************************************************
23 * Copyright (c) 2011 AT&T Intellectual Property
24 * All rights reserved. This program and the accompanying materials
25 * are made available under the terms of the Eclipse Public License v1.0
26 * which accompanies this distribution, and is available at
27 * https://www.eclipse.org/legal/epl-v10.html
28 *
29 * Contributors: Details at https://graphviz.org
30 *************************************************************************/
31
32#pragma once
33
34#include <stdbool.h>
35#include <stddef.h>
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41#include "types.h"
42
43/* Type indicating granularity and method
44 * l_undef - unspecified
45 * l_node - polyomino using nodes and edges
46 * l_clust - polyomino using nodes and edges and top-level clusters
47 * (assumes ND_clust(n) unused by application)
48 * l_graph - polyomino using computer graph bounding box
49 * l_array - array based on graph bounding boxes
50 * l_aspect - tiling based on graph bounding boxes preserving aspect ratio
51 * l_hull - polyomino using convex hull (unimplemented)
52 * l_tile - tiling using graph bounding box (unimplemented)
53 * l_bisect - alternate bisection using graph bounding box (unimplemented)
54 */
56
57#define PK_COL_MAJOR (1 << 0)
58#define PK_USER_VALS (1 << 1)
59#define PK_LEFT_ALIGN (1 << 2)
60#define PK_RIGHT_ALIGN (1 << 3)
61#define PK_TOP_ALIGN (1 << 4)
62#define PK_BOT_ALIGN (1 << 5)
63#define PK_INPUT_ORDER (1 << 6)
64
65typedef unsigned int packval_t;
66
67 typedef struct {
68 float aspect; /* desired aspect ratio */
69 int sz; /* row/column size size */
70 unsigned int margin; /* margin left around objects, in points */
71 bool doSplines;
72 pack_mode mode; /* granularity and method */
73 bool *fixed; /* fixed[i] == true implies g[i] should not be moved */
74 packval_t* vals; /* for arrays, sort numbers */
75 int flags;
76 } pack_info;
77
78#ifdef GVDLL
79#ifdef GVC_EXPORTS
80#define PACK_API __declspec(dllexport)
81#else
82#define PACK_API __declspec(dllimport)
83#endif
84#endif
85
86#ifndef PACK_API
87#define PACK_API /* nothing */
88#endif
89
90 PACK_API pointf *putRects(size_t ng, boxf *bbs, pack_info *pinfo);
91 PACK_API int packRects(size_t ng, boxf* bbs, pack_info* pinfo);
92
93 PACK_API pointf *putGraphs(size_t, Agraph_t **, Agraph_t *, pack_info *);
94 PACK_API int packGraphs(size_t, Agraph_t **, Agraph_t *, pack_info *);
95 PACK_API int packSubgraphs(size_t, Agraph_t **, Agraph_t *, pack_info *);
96 PACK_API int pack_graph(size_t ng, Agraph_t **gs, Agraph_t *root, bool *fixed);
97
98 PACK_API int shiftGraphs(size_t, Agraph_t **, pointf *, Agraph_t *, bool);
99
100 PACK_API pack_mode getPackMode(Agraph_t * g, pack_mode dflt);
101 PACK_API int getPack(Agraph_t *, int not_def, int dflt);
102 PACK_API pack_mode getPackInfo(Agraph_t * g, pack_mode dflt, int dfltMargin, pack_info*);
104 PACK_API pack_mode parsePackModeInfo(const char* p, pack_mode dflt,
105 pack_info* pinfo);
106
107 PACK_API int isConnected(Agraph_t *);
108 PACK_API Agraph_t **ccomps(Agraph_t *, size_t *, char *);
109 PACK_API Agraph_t **cccomps(Agraph_t *, size_t *, char *);
110 PACK_API Agraph_t **pccomps(Agraph_t *, size_t *, char *, bool *);
111 PACK_API Agraph_t *mapClust(Agraph_t *);
112#undef PACK_API
113#ifdef __cplusplus
114}
115#endif
pack_mode parsePackModeInfo(const char *p, pack_mode dflt, pack_info *pinfo)
Definition pack.c:1208
Agraph_t ** cccomps(Agraph_t *, size_t *, char *)
Definition ccomps.c:439
pack_mode getPackMode(Agraph_t *g, pack_mode dflt)
Definition pack.c:1257
pointf * putRects(size_t ng, boxf *bbs, pack_info *pinfo)
Definition pack.c:927
int shiftGraphs(size_t, Agraph_t **, pointf *, Agraph_t *, bool)
Definition pack.c:1037
int packGraphs(size_t, Agraph_t **, Agraph_t *, pack_info *)
Definition pack.c:1089
pointf * putGraphs(size_t, Agraph_t **, Agraph_t *, pack_info *)
Definition pack.c:888
pack_mode
Definition pack.h:55
@ l_aspect
Definition pack.h:55
@ l_clust
Definition pack.h:55
@ l_undef
Definition pack.h:55
@ l_graph
Definition pack.h:55
@ l_array
Definition pack.h:55
@ l_node
Definition pack.h:55
int isConnected(Agraph_t *)
Definition ccomps.c:508
int pack_graph(size_t ng, Agraph_t **gs, Agraph_t *root, bool *fixed)
Pack subgraphs followed by postprocessing.
Definition pack.c:1127
int packSubgraphs(size_t, Agraph_t **, Agraph_t *, pack_info *)
Definition pack.c:1104
Agraph_t ** ccomps(Agraph_t *, size_t *, char *)
Definition ccomps.c:187
pack_mode getPackInfo(Agraph_t *g, pack_mode dflt, int dfltMargin, pack_info *)
Definition pack.c:1281
Agraph_t ** pccomps(Agraph_t *, size_t *, char *, bool *)
Definition ccomps.c:125
pack_mode getPackModeInfo(Agraph_t *g, pack_mode dflt, pack_info *)
Definition pack.c:1253
unsigned int packval_t
Definition pack.h:65
int getPack(Agraph_t *, int not_def, int dflt)
Definition pack.c:1266
int packRects(size_t ng, boxf *bbs, pack_info *pinfo)
Definition pack.c:948
Agraph_t * mapClust(Agraph_t *)
Definition ccomps.c:366
graph or subgraph
Definition cgraph.h:425
Definition geom.h:41
float aspect
Definition pack.h:68
int flags
Definition pack.h:75
pack_mode mode
Definition pack.h:72
int sz
Definition pack.h:69
bool doSplines
use splines in constructing graph shape
Definition pack.h:71
bool * fixed
Definition pack.h:73
packval_t * vals
Definition pack.h:74
unsigned int margin
Definition pack.h:70
graphs, nodes and edges info: Agraphinfo_t, Agnodeinfo_t and Agedgeinfo_t