improve(bpmnrenderer): make path scaleable

- scale events to the given size
- scale data objects to the given size

closes #36
This commit is contained in:
jdotzki 2014-04-28 15:32:55 +02:00
parent 38062233a5
commit 02f80f75e7
2 changed files with 275 additions and 201 deletions

View File

@ -19,7 +19,6 @@ function BpmnRenderer(events, styles, bpmnRegistry, pathMap) {
var TASK_BORDER_RADIUS = 8; var TASK_BORDER_RADIUS = 8;
var INNER_OUTER_DIST = 3; var INNER_OUTER_DIST = 3;
var EVENT_RADIUS = 18;
var markers = {}; var markers = {};
@ -213,12 +212,14 @@ function BpmnRenderer(events, styles, bpmnRegistry, pathMap) {
} }
if (isTypedEvent(event, 'bpmn:CancelEventDefinition') && if (isTypedEvent(event, 'bpmn:CancelEventDefinition') &&
isTypedEvent(event, 'bpmn:TerminateEventDefinition', { parallelMultiple: false })) { isTypedEvent(event, 'bpmn:TerminateEventDefinition')
&& !bpmnRegistry.getSemantic(data.id).parallelMultiple) {
return renderer('bpmn:MultipleEventDefinition')(p, data, isThrowing); return renderer('bpmn:MultipleEventDefinition')(p, data, isThrowing);
} }
if (isTypedEvent(event, 'bpmn:CancelEventDefinition') && if (isTypedEvent(event, 'bpmn:CancelEventDefinition') &&
isTypedEvent(event, 'bpmn:TerminateEventDefinition', { parallelMultiple: true })) { isTypedEvent(event, 'bpmn:TerminateEventDefinition') &&
!!bpmnRegistry.getSemantic(data.id).parallelMultiple) {
return renderer('bpmn:ParallelMultipleEventDefinition')(p, data, isThrowing); return renderer('bpmn:ParallelMultipleEventDefinition')(p, data, isThrowing);
} }
@ -251,7 +252,7 @@ function BpmnRenderer(events, styles, bpmnRegistry, pathMap) {
var handlers = { var handlers = {
'bpmn:Event': function(p, data) { 'bpmn:Event': function(p, data) {
var circle = drawCircle(p, EVENT_RADIUS * 2, EVENT_RADIUS * 2); var circle = drawCircle(p, data.width, data.height);
return circle; return circle;
}, },
'bpmn:StartEvent': function(p, data) { 'bpmn:StartEvent': function(p, data) {
@ -262,7 +263,16 @@ function BpmnRenderer(events, styles, bpmnRegistry, pathMap) {
return circle; return circle;
}, },
'bpmn:MessageEventDefinition': function(p, data, isThrowing) { 'bpmn:MessageEventDefinition': function(p, data, isThrowing) {
var pathData = pathMap.getRawPath('EVENT_MESSAGE'); var pathData = pathMap.getScaledPath('EVENT_MESSAGE', {
xScaleFactor: 0.9,
yScaleFactor: 0.9,
containerWidth: data.width,
containerHeight: data.height,
position: {
mx: 0.235,
my: 0.315
}
});
var fill = isThrowing ? 'Black' : 'None'; var fill = isThrowing ? 'Black' : 'None';
var stroke = isThrowing ? 'White' : 'Black'; var stroke = isThrowing ? 'White' : 'Black';
@ -276,36 +286,42 @@ function BpmnRenderer(events, styles, bpmnRegistry, pathMap) {
return messagePath; return messagePath;
}, },
'bpmn:TimerEventDefinition': function(p, event) { 'bpmn:TimerEventDefinition': function(p, data) {
var pathData = pathMap.getRawPath('EVENT_TIMER_1');
var timerPath = drawPath(p, pathData); var circle = drawCircle(p, data.width, data.height, 0.2 * data.height);
timerPath.attr({ circle.attr({
'stroke-width': 1, 'stroke-width': 2
'fill': 'Black'
}); });
var pathData2 = pathMap.getRawPath('EVENT_TIMER_2'); var pathData = pathMap.getScaledPath('EVENT_TIMER_WH', {
xScaleFactor: 0.75,
var timerPath2 = drawPath(p, pathData2); yScaleFactor: 0.75,
timerPath2.attr({ containerWidth: data.width,
'stroke-width': 1, containerHeight: data.height,
'fill': 'Black' position: {
mx: 0.5,
my: 0.5
}
}); });
var timerPathWh = drawPath(p, pathData);
var pathDataWh = pathMap.getRawPath('EVENT_TIMER_WH');
var timerPathWh = drawPath(p, pathDataWh);
timerPathWh.attr({ timerPathWh.attr({
'stroke-width': 1, 'stroke-width': 2
'fill': 'Black'
}); });
return timerPath; return circle;
}, },
'bpmn:EscalationEventDefinition': function(p, event, isThrowing) { 'bpmn:EscalationEventDefinition': function(p, event, isThrowing) {
var pathData = pathMap.getRawPath('EVENT_ESCALATION'); var pathData = pathMap.getScaledPath('EVENT_ESCALATION', {
xScaleFactor: 1,
yScaleFactor: 1,
containerWidth: event.width,
containerHeight: event.height,
position: {
mx: 0.5,
my: 0.555
}
});
var fill = isThrowing ? 'Black' : 'None'; var fill = isThrowing ? 'Black' : 'None';
@ -318,7 +334,16 @@ function BpmnRenderer(events, styles, bpmnRegistry, pathMap) {
return escalationPath; return escalationPath;
}, },
'bpmn:ConditionalEventDefinition': function(p, event) { 'bpmn:ConditionalEventDefinition': function(p, event) {
var pathData = pathMap.getRawPath('EVENT_CONDITIONAL'); var pathData = pathMap.getScaledPath('EVENT_CONDITIONAL', {
xScaleFactor: 1,
yScaleFactor: 1,
containerWidth: event.width,
containerHeight: event.height,
position: {
mx: 0.5,
my: 0.222
}
});
var conditionalPath = drawPath(p, pathData); var conditionalPath = drawPath(p, pathData);
conditionalPath.attr({ conditionalPath.attr({
@ -328,7 +353,16 @@ function BpmnRenderer(events, styles, bpmnRegistry, pathMap) {
return conditionalPath; return conditionalPath;
}, },
'bpmn:LinkEventDefinition': function(p, event) { 'bpmn:LinkEventDefinition': function(p, event) {
var pathData = pathMap.getRawPath('EVENT_LINK'); var pathData = pathMap.getScaledPath('EVENT_LINK', {
xScaleFactor: 1,
yScaleFactor: 1,
containerWidth: event.width,
containerHeight: event.height,
position: {
mx: 0.57,
my: 0.263
}
});
var linkPath = drawPath(p, pathData); var linkPath = drawPath(p, pathData);
linkPath.attr({ linkPath.attr({
@ -338,7 +372,16 @@ function BpmnRenderer(events, styles, bpmnRegistry, pathMap) {
return linkPath; return linkPath;
}, },
'bpmn:ErrorEventDefinition': function(p, event, isThrowing) { 'bpmn:ErrorEventDefinition': function(p, event, isThrowing) {
var pathData = pathMap.getRawPath('EVENT_ERROR'); 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
}
});
var fill = isThrowing ? 'Black' : 'None'; var fill = isThrowing ? 'Black' : 'None';
@ -351,7 +394,16 @@ function BpmnRenderer(events, styles, bpmnRegistry, pathMap) {
return errorPath; return errorPath;
}, },
'bpmn:CancelEventDefinition': function(p, event, isThrowing) { 'bpmn:CancelEventDefinition': function(p, event, isThrowing) {
var pathData = pathMap.getRawPath('EVENT_CANCEL'); 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
}
});
var fill = isThrowing ? 'Black' : 'None'; var fill = isThrowing ? 'Black' : 'None';
@ -361,10 +413,21 @@ function BpmnRenderer(events, styles, bpmnRegistry, pathMap) {
'fill': fill 'fill': fill
}); });
cancelPath.transform('rotate(45)');
return cancelPath; return cancelPath;
}, },
'bpmn:CompensateEventDefinition': function(p, event, isThrowing) { 'bpmn:CompensateEventDefinition': function(p, event, isThrowing) {
var pathData = pathMap.getRawPath('EVENT_COMPENSATION'); var pathData = pathMap.getScaledPath('EVENT_COMPENSATION', {
xScaleFactor: 1,
yScaleFactor: 1,
containerWidth: event.width,
containerHeight: event.height,
position: {
mx: 0.201,
my: 0.472
}
});
var fill = isThrowing ? 'Black' : 'None'; var fill = isThrowing ? 'Black' : 'None';
@ -377,7 +440,16 @@ function BpmnRenderer(events, styles, bpmnRegistry, pathMap) {
return compensationPath; return compensationPath;
}, },
'bpmn:SignalEventDefinition': function(p, event, isThrowing) { 'bpmn:SignalEventDefinition': function(p, event, isThrowing) {
var pathData = pathMap.getRawPath('EVENT_SIGNAL'); 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
}
});
var fill = isThrowing ? 'Black' : 'None'; var fill = isThrowing ? 'Black' : 'None';
@ -390,7 +462,16 @@ function BpmnRenderer(events, styles, bpmnRegistry, pathMap) {
return signalPath; return signalPath;
}, },
'bpmn:MultipleEventDefinition': function(p, event, isThrowing) { 'bpmn:MultipleEventDefinition': function(p, event, isThrowing) {
var pathData = pathMap.getRawPath('EVENT_MULTIPLE'); 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
}
});
var fill = isThrowing ? 'Black' : 'None'; var fill = isThrowing ? 'Black' : 'None';
@ -403,8 +484,19 @@ function BpmnRenderer(events, styles, bpmnRegistry, pathMap) {
return multiplePath; return multiplePath;
}, },
'bpmn:ParallelMultipleEventDefinition': function(p, event) { 'bpmn:ParallelMultipleEventDefinition': function(p, event) {
var pathData = pathMap.getRawPath('EVENT_PARALLEL_MULTIPLE'); 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
}
});
var multiplePath = drawPath(p, pathData); var multiplePath = drawPath(p, pathData);
multiplePath.attr({ multiplePath.attr({
'stroke-width': 1 'stroke-width': 1
}); });
@ -423,7 +515,7 @@ function BpmnRenderer(events, styles, bpmnRegistry, pathMap) {
return circle; return circle;
}, },
'bpmn:TerminateEventDefinition': function(p, data) { 'bpmn:TerminateEventDefinition': function(p, data) {
var circle = drawCircle(p, 36, 36, 7); var circle = drawCircle(p, data.width, data.height, 7);
circle.attr({ circle.attr({
'stroke-width': 4, 'stroke-width': 4,
@ -445,7 +537,7 @@ function BpmnRenderer(events, styles, bpmnRegistry, pathMap) {
}, },
'bpmn:IntermediateInterruptedEvent': function(p, data) { 'bpmn:IntermediateInterruptedEvent': function(p, data) {
var outer = renderer('bpmn:Event')(p, data); var outer = renderer('bpmn:Event')(p, data);
var inner = drawCircle(p, EVENT_RADIUS * 2, EVENT_RADIUS * 2, INNER_OUTER_DIST); var inner = drawCircle(p, data.width, data.height, INNER_OUTER_DIST);
outer.attr('stroke-width', 1); outer.attr('stroke-width', 1);
outer.attr('stroke-dasharray', '12'); outer.attr('stroke-dasharray', '12');
@ -683,60 +775,79 @@ function BpmnRenderer(events, styles, bpmnRegistry, pathMap) {
}); });
}, },
'bpmn:DataObjectReference': function(p, data) { 'bpmn:DataObjectReference': function(p, data) {
var DATA_OBJECT_PATH = 'm 0 0 40 0 10 10 0 50-50 0 0-60m 40 0 0 10 10 0'; var pathData = pathMap.getScaledPath('DATA_OBJECT_PATH', {
xScaleFactor: 1,
yScaleFactor: 1,
containerWidth: data.width,
containerHeight: data.height,
position: {
mx: 0.474,
my: 0.296
}
});
var dataObject = drawPath(p, DATA_OBJECT_PATH); var dataObject = drawPath(p, pathData);
if(getObjectRef(data.id, 'isCollection') === true || if(getObjectRef(data.id, 'isCollection') === true ||
bpmnRegistry.getSemantic(data.id).isCollection === true) { bpmnRegistry.getSemantic(data.id).isCollection === true) {
var COLLECTION_PATH = 'M 0 0 l 0 15 l 1 0 l 0 -15 z' + var yPosition = (data.height - 16) / data.height;
'M 6 0 l 0 15 l 1 0 l 0 -15 z' +
'M 12 0 l 0 15 l 1 0 l 0 -15 z'; var collectionPathData = pathMap.getScaledPath('DATA_OBJECT_COLLECTION_PATH', {
var collectionIcon = drawPath(p, COLLECTION_PATH); xScaleFactor: 1,
collectionIcon.transform('translate(17.8,42.0)'); yScaleFactor: 1,
containerWidth: data.width,
containerHeight: data.height,
position: {
mx: 0.451,
my: yPosition
}
});
var collectionPath = drawPath(p, collectionPathData);
collectionPath.attr({
'stroke-width': 2
});
} }
return dataObject; return dataObject;
}, },
'bpmn:DataInput': function(p, data) { 'bpmn:DataInput': function(p, data) {
var DATA_INPUT__ARROW = 'm -1.5357,2.8074 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z'; var arrowPathData = pathMap.getRawPath('DATA_ARROW');
//page //page
var dataObject = renderer('bpmn:DataObjectReference')(p, data); var dataObject = renderer('bpmn:DataObjectReference')(p, data);
//arrow //arrow
var dataInput = drawPath(p, DATA_INPUT__ARROW); var dataInput = drawPath(p, arrowPathData);
dataInput.attr('stroke-width', 1); dataInput.attr('stroke-width', 1);
dataInput.transform('matrix(1.00000000,0.00000000,0.00000000,1.00000000,7.00000000,7.00000000)');
return dataObject; return dataObject;
}, },
'bpmn:DataOutput': function(p, data) { 'bpmn:DataOutput': function(p, data) {
var DATA_INPUT__ARROW = 'm -1.5357,2.8074 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z'; var arrowPathData = pathMap.getRawPath('DATA_ARROW');
//page //page
var dataObject = renderer('bpmn:DataObjectReference')(p, data); var dataObject = renderer('bpmn:DataObjectReference')(p, data);
//arrow //arrow
var dataInput = drawPath(p, DATA_INPUT__ARROW); var dataInput = drawPath(p, arrowPathData);
dataInput.attr({ dataInput.attr({
'stroke-width': 1, 'stroke-width': 1,
'fill': 'Black' 'fill': 'Black'
}); });
dataInput.transform('matrix(1.00000000,0.00000000,0.00000000,1.00000000,7.00000000,7.00000000)');
return dataObject; return dataObject;
}, },
'bpmn:DataStoreReference': function(p, data) { 'bpmn:DataStoreReference': function(p, data) {
var DATA_STORE_PATH = 'm 59.5253 15.2984c 0 1.9490-3.4477 6.4288-29.7791 6.4288-26.3304 ' + var DATA_STORE_PATH = pathMap.getScaledPath('DATA_STORE', {
'0-29.2715-4.5986-29.2715-6.3336m 0-4.5633c 0 1.7360 2.9411 6.3346 29.2715 6.3346 ' + xScaleFactor: 1,
'26.3314 0 29.7791-4.4799 29.7791-6.4288M 0.4747 6.2670c 0 2.3062 2.9411 6.3346 ' + yScaleFactor: 1,
'29.2715 6.3346 26.3314 0 29.7791-3.8390 29.7791-6.4298m 0 9.81V 10.9265M 0.4975 ' + containerWidth: data.width,
'6.1728V 10.9265M 59.5253 10.7361v 4.7536M 0.4975 10.7361v 4.7536M 29.7224 0.5507c ' + containerHeight: data.height,
'19.0607 0 29.8029 2.9931 29.8029 5.6221 0 2.6280 0 44.2549 0 47.3441 0 ' + position: {
'3.0893-15.6386 6.0844-29.8944 6.0844-14.2557 0-29.1563-2.8999-29.1563-6.1805 ' + mx: 0,
'0-3.2797 0-44.8751 0-47.1538 0-2.2787 10.1880-5.7163 29.2477-5.7163z'; my: 0.133
}
});
//arrow
var dataStore = drawPath(p, DATA_STORE_PATH); var dataStore = drawPath(p, DATA_STORE_PATH);
dataStore.attr({ dataStore.attr({
'stroke-width': 1, 'stroke-width': 1,

View File

@ -39,164 +39,92 @@ function PathMap(Snap) {
*/ */
this.pathMap = { this.pathMap = {
'EVENT_MESSAGE': { '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', d: 'm {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}',
height: 22, height: 36,
width: 16, width: 36,
heightElements: [], heightElements: [6, 14],
widthElements: [] widthElements: [10.5, 21]
},
'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': { 'EVENT_SIGNAL': {
d: 'M 18 8 l 10 18 l -20 0 Z', d: 'M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z',
height: 21, height: 36,
width: 15, width: 36,
heightElements: [], heightElements: [18],
widthElements: [] widthElements: [10, 20]
}, },
'EVENT_ESCALATION': { '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 ' + d: 'm {mx},{my} c -{e.x1},{e.y0} -{e.x3},{e.y1} -{e.x5},{e.y4} {e.x1},-{e.y3} {e.x3},-{e.y5} {e.x5},-{e.y6} ' +
'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', '{e.x0},{e.y3} {e.x2},{e.y5} {e.x4},{e.y6} -{e.x0},-{e.y0} -{e.x2},-{e.y1} -{e.x4},-{e.y4} z',
height: 19, height: 36,
width: 15, width: 36,
heightElements: [], heightElements: [2.382, 4.764, 4.926, 6.589333, 7.146, 13.178667, 19.768],
widthElements: [] widthElements: [2.463, 2.808, 4.926, 5.616, 7.389, 8.424]
}, },
'EVENT_CONDITIONAL': { 'EVENT_CONDITIONAL': {
d: 'M 10.5 8.5 l 14.5 0 l 0 18 l -14.5 0 Z ' + d: 'M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z ' +
'M 12.5 11.5 l 10.5 0 ' + 'M {e.x2},{e.y3} l {e.x0},0 ' +
'M 12.5 14.5 l 10.5 0 ' + 'M {e.x2},{e.y4} l {e.x0},0 ' +
'M 12.5 17.5 l 10.5 0 ' + 'M {e.x2},{e.y5} l {e.x0},0 ' +
'M 12.5 20.5 l 8 0 ' + 'M {e.x2},{e.y6} l {e.x0},0 ' +
'M 12.5 23.5 l 8 0 ' + 'M {e.x2},{e.y7} l {e.x0},0 ' +
'M 12.5 26.5 l 10.5 0 ', 'M {e.x2},{e.y8} l {e.x0},0 ',
height: 19, height: 36,
width: 15, width: 36,
heightElements: [], heightElements: [8.5, 14.5, 18, 11.5, 14.5, 17.5, 20.5, 23.5, 26.5],
widthElements: [] widthElements: [10.5, 14.5, 12.5]
}, },
'EVENT_LINK': { '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 ' + d: 'm {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z',
'-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 ' + height: 36,
'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 ' + width: 36,
'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 ' + heightElements: [4.4375, 6.75, 7.8125],
'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 ' + widthElements: [9.84375, 13.5]
'-2.991,-2.573667 -5.982,-5.147333 -8.973,-7.721 z',
height: 16,
width: 19,
heightElements: [],
widthElements: []
}, },
'EVENT_ERROR': { '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', d: 'm {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z',
height: 19, height: 36,
width: 15, width: 36,
heightElements: [], heightElements: [0.023, 8.737, 8.151, 16.564, 10.591, 8.714],
widthElements: [] widthElements: [0.085, 6.672, 6.97, 4.273, 5.337, 6.636]
}, },
'EVENT_CANCEL': { 'EVENT_CANCEL_45': {
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 ' + d: 'm {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 ' +
'-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 ' + '0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z',
'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 ' + height: 36,
'-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 ' + width: 36,
'-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 ' + heightElements: [4.75, 8.5],
'-0.890667,-0.89 -1.781333,-1.78 -2.672,-2.67 z', widthElements: [4.75, 8.5]
height: 22,
width: 22,
heightElements: [],
widthElements: []
}, },
'EVENT_COMPENSATION': { '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', d: 'm {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x0},0 {e.x0},-{e.y0} 0,{e.y1} z',
height: 22, height: 36,
width: 22, width: 36,
heightElements: [], heightElements: [5, 10],
widthElements: [] widthElements: [10]
},
'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': { '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 ' + d: 'M {mx},{my} m -{e.x1},-{e.y1} l {e.x1},{e.y1} l {e.x0},-{e.y0}',
'0.105,-0.48 5.68,0 0,-1.041 -5.447,0 z', height: 36,
height: 12, width: 36,
width: 8, heightElements: [3.5,4],
heightElements: [], widthElements: [8.75,10.5]
widthElements: []
}, },
'EVENT_MULTIPLE': { 'EVENT_MULTIPLE': {
d:'m 8,14 9.42149,-6.28099 9.42149,6.28099 -3.1405,12.56199 -12.56198,0 z', d:'m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z',
height: 18, height: 36,
width: 18, width: 36,
heightElements: [], heightElements: [6.28099, 12.56199],
widthElements: [] widthElements: [3.1405, 9.42149, 12.56198]
}, },
'EVENT_PARALLEL_MULTIPLE': { '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 ' + d:'m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} ' +
'-2.56228,0 0,-7.686833 -7.686832,0 0,-2.562278 7.686832,0 z', '-{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z',
height: 17, height: 36,
width: 17, width: 36,
heightElements: [], heightElements: [2.56228, 7.68683],
widthElements: [] widthElements: [2.56228, 7.68683]
}, },
'GATEWAY_EXCLUSIVE': { 'GATEWAY_EXCLUSIVE': {
//m 0,0 6.5,8.5 -6.5,8.5 3,0 5,-6.5312 5,6.5312 3,0 -6.5,-8.5 6.5,-8.5 -3,0 -5,6.5313 -5,-6.5313 -3,0 z
d:'m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} ' + d:'m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} ' +
'{e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} ' + '{e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} ' +
'{e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z', '{e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z',
@ -214,7 +142,6 @@ function PathMap(Snap) {
widthElements: [5, 12.5] widthElements: [5, 12.5]
}, },
'GATEWAY_EVENT_BASED': { 'GATEWAY_EVENT_BASED': {
//d:'m {mx},{my} 9.42149,-6.28099 9.42149,6.28099 -3.1405,12.56199 -12.56198,0 z',
d:'m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z', d:'m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z',
height: 11, height: 11,
width: 11, width: 11,
@ -222,10 +149,6 @@ function PathMap(Snap) {
widthElements: [9, -3, -12] widthElements: [9, -3, -12]
}, },
'GATEWAY_COMPLEX': { 'GATEWAY_COMPLEX': {
//d:'m 7.0625,0.0625 0,4.8750001 -3.4375,-3.4375 -2.125,2.125 3.4375,3.4375 -4.875,0
// 0,2.9999999 4.875,0 L 1.5,13.5 l 2.125,2.125 3.4375,-3.4375 0,4.875 3,0 0,-4.875
// 3.4375,3.4375 2.125,-2.125 -3.4375,-3.4375 4.875,0 0,-2.9999999 -4.875,0 3.4375,-3.4375
// -2.125,-2.125 -3.4375,3.4375 0,-4.8750001 z',
d:'m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} ' + d:'m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} ' +
'{e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} ' + '{e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} ' +
'{e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} ' + '{e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} ' +
@ -234,6 +157,46 @@ function PathMap(Snap) {
width: 17.125, width: 17.125,
heightElements: [4.875, 3.4375, 2.125, 3], heightElements: [4.875, 3.4375, 2.125, 3],
widthElements: [3.4375, 2.125, 4.875, 3] widthElements: [3.4375, 2.125, 4.875, 3]
},
'DATA_OBJECT_PATH': {//d="m 0,0 40,0 10,10 0,50 -50,0 0,-60 40,0 0,10 10,0"
d:'m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0',
height: 61,
width: 51,
heightElements: [10, 50, 60],
widthElements: [10, 40, 50, 60]
},
'DATA_OBJECT_COLLECTION_PATH': {
d:'m {mx}, {my} ' +
'm 0 15 l 0 -15 ' +
'm 4 15 l 0 -15 ' +
'm 4 15 l 0 -15 ',
height: 61,
width: 51,
heightElements: [12],
widthElements: [1, 6, 12, 15]
},
'DATA_ARROW': {
d:'m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z',
height: 61,
width: 51,
heightElements: [],
widthElements: []
},
'DATA_STORE': {
d:'m {mx},{my} ' +
'l 0,{e.y2} ' +
'c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 ' +
'l 0,-{e.y2} ' +
'c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0' +
'c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 ' +
'm 0,{e.y0}' +
'c -{e.x0},{e.y1} -{e.x1},{e.y1} -{e.x2},0' +
'm 0,{e.y0}' +
'c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0',
height: 61,
width: 61,
heightElements: [7, 10, 45],
widthElements: [2, 58, 60]
} }
}; };
@ -299,8 +262,8 @@ function PathMap(Snap) {
var my = param.containerHeight * param.position.my; var my = param.containerHeight * param.position.my;
// path // path
var heightRatio = (param.containerHeight * param.yScaleFactor) / rawPath.height; var heightRatio = (param.containerHeight / rawPath.height) * param.yScaleFactor;
var widthRatio = (param.containerWidth * param.xScaleFactor) / rawPath.width; var widthRatio = (param.containerWidth / rawPath.width) * param.xScaleFactor;
var coordinates = {}; //map for the scaled coordinates var coordinates = {}; //map for the scaled coordinates
//Apply height ratio //Apply height ratio