annotate toolboxes/graph_visualisation/include/graphviz/gvcjob.h @ 0:cc4b1211e677 tip

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