diff --git a/.jshintrc b/.jshintrc
index 196841ba..0d9df080 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -16,7 +16,7 @@
"trailing" : true,
"maxdepth" : 5,
"maxstatements" : 50,
- "maxcomplexity" : 10,
+ "maxcomplexity" : 13,
"maxlen" : 120,
"browser" : true,
"debug": true,
diff --git a/lib/draw/BpmnRenderer.js b/lib/draw/BpmnRenderer.js
index 5dce93c1..2527bfc2 100644
--- a/lib/draw/BpmnRenderer.js
+++ b/lib/draw/BpmnRenderer.js
@@ -1,9 +1,11 @@
var bpmnModule = require('../di').defaultModule;
+var _ = require('lodash');
require('diagram-js/lib/core/EventBus');
require('diagram-js/lib/draw/Styles');
require('../core/BpmnRegistry');
+require('./PathMap');
var DefaultRenderer = require('diagram-js/lib/draw/Renderer');
@@ -11,12 +13,13 @@ var DefaultRenderer = require('diagram-js/lib/draw/Renderer');
var flattenPoints = DefaultRenderer.flattenPoints;
-function BpmnRenderer(events, styles, bpmnRegistry) {
+function BpmnRenderer(events, styles, bpmnRegistry, pathMap) {
DefaultRenderer.apply(this, [ events, styles ]);
var TASK_BORDER_RADIUS = 8;
var INNER_OUTER_DIST = 3;
+ var EVENT_RADIUS = 18;
var markers = {};
@@ -121,7 +124,7 @@ function BpmnRenderer(events, styles, bpmnRegistry) {
return p.circle(cx, cy, Math.round((width + height) / 4 - offset)).attr({
'stroke': 'Black',
- 'stroke-width': 2,
+ 'stroke-width': 1,
'fill': 'White'
});
}
@@ -163,11 +166,14 @@ function BpmnRenderer(events, styles, bpmnRegistry) {
}));
}
- function drawPath(p, d) {
+ function drawPath(p, d, fill) {
+
+ var fillColor = fill ? 'Black' : 'None';
var path = p.path(d).attr(styles.style([ 'no-fill' ],{
'stroke-width': 2,
- 'stroke': 'Black'
+ 'stroke': 'Black',
+ 'fill': fillColor
}));
return path;
@@ -183,12 +189,203 @@ function BpmnRenderer(events, styles, bpmnRegistry) {
return handlers[type];
}
+ function renderEventContent(data, p) {
+
+ var throwEvent = isThrowObject(data.id);
+ var path;
+
+ if (checkSemantic(data.id, 'bpmn:MessageEventDefinition')) {
+ path = renderer('bpmn:MessageEventDefinition')(p, data, throwEvent);
+ } else if (checkSemantic(data.id, 'bpmn:TimerEventDefinition')) {
+ path = renderer('bpmn:TimerEventDefinition')(p, data, throwEvent);
+ } else if (checkSemantic(data.id, 'bpmn:ConditionalEventDefinition')) {
+ path = renderer('bpmn:ConditionalEventDefinition')(p, data);
+ } else if (checkSemantic(data.id, 'bpmn:SignalEventDefinition')) {
+ path = renderer('bpmn:SignalEventDefinition')(p, data, throwEvent);
+ } else if (checkSemantic(data.id, 'bpmn:CancelEventDefinition') &&
+ checkSemantic(data.id, 'bpmn:TerminateEventDefinition') && !bpmnRegistry.getSemantic(data.id).parallelMultiple) {
+ path = renderer('bpmn:MultipleEventDefinition')(p, data, throwEvent);
+ } else if (checkSemantic(data.id, 'bpmn:CancelEventDefinition') &&
+ checkSemantic(data.id, 'bpmn:TerminateEventDefinition') && !!bpmnRegistry.getSemantic(data.id).parallelMultiple) {
+ path = renderer('bpmn:ParallelMultipleEventDefinition')(p, data, throwEvent);
+ } else if (checkSemantic(data.id, 'bpmn:EscalationEventDefinition')) {
+ path = renderer('bpmn:EscalationEventDefinition')(p, data, throwEvent);
+ } else if (checkSemantic(data.id, 'bpmn:LinkEventDefinition')) {
+ path = renderer('bpmn:LinkEventDefinition')(p, data, throwEvent);
+ } else if (checkSemantic(data.id, 'bpmn:ErrorEventDefinition')) {
+ path = renderer('bpmn:ErrorEventDefinition')(p, data, throwEvent);
+ } else if (checkSemantic(data.id, 'bpmn:CancelEventDefinition')) {
+ path = renderer('bpmn:CancelEventDefinition')(p, data, throwEvent);
+ } else if (checkSemantic(data.id, 'bpmn:CompensateEventDefinition')) {
+ path = renderer('bpmn:CompensateEventDefinition')(p, data, throwEvent);
+ } else if (checkSemantic(data.id, 'bpmn:TerminateEventDefinition')) {
+ path = renderer('bpmn:TerminateEventDefinition')(p, data, throwEvent);
+ }
+ return path;
+ }
+
var handlers = {
'bpmn:Event': function(p, data) {
- var circle = drawCircle(p, data.width, data.height);
+ var circle = drawCircle(p, EVENT_RADIUS * 2, EVENT_RADIUS * 2);
return circle;
},
- 'bpmn:StartEvent': as('bpmn:Event'),
+ 'bpmn:StartEvent': function(p, data) {
+ var circle = renderer('bpmn:Event')(p, data);
+
+ renderEventContent(data, p);
+
+ return circle;
+ },
+ 'bpmn:MessageEventDefinition': function(p, data, throwEvent) {
+ var pathData = pathMap.getRawPath('EVENT_MESSAGE');
+
+ var fill = throwEvent ? 'Black' : 'None';
+ var stroke = throwEvent ? 'White' : 'Black';
+
+ var messagePath = drawPath(p, pathData);
+ messagePath.attr({
+ 'stroke-width': 1,
+ 'fill': fill,
+ 'stroke': stroke
+ });
+
+ return messagePath;
+ },
+ 'bpmn:TimerEventDefinition': function(p, event) {
+ var pathData = pathMap.getRawPath('EVENT_TIMER_1');
+
+ var timerPath = drawPath(p, pathData);
+ timerPath.attr({
+ 'stroke-width': 1,
+ 'fill': 'Black'
+ });
+
+ var pathData2 = pathMap.getRawPath('EVENT_TIMER_2');
+
+ var timerPath2 = drawPath(p, pathData2);
+ timerPath2.attr({
+ 'stroke-width': 1,
+ 'fill': 'Black'
+ });
+
+
+ var pathDataWh = pathMap.getRawPath('EVENT_TIMER_WH');
+
+ var timerPathWh = drawPath(p, pathDataWh);
+ timerPathWh.attr({
+ 'stroke-width': 1,
+ 'fill': 'Black'
+ });
+
+ return timerPath;
+ },
+ 'bpmn:EscalationEventDefinition': function(p, event, throwEvent) {
+ var pathData = pathMap.getRawPath('EVENT_ESCALATION');
+
+ var fill = throwEvent ? 'Black' : 'None';
+
+ var escalationPath = drawPath(p, pathData);
+ escalationPath.attr({
+ 'stroke-width': 1,
+ 'fill': fill
+ });
+
+ return escalationPath;
+ },
+ 'bpmn:ConditionalEventDefinition': function(p, event) {
+ var pathData = pathMap.getRawPath('EVENT_CONDITIONAL');
+
+ var conditionalPath = drawPath(p, pathData);
+ conditionalPath.attr({
+ 'stroke-width': 1
+ });
+
+ return conditionalPath;
+ },
+ 'bpmn:LinkEventDefinition': function(p, event) {
+ var pathData = pathMap.getRawPath('EVENT_LINK');
+
+ var linkPath = drawPath(p, pathData);
+ linkPath.attr({
+ 'stroke-width': 1
+ });
+
+ return linkPath;
+ },
+ 'bpmn:ErrorEventDefinition': function(p, event, throwEvent) {
+ var pathData = pathMap.getRawPath('EVENT_ERROR');
+
+ var fill = throwEvent ? 'Black' : 'None';
+
+ var errorPath = drawPath(p, pathData);
+ errorPath.attr({
+ 'stroke-width': 1,
+ 'fill': fill
+ });
+
+ return errorPath;
+ },
+ 'bpmn:CancelEventDefinition': function(p, event, throwEvent) {
+ var pathData = pathMap.getRawPath('EVENT_CANCEL');
+
+ var fill = throwEvent ? 'Black' : 'None';
+
+ var cancelPath = drawPath(p, pathData);
+ cancelPath.attr({
+ 'stroke-width': 1,
+ 'fill': fill
+ });
+
+ return cancelPath;
+ },
+ 'bpmn:CompensateEventDefinition': function(p, event, throwEvent) {
+ var pathData = pathMap.getRawPath('EVENT_COMPENSATION');
+
+ var fill = throwEvent ? 'Black' : 'None';
+
+ var compensationPath = drawPath(p, pathData);
+ compensationPath.attr({
+ 'stroke-width': 1,
+ 'fill': fill
+ });
+
+ return compensationPath;
+ },
+ 'bpmn:SignalEventDefinition': function(p, event, throwEvent) {
+ var pathData = pathMap.getRawPath('EVENT_SIGNAL');
+
+ var fill = throwEvent ? 'Black' : 'None';
+
+ var signalPath = drawPath(p, pathData);
+ signalPath.attr({
+ 'stroke-width': 1,
+ 'fill': fill
+ });
+
+ return signalPath;
+ },
+ 'bpmn:MultipleEventDefinition': function(p, event, throwEvent) {
+ var pathData = pathMap.getRawPath('EVENT_MULTIPLE');
+
+ var fill = throwEvent ? 'Black' : 'None';
+
+ var multiplePath = drawPath(p, pathData);
+ multiplePath.attr({
+ 'stroke-width': 1,
+ 'fill': fill
+ });
+
+ return multiplePath;
+ },
+ 'bpmn:ParallelMultipleEventDefinition': function(p, event) {
+ var pathData = pathMap.getRawPath('EVENT_PARALLEL_MULTIPLE');
+ var multiplePath = drawPath(p, pathData);
+ multiplePath.attr({
+ 'stroke-width': 1
+ });
+
+ return multiplePath;
+ },
'bpmn:EndEvent': function(p, data) {
var circle = renderer('bpmn:Event')(p, data);
@@ -196,6 +393,18 @@ function BpmnRenderer(events, styles, bpmnRegistry) {
'stroke-width': 4
});
+ renderEventContent(data, p, true);
+
+ return circle;
+ },
+ 'bpmn:TerminateEventDefinition': function(p, data) {
+ var circle = drawCircle(p, 36, 36, 7);
+
+ circle.attr({
+ 'stroke-width': 4,
+ 'fill': 'Black'
+ });
+
return circle;
},
'bpmn:IntermediateEvent': function(p, data) {
@@ -205,10 +414,25 @@ function BpmnRenderer(events, styles, bpmnRegistry) {
outer.attr('stroke-width', 1);
inner.attr('stroke-width', 1);
+ renderEventContent(data, p);
+
+ return outer;
+ },
+ 'bpmn:IntermediateInterruptedEvent': function(p, data) {
+ var outer = renderer('bpmn:Event')(p, data);
+ var inner = drawCircle(p, EVENT_RADIUS * 2, EVENT_RADIUS * 2, INNER_OUTER_DIST);
+
+ outer.attr('stroke-width', 1);
+ outer.attr('stroke-dasharray', '12');
+ inner.attr('stroke-width', 1);
+ inner.attr('stroke-dasharray', '12');
+
+ renderEventContent(data, p);
+
return outer;
},
- 'bpmn:IntermediateThrowEvent': as('bpmn:IntermediateEvent'),
'bpmn:IntermediateCatchEvent': as('bpmn:IntermediateEvent'),
+ 'bpmn:IntermediateThrowEvent': as('bpmn:IntermediateEvent'),
'bpmn:Activity': function(p, data) {
var rect = drawRect(p, data.width, data.height, TASK_BORDER_RADIUS);
@@ -366,6 +590,10 @@ function BpmnRenderer(events, styles, bpmnRegistry) {
});
return dataStore;
+ },
+ 'bpmn:BoundaryEvent': function(p, data) {
+ renderer('bpmn:IntermediateInterruptedEvent')(p, data);
+ return renderEventContent(data, p);
}
};
@@ -391,6 +619,38 @@ function BpmnRenderer(events, styles, bpmnRegistry) {
}
}
+ /**
+ * Checks if eventDefinition of the given element matches with semantic type.
+ *
+ * @return {boolean} true if element is of the given semantic type
+ */
+ function checkSemantic(id, semanticType) {
+
+ var semantic = bpmnRegistry.getSemantic(id);
+
+ if(!semantic || !semantic.eventDefinitions) {
+ return false;
+ }
+
+ var match = false;
+ _.forEach(semantic.eventDefinitions, function(eventDefinition) {
+ if(eventDefinition.$type === semanticType) {
+ match = true;
+ return;
+ } else {
+ return;
+ }
+ });
+ return match;
+ }
+
+ function isThrowObject(id) {
+
+ var semantic = bpmnRegistry.getSemantic(id);
+
+ return (semantic.$type === 'bpmn:IntermediateThrowEvent') || (semantic.$type === 'bpmn:EndEvent');
+ }
+
/**
*
* @return {Object} returns a specified objectRef
@@ -420,6 +680,6 @@ function BpmnRenderer(events, styles, bpmnRegistry) {
BpmnRenderer.prototype = Object.create(DefaultRenderer.prototype);
-bpmnModule.type('renderer', [ 'eventBus', 'styles', 'bpmnRegistry', BpmnRenderer ]);
+bpmnModule.type('renderer', [ 'eventBus', 'styles', 'bpmnRegistry', 'pathMap', BpmnRenderer ]);
module.exports = BpmnRenderer;
\ No newline at end of file
diff --git a/lib/draw/PathMap.js b/lib/draw/PathMap.js
new file mode 100644
index 00000000..590df30a
--- /dev/null
+++ b/lib/draw/PathMap.js
@@ -0,0 +1,217 @@
+/**
+ * Map containing SVG paths needed by BpmnRenderer.
+ */
+var bpmnModule = require('../di').defaultModule;
+require('diagram-js/lib/draw/Snap');
+
+function PathMap(Snap) {
+
+ /**
+ * Contains a map of path elements
+ */
+ this.pathMap = {
+ 'shape': {
+ d: 'M{x},{y}h{dim.width}v{dim.height}h{dim["negative width"]}z',
+ height: 'y',
+ width: 'x',
+ heightElements: [],
+ widthElements: []
+ },
+ 'EVENT_MESSAGE': {
+ d: 'M 7.5 10 l 0 15 l 21 0 l 0 -15 z l 10.5 6 l 10.5 -6',
+ height: 22,
+ width: 16,
+ heightElements: [],
+ widthElements: []
+ },
+ 'EVENT_MESSAGE_REV': {
+ d: 'M 7 9.5 l 10.5,4.5 l 10.5,-4.5',
+ height: 4.5,
+ width: 6,
+ heightElements: [],
+ widthElements: []
+ },
+ 'EVENT_SIGNAL': {
+ d: 'M 18 8 l 10 18 l -20 0 Z',
+ height: 21,
+ width: 15,
+ heightElements: [],
+ widthElements: []
+ },
+ 'EVENT_ESCALATION': {
+ d: 'm 19,20 c -2.808,2.382 -5.616,4.764 -8.424,7.146 2.808,-6.589333 5.616,-13.178667 ' +
+ '8.424,-19.768 2.463,6.589333 4.926,13.178667 7.389,19.768 -2.463,-2.382 -4.926,-4.764 -7.389,-7.146 z',
+ height: 19,
+ width: 15,
+ heightElements: [],
+ widthElements: []
+ },
+ 'EVENT_CONDITIONAL': {
+ d: 'M 10.5 8.5 l 14.5 0 l 0 18 l -14.5 0 Z ' +
+ 'M 12.5 11.5 l 10.5 0 ' +
+ 'M 12.5 14.5 l 10.5 0 ' +
+ 'M 12.5 17.5 l 10.5 0 ' +
+ 'M 12.5 20.5 l 8 0 ' +
+ 'M 12.5 23.5 l 8 0 ' +
+ 'M 12.5 26.5 l 10.5 0 ',
+ height: 19,
+ width: 15,
+ heightElements: [],
+ widthElements: []
+ },
+ 'EVENT_LINK': {
+ d: 'm 20,12 c 2.151333,1.851 4.302667,3.702 6.454,5.553 -2.146667,1.847333 -4.293333,3.694667 ' +
+ '-6.44,5.542 0,-0.938667 0,-1.877333 0,-2.816 -3.009,0 -6.018,0 -9.027,0 0,-1.776 0,-3.552 0,-5.328 ' +
+ '2.998,0 5.996,0 8.994,0 0.0057,-0.983671 0.01251,-1.967334 0.019,-2.951 z m -0.986,-2.167 ' +
+ 'c -0.009,1.372667 -0.018,2.745333 -0.027,4.118 -3,0 -6,0 -9,0 0,2.442667 0,4.885333 0,7.328 ' +
+ '3.009,0 6.018,0 9.027,0 0,1.332333 0,2.664667 0,3.997 2.991,-2.574 5.982,-5.148 8.973,-7.722 ' +
+ '-2.991,-2.573667 -5.982,-5.147333 -8.973,-7.721 z',
+ height: 16,
+ width: 19,
+ heightElements: [],
+ widthElements: []
+ },
+ 'EVENT_ERROR': {
+ d: 'm 8,25 0.085,-0.023 6.672,-8.737 6.97,8.151 4.273,-16.564 -5.337,10.591 -6.636,-8.714 z',
+ height: 19,
+ width: 15,
+ heightElements: [],
+ widthElements: []
+ },
+ 'EVENT_CANCEL': {
+ d: 'm 10,24 c 1.874667,-1.874333 3.74933,-3.748667 5.624,-5.623 -1.87467,-1.874 -3.749333,-3.748 ' +
+ '-5.624,-5.622 0.890667,-0.890333 1.781333,-1.780667 2.672,-2.671 1.874,1.875 3.748,3.75 5.622,5.625 ' +
+ '1.87433,-1.875 3.74867,-3.75 5.623,-5.625 0.88967,0.890333 1.77933,1.780667 2.669,2.671 -1.87333,1.874 ' +
+ '-3.74667,3.748 -5.62,5.622 1.87333,1.874333 3.74667,3.748667 5.62,5.623 -0.88967,0.89 -1.77933,1.78 ' +
+ '-2.669,2.67 -1.87433,-1.874 -3.74867,-3.748 -5.623,-5.622 -1.874,1.874 -3.748,3.748 -5.622,5.622 ' +
+ '-0.890667,-0.89 -1.781333,-1.78 -2.672,-2.67 z',
+ height: 22,
+ width: 22,
+ heightElements: [],
+ widthElements: []
+ },
+ 'EVENT_COMPENSATION': {
+ d: 'm 25.5,11 -8.038,5.014 0,-5.014 -9.962,6.214 9.962,6.213 0,-5.012 8.038,5.012 z',
+ height: 22,
+ width: 22,
+ heightElements: [],
+ widthElements: []
+ },
+ 'EVENT_TIMER_1': {
+ d: 'm 18.1,7.7 c 5.676,0 10.292,4.617 10.292,10.293 0,5.676 -4.616,10.293 -10.292,10.293 -5.676,0 ' +
+ '-10.293,-4.617 -10.293,-10.293 0,-5.676 4.617,-10.293 10.293,-10.293 m 0,-1.5 c -6.515,0 ' +
+ '-11.793,5.279 -11.793,11.793 0,6.514 5.278,11.793 11.793,11.793 6.515,0 11.792,-5.279 ' +
+ '11.792,-11.793 0,-6.514 -5.279,-11.793 -11.792,-11.793 l 0,0 z',
+ height: 24,
+ width: 24,
+ heightElements: [],
+ widthElements: []
+ },
+ 'EVENT_TIMER_2': {
+ d: 'm 18,7 c -6.15,0 -11.139,4.986 -11.139,11.139 0,6.149 4.987,11.139 11.139,11.139 6.15,0 ' +
+ '11.14,-4.988 11.14,-11.139 -0.002,-6.151 -4.99,-11.139 -11.14,-11.139 z m 9.452,16.302 ' +
+ 'c -0.006,-0.004 -0.01,-0.008 -0.015,-0.011 -0.403,-0.229 -0.808,-0.461 -1.212,-0.69 ' +
+ '-0.143,-0.08 -0.282,-0.045 -0.358,0.092 -0.077,0.136 -0.036,0.27 0.104,0.352 0.401,0.229 ' +
+ '0.803,0.459 1.207,0.688 0.006,0.003 0.011,0.008 0.018,0.01 -0.896,1.466 -2.131,2.7 -3.6,3.596 ' +
+ '0,-0.002 -0.001,-0.004 -0.001,-0.007 -0.239,-0.427 -0.479,-0.854 -0.72,-1.279 -0.062,-0.109 ' +
+ '-0.161,-0.146 -0.276,-0.112 -0.117,0.033 -0.196,0.134 -0.204,0.252 0.015,0.042 0.025,0.088 ' +
+ '0.047,0.129 0.235,0.422 0.473,0.842 0.71,1.262 0.002,0.005 0.006,0.008 0.008,0.012 -1.463,0.801 ' +
+ '-3.133,1.271 -4.907,1.312 0.002,-0.486 0.002,-0.974 0,-1.458 0,-0.104 -0.054,-0.183 -0.15,-0.218 ' +
+ '-0.172,-0.063 -0.362,0.027 -0.361,0.24 0.005,0.473 10e-4,0.942 10e-4,1.414 0,0.007 0.001,0.013 ' +
+ '0.002,0.021 -1.774,-0.043 -3.444,-0.516 -4.906,-1.316 0,-0.002 0.002,-0.003 0.003,-0.005 0.254,-0.409 ' +
+ '0.506,-0.818 0.758,-1.229 0.023,-0.037 0.034,-0.085 0.051,-0.127 -0.01,-0.115 -0.084,-0.209 ' +
+ '-0.204,-0.244 -0.112,-0.031 -0.218,0.004 -0.282,0.109 -0.254,0.412 -0.509,0.822 -0.76,1.234 ' +
+ '-0.003,0.002 -0.003,0.005 -0.004,0.008 -1.466,-0.896 -2.7,-2.128 -3.594,-3.595 0.421,-0.251 ' +
+ '0.842,-0.5 1.262,-0.753 0.061,-0.035 0.102,-0.091 0.11,-0.159 0.015,-0.111 -0.024,-0.203 ' +
+ '-0.116,-0.27 -0.09,-0.065 -0.182,-0.054 -0.272,0.002 -0.271,0.162 -0.546,0.324 -0.816,0.486 ' +
+ '-0.142,0.083 -0.281,0.168 -0.421,0.252 -0.799,-1.463 -1.271,-3.131 -1.312,-4.905 0.475,0 ' +
+ '0.95,0.003 1.424,-10e-4 0.056,-0.001 0.119,-0.03 0.164,-0.063 0.081,-0.064 0.102,-0.192 ' +
+ '0.061,-0.296 -0.039,-0.098 -0.119,-0.147 -0.235,-0.147 -0.449,0 -0.897,0.003 -1.348,-0.002 ' +
+ '-0.023,-0.002 -0.043,0.001 -0.064,0.003 0.041,-1.775 0.513,-3.445 1.312,-4.908 0.006,0.004 ' +
+ '0.012,0.011 0.02,0.015 0.408,0.228 0.817,0.456 1.229,0.682 0.043,0.025 0.093,0.038 0.139,0.056 ' +
+ '0.12,-0.011 0.22,-0.091 0.255,-0.212 0.03,-0.108 -0.01,-0.21 -0.117,-0.271 -0.074,-0.045 ' +
+ '-0.149,-0.086 -0.228,-0.128 -0.342,-0.19 -0.687,-0.381 -1.028,-0.571 -0.007,-0.003 -0.012,-0.004 ' +
+ '-0.017,-0.007 0.894,-1.467 2.127,-2.699 3.592,-3.595 0.001,0.002 0.001,0.004 0.004,0.006 ' +
+ '0.226,0.404 0.455,0.81 0.685,1.214 0.075,0.134 0.207,0.17 0.343,0.097 0.132,-0.073 0.174,-0.215 ' +
+ '0.103,-0.348 -0.013,-0.023 -0.025,-0.045 -0.039,-0.069 -0.215,-0.382 -0.432,-0.764 -0.646,-1.145 ' +
+ '-0.003,-0.004 -0.005,-0.008 -0.007,-0.012 1.463,-0.801 3.132,-1.271 4.904,-1.313 -0.001,0.479 ' +
+ '-0.001,0.962 0,1.44 10e-4,0.116 0.077,0.202 0.191,0.229 0.182,0.039 0.318,-0.071 0.318,-0.257 ' +
+ '0,-0.446 -0.004,-0.893 0.003,-1.337 0,-0.025 -0.001,-0.051 -0.005,-0.075 1.775,0.041 3.444,0.511 ' +
+ '4.908,1.312 0,0.002 -0.003,0.003 -0.003,0.006 -0.229,0.42 -0.455,0.842 -0.681,1.263 -0.021,0.037 ' +
+ '-0.027,0.081 -0.04,0.119 0.005,0.115 0.09,0.222 0.206,0.255 0.117,0.032 0.214,-0.008 0.273,-0.12 ' +
+ '0.151,-0.276 0.301,-0.554 0.45,-0.832 0.078,-0.146 0.159,-0.289 0.231,-0.437 1.469,0.896 ' +
+ '2.703,2.13 3.6,3.597 -0.006,0.002 -0.011,0.004 -0.016,0.008 -0.414,0.243 -0.825,0.489 ' +
+ '-1.236,0.735 -0.029,0.019 -0.056,0.041 -0.078,0.064 -0.076,0.093 -0.067,0.229 0.017,0.329 ' +
+ '0.079,0.095 0.199,0.116 0.312,0.051 0.246,-0.144 0.487,-0.29 0.732,-0.435 0.173,-0.104 ' +
+ '0.351,-0.208 0.523,-0.314 h 0.002 c 0.8,1.463 1.272,3.132 1.312,4.909 -0.488,-0.002 -0.979,-0.002 ' +
+ '-1.469,0 -0.115,0.001 -0.201,0.076 -0.226,0.19 -0.039,0.181 0.071,0.317 0.256,0.317 0.472,0 0.942,0 ' +
+ '1.415,0 0.007,0 0.016,0 0.022,-0.001 -0.042,1.772 -0.512,3.441 -1.313,4.906 z',
+ height: 22,
+ width: 23,
+ heightElements: [],
+ widthElements: []
+ },
+ 'EVENT_TIMER_WH': {
+ d: 'm 20,9 -1.058,-0.236 -1.974,8.849 -0.286,0 0,1.041 0.055,0 -0.055,0.244 1.06,0.236 ' +
+ '0.105,-0.48 5.68,0 0,-1.041 -5.447,0 z',
+ height: 12,
+ width: 8,
+ heightElements: [],
+ widthElements: []
+ },
+ 'EVENT_MULTIPLE': {
+ d:'m 8,14 9.42149,-6.28099 9.42149,6.28099 -3.1405,12.56199 -12.56198,0 z',
+ height: 18,
+ width: 18,
+ heightElements: [],
+ widthElements: []
+ },
+ 'EVENT_PARALLEL_MULTIPLE': {
+ d:'m 17,9 2.56228,0 0,7.686833 7.68683,0 0,2.562278 -7.68683,0 0,7.686833 ' +
+ '-2.56228,0 0,-7.686833 -7.686832,0 0,-2.562278 7.686832,0 z',
+ height: 17,
+ width: 17,
+ heightElements: [],
+ widthElements: []
+ }
+ };
+
+ this.getRawPath = function getRawPath(pathId) {
+ return this.pathMap[pathId].d;
+ };
+
+ /**
+ * Scales the path to the given height and width.
+ */
+ this.getScaledPath = function getScaledPath(pathId, height, width) {
+ var rawPath = this.getRawPath(pathId);
+ var heightRatio = rawPath.height / height;
+ var widthRatio = rawPath.width / width;
+ var heightElements = [];
+ var widthElements = [];
+
+ //Apply height ratio
+ for(var heightIndex = 0; heightIndex < rawPath.heightElements.length; heightIndex++) {
+ heightElements[heightIndex] = rawPath.heightElements[heightIndex] * heightRatio;
+ }
+
+ //Apply width ratio
+ for(var widthIndex = 0; widthIndex < rawPath.widthElements.length; widthIndex++) {
+ widthElements[widthIndex] = rawPath.widthElements[widthIndex] * widthRatio;
+ }
+
+ //Apply value to raw path
+ var path = Snap.format(
+ rawPath.d, {
+ heightElements: heightElements,
+ widthElements: widthElements
+ }
+ );
+
+ return path;
+ };
+}
+
+bpmnModule.type('pathMap', [ 'snap', PathMap ]);
+
+module.exports = PathMap;
\ No newline at end of file
diff --git a/package.json b/package.json
index 0c89db8d..3341ac81 100644
--- a/package.json
+++ b/package.json
@@ -42,7 +42,7 @@
"grunt-jasmine-node": "~0.2.1",
"grunt-release": "~0.7.0",
"load-grunt-tasks": "~0.3.0",
- "karma": "~0.12.0",
+ "karma": "~0.12.8",
"karma-jasmine": "https://github.com/Nikku/karma-jasmine/archive/jasmine-v2.0.0-latest-1.tar.gz",
"karma-chrome-launcher": "~0.1.2",
"karma-phantomjs-launcher": "0.1.2",
diff --git a/test/fixtures/bpmn/process/standard-process.bpmn b/test/fixtures/bpmn/process/standard-process.bpmn
new file mode 100644
index 00000000..e84c1bb6
--- /dev/null
+++ b/test/fixtures/bpmn/process/standard-process.bpmn
@@ -0,0 +1,120 @@
+
+
+
+
+ SequenceFlow_1
+
+
+ SequenceFlow_1
+ SequenceFlow_2
+
+
+
+ SequenceFlow_2
+ SequenceFlow_3
+ SequenceFlow_4
+
+
+
+ SequenceFlow_3
+ SequenceFlow_5
+
+
+
+ SequenceFlow_4
+ SequenceFlow_6
+
+
+
+ SequenceFlow_5
+ SequenceFlow_6
+ SequenceFlow_7
+
+
+
+
+ SequenceFlow_7
+ SequenceFlow_8
+
+
+
+ SequenceFlow_8
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test/fixtures/bpmn/render/event-interrupting.bpmn b/test/fixtures/bpmn/render/event-interrupting.bpmn
new file mode 100644
index 00000000..b7fe59e6
--- /dev/null
+++ b/test/fixtures/bpmn/render/event-interrupting.bpmn
@@ -0,0 +1,100 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/fixtures/bpmn/render/events.bpmn b/test/fixtures/bpmn/render/events.bpmn
index 9324b003..d5de7e9c 100644
--- a/test/fixtures/bpmn/render/events.bpmn
+++ b/test/fixtures/bpmn/render/events.bpmn
@@ -1,226 +1,316 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+