1/* $Id$ $Revision$ */
2/* vim:set shiftwidth=4 ts=8: */
3
4/*************************************************************************
5 * Copyright (c) 2011 AT&T Intellectual Property
6 * All rights reserved. This program and the accompanying materials
7 * are made available under the terms of the Eclipse Public License v1.0
8 * which accompanies this distribution, and is available at
9 * http://www.eclipse.org/legal/epl-v10.html
10 *
11 * Contributors: See CVS logs. Details at http://www.graphviz.org/
12 *************************************************************************/
13
14
15
16#ifndef _PACK_H
17#define _PACK_H 1
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23#include "types.h"
24
25/* Type indicating granularity and method
26 * l_undef - unspecified
27 * l_node - polyomino using nodes and edges
28 * l_clust - polyomino using nodes and edges and top-level clusters
29 * (assumes ND_clust(n) unused by application)
30 * l_graph - polyomino using computer graph bounding box
31 * l_array - array based on graph bounding boxes
32 * l_aspect - tiling based on graph bounding boxes preserving aspect ratio
33 * l_hull - polyomino using convex hull (unimplemented)
34 * l_tile - tiling using graph bounding box (unimplemented)
35 * l_bisect - alternate bisection using graph bounding box (unimplemented)
36 */
37 typedef enum { l_undef, l_clust, l_node, l_graph, l_array, l_aspect } pack_mode;
38
39#define PK_COL_MAJOR (1 << 0)
40#define PK_USER_VALS (1 << 1)
41#define PK_LEFT_ALIGN (1 << 2)
42#define PK_RIGHT_ALIGN (1 << 3)
43#define PK_TOP_ALIGN (1 << 4)
44#define PK_BOT_ALIGN (1 << 5)
45#define PK_INPUT_ORDER (1 << 6)
46
47typedef unsigned int packval_t;
48
49 typedef struct {
50 float aspect; /* desired aspect ratio */
51 int sz; /* row/column size size */
52 unsigned int margin; /* margin left around objects, in points */
53 int doSplines; /* use splines in constructing graph shape */
54 pack_mode mode; /* granularity and method */
55 boolean *fixed; /* fixed[i] == true implies g[i] should not be moved */
56 packval_t* vals; /* for arrays, sort numbers */
57 int flags;
58 } pack_info;
59
60/*visual studio*/
61#ifdef _WIN32
62#ifndef GVC_EXPORTS
63#define extern __declspec(dllimport)
64#endif
65#endif
66/*end visual studio*/
67
68 extern point *putRects(int ng, boxf* bbs, pack_info* pinfo);
69 extern int packRects(int ng, boxf* bbs, pack_info* pinfo);
70
71 extern point *putGraphs(int, Agraph_t **, Agraph_t *, pack_info *);
72 extern int packGraphs(int, Agraph_t **, Agraph_t *, pack_info *);
73 extern int packSubgraphs(int, Agraph_t **, Agraph_t *, pack_info *);
74 extern int pack_graph(int ng, Agraph_t** gs, Agraph_t* root, boolean* fixed);
75
76 extern int shiftGraphs(int, Agraph_t**, point*, Agraph_t*, int);
77
78 extern pack_mode getPackMode(Agraph_t * g, pack_mode dflt);
79 extern int getPack(Agraph_t *, int not_def, int dflt);
80 extern pack_mode getPackInfo(Agraph_t * g, pack_mode dflt, int dfltMargin, pack_info*);
81 extern pack_mode getPackModeInfo(Agraph_t * g, pack_mode dflt, pack_info*);
82 extern pack_mode parsePackModeInfo(char* p, pack_mode dflt, pack_info* pinfo);
83
84 extern int isConnected(Agraph_t *);
85 extern Agraph_t **ccomps(Agraph_t *, int *, char *);
86 extern Agraph_t **cccomps(Agraph_t *, int *, char *);
87 extern Agraph_t **pccomps(Agraph_t *, int *, char *, boolean *);
88 extern int nodeInduce(Agraph_t *);
89 extern Agraph_t *mapClust(Agraph_t *);
90#undef extern
91#ifdef __cplusplus
92}
93#endif
94#endif
95