2018-04-02 19:01:53 +00:00
|
|
|
import inherits from 'inherits';
|
|
|
|
|
|
|
|
import {
|
|
|
|
isObject,
|
|
|
|
assign,
|
|
|
|
forEach
|
|
|
|
} from 'min-dash';
|
|
|
|
|
|
|
|
import BaseRenderer from 'diagram-js/lib/draw/BaseRenderer';
|
|
|
|
|
|
|
|
import {
|
|
|
|
isExpanded,
|
|
|
|
isEventSubProcess
|
|
|
|
} from '../util/DiUtil';
|
|
|
|
|
|
|
|
import { is } from '../util/ModelUtil';
|
|
|
|
|
|
|
|
import {
|
|
|
|
createLine
|
|
|
|
} from 'diagram-js/lib/util/RenderUtil';
|
|
|
|
|
|
|
|
import {
|
|
|
|
isTypedEvent,
|
|
|
|
isThrowEvent,
|
|
|
|
isCollection,
|
|
|
|
getDi,
|
|
|
|
getSemantic,
|
|
|
|
getCirclePath,
|
|
|
|
getRoundRectPath,
|
|
|
|
getDiamondPath,
|
|
|
|
getRectPath,
|
|
|
|
getFillColor,
|
|
|
|
getStrokeColor
|
|
|
|
} from './BpmnRenderUtil';
|
|
|
|
|
|
|
|
import {
|
|
|
|
query as domQuery
|
|
|
|
} from 'min-dom';
|
|
|
|
|
|
|
|
import {
|
|
|
|
append as svgAppend,
|
|
|
|
attr as svgAttr,
|
|
|
|
create as svgCreate,
|
|
|
|
classes as svgClasses
|
|
|
|
} from 'tiny-svg';
|
|
|
|
|
|
|
|
import {
|
|
|
|
rotate,
|
|
|
|
transform,
|
|
|
|
translate
|
|
|
|
} from 'diagram-js/lib/util/SvgTransformUtil';
|
|
|
|
|
|
|
|
import Ids from 'ids';
|
|
|
|
|
|
|
|
var RENDERER_IDS = new Ids();
|
2017-10-04 08:36:45 +00:00
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
var TASK_BORDER_RADIUS = 10;
|
|
|
|
var INNER_OUTER_DIST = 3;
|
2014-03-20 15:18:23 +00:00
|
|
|
|
2017-11-13 10:11:07 +00:00
|
|
|
var DEFAULT_FILL_OPACITY = .95,
|
|
|
|
HIGH_FILL_OPACITY = .35;
|
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
export default function BpmnRenderer(
|
2018-05-23 12:27:32 +00:00
|
|
|
config, eventBus, styles, pathMap,
|
2018-05-24 11:42:40 +00:00
|
|
|
canvas, textRenderer, priority) {
|
2015-09-02 13:13:18 +00:00
|
|
|
|
2015-09-17 09:01:08 +00:00
|
|
|
BaseRenderer.call(this, eventBus, priority);
|
2014-04-25 14:14:36 +00:00
|
|
|
|
2018-05-24 13:02:02 +00:00
|
|
|
var defaultFillColor = config && config.defaultFillColor,
|
|
|
|
defaultStrokeColor = config && config.defaultStrokeColor;
|
2018-05-23 12:27:32 +00:00
|
|
|
|
2017-10-04 08:36:45 +00:00
|
|
|
var rendererId = RENDERER_IDS.next();
|
2017-09-29 09:08:20 +00:00
|
|
|
|
2014-03-20 16:51:05 +00:00
|
|
|
var markers = {};
|
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
var computeStyle = styles.computeStyle;
|
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
function addMarker(id, options) {
|
|
|
|
var attrs = assign({
|
|
|
|
fill: 'black',
|
|
|
|
strokeWidth: 1,
|
|
|
|
strokeLinecap: 'round',
|
|
|
|
strokeDasharray: 'none'
|
|
|
|
}, options.attrs);
|
2014-03-20 16:51:05 +00:00
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
var ref = options.ref || { x: 0, y: 0 };
|
2016-09-14 06:18:56 +00:00
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
var scale = options.scale || 1;
|
2014-03-20 16:51:05 +00:00
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
// fix for safari / chrome / firefox bug not correctly
|
|
|
|
// resetting stroke dash array
|
|
|
|
if (attrs.strokeDasharray === 'none') {
|
|
|
|
attrs.strokeDasharray = [10000, 1];
|
|
|
|
}
|
2014-03-20 16:51:05 +00:00
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
var marker = svgCreate('marker');
|
2014-06-02 13:37:14 +00:00
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
svgAttr(options.element, attrs);
|
2014-06-02 13:37:14 +00:00
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
svgAppend(marker, options.element);
|
2014-06-02 13:37:14 +00:00
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
svgAttr(marker, {
|
|
|
|
id: id,
|
|
|
|
viewBox: '0 0 20 20',
|
|
|
|
refX: ref.x,
|
|
|
|
refY: ref.y,
|
|
|
|
markerWidth: 20 * scale,
|
|
|
|
markerHeight: 20 * scale,
|
|
|
|
orient: 'auto'
|
|
|
|
});
|
2014-06-02 13:37:14 +00:00
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
var defs = domQuery('defs', canvas._svg);
|
2016-09-14 06:18:56 +00:00
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
if (!defs) {
|
|
|
|
defs = svgCreate('defs');
|
2016-09-14 06:18:56 +00:00
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
svgAppend(canvas._svg, defs);
|
|
|
|
}
|
2016-09-14 06:18:56 +00:00
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
svgAppend(defs, marker);
|
2016-09-14 06:18:56 +00:00
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
markers[id] = marker;
|
|
|
|
}
|
2016-09-14 06:18:56 +00:00
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
function marker(type, fill, stroke) {
|
2017-10-04 08:36:45 +00:00
|
|
|
var id = type + '-' + fill + '-' + stroke + '-' + rendererId;
|
2016-09-14 06:18:56 +00:00
|
|
|
|
2016-12-20 15:54:45 +00:00
|
|
|
if (!markers[id]) {
|
2016-11-28 15:53:19 +00:00
|
|
|
createMarker(type, fill, stroke);
|
|
|
|
}
|
|
|
|
|
2018-02-27 09:08:31 +00:00
|
|
|
return 'url(#' + id + ')';
|
2016-11-28 15:53:19 +00:00
|
|
|
}
|
2016-09-14 06:18:56 +00:00
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
function createMarker(type, fill, stroke) {
|
2017-10-04 08:36:45 +00:00
|
|
|
var id = type + '-' + fill + '-' + stroke + '-' + rendererId;
|
2014-06-02 13:37:14 +00:00
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
if (type === 'sequenceflow-end') {
|
|
|
|
var sequenceflowEnd = svgCreate('path');
|
|
|
|
svgAttr(sequenceflowEnd, { d: 'M 1 5 L 11 10 L 1 15 Z' });
|
|
|
|
|
|
|
|
addMarker(id, {
|
|
|
|
element: sequenceflowEnd,
|
|
|
|
ref: { x: 11, y: 10 },
|
|
|
|
scale: 0.5,
|
|
|
|
attrs: {
|
|
|
|
fill: stroke,
|
|
|
|
stroke: stroke
|
|
|
|
}
|
|
|
|
});
|
2014-06-02 13:37:14 +00:00
|
|
|
}
|
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
if (type === 'messageflow-start') {
|
|
|
|
var messageflowStart = svgCreate('circle');
|
|
|
|
svgAttr(messageflowStart, { cx: 6, cy: 6, r: 3.5 });
|
2014-06-02 13:37:14 +00:00
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
addMarker(id, {
|
|
|
|
element: messageflowStart,
|
|
|
|
attrs: {
|
|
|
|
fill: fill,
|
|
|
|
stroke: stroke
|
|
|
|
},
|
|
|
|
ref: { x: 6, y: 6 }
|
|
|
|
});
|
|
|
|
}
|
2014-06-02 13:37:14 +00:00
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
if (type === 'messageflow-end') {
|
|
|
|
var messageflowEnd = svgCreate('path');
|
|
|
|
svgAttr(messageflowEnd, { d: 'm 1 5 l 0 -3 l 7 3 l -7 3 z' });
|
2016-09-14 06:18:56 +00:00
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
addMarker(id, {
|
|
|
|
element: messageflowEnd,
|
|
|
|
attrs: {
|
|
|
|
fill: fill,
|
|
|
|
stroke: stroke,
|
|
|
|
strokeLinecap: 'butt'
|
|
|
|
},
|
|
|
|
ref: { x: 8.5, y: 5 }
|
|
|
|
});
|
|
|
|
}
|
2014-06-02 13:37:14 +00:00
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
if (type === 'association-start') {
|
|
|
|
var associationStart = svgCreate('path');
|
|
|
|
svgAttr(associationStart, { d: 'M 11 5 L 1 10 L 11 15' });
|
2014-06-02 13:37:14 +00:00
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
addMarker(id, {
|
|
|
|
element: associationStart,
|
|
|
|
attrs: {
|
|
|
|
fill: 'none',
|
|
|
|
stroke: stroke,
|
|
|
|
strokeWidth: 1.5
|
|
|
|
},
|
|
|
|
ref: { x: 1, y: 10 },
|
|
|
|
scale: 0.5
|
|
|
|
});
|
|
|
|
}
|
2016-09-14 06:18:56 +00:00
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
if (type === 'association-end') {
|
|
|
|
var associationEnd = svgCreate('path');
|
|
|
|
svgAttr(associationEnd, { d: 'M 1 5 L 11 10 L 1 15' });
|
2016-01-21 13:19:06 +00:00
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
addMarker(id, {
|
|
|
|
element: associationEnd,
|
|
|
|
attrs: {
|
|
|
|
fill: 'none',
|
|
|
|
stroke: stroke,
|
|
|
|
strokeWidth: 1.5
|
|
|
|
},
|
|
|
|
ref: { x: 12, y: 10 },
|
|
|
|
scale: 0.5
|
|
|
|
});
|
|
|
|
}
|
2016-09-14 06:18:56 +00:00
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
if (type === 'conditional-flow-marker') {
|
|
|
|
var conditionalflowMarker = svgCreate('path');
|
|
|
|
svgAttr(conditionalflowMarker, { d: 'M 0 10 L 8 6 L 16 10 L 8 14 Z' });
|
2014-06-02 13:37:14 +00:00
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
addMarker(id, {
|
|
|
|
element: conditionalflowMarker,
|
|
|
|
attrs: {
|
|
|
|
fill: fill,
|
|
|
|
stroke: stroke
|
|
|
|
},
|
|
|
|
ref: { x: -1, y: 10 },
|
|
|
|
scale: 0.5
|
|
|
|
});
|
|
|
|
}
|
2014-06-02 13:37:14 +00:00
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
if (type === 'conditional-default-flow-marker') {
|
|
|
|
var conditionaldefaultflowMarker = svgCreate('path');
|
2016-12-20 15:31:15 +00:00
|
|
|
svgAttr(conditionaldefaultflowMarker, { d: 'M 6 4 L 10 16' });
|
2016-09-14 06:18:56 +00:00
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
addMarker(id, {
|
|
|
|
element: conditionaldefaultflowMarker,
|
|
|
|
attrs: {
|
|
|
|
stroke: stroke
|
|
|
|
},
|
2016-12-20 15:31:15 +00:00
|
|
|
ref: { x: 0, y: 10 },
|
2016-11-28 15:53:19 +00:00
|
|
|
scale: 0.5
|
|
|
|
});
|
|
|
|
}
|
2014-03-20 16:51:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
function drawCircle(parentGfx, width, height, offset, attrs) {
|
2014-05-27 15:51:16 +00:00
|
|
|
|
2015-02-02 13:46:21 +00:00
|
|
|
if (isObject(offset)) {
|
2014-05-27 15:51:16 +00:00
|
|
|
attrs = offset;
|
|
|
|
offset = 0;
|
|
|
|
}
|
2014-03-20 15:18:23 +00:00
|
|
|
|
|
|
|
offset = offset || 0;
|
|
|
|
|
2014-05-27 15:51:16 +00:00
|
|
|
attrs = computeStyle(attrs, {
|
2014-05-27 16:48:38 +00:00
|
|
|
stroke: 'black',
|
|
|
|
strokeWidth: 2,
|
|
|
|
fill: 'white'
|
2014-05-27 15:51:16 +00:00
|
|
|
});
|
|
|
|
|
2018-04-09 11:02:40 +00:00
|
|
|
if (attrs.fill === 'none') {
|
|
|
|
delete attrs.fillOpacity;
|
|
|
|
}
|
|
|
|
|
2014-03-20 15:18:23 +00:00
|
|
|
var cx = width / 2,
|
|
|
|
cy = height / 2;
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
var circle = svgCreate('circle');
|
|
|
|
svgAttr(circle, {
|
|
|
|
cx: cx,
|
|
|
|
cy: cy,
|
|
|
|
r: Math.round((width + height) / 4 - offset)
|
|
|
|
});
|
|
|
|
svgAttr(circle, attrs);
|
|
|
|
|
|
|
|
svgAppend(parentGfx, circle);
|
|
|
|
|
|
|
|
return circle;
|
2014-03-20 15:18:23 +00:00
|
|
|
}
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
function drawRect(parentGfx, width, height, r, offset, attrs) {
|
2014-05-27 15:51:16 +00:00
|
|
|
|
2015-02-02 13:46:21 +00:00
|
|
|
if (isObject(offset)) {
|
2014-05-27 15:51:16 +00:00
|
|
|
attrs = offset;
|
|
|
|
offset = 0;
|
|
|
|
}
|
|
|
|
|
2014-03-20 15:18:23 +00:00
|
|
|
offset = offset || 0;
|
|
|
|
|
2014-05-27 15:51:16 +00:00
|
|
|
attrs = computeStyle(attrs, {
|
2014-05-27 16:48:38 +00:00
|
|
|
stroke: 'black',
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeWidth: 2,
|
2014-05-27 16:48:38 +00:00
|
|
|
fill: 'white'
|
2014-03-20 15:18:23 +00:00
|
|
|
});
|
2014-05-27 15:51:16 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
var rect = svgCreate('rect');
|
|
|
|
svgAttr(rect, {
|
|
|
|
x: offset,
|
|
|
|
y: offset,
|
|
|
|
width: width - offset * 2,
|
|
|
|
height: height - offset * 2,
|
|
|
|
rx: r,
|
|
|
|
ry: r
|
|
|
|
});
|
|
|
|
svgAttr(rect, attrs);
|
|
|
|
|
|
|
|
svgAppend(parentGfx, rect);
|
|
|
|
|
|
|
|
return rect;
|
2014-03-20 15:18:23 +00:00
|
|
|
}
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
function drawDiamond(parentGfx, width, height, attrs) {
|
2014-03-20 16:51:05 +00:00
|
|
|
|
|
|
|
var x_2 = width / 2;
|
|
|
|
var y_2 = height / 2;
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
var points = [{ x: x_2, y: 0 }, { x: width, y: y_2 }, { x: x_2, y: height }, { x: 0, y: y_2 }];
|
|
|
|
|
|
|
|
var pointsString = points.map(function(point) {
|
|
|
|
return point.x + ',' + point.y;
|
|
|
|
}).join(' ');
|
2014-03-20 16:51:05 +00:00
|
|
|
|
2014-05-27 15:51:16 +00:00
|
|
|
attrs = computeStyle(attrs, {
|
2014-05-27 16:48:38 +00:00
|
|
|
stroke: 'black',
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeWidth: 2,
|
2014-05-27 16:48:38 +00:00
|
|
|
fill: 'white'
|
2014-03-20 16:51:05 +00:00
|
|
|
});
|
2014-05-27 15:51:16 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
var polygon = svgCreate('polygon');
|
|
|
|
svgAttr(polygon, {
|
|
|
|
points: pointsString
|
|
|
|
});
|
|
|
|
svgAttr(polygon, attrs);
|
|
|
|
|
|
|
|
svgAppend(parentGfx, polygon);
|
|
|
|
|
|
|
|
return polygon;
|
2014-03-20 16:51:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
function drawLine(parentGfx, waypoints, attrs) {
|
2014-05-27 15:51:16 +00:00
|
|
|
attrs = computeStyle(attrs, [ 'no-fill' ], {
|
2014-05-27 16:48:38 +00:00
|
|
|
stroke: 'black',
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeWidth: 2,
|
2014-05-28 20:48:11 +00:00
|
|
|
fill: 'none'
|
2014-05-27 15:51:16 +00:00
|
|
|
});
|
2014-03-20 16:51:05 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
var line = createLine(waypoints, attrs);
|
|
|
|
|
|
|
|
svgAppend(parentGfx, line);
|
|
|
|
|
|
|
|
return line;
|
2014-05-27 15:51:16 +00:00
|
|
|
}
|
2014-04-03 12:01:56 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
function drawPath(parentGfx, d, attrs) {
|
2014-04-02 10:55:18 +00:00
|
|
|
|
2014-05-27 15:51:16 +00:00
|
|
|
attrs = computeStyle(attrs, [ 'no-fill' ], {
|
2014-05-27 16:48:38 +00:00
|
|
|
strokeWidth: 2,
|
|
|
|
stroke: 'black'
|
2014-05-27 15:51:16 +00:00
|
|
|
});
|
2014-04-02 10:55:18 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
var path = svgCreate('path');
|
|
|
|
svgAttr(path, { d: d });
|
|
|
|
svgAttr(path, attrs);
|
|
|
|
|
|
|
|
svgAppend(parentGfx, path);
|
|
|
|
|
|
|
|
return path;
|
2014-04-02 10:55:18 +00:00
|
|
|
}
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
function drawMarker(type, parentGfx, path, attrs) {
|
|
|
|
return drawPath(parentGfx, path, assign({ 'data-marker': type }, attrs));
|
2015-12-23 11:59:14 +00:00
|
|
|
}
|
|
|
|
|
2014-03-20 15:18:23 +00:00
|
|
|
function as(type) {
|
2016-09-14 06:18:56 +00:00
|
|
|
return function(parentGfx, element) {
|
|
|
|
return handlers[type](parentGfx, element);
|
2014-03-20 15:18:23 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
function renderer(type) {
|
|
|
|
return handlers[type];
|
|
|
|
}
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
function renderEventContent(element, parentGfx) {
|
2014-04-03 12:01:56 +00:00
|
|
|
|
2014-07-16 14:15:23 +00:00
|
|
|
var event = getSemantic(element);
|
2014-04-25 11:50:53 +00:00
|
|
|
var isThrowing = isThrowEvent(event);
|
|
|
|
|
|
|
|
if (isTypedEvent(event, 'bpmn:MessageEventDefinition')) {
|
2016-09-14 06:18:56 +00:00
|
|
|
return renderer('bpmn:MessageEventDefinition')(parentGfx, element, isThrowing);
|
2014-04-03 12:01:56 +00:00
|
|
|
}
|
2014-04-25 11:50:53 +00:00
|
|
|
|
|
|
|
if (isTypedEvent(event, 'bpmn:TimerEventDefinition')) {
|
2016-09-14 06:18:56 +00:00
|
|
|
return renderer('bpmn:TimerEventDefinition')(parentGfx, element, isThrowing);
|
2014-04-25 11:50:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (isTypedEvent(event, 'bpmn:ConditionalEventDefinition')) {
|
2016-09-14 06:18:56 +00:00
|
|
|
return renderer('bpmn:ConditionalEventDefinition')(parentGfx, element);
|
2014-04-25 11:50:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (isTypedEvent(event, 'bpmn:SignalEventDefinition')) {
|
2016-09-14 06:18:56 +00:00
|
|
|
return renderer('bpmn:SignalEventDefinition')(parentGfx, element, isThrowing);
|
2014-04-25 11:50:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (isTypedEvent(event, 'bpmn:CancelEventDefinition') &&
|
2014-05-21 14:14:17 +00:00
|
|
|
isTypedEvent(event, 'bpmn:TerminateEventDefinition', { parallelMultiple: false })) {
|
2016-09-14 06:18:56 +00:00
|
|
|
return renderer('bpmn:MultipleEventDefinition')(parentGfx, element, isThrowing);
|
2014-04-25 11:50:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (isTypedEvent(event, 'bpmn:CancelEventDefinition') &&
|
2014-05-21 14:14:17 +00:00
|
|
|
isTypedEvent(event, 'bpmn:TerminateEventDefinition', { parallelMultiple: true })) {
|
2016-09-14 06:18:56 +00:00
|
|
|
return renderer('bpmn:ParallelMultipleEventDefinition')(parentGfx, element, isThrowing);
|
2014-04-25 11:50:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (isTypedEvent(event, 'bpmn:EscalationEventDefinition')) {
|
2016-09-14 06:18:56 +00:00
|
|
|
return renderer('bpmn:EscalationEventDefinition')(parentGfx, element, isThrowing);
|
2014-04-25 11:50:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (isTypedEvent(event, 'bpmn:LinkEventDefinition')) {
|
2016-09-14 06:18:56 +00:00
|
|
|
return renderer('bpmn:LinkEventDefinition')(parentGfx, element, isThrowing);
|
2014-04-25 11:50:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (isTypedEvent(event, 'bpmn:ErrorEventDefinition')) {
|
2016-09-14 06:18:56 +00:00
|
|
|
return renderer('bpmn:ErrorEventDefinition')(parentGfx, element, isThrowing);
|
2014-04-25 11:50:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (isTypedEvent(event, 'bpmn:CancelEventDefinition')) {
|
2016-09-14 06:18:56 +00:00
|
|
|
return renderer('bpmn:CancelEventDefinition')(parentGfx, element, isThrowing);
|
2014-04-25 11:50:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (isTypedEvent(event, 'bpmn:CompensateEventDefinition')) {
|
2016-09-14 06:18:56 +00:00
|
|
|
return renderer('bpmn:CompensateEventDefinition')(parentGfx, element, isThrowing);
|
2014-04-25 11:50:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (isTypedEvent(event, 'bpmn:TerminateEventDefinition')) {
|
2016-09-14 06:18:56 +00:00
|
|
|
return renderer('bpmn:TerminateEventDefinition')(parentGfx, element, isThrowing);
|
2014-04-25 11:50:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
2014-04-03 12:01:56 +00:00
|
|
|
}
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
function renderLabel(parentGfx, label, options) {
|
2018-05-24 11:42:40 +00:00
|
|
|
|
|
|
|
options = assign({
|
|
|
|
size: {
|
|
|
|
width: 100
|
|
|
|
}
|
|
|
|
}, options);
|
|
|
|
|
|
|
|
var text = textRenderer.createText(label || '', options);
|
2018-05-23 12:27:32 +00:00
|
|
|
|
2016-11-08 13:24:26 +00:00
|
|
|
svgClasses(text).add('djs-label');
|
2018-05-23 12:27:32 +00:00
|
|
|
|
2017-02-13 12:47:00 +00:00
|
|
|
svgAppend(parentGfx, text);
|
2016-09-14 06:18:56 +00:00
|
|
|
|
|
|
|
return text;
|
2014-04-25 14:14:36 +00:00
|
|
|
}
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
function renderEmbeddedLabel(parentGfx, element, align) {
|
2014-07-16 14:15:23 +00:00
|
|
|
var semantic = getSemantic(element);
|
2016-11-23 12:03:38 +00:00
|
|
|
|
|
|
|
return renderLabel(parentGfx, semantic.name, {
|
|
|
|
box: element,
|
|
|
|
align: align,
|
2018-06-13 09:09:09 +00:00
|
|
|
padding: align === 'center-middle' ? 0 : 5,
|
2016-11-23 12:03:38 +00:00
|
|
|
style: {
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getStrokeColor(element, defaultStrokeColor)
|
2016-11-23 12:03:38 +00:00
|
|
|
}
|
|
|
|
});
|
2014-04-25 14:14:36 +00:00
|
|
|
}
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
function renderExternalLabel(parentGfx, element) {
|
2014-07-16 14:15:23 +00:00
|
|
|
var semantic = getSemantic(element);
|
2016-09-01 16:06:50 +00:00
|
|
|
var box = {
|
|
|
|
width: 90,
|
|
|
|
height: 30,
|
|
|
|
x: element.width / 2 + element.x,
|
|
|
|
y: element.height / 2 + element.y
|
|
|
|
};
|
|
|
|
|
2017-02-13 12:47:00 +00:00
|
|
|
return renderLabel(parentGfx, semantic.name, {
|
|
|
|
box: box,
|
|
|
|
fitBox: true,
|
2018-05-24 11:42:40 +00:00
|
|
|
style: assign(
|
|
|
|
{},
|
|
|
|
textRenderer.getExternalStyle(),
|
|
|
|
{
|
|
|
|
fill: getStrokeColor(element, defaultStrokeColor)
|
|
|
|
}
|
|
|
|
)
|
2017-02-13 12:47:00 +00:00
|
|
|
});
|
2014-04-25 14:14:36 +00:00
|
|
|
}
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
function renderLaneLabel(parentGfx, text, element) {
|
|
|
|
var textBox = renderLabel(parentGfx, text, {
|
2018-05-24 11:42:40 +00:00
|
|
|
box: {
|
|
|
|
height: 30,
|
|
|
|
width: element.height
|
|
|
|
},
|
2016-11-23 12:03:38 +00:00
|
|
|
align: 'center-middle',
|
|
|
|
style: {
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getStrokeColor(element, defaultStrokeColor)
|
2016-11-23 12:03:38 +00:00
|
|
|
}
|
2014-05-06 15:22:39 +00:00
|
|
|
});
|
|
|
|
|
2014-07-16 14:15:23 +00:00
|
|
|
var top = -1 * element.height;
|
2016-09-14 06:18:56 +00:00
|
|
|
|
|
|
|
transform(textBox, 0, -top, 270);
|
2014-05-02 15:03:03 +00:00
|
|
|
}
|
|
|
|
|
2014-07-30 14:06:32 +00:00
|
|
|
function createPathFromConnection(connection) {
|
|
|
|
var waypoints = connection.waypoints;
|
|
|
|
|
2014-05-27 15:51:16 +00:00
|
|
|
var pathData = 'm ' + waypoints[0].x + ',' + waypoints[0].y;
|
2014-05-21 11:51:59 +00:00
|
|
|
for (var i = 1; i < waypoints.length; i++) {
|
2014-05-27 15:51:16 +00:00
|
|
|
pathData += 'L' + waypoints[i].x + ',' + waypoints[i].y + ' ';
|
2014-05-21 11:51:59 +00:00
|
|
|
}
|
2014-05-27 15:51:16 +00:00
|
|
|
return pathData;
|
2014-05-21 11:51:59 +00:00
|
|
|
}
|
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
var handlers = this.handlers = {
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:Event': function(parentGfx, element, attrs) {
|
2017-12-15 13:35:18 +00:00
|
|
|
|
|
|
|
if (!('fillOpacity' in attrs)) {
|
|
|
|
attrs.fillOpacity = DEFAULT_FILL_OPACITY;
|
|
|
|
}
|
2017-11-13 10:11:07 +00:00
|
|
|
|
2016-11-23 12:03:38 +00:00
|
|
|
return drawCircle(parentGfx, element.width, element.height, attrs);
|
2014-03-20 15:18:23 +00:00
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:StartEvent': function(parentGfx, element) {
|
2016-11-23 12:03:38 +00:00
|
|
|
var attrs = {
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getFillColor(element, defaultFillColor),
|
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2016-11-23 12:03:38 +00:00
|
|
|
};
|
|
|
|
|
2014-07-16 14:15:23 +00:00
|
|
|
var semantic = getSemantic(element);
|
2014-04-03 12:01:56 +00:00
|
|
|
|
2014-05-27 15:51:16 +00:00
|
|
|
if (!semantic.isInterrupting) {
|
2014-05-28 21:19:41 +00:00
|
|
|
attrs = {
|
|
|
|
strokeDasharray: '6',
|
2018-05-23 12:27:32 +00:00
|
|
|
strokeLinecap: 'round',
|
|
|
|
fill: getFillColor(element, defaultFillColor),
|
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2014-05-28 21:19:41 +00:00
|
|
|
};
|
2014-05-15 08:09:07 +00:00
|
|
|
}
|
2014-05-27 15:51:16 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
var circle = renderer('bpmn:Event')(parentGfx, element, attrs);
|
2014-05-27 15:51:16 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
renderEventContent(element, parentGfx);
|
2014-04-03 12:01:56 +00:00
|
|
|
|
|
|
|
return circle;
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:MessageEventDefinition': function(parentGfx, element, isThrowing) {
|
2014-04-28 13:32:55 +00:00
|
|
|
var pathData = pathMap.getScaledPath('EVENT_MESSAGE', {
|
|
|
|
xScaleFactor: 0.9,
|
|
|
|
yScaleFactor: 0.9,
|
2014-07-16 14:15:23 +00:00
|
|
|
containerWidth: element.width,
|
|
|
|
containerHeight: element.height,
|
2014-04-28 13:32:55 +00:00
|
|
|
position: {
|
|
|
|
mx: 0.235,
|
|
|
|
my: 0.315
|
|
|
|
}
|
|
|
|
});
|
2014-04-03 12:01:56 +00:00
|
|
|
|
2018-05-23 12:27:32 +00:00
|
|
|
var fill = isThrowing ? getStrokeColor(element, defaultStrokeColor) : getFillColor(element, defaultFillColor);
|
|
|
|
var stroke = isThrowing ? getFillColor(element, defaultFillColor) : getStrokeColor(element, defaultStrokeColor);
|
2014-04-03 12:01:56 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
var messagePath = drawPath(parentGfx, pathData, {
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeWidth: 1,
|
|
|
|
fill: fill,
|
|
|
|
stroke: stroke
|
2014-04-03 12:01:56 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
return messagePath;
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:TimerEventDefinition': function(parentGfx, element) {
|
|
|
|
var circle = drawCircle(parentGfx, element.width, element.height, 0.2 * element.height, {
|
2016-11-23 12:03:38 +00:00
|
|
|
strokeWidth: 2,
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getFillColor(element, defaultFillColor),
|
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2014-04-03 12:01:56 +00:00
|
|
|
});
|
|
|
|
|
2014-04-28 13:32:55 +00:00
|
|
|
var pathData = pathMap.getScaledPath('EVENT_TIMER_WH', {
|
|
|
|
xScaleFactor: 0.75,
|
|
|
|
yScaleFactor: 0.75,
|
2014-07-16 14:15:23 +00:00
|
|
|
containerWidth: element.width,
|
|
|
|
containerHeight: element.height,
|
2014-04-28 13:32:55 +00:00
|
|
|
position: {
|
|
|
|
mx: 0.5,
|
|
|
|
my: 0.5
|
|
|
|
}
|
2014-04-03 12:01:56 +00:00
|
|
|
});
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
drawPath(parentGfx, pathData, {
|
2014-09-17 14:05:24 +00:00
|
|
|
strokeWidth: 2,
|
2016-11-23 12:03:38 +00:00
|
|
|
strokeLinecap: 'square',
|
2018-05-23 12:27:32 +00:00
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2014-04-03 12:01:56 +00:00
|
|
|
});
|
|
|
|
|
2018-05-24 11:42:40 +00:00
|
|
|
for (var i = 0;i < 12; i++) {
|
2014-09-17 14:05:24 +00:00
|
|
|
|
|
|
|
var linePathData = pathMap.getScaledPath('EVENT_TIMER_LINE', {
|
|
|
|
xScaleFactor: 0.75,
|
|
|
|
yScaleFactor: 0.75,
|
|
|
|
containerWidth: element.width,
|
|
|
|
containerHeight: element.height,
|
|
|
|
position: {
|
|
|
|
mx: 0.5,
|
|
|
|
my: 0.5
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
var width = element.width / 2;
|
|
|
|
var height = element.height / 2;
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
drawPath(parentGfx, linePathData, {
|
2014-09-17 14:05:24 +00:00
|
|
|
strokeWidth: 1,
|
|
|
|
strokeLinecap: 'square',
|
2016-11-23 12:03:38 +00:00
|
|
|
transform: 'rotate(' + (i * 30) + ',' + height + ',' + width + ')',
|
2018-05-23 12:27:32 +00:00
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2014-09-17 14:05:24 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2014-04-28 13:32:55 +00:00
|
|
|
return circle;
|
2014-04-03 12:01:56 +00:00
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:EscalationEventDefinition': function(parentGfx, event, isThrowing) {
|
2014-04-28 13:32:55 +00:00
|
|
|
var pathData = pathMap.getScaledPath('EVENT_ESCALATION', {
|
|
|
|
xScaleFactor: 1,
|
|
|
|
yScaleFactor: 1,
|
|
|
|
containerWidth: event.width,
|
|
|
|
containerHeight: event.height,
|
|
|
|
position: {
|
|
|
|
mx: 0.5,
|
2016-07-18 09:13:35 +00:00
|
|
|
my: 0.2
|
2014-04-28 13:32:55 +00:00
|
|
|
}
|
|
|
|
});
|
2014-04-03 12:01:56 +00:00
|
|
|
|
2018-05-23 12:27:32 +00:00
|
|
|
var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
|
2014-04-03 12:01:56 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
return drawPath(parentGfx, pathData, {
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeWidth: 1,
|
2016-11-23 12:03:38 +00:00
|
|
|
fill: fill,
|
2018-05-23 12:27:32 +00:00
|
|
|
stroke: getStrokeColor(event, defaultStrokeColor)
|
2014-04-03 12:01:56 +00:00
|
|
|
});
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:ConditionalEventDefinition': function(parentGfx, event) {
|
2014-04-28 13:32:55 +00:00
|
|
|
var pathData = pathMap.getScaledPath('EVENT_CONDITIONAL', {
|
|
|
|
xScaleFactor: 1,
|
|
|
|
yScaleFactor: 1,
|
|
|
|
containerWidth: event.width,
|
|
|
|
containerHeight: event.height,
|
|
|
|
position: {
|
|
|
|
mx: 0.5,
|
|
|
|
my: 0.222
|
|
|
|
}
|
|
|
|
});
|
2014-04-03 12:01:56 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
return drawPath(parentGfx, pathData, {
|
2016-11-23 12:03:38 +00:00
|
|
|
strokeWidth: 1,
|
2018-05-23 12:27:32 +00:00
|
|
|
stroke: getStrokeColor(event, defaultStrokeColor)
|
2014-04-03 12:01:56 +00:00
|
|
|
});
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:LinkEventDefinition': function(parentGfx, event, isThrowing) {
|
2014-04-28 13:32:55 +00:00
|
|
|
var pathData = pathMap.getScaledPath('EVENT_LINK', {
|
|
|
|
xScaleFactor: 1,
|
|
|
|
yScaleFactor: 1,
|
|
|
|
containerWidth: event.width,
|
|
|
|
containerHeight: event.height,
|
|
|
|
position: {
|
|
|
|
mx: 0.57,
|
|
|
|
my: 0.263
|
|
|
|
}
|
|
|
|
});
|
2014-04-03 12:01:56 +00:00
|
|
|
|
2018-05-23 12:27:32 +00:00
|
|
|
var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
|
2015-03-04 12:29:46 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
return drawPath(parentGfx, pathData, {
|
2015-03-04 12:29:46 +00:00
|
|
|
strokeWidth: 1,
|
2016-11-23 12:03:38 +00:00
|
|
|
fill: fill,
|
2018-05-23 12:27:32 +00:00
|
|
|
stroke: getStrokeColor(event, defaultStrokeColor)
|
2014-04-03 12:01:56 +00:00
|
|
|
});
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:ErrorEventDefinition': function(parentGfx, event, isThrowing) {
|
2014-04-28 13:32:55 +00:00
|
|
|
var pathData = pathMap.getScaledPath('EVENT_ERROR', {
|
|
|
|
xScaleFactor: 1.1,
|
|
|
|
yScaleFactor: 1.1,
|
|
|
|
containerWidth: event.width,
|
|
|
|
containerHeight: event.height,
|
|
|
|
position: {
|
|
|
|
mx: 0.2,
|
|
|
|
my: 0.722
|
|
|
|
}
|
|
|
|
});
|
2014-04-03 12:01:56 +00:00
|
|
|
|
2018-05-23 12:27:32 +00:00
|
|
|
var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
|
2014-04-03 12:01:56 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
return drawPath(parentGfx, pathData, {
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeWidth: 1,
|
2016-11-23 12:03:38 +00:00
|
|
|
fill: fill,
|
2018-05-23 12:27:32 +00:00
|
|
|
stroke: getStrokeColor(event, defaultStrokeColor)
|
2014-04-03 12:01:56 +00:00
|
|
|
});
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:CancelEventDefinition': function(parentGfx, event, isThrowing) {
|
2014-04-28 13:32:55 +00:00
|
|
|
var pathData = pathMap.getScaledPath('EVENT_CANCEL_45', {
|
|
|
|
xScaleFactor: 1.0,
|
|
|
|
yScaleFactor: 1.0,
|
|
|
|
containerWidth: event.width,
|
|
|
|
containerHeight: event.height,
|
|
|
|
position: {
|
|
|
|
mx: 0.638,
|
|
|
|
my: -0.055
|
|
|
|
}
|
|
|
|
});
|
2014-04-03 12:01:56 +00:00
|
|
|
|
2018-05-23 12:27:32 +00:00
|
|
|
var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
|
2014-04-03 12:01:56 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
var path = drawPath(parentGfx, pathData, {
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeWidth: 1,
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: fill,
|
|
|
|
stroke: getStrokeColor(event, defaultStrokeColor)
|
2016-09-14 06:18:56 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
rotate(path, 45);
|
|
|
|
|
|
|
|
return path;
|
2014-04-03 12:01:56 +00:00
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:CompensateEventDefinition': function(parentGfx, event, isThrowing) {
|
2014-04-28 13:32:55 +00:00
|
|
|
var pathData = pathMap.getScaledPath('EVENT_COMPENSATION', {
|
|
|
|
xScaleFactor: 1,
|
|
|
|
yScaleFactor: 1,
|
|
|
|
containerWidth: event.width,
|
|
|
|
containerHeight: event.height,
|
|
|
|
position: {
|
2016-01-20 15:50:01 +00:00
|
|
|
mx: 0.22,
|
|
|
|
my: 0.5
|
2014-04-28 13:32:55 +00:00
|
|
|
}
|
|
|
|
});
|
2014-04-03 12:01:56 +00:00
|
|
|
|
2018-05-23 12:27:32 +00:00
|
|
|
var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
|
2014-04-03 12:01:56 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
return drawPath(parentGfx, pathData, {
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeWidth: 1,
|
2016-11-23 12:03:38 +00:00
|
|
|
fill: fill,
|
2018-05-23 12:27:32 +00:00
|
|
|
stroke: getStrokeColor(event, defaultStrokeColor)
|
2014-04-03 12:01:56 +00:00
|
|
|
});
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:SignalEventDefinition': function(parentGfx, event, isThrowing) {
|
2014-04-28 13:32:55 +00:00
|
|
|
var pathData = pathMap.getScaledPath('EVENT_SIGNAL', {
|
|
|
|
xScaleFactor: 0.9,
|
|
|
|
yScaleFactor: 0.9,
|
|
|
|
containerWidth: event.width,
|
|
|
|
containerHeight: event.height,
|
|
|
|
position: {
|
|
|
|
mx: 0.5,
|
|
|
|
my: 0.2
|
|
|
|
}
|
|
|
|
});
|
2014-04-03 12:01:56 +00:00
|
|
|
|
2018-05-23 12:27:32 +00:00
|
|
|
var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
|
2014-04-03 12:01:56 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
return drawPath(parentGfx, pathData, {
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeWidth: 1,
|
2016-11-23 12:03:38 +00:00
|
|
|
fill: fill,
|
2018-05-23 12:27:32 +00:00
|
|
|
stroke: getStrokeColor(event, defaultStrokeColor)
|
2014-04-03 12:01:56 +00:00
|
|
|
});
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:MultipleEventDefinition': function(parentGfx, event, isThrowing) {
|
2014-04-28 13:32:55 +00:00
|
|
|
var pathData = pathMap.getScaledPath('EVENT_MULTIPLE', {
|
|
|
|
xScaleFactor: 1.1,
|
|
|
|
yScaleFactor: 1.1,
|
|
|
|
containerWidth: event.width,
|
|
|
|
containerHeight: event.height,
|
|
|
|
position: {
|
|
|
|
mx: 0.222,
|
|
|
|
my: 0.36
|
|
|
|
}
|
|
|
|
});
|
2014-04-03 12:01:56 +00:00
|
|
|
|
2018-05-23 12:27:32 +00:00
|
|
|
var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
|
2014-04-03 12:01:56 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
return drawPath(parentGfx, pathData, {
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeWidth: 1,
|
|
|
|
fill: fill
|
2014-04-03 12:01:56 +00:00
|
|
|
});
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:ParallelMultipleEventDefinition': function(parentGfx, event) {
|
2014-04-28 13:32:55 +00:00
|
|
|
var pathData = pathMap.getScaledPath('EVENT_PARALLEL_MULTIPLE', {
|
|
|
|
xScaleFactor: 1.2,
|
|
|
|
yScaleFactor: 1.2,
|
|
|
|
containerWidth: event.width,
|
|
|
|
containerHeight: event.height,
|
|
|
|
position: {
|
|
|
|
mx: 0.458,
|
|
|
|
my: 0.194
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
return drawPath(parentGfx, pathData, {
|
2016-11-23 12:03:38 +00:00
|
|
|
strokeWidth: 1,
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getStrokeColor(event, defaultStrokeColor),
|
|
|
|
stroke: getStrokeColor(event, defaultStrokeColor)
|
2014-04-03 12:01:56 +00:00
|
|
|
});
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:EndEvent': function(parentGfx, element) {
|
|
|
|
var circle = renderer('bpmn:Event')(parentGfx, element, {
|
2016-11-23 12:03:38 +00:00
|
|
|
strokeWidth: 4,
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getFillColor(element, defaultFillColor),
|
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2014-03-20 15:18:23 +00:00
|
|
|
});
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
renderEventContent(element, parentGfx, true);
|
2014-04-03 12:01:56 +00:00
|
|
|
|
|
|
|
return circle;
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:TerminateEventDefinition': function(parentGfx, element) {
|
|
|
|
var circle = drawCircle(parentGfx, element.width, element.height, 8, {
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeWidth: 4,
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getStrokeColor(element, defaultStrokeColor),
|
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2014-04-03 12:01:56 +00:00
|
|
|
});
|
|
|
|
|
2014-03-20 15:18:23 +00:00
|
|
|
return circle;
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:IntermediateEvent': function(parentGfx, element) {
|
2016-11-23 12:03:38 +00:00
|
|
|
var outer = renderer('bpmn:Event')(parentGfx, element, {
|
|
|
|
strokeWidth: 1,
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getFillColor(element, defaultFillColor),
|
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2016-11-23 12:03:38 +00:00
|
|
|
});
|
|
|
|
|
2018-05-23 12:27:32 +00:00
|
|
|
/* inner */
|
|
|
|
drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
|
2016-11-23 12:03:38 +00:00
|
|
|
strokeWidth: 1,
|
|
|
|
fill: getFillColor(element, 'none'),
|
2018-05-23 12:27:32 +00:00
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2016-11-23 12:03:38 +00:00
|
|
|
});
|
2014-03-20 15:18:23 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
renderEventContent(element, parentGfx);
|
2014-04-03 12:01:56 +00:00
|
|
|
|
2014-03-20 15:18:23 +00:00
|
|
|
return outer;
|
|
|
|
},
|
|
|
|
'bpmn:IntermediateCatchEvent': as('bpmn:IntermediateEvent'),
|
2014-04-03 12:01:56 +00:00
|
|
|
'bpmn:IntermediateThrowEvent': as('bpmn:IntermediateEvent'),
|
2014-03-20 15:18:23 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:Activity': function(parentGfx, element, attrs) {
|
2017-11-13 10:11:07 +00:00
|
|
|
|
|
|
|
attrs = attrs || {};
|
2017-12-15 13:35:18 +00:00
|
|
|
|
|
|
|
if (!('fillOpacity' in attrs)) {
|
|
|
|
attrs.fillOpacity = DEFAULT_FILL_OPACITY;
|
|
|
|
}
|
2017-11-13 10:11:07 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, attrs);
|
2014-04-25 14:14:36 +00:00
|
|
|
},
|
|
|
|
|
2016-11-23 12:03:38 +00:00
|
|
|
'bpmn:Task': function(parentGfx, element) {
|
|
|
|
var attrs = {
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getFillColor(element, defaultFillColor),
|
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2016-11-23 12:03:38 +00:00
|
|
|
};
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
var rect = renderer('bpmn:Activity')(parentGfx, element, attrs);
|
2016-11-23 12:03:38 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
renderEmbeddedLabel(parentGfx, element, 'center-middle');
|
|
|
|
attachTaskMarkers(parentGfx, element);
|
2016-11-23 12:03:38 +00:00
|
|
|
|
2014-03-20 15:18:23 +00:00
|
|
|
return rect;
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:ServiceTask': function(parentGfx, element) {
|
|
|
|
var task = renderer('bpmn:Task')(parentGfx, element);
|
2014-05-12 09:48:24 +00:00
|
|
|
|
|
|
|
var pathDataBG = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
|
|
|
|
abspos: {
|
|
|
|
x: 12,
|
|
|
|
y: 18
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
/* service bg */ drawPath(parentGfx, pathDataBG, {
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeWidth: 1,
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getFillColor(element, defaultFillColor),
|
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2014-05-12 09:48:24 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
var fillPathData = pathMap.getScaledPath('TASK_TYPE_SERVICE_FILL', {
|
|
|
|
abspos: {
|
|
|
|
x: 17.2,
|
|
|
|
y: 18
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
/* service fill */ drawPath(parentGfx, fillPathData, {
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeWidth: 0,
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getFillColor(element, defaultFillColor)
|
2014-05-12 09:48:24 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
var pathData = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
|
|
|
|
abspos: {
|
|
|
|
x: 17,
|
|
|
|
y: 22
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
/* service */ drawPath(parentGfx, pathData, {
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeWidth: 1,
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getFillColor(element, defaultFillColor),
|
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2014-05-12 09:48:24 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
return task;
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:UserTask': function(parentGfx, element) {
|
|
|
|
var task = renderer('bpmn:Task')(parentGfx, element);
|
2014-05-12 09:48:24 +00:00
|
|
|
|
|
|
|
var x = 15;
|
|
|
|
var y = 12;
|
|
|
|
|
|
|
|
var pathData = pathMap.getScaledPath('TASK_TYPE_USER_1', {
|
|
|
|
abspos: {
|
|
|
|
x: x,
|
|
|
|
y: y
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
/* user path */ drawPath(parentGfx, pathData, {
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeWidth: 0.5,
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getFillColor(element, defaultFillColor),
|
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2014-05-12 09:48:24 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
var pathData2 = pathMap.getScaledPath('TASK_TYPE_USER_2', {
|
|
|
|
abspos: {
|
|
|
|
x: x,
|
|
|
|
y: y
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
/* user2 path */ drawPath(parentGfx, pathData2, {
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeWidth: 0.5,
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getFillColor(element, defaultFillColor),
|
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2014-05-12 09:48:24 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
var pathData3 = pathMap.getScaledPath('TASK_TYPE_USER_3', {
|
|
|
|
abspos: {
|
|
|
|
x: x,
|
|
|
|
y: y
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
/* user3 path */ drawPath(parentGfx, pathData3, {
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeWidth: 0.5,
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getStrokeColor(element, defaultStrokeColor),
|
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2014-05-12 09:48:24 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
return task;
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:ManualTask': function(parentGfx, element) {
|
|
|
|
var task = renderer('bpmn:Task')(parentGfx, element);
|
2014-05-12 09:48:24 +00:00
|
|
|
|
|
|
|
var pathData = pathMap.getScaledPath('TASK_TYPE_MANUAL', {
|
|
|
|
abspos: {
|
|
|
|
x: 17,
|
|
|
|
y: 15
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
/* manual path */ drawPath(parentGfx, pathData, {
|
2016-11-23 12:03:38 +00:00
|
|
|
strokeWidth: 0.5, // 0.25,
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getFillColor(element, defaultFillColor),
|
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2014-05-12 09:48:24 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
return task;
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:SendTask': function(parentGfx, element) {
|
|
|
|
var task = renderer('bpmn:Task')(parentGfx, element);
|
2014-05-12 09:48:24 +00:00
|
|
|
|
|
|
|
var pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
|
|
|
|
xScaleFactor: 1,
|
|
|
|
yScaleFactor: 1,
|
|
|
|
containerWidth: 21,
|
|
|
|
containerHeight: 14,
|
|
|
|
position: {
|
|
|
|
mx: 0.285,
|
|
|
|
my: 0.357
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
/* send path */ drawPath(parentGfx, pathData, {
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeWidth: 1,
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getStrokeColor(element, defaultStrokeColor),
|
|
|
|
stroke: getFillColor(element, defaultFillColor)
|
2014-05-12 09:48:24 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
return task;
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:ReceiveTask' : function(parentGfx, element) {
|
2014-07-16 14:15:23 +00:00
|
|
|
var semantic = getSemantic(element);
|
2014-05-12 09:48:24 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
var task = renderer('bpmn:Task')(parentGfx, element);
|
2014-05-12 09:48:24 +00:00
|
|
|
var pathData;
|
2014-05-27 15:51:16 +00:00
|
|
|
|
2014-05-28 21:19:41 +00:00
|
|
|
if (semantic.instantiate) {
|
2016-11-08 13:24:26 +00:00
|
|
|
drawCircle(parentGfx, 28, 28, 20 * 0.22, { strokeWidth: 1 });
|
2014-05-12 09:48:24 +00:00
|
|
|
|
|
|
|
pathData = pathMap.getScaledPath('TASK_TYPE_INSTANTIATING_SEND', {
|
|
|
|
abspos: {
|
|
|
|
x: 7.77,
|
|
|
|
y: 9.52
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
|
|
|
|
pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
|
|
|
|
xScaleFactor: 0.9,
|
|
|
|
yScaleFactor: 0.9,
|
|
|
|
containerWidth: 21,
|
|
|
|
containerHeight: 14,
|
|
|
|
position: {
|
|
|
|
mx: 0.3,
|
|
|
|
my: 0.4
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
/* receive path */ drawPath(parentGfx, pathData, {
|
2016-11-23 12:03:38 +00:00
|
|
|
strokeWidth: 1,
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getFillColor(element, defaultFillColor),
|
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2014-05-12 09:48:24 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
return task;
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:ScriptTask': function(parentGfx, element) {
|
|
|
|
var task = renderer('bpmn:Task')(parentGfx, element);
|
2014-05-12 09:48:24 +00:00
|
|
|
|
|
|
|
var pathData = pathMap.getScaledPath('TASK_TYPE_SCRIPT', {
|
|
|
|
abspos: {
|
|
|
|
x: 15,
|
|
|
|
y: 20
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
/* script path */ drawPath(parentGfx, pathData, {
|
2016-11-23 12:03:38 +00:00
|
|
|
strokeWidth: 1,
|
2018-05-23 12:27:32 +00:00
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2014-05-12 09:48:24 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
return task;
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:BusinessRuleTask': function(parentGfx, element) {
|
|
|
|
var task = renderer('bpmn:Task')(parentGfx, element);
|
2014-05-12 09:48:24 +00:00
|
|
|
|
|
|
|
var headerPathData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_HEADER', {
|
|
|
|
abspos: {
|
|
|
|
x: 8,
|
|
|
|
y: 8
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
var businessHeaderPath = drawPath(parentGfx, headerPathData);
|
|
|
|
svgAttr(businessHeaderPath, {
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeWidth: 1,
|
2016-11-23 12:03:38 +00:00
|
|
|
fill: getFillColor(element, '#aaaaaa'),
|
2018-05-23 12:27:32 +00:00
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2014-05-12 09:48:24 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
var headerData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_MAIN', {
|
|
|
|
abspos: {
|
|
|
|
x: 8,
|
|
|
|
y: 8
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
var businessPath = drawPath(parentGfx, headerData);
|
|
|
|
svgAttr(businessPath, {
|
2016-11-23 12:03:38 +00:00
|
|
|
strokeWidth: 1,
|
2018-05-23 12:27:32 +00:00
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2014-05-12 09:48:24 +00:00
|
|
|
});
|
2014-05-23 08:59:00 +00:00
|
|
|
|
2014-05-12 09:48:24 +00:00
|
|
|
return task;
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:SubProcess': function(parentGfx, element, attrs) {
|
2016-11-23 12:03:38 +00:00
|
|
|
attrs = assign({
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getFillColor(element, defaultFillColor),
|
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2016-11-23 12:03:38 +00:00
|
|
|
}, attrs);
|
2016-03-16 10:27:09 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
var rect = renderer('bpmn:Activity')(parentGfx, element, attrs);
|
2014-05-27 15:51:16 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
var expanded = isExpanded(element);
|
2014-06-17 09:48:23 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
if (isEventSubProcess(element)) {
|
2016-09-14 06:18:56 +00:00
|
|
|
svgAttr(rect, {
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeDasharray: '1,2'
|
2014-05-15 06:37:45 +00:00
|
|
|
});
|
|
|
|
}
|
2014-05-05 15:22:43 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
renderEmbeddedLabel(parentGfx, element, expanded ? 'center-top' : 'center-middle');
|
2014-05-05 15:22:43 +00:00
|
|
|
|
2014-06-17 09:48:23 +00:00
|
|
|
if (expanded) {
|
2016-09-14 06:18:56 +00:00
|
|
|
attachTaskMarkers(parentGfx, element);
|
2014-05-05 15:22:43 +00:00
|
|
|
} else {
|
2016-09-14 06:18:56 +00:00
|
|
|
attachTaskMarkers(parentGfx, element, ['SubProcessMarker']);
|
2014-05-05 15:22:43 +00:00
|
|
|
}
|
2014-05-21 11:51:59 +00:00
|
|
|
|
2014-04-25 14:14:36 +00:00
|
|
|
return rect;
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:AdHocSubProcess': function(parentGfx, element) {
|
|
|
|
return renderer('bpmn:SubProcess')(parentGfx, element);
|
2014-05-05 15:22:43 +00:00
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:Transaction': function(parentGfx, element) {
|
|
|
|
var outer = renderer('bpmn:SubProcess')(parentGfx, element);
|
2014-03-20 15:18:23 +00:00
|
|
|
|
2016-12-05 20:55:12 +00:00
|
|
|
var innerAttrs = styles.style([ 'no-fill', 'no-events' ], {
|
2018-05-23 12:27:32 +00:00
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2016-12-05 20:55:12 +00:00
|
|
|
});
|
2015-02-02 13:46:21 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
/* inner path */ drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS - 2, INNER_OUTER_DIST, innerAttrs);
|
2014-03-20 15:18:23 +00:00
|
|
|
|
|
|
|
return outer;
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:CallActivity': function(parentGfx, element) {
|
|
|
|
return renderer('bpmn:SubProcess')(parentGfx, element, {
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeWidth: 5
|
|
|
|
});
|
2014-03-20 15:18:23 +00:00
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:Participant': function(parentGfx, element) {
|
2014-05-02 15:03:03 +00:00
|
|
|
|
2016-11-23 12:03:38 +00:00
|
|
|
var attrs = {
|
2017-11-13 10:11:07 +00:00
|
|
|
fillOpacity: DEFAULT_FILL_OPACITY,
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getFillColor(element, defaultFillColor),
|
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2016-11-23 12:03:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
var lane = renderer('bpmn:Lane')(parentGfx, element, attrs);
|
2014-05-02 15:03:03 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
var expandedPool = isExpanded(element);
|
2014-05-02 15:03:03 +00:00
|
|
|
|
|
|
|
if (expandedPool) {
|
2016-09-14 06:18:56 +00:00
|
|
|
drawLine(parentGfx, [
|
2014-09-08 17:03:39 +00:00
|
|
|
{ x: 30, y: 0 },
|
|
|
|
{ x: 30, y: element.height }
|
2016-11-23 12:03:38 +00:00
|
|
|
], {
|
2018-05-23 12:27:32 +00:00
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2016-11-23 12:03:38 +00:00
|
|
|
});
|
2014-07-16 14:15:23 +00:00
|
|
|
var text = getSemantic(element).name;
|
2016-09-14 06:18:56 +00:00
|
|
|
renderLaneLabel(parentGfx, text, element);
|
2014-05-02 15:03:03 +00:00
|
|
|
} else {
|
|
|
|
// Collapsed pool draw text inline
|
2014-07-16 14:15:23 +00:00
|
|
|
var text2 = getSemantic(element).name;
|
2016-11-23 12:03:38 +00:00
|
|
|
renderLabel(parentGfx, text2, {
|
|
|
|
box: element, align: 'center-middle',
|
|
|
|
style: {
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getStrokeColor(element, defaultStrokeColor)
|
2016-11-23 12:03:38 +00:00
|
|
|
}
|
|
|
|
});
|
2014-05-02 15:03:03 +00:00
|
|
|
}
|
|
|
|
|
2014-07-16 14:15:23 +00:00
|
|
|
var participantMultiplicity = !!(getSemantic(element).participantMultiplicity);
|
2014-05-18 10:20:11 +00:00
|
|
|
|
2015-12-23 11:59:14 +00:00
|
|
|
if (participantMultiplicity) {
|
2016-09-14 06:18:56 +00:00
|
|
|
renderer('ParticipantMultiplicityMarker')(parentGfx, element);
|
2014-05-18 10:20:11 +00:00
|
|
|
}
|
|
|
|
|
2014-05-02 15:03:03 +00:00
|
|
|
return lane;
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:Lane': function(parentGfx, element, attrs) {
|
2016-11-23 12:03:38 +00:00
|
|
|
var rect = drawRect(parentGfx, element.width, element.height, 0, assign({
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getFillColor(element, defaultFillColor),
|
2017-11-13 10:11:07 +00:00
|
|
|
fillOpacity: HIGH_FILL_OPACITY,
|
2018-05-23 12:27:32 +00:00
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2016-11-23 12:03:38 +00:00
|
|
|
}, attrs));
|
2014-05-02 15:03:03 +00:00
|
|
|
|
2014-07-16 14:15:23 +00:00
|
|
|
var semantic = getSemantic(element);
|
2014-05-21 13:35:26 +00:00
|
|
|
|
2014-05-27 15:51:16 +00:00
|
|
|
if (semantic.$type === 'bpmn:Lane') {
|
|
|
|
var text = semantic.name;
|
2016-09-14 06:18:56 +00:00
|
|
|
renderLaneLabel(parentGfx, text, element);
|
2014-05-02 15:03:03 +00:00
|
|
|
}
|
|
|
|
|
2014-03-20 15:18:23 +00:00
|
|
|
return rect;
|
2014-03-20 16:51:05 +00:00
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:InclusiveGateway': function(parentGfx, element) {
|
2017-11-13 10:11:07 +00:00
|
|
|
var diamond = renderer('bpmn:Gateway')(parentGfx, element);
|
2014-03-20 16:51:05 +00:00
|
|
|
|
2015-07-14 14:20:32 +00:00
|
|
|
/* circle path */
|
2016-09-14 06:18:56 +00:00
|
|
|
drawCircle(parentGfx, element.width, element.height, element.height * 0.24, {
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeWidth: 2.5,
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getFillColor(element, defaultFillColor),
|
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2014-04-24 10:25:04 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
return diamond;
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:ExclusiveGateway': function(parentGfx, element) {
|
2017-11-13 10:11:07 +00:00
|
|
|
var diamond = renderer('bpmn:Gateway')(parentGfx, element);
|
2014-04-24 10:25:04 +00:00
|
|
|
|
|
|
|
var pathData = pathMap.getScaledPath('GATEWAY_EXCLUSIVE', {
|
2014-04-28 09:48:19 +00:00
|
|
|
xScaleFactor: 0.4,
|
|
|
|
yScaleFactor: 0.4,
|
2014-07-16 14:15:23 +00:00
|
|
|
containerWidth: element.width,
|
|
|
|
containerHeight: element.height,
|
2014-04-24 10:25:04 +00:00
|
|
|
position: {
|
2014-04-28 09:48:19 +00:00
|
|
|
mx: 0.32,
|
|
|
|
my: 0.3
|
2014-04-24 10:25:04 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-06-07 06:46:45 +00:00
|
|
|
if ((getDi(element).isMarkerVisible)) {
|
2016-09-14 06:18:56 +00:00
|
|
|
drawPath(parentGfx, pathData, {
|
2014-07-09 08:02:34 +00:00
|
|
|
strokeWidth: 1,
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getStrokeColor(element, defaultStrokeColor),
|
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2014-07-09 08:02:34 +00:00
|
|
|
});
|
|
|
|
}
|
2014-04-24 10:25:04 +00:00
|
|
|
|
|
|
|
return diamond;
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:ComplexGateway': function(parentGfx, element) {
|
2017-11-13 10:11:07 +00:00
|
|
|
var diamond = renderer('bpmn:Gateway')(parentGfx, element);
|
2014-04-24 10:25:04 +00:00
|
|
|
|
|
|
|
var pathData = pathMap.getScaledPath('GATEWAY_COMPLEX', {
|
|
|
|
xScaleFactor: 0.5,
|
|
|
|
yScaleFactor:0.5,
|
2014-07-16 14:15:23 +00:00
|
|
|
containerWidth: element.width,
|
|
|
|
containerHeight: element.height,
|
2014-04-24 10:25:04 +00:00
|
|
|
position: {
|
|
|
|
mx: 0.46,
|
|
|
|
my: 0.26
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
/* complex path */ drawPath(parentGfx, pathData, {
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeWidth: 1,
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getStrokeColor(element, defaultStrokeColor),
|
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2014-04-24 10:25:04 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
return diamond;
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:ParallelGateway': function(parentGfx, element) {
|
2017-11-13 10:11:07 +00:00
|
|
|
var diamond = renderer('bpmn:Gateway')(parentGfx, element);
|
2014-04-24 10:25:04 +00:00
|
|
|
|
|
|
|
var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {
|
|
|
|
xScaleFactor: 0.6,
|
|
|
|
yScaleFactor:0.6,
|
2014-07-16 14:15:23 +00:00
|
|
|
containerWidth: element.width,
|
|
|
|
containerHeight: element.height,
|
2014-04-24 10:25:04 +00:00
|
|
|
position: {
|
|
|
|
mx: 0.46,
|
|
|
|
my: 0.2
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
/* parallel path */ drawPath(parentGfx, pathData, {
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeWidth: 1,
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getStrokeColor(element, defaultStrokeColor),
|
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2014-04-24 10:25:04 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
return diamond;
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:EventBasedGateway': function(parentGfx, element) {
|
2014-05-27 15:51:16 +00:00
|
|
|
|
2014-07-16 14:15:23 +00:00
|
|
|
var semantic = getSemantic(element);
|
2014-05-27 15:51:16 +00:00
|
|
|
|
2017-11-13 10:11:07 +00:00
|
|
|
var diamond = renderer('bpmn:Gateway')(parentGfx, element);
|
2014-04-24 10:25:04 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
/* outer circle path */ drawCircle(parentGfx, element.width, element.height, element.height * 0.20, {
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeWidth: 1,
|
2016-11-23 12:03:38 +00:00
|
|
|
fill: 'none',
|
2018-05-23 12:27:32 +00:00
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2014-04-24 10:25:04 +00:00
|
|
|
});
|
|
|
|
|
2014-05-27 15:51:16 +00:00
|
|
|
var type = semantic.eventGatewayType;
|
|
|
|
var instantiate = !!semantic.instantiate;
|
2014-04-24 10:25:04 +00:00
|
|
|
|
|
|
|
function drawEvent() {
|
|
|
|
|
|
|
|
var pathData = pathMap.getScaledPath('GATEWAY_EVENT_BASED', {
|
2014-05-06 09:30:03 +00:00
|
|
|
xScaleFactor: 0.18,
|
|
|
|
yScaleFactor: 0.18,
|
2014-07-16 14:15:23 +00:00
|
|
|
containerWidth: element.width,
|
|
|
|
containerHeight: element.height,
|
2014-04-24 10:25:04 +00:00
|
|
|
position: {
|
2014-05-06 09:30:03 +00:00
|
|
|
mx: 0.36,
|
|
|
|
my: 0.44
|
2014-04-24 10:25:04 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-11-23 12:03:38 +00:00
|
|
|
var attrs = {
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeWidth: 2,
|
2016-11-23 12:03:38 +00:00
|
|
|
fill: getFillColor(element, 'none'),
|
2018-05-23 12:27:32 +00:00
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2016-11-23 12:03:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* event path */ drawPath(parentGfx, pathData, attrs);
|
2014-04-24 10:25:04 +00:00
|
|
|
}
|
|
|
|
|
2014-05-27 15:51:16 +00:00
|
|
|
if (type === 'Parallel') {
|
2014-04-24 10:25:04 +00:00
|
|
|
|
|
|
|
var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {
|
|
|
|
xScaleFactor: 0.4,
|
|
|
|
yScaleFactor:0.4,
|
2014-07-16 14:15:23 +00:00
|
|
|
containerWidth: element.width,
|
|
|
|
containerHeight: element.height,
|
2014-04-24 10:25:04 +00:00
|
|
|
position: {
|
2014-04-28 09:48:19 +00:00
|
|
|
mx: 0.474,
|
|
|
|
my: 0.296
|
2014-04-24 10:25:04 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
var parallelPath = drawPath(parentGfx, pathData);
|
|
|
|
svgAttr(parallelPath, {
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeWidth: 1,
|
2014-05-27 16:48:38 +00:00
|
|
|
fill: 'none'
|
2014-04-24 10:25:04 +00:00
|
|
|
});
|
2014-05-28 21:19:41 +00:00
|
|
|
} else if (type === 'Exclusive') {
|
2014-04-24 10:25:04 +00:00
|
|
|
|
2014-05-28 21:19:41 +00:00
|
|
|
if (!instantiate) {
|
2016-09-14 06:18:56 +00:00
|
|
|
var innerCircle = drawCircle(parentGfx, element.width, element.height, element.height * 0.26);
|
|
|
|
svgAttr(innerCircle, {
|
2014-05-28 21:19:41 +00:00
|
|
|
strokeWidth: 1,
|
2016-11-23 12:03:38 +00:00
|
|
|
fill: 'none',
|
2018-05-23 12:27:32 +00:00
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2014-05-28 21:19:41 +00:00
|
|
|
});
|
|
|
|
}
|
2014-04-24 10:25:04 +00:00
|
|
|
|
|
|
|
drawEvent();
|
|
|
|
}
|
2014-04-25 14:14:36 +00:00
|
|
|
|
2014-04-24 10:25:04 +00:00
|
|
|
|
|
|
|
return diamond;
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:Gateway': function(parentGfx, element) {
|
2017-11-13 10:11:07 +00:00
|
|
|
var attrs = {
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getFillColor(element, defaultFillColor),
|
2017-11-13 10:11:07 +00:00
|
|
|
fillOpacity: DEFAULT_FILL_OPACITY,
|
2018-05-23 12:27:32 +00:00
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2017-11-13 10:11:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
return drawDiamond(parentGfx, element.width, element.height, attrs);
|
2014-03-20 16:51:05 +00:00
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:SequenceFlow': function(parentGfx, element) {
|
2014-07-30 14:06:32 +00:00
|
|
|
var pathData = createPathFromConnection(element);
|
2016-11-23 12:03:38 +00:00
|
|
|
|
2018-05-23 12:27:32 +00:00
|
|
|
var fill = getFillColor(element, defaultFillColor),
|
|
|
|
stroke = getStrokeColor(element, defaultStrokeColor);
|
2016-11-28 15:53:19 +00:00
|
|
|
|
2016-11-23 12:03:38 +00:00
|
|
|
var attrs = {
|
2015-05-06 11:13:56 +00:00
|
|
|
strokeLinejoin: 'round',
|
2016-11-28 15:53:19 +00:00
|
|
|
markerEnd: marker('sequenceflow-end', fill, stroke),
|
2018-05-23 12:27:32 +00:00
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2016-11-23 12:03:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
var path = drawPath(parentGfx, pathData, attrs);
|
2014-05-27 15:51:16 +00:00
|
|
|
|
2014-07-16 14:15:23 +00:00
|
|
|
var sequenceFlow = getSemantic(element);
|
2014-05-27 15:51:16 +00:00
|
|
|
|
2017-12-16 23:06:01 +00:00
|
|
|
var source;
|
2014-05-17 08:54:56 +00:00
|
|
|
|
2017-12-16 23:06:01 +00:00
|
|
|
if (element.source) {
|
|
|
|
source = element.source.businessObject;
|
|
|
|
|
|
|
|
// conditional flow marker
|
|
|
|
if (sequenceFlow.conditionExpression && source.$instanceOf('bpmn:Activity')) {
|
|
|
|
svgAttr(path, {
|
|
|
|
markerStart: marker('conditional-flow-marker', fill, stroke)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// default marker
|
|
|
|
if (source.default && (source.$instanceOf('bpmn:Gateway') || source.$instanceOf('bpmn:Activity')) &&
|
|
|
|
source.default === sequenceFlow) {
|
|
|
|
svgAttr(path, {
|
|
|
|
markerStart: marker('conditional-default-flow-marker', fill, stroke)
|
|
|
|
});
|
|
|
|
}
|
2014-05-19 14:22:55 +00:00
|
|
|
}
|
|
|
|
|
2014-05-27 15:51:16 +00:00
|
|
|
return path;
|
2014-03-20 16:51:05 +00:00
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:Association': function(parentGfx, element, attrs) {
|
2014-05-28 20:48:11 +00:00
|
|
|
|
2016-01-21 13:19:06 +00:00
|
|
|
var semantic = getSemantic(element);
|
|
|
|
|
2018-05-23 12:27:32 +00:00
|
|
|
var fill = getFillColor(element, defaultFillColor),
|
|
|
|
stroke = getStrokeColor(element, defaultStrokeColor);
|
2016-11-28 15:53:19 +00:00
|
|
|
|
2015-02-02 13:46:21 +00:00
|
|
|
attrs = assign({
|
2016-01-25 20:13:57 +00:00
|
|
|
strokeDasharray: '0.5, 5',
|
2015-05-06 11:13:56 +00:00
|
|
|
strokeLinecap: 'round',
|
2016-11-28 15:53:19 +00:00
|
|
|
strokeLinejoin: 'round',
|
2018-05-23 12:27:32 +00:00
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2014-05-28 20:48:11 +00:00
|
|
|
}, attrs || {});
|
2014-03-20 16:51:05 +00:00
|
|
|
|
2016-01-21 13:19:06 +00:00
|
|
|
if (semantic.associationDirection === 'One' ||
|
|
|
|
semantic.associationDirection === 'Both') {
|
2016-11-28 15:53:19 +00:00
|
|
|
attrs.markerEnd = marker('association-end', fill, stroke);
|
2016-01-21 13:19:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (semantic.associationDirection === 'Both') {
|
2016-11-28 15:53:19 +00:00
|
|
|
attrs.markerStart = marker('association-start', fill, stroke);
|
2016-01-21 13:19:06 +00:00
|
|
|
}
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
return drawLine(parentGfx, element.waypoints, attrs);
|
2014-03-20 16:51:05 +00:00
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:DataInputAssociation': function(parentGfx, element) {
|
2018-05-23 12:27:32 +00:00
|
|
|
var fill = getFillColor(element, defaultFillColor),
|
|
|
|
stroke = getStrokeColor(element, defaultStrokeColor);
|
2016-11-28 15:53:19 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
return renderer('bpmn:Association')(parentGfx, element, {
|
2016-11-28 15:53:19 +00:00
|
|
|
markerEnd: marker('association-end', fill, stroke)
|
2014-04-02 10:55:18 +00:00
|
|
|
});
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:DataOutputAssociation': function(parentGfx, element) {
|
2018-05-23 12:27:32 +00:00
|
|
|
var fill = getFillColor(element, defaultFillColor),
|
|
|
|
stroke = getStrokeColor(element, defaultStrokeColor);
|
2016-11-28 15:53:19 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
return renderer('bpmn:Association')(parentGfx, element, {
|
2016-11-28 15:53:19 +00:00
|
|
|
markerEnd: marker('association-end', fill, stroke)
|
2014-04-02 10:55:18 +00:00
|
|
|
});
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:MessageFlow': function(parentGfx, element) {
|
2014-03-20 16:51:05 +00:00
|
|
|
|
2015-02-25 17:30:16 +00:00
|
|
|
var semantic = getSemantic(element),
|
|
|
|
di = getDi(element);
|
2014-05-27 15:51:16 +00:00
|
|
|
|
2018-05-23 12:27:32 +00:00
|
|
|
var fill = getFillColor(element, defaultFillColor),
|
|
|
|
stroke = getStrokeColor(element, defaultStrokeColor);
|
2016-11-28 15:53:19 +00:00
|
|
|
|
2014-07-30 14:06:32 +00:00
|
|
|
var pathData = createPathFromConnection(element);
|
2016-11-23 12:03:38 +00:00
|
|
|
|
|
|
|
var attrs = {
|
2016-11-28 15:53:19 +00:00
|
|
|
markerEnd: marker('messageflow-end', fill, stroke),
|
|
|
|
markerStart: marker('messageflow-start', fill, stroke),
|
2015-05-06 11:13:56 +00:00
|
|
|
strokeDasharray: '10, 12',
|
2014-05-27 16:48:38 +00:00
|
|
|
strokeLinecap: 'round',
|
2015-05-06 11:13:56 +00:00
|
|
|
strokeLinejoin: 'round',
|
2016-11-23 12:03:38 +00:00
|
|
|
strokeWidth: '1.5px',
|
2018-05-23 12:27:32 +00:00
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2016-11-23 12:03:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
var path = drawPath(parentGfx, pathData, attrs);
|
2014-05-21 11:51:59 +00:00
|
|
|
|
2015-02-25 17:30:16 +00:00
|
|
|
if (semantic.messageRef) {
|
2014-05-27 15:51:16 +00:00
|
|
|
var midPoint = path.getPointAtLength(path.getTotalLength() / 2);
|
2014-05-21 11:51:59 +00:00
|
|
|
|
|
|
|
var markerPathData = pathMap.getScaledPath('MESSAGE_FLOW_MARKER', {
|
|
|
|
abspos: {
|
|
|
|
x: midPoint.x,
|
|
|
|
y: midPoint.y
|
|
|
|
}
|
|
|
|
});
|
2014-05-27 15:51:16 +00:00
|
|
|
|
|
|
|
var messageAttrs = { strokeWidth: 1 };
|
|
|
|
|
|
|
|
if (di.messageVisibleKind === 'initiating') {
|
2014-05-27 16:48:38 +00:00
|
|
|
messageAttrs.fill = 'white';
|
|
|
|
messageAttrs.stroke = 'black';
|
2014-05-27 15:51:16 +00:00
|
|
|
} else {
|
|
|
|
messageAttrs.fill = '#888';
|
2014-05-27 16:48:38 +00:00
|
|
|
messageAttrs.stroke = 'white';
|
2014-05-27 15:51:16 +00:00
|
|
|
}
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
drawPath(parentGfx, markerPathData, messageAttrs);
|
2014-05-21 11:51:59 +00:00
|
|
|
}
|
|
|
|
|
2014-05-27 15:51:16 +00:00
|
|
|
return path;
|
2014-04-02 10:55:18 +00:00
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:DataObject': function(parentGfx, element) {
|
2014-04-28 13:32:55 +00:00
|
|
|
var pathData = pathMap.getScaledPath('DATA_OBJECT_PATH', {
|
|
|
|
xScaleFactor: 1,
|
|
|
|
yScaleFactor: 1,
|
2014-07-16 14:15:23 +00:00
|
|
|
containerWidth: element.width,
|
|
|
|
containerHeight: element.height,
|
2014-04-28 13:32:55 +00:00
|
|
|
position: {
|
|
|
|
mx: 0.474,
|
|
|
|
my: 0.296
|
|
|
|
}
|
|
|
|
});
|
2014-04-02 10:55:18 +00:00
|
|
|
|
2016-11-23 12:03:38 +00:00
|
|
|
var elementObject = drawPath(parentGfx, pathData, {
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getFillColor(element, defaultFillColor),
|
2017-11-13 10:11:07 +00:00
|
|
|
fillOpacity: DEFAULT_FILL_OPACITY,
|
2018-05-23 12:27:32 +00:00
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2016-11-23 12:03:38 +00:00
|
|
|
});
|
2014-04-06 22:16:57 +00:00
|
|
|
|
2014-07-16 14:15:23 +00:00
|
|
|
var semantic = getSemantic(element);
|
2014-04-28 13:32:55 +00:00
|
|
|
|
2014-05-27 15:51:16 +00:00
|
|
|
if (isCollection(semantic)) {
|
2016-09-14 06:18:56 +00:00
|
|
|
renderDataItemCollection(parentGfx, element);
|
2014-04-04 10:01:42 +00:00
|
|
|
}
|
2014-04-02 10:55:18 +00:00
|
|
|
|
2014-07-16 14:15:23 +00:00
|
|
|
return elementObject;
|
2014-04-02 10:55:18 +00:00
|
|
|
},
|
2014-05-27 15:51:16 +00:00
|
|
|
'bpmn:DataObjectReference': as('bpmn:DataObject'),
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:DataInput': function(parentGfx, element) {
|
2014-04-02 10:55:18 +00:00
|
|
|
|
2014-04-28 13:32:55 +00:00
|
|
|
var arrowPathData = pathMap.getRawPath('DATA_ARROW');
|
2014-04-02 10:55:18 +00:00
|
|
|
|
2014-05-27 15:51:16 +00:00
|
|
|
// page
|
2016-09-14 06:18:56 +00:00
|
|
|
var elementObject = renderer('bpmn:DataObject')(parentGfx, element);
|
2014-05-27 15:51:16 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
/* input arrow path */ drawPath(parentGfx, arrowPathData, { strokeWidth: 1 });
|
2014-04-02 10:55:18 +00:00
|
|
|
|
2014-07-16 14:15:23 +00:00
|
|
|
return elementObject;
|
2014-04-02 10:55:18 +00:00
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:DataOutput': function(parentGfx, element) {
|
2014-04-28 13:32:55 +00:00
|
|
|
var arrowPathData = pathMap.getRawPath('DATA_ARROW');
|
2014-04-02 10:55:18 +00:00
|
|
|
|
2014-05-27 15:51:16 +00:00
|
|
|
// page
|
2016-09-14 06:18:56 +00:00
|
|
|
var elementObject = renderer('bpmn:DataObject')(parentGfx, element);
|
2014-05-27 15:51:16 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
/* output arrow path */ drawPath(parentGfx, arrowPathData, {
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeWidth: 1,
|
2014-05-27 16:48:38 +00:00
|
|
|
fill: 'black'
|
2014-04-02 10:55:18 +00:00
|
|
|
});
|
|
|
|
|
2014-07-16 14:15:23 +00:00
|
|
|
return elementObject;
|
2014-04-02 10:55:18 +00:00
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:DataStoreReference': function(parentGfx, element) {
|
2014-04-28 13:32:55 +00:00
|
|
|
var DATA_STORE_PATH = pathMap.getScaledPath('DATA_STORE', {
|
|
|
|
xScaleFactor: 1,
|
|
|
|
yScaleFactor: 1,
|
2014-07-16 14:15:23 +00:00
|
|
|
containerWidth: element.width,
|
|
|
|
containerHeight: element.height,
|
2014-04-28 13:32:55 +00:00
|
|
|
position: {
|
|
|
|
mx: 0,
|
|
|
|
my: 0.133
|
|
|
|
}
|
|
|
|
});
|
2014-04-02 10:55:18 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
var elementStore = drawPath(parentGfx, DATA_STORE_PATH, {
|
2014-05-27 16:48:38 +00:00
|
|
|
strokeWidth: 2,
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getFillColor(element, defaultFillColor),
|
2017-11-13 10:11:07 +00:00
|
|
|
fillOpacity: DEFAULT_FILL_OPACITY,
|
2018-05-23 12:27:32 +00:00
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2014-03-20 16:51:05 +00:00
|
|
|
});
|
2014-04-02 10:55:18 +00:00
|
|
|
|
2014-07-16 14:15:23 +00:00
|
|
|
return elementStore;
|
2014-04-03 12:01:56 +00:00
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:BoundaryEvent': function(parentGfx, element) {
|
2014-05-27 15:51:16 +00:00
|
|
|
|
2014-07-16 14:15:23 +00:00
|
|
|
var semantic = getSemantic(element),
|
2014-05-27 15:51:16 +00:00
|
|
|
cancel = semantic.cancelActivity;
|
|
|
|
|
2014-05-28 21:19:41 +00:00
|
|
|
var attrs = {
|
2016-11-23 12:03:38 +00:00
|
|
|
strokeWidth: 1,
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getFillColor(element, defaultFillColor),
|
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2014-05-28 21:19:41 +00:00
|
|
|
};
|
2014-05-27 16:48:38 +00:00
|
|
|
|
2014-05-28 21:19:41 +00:00
|
|
|
if (!cancel) {
|
|
|
|
attrs.strokeDasharray = '6';
|
2015-07-14 14:20:32 +00:00
|
|
|
attrs.strokeLinecap = 'round';
|
2014-05-28 21:19:41 +00:00
|
|
|
}
|
|
|
|
|
2018-04-09 11:02:40 +00:00
|
|
|
// apply fillOpacity
|
|
|
|
var outerAttrs = assign({}, attrs, {
|
|
|
|
fillOpacity: 1
|
|
|
|
});
|
|
|
|
|
|
|
|
// apply no-fill
|
|
|
|
var innerAttrs = assign({}, attrs, {
|
|
|
|
fill: 'none'
|
|
|
|
});
|
|
|
|
|
|
|
|
var outer = renderer('bpmn:Event')(parentGfx, element, outerAttrs);
|
|
|
|
|
|
|
|
/* inner path */ drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, innerAttrs);
|
2014-05-27 15:51:16 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
renderEventContent(element, parentGfx);
|
2014-05-27 15:51:16 +00:00
|
|
|
|
|
|
|
return outer;
|
2014-04-25 11:50:53 +00:00
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:Group': function(parentGfx, element) {
|
|
|
|
return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, {
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeWidth: 1,
|
|
|
|
strokeDasharray: '8,3,1,3',
|
2014-05-27 16:48:38 +00:00
|
|
|
fill: 'none',
|
2014-05-27 15:51:16 +00:00
|
|
|
pointerEvents: 'none'
|
2014-04-29 13:39:26 +00:00
|
|
|
});
|
2014-04-25 14:14:36 +00:00
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'label': function(parentGfx, element) {
|
2017-02-13 12:47:00 +00:00
|
|
|
return renderExternalLabel(parentGfx, element);
|
2014-05-02 09:17:25 +00:00
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:TextAnnotation': function(parentGfx, element) {
|
2014-08-05 11:57:32 +00:00
|
|
|
var style = {
|
|
|
|
'fill': 'none',
|
|
|
|
'stroke': 'none'
|
|
|
|
};
|
2016-11-04 14:28:12 +00:00
|
|
|
|
2016-12-01 12:17:44 +00:00
|
|
|
var textElement = drawRect(parentGfx, element.width, element.height, 0, 0, style);
|
2016-11-04 14:28:12 +00:00
|
|
|
|
2014-05-02 09:17:25 +00:00
|
|
|
var textPathData = pathMap.getScaledPath('TEXT_ANNOTATION', {
|
|
|
|
xScaleFactor: 1,
|
|
|
|
yScaleFactor: 1,
|
2016-12-01 12:17:44 +00:00
|
|
|
containerWidth: element.width,
|
|
|
|
containerHeight: element.height,
|
2014-05-02 09:17:25 +00:00
|
|
|
position: {
|
|
|
|
mx: 0.0,
|
|
|
|
my: 0.0
|
|
|
|
}
|
|
|
|
});
|
2018-05-23 12:27:32 +00:00
|
|
|
|
2016-11-23 12:03:38 +00:00
|
|
|
drawPath(parentGfx, textPathData, {
|
2018-05-23 12:27:32 +00:00
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2016-11-23 12:03:38 +00:00
|
|
|
});
|
2014-05-02 09:17:25 +00:00
|
|
|
|
2016-12-01 12:17:44 +00:00
|
|
|
var text = getSemantic(element).text || '';
|
2018-05-23 12:27:32 +00:00
|
|
|
renderLabel(parentGfx, text, {
|
|
|
|
box: element,
|
|
|
|
align: 'left-top',
|
|
|
|
padding: 5,
|
|
|
|
style: {
|
|
|
|
fill: getStrokeColor(element, defaultStrokeColor)
|
|
|
|
}
|
|
|
|
});
|
2014-05-02 09:17:25 +00:00
|
|
|
|
2014-08-05 11:57:32 +00:00
|
|
|
return textElement;
|
2014-05-05 15:22:43 +00:00
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'ParticipantMultiplicityMarker': function(parentGfx, element) {
|
2015-12-23 11:59:14 +00:00
|
|
|
var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
|
2014-05-18 10:20:11 +00:00
|
|
|
xScaleFactor: 1,
|
|
|
|
yScaleFactor: 1,
|
2014-07-16 14:15:23 +00:00
|
|
|
containerWidth: element.width,
|
|
|
|
containerHeight: element.height,
|
2014-05-18 10:20:11 +00:00
|
|
|
position: {
|
2014-07-16 14:15:23 +00:00
|
|
|
mx: ((element.width / 2) / element.width),
|
|
|
|
my: (element.height - 15) / element.height
|
2014-05-18 10:20:11 +00:00
|
|
|
}
|
|
|
|
});
|
2014-05-28 20:48:11 +00:00
|
|
|
|
2018-05-23 12:27:32 +00:00
|
|
|
drawMarker('participant-multiplicity', parentGfx, markerPath, {
|
|
|
|
strokeWidth: 1,
|
|
|
|
fill: getFillColor(element, defaultFillColor),
|
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
|
|
});
|
2014-05-18 10:20:11 +00:00
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'SubProcessMarker': function(parentGfx, element) {
|
|
|
|
var markerRect = drawRect(parentGfx, 14, 14, 0, {
|
2016-11-23 12:03:38 +00:00
|
|
|
strokeWidth: 1,
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getFillColor(element, defaultFillColor),
|
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2014-05-05 15:22:43 +00:00
|
|
|
});
|
2014-05-02 09:17:25 +00:00
|
|
|
|
2014-05-28 20:48:11 +00:00
|
|
|
// Process marker is placed in the middle of the box
|
|
|
|
// therefore fixed values can be used here
|
2016-09-14 06:18:56 +00:00
|
|
|
translate(markerRect, element.width / 2 - 7.5, element.height - 20);
|
2014-05-28 20:48:11 +00:00
|
|
|
|
2015-12-23 11:59:14 +00:00
|
|
|
var markerPath = pathMap.getScaledPath('MARKER_SUB_PROCESS', {
|
2014-05-05 15:22:43 +00:00
|
|
|
xScaleFactor: 1.5,
|
|
|
|
yScaleFactor: 1.5,
|
2014-07-16 14:15:23 +00:00
|
|
|
containerWidth: element.width,
|
|
|
|
containerHeight: element.height,
|
2014-05-05 15:22:43 +00:00
|
|
|
position: {
|
2014-07-16 14:15:23 +00:00
|
|
|
mx: (element.width / 2 - 7.5) / element.width,
|
|
|
|
my: (element.height - 20) / element.height
|
2014-05-05 15:22:43 +00:00
|
|
|
}
|
|
|
|
});
|
2014-05-28 20:48:11 +00:00
|
|
|
|
2016-11-23 12:03:38 +00:00
|
|
|
drawMarker('sub-process', parentGfx, markerPath, {
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getFillColor(element, defaultFillColor),
|
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2016-11-23 12:03:38 +00:00
|
|
|
});
|
2014-05-05 15:22:43 +00:00
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'ParallelMarker': function(parentGfx, element, position) {
|
2015-12-23 11:59:14 +00:00
|
|
|
var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
|
2014-05-05 15:22:43 +00:00
|
|
|
xScaleFactor: 1,
|
|
|
|
yScaleFactor: 1,
|
2014-07-16 14:15:23 +00:00
|
|
|
containerWidth: element.width,
|
|
|
|
containerHeight: element.height,
|
2014-05-05 15:22:43 +00:00
|
|
|
position: {
|
2014-07-16 14:15:23 +00:00
|
|
|
mx: ((element.width / 2 + position.parallel) / element.width),
|
|
|
|
my: (element.height - 20) / element.height
|
2014-05-05 15:22:43 +00:00
|
|
|
}
|
|
|
|
});
|
2015-12-23 11:59:14 +00:00
|
|
|
|
2018-05-23 12:27:32 +00:00
|
|
|
drawMarker('parallel', parentGfx, markerPath, {
|
|
|
|
fill: getFillColor(element, defaultFillColor),
|
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
|
|
});
|
2014-05-05 15:22:43 +00:00
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'SequentialMarker': function(parentGfx, element, position) {
|
2015-12-23 11:59:14 +00:00
|
|
|
var markerPath = pathMap.getScaledPath('MARKER_SEQUENTIAL', {
|
2014-05-05 15:22:43 +00:00
|
|
|
xScaleFactor: 1,
|
|
|
|
yScaleFactor: 1,
|
2014-07-16 14:15:23 +00:00
|
|
|
containerWidth: element.width,
|
|
|
|
containerHeight: element.height,
|
2014-05-05 15:22:43 +00:00
|
|
|
position: {
|
2014-07-16 14:15:23 +00:00
|
|
|
mx: ((element.width / 2 + position.seq) / element.width),
|
|
|
|
my: (element.height - 19) / element.height
|
2014-05-05 15:22:43 +00:00
|
|
|
}
|
|
|
|
});
|
2015-12-23 11:59:14 +00:00
|
|
|
|
2018-05-23 12:27:32 +00:00
|
|
|
drawMarker('sequential', parentGfx, markerPath, {
|
|
|
|
fill: getFillColor(element, defaultFillColor),
|
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
|
|
});
|
2014-05-05 15:22:43 +00:00
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'CompensationMarker': function(parentGfx, element, position) {
|
2015-12-23 11:59:14 +00:00
|
|
|
var markerMath = pathMap.getScaledPath('MARKER_COMPENSATION', {
|
2014-05-05 15:22:43 +00:00
|
|
|
xScaleFactor: 1,
|
|
|
|
yScaleFactor: 1,
|
2014-07-16 14:15:23 +00:00
|
|
|
containerWidth: element.width,
|
|
|
|
containerHeight: element.height,
|
2014-05-05 15:22:43 +00:00
|
|
|
position: {
|
2014-07-16 14:15:23 +00:00
|
|
|
mx: ((element.width / 2 + position.compensation) / element.width),
|
|
|
|
my: (element.height - 13) / element.height
|
2014-05-05 15:22:43 +00:00
|
|
|
}
|
|
|
|
});
|
2015-12-23 11:59:14 +00:00
|
|
|
|
2018-05-23 12:27:32 +00:00
|
|
|
drawMarker('compensation', parentGfx, markerMath, {
|
|
|
|
strokeWidth: 1,
|
|
|
|
fill: getFillColor(element, defaultFillColor),
|
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
|
|
});
|
2014-05-05 15:22:43 +00:00
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'LoopMarker': function(parentGfx, element, position) {
|
2015-12-23 11:59:14 +00:00
|
|
|
var markerPath = pathMap.getScaledPath('MARKER_LOOP', {
|
2014-05-05 15:22:43 +00:00
|
|
|
xScaleFactor: 1,
|
|
|
|
yScaleFactor: 1,
|
2014-07-16 14:15:23 +00:00
|
|
|
containerWidth: element.width,
|
|
|
|
containerHeight: element.height,
|
2014-05-05 15:22:43 +00:00
|
|
|
position: {
|
2014-07-16 14:15:23 +00:00
|
|
|
mx: ((element.width / 2 + position.loop) / element.width),
|
|
|
|
my: (element.height - 7) / element.height
|
2014-05-05 15:22:43 +00:00
|
|
|
}
|
|
|
|
});
|
2014-05-27 15:51:16 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
drawMarker('loop', parentGfx, markerPath, {
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeWidth: 1,
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getFillColor(element, defaultFillColor),
|
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor),
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeLinecap: 'round',
|
|
|
|
strokeMiterlimit: 0.5
|
2014-05-05 15:22:43 +00:00
|
|
|
});
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'AdhocMarker': function(parentGfx, element, position) {
|
2015-12-23 11:59:14 +00:00
|
|
|
var markerPath = pathMap.getScaledPath('MARKER_ADHOC', {
|
2014-05-05 15:22:43 +00:00
|
|
|
xScaleFactor: 1,
|
|
|
|
yScaleFactor: 1,
|
2014-07-16 14:15:23 +00:00
|
|
|
containerWidth: element.width,
|
|
|
|
containerHeight: element.height,
|
2014-05-05 15:22:43 +00:00
|
|
|
position: {
|
2014-07-16 14:15:23 +00:00
|
|
|
mx: ((element.width / 2 + position.adhoc) / element.width),
|
|
|
|
my: (element.height - 15) / element.height
|
2014-05-05 15:22:43 +00:00
|
|
|
}
|
|
|
|
});
|
2014-05-27 15:51:16 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
drawMarker('adhoc', parentGfx, markerPath, {
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeWidth: 1,
|
2018-05-23 12:27:32 +00:00
|
|
|
fill: getStrokeColor(element, defaultStrokeColor),
|
|
|
|
stroke: getStrokeColor(element, defaultStrokeColor)
|
2014-05-05 15:22:43 +00:00
|
|
|
});
|
|
|
|
}
|
2014-03-20 15:18:23 +00:00
|
|
|
};
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
function attachTaskMarkers(parentGfx, element, taskMarkers) {
|
2014-07-16 14:15:23 +00:00
|
|
|
var obj = getSemantic(element);
|
2014-05-05 15:22:43 +00:00
|
|
|
|
2016-12-20 15:54:45 +00:00
|
|
|
var subprocess = taskMarkers && taskMarkers.indexOf('SubProcessMarker') !== -1;
|
2014-05-05 15:22:43 +00:00
|
|
|
var position;
|
|
|
|
|
2014-05-27 15:51:16 +00:00
|
|
|
if (subprocess) {
|
2014-05-05 15:22:43 +00:00
|
|
|
position = {
|
|
|
|
seq: -21,
|
|
|
|
parallel: -22,
|
|
|
|
compensation: -42,
|
|
|
|
loop: -18,
|
|
|
|
adhoc: 10
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
position = {
|
|
|
|
seq: -3,
|
|
|
|
parallel: -6,
|
|
|
|
compensation: -27,
|
|
|
|
loop: 0,
|
|
|
|
adhoc: 10
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2015-02-02 13:46:21 +00:00
|
|
|
forEach(taskMarkers, function(marker) {
|
2016-09-14 06:18:56 +00:00
|
|
|
renderer(marker)(parentGfx, element, position);
|
2014-05-05 15:22:43 +00:00
|
|
|
});
|
|
|
|
|
2016-01-20 17:30:09 +00:00
|
|
|
if (obj.isForCompensation) {
|
2016-09-14 06:18:56 +00:00
|
|
|
renderer('CompensationMarker')(parentGfx, element, position);
|
2016-01-20 17:30:09 +00:00
|
|
|
}
|
|
|
|
|
2014-05-27 15:51:16 +00:00
|
|
|
if (obj.$type === 'bpmn:AdHocSubProcess') {
|
2016-09-14 06:18:56 +00:00
|
|
|
renderer('AdhocMarker')(parentGfx, element, position);
|
2014-05-05 15:22:43 +00:00
|
|
|
}
|
2016-01-20 17:30:09 +00:00
|
|
|
|
|
|
|
var loopCharacteristics = obj.loopCharacteristics,
|
|
|
|
isSequential = loopCharacteristics && loopCharacteristics.isSequential;
|
|
|
|
|
|
|
|
if (loopCharacteristics) {
|
|
|
|
|
|
|
|
if (isSequential === undefined) {
|
2016-09-14 06:18:56 +00:00
|
|
|
renderer('LoopMarker')(parentGfx, element, position);
|
2016-01-20 17:30:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (isSequential === false) {
|
2016-09-14 06:18:56 +00:00
|
|
|
renderer('ParallelMarker')(parentGfx, element, position);
|
2016-01-20 17:30:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (isSequential === true) {
|
2016-09-14 06:18:56 +00:00
|
|
|
renderer('SequentialMarker')(parentGfx, element, position);
|
2016-01-20 17:30:09 +00:00
|
|
|
}
|
2014-05-05 15:22:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
function renderDataItemCollection(parentGfx, element) {
|
2014-05-27 15:51:16 +00:00
|
|
|
|
2014-07-16 14:15:23 +00:00
|
|
|
var yPosition = (element.height - 16) / element.height;
|
2014-05-27 15:51:16 +00:00
|
|
|
|
|
|
|
var pathData = pathMap.getScaledPath('DATA_OBJECT_COLLECTION_PATH', {
|
|
|
|
xScaleFactor: 1,
|
|
|
|
yScaleFactor: 1,
|
2014-07-16 14:15:23 +00:00
|
|
|
containerWidth: element.width,
|
|
|
|
containerHeight: element.height,
|
2014-05-27 15:51:16 +00:00
|
|
|
position: {
|
|
|
|
mx: 0.451,
|
|
|
|
my: yPosition
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
/* collection path */ drawPath(parentGfx, pathData, {
|
2014-05-27 15:51:16 +00:00
|
|
|
strokeWidth: 2
|
|
|
|
});
|
|
|
|
}
|
2017-11-10 20:07:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
// extension API, use at your own risk
|
|
|
|
this._drawPath = drawPath;
|
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
}
|
2014-05-27 15:51:16 +00:00
|
|
|
|
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
inherits(BpmnRenderer, BaseRenderer);
|
2014-04-03 12:01:56 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
BpmnRenderer.$inject = [
|
2018-05-24 13:02:02 +00:00
|
|
|
'config.bpmnRenderer',
|
2018-04-02 19:01:53 +00:00
|
|
|
'eventBus',
|
|
|
|
'styles',
|
|
|
|
'pathMap',
|
2018-05-24 11:42:40 +00:00
|
|
|
'canvas',
|
|
|
|
'textRenderer'
|
2018-04-02 19:01:53 +00:00
|
|
|
];
|
2014-05-02 16:20:36 +00:00
|
|
|
|
2014-04-03 12:01:56 +00:00
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
BpmnRenderer.prototype.canRender = function(element) {
|
|
|
|
return is(element, 'bpmn:BaseElement');
|
|
|
|
};
|
2014-04-03 12:01:56 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
BpmnRenderer.prototype.drawShape = function(parentGfx, element) {
|
2015-09-02 13:13:18 +00:00
|
|
|
var type = element.type;
|
|
|
|
var h = this.handlers[type];
|
2015-04-17 14:40:45 +00:00
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
/* jshint -W040 */
|
2016-09-14 06:18:56 +00:00
|
|
|
return h(parentGfx, element);
|
2015-09-02 13:13:18 +00:00
|
|
|
};
|
2015-04-17 14:40:45 +00:00
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
BpmnRenderer.prototype.drawConnection = function(parentGfx, element) {
|
2015-09-02 13:13:18 +00:00
|
|
|
var type = element.type;
|
|
|
|
var h = this.handlers[type];
|
2015-04-17 14:40:45 +00:00
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
/* jshint -W040 */
|
2016-09-14 06:18:56 +00:00
|
|
|
return h(parentGfx, element);
|
2015-09-02 13:13:18 +00:00
|
|
|
};
|
2015-04-17 14:40:45 +00:00
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
BpmnRenderer.prototype.getShapePath = function(element) {
|
2015-04-17 14:40:45 +00:00
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
if (is(element, 'bpmn:Event')) {
|
|
|
|
return getCirclePath(element);
|
|
|
|
}
|
2015-04-17 14:40:45 +00:00
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
if (is(element, 'bpmn:Activity')) {
|
|
|
|
return getRoundRectPath(element, TASK_BORDER_RADIUS);
|
2015-04-17 14:40:45 +00:00
|
|
|
}
|
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
if (is(element, 'bpmn:Gateway')) {
|
|
|
|
return getDiamondPath(element);
|
2015-04-17 14:40:45 +00:00
|
|
|
}
|
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
return getRectPath(element);
|
|
|
|
};
|