2014-05-27 15:51:16 +00:00
|
|
|
'use strict';
|
|
|
|
|
2015-03-23 14:15:32 +00:00
|
|
|
var inherits = require('inherits'),
|
2015-02-02 13:46:21 +00:00
|
|
|
isObject = require('lodash/lang/isObject'),
|
|
|
|
assign = require('lodash/object/assign'),
|
|
|
|
forEach = require('lodash/collection/forEach'),
|
|
|
|
every = require('lodash/collection/every'),
|
|
|
|
includes = require('lodash/collection/includes'),
|
|
|
|
some = require('lodash/collection/some');
|
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
var BaseRenderer = require('diagram-js/lib/draw/BaseRenderer'),
|
2015-02-02 13:46:21 +00:00
|
|
|
TextUtil = require('diagram-js/lib/util/Text'),
|
2015-04-27 14:50:09 +00:00
|
|
|
DiUtil = require('../util/DiUtil');
|
2014-03-20 16:51:05 +00:00
|
|
|
|
2016-11-23 12:03:38 +00:00
|
|
|
var getBusinessObject = require('../util/ModelUtil').getBusinessObject,
|
|
|
|
is = require('../util/ModelUtil').is;
|
2014-03-20 16:51:05 +00:00
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
var RenderUtil = require('diagram-js/lib/util/RenderUtil');
|
2014-05-27 15:51:16 +00:00
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
var componentsToPath = RenderUtil.componentsToPath,
|
|
|
|
createLine = RenderUtil.createLine;
|
2014-03-25 13:08:11 +00:00
|
|
|
|
2016-11-08 13:24:26 +00:00
|
|
|
var domQuery = require('min-dom/lib/query');
|
2016-09-14 06:18:56 +00:00
|
|
|
|
|
|
|
var svgAppend = require('tiny-svg/lib/append'),
|
|
|
|
svgAttr = require('tiny-svg/lib/attr'),
|
2016-11-08 13:24:26 +00:00
|
|
|
svgCreate = require('tiny-svg/lib/create'),
|
|
|
|
svgClasses = require('tiny-svg/lib/classes');
|
2016-09-14 06:18:56 +00:00
|
|
|
|
|
|
|
var rotate = require('diagram-js/lib/util/SvgTransformUtil').rotate,
|
|
|
|
transform = require('diagram-js/lib/util/SvgTransformUtil').transform,
|
|
|
|
translate = require('diagram-js/lib/util/SvgTransformUtil').translate;
|
2014-03-20 15:18:23 +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
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
var LABEL_STYLE = {
|
|
|
|
fontFamily: 'Arial, sans-serif',
|
2016-09-14 06:18:56 +00:00
|
|
|
fontSize: 12
|
2015-09-02 13:13:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
function BpmnRenderer(eventBus, styles, pathMap, canvas, 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
|
|
|
|
2014-09-09 13:20:30 +00:00
|
|
|
var textUtil = new TextUtil({
|
2014-05-06 08:15:38 +00:00
|
|
|
style: LABEL_STYLE,
|
|
|
|
size: { width: 100 }
|
2014-04-25 14:14:36 +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) {
|
|
|
|
var id = type + '-' + fill + '-' + stroke;
|
2016-09-14 06:18:56 +00:00
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
if (!includes(markers, id)) {
|
|
|
|
createMarker(type, fill, stroke);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 'url(#' + id + ')';
|
|
|
|
}
|
2016-09-14 06:18:56 +00:00
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
function createMarker(type, fill, stroke) {
|
|
|
|
var id = type + '-' + fill + '-' + stroke;
|
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
|
|
|
});
|
|
|
|
|
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) {
|
|
|
|
var text = textUtil.createText(parentGfx, label || '', options);
|
2016-11-08 13:24:26 +00:00
|
|
|
svgClasses(text).add('djs-label');
|
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,
|
|
|
|
padding: 5,
|
|
|
|
style: {
|
|
|
|
fill: getStrokeColor(element)
|
|
|
|
}
|
|
|
|
});
|
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
|
|
|
|
};
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
return renderLabel(parentGfx, semantic.name, { box: box, style: { fontSize: '11px' } });
|
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, {
|
2014-07-16 14:15:23 +00:00
|
|
|
box: { height: 30, width: element.height },
|
2016-11-23 12:03:38 +00:00
|
|
|
align: 'center-middle',
|
|
|
|
style: {
|
|
|
|
fill: getStrokeColor(element)
|
|
|
|
}
|
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) {
|
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 = {
|
|
|
|
fill: getFillColor(element),
|
|
|
|
stroke: getStrokeColor(element)
|
|
|
|
};
|
|
|
|
|
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',
|
|
|
|
strokeLinecap: 'round'
|
|
|
|
};
|
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
|
|
|
|
2016-11-23 12:03:38 +00:00
|
|
|
var fill = isThrowing ? getStrokeColor(element) : getFillColor(element);
|
|
|
|
var stroke = isThrowing ? getFillColor(element) : getStrokeColor(element);
|
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,
|
|
|
|
fill: getFillColor(element),
|
|
|
|
stroke: getStrokeColor(element)
|
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',
|
|
|
|
stroke: getStrokeColor(element)
|
2014-04-03 12:01:56 +00:00
|
|
|
});
|
|
|
|
|
2016-06-07 06:46:45 +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 + ')',
|
|
|
|
stroke: getStrokeColor(element)
|
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
|
|
|
|
2016-11-23 12:03:38 +00:00
|
|
|
var fill = isThrowing ? getStrokeColor(event) : '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,
|
|
|
|
stroke: getStrokeColor(event)
|
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,
|
|
|
|
stroke: getStrokeColor(event)
|
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
|
|
|
|
2016-11-23 12:03:38 +00:00
|
|
|
var fill = isThrowing ? getStrokeColor(event) : '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,
|
|
|
|
stroke: getStrokeColor(event)
|
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
|
|
|
|
2016-11-23 12:03:38 +00:00
|
|
|
var fill = isThrowing ? getStrokeColor(event) : '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,
|
|
|
|
stroke: getStrokeColor(event)
|
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
|
|
|
|
2014-05-27 16:48:38 +00:00
|
|
|
var fill = isThrowing ? 'black' : '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,
|
|
|
|
fill: fill
|
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
|
|
|
|
2016-11-23 12:03:38 +00:00
|
|
|
var fill = isThrowing ? getStrokeColor(event) : '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,
|
|
|
|
stroke: getStrokeColor(event)
|
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
|
|
|
|
2016-11-23 12:03:38 +00:00
|
|
|
var fill = isThrowing ? getStrokeColor(event) : '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,
|
|
|
|
stroke: getStrokeColor(event)
|
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
|
|
|
|
2014-05-27 16:48:38 +00:00
|
|
|
var fill = isThrowing ? 'black' : '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,
|
|
|
|
fill: getStrokeColor(event),
|
|
|
|
stroke: getStrokeColor(event)
|
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,
|
|
|
|
fill: getFillColor(element),
|
|
|
|
stroke: getStrokeColor(element)
|
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,
|
2016-11-23 12:03:38 +00:00
|
|
|
fill: getStrokeColor(element),
|
|
|
|
stroke: getStrokeColor(element)
|
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,
|
|
|
|
fill: getFillColor(element),
|
|
|
|
stroke: getStrokeColor(element)
|
|
|
|
});
|
|
|
|
|
|
|
|
/* inner */ drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
|
|
|
|
strokeWidth: 1,
|
|
|
|
fill: getFillColor(element, 'none'),
|
|
|
|
stroke: getStrokeColor(element)
|
|
|
|
});
|
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) {
|
|
|
|
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 = {
|
|
|
|
fill: getFillColor(element),
|
|
|
|
stroke: getStrokeColor(element)
|
|
|
|
};
|
|
|
|
|
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,
|
2016-11-23 12:03:38 +00:00
|
|
|
fill: getFillColor(element),
|
|
|
|
stroke: getStrokeColor(element)
|
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,
|
2016-11-23 12:03:38 +00:00
|
|
|
fill: getFillColor(element)
|
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,
|
2016-11-23 12:03:38 +00:00
|
|
|
fill: getFillColor(element),
|
|
|
|
stroke: getStrokeColor(element)
|
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,
|
2016-11-23 12:03:38 +00:00
|
|
|
fill: getFillColor(element),
|
|
|
|
stroke: getStrokeColor(element)
|
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,
|
2016-11-23 12:03:38 +00:00
|
|
|
fill: getFillColor(element),
|
|
|
|
stroke: getStrokeColor(element)
|
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,
|
2016-11-23 12:03:38 +00:00
|
|
|
fill: getStrokeColor(element),
|
|
|
|
stroke: getStrokeColor(element)
|
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,
|
|
|
|
fill: getFillColor(element),
|
|
|
|
stroke: getStrokeColor(element)
|
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,
|
2016-12-05 12:20:15 +00:00
|
|
|
fill: getStrokeColor(element),
|
|
|
|
stroke: getFillColor(element)
|
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,
|
|
|
|
fill: getFillColor(element),
|
|
|
|
stroke: getStrokeColor(element)
|
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,
|
|
|
|
stroke: getStrokeColor(element)
|
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'),
|
|
|
|
stroke: getStrokeColor(element)
|
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,
|
|
|
|
stroke: getStrokeColor(element)
|
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({
|
|
|
|
fillOpacity: 0.95,
|
|
|
|
fill: getFillColor(element),
|
|
|
|
stroke: getStrokeColor(element)
|
|
|
|
}, 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
|
|
|
|
2015-08-04 15:52:43 +00:00
|
|
|
var expanded = DiUtil.isExpanded(element);
|
2014-04-25 14:14:36 +00:00
|
|
|
|
2015-08-04 15:52:43 +00:00
|
|
|
var isEventSubProcess = DiUtil.isEventSubProcess(element);
|
2014-06-17 09:48:23 +00:00
|
|
|
|
2014-05-27 15:51:16 +00:00
|
|
|
if (isEventSubProcess) {
|
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' ], {
|
|
|
|
stroke: getStrokeColor(element)
|
|
|
|
});
|
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 = {
|
2016-03-16 10:27:09 +00:00
|
|
|
fillOpacity: 0.95,
|
2016-11-23 12:03:38 +00:00
|
|
|
fill: getFillColor(element),
|
|
|
|
stroke: getStrokeColor(element)
|
|
|
|
};
|
|
|
|
|
|
|
|
var lane = renderer('bpmn:Lane')(parentGfx, element, attrs);
|
2014-05-02 15:03:03 +00:00
|
|
|
|
2015-04-27 14:50:09 +00:00
|
|
|
var expandedPool = DiUtil.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
|
|
|
], {
|
|
|
|
stroke: getStrokeColor(element)
|
|
|
|
});
|
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: {
|
|
|
|
fill: getStrokeColor(element)
|
|
|
|
}
|
|
|
|
});
|
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({
|
|
|
|
fill: getFillColor(element),
|
|
|
|
stroke: getStrokeColor(element)
|
|
|
|
}, 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) {
|
2016-11-23 12:03:38 +00:00
|
|
|
var attrs = {
|
|
|
|
fill: getFillColor(element),
|
|
|
|
stroke: getStrokeColor(element)
|
|
|
|
};
|
|
|
|
|
|
|
|
var diamond = drawDiamond(parentGfx, element.width, element.height, attrs);
|
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,
|
2016-11-23 12:03:38 +00:00
|
|
|
fill: getFillColor(element),
|
|
|
|
stroke: getStrokeColor(element)
|
2014-04-24 10:25:04 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
return diamond;
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:ExclusiveGateway': function(parentGfx, element) {
|
2016-11-23 12:03:38 +00:00
|
|
|
var attrs = {
|
|
|
|
fill: getFillColor(element),
|
|
|
|
stroke: getStrokeColor(element)
|
|
|
|
};
|
|
|
|
|
|
|
|
var diamond = drawDiamond(parentGfx, element.width, element.height, attrs);
|
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,
|
2016-11-23 12:03:38 +00:00
|
|
|
fill: getStrokeColor(element),
|
|
|
|
stroke: getStrokeColor(element)
|
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) {
|
2016-11-23 12:03:38 +00:00
|
|
|
var attrs = {
|
|
|
|
fill: getFillColor(element),
|
|
|
|
stroke: getStrokeColor(element)
|
|
|
|
};
|
|
|
|
|
|
|
|
var diamond = drawDiamond(parentGfx, element.width, element.height, attrs);
|
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,
|
2016-11-23 12:03:38 +00:00
|
|
|
fill: getStrokeColor(element),
|
|
|
|
stroke: getStrokeColor(element)
|
2014-04-24 10:25:04 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
return diamond;
|
|
|
|
},
|
2016-09-14 06:18:56 +00:00
|
|
|
'bpmn:ParallelGateway': function(parentGfx, element) {
|
2016-11-23 12:03:38 +00:00
|
|
|
var attrs = {
|
|
|
|
fill: getFillColor(element),
|
|
|
|
stroke: getStrokeColor(element)
|
|
|
|
};
|
|
|
|
|
|
|
|
var diamond = drawDiamond(parentGfx, element.width, element.height, attrs);
|
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,
|
2016-11-23 12:03:38 +00:00
|
|
|
fill: getStrokeColor(element),
|
|
|
|
stroke: getStrokeColor(element)
|
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
|
|
|
|
2016-11-23 12:03:38 +00:00
|
|
|
var attrs = {
|
|
|
|
fill: getFillColor(element),
|
|
|
|
stroke: getStrokeColor(element)
|
|
|
|
};
|
|
|
|
|
|
|
|
var diamond = drawDiamond(parentGfx, element.width, element.height, attrs);
|
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',
|
|
|
|
stroke: getStrokeColor(element)
|
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'),
|
|
|
|
stroke: getStrokeColor(element)
|
|
|
|
};
|
|
|
|
|
|
|
|
/* 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',
|
|
|
|
stroke: getStrokeColor(element)
|
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) {
|
|
|
|
return drawDiamond(parentGfx, element.width, element.height);
|
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
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
var fill = getFillColor(element),
|
|
|
|
stroke = getStrokeColor(element);
|
|
|
|
|
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),
|
2016-11-23 12:03:38 +00:00
|
|
|
stroke: getStrokeColor(element)
|
|
|
|
};
|
|
|
|
|
|
|
|
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-07-23 16:53:33 +00:00
|
|
|
var source = element.source.businessObject;
|
2014-05-27 15:51:16 +00:00
|
|
|
|
|
|
|
// conditional flow marker
|
2015-09-30 06:28:28 +00:00
|
|
|
if (sequenceFlow.conditionExpression && source.$instanceOf('bpmn:Activity')) {
|
2016-09-14 06:18:56 +00:00
|
|
|
svgAttr(path, {
|
2016-11-28 15:53:19 +00:00
|
|
|
markerStart: marker('conditional-flow-marker', fill, stroke)
|
2014-05-17 08:54:56 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2014-05-27 15:51:16 +00:00
|
|
|
// default marker
|
2016-01-07 08:03:20 +00:00
|
|
|
if (source.default && (source.$instanceOf('bpmn:Gateway') || source.$instanceOf('bpmn:Activity')) &&
|
|
|
|
source.default === sequenceFlow) {
|
2016-09-14 06:18:56 +00:00
|
|
|
svgAttr(path, {
|
2016-11-28 15:53:19 +00:00
|
|
|
markerStart: marker('conditional-default-flow-marker', fill, stroke)
|
2014-05-27 15:51:16 +00:00
|
|
|
});
|
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);
|
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
var fill = getFillColor(element),
|
|
|
|
stroke = getStrokeColor(element);
|
|
|
|
|
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',
|
|
|
|
stroke: getStrokeColor(element)
|
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) {
|
2016-11-28 15:53:19 +00:00
|
|
|
var fill = getFillColor(element),
|
|
|
|
stroke = getStrokeColor(element);
|
|
|
|
|
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) {
|
2016-11-28 15:53:19 +00:00
|
|
|
var fill = getFillColor(element),
|
|
|
|
stroke = getStrokeColor(element);
|
|
|
|
|
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
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
var fill = getFillColor(element),
|
|
|
|
stroke = getStrokeColor(element);
|
|
|
|
|
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',
|
|
|
|
stroke: getStrokeColor(element)
|
|
|
|
};
|
|
|
|
|
|
|
|
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, {
|
|
|
|
fill: getFillColor(element),
|
|
|
|
stroke: getStrokeColor(element)
|
|
|
|
});
|
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,
|
2016-11-23 12:03:38 +00:00
|
|
|
fill: getFillColor(element),
|
|
|
|
stroke: getStrokeColor(element)
|
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,
|
|
|
|
fill: getFillColor(element),
|
|
|
|
stroke: getStrokeColor(element)
|
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
|
|
|
}
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
var outer = renderer('bpmn:Event')(parentGfx, element, attrs);
|
|
|
|
/* inner path */ drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, assign(attrs, { fill: 'none' }));
|
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) {
|
2016-09-01 16:06:50 +00:00
|
|
|
// Update external label size and bounds during rendering when
|
|
|
|
// we have the actual rendered bounds anyway.
|
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
var textElement = renderExternalLabel(parentGfx, element);
|
2016-09-01 16:06:50 +00:00
|
|
|
|
2016-09-27 12:32:22 +00:00
|
|
|
var textBBox;
|
|
|
|
|
|
|
|
try {
|
|
|
|
textBBox = textElement.getBBox();
|
|
|
|
} catch (e) {
|
|
|
|
textBBox = { width: 0, height: 0, x: 0 };
|
|
|
|
}
|
2016-09-01 16:06:50 +00:00
|
|
|
|
|
|
|
// update element.x so that the layouted text is still
|
|
|
|
// center alligned (newX = oldMidX - newWidth / 2)
|
2016-09-27 15:01:05 +00:00
|
|
|
element.x = Math.ceil(element.x + element.width / 2) - Math.ceil((textBBox.width / 2));
|
2016-09-01 16:06:50 +00:00
|
|
|
|
|
|
|
// take element width, height from actual bounds
|
|
|
|
element.width = Math.ceil(textBBox.width);
|
|
|
|
element.height = Math.ceil(textBBox.height);
|
|
|
|
|
|
|
|
// compensate bounding box x
|
2016-09-14 06:18:56 +00:00
|
|
|
svgAttr(textElement, {
|
2016-09-01 16:06:50 +00:00
|
|
|
transform: 'translate(' + (-1 * textBBox.x) + ',0)'
|
|
|
|
});
|
|
|
|
|
|
|
|
return textElement;
|
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
|
|
|
|
}
|
|
|
|
});
|
2016-11-23 12:03:38 +00:00
|
|
|
drawPath(parentGfx, textPathData, {
|
|
|
|
stroke: getStrokeColor(element)
|
|
|
|
});
|
2014-05-02 09:17:25 +00:00
|
|
|
|
2016-12-01 12:17:44 +00:00
|
|
|
var text = getSemantic(element).text || '';
|
|
|
|
renderLabel(parentGfx, text, { box: element, align: 'left-middle', padding: 5 });
|
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
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
drawMarker('participant-multiplicity', parentGfx, markerPath);
|
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,
|
|
|
|
fill: getFillColor(element),
|
|
|
|
stroke: getStrokeColor(element)
|
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, {
|
|
|
|
fill: getFillColor(element),
|
|
|
|
stroke: getStrokeColor(element)
|
|
|
|
});
|
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
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
drawMarker('parallel', parentGfx, markerPath);
|
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
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
drawMarker('sequential', parentGfx, markerPath);
|
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
|
|
|
|
2016-09-14 06:18:56 +00:00
|
|
|
drawMarker('compensation', parentGfx, markerMath, { strokeWidth: 1 });
|
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,
|
2014-05-27 16:48:38 +00:00
|
|
|
fill: 'none',
|
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,
|
2014-05-27 16:48:38 +00:00
|
|
|
fill: 'black'
|
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
|
|
|
|
2015-02-02 13:46:21 +00:00
|
|
|
var subprocess = includes(taskMarkers, 'SubProcessMarker');
|
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
|
|
|
|
});
|
|
|
|
}
|
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
|
|
|
|
2016-11-28 15:53:19 +00:00
|
|
|
BpmnRenderer.$inject = [ 'eventBus', 'styles', 'pathMap', 'canvas' ];
|
2014-05-05 07:18:46 +00:00
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
module.exports = BpmnRenderer;
|
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);
|
|
|
|
};
|
2015-04-17 14:40:45 +00:00
|
|
|
|
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
///////// helper functions /////////////////////////////
|
2015-04-17 14:40:45 +00:00
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
/**
|
|
|
|
* Checks if eventDefinition of the given element matches with semantic type.
|
|
|
|
*
|
|
|
|
* @return {boolean} true if element is of the given semantic type
|
|
|
|
*/
|
|
|
|
function isTypedEvent(event, eventDefinitionType, filter) {
|
2015-04-17 14:40:45 +00:00
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
function matches(definition, filter) {
|
|
|
|
return every(filter, function(val, key) {
|
|
|
|
|
|
|
|
// we want a == conversion here, to be able to catch
|
|
|
|
// undefined == false and friends
|
|
|
|
/* jshint -W116 */
|
|
|
|
return definition[key] == val;
|
|
|
|
});
|
2015-04-17 14:40:45 +00:00
|
|
|
}
|
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
return some(event.eventDefinitions, function(definition) {
|
|
|
|
return definition.$type === eventDefinitionType && matches(event, filter);
|
|
|
|
});
|
|
|
|
}
|
2015-04-17 14:40:45 +00:00
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
function isThrowEvent(event) {
|
|
|
|
return (event.$type === 'bpmn:IntermediateThrowEvent') || (event.$type === 'bpmn:EndEvent');
|
|
|
|
}
|
2015-04-17 14:40:45 +00:00
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
function isCollection(element) {
|
|
|
|
return element.isCollection ||
|
|
|
|
(element.elementObjectRef && element.elementObjectRef.isCollection);
|
|
|
|
}
|
2015-04-17 14:40:45 +00:00
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
function getDi(element) {
|
|
|
|
return element.businessObject.di;
|
|
|
|
}
|
2015-04-17 14:40:45 +00:00
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
function getSemantic(element) {
|
|
|
|
return element.businessObject;
|
|
|
|
}
|
2015-04-17 14:40:45 +00:00
|
|
|
|
|
|
|
|
2014-03-20 16:51:05 +00:00
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
/////// cropping path customizations /////////////////////////
|
|
|
|
|
|
|
|
function getCirclePath(shape) {
|
2015-04-17 14:40:45 +00:00
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
var cx = shape.x + shape.width / 2,
|
|
|
|
cy = shape.y + shape.height / 2,
|
|
|
|
radius = shape.width / 2;
|
|
|
|
|
|
|
|
var circlePath = [
|
|
|
|
['M', cx, cy],
|
|
|
|
['m', 0, -radius],
|
|
|
|
['a', radius, radius, 0, 1, 1, 0, 2 * radius],
|
|
|
|
['a', radius, radius, 0, 1, 1, 0, -2 * radius],
|
|
|
|
['z']
|
|
|
|
];
|
|
|
|
|
|
|
|
return componentsToPath(circlePath);
|
2014-03-20 15:18:23 +00:00
|
|
|
}
|
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
function getRoundRectPath(shape, borderRadius) {
|
|
|
|
|
|
|
|
var x = shape.x,
|
|
|
|
y = shape.y,
|
|
|
|
width = shape.width,
|
|
|
|
height = shape.height;
|
|
|
|
|
|
|
|
var roundRectPath = [
|
|
|
|
['M', x + borderRadius, y],
|
|
|
|
['l', width - borderRadius * 2, 0],
|
|
|
|
['a', borderRadius, borderRadius, 0, 0, 1, borderRadius, borderRadius],
|
|
|
|
['l', 0, height - borderRadius * 2],
|
|
|
|
['a', borderRadius, borderRadius, 0, 0, 1, -borderRadius, borderRadius],
|
|
|
|
['l', borderRadius * 2 - width, 0],
|
|
|
|
['a', borderRadius, borderRadius, 0, 0, 1, -borderRadius, -borderRadius],
|
|
|
|
['l', 0, borderRadius * 2 - height],
|
|
|
|
['a', borderRadius, borderRadius, 0, 0, 1, borderRadius, -borderRadius],
|
|
|
|
['z']
|
|
|
|
];
|
|
|
|
|
|
|
|
return componentsToPath(roundRectPath);
|
|
|
|
}
|
2014-03-20 15:18:23 +00:00
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
function getDiamondPath(shape) {
|
2014-03-20 15:18:23 +00:00
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
var width = shape.width,
|
|
|
|
height = shape.height,
|
|
|
|
x = shape.x,
|
|
|
|
y = shape.y,
|
|
|
|
halfWidth = width / 2,
|
|
|
|
halfHeight = height / 2;
|
2014-03-20 15:18:23 +00:00
|
|
|
|
2015-09-02 13:13:18 +00:00
|
|
|
var diamondPath = [
|
|
|
|
['M', x + halfWidth, y],
|
|
|
|
['l', halfWidth, halfHeight],
|
|
|
|
['l', -halfWidth, halfHeight],
|
|
|
|
['l', -halfWidth, -halfHeight],
|
|
|
|
['z']
|
|
|
|
];
|
|
|
|
|
|
|
|
return componentsToPath(diamondPath);
|
|
|
|
}
|
|
|
|
|
|
|
|
function getRectPath(shape) {
|
|
|
|
var x = shape.x,
|
|
|
|
y = shape.y,
|
|
|
|
width = shape.width,
|
|
|
|
height = shape.height;
|
|
|
|
|
|
|
|
var rectPath = [
|
|
|
|
['M', x, y],
|
|
|
|
['l', width, 0],
|
|
|
|
['l', 0, height],
|
|
|
|
['l', -width, 0],
|
|
|
|
['z']
|
|
|
|
];
|
|
|
|
|
|
|
|
return componentsToPath(rectPath);
|
2015-09-30 06:28:28 +00:00
|
|
|
}
|
2016-11-23 12:03:38 +00:00
|
|
|
|
|
|
|
function getFillColor(element, defaultColor) {
|
|
|
|
var bo = getBusinessObject(element);
|
|
|
|
|
|
|
|
return bo.di.get('fill') || defaultColor || 'white';
|
|
|
|
}
|
|
|
|
|
|
|
|
function getStrokeColor(element, defaultColor) {
|
|
|
|
var bo = getBusinessObject(element);
|
|
|
|
|
|
|
|
return bo.di.get('stroke') || defaultColor || 'black';
|
|
|
|
}
|