bpmn-js 18.6.1 → 18.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bpmn-modeler.development.js +2448 -2428
- package/dist/bpmn-modeler.production.min.js +3 -3
- package/dist/bpmn-navigated-viewer.development.js +2448 -2428
- package/dist/bpmn-navigated-viewer.production.min.js +2 -2
- package/dist/bpmn-viewer.development.js +2448 -2428
- package/dist/bpmn-viewer.production.min.js +2 -2
- package/lib/draw/BpmnRenderer.js +2412 -2390
- package/package.json +3 -3
package/lib/draw/BpmnRenderer.js
CHANGED
|
@@ -1,2391 +1,2413 @@
|
|
|
1
|
-
import inherits from 'inherits-browser';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
assign,
|
|
5
|
-
forEach,
|
|
6
|
-
isObject
|
|
7
|
-
} from 'min-dash';
|
|
8
|
-
|
|
9
|
-
import BaseRenderer from 'diagram-js/lib/draw/BaseRenderer';
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
isExpanded,
|
|
13
|
-
isHorizontal,
|
|
14
|
-
isEventSubProcess
|
|
15
|
-
} from '../util/DiUtil';
|
|
16
|
-
|
|
17
|
-
import {
|
|
18
|
-
getLabel
|
|
19
|
-
} from '../util/LabelUtil';
|
|
20
|
-
|
|
21
|
-
import {
|
|
22
|
-
is
|
|
23
|
-
} from '../util/ModelUtil';
|
|
24
|
-
|
|
25
|
-
import {
|
|
26
|
-
createLine
|
|
27
|
-
} from 'diagram-js/lib/util/RenderUtil';
|
|
28
|
-
|
|
29
|
-
import {
|
|
30
|
-
isTypedEvent,
|
|
31
|
-
isThrowEvent,
|
|
32
|
-
isCollection,
|
|
33
|
-
getBounds,
|
|
34
|
-
getDi,
|
|
35
|
-
getSemantic,
|
|
36
|
-
getCirclePath,
|
|
37
|
-
getRoundRectPath,
|
|
38
|
-
getDiamondPath,
|
|
39
|
-
getRectPath,
|
|
40
|
-
getFillColor,
|
|
41
|
-
getStrokeColor,
|
|
42
|
-
getLabelColor,
|
|
43
|
-
getHeight,
|
|
44
|
-
getWidth
|
|
45
|
-
} from './BpmnRenderUtil';
|
|
46
|
-
|
|
47
|
-
import {
|
|
48
|
-
query as domQuery
|
|
49
|
-
} from 'min-dom';
|
|
50
|
-
|
|
51
|
-
import {
|
|
52
|
-
append as svgAppend,
|
|
53
|
-
attr as svgAttr,
|
|
54
|
-
create as svgCreate,
|
|
55
|
-
classes as svgClasses
|
|
56
|
-
} from 'tiny-svg';
|
|
57
|
-
|
|
58
|
-
import {
|
|
59
|
-
rotate,
|
|
60
|
-
transform,
|
|
61
|
-
translate
|
|
62
|
-
} from 'diagram-js/lib/util/SvgTransformUtil';
|
|
63
|
-
|
|
64
|
-
import Ids from 'ids';
|
|
65
|
-
|
|
66
|
-
import { black } from './BpmnRenderUtil';
|
|
67
|
-
|
|
68
|
-
var markerIds = new Ids();
|
|
69
|
-
|
|
70
|
-
var ELEMENT_LABEL_DISTANCE = 10,
|
|
71
|
-
INNER_OUTER_DIST = 3,
|
|
72
|
-
PARTICIPANT_STROKE_WIDTH = 1.5,
|
|
73
|
-
TASK_BORDER_RADIUS = 10;
|
|
74
|
-
|
|
75
|
-
var DEFAULT_OPACITY = 0.95,
|
|
76
|
-
FULL_OPACITY = 1,
|
|
77
|
-
LOW_OPACITY = 0.25;
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* @typedef { Partial<{
|
|
81
|
-
* defaultFillColor: string,
|
|
82
|
-
* defaultStrokeColor: string,
|
|
83
|
-
* defaultLabelColor: string
|
|
84
|
-
* }> } BpmnRendererConfig
|
|
85
|
-
*
|
|
86
|
-
* @typedef { Partial<{
|
|
87
|
-
* fill: string,
|
|
88
|
-
* stroke: string,
|
|
89
|
-
* width: string,
|
|
90
|
-
* height: string
|
|
91
|
-
* }> } Attrs
|
|
92
|
-
*/
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* @typedef { import('../model/Types').Element } Element
|
|
96
|
-
* @typedef { import('../model/Types').Shape } Shape
|
|
97
|
-
* @typedef { import('../model/Types').Connection } Connection
|
|
98
|
-
*/
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* A renderer for BPMN elements
|
|
102
|
-
*
|
|
103
|
-
* @param {BpmnRendererConfig} config
|
|
104
|
-
* @param {import('diagram-js/lib/core/EventBus').default} eventBus
|
|
105
|
-
* @param {import('diagram-js/lib/draw/Styles').default} styles
|
|
106
|
-
* @param {import('./PathMap').default} pathMap
|
|
107
|
-
* @param {import('diagram-js/lib/core/Canvas').default} canvas
|
|
108
|
-
* @param {import('./TextRenderer').default} textRenderer
|
|
109
|
-
* @param {number} [priority]
|
|
110
|
-
*/
|
|
111
|
-
export default function BpmnRenderer(
|
|
112
|
-
config, eventBus, styles, pathMap,
|
|
113
|
-
canvas, textRenderer, priority) {
|
|
114
|
-
|
|
115
|
-
BaseRenderer.call(this, eventBus, priority);
|
|
116
|
-
|
|
117
|
-
var defaultFillColor = config && config.defaultFillColor,
|
|
118
|
-
defaultStrokeColor = config && config.defaultStrokeColor,
|
|
119
|
-
defaultLabelColor = config && config.defaultLabelColor;
|
|
120
|
-
|
|
121
|
-
function shapeStyle(attrs) {
|
|
122
|
-
return styles.computeStyle(attrs, {
|
|
123
|
-
strokeLinecap: 'round',
|
|
124
|
-
strokeLinejoin: 'round',
|
|
125
|
-
stroke: black,
|
|
126
|
-
strokeWidth: 2,
|
|
127
|
-
fill: 'white'
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function lineStyle(attrs) {
|
|
132
|
-
return styles.computeStyle(attrs, [ 'no-fill' ], {
|
|
133
|
-
strokeLinecap: 'round',
|
|
134
|
-
strokeLinejoin: 'round',
|
|
135
|
-
stroke: black,
|
|
136
|
-
strokeWidth: 2
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
function addMarker(id, options) {
|
|
141
|
-
var {
|
|
142
|
-
ref = { x: 0, y: 0 },
|
|
143
|
-
scale = 1,
|
|
144
|
-
element,
|
|
145
|
-
parentGfx = canvas._svg
|
|
146
|
-
} = options;
|
|
147
|
-
|
|
148
|
-
var marker = svgCreate('marker', {
|
|
149
|
-
id: id,
|
|
150
|
-
viewBox: '0 0 20 20',
|
|
151
|
-
refX: ref.x,
|
|
152
|
-
refY: ref.y,
|
|
153
|
-
markerWidth: 20 * scale,
|
|
154
|
-
markerHeight: 20 * scale,
|
|
155
|
-
orient: 'auto'
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
svgAppend(marker, element);
|
|
159
|
-
|
|
160
|
-
var defs = domQuery(':scope > defs', parentGfx);
|
|
161
|
-
|
|
162
|
-
if (!defs) {
|
|
163
|
-
defs = svgCreate('defs');
|
|
164
|
-
|
|
165
|
-
svgAppend(parentGfx, defs);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
svgAppend(defs, marker);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
function marker(parentGfx, type, fill, stroke) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
var id = markerIds.nextPrefixed('marker-');
|
|
175
|
-
|
|
176
|
-
createMarker(parentGfx, id, type, fill, stroke);
|
|
177
|
-
|
|
178
|
-
return 'url(#' + id + ')';
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
function createMarker(parentGfx, id, type, fill, stroke) {
|
|
182
|
-
|
|
183
|
-
if (type === 'sequenceflow-end') {
|
|
184
|
-
var sequenceflowEnd = svgCreate('path', {
|
|
185
|
-
d: 'M 1 5 L 11 10 L 1 15 Z',
|
|
186
|
-
...shapeStyle({
|
|
187
|
-
fill: stroke,
|
|
188
|
-
stroke: stroke,
|
|
189
|
-
strokeWidth: 1
|
|
190
|
-
})
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
addMarker(id, {
|
|
194
|
-
element: sequenceflowEnd,
|
|
195
|
-
ref: { x: 11, y: 10 },
|
|
196
|
-
scale: 0.5,
|
|
197
|
-
parentGfx
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
if (type === 'messageflow-start') {
|
|
202
|
-
var messageflowStart = svgCreate('circle', {
|
|
203
|
-
cx: 6,
|
|
204
|
-
cy: 6,
|
|
205
|
-
r: 3.5,
|
|
206
|
-
...shapeStyle({
|
|
207
|
-
fill,
|
|
208
|
-
stroke: stroke,
|
|
209
|
-
strokeWidth: 1,
|
|
210
|
-
|
|
211
|
-
// fix for safari / chrome / firefox bug not correctly
|
|
212
|
-
// resetting stroke dash array
|
|
213
|
-
strokeDasharray: [ 10000, 1 ]
|
|
214
|
-
})
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
addMarker(id, {
|
|
218
|
-
element: messageflowStart,
|
|
219
|
-
ref: { x: 6, y: 6 },
|
|
220
|
-
parentGfx
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
if (type === 'messageflow-end') {
|
|
225
|
-
var messageflowEnd = svgCreate('path', {
|
|
226
|
-
d: 'm 1 5 l 0 -3 l 7 3 l -7 3 z',
|
|
227
|
-
...shapeStyle({
|
|
228
|
-
fill,
|
|
229
|
-
stroke: stroke,
|
|
230
|
-
strokeWidth: 1,
|
|
231
|
-
|
|
232
|
-
// fix for safari / chrome / firefox bug not correctly
|
|
233
|
-
// resetting stroke dash array
|
|
234
|
-
strokeDasharray: [ 10000, 1 ]
|
|
235
|
-
})
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
addMarker(id, {
|
|
239
|
-
element: messageflowEnd,
|
|
240
|
-
ref: { x: 8.5, y: 5 },
|
|
241
|
-
parentGfx
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
if (type === 'association-start') {
|
|
246
|
-
var associationStart = svgCreate('path', {
|
|
247
|
-
d: 'M 11 5 L 1 10 L 11 15',
|
|
248
|
-
...lineStyle({
|
|
249
|
-
fill: 'none',
|
|
250
|
-
stroke,
|
|
251
|
-
strokeWidth: 1.5,
|
|
252
|
-
|
|
253
|
-
// fix for safari / chrome / firefox bug not correctly
|
|
254
|
-
// resetting stroke dash array
|
|
255
|
-
strokeDasharray: [ 10000, 1 ]
|
|
256
|
-
})
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
addMarker(id, {
|
|
260
|
-
element: associationStart,
|
|
261
|
-
ref: { x: 1, y: 10 },
|
|
262
|
-
scale: 0.5,
|
|
263
|
-
parentGfx
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
if (type === 'association-end') {
|
|
268
|
-
var associationEnd = svgCreate('path', {
|
|
269
|
-
d: 'M 1 5 L 11 10 L 1 15',
|
|
270
|
-
...lineStyle({
|
|
271
|
-
fill: 'none',
|
|
272
|
-
stroke,
|
|
273
|
-
strokeWidth: 1.5,
|
|
274
|
-
|
|
275
|
-
// fix for safari / chrome / firefox bug not correctly
|
|
276
|
-
// resetting stroke dash array
|
|
277
|
-
strokeDasharray: [ 10000, 1 ]
|
|
278
|
-
})
|
|
279
|
-
});
|
|
280
|
-
|
|
281
|
-
addMarker(id, {
|
|
282
|
-
element: associationEnd,
|
|
283
|
-
ref: { x: 11, y: 10 },
|
|
284
|
-
scale: 0.5,
|
|
285
|
-
parentGfx
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
if (type === 'conditional-flow-marker') {
|
|
290
|
-
var conditionalFlowMarker = svgCreate('path', {
|
|
291
|
-
d: 'M 0 10 L 8 6 L 16 10 L 8 14 Z',
|
|
292
|
-
...shapeStyle({
|
|
293
|
-
fill,
|
|
294
|
-
stroke: stroke
|
|
295
|
-
})
|
|
296
|
-
});
|
|
297
|
-
|
|
298
|
-
addMarker(id, {
|
|
299
|
-
element: conditionalFlowMarker,
|
|
300
|
-
ref: { x: -1, y: 10 },
|
|
301
|
-
scale: 0.5,
|
|
302
|
-
parentGfx
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
if (type === 'conditional-default-flow-marker') {
|
|
307
|
-
var defaultFlowMarker = svgCreate('path', {
|
|
308
|
-
d: 'M 6 4 L 10 16',
|
|
309
|
-
...shapeStyle({
|
|
310
|
-
stroke: stroke,
|
|
311
|
-
fill: 'none'
|
|
312
|
-
})
|
|
313
|
-
});
|
|
314
|
-
|
|
315
|
-
addMarker(id, {
|
|
316
|
-
element: defaultFlowMarker,
|
|
317
|
-
ref: { x: 0, y: 10 },
|
|
318
|
-
scale: 0.5,
|
|
319
|
-
parentGfx
|
|
320
|
-
});
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
function drawCircle(parentGfx, width, height, offset, attrs = {}) {
|
|
325
|
-
|
|
326
|
-
if (isObject(offset)) {
|
|
327
|
-
attrs = offset;
|
|
328
|
-
offset = 0;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
offset = offset || 0;
|
|
332
|
-
|
|
333
|
-
attrs = shapeStyle(attrs);
|
|
334
|
-
|
|
335
|
-
var cx = width / 2,
|
|
336
|
-
cy = height / 2;
|
|
337
|
-
|
|
338
|
-
var circle = svgCreate('circle', {
|
|
339
|
-
cx: cx,
|
|
340
|
-
cy: cy,
|
|
341
|
-
r: Math.round((width + height) / 4 - offset),
|
|
342
|
-
...attrs
|
|
343
|
-
});
|
|
344
|
-
|
|
345
|
-
svgAppend(parentGfx, circle);
|
|
346
|
-
|
|
347
|
-
return circle;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
function drawRect(parentGfx, width, height, r, offset, attrs) {
|
|
351
|
-
|
|
352
|
-
if (isObject(offset)) {
|
|
353
|
-
attrs = offset;
|
|
354
|
-
offset = 0;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
offset = offset || 0;
|
|
358
|
-
|
|
359
|
-
attrs = shapeStyle(attrs);
|
|
360
|
-
|
|
361
|
-
var rect = svgCreate('rect', {
|
|
362
|
-
x: offset,
|
|
363
|
-
y: offset,
|
|
364
|
-
width: width - offset * 2,
|
|
365
|
-
height: height - offset * 2,
|
|
366
|
-
rx: r,
|
|
367
|
-
ry: r,
|
|
368
|
-
...attrs
|
|
369
|
-
});
|
|
370
|
-
|
|
371
|
-
svgAppend(parentGfx, rect);
|
|
372
|
-
|
|
373
|
-
return rect;
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
function drawDiamond(parentGfx, width, height, attrs) {
|
|
377
|
-
|
|
378
|
-
var x_2 = width / 2;
|
|
379
|
-
var y_2 = height / 2;
|
|
380
|
-
|
|
381
|
-
var points = [
|
|
382
|
-
{ x: x_2, y: 0 },
|
|
383
|
-
{ x: width, y: y_2 },
|
|
384
|
-
{ x: x_2, y: height },
|
|
385
|
-
{ x: 0, y: y_2 }
|
|
386
|
-
];
|
|
387
|
-
|
|
388
|
-
var pointsString = points.map(function(point) {
|
|
389
|
-
return point.x + ',' + point.y;
|
|
390
|
-
}).join(' ');
|
|
391
|
-
|
|
392
|
-
attrs = shapeStyle(attrs);
|
|
393
|
-
|
|
394
|
-
var polygon = svgCreate('polygon', {
|
|
395
|
-
...attrs,
|
|
396
|
-
points: pointsString
|
|
397
|
-
});
|
|
398
|
-
|
|
399
|
-
svgAppend(parentGfx, polygon);
|
|
400
|
-
|
|
401
|
-
return polygon;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
/**
|
|
405
|
-
* @param {SVGElement} parentGfx
|
|
406
|
-
* @param {Point[]} waypoints
|
|
407
|
-
* @param {any} attrs
|
|
408
|
-
* @param {number} [radius]
|
|
409
|
-
*
|
|
410
|
-
* @return {SVGElement}
|
|
411
|
-
*/
|
|
412
|
-
function drawLine(parentGfx, waypoints, attrs, radius) {
|
|
413
|
-
attrs = lineStyle(attrs);
|
|
414
|
-
|
|
415
|
-
var line = createLine(waypoints, attrs, radius);
|
|
416
|
-
|
|
417
|
-
svgAppend(parentGfx, line);
|
|
418
|
-
|
|
419
|
-
return line;
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
/**
|
|
423
|
-
* @param {SVGElement} parentGfx
|
|
424
|
-
* @param {Point[]} waypoints
|
|
425
|
-
* @param {any} attrs
|
|
426
|
-
*
|
|
427
|
-
* @return {SVGElement}
|
|
428
|
-
*/
|
|
429
|
-
function drawConnectionSegments(parentGfx, waypoints, attrs) {
|
|
430
|
-
return drawLine(parentGfx, waypoints, attrs, 5);
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
function drawPath(parentGfx, d, attrs) {
|
|
434
|
-
attrs = lineStyle(attrs);
|
|
435
|
-
|
|
436
|
-
var path = svgCreate('path', {
|
|
437
|
-
...attrs,
|
|
438
|
-
d
|
|
439
|
-
});
|
|
440
|
-
|
|
441
|
-
svgAppend(parentGfx, path);
|
|
442
|
-
|
|
443
|
-
return path;
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
function drawMarker(type, parentGfx, path, attrs) {
|
|
447
|
-
return drawPath(parentGfx, path, assign({ 'data-marker': type }, attrs));
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
function renderer(type) {
|
|
451
|
-
return handlers[type];
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
function as(type) {
|
|
455
|
-
return function(parentGfx, element, attrs) {
|
|
456
|
-
return renderer(type)(parentGfx, element, attrs);
|
|
457
|
-
};
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
var eventIconRenderers = {
|
|
461
|
-
'bpmn:MessageEventDefinition': function(parentGfx, element, attrs = {}, isThrowing) {
|
|
462
|
-
var pathData = pathMap.getScaledPath('EVENT_MESSAGE', {
|
|
463
|
-
xScaleFactor: 0.9,
|
|
464
|
-
yScaleFactor: 0.9,
|
|
465
|
-
containerWidth: attrs.width || element.width,
|
|
466
|
-
containerHeight: attrs.height || element.height,
|
|
467
|
-
position: {
|
|
468
|
-
mx: 0.235,
|
|
469
|
-
my: 0.315
|
|
470
|
-
}
|
|
471
|
-
});
|
|
472
|
-
|
|
473
|
-
var fill = isThrowing
|
|
474
|
-
? getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
475
|
-
: getFillColor(element, defaultFillColor, attrs.fill);
|
|
476
|
-
|
|
477
|
-
var stroke = isThrowing
|
|
478
|
-
? getFillColor(element, defaultFillColor, attrs.fill)
|
|
479
|
-
: getStrokeColor(element, defaultStrokeColor, attrs.stroke);
|
|
480
|
-
|
|
481
|
-
var messagePath = drawPath(parentGfx, pathData, {
|
|
482
|
-
fill,
|
|
483
|
-
stroke,
|
|
484
|
-
strokeWidth: 1
|
|
485
|
-
});
|
|
486
|
-
|
|
487
|
-
return messagePath;
|
|
488
|
-
},
|
|
489
|
-
'bpmn:TimerEventDefinition': function(parentGfx, element, attrs = {}) {
|
|
490
|
-
var baseWidth = attrs.width || element.width;
|
|
491
|
-
var baseHeight = attrs.height || element.height;
|
|
492
|
-
|
|
493
|
-
// use a lighter stroke for event suprocess icons
|
|
494
|
-
var strokeWidth = attrs.width ? 1 : 2;
|
|
495
|
-
|
|
496
|
-
var circle = drawCircle(parentGfx, baseWidth, baseHeight, 0.2 * baseHeight, {
|
|
497
|
-
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
498
|
-
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
499
|
-
strokeWidth: strokeWidth
|
|
500
|
-
});
|
|
501
|
-
|
|
502
|
-
var pathData = pathMap.getScaledPath('EVENT_TIMER_WH', {
|
|
503
|
-
xScaleFactor: 0.75,
|
|
504
|
-
yScaleFactor: 0.75,
|
|
505
|
-
containerWidth: baseWidth,
|
|
506
|
-
containerHeight: baseHeight,
|
|
507
|
-
position: {
|
|
508
|
-
mx: 0.5,
|
|
509
|
-
my: 0.5
|
|
510
|
-
}
|
|
511
|
-
});
|
|
512
|
-
|
|
513
|
-
drawPath(parentGfx, pathData, {
|
|
514
|
-
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
515
|
-
strokeWidth: strokeWidth
|
|
516
|
-
});
|
|
517
|
-
|
|
518
|
-
for (var i = 0; i < 12; i++) {
|
|
519
|
-
var linePathData = pathMap.getScaledPath('EVENT_TIMER_LINE', {
|
|
520
|
-
xScaleFactor: 0.75,
|
|
521
|
-
yScaleFactor: 0.75,
|
|
522
|
-
containerWidth: baseWidth,
|
|
523
|
-
containerHeight: baseHeight,
|
|
524
|
-
position: {
|
|
525
|
-
mx: 0.5,
|
|
526
|
-
my: 0.5
|
|
527
|
-
}
|
|
528
|
-
});
|
|
529
|
-
|
|
530
|
-
var width = baseWidth / 2,
|
|
531
|
-
height = baseHeight / 2;
|
|
532
|
-
|
|
533
|
-
drawPath(parentGfx, linePathData, {
|
|
534
|
-
strokeWidth: 1,
|
|
535
|
-
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
536
|
-
transform: 'rotate(' + (i * 30) + ',' + height + ',' + width + ')'
|
|
537
|
-
});
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
return circle;
|
|
541
|
-
},
|
|
542
|
-
'bpmn:EscalationEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
|
|
543
|
-
var pathData = pathMap.getScaledPath('EVENT_ESCALATION', {
|
|
544
|
-
xScaleFactor: 1,
|
|
545
|
-
yScaleFactor: 1,
|
|
546
|
-
containerWidth: attrs.width || event.width,
|
|
547
|
-
containerHeight: attrs.height || event.height,
|
|
548
|
-
position: {
|
|
549
|
-
mx: 0.5,
|
|
550
|
-
my: 0.2
|
|
551
|
-
}
|
|
552
|
-
});
|
|
553
|
-
|
|
554
|
-
var fill = isThrowing
|
|
555
|
-
? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
|
|
556
|
-
: getFillColor(event, defaultFillColor, attrs.fill);
|
|
557
|
-
|
|
558
|
-
return drawPath(parentGfx, pathData, {
|
|
559
|
-
fill,
|
|
560
|
-
stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
|
|
561
|
-
strokeWidth: 1
|
|
562
|
-
});
|
|
563
|
-
},
|
|
564
|
-
'bpmn:ConditionalEventDefinition': function(parentGfx, event, attrs = {}) {
|
|
565
|
-
var pathData = pathMap.getScaledPath('EVENT_CONDITIONAL', {
|
|
566
|
-
xScaleFactor: 1,
|
|
567
|
-
yScaleFactor: 1,
|
|
568
|
-
containerWidth: attrs.width || event.width,
|
|
569
|
-
containerHeight: attrs.height || event.height,
|
|
570
|
-
position: {
|
|
571
|
-
mx: 0.5,
|
|
572
|
-
my: 0.222
|
|
573
|
-
}
|
|
574
|
-
});
|
|
575
|
-
|
|
576
|
-
return drawPath(parentGfx, pathData, {
|
|
577
|
-
fill: getFillColor(event, defaultFillColor, attrs.fill),
|
|
578
|
-
stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
|
|
579
|
-
strokeWidth: 1
|
|
580
|
-
});
|
|
581
|
-
},
|
|
582
|
-
'bpmn:LinkEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
|
|
583
|
-
var pathData = pathMap.getScaledPath('EVENT_LINK', {
|
|
584
|
-
xScaleFactor: 1,
|
|
585
|
-
yScaleFactor: 1,
|
|
586
|
-
containerWidth: event.width,
|
|
587
|
-
containerHeight: event.height,
|
|
588
|
-
position: {
|
|
589
|
-
mx: 0.57,
|
|
590
|
-
my: 0.263
|
|
591
|
-
}
|
|
592
|
-
});
|
|
593
|
-
|
|
594
|
-
var fill = isThrowing
|
|
595
|
-
? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
|
|
596
|
-
: getFillColor(event, defaultFillColor, attrs.fill);
|
|
597
|
-
|
|
598
|
-
return drawPath(parentGfx, pathData, {
|
|
599
|
-
fill,
|
|
600
|
-
stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
|
|
601
|
-
strokeWidth: 1
|
|
602
|
-
});
|
|
603
|
-
},
|
|
604
|
-
'bpmn:ErrorEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
|
|
605
|
-
var pathData = pathMap.getScaledPath('EVENT_ERROR', {
|
|
606
|
-
xScaleFactor: 1.1,
|
|
607
|
-
yScaleFactor: 1.1,
|
|
608
|
-
containerWidth: attrs.width || event.width,
|
|
609
|
-
containerHeight: attrs.height || event.height,
|
|
610
|
-
position: {
|
|
611
|
-
mx: 0.2,
|
|
612
|
-
my: 0.722
|
|
613
|
-
}
|
|
614
|
-
});
|
|
615
|
-
|
|
616
|
-
var fill = isThrowing
|
|
617
|
-
? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
|
|
618
|
-
: getFillColor(event, defaultFillColor, attrs.fill);
|
|
619
|
-
|
|
620
|
-
return drawPath(parentGfx, pathData, {
|
|
621
|
-
fill,
|
|
622
|
-
stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
|
|
623
|
-
strokeWidth: 1
|
|
624
|
-
});
|
|
625
|
-
},
|
|
626
|
-
'bpmn:CancelEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
|
|
627
|
-
var pathData = pathMap.getScaledPath('EVENT_CANCEL_45', {
|
|
628
|
-
xScaleFactor: 1.0,
|
|
629
|
-
yScaleFactor: 1.0,
|
|
630
|
-
containerWidth: event.width,
|
|
631
|
-
containerHeight: event.height,
|
|
632
|
-
position: {
|
|
633
|
-
mx: 0.638,
|
|
634
|
-
my: -0.055
|
|
635
|
-
}
|
|
636
|
-
});
|
|
637
|
-
|
|
638
|
-
var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor, attrs.stroke) : 'none';
|
|
639
|
-
|
|
640
|
-
var path = drawPath(parentGfx, pathData, {
|
|
641
|
-
fill,
|
|
642
|
-
stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
|
|
643
|
-
strokeWidth: 1
|
|
644
|
-
});
|
|
645
|
-
|
|
646
|
-
rotate(path, 45);
|
|
647
|
-
|
|
648
|
-
return path;
|
|
649
|
-
},
|
|
650
|
-
'bpmn:CompensateEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
|
|
651
|
-
var pathData = pathMap.getScaledPath('EVENT_COMPENSATION', {
|
|
652
|
-
xScaleFactor: 1,
|
|
653
|
-
yScaleFactor: 1,
|
|
654
|
-
containerWidth: attrs.width || event.width,
|
|
655
|
-
containerHeight: attrs.height || event.height,
|
|
656
|
-
position: {
|
|
657
|
-
mx: 0.22,
|
|
658
|
-
my: 0.5
|
|
659
|
-
}
|
|
660
|
-
});
|
|
661
|
-
|
|
662
|
-
var fill = isThrowing
|
|
663
|
-
? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
|
|
664
|
-
: getFillColor(event, defaultFillColor, attrs.fill);
|
|
665
|
-
|
|
666
|
-
return drawPath(parentGfx, pathData, {
|
|
667
|
-
fill,
|
|
668
|
-
stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
|
|
669
|
-
strokeWidth: 1
|
|
670
|
-
});
|
|
671
|
-
},
|
|
672
|
-
'bpmn:SignalEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
|
|
673
|
-
var pathData = pathMap.getScaledPath('EVENT_SIGNAL', {
|
|
674
|
-
xScaleFactor: 0.9,
|
|
675
|
-
yScaleFactor: 0.9,
|
|
676
|
-
containerWidth: attrs.width || event.width,
|
|
677
|
-
containerHeight: attrs.height || event.height,
|
|
678
|
-
position: {
|
|
679
|
-
mx: 0.5,
|
|
680
|
-
my: 0.2
|
|
681
|
-
}
|
|
682
|
-
});
|
|
683
|
-
|
|
684
|
-
var fill = isThrowing
|
|
685
|
-
? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
|
|
686
|
-
: getFillColor(event, defaultFillColor, attrs.fill);
|
|
687
|
-
|
|
688
|
-
return drawPath(parentGfx, pathData, {
|
|
689
|
-
strokeWidth: 1,
|
|
690
|
-
fill,
|
|
691
|
-
stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke)
|
|
692
|
-
});
|
|
693
|
-
},
|
|
694
|
-
'bpmn:MultipleEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
|
|
695
|
-
var pathData = pathMap.getScaledPath('EVENT_MULTIPLE', {
|
|
696
|
-
xScaleFactor: 1.1,
|
|
697
|
-
yScaleFactor: 1.1,
|
|
698
|
-
containerWidth: attrs.width || event.width,
|
|
699
|
-
containerHeight: attrs.height || event.height,
|
|
700
|
-
position: {
|
|
701
|
-
mx: 0.211,
|
|
702
|
-
my: 0.36
|
|
703
|
-
}
|
|
704
|
-
});
|
|
705
|
-
|
|
706
|
-
var fill = isThrowing
|
|
707
|
-
? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
|
|
708
|
-
: getFillColor(event, defaultFillColor, attrs.fill);
|
|
709
|
-
|
|
710
|
-
return drawPath(parentGfx, pathData, {
|
|
711
|
-
fill,
|
|
712
|
-
stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
|
|
713
|
-
strokeWidth: 1
|
|
714
|
-
});
|
|
715
|
-
},
|
|
716
|
-
'bpmn:ParallelMultipleEventDefinition': function(parentGfx, event, attrs = {}) {
|
|
717
|
-
var pathData = pathMap.getScaledPath('EVENT_PARALLEL_MULTIPLE', {
|
|
718
|
-
xScaleFactor: 1.2,
|
|
719
|
-
yScaleFactor: 1.2,
|
|
720
|
-
containerWidth: attrs.width || event.width,
|
|
721
|
-
containerHeight: attrs.height || event.height,
|
|
722
|
-
position: {
|
|
723
|
-
mx: 0.458,
|
|
724
|
-
my: 0.194
|
|
725
|
-
}
|
|
726
|
-
});
|
|
727
|
-
|
|
728
|
-
return drawPath(parentGfx, pathData, {
|
|
729
|
-
fill: getFillColor(event, defaultFillColor, attrs.fill),
|
|
730
|
-
stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
|
|
731
|
-
strokeWidth: 1
|
|
732
|
-
});
|
|
733
|
-
},
|
|
734
|
-
'bpmn:TerminateEventDefinition': function(parentGfx, element, attrs = {}) {
|
|
735
|
-
var circle = drawCircle(parentGfx, element.width, element.height, 8, {
|
|
736
|
-
fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
737
|
-
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
738
|
-
strokeWidth: 4
|
|
739
|
-
});
|
|
740
|
-
|
|
741
|
-
return circle;
|
|
742
|
-
}
|
|
743
|
-
};
|
|
744
|
-
|
|
745
|
-
function renderEventIcon(element, parentGfx, attrs = {}, proxyElement) {
|
|
746
|
-
var semantic = getSemantic(element),
|
|
747
|
-
isThrowing = isThrowEvent(semantic);
|
|
748
|
-
|
|
749
|
-
var nodeElement = proxyElement || element;
|
|
750
|
-
|
|
751
|
-
if (semantic.get('eventDefinitions') && semantic.get('eventDefinitions').length > 1) {
|
|
752
|
-
if (semantic.get('parallelMultiple')) {
|
|
753
|
-
return eventIconRenderers[ 'bpmn:ParallelMultipleEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
754
|
-
}
|
|
755
|
-
else {
|
|
756
|
-
return eventIconRenderers[ 'bpmn:MultipleEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
if (isTypedEvent(semantic, 'bpmn:MessageEventDefinition')) {
|
|
761
|
-
return eventIconRenderers[ 'bpmn:MessageEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
if (isTypedEvent(semantic, 'bpmn:TimerEventDefinition')) {
|
|
765
|
-
return eventIconRenderers[ 'bpmn:TimerEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
if (isTypedEvent(semantic, 'bpmn:ConditionalEventDefinition')) {
|
|
769
|
-
return eventIconRenderers[ 'bpmn:ConditionalEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
if (isTypedEvent(semantic, 'bpmn:SignalEventDefinition')) {
|
|
773
|
-
return eventIconRenderers[ 'bpmn:SignalEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
774
|
-
}
|
|
775
|
-
|
|
776
|
-
if (isTypedEvent(semantic, 'bpmn:EscalationEventDefinition')) {
|
|
777
|
-
return eventIconRenderers[ 'bpmn:EscalationEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
if (isTypedEvent(semantic, 'bpmn:LinkEventDefinition')) {
|
|
781
|
-
return eventIconRenderers[ 'bpmn:LinkEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
if (isTypedEvent(semantic, 'bpmn:ErrorEventDefinition')) {
|
|
785
|
-
return eventIconRenderers[ 'bpmn:ErrorEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
if (isTypedEvent(semantic, 'bpmn:CancelEventDefinition')) {
|
|
789
|
-
return eventIconRenderers[ 'bpmn:CancelEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
if (isTypedEvent(semantic, 'bpmn:CompensateEventDefinition')) {
|
|
793
|
-
return eventIconRenderers[ 'bpmn:CompensateEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
if (isTypedEvent(semantic, 'bpmn:TerminateEventDefinition')) {
|
|
797
|
-
return eventIconRenderers[ 'bpmn:TerminateEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
return null;
|
|
801
|
-
}
|
|
802
|
-
|
|
803
|
-
var taskMarkerRenderers = {
|
|
804
|
-
'ParticipantMultiplicityMarker': function(parentGfx, element, attrs = {}) {
|
|
805
|
-
var width = getWidth(element, attrs),
|
|
806
|
-
height = getHeight(element, attrs);
|
|
807
|
-
|
|
808
|
-
var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
|
|
809
|
-
xScaleFactor: 1,
|
|
810
|
-
yScaleFactor: 1,
|
|
811
|
-
containerWidth: width,
|
|
812
|
-
containerHeight: height,
|
|
813
|
-
position: {
|
|
814
|
-
mx: ((width / 2 - 6) / width),
|
|
815
|
-
my: (height - 15) / height
|
|
816
|
-
}
|
|
817
|
-
});
|
|
818
|
-
|
|
819
|
-
drawMarker('participant-multiplicity', parentGfx, markerPath, {
|
|
820
|
-
strokeWidth: 2,
|
|
821
|
-
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
822
|
-
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
823
|
-
});
|
|
824
|
-
},
|
|
825
|
-
'SubProcessMarker': function(parentGfx, element, attrs = {}) {
|
|
826
|
-
var markerRect = drawRect(parentGfx, 14, 14, 0, {
|
|
827
|
-
strokeWidth: 1,
|
|
828
|
-
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
829
|
-
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
830
|
-
});
|
|
831
|
-
|
|
832
|
-
translate(markerRect, element.width / 2 - 7.5, element.height - 20);
|
|
833
|
-
|
|
834
|
-
var markerPath = pathMap.getScaledPath('MARKER_SUB_PROCESS', {
|
|
835
|
-
xScaleFactor: 1.5,
|
|
836
|
-
yScaleFactor: 1.5,
|
|
837
|
-
containerWidth: element.width,
|
|
838
|
-
containerHeight: element.height,
|
|
839
|
-
position: {
|
|
840
|
-
mx: (element.width / 2 - 7.5) / element.width,
|
|
841
|
-
my: (element.height - 20) / element.height
|
|
842
|
-
}
|
|
843
|
-
});
|
|
844
|
-
|
|
845
|
-
drawMarker('sub-process', parentGfx, markerPath, {
|
|
846
|
-
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
847
|
-
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
848
|
-
});
|
|
849
|
-
},
|
|
850
|
-
'ParallelMarker': function(parentGfx, element, attrs) {
|
|
851
|
-
var width = getWidth(element, attrs),
|
|
852
|
-
height = getHeight(element, attrs);
|
|
853
|
-
|
|
854
|
-
var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
|
|
855
|
-
xScaleFactor: 1,
|
|
856
|
-
yScaleFactor: 1,
|
|
857
|
-
containerWidth: width,
|
|
858
|
-
containerHeight: height,
|
|
859
|
-
position: {
|
|
860
|
-
mx: ((width / 2 + attrs.parallel) / width),
|
|
861
|
-
my: (height - 20) / height
|
|
862
|
-
}
|
|
863
|
-
});
|
|
864
|
-
|
|
865
|
-
drawMarker('parallel', parentGfx, markerPath, {
|
|
866
|
-
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
867
|
-
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
868
|
-
});
|
|
869
|
-
},
|
|
870
|
-
'SequentialMarker': function(parentGfx, element, attrs) {
|
|
871
|
-
var markerPath = pathMap.getScaledPath('MARKER_SEQUENTIAL', {
|
|
872
|
-
xScaleFactor: 1,
|
|
873
|
-
yScaleFactor: 1,
|
|
874
|
-
containerWidth: element.width,
|
|
875
|
-
containerHeight: element.height,
|
|
876
|
-
position: {
|
|
877
|
-
mx: ((element.width / 2 + attrs.seq) / element.width),
|
|
878
|
-
my: (element.height - 19) / element.height
|
|
879
|
-
}
|
|
880
|
-
});
|
|
881
|
-
|
|
882
|
-
drawMarker('sequential', parentGfx, markerPath, {
|
|
883
|
-
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
884
|
-
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
885
|
-
});
|
|
886
|
-
},
|
|
887
|
-
'CompensationMarker': function(parentGfx, element, attrs) {
|
|
888
|
-
var markerMath = pathMap.getScaledPath('MARKER_COMPENSATION', {
|
|
889
|
-
xScaleFactor: 1,
|
|
890
|
-
yScaleFactor: 1,
|
|
891
|
-
containerWidth: element.width,
|
|
892
|
-
containerHeight: element.height,
|
|
893
|
-
position: {
|
|
894
|
-
mx: ((element.width / 2 + attrs.compensation) / element.width),
|
|
895
|
-
my: (element.height - 13) / element.height
|
|
896
|
-
}
|
|
897
|
-
});
|
|
898
|
-
|
|
899
|
-
drawMarker('compensation', parentGfx, markerMath, {
|
|
900
|
-
strokeWidth: 1,
|
|
901
|
-
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
902
|
-
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
903
|
-
});
|
|
904
|
-
},
|
|
905
|
-
'LoopMarker': function(parentGfx, element, attrs) {
|
|
906
|
-
var width = getWidth(element, attrs),
|
|
907
|
-
height = getHeight(element, attrs);
|
|
908
|
-
|
|
909
|
-
var markerPath = pathMap.getScaledPath('MARKER_LOOP', {
|
|
910
|
-
xScaleFactor: 1,
|
|
911
|
-
yScaleFactor: 1,
|
|
912
|
-
containerWidth: width,
|
|
913
|
-
containerHeight: height,
|
|
914
|
-
position: {
|
|
915
|
-
mx: ((width / 2 + attrs.loop) / width),
|
|
916
|
-
my: (height - 7) / height
|
|
917
|
-
}
|
|
918
|
-
});
|
|
919
|
-
|
|
920
|
-
drawMarker('loop', parentGfx, markerPath, {
|
|
921
|
-
strokeWidth: 1.5,
|
|
922
|
-
fill: 'none',
|
|
923
|
-
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
924
|
-
strokeMiterlimit: 0.5
|
|
925
|
-
});
|
|
926
|
-
},
|
|
927
|
-
'AdhocMarker': function(parentGfx, element, attrs) {
|
|
928
|
-
var width = getWidth(element, attrs),
|
|
929
|
-
height = getHeight(element, attrs);
|
|
930
|
-
|
|
931
|
-
var markerPath = pathMap.getScaledPath('MARKER_ADHOC', {
|
|
932
|
-
xScaleFactor: 1,
|
|
933
|
-
yScaleFactor: 1,
|
|
934
|
-
containerWidth: width,
|
|
935
|
-
containerHeight: height,
|
|
936
|
-
position: {
|
|
937
|
-
mx: ((width / 2 + attrs.adhoc) / width),
|
|
938
|
-
my: (height - 15) / height
|
|
939
|
-
}
|
|
940
|
-
});
|
|
941
|
-
|
|
942
|
-
drawMarker('adhoc', parentGfx, markerPath, {
|
|
943
|
-
strokeWidth: 1,
|
|
944
|
-
fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
945
|
-
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
946
|
-
});
|
|
947
|
-
}
|
|
948
|
-
};
|
|
949
|
-
|
|
950
|
-
function renderTaskMarker(type, parentGfx, element, attrs) {
|
|
951
|
-
taskMarkerRenderers[ type ](parentGfx, element, attrs);
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
function renderTaskMarkers(parentGfx, element, taskMarkers, attrs = {}) {
|
|
955
|
-
attrs = {
|
|
956
|
-
fill: attrs.fill,
|
|
957
|
-
stroke: attrs.stroke,
|
|
958
|
-
width: getWidth(element, attrs),
|
|
959
|
-
height: getHeight(element, attrs)
|
|
960
|
-
};
|
|
961
|
-
|
|
962
|
-
var semantic = getSemantic(element);
|
|
963
|
-
|
|
964
|
-
var subprocess = taskMarkers
|
|
965
|
-
|
|
966
|
-
if (subprocess) {
|
|
967
|
-
attrs = {
|
|
968
|
-
...attrs,
|
|
969
|
-
seq: -21,
|
|
970
|
-
parallel: -22,
|
|
971
|
-
compensation: -
|
|
972
|
-
loop: -18,
|
|
973
|
-
adhoc: 10
|
|
974
|
-
};
|
|
975
|
-
} else {
|
|
976
|
-
attrs = {
|
|
977
|
-
...attrs,
|
|
978
|
-
seq: -5,
|
|
979
|
-
parallel: -6,
|
|
980
|
-
compensation: -
|
|
981
|
-
loop: 0,
|
|
982
|
-
adhoc:
|
|
983
|
-
};
|
|
984
|
-
}
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
if (semantic
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
}
|
|
997
|
-
|
|
998
|
-
var loopCharacteristics = semantic.get('loopCharacteristics'),
|
|
999
|
-
isSequential = loopCharacteristics && loopCharacteristics.get('isSequential');
|
|
1000
|
-
|
|
1001
|
-
if (loopCharacteristics) {
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1007
|
-
if (
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
}
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
});
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
}
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
var
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
fill
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
var
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
return
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
strokeWidth:
|
|
1554
|
-
});
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
}
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
}
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
'
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
strokeWidth:
|
|
1765
|
-
});
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
}
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
}
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
'
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
}
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
'
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
});
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
'
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
'
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
});
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
}
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
*
|
|
2342
|
-
*
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
};
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
*
|
|
2377
|
-
*
|
|
2378
|
-
*
|
|
2379
|
-
* @
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
1
|
+
import inherits from 'inherits-browser';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
assign,
|
|
5
|
+
forEach,
|
|
6
|
+
isObject
|
|
7
|
+
} from 'min-dash';
|
|
8
|
+
|
|
9
|
+
import BaseRenderer from 'diagram-js/lib/draw/BaseRenderer';
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
isExpanded,
|
|
13
|
+
isHorizontal,
|
|
14
|
+
isEventSubProcess
|
|
15
|
+
} from '../util/DiUtil';
|
|
16
|
+
|
|
17
|
+
import {
|
|
18
|
+
getLabel
|
|
19
|
+
} from '../util/LabelUtil';
|
|
20
|
+
|
|
21
|
+
import {
|
|
22
|
+
is
|
|
23
|
+
} from '../util/ModelUtil';
|
|
24
|
+
|
|
25
|
+
import {
|
|
26
|
+
createLine
|
|
27
|
+
} from 'diagram-js/lib/util/RenderUtil';
|
|
28
|
+
|
|
29
|
+
import {
|
|
30
|
+
isTypedEvent,
|
|
31
|
+
isThrowEvent,
|
|
32
|
+
isCollection,
|
|
33
|
+
getBounds,
|
|
34
|
+
getDi,
|
|
35
|
+
getSemantic,
|
|
36
|
+
getCirclePath,
|
|
37
|
+
getRoundRectPath,
|
|
38
|
+
getDiamondPath,
|
|
39
|
+
getRectPath,
|
|
40
|
+
getFillColor,
|
|
41
|
+
getStrokeColor,
|
|
42
|
+
getLabelColor,
|
|
43
|
+
getHeight,
|
|
44
|
+
getWidth
|
|
45
|
+
} from './BpmnRenderUtil';
|
|
46
|
+
|
|
47
|
+
import {
|
|
48
|
+
query as domQuery
|
|
49
|
+
} from 'min-dom';
|
|
50
|
+
|
|
51
|
+
import {
|
|
52
|
+
append as svgAppend,
|
|
53
|
+
attr as svgAttr,
|
|
54
|
+
create as svgCreate,
|
|
55
|
+
classes as svgClasses
|
|
56
|
+
} from 'tiny-svg';
|
|
57
|
+
|
|
58
|
+
import {
|
|
59
|
+
rotate,
|
|
60
|
+
transform,
|
|
61
|
+
translate
|
|
62
|
+
} from 'diagram-js/lib/util/SvgTransformUtil';
|
|
63
|
+
|
|
64
|
+
import Ids from 'ids';
|
|
65
|
+
|
|
66
|
+
import { black } from './BpmnRenderUtil';
|
|
67
|
+
|
|
68
|
+
var markerIds = new Ids();
|
|
69
|
+
|
|
70
|
+
var ELEMENT_LABEL_DISTANCE = 10,
|
|
71
|
+
INNER_OUTER_DIST = 3,
|
|
72
|
+
PARTICIPANT_STROKE_WIDTH = 1.5,
|
|
73
|
+
TASK_BORDER_RADIUS = 10;
|
|
74
|
+
|
|
75
|
+
var DEFAULT_OPACITY = 0.95,
|
|
76
|
+
FULL_OPACITY = 1,
|
|
77
|
+
LOW_OPACITY = 0.25;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* @typedef { Partial<{
|
|
81
|
+
* defaultFillColor: string,
|
|
82
|
+
* defaultStrokeColor: string,
|
|
83
|
+
* defaultLabelColor: string
|
|
84
|
+
* }> } BpmnRendererConfig
|
|
85
|
+
*
|
|
86
|
+
* @typedef { Partial<{
|
|
87
|
+
* fill: string,
|
|
88
|
+
* stroke: string,
|
|
89
|
+
* width: string,
|
|
90
|
+
* height: string
|
|
91
|
+
* }> } Attrs
|
|
92
|
+
*/
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* @typedef { import('../model/Types').Element } Element
|
|
96
|
+
* @typedef { import('../model/Types').Shape } Shape
|
|
97
|
+
* @typedef { import('../model/Types').Connection } Connection
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* A renderer for BPMN elements
|
|
102
|
+
*
|
|
103
|
+
* @param {BpmnRendererConfig} config
|
|
104
|
+
* @param {import('diagram-js/lib/core/EventBus').default} eventBus
|
|
105
|
+
* @param {import('diagram-js/lib/draw/Styles').default} styles
|
|
106
|
+
* @param {import('./PathMap').default} pathMap
|
|
107
|
+
* @param {import('diagram-js/lib/core/Canvas').default} canvas
|
|
108
|
+
* @param {import('./TextRenderer').default} textRenderer
|
|
109
|
+
* @param {number} [priority]
|
|
110
|
+
*/
|
|
111
|
+
export default function BpmnRenderer(
|
|
112
|
+
config, eventBus, styles, pathMap,
|
|
113
|
+
canvas, textRenderer, priority) {
|
|
114
|
+
|
|
115
|
+
BaseRenderer.call(this, eventBus, priority);
|
|
116
|
+
|
|
117
|
+
var defaultFillColor = config && config.defaultFillColor,
|
|
118
|
+
defaultStrokeColor = config && config.defaultStrokeColor,
|
|
119
|
+
defaultLabelColor = config && config.defaultLabelColor;
|
|
120
|
+
|
|
121
|
+
function shapeStyle(attrs) {
|
|
122
|
+
return styles.computeStyle(attrs, {
|
|
123
|
+
strokeLinecap: 'round',
|
|
124
|
+
strokeLinejoin: 'round',
|
|
125
|
+
stroke: black,
|
|
126
|
+
strokeWidth: 2,
|
|
127
|
+
fill: 'white'
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function lineStyle(attrs) {
|
|
132
|
+
return styles.computeStyle(attrs, [ 'no-fill' ], {
|
|
133
|
+
strokeLinecap: 'round',
|
|
134
|
+
strokeLinejoin: 'round',
|
|
135
|
+
stroke: black,
|
|
136
|
+
strokeWidth: 2
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function addMarker(id, options) {
|
|
141
|
+
var {
|
|
142
|
+
ref = { x: 0, y: 0 },
|
|
143
|
+
scale = 1,
|
|
144
|
+
element,
|
|
145
|
+
parentGfx = canvas._svg
|
|
146
|
+
} = options;
|
|
147
|
+
|
|
148
|
+
var marker = svgCreate('marker', {
|
|
149
|
+
id: id,
|
|
150
|
+
viewBox: '0 0 20 20',
|
|
151
|
+
refX: ref.x,
|
|
152
|
+
refY: ref.y,
|
|
153
|
+
markerWidth: 20 * scale,
|
|
154
|
+
markerHeight: 20 * scale,
|
|
155
|
+
orient: 'auto'
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
svgAppend(marker, element);
|
|
159
|
+
|
|
160
|
+
var defs = domQuery(':scope > defs', parentGfx);
|
|
161
|
+
|
|
162
|
+
if (!defs) {
|
|
163
|
+
defs = svgCreate('defs');
|
|
164
|
+
|
|
165
|
+
svgAppend(parentGfx, defs);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
svgAppend(defs, marker);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function marker(parentGfx, type, fill, stroke) {
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
var id = markerIds.nextPrefixed('marker-');
|
|
175
|
+
|
|
176
|
+
createMarker(parentGfx, id, type, fill, stroke);
|
|
177
|
+
|
|
178
|
+
return 'url(#' + id + ')';
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function createMarker(parentGfx, id, type, fill, stroke) {
|
|
182
|
+
|
|
183
|
+
if (type === 'sequenceflow-end') {
|
|
184
|
+
var sequenceflowEnd = svgCreate('path', {
|
|
185
|
+
d: 'M 1 5 L 11 10 L 1 15 Z',
|
|
186
|
+
...shapeStyle({
|
|
187
|
+
fill: stroke,
|
|
188
|
+
stroke: stroke,
|
|
189
|
+
strokeWidth: 1
|
|
190
|
+
})
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
addMarker(id, {
|
|
194
|
+
element: sequenceflowEnd,
|
|
195
|
+
ref: { x: 11, y: 10 },
|
|
196
|
+
scale: 0.5,
|
|
197
|
+
parentGfx
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (type === 'messageflow-start') {
|
|
202
|
+
var messageflowStart = svgCreate('circle', {
|
|
203
|
+
cx: 6,
|
|
204
|
+
cy: 6,
|
|
205
|
+
r: 3.5,
|
|
206
|
+
...shapeStyle({
|
|
207
|
+
fill,
|
|
208
|
+
stroke: stroke,
|
|
209
|
+
strokeWidth: 1,
|
|
210
|
+
|
|
211
|
+
// fix for safari / chrome / firefox bug not correctly
|
|
212
|
+
// resetting stroke dash array
|
|
213
|
+
strokeDasharray: [ 10000, 1 ]
|
|
214
|
+
})
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
addMarker(id, {
|
|
218
|
+
element: messageflowStart,
|
|
219
|
+
ref: { x: 6, y: 6 },
|
|
220
|
+
parentGfx
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
if (type === 'messageflow-end') {
|
|
225
|
+
var messageflowEnd = svgCreate('path', {
|
|
226
|
+
d: 'm 1 5 l 0 -3 l 7 3 l -7 3 z',
|
|
227
|
+
...shapeStyle({
|
|
228
|
+
fill,
|
|
229
|
+
stroke: stroke,
|
|
230
|
+
strokeWidth: 1,
|
|
231
|
+
|
|
232
|
+
// fix for safari / chrome / firefox bug not correctly
|
|
233
|
+
// resetting stroke dash array
|
|
234
|
+
strokeDasharray: [ 10000, 1 ]
|
|
235
|
+
})
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
addMarker(id, {
|
|
239
|
+
element: messageflowEnd,
|
|
240
|
+
ref: { x: 8.5, y: 5 },
|
|
241
|
+
parentGfx
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if (type === 'association-start') {
|
|
246
|
+
var associationStart = svgCreate('path', {
|
|
247
|
+
d: 'M 11 5 L 1 10 L 11 15',
|
|
248
|
+
...lineStyle({
|
|
249
|
+
fill: 'none',
|
|
250
|
+
stroke,
|
|
251
|
+
strokeWidth: 1.5,
|
|
252
|
+
|
|
253
|
+
// fix for safari / chrome / firefox bug not correctly
|
|
254
|
+
// resetting stroke dash array
|
|
255
|
+
strokeDasharray: [ 10000, 1 ]
|
|
256
|
+
})
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
addMarker(id, {
|
|
260
|
+
element: associationStart,
|
|
261
|
+
ref: { x: 1, y: 10 },
|
|
262
|
+
scale: 0.5,
|
|
263
|
+
parentGfx
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
if (type === 'association-end') {
|
|
268
|
+
var associationEnd = svgCreate('path', {
|
|
269
|
+
d: 'M 1 5 L 11 10 L 1 15',
|
|
270
|
+
...lineStyle({
|
|
271
|
+
fill: 'none',
|
|
272
|
+
stroke,
|
|
273
|
+
strokeWidth: 1.5,
|
|
274
|
+
|
|
275
|
+
// fix for safari / chrome / firefox bug not correctly
|
|
276
|
+
// resetting stroke dash array
|
|
277
|
+
strokeDasharray: [ 10000, 1 ]
|
|
278
|
+
})
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
addMarker(id, {
|
|
282
|
+
element: associationEnd,
|
|
283
|
+
ref: { x: 11, y: 10 },
|
|
284
|
+
scale: 0.5,
|
|
285
|
+
parentGfx
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
if (type === 'conditional-flow-marker') {
|
|
290
|
+
var conditionalFlowMarker = svgCreate('path', {
|
|
291
|
+
d: 'M 0 10 L 8 6 L 16 10 L 8 14 Z',
|
|
292
|
+
...shapeStyle({
|
|
293
|
+
fill,
|
|
294
|
+
stroke: stroke
|
|
295
|
+
})
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
addMarker(id, {
|
|
299
|
+
element: conditionalFlowMarker,
|
|
300
|
+
ref: { x: -1, y: 10 },
|
|
301
|
+
scale: 0.5,
|
|
302
|
+
parentGfx
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
if (type === 'conditional-default-flow-marker') {
|
|
307
|
+
var defaultFlowMarker = svgCreate('path', {
|
|
308
|
+
d: 'M 6 4 L 10 16',
|
|
309
|
+
...shapeStyle({
|
|
310
|
+
stroke: stroke,
|
|
311
|
+
fill: 'none'
|
|
312
|
+
})
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
addMarker(id, {
|
|
316
|
+
element: defaultFlowMarker,
|
|
317
|
+
ref: { x: 0, y: 10 },
|
|
318
|
+
scale: 0.5,
|
|
319
|
+
parentGfx
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
function drawCircle(parentGfx, width, height, offset, attrs = {}) {
|
|
325
|
+
|
|
326
|
+
if (isObject(offset)) {
|
|
327
|
+
attrs = offset;
|
|
328
|
+
offset = 0;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
offset = offset || 0;
|
|
332
|
+
|
|
333
|
+
attrs = shapeStyle(attrs);
|
|
334
|
+
|
|
335
|
+
var cx = width / 2,
|
|
336
|
+
cy = height / 2;
|
|
337
|
+
|
|
338
|
+
var circle = svgCreate('circle', {
|
|
339
|
+
cx: cx,
|
|
340
|
+
cy: cy,
|
|
341
|
+
r: Math.round((width + height) / 4 - offset),
|
|
342
|
+
...attrs
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
svgAppend(parentGfx, circle);
|
|
346
|
+
|
|
347
|
+
return circle;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
function drawRect(parentGfx, width, height, r, offset, attrs) {
|
|
351
|
+
|
|
352
|
+
if (isObject(offset)) {
|
|
353
|
+
attrs = offset;
|
|
354
|
+
offset = 0;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
offset = offset || 0;
|
|
358
|
+
|
|
359
|
+
attrs = shapeStyle(attrs);
|
|
360
|
+
|
|
361
|
+
var rect = svgCreate('rect', {
|
|
362
|
+
x: offset,
|
|
363
|
+
y: offset,
|
|
364
|
+
width: width - offset * 2,
|
|
365
|
+
height: height - offset * 2,
|
|
366
|
+
rx: r,
|
|
367
|
+
ry: r,
|
|
368
|
+
...attrs
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
svgAppend(parentGfx, rect);
|
|
372
|
+
|
|
373
|
+
return rect;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
function drawDiamond(parentGfx, width, height, attrs) {
|
|
377
|
+
|
|
378
|
+
var x_2 = width / 2;
|
|
379
|
+
var y_2 = height / 2;
|
|
380
|
+
|
|
381
|
+
var points = [
|
|
382
|
+
{ x: x_2, y: 0 },
|
|
383
|
+
{ x: width, y: y_2 },
|
|
384
|
+
{ x: x_2, y: height },
|
|
385
|
+
{ x: 0, y: y_2 }
|
|
386
|
+
];
|
|
387
|
+
|
|
388
|
+
var pointsString = points.map(function(point) {
|
|
389
|
+
return point.x + ',' + point.y;
|
|
390
|
+
}).join(' ');
|
|
391
|
+
|
|
392
|
+
attrs = shapeStyle(attrs);
|
|
393
|
+
|
|
394
|
+
var polygon = svgCreate('polygon', {
|
|
395
|
+
...attrs,
|
|
396
|
+
points: pointsString
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
svgAppend(parentGfx, polygon);
|
|
400
|
+
|
|
401
|
+
return polygon;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* @param {SVGElement} parentGfx
|
|
406
|
+
* @param {Point[]} waypoints
|
|
407
|
+
* @param {any} attrs
|
|
408
|
+
* @param {number} [radius]
|
|
409
|
+
*
|
|
410
|
+
* @return {SVGElement}
|
|
411
|
+
*/
|
|
412
|
+
function drawLine(parentGfx, waypoints, attrs, radius) {
|
|
413
|
+
attrs = lineStyle(attrs);
|
|
414
|
+
|
|
415
|
+
var line = createLine(waypoints, attrs, radius);
|
|
416
|
+
|
|
417
|
+
svgAppend(parentGfx, line);
|
|
418
|
+
|
|
419
|
+
return line;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* @param {SVGElement} parentGfx
|
|
424
|
+
* @param {Point[]} waypoints
|
|
425
|
+
* @param {any} attrs
|
|
426
|
+
*
|
|
427
|
+
* @return {SVGElement}
|
|
428
|
+
*/
|
|
429
|
+
function drawConnectionSegments(parentGfx, waypoints, attrs) {
|
|
430
|
+
return drawLine(parentGfx, waypoints, attrs, 5);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
function drawPath(parentGfx, d, attrs) {
|
|
434
|
+
attrs = lineStyle(attrs);
|
|
435
|
+
|
|
436
|
+
var path = svgCreate('path', {
|
|
437
|
+
...attrs,
|
|
438
|
+
d
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
svgAppend(parentGfx, path);
|
|
442
|
+
|
|
443
|
+
return path;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
function drawMarker(type, parentGfx, path, attrs) {
|
|
447
|
+
return drawPath(parentGfx, path, assign({ 'data-marker': type }, attrs));
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
function renderer(type) {
|
|
451
|
+
return handlers[type];
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
function as(type) {
|
|
455
|
+
return function(parentGfx, element, attrs) {
|
|
456
|
+
return renderer(type)(parentGfx, element, attrs);
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
var eventIconRenderers = {
|
|
461
|
+
'bpmn:MessageEventDefinition': function(parentGfx, element, attrs = {}, isThrowing) {
|
|
462
|
+
var pathData = pathMap.getScaledPath('EVENT_MESSAGE', {
|
|
463
|
+
xScaleFactor: 0.9,
|
|
464
|
+
yScaleFactor: 0.9,
|
|
465
|
+
containerWidth: attrs.width || element.width,
|
|
466
|
+
containerHeight: attrs.height || element.height,
|
|
467
|
+
position: {
|
|
468
|
+
mx: 0.235,
|
|
469
|
+
my: 0.315
|
|
470
|
+
}
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
var fill = isThrowing
|
|
474
|
+
? getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
475
|
+
: getFillColor(element, defaultFillColor, attrs.fill);
|
|
476
|
+
|
|
477
|
+
var stroke = isThrowing
|
|
478
|
+
? getFillColor(element, defaultFillColor, attrs.fill)
|
|
479
|
+
: getStrokeColor(element, defaultStrokeColor, attrs.stroke);
|
|
480
|
+
|
|
481
|
+
var messagePath = drawPath(parentGfx, pathData, {
|
|
482
|
+
fill,
|
|
483
|
+
stroke,
|
|
484
|
+
strokeWidth: 1
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
return messagePath;
|
|
488
|
+
},
|
|
489
|
+
'bpmn:TimerEventDefinition': function(parentGfx, element, attrs = {}) {
|
|
490
|
+
var baseWidth = attrs.width || element.width;
|
|
491
|
+
var baseHeight = attrs.height || element.height;
|
|
492
|
+
|
|
493
|
+
// use a lighter stroke for event suprocess icons
|
|
494
|
+
var strokeWidth = attrs.width ? 1 : 2;
|
|
495
|
+
|
|
496
|
+
var circle = drawCircle(parentGfx, baseWidth, baseHeight, 0.2 * baseHeight, {
|
|
497
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
498
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
499
|
+
strokeWidth: strokeWidth
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
var pathData = pathMap.getScaledPath('EVENT_TIMER_WH', {
|
|
503
|
+
xScaleFactor: 0.75,
|
|
504
|
+
yScaleFactor: 0.75,
|
|
505
|
+
containerWidth: baseWidth,
|
|
506
|
+
containerHeight: baseHeight,
|
|
507
|
+
position: {
|
|
508
|
+
mx: 0.5,
|
|
509
|
+
my: 0.5
|
|
510
|
+
}
|
|
511
|
+
});
|
|
512
|
+
|
|
513
|
+
drawPath(parentGfx, pathData, {
|
|
514
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
515
|
+
strokeWidth: strokeWidth
|
|
516
|
+
});
|
|
517
|
+
|
|
518
|
+
for (var i = 0; i < 12; i++) {
|
|
519
|
+
var linePathData = pathMap.getScaledPath('EVENT_TIMER_LINE', {
|
|
520
|
+
xScaleFactor: 0.75,
|
|
521
|
+
yScaleFactor: 0.75,
|
|
522
|
+
containerWidth: baseWidth,
|
|
523
|
+
containerHeight: baseHeight,
|
|
524
|
+
position: {
|
|
525
|
+
mx: 0.5,
|
|
526
|
+
my: 0.5
|
|
527
|
+
}
|
|
528
|
+
});
|
|
529
|
+
|
|
530
|
+
var width = baseWidth / 2,
|
|
531
|
+
height = baseHeight / 2;
|
|
532
|
+
|
|
533
|
+
drawPath(parentGfx, linePathData, {
|
|
534
|
+
strokeWidth: 1,
|
|
535
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
536
|
+
transform: 'rotate(' + (i * 30) + ',' + height + ',' + width + ')'
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
return circle;
|
|
541
|
+
},
|
|
542
|
+
'bpmn:EscalationEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
|
|
543
|
+
var pathData = pathMap.getScaledPath('EVENT_ESCALATION', {
|
|
544
|
+
xScaleFactor: 1,
|
|
545
|
+
yScaleFactor: 1,
|
|
546
|
+
containerWidth: attrs.width || event.width,
|
|
547
|
+
containerHeight: attrs.height || event.height,
|
|
548
|
+
position: {
|
|
549
|
+
mx: 0.5,
|
|
550
|
+
my: 0.2
|
|
551
|
+
}
|
|
552
|
+
});
|
|
553
|
+
|
|
554
|
+
var fill = isThrowing
|
|
555
|
+
? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
|
|
556
|
+
: getFillColor(event, defaultFillColor, attrs.fill);
|
|
557
|
+
|
|
558
|
+
return drawPath(parentGfx, pathData, {
|
|
559
|
+
fill,
|
|
560
|
+
stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
|
|
561
|
+
strokeWidth: 1
|
|
562
|
+
});
|
|
563
|
+
},
|
|
564
|
+
'bpmn:ConditionalEventDefinition': function(parentGfx, event, attrs = {}) {
|
|
565
|
+
var pathData = pathMap.getScaledPath('EVENT_CONDITIONAL', {
|
|
566
|
+
xScaleFactor: 1,
|
|
567
|
+
yScaleFactor: 1,
|
|
568
|
+
containerWidth: attrs.width || event.width,
|
|
569
|
+
containerHeight: attrs.height || event.height,
|
|
570
|
+
position: {
|
|
571
|
+
mx: 0.5,
|
|
572
|
+
my: 0.222
|
|
573
|
+
}
|
|
574
|
+
});
|
|
575
|
+
|
|
576
|
+
return drawPath(parentGfx, pathData, {
|
|
577
|
+
fill: getFillColor(event, defaultFillColor, attrs.fill),
|
|
578
|
+
stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
|
|
579
|
+
strokeWidth: 1
|
|
580
|
+
});
|
|
581
|
+
},
|
|
582
|
+
'bpmn:LinkEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
|
|
583
|
+
var pathData = pathMap.getScaledPath('EVENT_LINK', {
|
|
584
|
+
xScaleFactor: 1,
|
|
585
|
+
yScaleFactor: 1,
|
|
586
|
+
containerWidth: event.width,
|
|
587
|
+
containerHeight: event.height,
|
|
588
|
+
position: {
|
|
589
|
+
mx: 0.57,
|
|
590
|
+
my: 0.263
|
|
591
|
+
}
|
|
592
|
+
});
|
|
593
|
+
|
|
594
|
+
var fill = isThrowing
|
|
595
|
+
? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
|
|
596
|
+
: getFillColor(event, defaultFillColor, attrs.fill);
|
|
597
|
+
|
|
598
|
+
return drawPath(parentGfx, pathData, {
|
|
599
|
+
fill,
|
|
600
|
+
stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
|
|
601
|
+
strokeWidth: 1
|
|
602
|
+
});
|
|
603
|
+
},
|
|
604
|
+
'bpmn:ErrorEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
|
|
605
|
+
var pathData = pathMap.getScaledPath('EVENT_ERROR', {
|
|
606
|
+
xScaleFactor: 1.1,
|
|
607
|
+
yScaleFactor: 1.1,
|
|
608
|
+
containerWidth: attrs.width || event.width,
|
|
609
|
+
containerHeight: attrs.height || event.height,
|
|
610
|
+
position: {
|
|
611
|
+
mx: 0.2,
|
|
612
|
+
my: 0.722
|
|
613
|
+
}
|
|
614
|
+
});
|
|
615
|
+
|
|
616
|
+
var fill = isThrowing
|
|
617
|
+
? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
|
|
618
|
+
: getFillColor(event, defaultFillColor, attrs.fill);
|
|
619
|
+
|
|
620
|
+
return drawPath(parentGfx, pathData, {
|
|
621
|
+
fill,
|
|
622
|
+
stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
|
|
623
|
+
strokeWidth: 1
|
|
624
|
+
});
|
|
625
|
+
},
|
|
626
|
+
'bpmn:CancelEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
|
|
627
|
+
var pathData = pathMap.getScaledPath('EVENT_CANCEL_45', {
|
|
628
|
+
xScaleFactor: 1.0,
|
|
629
|
+
yScaleFactor: 1.0,
|
|
630
|
+
containerWidth: event.width,
|
|
631
|
+
containerHeight: event.height,
|
|
632
|
+
position: {
|
|
633
|
+
mx: 0.638,
|
|
634
|
+
my: -0.055
|
|
635
|
+
}
|
|
636
|
+
});
|
|
637
|
+
|
|
638
|
+
var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor, attrs.stroke) : 'none';
|
|
639
|
+
|
|
640
|
+
var path = drawPath(parentGfx, pathData, {
|
|
641
|
+
fill,
|
|
642
|
+
stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
|
|
643
|
+
strokeWidth: 1
|
|
644
|
+
});
|
|
645
|
+
|
|
646
|
+
rotate(path, 45);
|
|
647
|
+
|
|
648
|
+
return path;
|
|
649
|
+
},
|
|
650
|
+
'bpmn:CompensateEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
|
|
651
|
+
var pathData = pathMap.getScaledPath('EVENT_COMPENSATION', {
|
|
652
|
+
xScaleFactor: 1,
|
|
653
|
+
yScaleFactor: 1,
|
|
654
|
+
containerWidth: attrs.width || event.width,
|
|
655
|
+
containerHeight: attrs.height || event.height,
|
|
656
|
+
position: {
|
|
657
|
+
mx: 0.22,
|
|
658
|
+
my: 0.5
|
|
659
|
+
}
|
|
660
|
+
});
|
|
661
|
+
|
|
662
|
+
var fill = isThrowing
|
|
663
|
+
? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
|
|
664
|
+
: getFillColor(event, defaultFillColor, attrs.fill);
|
|
665
|
+
|
|
666
|
+
return drawPath(parentGfx, pathData, {
|
|
667
|
+
fill,
|
|
668
|
+
stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
|
|
669
|
+
strokeWidth: 1
|
|
670
|
+
});
|
|
671
|
+
},
|
|
672
|
+
'bpmn:SignalEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
|
|
673
|
+
var pathData = pathMap.getScaledPath('EVENT_SIGNAL', {
|
|
674
|
+
xScaleFactor: 0.9,
|
|
675
|
+
yScaleFactor: 0.9,
|
|
676
|
+
containerWidth: attrs.width || event.width,
|
|
677
|
+
containerHeight: attrs.height || event.height,
|
|
678
|
+
position: {
|
|
679
|
+
mx: 0.5,
|
|
680
|
+
my: 0.2
|
|
681
|
+
}
|
|
682
|
+
});
|
|
683
|
+
|
|
684
|
+
var fill = isThrowing
|
|
685
|
+
? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
|
|
686
|
+
: getFillColor(event, defaultFillColor, attrs.fill);
|
|
687
|
+
|
|
688
|
+
return drawPath(parentGfx, pathData, {
|
|
689
|
+
strokeWidth: 1,
|
|
690
|
+
fill,
|
|
691
|
+
stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke)
|
|
692
|
+
});
|
|
693
|
+
},
|
|
694
|
+
'bpmn:MultipleEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
|
|
695
|
+
var pathData = pathMap.getScaledPath('EVENT_MULTIPLE', {
|
|
696
|
+
xScaleFactor: 1.1,
|
|
697
|
+
yScaleFactor: 1.1,
|
|
698
|
+
containerWidth: attrs.width || event.width,
|
|
699
|
+
containerHeight: attrs.height || event.height,
|
|
700
|
+
position: {
|
|
701
|
+
mx: 0.211,
|
|
702
|
+
my: 0.36
|
|
703
|
+
}
|
|
704
|
+
});
|
|
705
|
+
|
|
706
|
+
var fill = isThrowing
|
|
707
|
+
? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
|
|
708
|
+
: getFillColor(event, defaultFillColor, attrs.fill);
|
|
709
|
+
|
|
710
|
+
return drawPath(parentGfx, pathData, {
|
|
711
|
+
fill,
|
|
712
|
+
stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
|
|
713
|
+
strokeWidth: 1
|
|
714
|
+
});
|
|
715
|
+
},
|
|
716
|
+
'bpmn:ParallelMultipleEventDefinition': function(parentGfx, event, attrs = {}) {
|
|
717
|
+
var pathData = pathMap.getScaledPath('EVENT_PARALLEL_MULTIPLE', {
|
|
718
|
+
xScaleFactor: 1.2,
|
|
719
|
+
yScaleFactor: 1.2,
|
|
720
|
+
containerWidth: attrs.width || event.width,
|
|
721
|
+
containerHeight: attrs.height || event.height,
|
|
722
|
+
position: {
|
|
723
|
+
mx: 0.458,
|
|
724
|
+
my: 0.194
|
|
725
|
+
}
|
|
726
|
+
});
|
|
727
|
+
|
|
728
|
+
return drawPath(parentGfx, pathData, {
|
|
729
|
+
fill: getFillColor(event, defaultFillColor, attrs.fill),
|
|
730
|
+
stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
|
|
731
|
+
strokeWidth: 1
|
|
732
|
+
});
|
|
733
|
+
},
|
|
734
|
+
'bpmn:TerminateEventDefinition': function(parentGfx, element, attrs = {}) {
|
|
735
|
+
var circle = drawCircle(parentGfx, element.width, element.height, 8, {
|
|
736
|
+
fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
737
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
738
|
+
strokeWidth: 4
|
|
739
|
+
});
|
|
740
|
+
|
|
741
|
+
return circle;
|
|
742
|
+
}
|
|
743
|
+
};
|
|
744
|
+
|
|
745
|
+
function renderEventIcon(element, parentGfx, attrs = {}, proxyElement) {
|
|
746
|
+
var semantic = getSemantic(element),
|
|
747
|
+
isThrowing = isThrowEvent(semantic);
|
|
748
|
+
|
|
749
|
+
var nodeElement = proxyElement || element;
|
|
750
|
+
|
|
751
|
+
if (semantic.get('eventDefinitions') && semantic.get('eventDefinitions').length > 1) {
|
|
752
|
+
if (semantic.get('parallelMultiple')) {
|
|
753
|
+
return eventIconRenderers[ 'bpmn:ParallelMultipleEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
754
|
+
}
|
|
755
|
+
else {
|
|
756
|
+
return eventIconRenderers[ 'bpmn:MultipleEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
if (isTypedEvent(semantic, 'bpmn:MessageEventDefinition')) {
|
|
761
|
+
return eventIconRenderers[ 'bpmn:MessageEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
if (isTypedEvent(semantic, 'bpmn:TimerEventDefinition')) {
|
|
765
|
+
return eventIconRenderers[ 'bpmn:TimerEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
if (isTypedEvent(semantic, 'bpmn:ConditionalEventDefinition')) {
|
|
769
|
+
return eventIconRenderers[ 'bpmn:ConditionalEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
if (isTypedEvent(semantic, 'bpmn:SignalEventDefinition')) {
|
|
773
|
+
return eventIconRenderers[ 'bpmn:SignalEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
if (isTypedEvent(semantic, 'bpmn:EscalationEventDefinition')) {
|
|
777
|
+
return eventIconRenderers[ 'bpmn:EscalationEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
if (isTypedEvent(semantic, 'bpmn:LinkEventDefinition')) {
|
|
781
|
+
return eventIconRenderers[ 'bpmn:LinkEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
if (isTypedEvent(semantic, 'bpmn:ErrorEventDefinition')) {
|
|
785
|
+
return eventIconRenderers[ 'bpmn:ErrorEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
if (isTypedEvent(semantic, 'bpmn:CancelEventDefinition')) {
|
|
789
|
+
return eventIconRenderers[ 'bpmn:CancelEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
if (isTypedEvent(semantic, 'bpmn:CompensateEventDefinition')) {
|
|
793
|
+
return eventIconRenderers[ 'bpmn:CompensateEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
if (isTypedEvent(semantic, 'bpmn:TerminateEventDefinition')) {
|
|
797
|
+
return eventIconRenderers[ 'bpmn:TerminateEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
return null;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
var taskMarkerRenderers = {
|
|
804
|
+
'ParticipantMultiplicityMarker': function(parentGfx, element, attrs = {}) {
|
|
805
|
+
var width = getWidth(element, attrs),
|
|
806
|
+
height = getHeight(element, attrs);
|
|
807
|
+
|
|
808
|
+
var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
|
|
809
|
+
xScaleFactor: 1,
|
|
810
|
+
yScaleFactor: 1,
|
|
811
|
+
containerWidth: width,
|
|
812
|
+
containerHeight: height,
|
|
813
|
+
position: {
|
|
814
|
+
mx: ((width / 2 - 6) / width),
|
|
815
|
+
my: (height - 15) / height
|
|
816
|
+
}
|
|
817
|
+
});
|
|
818
|
+
|
|
819
|
+
drawMarker('participant-multiplicity', parentGfx, markerPath, {
|
|
820
|
+
strokeWidth: 2,
|
|
821
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
822
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
823
|
+
});
|
|
824
|
+
},
|
|
825
|
+
'SubProcessMarker': function(parentGfx, element, attrs = {}) {
|
|
826
|
+
var markerRect = drawRect(parentGfx, 14, 14, 0, {
|
|
827
|
+
strokeWidth: 1,
|
|
828
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
829
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
830
|
+
});
|
|
831
|
+
|
|
832
|
+
translate(markerRect, element.width / 2 - 7.5, element.height - 20);
|
|
833
|
+
|
|
834
|
+
var markerPath = pathMap.getScaledPath('MARKER_SUB_PROCESS', {
|
|
835
|
+
xScaleFactor: 1.5,
|
|
836
|
+
yScaleFactor: 1.5,
|
|
837
|
+
containerWidth: element.width,
|
|
838
|
+
containerHeight: element.height,
|
|
839
|
+
position: {
|
|
840
|
+
mx: (element.width / 2 - 7.5) / element.width,
|
|
841
|
+
my: (element.height - 20) / element.height
|
|
842
|
+
}
|
|
843
|
+
});
|
|
844
|
+
|
|
845
|
+
drawMarker('sub-process', parentGfx, markerPath, {
|
|
846
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
847
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
848
|
+
});
|
|
849
|
+
},
|
|
850
|
+
'ParallelMarker': function(parentGfx, element, attrs) {
|
|
851
|
+
var width = getWidth(element, attrs),
|
|
852
|
+
height = getHeight(element, attrs);
|
|
853
|
+
|
|
854
|
+
var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
|
|
855
|
+
xScaleFactor: 1,
|
|
856
|
+
yScaleFactor: 1,
|
|
857
|
+
containerWidth: width,
|
|
858
|
+
containerHeight: height,
|
|
859
|
+
position: {
|
|
860
|
+
mx: ((width / 2 + attrs.parallel) / width),
|
|
861
|
+
my: (height - 20) / height
|
|
862
|
+
}
|
|
863
|
+
});
|
|
864
|
+
|
|
865
|
+
drawMarker('parallel', parentGfx, markerPath, {
|
|
866
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
867
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
868
|
+
});
|
|
869
|
+
},
|
|
870
|
+
'SequentialMarker': function(parentGfx, element, attrs) {
|
|
871
|
+
var markerPath = pathMap.getScaledPath('MARKER_SEQUENTIAL', {
|
|
872
|
+
xScaleFactor: 1,
|
|
873
|
+
yScaleFactor: 1,
|
|
874
|
+
containerWidth: element.width,
|
|
875
|
+
containerHeight: element.height,
|
|
876
|
+
position: {
|
|
877
|
+
mx: ((element.width / 2 + attrs.seq) / element.width),
|
|
878
|
+
my: (element.height - 19) / element.height
|
|
879
|
+
}
|
|
880
|
+
});
|
|
881
|
+
|
|
882
|
+
drawMarker('sequential', parentGfx, markerPath, {
|
|
883
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
884
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
885
|
+
});
|
|
886
|
+
},
|
|
887
|
+
'CompensationMarker': function(parentGfx, element, attrs) {
|
|
888
|
+
var markerMath = pathMap.getScaledPath('MARKER_COMPENSATION', {
|
|
889
|
+
xScaleFactor: 1,
|
|
890
|
+
yScaleFactor: 1,
|
|
891
|
+
containerWidth: element.width,
|
|
892
|
+
containerHeight: element.height,
|
|
893
|
+
position: {
|
|
894
|
+
mx: ((element.width / 2 + attrs.compensation) / element.width),
|
|
895
|
+
my: (element.height - 13) / element.height
|
|
896
|
+
}
|
|
897
|
+
});
|
|
898
|
+
|
|
899
|
+
drawMarker('compensation', parentGfx, markerMath, {
|
|
900
|
+
strokeWidth: 1,
|
|
901
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
902
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
903
|
+
});
|
|
904
|
+
},
|
|
905
|
+
'LoopMarker': function(parentGfx, element, attrs) {
|
|
906
|
+
var width = getWidth(element, attrs),
|
|
907
|
+
height = getHeight(element, attrs);
|
|
908
|
+
|
|
909
|
+
var markerPath = pathMap.getScaledPath('MARKER_LOOP', {
|
|
910
|
+
xScaleFactor: 1,
|
|
911
|
+
yScaleFactor: 1,
|
|
912
|
+
containerWidth: width,
|
|
913
|
+
containerHeight: height,
|
|
914
|
+
position: {
|
|
915
|
+
mx: ((width / 2 + attrs.loop) / width),
|
|
916
|
+
my: (height - 7) / height
|
|
917
|
+
}
|
|
918
|
+
});
|
|
919
|
+
|
|
920
|
+
drawMarker('loop', parentGfx, markerPath, {
|
|
921
|
+
strokeWidth: 1.5,
|
|
922
|
+
fill: 'none',
|
|
923
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
924
|
+
strokeMiterlimit: 0.5
|
|
925
|
+
});
|
|
926
|
+
},
|
|
927
|
+
'AdhocMarker': function(parentGfx, element, attrs) {
|
|
928
|
+
var width = getWidth(element, attrs),
|
|
929
|
+
height = getHeight(element, attrs);
|
|
930
|
+
|
|
931
|
+
var markerPath = pathMap.getScaledPath('MARKER_ADHOC', {
|
|
932
|
+
xScaleFactor: 1,
|
|
933
|
+
yScaleFactor: 1,
|
|
934
|
+
containerWidth: width,
|
|
935
|
+
containerHeight: height,
|
|
936
|
+
position: {
|
|
937
|
+
mx: ((width / 2 + attrs.adhoc) / width),
|
|
938
|
+
my: (height - 15) / height
|
|
939
|
+
}
|
|
940
|
+
});
|
|
941
|
+
|
|
942
|
+
drawMarker('adhoc', parentGfx, markerPath, {
|
|
943
|
+
strokeWidth: 1,
|
|
944
|
+
fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
945
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
946
|
+
});
|
|
947
|
+
}
|
|
948
|
+
};
|
|
949
|
+
|
|
950
|
+
function renderTaskMarker(type, parentGfx, element, attrs) {
|
|
951
|
+
taskMarkerRenderers[ type ](parentGfx, element, attrs);
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
function renderTaskMarkers(parentGfx, element, taskMarkers = [], attrs = {}) {
|
|
955
|
+
attrs = {
|
|
956
|
+
fill: attrs.fill,
|
|
957
|
+
stroke: attrs.stroke,
|
|
958
|
+
width: getWidth(element, attrs),
|
|
959
|
+
height: getHeight(element, attrs)
|
|
960
|
+
};
|
|
961
|
+
|
|
962
|
+
var semantic = getSemantic(element);
|
|
963
|
+
|
|
964
|
+
var subprocess = taskMarkers.includes('SubProcessMarker');
|
|
965
|
+
|
|
966
|
+
if (subprocess) {
|
|
967
|
+
attrs = {
|
|
968
|
+
...attrs,
|
|
969
|
+
seq: -21,
|
|
970
|
+
parallel: -22,
|
|
971
|
+
compensation: -25,
|
|
972
|
+
loop: -18,
|
|
973
|
+
adhoc: 10
|
|
974
|
+
};
|
|
975
|
+
} else {
|
|
976
|
+
attrs = {
|
|
977
|
+
...attrs,
|
|
978
|
+
seq: -5,
|
|
979
|
+
parallel: -6,
|
|
980
|
+
compensation: -7,
|
|
981
|
+
loop: 0,
|
|
982
|
+
adhoc: -8
|
|
983
|
+
};
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
if (semantic.get('isForCompensation')) {
|
|
987
|
+
taskMarkers.push('CompensationMarker');
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
if (is(semantic, 'bpmn:AdHocSubProcess')) {
|
|
991
|
+
taskMarkers.push('AdhocMarker');
|
|
992
|
+
|
|
993
|
+
if (!subprocess) {
|
|
994
|
+
assign(attrs, { compensation: attrs.compensation - 18 });
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
var loopCharacteristics = semantic.get('loopCharacteristics'),
|
|
999
|
+
isSequential = loopCharacteristics && loopCharacteristics.get('isSequential');
|
|
1000
|
+
|
|
1001
|
+
if (loopCharacteristics) {
|
|
1002
|
+
|
|
1003
|
+
assign(attrs, {
|
|
1004
|
+
compensation: attrs.compensation - 18,
|
|
1005
|
+
});
|
|
1006
|
+
|
|
1007
|
+
if (taskMarkers.includes('AdhocMarker')) {
|
|
1008
|
+
assign(attrs, {
|
|
1009
|
+
seq: -23,
|
|
1010
|
+
loop: -18,
|
|
1011
|
+
parallel: -24
|
|
1012
|
+
});
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
if (isSequential === undefined) {
|
|
1016
|
+
taskMarkers.push('LoopMarker');
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
if (isSequential === false) {
|
|
1020
|
+
taskMarkers.push('ParallelMarker');
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
if (isSequential === true) {
|
|
1024
|
+
taskMarkers.push('SequentialMarker');
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
if (taskMarkers.includes('CompensationMarker') && taskMarkers.length === 1) {
|
|
1029
|
+
assign(attrs, {
|
|
1030
|
+
compensation: -8
|
|
1031
|
+
});
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
forEach(taskMarkers, function(marker) {
|
|
1035
|
+
renderTaskMarker(marker, parentGfx, element, attrs);
|
|
1036
|
+
});
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
function renderLabel(parentGfx, label, attrs = {}) {
|
|
1040
|
+
attrs = assign({
|
|
1041
|
+
size: {
|
|
1042
|
+
width: 100
|
|
1043
|
+
}
|
|
1044
|
+
}, attrs);
|
|
1045
|
+
|
|
1046
|
+
var text = textRenderer.createText(label || '', attrs);
|
|
1047
|
+
|
|
1048
|
+
svgClasses(text).add('djs-label');
|
|
1049
|
+
|
|
1050
|
+
svgAppend(parentGfx, text);
|
|
1051
|
+
|
|
1052
|
+
return text;
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
function renderEmbeddedLabel(parentGfx, element, align, attrs = {}) {
|
|
1056
|
+
var semantic = getSemantic(element);
|
|
1057
|
+
|
|
1058
|
+
var box = getBounds({
|
|
1059
|
+
x: element.x,
|
|
1060
|
+
y: element.y,
|
|
1061
|
+
width: element.width,
|
|
1062
|
+
height: element.height
|
|
1063
|
+
}, attrs);
|
|
1064
|
+
|
|
1065
|
+
return renderLabel(parentGfx, semantic.name, {
|
|
1066
|
+
align,
|
|
1067
|
+
box,
|
|
1068
|
+
padding: 7,
|
|
1069
|
+
style: {
|
|
1070
|
+
fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
|
|
1071
|
+
}
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
function renderExternalLabel(parentGfx, element, attrs = {}) {
|
|
1076
|
+
var box = {
|
|
1077
|
+
width: 90,
|
|
1078
|
+
height: 30,
|
|
1079
|
+
x: element.width / 2 + element.x,
|
|
1080
|
+
y: element.height / 2 + element.y
|
|
1081
|
+
};
|
|
1082
|
+
|
|
1083
|
+
return renderLabel(parentGfx, getLabel(element), {
|
|
1084
|
+
box: box,
|
|
1085
|
+
fitBox: true,
|
|
1086
|
+
style: assign(
|
|
1087
|
+
{},
|
|
1088
|
+
textRenderer.getExternalStyle(),
|
|
1089
|
+
{
|
|
1090
|
+
fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
|
|
1091
|
+
}
|
|
1092
|
+
)
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
function renderLaneLabel(parentGfx, text, element, attrs = {}) {
|
|
1097
|
+
var isHorizontalLane = isHorizontal(element);
|
|
1098
|
+
|
|
1099
|
+
var textBox = renderLabel(parentGfx, text, {
|
|
1100
|
+
box: {
|
|
1101
|
+
height: 30,
|
|
1102
|
+
width: isHorizontalLane ? getHeight(element, attrs) : getWidth(element, attrs),
|
|
1103
|
+
},
|
|
1104
|
+
align: 'center-middle',
|
|
1105
|
+
style: {
|
|
1106
|
+
fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
|
|
1107
|
+
}
|
|
1108
|
+
});
|
|
1109
|
+
|
|
1110
|
+
if (isHorizontalLane) {
|
|
1111
|
+
var top = -1 * getHeight(element, attrs);
|
|
1112
|
+
transform(textBox, 0, -top, 270);
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
function renderActivity(parentGfx, element, attrs = {}) {
|
|
1117
|
+
var {
|
|
1118
|
+
width,
|
|
1119
|
+
height
|
|
1120
|
+
} = getBounds(element, attrs);
|
|
1121
|
+
|
|
1122
|
+
return drawRect(parentGfx, width, height, TASK_BORDER_RADIUS, {
|
|
1123
|
+
...attrs,
|
|
1124
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
1125
|
+
fillOpacity: DEFAULT_OPACITY,
|
|
1126
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
1127
|
+
});
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
function renderAssociation(parentGfx, element, attrs = {}) {
|
|
1131
|
+
var semantic = getSemantic(element);
|
|
1132
|
+
|
|
1133
|
+
var fill = getFillColor(element, defaultFillColor, attrs.fill),
|
|
1134
|
+
stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
|
|
1135
|
+
|
|
1136
|
+
if (semantic.get('associationDirection') === 'One' ||
|
|
1137
|
+
semantic.get('associationDirection') === 'Both') {
|
|
1138
|
+
attrs.markerEnd = marker(parentGfx, 'association-end', fill, stroke);
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
if (semantic.get('associationDirection') === 'Both') {
|
|
1142
|
+
attrs.markerStart = marker(parentGfx, 'association-start', fill, stroke);
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
attrs = pickAttrs(attrs, [
|
|
1146
|
+
'markerStart',
|
|
1147
|
+
'markerEnd'
|
|
1148
|
+
]);
|
|
1149
|
+
|
|
1150
|
+
return drawConnectionSegments(parentGfx, element.waypoints, {
|
|
1151
|
+
...attrs,
|
|
1152
|
+
stroke,
|
|
1153
|
+
strokeDasharray: '0, 5'
|
|
1154
|
+
});
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
function renderDataObject(parentGfx, element, attrs = {}) {
|
|
1158
|
+
var fill = getFillColor(element, defaultFillColor, attrs.fill),
|
|
1159
|
+
stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
|
|
1160
|
+
|
|
1161
|
+
var pathData = pathMap.getScaledPath('DATA_OBJECT_PATH', {
|
|
1162
|
+
xScaleFactor: 1,
|
|
1163
|
+
yScaleFactor: 1,
|
|
1164
|
+
containerWidth: element.width,
|
|
1165
|
+
containerHeight: element.height,
|
|
1166
|
+
position: {
|
|
1167
|
+
mx: 0.474,
|
|
1168
|
+
my: 0.296
|
|
1169
|
+
}
|
|
1170
|
+
});
|
|
1171
|
+
|
|
1172
|
+
var dataObject = drawPath(parentGfx, pathData, {
|
|
1173
|
+
fill,
|
|
1174
|
+
fillOpacity: DEFAULT_OPACITY,
|
|
1175
|
+
stroke
|
|
1176
|
+
});
|
|
1177
|
+
|
|
1178
|
+
var semantic = getSemantic(element);
|
|
1179
|
+
|
|
1180
|
+
if (isCollection(semantic)) {
|
|
1181
|
+
var collectionPathData = pathMap.getScaledPath('DATA_OBJECT_COLLECTION_PATH', {
|
|
1182
|
+
xScaleFactor: 1,
|
|
1183
|
+
yScaleFactor: 1,
|
|
1184
|
+
containerWidth: element.width,
|
|
1185
|
+
containerHeight: element.height,
|
|
1186
|
+
position: {
|
|
1187
|
+
mx: 0.33,
|
|
1188
|
+
my: (element.height - 18) / element.height
|
|
1189
|
+
}
|
|
1190
|
+
});
|
|
1191
|
+
|
|
1192
|
+
drawPath(parentGfx, collectionPathData, {
|
|
1193
|
+
strokeWidth: 2,
|
|
1194
|
+
fill,
|
|
1195
|
+
stroke
|
|
1196
|
+
});
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
return dataObject;
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
function renderEvent(parentGfx, element, attrs = {}) {
|
|
1203
|
+
return drawCircle(parentGfx, element.width, element.height, {
|
|
1204
|
+
fillOpacity: DEFAULT_OPACITY,
|
|
1205
|
+
...attrs,
|
|
1206
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
1207
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
1208
|
+
});
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
function renderGateway(parentGfx, element, attrs = {}) {
|
|
1212
|
+
return drawDiamond(parentGfx, element.width, element.height, {
|
|
1213
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
1214
|
+
fillOpacity: DEFAULT_OPACITY,
|
|
1215
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
1216
|
+
});
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
function renderLane(parentGfx, element, attrs = {}) {
|
|
1220
|
+
var lane = drawRect(parentGfx, getWidth(element, attrs), getHeight(element, attrs), 0, {
|
|
1221
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
1222
|
+
fillOpacity: attrs.fillOpacity || DEFAULT_OPACITY,
|
|
1223
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1224
|
+
strokeWidth: 1.5
|
|
1225
|
+
});
|
|
1226
|
+
|
|
1227
|
+
var semantic = getSemantic(element);
|
|
1228
|
+
|
|
1229
|
+
if (is(semantic, 'bpmn:Lane')) {
|
|
1230
|
+
var text = semantic.get('name');
|
|
1231
|
+
|
|
1232
|
+
renderLaneLabel(parentGfx, text, element, attrs);
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
return lane;
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
function renderSubProcess(parentGfx, element, attrs = {}) {
|
|
1239
|
+
var activity = renderActivity(parentGfx, element, attrs);
|
|
1240
|
+
|
|
1241
|
+
var expanded = isExpanded(element);
|
|
1242
|
+
|
|
1243
|
+
if (isEventSubProcess(element)) {
|
|
1244
|
+
svgAttr(activity, {
|
|
1245
|
+
strokeDasharray: '0, 5.5',
|
|
1246
|
+
strokeWidth: 2.5
|
|
1247
|
+
});
|
|
1248
|
+
|
|
1249
|
+
if (!expanded) {
|
|
1250
|
+
var flowElements = getSemantic(element).flowElements || [];
|
|
1251
|
+
var startEvents = flowElements.filter(e => is(e, 'bpmn:StartEvent'));
|
|
1252
|
+
|
|
1253
|
+
if (startEvents.length === 1) {
|
|
1254
|
+
renderEventSubProcessIcon(startEvents[0], parentGfx, attrs, element);
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
renderEmbeddedLabel(parentGfx, element, expanded ? 'center-top' : 'center-middle', attrs);
|
|
1260
|
+
|
|
1261
|
+
if (expanded) {
|
|
1262
|
+
renderTaskMarkers(parentGfx, element, undefined, attrs);
|
|
1263
|
+
} else {
|
|
1264
|
+
renderTaskMarkers(parentGfx, element, [ 'SubProcessMarker' ], attrs);
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
return activity;
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
function renderEventSubProcessIcon(startEvent, parentGfx, attrs, proxyElement) {
|
|
1271
|
+
var iconSize = 22;
|
|
1272
|
+
|
|
1273
|
+
// match the colors of the enclosing subprocess
|
|
1274
|
+
var proxyAttrs = {
|
|
1275
|
+
fill: getFillColor(proxyElement, defaultFillColor, attrs.fill),
|
|
1276
|
+
stroke: getStrokeColor(proxyElement, defaultStrokeColor, attrs.stroke),
|
|
1277
|
+
width: iconSize,
|
|
1278
|
+
height: iconSize
|
|
1279
|
+
};
|
|
1280
|
+
|
|
1281
|
+
var interrupting = getSemantic(startEvent).isInterrupting;
|
|
1282
|
+
var strokeDasharray = interrupting ? 0 : 3;
|
|
1283
|
+
|
|
1284
|
+
// better visibility for non-interrupting events
|
|
1285
|
+
var strokeWidth = interrupting ? 1 : 1.2;
|
|
1286
|
+
|
|
1287
|
+
// make the icon look larger by drawing a smaller circle
|
|
1288
|
+
var circleSize = 20;
|
|
1289
|
+
var shift = (iconSize - circleSize) / 2;
|
|
1290
|
+
var transform = 'translate(' + shift + ',' + shift + ')';
|
|
1291
|
+
|
|
1292
|
+
drawCircle(parentGfx, circleSize, circleSize, {
|
|
1293
|
+
fill: proxyAttrs.fill,
|
|
1294
|
+
stroke: proxyAttrs.stroke,
|
|
1295
|
+
strokeWidth,
|
|
1296
|
+
strokeDasharray,
|
|
1297
|
+
transform
|
|
1298
|
+
});
|
|
1299
|
+
|
|
1300
|
+
renderEventIcon(startEvent, parentGfx, proxyAttrs, proxyElement);
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
function renderTask(parentGfx, element, attrs = {}) {
|
|
1304
|
+
var activity = renderActivity(parentGfx, element, attrs);
|
|
1305
|
+
|
|
1306
|
+
renderEmbeddedLabel(parentGfx, element, 'center-middle', attrs);
|
|
1307
|
+
|
|
1308
|
+
renderTaskMarkers(parentGfx, element, undefined, attrs);
|
|
1309
|
+
|
|
1310
|
+
return activity;
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
var handlers = this.handlers = {
|
|
1314
|
+
'bpmn:AdHocSubProcess': function(parentGfx, element, attrs = {}) {
|
|
1315
|
+
if (isExpanded(element)) {
|
|
1316
|
+
attrs = pickAttrs(attrs, [
|
|
1317
|
+
'fill',
|
|
1318
|
+
'stroke',
|
|
1319
|
+
'width',
|
|
1320
|
+
'height'
|
|
1321
|
+
]);
|
|
1322
|
+
} else {
|
|
1323
|
+
attrs = pickAttrs(attrs, [
|
|
1324
|
+
'fill',
|
|
1325
|
+
'stroke'
|
|
1326
|
+
]);
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
return renderSubProcess(parentGfx, element, attrs);
|
|
1330
|
+
},
|
|
1331
|
+
'bpmn:Association': function(parentGfx, element, attrs = {}) {
|
|
1332
|
+
attrs = pickAttrs(attrs, [
|
|
1333
|
+
'fill',
|
|
1334
|
+
'stroke'
|
|
1335
|
+
]);
|
|
1336
|
+
|
|
1337
|
+
return renderAssociation(parentGfx, element, attrs);
|
|
1338
|
+
},
|
|
1339
|
+
'bpmn:BoundaryEvent': function(parentGfx, element, attrs = {}) {
|
|
1340
|
+
var { renderIcon = true } = attrs;
|
|
1341
|
+
|
|
1342
|
+
attrs = pickAttrs(attrs, [
|
|
1343
|
+
'fill',
|
|
1344
|
+
'stroke'
|
|
1345
|
+
]);
|
|
1346
|
+
|
|
1347
|
+
var semantic = getSemantic(element),
|
|
1348
|
+
cancelActivity = semantic.get('cancelActivity');
|
|
1349
|
+
|
|
1350
|
+
attrs = {
|
|
1351
|
+
strokeWidth: 1.5,
|
|
1352
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
1353
|
+
fillOpacity: FULL_OPACITY,
|
|
1354
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
1355
|
+
};
|
|
1356
|
+
|
|
1357
|
+
if (!cancelActivity) {
|
|
1358
|
+
attrs.strokeDasharray = '6';
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
var event = renderEvent(parentGfx, element, attrs);
|
|
1362
|
+
|
|
1363
|
+
drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
|
|
1364
|
+
...attrs,
|
|
1365
|
+
fill: 'none'
|
|
1366
|
+
});
|
|
1367
|
+
|
|
1368
|
+
if (renderIcon) {
|
|
1369
|
+
renderEventIcon(element, parentGfx, attrs);
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
return event;
|
|
1373
|
+
},
|
|
1374
|
+
'bpmn:BusinessRuleTask': function(parentGfx, element, attrs = {}) {
|
|
1375
|
+
attrs = pickAttrs(attrs, [
|
|
1376
|
+
'fill',
|
|
1377
|
+
'stroke'
|
|
1378
|
+
]);
|
|
1379
|
+
|
|
1380
|
+
var task = renderTask(parentGfx, element, attrs);
|
|
1381
|
+
|
|
1382
|
+
var headerData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_MAIN', {
|
|
1383
|
+
abspos: {
|
|
1384
|
+
x: 8,
|
|
1385
|
+
y: 8
|
|
1386
|
+
}
|
|
1387
|
+
});
|
|
1388
|
+
|
|
1389
|
+
var businessPath = drawPath(parentGfx, headerData);
|
|
1390
|
+
|
|
1391
|
+
svgAttr(businessPath, {
|
|
1392
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
1393
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1394
|
+
strokeWidth: 1
|
|
1395
|
+
});
|
|
1396
|
+
|
|
1397
|
+
var headerPathData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_HEADER', {
|
|
1398
|
+
abspos: {
|
|
1399
|
+
x: 8,
|
|
1400
|
+
y: 8
|
|
1401
|
+
}
|
|
1402
|
+
});
|
|
1403
|
+
|
|
1404
|
+
var businessHeaderPath = drawPath(parentGfx, headerPathData);
|
|
1405
|
+
|
|
1406
|
+
svgAttr(businessHeaderPath, {
|
|
1407
|
+
fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1408
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1409
|
+
strokeWidth: 1
|
|
1410
|
+
});
|
|
1411
|
+
|
|
1412
|
+
return task;
|
|
1413
|
+
},
|
|
1414
|
+
'bpmn:CallActivity': function(parentGfx, element, attrs = {}) {
|
|
1415
|
+
attrs = pickAttrs(attrs, [
|
|
1416
|
+
'fill',
|
|
1417
|
+
'stroke'
|
|
1418
|
+
]);
|
|
1419
|
+
|
|
1420
|
+
return renderSubProcess(parentGfx, element, {
|
|
1421
|
+
strokeWidth: 5,
|
|
1422
|
+
...attrs
|
|
1423
|
+
});
|
|
1424
|
+
},
|
|
1425
|
+
'bpmn:ComplexGateway': function(parentGfx, element, attrs = {}) {
|
|
1426
|
+
attrs = pickAttrs(attrs, [
|
|
1427
|
+
'fill',
|
|
1428
|
+
'stroke'
|
|
1429
|
+
]);
|
|
1430
|
+
|
|
1431
|
+
var gateway = renderGateway(parentGfx, element, attrs);
|
|
1432
|
+
|
|
1433
|
+
var pathData = pathMap.getScaledPath('GATEWAY_COMPLEX', {
|
|
1434
|
+
xScaleFactor: 0.5,
|
|
1435
|
+
yScaleFactor:0.5,
|
|
1436
|
+
containerWidth: element.width,
|
|
1437
|
+
containerHeight: element.height,
|
|
1438
|
+
position: {
|
|
1439
|
+
mx: 0.46,
|
|
1440
|
+
my: 0.26
|
|
1441
|
+
}
|
|
1442
|
+
});
|
|
1443
|
+
|
|
1444
|
+
drawPath(parentGfx, pathData, {
|
|
1445
|
+
fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1446
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1447
|
+
strokeWidth: 1
|
|
1448
|
+
});
|
|
1449
|
+
|
|
1450
|
+
return gateway;
|
|
1451
|
+
},
|
|
1452
|
+
'bpmn:DataInput': function(parentGfx, element, attrs = {}) {
|
|
1453
|
+
attrs = pickAttrs(attrs, [
|
|
1454
|
+
'fill',
|
|
1455
|
+
'stroke'
|
|
1456
|
+
]);
|
|
1457
|
+
|
|
1458
|
+
var arrowPathData = pathMap.getRawPath('DATA_ARROW');
|
|
1459
|
+
|
|
1460
|
+
var dataObject = renderDataObject(parentGfx, element, attrs);
|
|
1461
|
+
|
|
1462
|
+
drawPath(parentGfx, arrowPathData, {
|
|
1463
|
+
fill: 'none',
|
|
1464
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1465
|
+
strokeWidth: 1
|
|
1466
|
+
});
|
|
1467
|
+
|
|
1468
|
+
return dataObject;
|
|
1469
|
+
},
|
|
1470
|
+
'bpmn:DataInputAssociation': function(parentGfx, element, attrs = {}) {
|
|
1471
|
+
attrs = pickAttrs(attrs, [
|
|
1472
|
+
'fill',
|
|
1473
|
+
'stroke'
|
|
1474
|
+
]);
|
|
1475
|
+
|
|
1476
|
+
return renderAssociation(parentGfx, element, {
|
|
1477
|
+
...attrs,
|
|
1478
|
+
markerEnd: marker(parentGfx, 'association-end', getFillColor(element, defaultFillColor, attrs.fill), getStrokeColor(element, defaultStrokeColor, attrs.stroke))
|
|
1479
|
+
});
|
|
1480
|
+
},
|
|
1481
|
+
'bpmn:DataObject': function(parentGfx, element, attrs = {}) {
|
|
1482
|
+
attrs = pickAttrs(attrs, [
|
|
1483
|
+
'fill',
|
|
1484
|
+
'stroke'
|
|
1485
|
+
]);
|
|
1486
|
+
|
|
1487
|
+
return renderDataObject(parentGfx, element, attrs);
|
|
1488
|
+
},
|
|
1489
|
+
'bpmn:DataObjectReference': as('bpmn:DataObject'),
|
|
1490
|
+
'bpmn:DataOutput': function(parentGfx, element, attrs = {}) {
|
|
1491
|
+
attrs = pickAttrs(attrs, [
|
|
1492
|
+
'fill',
|
|
1493
|
+
'stroke'
|
|
1494
|
+
]);
|
|
1495
|
+
|
|
1496
|
+
var arrowPathData = pathMap.getRawPath('DATA_ARROW');
|
|
1497
|
+
|
|
1498
|
+
var dataObject = renderDataObject(parentGfx, element, attrs);
|
|
1499
|
+
|
|
1500
|
+
drawPath(parentGfx, arrowPathData, {
|
|
1501
|
+
strokeWidth: 1,
|
|
1502
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
1503
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
1504
|
+
});
|
|
1505
|
+
|
|
1506
|
+
return dataObject;
|
|
1507
|
+
},
|
|
1508
|
+
'bpmn:DataOutputAssociation': function(parentGfx, element, attrs = {}) {
|
|
1509
|
+
attrs = pickAttrs(attrs, [
|
|
1510
|
+
'fill',
|
|
1511
|
+
'stroke'
|
|
1512
|
+
]);
|
|
1513
|
+
|
|
1514
|
+
return renderAssociation(parentGfx, element, {
|
|
1515
|
+
...attrs,
|
|
1516
|
+
markerEnd: marker(parentGfx, 'association-end', getFillColor(element, defaultFillColor, attrs.fill), getStrokeColor(element, defaultStrokeColor, attrs.stroke))
|
|
1517
|
+
});
|
|
1518
|
+
},
|
|
1519
|
+
'bpmn:DataStoreReference': function(parentGfx, element, attrs = {}) {
|
|
1520
|
+
attrs = pickAttrs(attrs, [
|
|
1521
|
+
'fill',
|
|
1522
|
+
'stroke'
|
|
1523
|
+
]);
|
|
1524
|
+
|
|
1525
|
+
var dataStorePath = pathMap.getScaledPath('DATA_STORE', {
|
|
1526
|
+
xScaleFactor: 1,
|
|
1527
|
+
yScaleFactor: 1,
|
|
1528
|
+
containerWidth: element.width,
|
|
1529
|
+
containerHeight: element.height,
|
|
1530
|
+
position: {
|
|
1531
|
+
mx: 0,
|
|
1532
|
+
my: 0.133
|
|
1533
|
+
}
|
|
1534
|
+
});
|
|
1535
|
+
|
|
1536
|
+
return drawPath(parentGfx, dataStorePath, {
|
|
1537
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
1538
|
+
fillOpacity: DEFAULT_OPACITY,
|
|
1539
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1540
|
+
strokeWidth: 2
|
|
1541
|
+
});
|
|
1542
|
+
},
|
|
1543
|
+
'bpmn:EndEvent': function(parentGfx, element, attrs = {}) {
|
|
1544
|
+
var { renderIcon = true } = attrs;
|
|
1545
|
+
|
|
1546
|
+
attrs = pickAttrs(attrs, [
|
|
1547
|
+
'fill',
|
|
1548
|
+
'stroke'
|
|
1549
|
+
]);
|
|
1550
|
+
|
|
1551
|
+
var event = renderEvent(parentGfx, element, {
|
|
1552
|
+
...attrs,
|
|
1553
|
+
strokeWidth: 4
|
|
1554
|
+
});
|
|
1555
|
+
|
|
1556
|
+
if (renderIcon) {
|
|
1557
|
+
renderEventIcon(element, parentGfx, attrs);
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
return event;
|
|
1561
|
+
},
|
|
1562
|
+
'bpmn:EventBasedGateway': function(parentGfx, element, attrs = {}) {
|
|
1563
|
+
attrs = pickAttrs(attrs, [
|
|
1564
|
+
'fill',
|
|
1565
|
+
'stroke'
|
|
1566
|
+
]);
|
|
1567
|
+
|
|
1568
|
+
var semantic = getSemantic(element);
|
|
1569
|
+
|
|
1570
|
+
var diamond = renderGateway(parentGfx, element, attrs);
|
|
1571
|
+
|
|
1572
|
+
drawCircle(parentGfx, element.width, element.height, element.height * 0.20, {
|
|
1573
|
+
fill: getFillColor(element, 'none', attrs.fill),
|
|
1574
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1575
|
+
strokeWidth: 1
|
|
1576
|
+
});
|
|
1577
|
+
|
|
1578
|
+
var type = semantic.get('eventGatewayType'),
|
|
1579
|
+
instantiate = !!semantic.get('instantiate');
|
|
1580
|
+
|
|
1581
|
+
function drawEvent() {
|
|
1582
|
+
|
|
1583
|
+
var pathData = pathMap.getScaledPath('GATEWAY_EVENT_BASED', {
|
|
1584
|
+
xScaleFactor: 0.18,
|
|
1585
|
+
yScaleFactor: 0.18,
|
|
1586
|
+
containerWidth: element.width,
|
|
1587
|
+
containerHeight: element.height,
|
|
1588
|
+
position: {
|
|
1589
|
+
mx: 0.36,
|
|
1590
|
+
my: 0.44
|
|
1591
|
+
}
|
|
1592
|
+
});
|
|
1593
|
+
|
|
1594
|
+
drawPath(parentGfx, pathData, {
|
|
1595
|
+
fill: 'none',
|
|
1596
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1597
|
+
strokeWidth: 2
|
|
1598
|
+
});
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
if (type === 'Parallel') {
|
|
1602
|
+
var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {
|
|
1603
|
+
xScaleFactor: 0.4,
|
|
1604
|
+
yScaleFactor: 0.4,
|
|
1605
|
+
containerWidth: element.width,
|
|
1606
|
+
containerHeight: element.height,
|
|
1607
|
+
position: {
|
|
1608
|
+
mx: 0.474,
|
|
1609
|
+
my: 0.296
|
|
1610
|
+
}
|
|
1611
|
+
});
|
|
1612
|
+
|
|
1613
|
+
drawPath(parentGfx, pathData, {
|
|
1614
|
+
fill: 'none',
|
|
1615
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1616
|
+
strokeWidth: 1
|
|
1617
|
+
});
|
|
1618
|
+
} else if (type === 'Exclusive') {
|
|
1619
|
+
if (!instantiate) {
|
|
1620
|
+
drawCircle(parentGfx, element.width, element.height, element.height * 0.26, {
|
|
1621
|
+
fill: 'none',
|
|
1622
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1623
|
+
strokeWidth: 1
|
|
1624
|
+
});
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
drawEvent();
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
|
|
1631
|
+
return diamond;
|
|
1632
|
+
},
|
|
1633
|
+
'bpmn:ExclusiveGateway': function(parentGfx, element, attrs = {}) {
|
|
1634
|
+
attrs = pickAttrs(attrs, [
|
|
1635
|
+
'fill',
|
|
1636
|
+
'stroke'
|
|
1637
|
+
]);
|
|
1638
|
+
|
|
1639
|
+
var gateway = renderGateway(parentGfx, element, attrs);
|
|
1640
|
+
|
|
1641
|
+
var pathData = pathMap.getScaledPath('GATEWAY_EXCLUSIVE', {
|
|
1642
|
+
xScaleFactor: 0.4,
|
|
1643
|
+
yScaleFactor: 0.4,
|
|
1644
|
+
containerWidth: element.width,
|
|
1645
|
+
containerHeight: element.height,
|
|
1646
|
+
position: {
|
|
1647
|
+
mx: 0.32,
|
|
1648
|
+
my: 0.3
|
|
1649
|
+
}
|
|
1650
|
+
});
|
|
1651
|
+
|
|
1652
|
+
var di = getDi(element);
|
|
1653
|
+
|
|
1654
|
+
if (di.get('isMarkerVisible')) {
|
|
1655
|
+
drawPath(parentGfx, pathData, {
|
|
1656
|
+
fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1657
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1658
|
+
strokeWidth: 1
|
|
1659
|
+
});
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
return gateway;
|
|
1663
|
+
},
|
|
1664
|
+
'bpmn:Gateway': function(parentGfx, element, attrs = {}) {
|
|
1665
|
+
attrs = pickAttrs(attrs, [
|
|
1666
|
+
'fill',
|
|
1667
|
+
'stroke'
|
|
1668
|
+
]);
|
|
1669
|
+
|
|
1670
|
+
return renderGateway(parentGfx, element, attrs);
|
|
1671
|
+
},
|
|
1672
|
+
'bpmn:Group': function(parentGfx, element, attrs = {}) {
|
|
1673
|
+
attrs = pickAttrs(attrs, [
|
|
1674
|
+
'fill',
|
|
1675
|
+
'stroke',
|
|
1676
|
+
'width',
|
|
1677
|
+
'height'
|
|
1678
|
+
]);
|
|
1679
|
+
|
|
1680
|
+
return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, {
|
|
1681
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1682
|
+
strokeWidth: 1.5,
|
|
1683
|
+
strokeDasharray: '10, 6, 0, 6',
|
|
1684
|
+
fill: 'none',
|
|
1685
|
+
pointerEvents: 'none',
|
|
1686
|
+
width: getWidth(element, attrs),
|
|
1687
|
+
height: getHeight(element, attrs)
|
|
1688
|
+
});
|
|
1689
|
+
},
|
|
1690
|
+
'bpmn:InclusiveGateway': function(parentGfx, element, attrs = {}) {
|
|
1691
|
+
attrs = pickAttrs(attrs, [
|
|
1692
|
+
'fill',
|
|
1693
|
+
'stroke'
|
|
1694
|
+
]);
|
|
1695
|
+
|
|
1696
|
+
var gateway = renderGateway(parentGfx, element, attrs);
|
|
1697
|
+
|
|
1698
|
+
drawCircle(parentGfx, element.width, element.height, element.height * 0.24, {
|
|
1699
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
1700
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1701
|
+
strokeWidth: 2.5
|
|
1702
|
+
});
|
|
1703
|
+
|
|
1704
|
+
return gateway;
|
|
1705
|
+
},
|
|
1706
|
+
'bpmn:IntermediateEvent': function(parentGfx, element, attrs = {}) {
|
|
1707
|
+
var { renderIcon = true } = attrs;
|
|
1708
|
+
|
|
1709
|
+
attrs = pickAttrs(attrs, [
|
|
1710
|
+
'fill',
|
|
1711
|
+
'stroke'
|
|
1712
|
+
]);
|
|
1713
|
+
|
|
1714
|
+
var outer = renderEvent(parentGfx, element, {
|
|
1715
|
+
...attrs,
|
|
1716
|
+
strokeWidth: 1.5
|
|
1717
|
+
});
|
|
1718
|
+
|
|
1719
|
+
drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
|
|
1720
|
+
fill: 'none',
|
|
1721
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1722
|
+
strokeWidth: 1.5
|
|
1723
|
+
});
|
|
1724
|
+
|
|
1725
|
+
if (renderIcon) {
|
|
1726
|
+
renderEventIcon(element, parentGfx, attrs);
|
|
1727
|
+
}
|
|
1728
|
+
|
|
1729
|
+
return outer;
|
|
1730
|
+
},
|
|
1731
|
+
'bpmn:IntermediateCatchEvent': as('bpmn:IntermediateEvent'),
|
|
1732
|
+
'bpmn:IntermediateThrowEvent': as('bpmn:IntermediateEvent'),
|
|
1733
|
+
'bpmn:Lane': function(parentGfx, element, attrs = {}) {
|
|
1734
|
+
attrs = pickAttrs(attrs, [
|
|
1735
|
+
'fill',
|
|
1736
|
+
'stroke',
|
|
1737
|
+
'width',
|
|
1738
|
+
'height'
|
|
1739
|
+
]);
|
|
1740
|
+
|
|
1741
|
+
return renderLane(parentGfx, element, {
|
|
1742
|
+
...attrs,
|
|
1743
|
+
fillOpacity: LOW_OPACITY
|
|
1744
|
+
});
|
|
1745
|
+
},
|
|
1746
|
+
'bpmn:ManualTask': function(parentGfx, element, attrs = {}) {
|
|
1747
|
+
attrs = pickAttrs(attrs, [
|
|
1748
|
+
'fill',
|
|
1749
|
+
'stroke'
|
|
1750
|
+
]);
|
|
1751
|
+
|
|
1752
|
+
var task = renderTask(parentGfx, element, attrs);
|
|
1753
|
+
|
|
1754
|
+
var pathData = pathMap.getScaledPath('TASK_TYPE_MANUAL', {
|
|
1755
|
+
abspos: {
|
|
1756
|
+
x: 17,
|
|
1757
|
+
y: 15
|
|
1758
|
+
}
|
|
1759
|
+
});
|
|
1760
|
+
|
|
1761
|
+
drawPath(parentGfx, pathData, {
|
|
1762
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
1763
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1764
|
+
strokeWidth: 0.5
|
|
1765
|
+
});
|
|
1766
|
+
|
|
1767
|
+
return task;
|
|
1768
|
+
},
|
|
1769
|
+
'bpmn:MessageFlow': function(parentGfx, element, attrs = {}) {
|
|
1770
|
+
attrs = pickAttrs(attrs, [
|
|
1771
|
+
'fill',
|
|
1772
|
+
'stroke'
|
|
1773
|
+
]);
|
|
1774
|
+
|
|
1775
|
+
var semantic = getSemantic(element),
|
|
1776
|
+
di = getDi(element);
|
|
1777
|
+
|
|
1778
|
+
var fill = getFillColor(element, defaultFillColor, attrs.fill),
|
|
1779
|
+
stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
|
|
1780
|
+
|
|
1781
|
+
var path = drawConnectionSegments(parentGfx, element.waypoints, {
|
|
1782
|
+
markerEnd: marker(parentGfx, 'messageflow-end', fill, stroke),
|
|
1783
|
+
markerStart: marker(parentGfx, 'messageflow-start', fill, stroke),
|
|
1784
|
+
stroke,
|
|
1785
|
+
strokeDasharray: '10, 11',
|
|
1786
|
+
strokeWidth: 1.5
|
|
1787
|
+
});
|
|
1788
|
+
|
|
1789
|
+
if (semantic.get('messageRef')) {
|
|
1790
|
+
var midPoint = path.getPointAtLength(path.getTotalLength() / 2);
|
|
1791
|
+
|
|
1792
|
+
var markerPathData = pathMap.getScaledPath('MESSAGE_FLOW_MARKER', {
|
|
1793
|
+
abspos: {
|
|
1794
|
+
x: midPoint.x,
|
|
1795
|
+
y: midPoint.y
|
|
1796
|
+
}
|
|
1797
|
+
});
|
|
1798
|
+
|
|
1799
|
+
var messageAttrs = {
|
|
1800
|
+
strokeWidth: 1
|
|
1801
|
+
};
|
|
1802
|
+
|
|
1803
|
+
if (di.get('messageVisibleKind') === 'initiating') {
|
|
1804
|
+
messageAttrs.fill = fill;
|
|
1805
|
+
messageAttrs.stroke = stroke;
|
|
1806
|
+
} else {
|
|
1807
|
+
messageAttrs.fill = stroke;
|
|
1808
|
+
messageAttrs.stroke = fill;
|
|
1809
|
+
}
|
|
1810
|
+
|
|
1811
|
+
var message = drawPath(parentGfx, markerPathData, messageAttrs);
|
|
1812
|
+
|
|
1813
|
+
var messageRef = semantic.get('messageRef'),
|
|
1814
|
+
name = messageRef.get('name');
|
|
1815
|
+
|
|
1816
|
+
var label = renderLabel(parentGfx, name, {
|
|
1817
|
+
align: 'center-top',
|
|
1818
|
+
fitBox: true,
|
|
1819
|
+
style: {
|
|
1820
|
+
fill: stroke
|
|
1821
|
+
}
|
|
1822
|
+
});
|
|
1823
|
+
|
|
1824
|
+
var messageBounds = message.getBBox(),
|
|
1825
|
+
labelBounds = label.getBBox();
|
|
1826
|
+
|
|
1827
|
+
var translateX = midPoint.x - labelBounds.width / 2,
|
|
1828
|
+
translateY = midPoint.y + messageBounds.height / 2 + ELEMENT_LABEL_DISTANCE;
|
|
1829
|
+
|
|
1830
|
+
transform(label, translateX, translateY, 0);
|
|
1831
|
+
}
|
|
1832
|
+
|
|
1833
|
+
return path;
|
|
1834
|
+
},
|
|
1835
|
+
'bpmn:ParallelGateway': function(parentGfx, element, attrs = {}) {
|
|
1836
|
+
attrs = pickAttrs(attrs, [
|
|
1837
|
+
'fill',
|
|
1838
|
+
'stroke'
|
|
1839
|
+
]);
|
|
1840
|
+
|
|
1841
|
+
var diamond = renderGateway(parentGfx, element, attrs);
|
|
1842
|
+
|
|
1843
|
+
var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {
|
|
1844
|
+
xScaleFactor: 0.6,
|
|
1845
|
+
yScaleFactor: 0.6,
|
|
1846
|
+
containerWidth: element.width,
|
|
1847
|
+
containerHeight: element.height,
|
|
1848
|
+
position: {
|
|
1849
|
+
mx: 0.46,
|
|
1850
|
+
my: 0.2
|
|
1851
|
+
}
|
|
1852
|
+
});
|
|
1853
|
+
|
|
1854
|
+
drawPath(parentGfx, pathData, {
|
|
1855
|
+
fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1856
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1857
|
+
strokeWidth: 1
|
|
1858
|
+
});
|
|
1859
|
+
|
|
1860
|
+
return diamond;
|
|
1861
|
+
},
|
|
1862
|
+
'bpmn:Participant': function(parentGfx, element, attrs = {}) {
|
|
1863
|
+
attrs = pickAttrs(attrs, [
|
|
1864
|
+
'fill',
|
|
1865
|
+
'stroke',
|
|
1866
|
+
'width',
|
|
1867
|
+
'height'
|
|
1868
|
+
]);
|
|
1869
|
+
|
|
1870
|
+
var participant = renderLane(parentGfx, element, attrs);
|
|
1871
|
+
|
|
1872
|
+
var expandedParticipant = isExpanded(element);
|
|
1873
|
+
var horizontalParticipant = isHorizontal(element);
|
|
1874
|
+
|
|
1875
|
+
var semantic = getSemantic(element),
|
|
1876
|
+
name = semantic.get('name');
|
|
1877
|
+
|
|
1878
|
+
if (expandedParticipant) {
|
|
1879
|
+
var waypoints = horizontalParticipant ? [
|
|
1880
|
+
{
|
|
1881
|
+
x: 30,
|
|
1882
|
+
y: 0
|
|
1883
|
+
},
|
|
1884
|
+
{
|
|
1885
|
+
x: 30,
|
|
1886
|
+
y: getHeight(element, attrs)
|
|
1887
|
+
}
|
|
1888
|
+
] : [
|
|
1889
|
+
{
|
|
1890
|
+
x: 0,
|
|
1891
|
+
y: 30
|
|
1892
|
+
},
|
|
1893
|
+
{
|
|
1894
|
+
x: getWidth(element, attrs),
|
|
1895
|
+
y: 30
|
|
1896
|
+
}
|
|
1897
|
+
];
|
|
1898
|
+
|
|
1899
|
+
drawLine(parentGfx, waypoints, {
|
|
1900
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1901
|
+
strokeWidth: PARTICIPANT_STROKE_WIDTH
|
|
1902
|
+
});
|
|
1903
|
+
|
|
1904
|
+
renderLaneLabel(parentGfx, name, element, attrs);
|
|
1905
|
+
} else {
|
|
1906
|
+
var bounds = getBounds(element, attrs);
|
|
1907
|
+
|
|
1908
|
+
if (!horizontalParticipant) {
|
|
1909
|
+
bounds.height = getWidth(element, attrs);
|
|
1910
|
+
bounds.width = getHeight(element, attrs);
|
|
1911
|
+
}
|
|
1912
|
+
|
|
1913
|
+
var textBox = renderLabel(parentGfx, name, {
|
|
1914
|
+
box: bounds,
|
|
1915
|
+
align: 'center-middle',
|
|
1916
|
+
style: {
|
|
1917
|
+
fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
|
|
1918
|
+
}
|
|
1919
|
+
});
|
|
1920
|
+
|
|
1921
|
+
if (!horizontalParticipant) {
|
|
1922
|
+
var top = -1 * getHeight(element, attrs);
|
|
1923
|
+
transform(textBox, 0, -top, 270);
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1927
|
+
if (semantic.get('participantMultiplicity')) {
|
|
1928
|
+
renderTaskMarker('ParticipantMultiplicityMarker', parentGfx, element, attrs);
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
return participant;
|
|
1932
|
+
},
|
|
1933
|
+
'bpmn:ReceiveTask' : function(parentGfx, element, attrs = {}) {
|
|
1934
|
+
attrs = pickAttrs(attrs, [
|
|
1935
|
+
'fill',
|
|
1936
|
+
'stroke'
|
|
1937
|
+
]);
|
|
1938
|
+
|
|
1939
|
+
var semantic = getSemantic(element);
|
|
1940
|
+
|
|
1941
|
+
var task = renderTask(parentGfx, element, attrs);
|
|
1942
|
+
|
|
1943
|
+
var pathData;
|
|
1944
|
+
|
|
1945
|
+
if (semantic.get('instantiate')) {
|
|
1946
|
+
drawCircle(parentGfx, 28, 28, 20 * 0.22, {
|
|
1947
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
1948
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1949
|
+
strokeWidth: 1
|
|
1950
|
+
});
|
|
1951
|
+
|
|
1952
|
+
pathData = pathMap.getScaledPath('TASK_TYPE_INSTANTIATING_SEND', {
|
|
1953
|
+
abspos: {
|
|
1954
|
+
x: 7.77,
|
|
1955
|
+
y: 9.52
|
|
1956
|
+
}
|
|
1957
|
+
});
|
|
1958
|
+
} else {
|
|
1959
|
+
pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
|
|
1960
|
+
xScaleFactor: 0.9,
|
|
1961
|
+
yScaleFactor: 0.9,
|
|
1962
|
+
containerWidth: 21,
|
|
1963
|
+
containerHeight: 14,
|
|
1964
|
+
position: {
|
|
1965
|
+
mx: 0.3,
|
|
1966
|
+
my: 0.4
|
|
1967
|
+
}
|
|
1968
|
+
});
|
|
1969
|
+
}
|
|
1970
|
+
|
|
1971
|
+
drawPath(parentGfx, pathData, {
|
|
1972
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
1973
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1974
|
+
strokeWidth: 1
|
|
1975
|
+
});
|
|
1976
|
+
|
|
1977
|
+
return task;
|
|
1978
|
+
},
|
|
1979
|
+
'bpmn:ScriptTask': function(parentGfx, element, attrs = {}) {
|
|
1980
|
+
attrs = pickAttrs(attrs, [
|
|
1981
|
+
'fill',
|
|
1982
|
+
'stroke'
|
|
1983
|
+
]);
|
|
1984
|
+
|
|
1985
|
+
var task = renderTask(parentGfx, element, attrs);
|
|
1986
|
+
|
|
1987
|
+
var pathData = pathMap.getScaledPath('TASK_TYPE_SCRIPT', {
|
|
1988
|
+
abspos: {
|
|
1989
|
+
x: 15,
|
|
1990
|
+
y: 20
|
|
1991
|
+
}
|
|
1992
|
+
});
|
|
1993
|
+
|
|
1994
|
+
drawPath(parentGfx, pathData, {
|
|
1995
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
1996
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1997
|
+
strokeWidth: 1
|
|
1998
|
+
});
|
|
1999
|
+
|
|
2000
|
+
return task;
|
|
2001
|
+
},
|
|
2002
|
+
'bpmn:SendTask': function(parentGfx, element, attrs = {}) {
|
|
2003
|
+
attrs = pickAttrs(attrs, [
|
|
2004
|
+
'fill',
|
|
2005
|
+
'stroke'
|
|
2006
|
+
]);
|
|
2007
|
+
|
|
2008
|
+
var task = renderTask(parentGfx, element, attrs);
|
|
2009
|
+
|
|
2010
|
+
var pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
|
|
2011
|
+
xScaleFactor: 1,
|
|
2012
|
+
yScaleFactor: 1,
|
|
2013
|
+
containerWidth: 21,
|
|
2014
|
+
containerHeight: 14,
|
|
2015
|
+
position: {
|
|
2016
|
+
mx: 0.285,
|
|
2017
|
+
my: 0.357
|
|
2018
|
+
}
|
|
2019
|
+
});
|
|
2020
|
+
|
|
2021
|
+
drawPath(parentGfx, pathData, {
|
|
2022
|
+
fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
2023
|
+
stroke: getFillColor(element, defaultFillColor, attrs.fill),
|
|
2024
|
+
strokeWidth: 1
|
|
2025
|
+
});
|
|
2026
|
+
|
|
2027
|
+
return task;
|
|
2028
|
+
},
|
|
2029
|
+
'bpmn:SequenceFlow': function(parentGfx, element, attrs = {}) {
|
|
2030
|
+
attrs = pickAttrs(attrs, [
|
|
2031
|
+
'fill',
|
|
2032
|
+
'stroke'
|
|
2033
|
+
]);
|
|
2034
|
+
|
|
2035
|
+
var fill = getFillColor(element, defaultFillColor, attrs.fill),
|
|
2036
|
+
stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
|
|
2037
|
+
|
|
2038
|
+
var connection = drawConnectionSegments(parentGfx, element.waypoints, {
|
|
2039
|
+
markerEnd: marker(parentGfx, 'sequenceflow-end', fill, stroke),
|
|
2040
|
+
stroke
|
|
2041
|
+
});
|
|
2042
|
+
|
|
2043
|
+
var semantic = getSemantic(element);
|
|
2044
|
+
|
|
2045
|
+
var { source } = element;
|
|
2046
|
+
|
|
2047
|
+
if (source) {
|
|
2048
|
+
var sourceSemantic = getSemantic(source);
|
|
2049
|
+
|
|
2050
|
+
// conditional flow marker
|
|
2051
|
+
if (semantic.get('conditionExpression') && is(sourceSemantic, 'bpmn:Activity')) {
|
|
2052
|
+
svgAttr(connection, {
|
|
2053
|
+
markerStart: marker(parentGfx, 'conditional-flow-marker', fill, stroke)
|
|
2054
|
+
});
|
|
2055
|
+
}
|
|
2056
|
+
|
|
2057
|
+
// default marker
|
|
2058
|
+
if (sourceSemantic.get('default') && (is(sourceSemantic, 'bpmn:Gateway') || is(sourceSemantic, 'bpmn:Activity')) &&
|
|
2059
|
+
sourceSemantic.get('default') === semantic) {
|
|
2060
|
+
svgAttr(connection, {
|
|
2061
|
+
markerStart: marker(parentGfx, 'conditional-default-flow-marker', fill, stroke)
|
|
2062
|
+
});
|
|
2063
|
+
}
|
|
2064
|
+
}
|
|
2065
|
+
|
|
2066
|
+
return connection;
|
|
2067
|
+
},
|
|
2068
|
+
'bpmn:ServiceTask': function(parentGfx, element, attrs = {}) {
|
|
2069
|
+
attrs = pickAttrs(attrs, [
|
|
2070
|
+
'fill',
|
|
2071
|
+
'stroke'
|
|
2072
|
+
]);
|
|
2073
|
+
|
|
2074
|
+
var task = renderTask(parentGfx, element, attrs);
|
|
2075
|
+
|
|
2076
|
+
drawCircle(parentGfx, 10, 10, {
|
|
2077
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
2078
|
+
stroke: 'none',
|
|
2079
|
+
transform: 'translate(6, 6)'
|
|
2080
|
+
});
|
|
2081
|
+
|
|
2082
|
+
var pathDataService1 = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
|
|
2083
|
+
abspos: {
|
|
2084
|
+
x: 12,
|
|
2085
|
+
y: 18
|
|
2086
|
+
}
|
|
2087
|
+
});
|
|
2088
|
+
|
|
2089
|
+
drawPath(parentGfx, pathDataService1, {
|
|
2090
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
2091
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
2092
|
+
strokeWidth: 1
|
|
2093
|
+
});
|
|
2094
|
+
|
|
2095
|
+
drawCircle(parentGfx, 10, 10, {
|
|
2096
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
2097
|
+
stroke: 'none',
|
|
2098
|
+
transform: 'translate(11, 10)'
|
|
2099
|
+
});
|
|
2100
|
+
|
|
2101
|
+
var pathDataService2 = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
|
|
2102
|
+
abspos: {
|
|
2103
|
+
x: 17,
|
|
2104
|
+
y: 22
|
|
2105
|
+
}
|
|
2106
|
+
});
|
|
2107
|
+
|
|
2108
|
+
drawPath(parentGfx, pathDataService2, {
|
|
2109
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
2110
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
2111
|
+
strokeWidth: 1
|
|
2112
|
+
});
|
|
2113
|
+
|
|
2114
|
+
return task;
|
|
2115
|
+
},
|
|
2116
|
+
'bpmn:StartEvent': function(parentGfx, element, attrs = {}) {
|
|
2117
|
+
var { renderIcon = true } = attrs;
|
|
2118
|
+
|
|
2119
|
+
attrs = pickAttrs(attrs, [
|
|
2120
|
+
'fill',
|
|
2121
|
+
'stroke'
|
|
2122
|
+
]);
|
|
2123
|
+
|
|
2124
|
+
var semantic = getSemantic(element);
|
|
2125
|
+
|
|
2126
|
+
if (!semantic.get('isInterrupting')) {
|
|
2127
|
+
attrs = {
|
|
2128
|
+
...attrs,
|
|
2129
|
+
strokeDasharray: '6'
|
|
2130
|
+
};
|
|
2131
|
+
}
|
|
2132
|
+
|
|
2133
|
+
var event = renderEvent(parentGfx, element, attrs);
|
|
2134
|
+
|
|
2135
|
+
if (renderIcon) {
|
|
2136
|
+
renderEventIcon(element, parentGfx, attrs);
|
|
2137
|
+
}
|
|
2138
|
+
|
|
2139
|
+
return event;
|
|
2140
|
+
},
|
|
2141
|
+
'bpmn:SubProcess': function(parentGfx, element, attrs = {}) {
|
|
2142
|
+
if (isExpanded(element)) {
|
|
2143
|
+
attrs = pickAttrs(attrs, [
|
|
2144
|
+
'fill',
|
|
2145
|
+
'stroke',
|
|
2146
|
+
'width',
|
|
2147
|
+
'height'
|
|
2148
|
+
]);
|
|
2149
|
+
} else {
|
|
2150
|
+
attrs = pickAttrs(attrs, [
|
|
2151
|
+
'fill',
|
|
2152
|
+
'stroke'
|
|
2153
|
+
]);
|
|
2154
|
+
}
|
|
2155
|
+
|
|
2156
|
+
return renderSubProcess(parentGfx, element, attrs);
|
|
2157
|
+
},
|
|
2158
|
+
'bpmn:Task': function(parentGfx, element, attrs = {}) {
|
|
2159
|
+
attrs = pickAttrs(attrs, [
|
|
2160
|
+
'fill',
|
|
2161
|
+
'stroke'
|
|
2162
|
+
]);
|
|
2163
|
+
|
|
2164
|
+
return renderTask(parentGfx, element, attrs);
|
|
2165
|
+
},
|
|
2166
|
+
'bpmn:TextAnnotation': function(parentGfx, element, attrs = {}) {
|
|
2167
|
+
attrs = pickAttrs(attrs, [
|
|
2168
|
+
'fill',
|
|
2169
|
+
'stroke',
|
|
2170
|
+
'width',
|
|
2171
|
+
'height'
|
|
2172
|
+
]);
|
|
2173
|
+
|
|
2174
|
+
var {
|
|
2175
|
+
width,
|
|
2176
|
+
height
|
|
2177
|
+
} = getBounds(element, attrs);
|
|
2178
|
+
|
|
2179
|
+
var textElement = drawRect(parentGfx, width, height, 0, 0, {
|
|
2180
|
+
fill: 'none',
|
|
2181
|
+
stroke: 'none'
|
|
2182
|
+
});
|
|
2183
|
+
|
|
2184
|
+
var textPathData = pathMap.getScaledPath('TEXT_ANNOTATION', {
|
|
2185
|
+
xScaleFactor: 1,
|
|
2186
|
+
yScaleFactor: 1,
|
|
2187
|
+
containerWidth: width,
|
|
2188
|
+
containerHeight: height,
|
|
2189
|
+
position: {
|
|
2190
|
+
mx: 0.0,
|
|
2191
|
+
my: 0.0
|
|
2192
|
+
}
|
|
2193
|
+
});
|
|
2194
|
+
|
|
2195
|
+
drawPath(parentGfx, textPathData, {
|
|
2196
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
2197
|
+
});
|
|
2198
|
+
|
|
2199
|
+
var semantic = getSemantic(element),
|
|
2200
|
+
text = semantic.get('text') || '';
|
|
2201
|
+
|
|
2202
|
+
renderLabel(parentGfx, text, {
|
|
2203
|
+
align: 'left-top',
|
|
2204
|
+
box: getBounds(element, attrs),
|
|
2205
|
+
padding: 7,
|
|
2206
|
+
style: {
|
|
2207
|
+
fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
|
|
2208
|
+
}
|
|
2209
|
+
});
|
|
2210
|
+
|
|
2211
|
+
return textElement;
|
|
2212
|
+
},
|
|
2213
|
+
'bpmn:Transaction': function(parentGfx, element, attrs = {}) {
|
|
2214
|
+
if (isExpanded(element)) {
|
|
2215
|
+
attrs = pickAttrs(attrs, [
|
|
2216
|
+
'fill',
|
|
2217
|
+
'stroke',
|
|
2218
|
+
'width',
|
|
2219
|
+
'height'
|
|
2220
|
+
]);
|
|
2221
|
+
} else {
|
|
2222
|
+
attrs = pickAttrs(attrs, [
|
|
2223
|
+
'fill',
|
|
2224
|
+
'stroke'
|
|
2225
|
+
]);
|
|
2226
|
+
}
|
|
2227
|
+
|
|
2228
|
+
var outer = renderSubProcess(parentGfx, element, {
|
|
2229
|
+
strokeWidth: 1.5,
|
|
2230
|
+
...attrs
|
|
2231
|
+
});
|
|
2232
|
+
|
|
2233
|
+
var innerAttrs = styles.style([ 'no-fill', 'no-events' ], {
|
|
2234
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
2235
|
+
strokeWidth: 1.5
|
|
2236
|
+
});
|
|
2237
|
+
|
|
2238
|
+
var expanded = isExpanded(element);
|
|
2239
|
+
|
|
2240
|
+
if (!expanded) {
|
|
2241
|
+
attrs = {};
|
|
2242
|
+
}
|
|
2243
|
+
|
|
2244
|
+
drawRect(
|
|
2245
|
+
parentGfx,
|
|
2246
|
+
getWidth(element, attrs),
|
|
2247
|
+
getHeight(element, attrs),
|
|
2248
|
+
TASK_BORDER_RADIUS - INNER_OUTER_DIST,
|
|
2249
|
+
INNER_OUTER_DIST,
|
|
2250
|
+
innerAttrs
|
|
2251
|
+
);
|
|
2252
|
+
|
|
2253
|
+
return outer;
|
|
2254
|
+
},
|
|
2255
|
+
'bpmn:UserTask': function(parentGfx, element, attrs = {}) {
|
|
2256
|
+
attrs = pickAttrs(attrs, [
|
|
2257
|
+
'fill',
|
|
2258
|
+
'stroke'
|
|
2259
|
+
]);
|
|
2260
|
+
|
|
2261
|
+
var task = renderTask(parentGfx, element, attrs);
|
|
2262
|
+
|
|
2263
|
+
var x = 15;
|
|
2264
|
+
var y = 12;
|
|
2265
|
+
|
|
2266
|
+
var pathDataUser1 = pathMap.getScaledPath('TASK_TYPE_USER_1', {
|
|
2267
|
+
abspos: {
|
|
2268
|
+
x: x,
|
|
2269
|
+
y: y
|
|
2270
|
+
}
|
|
2271
|
+
});
|
|
2272
|
+
|
|
2273
|
+
drawPath(parentGfx, pathDataUser1, {
|
|
2274
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
2275
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
2276
|
+
strokeWidth: 0.5
|
|
2277
|
+
});
|
|
2278
|
+
|
|
2279
|
+
var pathDataUser2 = pathMap.getScaledPath('TASK_TYPE_USER_2', {
|
|
2280
|
+
abspos: {
|
|
2281
|
+
x: x,
|
|
2282
|
+
y: y
|
|
2283
|
+
}
|
|
2284
|
+
});
|
|
2285
|
+
|
|
2286
|
+
drawPath(parentGfx, pathDataUser2, {
|
|
2287
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
2288
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
2289
|
+
strokeWidth: 0.5
|
|
2290
|
+
});
|
|
2291
|
+
|
|
2292
|
+
var pathDataUser3 = pathMap.getScaledPath('TASK_TYPE_USER_3', {
|
|
2293
|
+
abspos: {
|
|
2294
|
+
x: x,
|
|
2295
|
+
y: y
|
|
2296
|
+
}
|
|
2297
|
+
});
|
|
2298
|
+
|
|
2299
|
+
drawPath(parentGfx, pathDataUser3, {
|
|
2300
|
+
fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
2301
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
2302
|
+
strokeWidth: 0.5
|
|
2303
|
+
});
|
|
2304
|
+
|
|
2305
|
+
return task;
|
|
2306
|
+
},
|
|
2307
|
+
'label': function(parentGfx, element, attrs = {}) {
|
|
2308
|
+
return renderExternalLabel(parentGfx, element, attrs);
|
|
2309
|
+
}
|
|
2310
|
+
};
|
|
2311
|
+
|
|
2312
|
+
// extension API, use at your own risk
|
|
2313
|
+
this._drawPath = drawPath;
|
|
2314
|
+
|
|
2315
|
+
this._renderer = renderer;
|
|
2316
|
+
}
|
|
2317
|
+
|
|
2318
|
+
|
|
2319
|
+
inherits(BpmnRenderer, BaseRenderer);
|
|
2320
|
+
|
|
2321
|
+
BpmnRenderer.$inject = [
|
|
2322
|
+
'config.bpmnRenderer',
|
|
2323
|
+
'eventBus',
|
|
2324
|
+
'styles',
|
|
2325
|
+
'pathMap',
|
|
2326
|
+
'canvas',
|
|
2327
|
+
'textRenderer'
|
|
2328
|
+
];
|
|
2329
|
+
|
|
2330
|
+
|
|
2331
|
+
/**
|
|
2332
|
+
* @param {Element} element
|
|
2333
|
+
*
|
|
2334
|
+
* @return {boolean}
|
|
2335
|
+
*/
|
|
2336
|
+
BpmnRenderer.prototype.canRender = function(element) {
|
|
2337
|
+
return is(element, 'bpmn:BaseElement');
|
|
2338
|
+
};
|
|
2339
|
+
|
|
2340
|
+
/**
|
|
2341
|
+
* Draw shape into parentGfx.
|
|
2342
|
+
*
|
|
2343
|
+
* @param {SVGElement} parentGfx
|
|
2344
|
+
* @param {Shape} shape
|
|
2345
|
+
* @param {Attrs} [attrs]
|
|
2346
|
+
*
|
|
2347
|
+
* @return {SVGElement} mainGfx
|
|
2348
|
+
*/
|
|
2349
|
+
BpmnRenderer.prototype.drawShape = function(parentGfx, shape, attrs = {}) {
|
|
2350
|
+
var { type } = shape;
|
|
2351
|
+
|
|
2352
|
+
var handler = this._renderer(type);
|
|
2353
|
+
|
|
2354
|
+
return handler(parentGfx, shape, attrs);
|
|
2355
|
+
};
|
|
2356
|
+
|
|
2357
|
+
/**
|
|
2358
|
+
* Draw connection into parentGfx.
|
|
2359
|
+
*
|
|
2360
|
+
* @param {SVGElement} parentGfx
|
|
2361
|
+
* @param {Connection} connection
|
|
2362
|
+
* @param {Attrs} [attrs]
|
|
2363
|
+
*
|
|
2364
|
+
* @return {SVGElement} mainGfx
|
|
2365
|
+
*/
|
|
2366
|
+
BpmnRenderer.prototype.drawConnection = function(parentGfx, connection, attrs = {}) {
|
|
2367
|
+
var { type } = connection;
|
|
2368
|
+
|
|
2369
|
+
var handler = this._renderer(type);
|
|
2370
|
+
|
|
2371
|
+
return handler(parentGfx, connection, attrs);
|
|
2372
|
+
};
|
|
2373
|
+
|
|
2374
|
+
/**
|
|
2375
|
+
* Get shape path.
|
|
2376
|
+
*
|
|
2377
|
+
* @param {Shape} shape
|
|
2378
|
+
*
|
|
2379
|
+
* @return {string} path
|
|
2380
|
+
*/
|
|
2381
|
+
BpmnRenderer.prototype.getShapePath = function(shape) {
|
|
2382
|
+
if (is(shape, 'bpmn:Event')) {
|
|
2383
|
+
return getCirclePath(shape);
|
|
2384
|
+
}
|
|
2385
|
+
|
|
2386
|
+
if (is(shape, 'bpmn:Activity')) {
|
|
2387
|
+
return getRoundRectPath(shape, TASK_BORDER_RADIUS);
|
|
2388
|
+
}
|
|
2389
|
+
|
|
2390
|
+
if (is(shape, 'bpmn:Gateway')) {
|
|
2391
|
+
return getDiamondPath(shape);
|
|
2392
|
+
}
|
|
2393
|
+
|
|
2394
|
+
return getRectPath(shape);
|
|
2395
|
+
};
|
|
2396
|
+
|
|
2397
|
+
/**
|
|
2398
|
+
* Pick attributes if they exist.
|
|
2399
|
+
*
|
|
2400
|
+
* @param {Object} attrs
|
|
2401
|
+
* @param {string[]} keys
|
|
2402
|
+
*
|
|
2403
|
+
* @returns {Object}
|
|
2404
|
+
*/
|
|
2405
|
+
function pickAttrs(attrs, keys = []) {
|
|
2406
|
+
return keys.reduce((pickedAttrs, key) => {
|
|
2407
|
+
if (attrs[ key ]) {
|
|
2408
|
+
pickedAttrs[ key ] = attrs[ key ];
|
|
2409
|
+
}
|
|
2410
|
+
|
|
2411
|
+
return pickedAttrs;
|
|
2412
|
+
}, {});
|
|
2391
2413
|
}
|