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 #ifndef GV_CONST_H
15 #define GV_CONST_H
16 
17 #define SMALLBUF	128
18 #define LPAREN		'('
19 #define RPAREN		')'
20 #define LBRACE		'{'
21 #define RBRACE		'}'
22 
23 /*	node,edge types */
24 #ifdef NORMAL
25 #undef NORMAL
26 #endif
27 #define		NORMAL		0	/* an original input node */
28 #define		VIRTUAL		1	/* virtual nodes in long edge chains */
29 #define		SLACKNODE	2	/* encode edges in node position phase */
30 #define		REVERSED	3	/* reverse of an original edge */
31 #define		FLATORDER	4	/* for ordered edges */
32 #define		CLUSTER_EDGE 5	/* for ranking clusters */
33 #define		IGNORED		6	/* concentrated multi-edges */
34 
35 /* collapsed node classifications */
36 #define		NOCMD		0	/* default */
37 #define		SAMERANK	1	/* place on same rank */
38 #define		MINRANK		2	/* place on "least" rank */
39 #define		SOURCERANK	3	/* strict version of MINRANK */
40 #define		MAXRANK		4	/* place on "greatest" rank */
41 #define		SINKRANK	5	/* strict version of MAXRANK */
42 #define		LEAFSET		6	/* set of collapsed leaf nodes */
43 #define		CLUSTER		7	/* set of clustered nodes */
44 
45 /* type of cluster rank assignment */
46 #define		LOCAL		100
47 #define		GLOBAL		101
48 #define		NOCLUST		102
49 
50 /* default attributes */
51 #define		DEFAULT_COLOR		"black"
52 #define		DEFAULT_ACTIVEPENCOLOR	"#808080"
53 #define		DEFAULT_ACTIVEFILLCOLOR	"#fcfcfc"
54 #define		DEFAULT_ACTIVEFONTCOLOR	"black"
55 #define		DEFAULT_SELECTEDPENCOLOR "#303030"
56 #define		DEFAULT_SELECTEDFILLCOLOR "#e8e8e8"
57 #define		DEFAULT_SELECTEDFONTCOLOR "black"
58 #define		DEFAULT_DELETEDPENCOLOR	"#e0e0e0"
59 #define		DEFAULT_DELETEDFILLCOLOR "#f0f0f0"
60 #define		DEFAULT_DELETEDFONTCOLOR "darkgrey"
61 #define		DEFAULT_VISITEDPENCOLOR	"#101010"
62 #define		DEFAULT_VISITEDFILLCOLOR "#f8f8f8"
63 #define		DEFAULT_VISITEDFONTCOLOR "black"
64 #define		DEFAULT_FONTSIZE	14.0
65 #define		DEFAULT_LABEL_FONTSIZE	11.0	/* for head/taillabel */
66 #define		MIN_FONTSIZE		1.0
67 #if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) || defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
68 #define		DEFAULT_FONTNAME	"TimesNewRomanPSMT"
69 #else
70 #define		DEFAULT_FONTNAME	"Times-Roman"
71 #endif
72 #define		DEFAULT_FILL		"lightgrey"
73 #define         LINESPACING             1.20
74 
75 #define		DEFAULT_NODEHEIGHT	0.5
76 #define		MIN_NODEHEIGHT		0.02
77 #define		DEFAULT_NODEWIDTH	0.75
78 #define		MIN_NODEWIDTH		0.01
79 #define		DEFAULT_NODESHAPE	"ellipse"
80 
81 #define		NODENAME_ESC		"\\N"
82 
83 #define		DEFAULT_LAYERSEP	":\t "
84 #define		DEFAULT_LAYERLISTSEP	","
85 
86 #define		DEFAULT_NODESEP	0.25
87 #define		MIN_NODESEP		0.02
88 #define		DEFAULT_RANKSEP	0.5
89 #define		MIN_RANKSEP		0.02
90 
91 
92 /* default margin for paged formats such as PostScript - in points  = 0.5in */
93 #define		DEFAULT_PRINT_MARGIN 36
94 /* default margin for embedded formats such as PNG - in points */
95 #define		DEFAULT_EMBED_MARGIN 0
96 /* default padding around graph - in points */
97 #define		DEFAULT_GRAPH_PAD 4
98 
99 #define		SELF_EDGE_SIZE	18
100 #define		MC_SCALE	256	/* for mincross */
101 
102 #define		PORT_LABEL_DISTANCE	10
103 #define		PORT_LABEL_ANGLE	-25	/* degrees; pos is CCW, neg is CW */
104 
105 /* default polygon sample size for overlap removal and maps */
106 #define DFLT_SAMPLE 20
107 
108 /* arrow types */
109 #define		ARR_NONE         0
110 
111 /* sides (e.g. of cluster margins) */
112 #define		BOTTOM_IX	0
113 #define		RIGHT_IX	1
114 #define		TOP_IX		2
115 #define		LEFT_IX		3
116 
117 /* sides of boxes for SHAPE_path */
118 #define		BOTTOM		(1<<BOTTOM_IX)
119 #define		RIGHT		(1<<RIGHT_IX)
120 #define		TOP		(1<<TOP_IX)
121 #define		LEFT		(1<<LEFT_IX)
122 
123 #define CCW  -1			/* counter clock-wise */
124 #define CW    1			/* clock-wise */
125 
126 /* Obj types  for renderers */
127 #define		NONE    0
128 #define		NODE    1
129 #define		EDGE    2
130 #define		CLST    3
131 
132 /* output languages */
133 #define		HPGL		2	/* HP Graphics Language */
134 #define		PCL		3	/* Printer Control Language */
135 #define		MIF		4	/* Adobe FrameMaker */
136 #define		PIC_format	5	/* symbol PIC is used by compilers for
137 					   Position Independent Code */
138 #define		TK		15	/* TK canvas */
139 
140 #define		VTX		21	/* visual thought */
141 #define		METAPOST	22
142 #define		DIA		24	/* dia drawing tool */
143 
144 #define		QPDF		30	/* Quartz paged PDF */
145 #define		QEPDF		31	/* Quartz embedded PDF */
146 
147 #define		QBM_FIRST 100	/* first Quartz bitmap format, inclusive */
148 #define		QBM_LAST 200	/* last Quartz bitmap format, exclusive */
149 
150 #define		GVRENDER_PLUGIN	300	/* a plugin supported language */
151 #define		NO_SUPPORT	999	/* no support */
152 
153 /* for clusters */
154 #define		CL_BACK		10	/* cost of backward pointing edge */
155 #define		CL_OFFSET	8	/* margin of cluster box in PS points */
156 #ifndef _WIN32
157 #define		CL_CROSS	1000	/* cost of cluster skeleton edge crossing */
158 #else
159 #define		CL_CROSS	100	/* avoid 16 bit overflow */
160 #endif
161 
162 /* edge types */
163 #define REGULAREDGE 1
164 #define FLATEDGE    2
165 #define SELFWPEDGE  4
166 #define SELFNPEDGE  8
167 #define SELFEDGE    8
168 #define EDGETYPEMASK	 15	/* the OR of the above */
169 
170 /* for graph server */
171 #define		SERVER_NN	200
172 #define		SERVER_NE	500
173 
174 /* for neato */
175 #define Spring_coeff    1.0
176 #define MYHUGE          (1.0e+37)
177 #define MAXDIM			10
178 
179 /* drawing phases */
180 #define GVBEGIN         0
181 #define GVSPLINES       1
182 
183 /* existence of labels */
184 #define EDGE_LABEL		(1 << 0)
185 #define HEAD_LABEL		(1 << 1)
186 #define TAIL_LABEL		(1 << 2)
187 #define GRAPH_LABEL		(1 << 3)
188 #define NODE_XLABEL		(1 << 4)
189 #define EDGE_XLABEL		(1 << 5)
190 
191 /* type of graph label: GD_label_pos */
192 #define LABEL_AT_BOTTOM	0
193 #define LABEL_AT_TOP	1
194 #define LABEL_AT_LEFT	2
195 #define LABEL_AT_RIGHT	4
196 
197 /* values specifying rankdir */
198 #define RANKDIR_TB	0
199 #define RANKDIR_LR	1
200 #define RANKDIR_BT	2
201 #define RANKDIR_RL	3
202 
203 /* allowed charsets */
204 #define CHAR_UTF8	0
205 #define CHAR_LATIN1	1
206 #define CHAR_BIG5	2
207 
208 /* style flags (0-23)*/
209 #define FILLED		(1 << 0)
210 #define RADIAL		(1 << 1)
211 #define ROUNDED		(1 << 2)
212 #define DIAGONALS	(1 << 3)
213 #define AUXLABELS	(1 << 4)
214 #define INVISIBLE	(1 << 5)
215 #define STRIPED		(1 << 6)
216 #define DOTTED		(1 << 7)
217 #define DASHED		(1 << 8)
218 #define WEDGED		(1 << 9)
219 #define UNDERLINE	(1 << 10)
220 #define FIXEDSHAPE	(1 << 11)
221 
222 #define SHAPE_MASK	(127 << 24)
223 
224 /* shape (1-127) */
225 #define DOGEAR		(1 << 24)
226 #define TAB		(2 << 24)
227 #define FOLDER		(3 << 24)
228 #define BOX3D		(4 << 24)
229 #define COMPONENT	(5 << 24)
230 #define PROMOTER	(6 << 24)
231 #define CDS		(7 << 24)
232 #define TERMINATOR	(8 << 24)
233 #define UTR		(9 << 24)
234 #define PRIMERSITE	(10 << 24)
235 #define RESTRICTIONSITE	(11 << 24)
236 #define FIVEPOVERHANG	(12 << 24)
237 #define THREEPOVERHANG	(13 << 24)
238 #define NOVERHANG	(14 << 24)
239 #define ASSEMBLY	(15 << 24)
240 #define SIGNATURE	(16 << 24)
241 #define INSULATOR	(17 << 24)
242 #define RIBOSITE	(18 << 24)
243 #define RNASTAB		(19 << 24)
244 #define PROTEASESITE	(20 << 24)
245 #define PROTEINSTAB	(21 << 24)
246 #define RPROMOTER	(22 << 24)
247 #define RARROW		(23 << 24)
248 #define LARROW		(24 << 24)
249 #define LPROMOTER	(25 << 24)
250 #define CYLINDER	(26 << 24)
251 
252 /* fill types */
253 #define FILL      	1
254 #define GRADIENT  	2
255 #define RGRADIENT 	3
256 #define NO_POLY   	4    /* bit flag: if set, do fill only */
257 
258 /* label types */
259 #define LT_NONE 	(0 << 1)
260 #define LT_HTML 	(1 << 1)
261 #define LT_RECD 	(2 << 1)
262 
263 /* Flags stored in GD_flags
264  * Bit(s):  0     unused
265  *          1-3   ET_
266  *          4     NEW_RANK
267  */
268 
269 /* edge types */
270 #define ET_NONE 	(0 << 1)
271 #define ET_LINE 	(1 << 1)
272 #define ET_CURVED 	(2 << 1)
273 #define ET_PLINE 	(3 << 1)
274 #define ET_ORTHO 	(4 << 1)
275 #define ET_SPLINE 	(5 << 1)
276 #define ET_COMPOUND 	(6 << 1)
277 
278 /* New ranking is used */
279 #define NEW_RANK    	(1 << 4)
280 /******/
281 
282 /* user-specified node position: ND_pinned */
283 #define P_SET    1		/* position supplied by user */
284 #define P_FIX    2		/* position fixed during topological layout */
285 #define P_PIN    3		/* position fixed */
286 
287 #define GAP 4			/* whitespace in POINTS around labels and between peripheries */
288 
289 /* fontsize at which text is omitted entirely */
290 #define FONTSIZE_MUCH_TOO_SMALL 0.15
291 /* fontsize at which text is rendered by a simple line */
292 #define FONTSIZE_TOO_SMALL 1.5
293 
294 #endif
295