Graphviz  2.29.20120524.0446
lib/pack/pack.h
Go to the documentation of this file.
00001 /* $Id$ $Revision$ */
00002 /* vim:set shiftwidth=4 ts=8: */
00003 
00004 /*************************************************************************
00005  * Copyright (c) 2011 AT&T Intellectual Property 
00006  * All rights reserved. This program and the accompanying materials
00007  * are made available under the terms of the Eclipse Public License v1.0
00008  * which accompanies this distribution, and is available at
00009  * http://www.eclipse.org/legal/epl-v10.html
00010  *
00011  * Contributors: See CVS logs. Details at http://www.graphviz.org/
00012  *************************************************************************/
00013 
00014 
00015 
00016 #ifndef _PACK_H
00017 #define _PACK_H 1
00018 
00019 #ifdef __cplusplus
00020 extern "C" {
00021 #endif
00022 
00023 #include "types.h"
00024 
00025 /* Type indicating granularity and method 
00026  *  l_undef    - unspecified
00027  *  l_node     - polyomino using nodes and edges
00028  *  l_clust    - polyomino using nodes and edges and top-level clusters
00029  *               (assumes ND_clust(n) unused by application)
00030  *  l_graph    - polyomino using computer graph bounding box
00031  *  l_array    - array based on graph bounding boxes
00032  *  l_aspect   - tiling based on graph bounding boxes preserving aspect ratio
00033  *  l_hull     - polyomino using convex hull (unimplemented)
00034  *  l_tile     - tiling using graph bounding box (unimplemented)
00035  *  l_bisect   - alternate bisection using graph bounding box (unimplemented)
00036  */
00037     typedef enum { l_undef, l_clust, l_node, l_graph, l_array, l_aspect } pack_mode;
00038 
00039 #define PK_COL_MAJOR   (1 << 0)
00040 #define PK_USER_VALS   (1 << 1)
00041 #define PK_LEFT_ALIGN  (1 << 2)
00042 #define PK_RIGHT_ALIGN (1 << 3)
00043 #define PK_TOP_ALIGN   (1 << 4)
00044 #define PK_BOT_ALIGN   (1 << 5)
00045 
00046 typedef unsigned char packval_t;
00047 
00048     typedef struct {
00049         float aspect;           /* desired aspect ratio */
00050         int sz;                 /* row/column size size */
00051         unsigned int margin;    /* margin left around objects, in points */
00052         int doSplines;          /* use splines in constructing graph shape */
00053         pack_mode mode;         /* granularity and method */
00054         boolean *fixed;         /* fixed[i] == true implies g[i] should not be moved */
00055         packval_t* vals;        /* for arrays, sort numbers */
00056         int flags;       
00057     } pack_info;
00058 #ifdef GVDLL
00059 #define extern __declspec(dllexport)
00060 #else
00061 #define extern
00062 #endif
00063 
00064 /*visual studio*/
00065 #ifdef WIN32_DLL
00066 #ifndef GVC_EXPORTS
00067 #define extern __declspec(dllimport)
00068 #endif
00069 #endif
00070 /*end visual studio*/
00071 
00072     extern point *putRects(int ng, boxf* bbs, pack_info* pinfo);
00073     extern int packRects(int ng, boxf* bbs, pack_info* pinfo);
00074 
00075     extern point *putGraphs(int, Agraph_t **, Agraph_t *, pack_info *);
00076     extern int packGraphs(int, Agraph_t **, Agraph_t *, pack_info *);
00077     extern int packSubgraphs(int, Agraph_t **, Agraph_t *, pack_info *);
00078     extern int pack_graph(int ng, Agraph_t** gs, Agraph_t* root, boolean* fixed);
00079 
00080     extern int shiftGraphs(int, Agraph_t**, point*, Agraph_t*, int);
00081 
00082     extern pack_mode getPackMode(Agraph_t * g, pack_mode dflt);
00083     extern int getPack(Agraph_t *, int not_def, int dflt);
00084     extern pack_mode getPackInfo(Agraph_t * g, pack_mode dflt, int dfltMargin, pack_info*);
00085     extern pack_mode getPackModeInfo(Agraph_t * g, pack_mode dflt, pack_info*);
00086     extern pack_mode parsePackModeInfo(char* p, pack_mode dflt, pack_info* pinfo);
00087 
00088     extern int isConnected(Agraph_t *);
00089     extern Agraph_t **ccomps(Agraph_t *, int *, char *);
00090     extern Agraph_t **pccomps(Agraph_t *, int *, char *, boolean *);
00091     extern int nodeInduce(Agraph_t *);
00092 #undef extern
00093 #ifdef __cplusplus
00094 }
00095 #endif
00096 #endif