Mercurial > hg > camir-aes2014
comparison toolboxes/graph_visualisation/include/graphviz/gvcjob.h @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e9a9cd732c1e |
---|---|
1 /* $Id: gvcjob.h,v 1.82 2009/07/08 15:14:20 ellson Exp $ $Revision: 1.82 $ */ | |
2 /* vim:set shiftwidth=4 ts=8: */ | |
3 | |
4 /********************************************************** | |
5 * This software is part of the graphviz package * | |
6 * http://www.graphviz.org/ * | |
7 * * | |
8 * Copyright (c) 1994-2004 AT&T Corp. * | |
9 * and is licensed under the * | |
10 * Common Public License, Version 1.0 * | |
11 * by AT&T Corp. * | |
12 * * | |
13 * Information and Software Systems Research * | |
14 * AT&T Research, Florham Park NJ * | |
15 **********************************************************/ | |
16 | |
17 /* Common header used by both clients and plugins */ | |
18 | |
19 #ifndef GVCJOB_H | |
20 #define GVCJOB_H | |
21 | |
22 #ifdef __cplusplus | |
23 extern "C" { | |
24 #endif | |
25 | |
26 #include "gvcommon.h" | |
27 #include "color.h" | |
28 | |
29 #define ARRAY_SIZE(A) (sizeof(A)/sizeof(A[0])) | |
30 | |
31 typedef struct gvdevice_engine_s gvdevice_engine_t; | |
32 typedef struct gvformatter_engine_s gvformatter_engine_t; | |
33 typedef struct gvrender_engine_s gvrender_engine_t; | |
34 typedef struct gvlayout_engine_s gvlayout_engine_t; | |
35 typedef struct gvtextlayout_engine_s gvtextlayout_engine_t; | |
36 typedef struct gvloadimage_engine_s gvloadimage_engine_t; | |
37 | |
38 typedef enum { PEN_NONE, PEN_DASHED, PEN_DOTTED, PEN_SOLID } pen_type; | |
39 typedef enum { FILL_NONE, FILL_SOLID } fill_type; | |
40 typedef enum { FONT_REGULAR, FONT_BOLD, FONT_ITALIC } font_type; | |
41 typedef enum { LABEL_PLAIN, LABEL_HTML } label_type; | |
42 | |
43 #define PENWIDTH_NORMAL 1. | |
44 #define PENWIDTH_BOLD 2. | |
45 typedef enum { GVATTR_STRING, GVATTR_BOOL, GVATTR_COLOR } gvattr_t; | |
46 | |
47 /* The -T output formats listed below are examples only, they are not definitive or inclusive, | |
48 other outputs may use the flags now, or in the future | |
49 | |
50 Default emit order is breadth first graph walk order | |
51 EMIT_SORTED emits nodes before edges | |
52 EMIT_COLORS emits colors before nodes or edge -Tfig | |
53 EMIT_CLUSTERS_LAST emits cluster after nodes and edges | |
54 EMIT_PREORDER emit in preorder traversal ??? | |
55 EMIT_EDGE_SORTED emits edges before nodes | |
56 | |
57 GVDEVICE_DOES_PAGES provides pagination support -Tps | |
58 GVDEVICE_DOES_LAYERS provides support for layers -Tps | |
59 GVDEVICE_EVENTS supports mouse events -Tgtk, -Txlib | |
60 GVDEVICE_DOES_TRUECOLOR supports alpha channel -Tpng, -Tgtk, -Txlib | |
61 GVDEVICE_BINARY_FORMAT Suppresses \r\n substitution for linends | |
62 GVDEVICE_COMPRESSED_FORMAT controls libz compression | |
63 GVDEVICE_NO_WRITER used when gvdevice is not used because device uses its own writer, -Tming, devil outputs (FIXME seems to overlap OUTPUT_NOT_REQUIRED) | |
64 | |
65 GVRENDER_Y_GOES_DOWN device origin top left, y goes down, otherwise | |
66 device origin lower left, y goes up | |
67 GVRENDER_DOES_TRANSFORM device uses scale, translate, rotate to do its own | |
68 coordinate transformations, otherwise coordinates | |
69 are pre-transformed | |
70 GVRENDER_DOES_ARROWS renderer has its own idea of arrow shapes (deprecated) | |
71 GVRENDER_DOES_LABELS basically, maps don't need labels | |
72 GVRENDER_DOES_MAPS renderer encodes mapping information for mouse events -Tcmapx -Tsvg | |
73 GVRENDER_DOES_MAP_RECTANGLE supports a 2 coord rectngle optimization | |
74 GVRENDER_DOES_MAP_CIRCLE supports a 1 coord + radius circle optimization | |
75 GVRENDER_DOES_MAP_POLYGON supports polygons (basically, -Tsvg uses anchors, so doesn't need to support any map shapes) | |
76 GVRENDER_DOES_MAP_ELLIPSE supports a 2 coord ellipse optimization | |
77 GVRENDER_DOES_MAP_BSPLINE supports mapping of splines | |
78 GVRENDER_DOES_TOOLTIPS can represent tooltip info -Tcmapx, -Tsvg | |
79 GVRENDER_DOES_TARGETS can represent target info (open link in a new tab or window) | |
80 GVRENDER_DOES_Z render support 2.5D representation -Tvrml | |
81 GVRENDER_NO_WHITE_BG don't paint white background, assumes white paper -Tps | |
82 LAYOUT_NOT_REQUIRED don't perform layout -Tcanon | |
83 OUTPUT_NOT_REQUIRED don't use gvdevice for output (basically when agwrite() used instead) -Tcanon, -Txdot | |
84 */ | |
85 | |
86 | |
87 #define EMIT_SORTED (1<<0) | |
88 #define EMIT_COLORS (1<<1) | |
89 #define EMIT_CLUSTERS_LAST (1<<2) | |
90 #define EMIT_PREORDER (1<<3) | |
91 #define EMIT_EDGE_SORTED (1<<4) | |
92 #define GVDEVICE_DOES_PAGES (1<<5) | |
93 #define GVDEVICE_DOES_LAYERS (1<<6) | |
94 #define GVDEVICE_EVENTS (1<<7) | |
95 #define GVDEVICE_DOES_TRUECOLOR (1<<8) | |
96 #define GVDEVICE_BINARY_FORMAT (1<<9) | |
97 #define GVDEVICE_COMPRESSED_FORMAT (1<<10) | |
98 #define GVDEVICE_NO_WRITER (1<<11) | |
99 #define GVRENDER_Y_GOES_DOWN (1<<12) | |
100 #define GVRENDER_DOES_TRANSFORM (1<<13) | |
101 #define GVRENDER_DOES_ARROWS (1<<14) | |
102 #define GVRENDER_DOES_LABELS (1<<15) | |
103 #define GVRENDER_DOES_MAPS (1<<16) | |
104 #define GVRENDER_DOES_MAP_RECTANGLE (1<<17) | |
105 #define GVRENDER_DOES_MAP_CIRCLE (1<<18) | |
106 #define GVRENDER_DOES_MAP_POLYGON (1<<19) | |
107 #define GVRENDER_DOES_MAP_ELLIPSE (1<<20) | |
108 #define GVRENDER_DOES_MAP_BSPLINE (1<<21) | |
109 #define GVRENDER_DOES_TOOLTIPS (1<<22) | |
110 #define GVRENDER_DOES_TARGETS (1<<23) | |
111 #define GVRENDER_DOES_Z (1<<24) | |
112 #define GVRENDER_NO_WHITE_BG (1<<25) | |
113 #define LAYOUT_NOT_REQUIRED (1<<26) | |
114 #define OUTPUT_NOT_REQUIRED (1<<27) | |
115 | |
116 typedef struct { | |
117 int flags; | |
118 double default_pad; /* graph units */ | |
119 char **knowncolors; | |
120 int sz_knowncolors; | |
121 color_type_t color_type; | |
122 } gvrender_features_t; | |
123 | |
124 typedef struct { | |
125 int flags; | |
126 pointf default_margin; /* left/right, top/bottom - points */ | |
127 pointf default_pagesize;/* default page width, height - points */ | |
128 pointf default_dpi; | |
129 } gvdevice_features_t; | |
130 | |
131 #define LAYOUT_USES_RANKDIR (1<<0) | |
132 | |
133 typedef struct gvplugin_active_device_s { | |
134 gvdevice_engine_t *engine; | |
135 int id; | |
136 gvdevice_features_t *features; | |
137 const char *type; | |
138 } gvplugin_active_device_t; | |
139 | |
140 typedef struct gvplugin_active_render_s { | |
141 gvrender_engine_t *engine; | |
142 int id; | |
143 gvrender_features_t *features; | |
144 const char *type; | |
145 } gvplugin_active_render_t; | |
146 | |
147 typedef struct gvplugin_active_loadimage_t { | |
148 gvloadimage_engine_t *engine; | |
149 int id; | |
150 const char *type; | |
151 } gvplugin_active_loadimage_t; | |
152 | |
153 typedef struct gv_argvlist_s { | |
154 char **argv; | |
155 int argc; | |
156 int alloc; | |
157 } gv_argvlist_t; | |
158 | |
159 typedef struct gvdevice_callbacks_s { | |
160 void (*refresh) (GVJ_t * job); | |
161 void (*button_press) (GVJ_t * job, int button, pointf pointer); | |
162 void (*button_release) (GVJ_t * job, int button, pointf pointer); | |
163 void (*motion) (GVJ_t * job, pointf pointer); | |
164 void (*modify) (GVJ_t * job, const char *name, const char *value); | |
165 void (*del) (GVJ_t * job); /* can't use "delete" 'cos C++ stole it */ | |
166 void (*read) (GVJ_t * job, const char *filename, const char *layout); | |
167 void (*layout) (GVJ_t * job, const char *layout); | |
168 void (*render) (GVJ_t * job, const char *format, const char *filename); | |
169 } gvdevice_callbacks_t; | |
170 | |
171 typedef int (*gvevent_key_callback_t) (GVJ_t * job); | |
172 | |
173 typedef struct gvevent_key_binding_s { | |
174 char *keystring; | |
175 gvevent_key_callback_t callback; | |
176 } gvevent_key_binding_t; | |
177 | |
178 typedef enum {MAP_RECTANGLE, MAP_CIRCLE, MAP_POLYGON, } map_shape_t; | |
179 | |
180 typedef enum {ROOTGRAPH_OBJTYPE, CLUSTER_OBJTYPE, NODE_OBJTYPE, EDGE_OBJTYPE} obj_type; | |
181 | |
182 /* See comment in gvrender_core_dot.c */ | |
183 typedef enum { | |
184 EMIT_GDRAW, EMIT_CDRAW, EMIT_TDRAW, EMIT_HDRAW, | |
185 EMIT_GLABEL, EMIT_CLABEL, EMIT_TLABEL, EMIT_HLABEL, | |
186 EMIT_NDRAW, EMIT_EDRAW, EMIT_NLABEL, EMIT_ELABEL, | |
187 } emit_state_t; | |
188 | |
189 typedef struct obj_state_s obj_state_t; | |
190 | |
191 struct obj_state_s { | |
192 obj_state_t *parent; | |
193 | |
194 obj_type type; | |
195 union { | |
196 graph_t *g; | |
197 graph_t *sg; | |
198 node_t *n; | |
199 edge_t *e; | |
200 } u; | |
201 | |
202 emit_state_t emit_state; | |
203 | |
204 gvcolor_t pencolor, fillcolor; | |
205 pen_type pen; | |
206 fill_type fill; | |
207 double penwidth; | |
208 char **rawstyle; | |
209 | |
210 double z, tail_z, head_z; /* z depths for 2.5D renderers such as vrml */ | |
211 | |
212 /* fully substituted text strings */ | |
213 char *label; | |
214 char *taillabel; | |
215 char *headlabel; | |
216 | |
217 char *url; /* if GVRENDER_DOES_MAPS */ | |
218 char *id; | |
219 char *labelurl; | |
220 char *tailurl; | |
221 char *headurl; | |
222 | |
223 char *tooltip; /* if GVRENDER_DOES_TOOLTIPS */ | |
224 char *labeltooltip; | |
225 char *tailtooltip; | |
226 char *headtooltip; | |
227 | |
228 char *target; /* if GVRENDER_DOES_TARGETS */ | |
229 char *labeltarget; | |
230 char *tailtarget; | |
231 char *headtarget; | |
232 | |
233 int explicit_tooltip:1; | |
234 int explicit_tailtooltip:1; | |
235 int explicit_headtooltip:1; | |
236 int explicit_labeltooltip:1; | |
237 int explicit_tailtarget:1; | |
238 int explicit_headtarget:1; | |
239 int explicit_edgetarget:1; | |
240 int explicit_tailurl:1; | |
241 int explicit_headurl:1; | |
242 | |
243 /* primary mapped region - node shape, edge labels */ | |
244 map_shape_t url_map_shape; | |
245 int url_map_n; /* number of points for url map if GVRENDER_DOES_MAPS */ | |
246 pointf *url_map_p; | |
247 | |
248 /* additonal mapped regions for edges */ | |
249 int url_bsplinemap_poly_n; /* number of polygons in url bspline map | |
250 if GVRENDER_DOES_MAPS && GVRENDER_DOES_MAP_BSPLINES */ | |
251 int *url_bsplinemap_n; /* array of url_bsplinemap_poly_n ints | |
252 of number of points in each polygon */ | |
253 pointf *url_bsplinemap_p; /* all the polygon points */ | |
254 | |
255 int tailendurl_map_n; /* tail end intersection with node */ | |
256 pointf *tailendurl_map_p; | |
257 | |
258 int headendurl_map_n; /* head end intersection with node */ | |
259 pointf *headendurl_map_p; | |
260 }; | |
261 | |
262 /* Note on units: | |
263 * points - a physical distance (1/72 inch) unaffected by zoom or dpi. | |
264 * graph units - related to physical distance by zoom. Equals points at zoom=1 | |
265 * device units - related to physical distance in points by dpi/72 | |
266 */ | |
267 | |
268 struct GVJ_s { | |
269 GVC_t *gvc; /* parent gvc */ | |
270 GVJ_t *next; /* linked list of jobs */ | |
271 GVJ_t *next_active; /* linked list of active jobs (e.g. multiple windows) */ | |
272 | |
273 GVCOMMON_t *common; | |
274 | |
275 obj_state_t *obj; /* objects can be nested (at least clusters can) | |
276 so keep object state on a stack */ | |
277 char *input_filename; | |
278 int graph_index; | |
279 | |
280 const char *layout_type; | |
281 | |
282 const char *output_filename; | |
283 FILE *output_file; | |
284 char *output_data; | |
285 unsigned int output_data_allocated; | |
286 unsigned int output_data_position; | |
287 | |
288 const char *output_langname; | |
289 int output_lang; | |
290 | |
291 gvplugin_active_render_t render; | |
292 gvplugin_active_device_t device; | |
293 gvplugin_active_loadimage_t loadimage; | |
294 gvdevice_callbacks_t *callbacks; | |
295 pointf device_dpi; | |
296 boolean device_sets_dpi; | |
297 | |
298 void *display; | |
299 int screen; | |
300 | |
301 void *context; /* gd or cairo surface */ | |
302 boolean external_context; /* context belongs to caller */ | |
303 char *imagedata; /* location of imagedata */ | |
304 | |
305 int flags; /* emit_graph flags */ | |
306 | |
307 int numLayers; /* number of layers */ | |
308 int layerNum; /* current layer - 1 based*/ | |
309 | |
310 point pagesArraySize; /* 2D size of page array */ | |
311 point pagesArrayFirst;/* 2D starting corner in */ | |
312 point pagesArrayMajor;/* 2D major increment */ | |
313 point pagesArrayMinor;/* 2D minor increment */ | |
314 point pagesArrayElem; /* 2D coord of current page - 0,0 based */ | |
315 int numPages; /* number of pages */ | |
316 | |
317 boxf bb; /* graph bb with padding - graph units */ | |
318 pointf pad; /* padding around bb - graph units */ | |
319 boxf clip; /* clip region in graph units */ | |
320 boxf pageBox; /* current page in graph units */ | |
321 pointf pageSize; /* page size in graph units */ | |
322 pointf focus; /* viewport focus - graph units */ | |
323 | |
324 double zoom; /* viewport zoom factor (points per graph unit) */ | |
325 int rotation; /* viewport rotation (degrees) 0=portrait, 90=landscape */ | |
326 | |
327 pointf view; /* viewport size - points */ | |
328 boxf canvasBox; /* viewport area - points */ | |
329 pointf margin; /* job-specific margin - points */ | |
330 | |
331 pointf dpi; /* device resolution device-units-per-inch */ | |
332 | |
333 unsigned int width; /* device width - device units */ | |
334 unsigned int height; /* device height - device units */ | |
335 box pageBoundingBox;/* rotated boundingBox - device units */ | |
336 box boundingBox; /* cumulative boundingBox over all pages - device units */ | |
337 | |
338 pointf scale; /* composite device to graph units (zoom and dpi) */ | |
339 pointf translation; /* composite translation */ | |
340 pointf devscale; /* composite device to points: dpi, y_goes_down */ | |
341 | |
342 boolean fit_mode, | |
343 needs_refresh, | |
344 click, | |
345 has_grown, | |
346 has_been_rendered; | |
347 | |
348 unsigned char button; /* active button */ | |
349 pointf pointer; /* pointer position in device units */ | |
350 pointf oldpointer; /* old pointer position in device units */ | |
351 | |
352 void *current_obj; /* graph object that pointer is in currently */ | |
353 | |
354 void *selected_obj; /* graph object that has been selected */ | |
355 /* (e.g. button 1 clicked on current obj) */ | |
356 char *active_tooltip; /* tooltip of active object - or NULL */ | |
357 char *selected_href; /* href of selected object - or NULL */ | |
358 gv_argvlist_t selected_obj_type_name; /* (e.g. "edge" "node3" "e" "->" "node5" "") */ | |
359 gv_argvlist_t selected_obj_attributes; /* attribute triplets: name, value, type */ | |
360 /* e.g. "color", "red", GVATTR_COLOR, | |
361 "style", "filled", GVATTR_BOOL, */ | |
362 | |
363 void *window; /* display-specific data for gvrender plugin */ | |
364 | |
365 /* keybindings for keyboard events */ | |
366 gvevent_key_binding_t *keybindings; | |
367 int numkeys; | |
368 void *keycodes; | |
369 }; | |
370 | |
371 #ifdef __cplusplus | |
372 } | |
373 #endif | |
374 #endif /* GVCJOB_H */ |