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