1/**2 * Copyright (c) 2006-2014, JGraph Holdings Ltd3 */45//**********************************************************************************************************************************************************6//Location7//**********************************************************************************************************************************************************8/**9* Extends mxShape.10*/11function mxArchiMateLocation(bounds, fill, stroke, strokewidth)12{13 mxShape.call(this);14 this.bounds = bounds;15 this.fill = fill;16 this.stroke = stroke;17 this.strokewidth = (strokewidth != null) ? strokewidth : 1;18};1920/**21* Extends mxShape.22*/23mxUtils.extend(mxArchiMateLocation, mxShape);2425mxArchiMateLocation.prototype.cst = {26 LOCATION : 'mxgraph.archimate.location'27};2829/**30* Function: paintVertexShape31* 32* Paints the vertex shape.33*/34mxArchiMateLocation.prototype.paintVertexShape = function(c, x, y, w, h)35{36 c.translate(x, y);37 this.background(c, 0, 0, w, h);38 c.setShadow(false);39 c.translate(w - 20, 5);40 this.foreground(c, w - 20, 5, 15, 15);41};4243mxArchiMateLocation.prototype.background = function(c, x, y, w, h)44{45 c.rect(0, 0, w, h);46 c.fillAndStroke();47};4849mxArchiMateLocation.prototype.foreground = function(c, x, y, w, h)50{51 c.setDashed(false);52 53 c.translate(3 ,0);54 w = w - 6;55 c.begin();56 c.moveTo(w * 0.5, h);57 c.arcTo(w * 0.1775, h * 0.3, 0, 0, 0, w * 0.345, h * 0.7);58 c.arcTo(w * 0.538, h * 0.364, 0, 0, 1, w * 0.5, 0);59 c.arcTo(w * 0.538, h * 0.364, 0, 0, 1, w * 0.655, h * 0.7);60 c.arcTo(w * 0.1775, h * 0.3, 0, 0, 0, w * 0.5, h);61 c.stroke();62};6364mxCellRenderer.registerShape(mxArchiMateLocation.prototype.cst.LOCATION, mxArchiMateLocation);6566mxArchiMateLocation.prototype.getConstraints = function(style, w, h)67{68 var constr = [];6970 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false));71 constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));72 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));73 constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));74 constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));75 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false));76 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));77 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false));78 constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false));79 constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));80 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));81 constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));82 constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));83 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.75), false));84 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));85 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.25), false));8687 return (constr);88};8990//**********************************************************************************************************************************************************91//Business92//**********************************************************************************************************************************************************93/**94* Extends mxShape.95*/96function mxArchiMateBusiness(bounds, fill, stroke, strokewidth)97{98 mxShape.call(this);99 this.bounds = bounds;100 this.fill = fill;101 this.stroke = stroke;102 this.strokewidth = (strokewidth != null) ? strokewidth : 1;103};104105/**106* Extends mxShape.107*/108mxUtils.extend(mxArchiMateBusiness, mxShape);109110mxArchiMateBusiness.prototype.cst = {111 BUSINESS : 'mxgraph.archimate.business',112 TYPE : 'busType',113 PROCESS : 'process',114 FUNCTION : 'function',115 INTERACTION : 'interaction',116 EVENT : 'event',117 SERVICE : 'service'118};119120mxArchiMateBusiness.prototype.customProperties = [121 {name: 'busType', dispName: 'Business Type', type: 'enum', 122 enumList: [{val: 'process', dispName: 'Process'}, 123 {val: 'function', dispName: 'Function'}, 124 {val: 'interaction', dispName: 'Interaction'}, 125 {val: 'event', dispName: 'Event'}, 126 {val: 'service', dispName: 'Service'}]127 }128];129130/**131* Function: paintVertexShape132* 133* Paints the vertex shape.134*/135mxArchiMateBusiness.prototype.paintVertexShape = function(c, x, y, w, h)136{137 c.translate(x, y);138 this.background(c, 0, 0, w, h);139 c.setShadow(false);140 c.translate(w - 20, 5);141 this.foreground(c, w - 20, 5, 15, 15);142};143144mxArchiMateBusiness.prototype.background = function(c, x, y, w, h)145{146 c.roundrect(0, 0, w, h, 10, 10);147 c.fillAndStroke();148};149150mxArchiMateBusiness.prototype.foreground = function(c, x, y, w, h)151{152 var type = mxUtils.getValue(this.style, mxArchiMateBusiness.prototype.cst.TYPE, mxArchiMateBusiness.prototype.cst.PROCESS);153 154 c.setDashed(false);155 156 if (type === mxArchiMateBusiness.prototype.cst.PROCESS)157 {158 c.translate(0, 2);159 h = h - 4;160 161 c.begin();162 c.moveTo(0, h * 0.15);163 c.lineTo(w * 0.65, h * 0.15);164 c.lineTo(w * 0.65, 0);165 c.lineTo(w, h * 0.5);166 c.lineTo(w * 0.65, h);167 c.lineTo(w * 0.65, h * 0.85);168 c.lineTo(0, h * 0.85);169 c.close();170 c.stroke();171 }172 else if (type === mxArchiMateBusiness.prototype.cst.FUNCTION)173 {174 c.translate(2, 0);175 w = w - 4;176 177 c.begin();178 c.moveTo(0, h * 0.15);179 c.lineTo(w * 0.5, 0);180 c.lineTo(w, h * 0.15);181 c.lineTo(w, h);182 c.lineTo(w * 0.5, h * 0.85);183 c.lineTo(0, h);184 c.close();185 c.stroke();186 }187 else if (type === mxArchiMateBusiness.prototype.cst.INTERACTION)188 {189 c.begin();190 c.moveTo(w * 0.55, 0);191 c.arcTo(w * 0.45, h * 0.5, 0, 0, 1, w * 0.55, h);192 c.close();193 c.moveTo(w * 0.45, 0);194 c.arcTo(w * 0.45, h * 0.5, 0, 0, 0, w * 0.45, h);195 c.close();196 c.stroke();197 }198 else if (type === mxArchiMateBusiness.prototype.cst.EVENT)199 {200 c.translate(0, 3);201 h = h - 6;202 203 c.begin();204 c.moveTo(w - h * 0.5, 0);205 c.arcTo(h * 0.5, h * 0.5, 0, 0, 1, w - h * 0.5, h);206 c.lineTo(0, h);207 c.arcTo(h * 0.5, h * 0.5, 0, 0, 0, 0, 0);208 c.close();209 c.stroke();210 }211 else if (type === mxArchiMateBusiness.prototype.cst.SERVICE)212 {213 c.translate(0, 3);214 h = h - 6;215 216 c.begin();217 c.moveTo(w - h * 0.5, 0);218 c.arcTo(h * 0.5, h * 0.5, 0, 0, 1, w - h * 0.5, h);219 c.lineTo(0, h);220 c.arcTo(h * 0.5, h * 0.5, 0, 0, 1, 0, 0);221 c.close();222 c.stroke();223 }224};225226mxCellRenderer.registerShape(mxArchiMateBusiness.prototype.cst.BUSINESS, mxArchiMateBusiness);227228mxArchiMateBusiness.prototype.getConstraints = function(style, w, h)229{230 var constr = [];231232 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 2.9, 2.9));233 constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));234 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));235 constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));236 constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false, null, -2.9, 2.9));237 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false));238 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));239 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false));240 constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false, null, -2.9, -2.9));241 constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));242 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));243 constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));244 constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false, null, 2.9, -2.9));245 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.75), false));246 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));247 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.25), false));248249 return (constr);250};251252//**********************************************************************************************************************************************************253//Business Object254//**********************************************************************************************************************************************************255/**256* Extends mxShape.257*/258function mxArchiMateBusinessObject(bounds, fill, stroke, strokewidth)259{260 mxShape.call(this);261 this.bounds = bounds;262 this.fill = fill;263 this.stroke = stroke;264 this.strokewidth = (strokewidth != null) ? strokewidth : 1;265};266267/**268* Extends mxShape.269*/270mxUtils.extend(mxArchiMateBusinessObject, mxShape);271272mxArchiMateBusinessObject.prototype.cst = {273 BUSINESS_OBJECT : 'mxgraph.archimate.businessObject'274};275276/**277* Function: paintVertexShape278* 279* Paints the vertex shape.280*/281mxArchiMateBusinessObject.prototype.paintVertexShape = function(c, x, y, w, h)282{283 c.translate(x, y);284 this.background(c, 0, 0, w, h);285 c.setShadow(false);286 this.foreground(c, 0, 0, w, h);287};288289mxArchiMateBusinessObject.prototype.background = function(c, x, y, w, h)290{291 c.rect(0, 0, w, h);292 c.fillAndStroke();293};294295mxArchiMateBusinessObject.prototype.foreground = function(c, x, y, w, h)296{297 if (h >= 15)298 {299 c.begin();300 c.moveTo(0, 15);301 c.lineTo(w, 15);302 c.stroke();303 }304};305306mxCellRenderer.registerShape(mxArchiMateBusinessObject.prototype.cst.BUSINESS_OBJECT, mxArchiMateBusinessObject);307308mxArchiMateBusinessObject.prototype.getConstraints = function(style, w, h)309{310 var constr = [];311312 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 2.9, 2.9));313 constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));314 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));315 constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));316 constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false, null, -2.9, 2.9));317 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false));318 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));319 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false));320 constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false, null, -2.9, -2.9));321 constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));322 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));323 constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));324 constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false, null, 2.9, -2.9));325 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.75), false));326 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));327 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.25), false));328329 return (constr);330};331332//**********************************************************************************************************************************************************333//Representation334//**********************************************************************************************************************************************************335/**336* Extends mxShape.337*/338function mxArchiMateRepresentation(bounds, fill, stroke, strokewidth)339{340 mxShape.call(this);341 this.bounds = bounds;342 this.fill = fill;343 this.stroke = stroke;344 this.strokewidth = (strokewidth != null) ? strokewidth : 1;345};346347/**348* Extends mxShape.349*/350mxUtils.extend(mxArchiMateRepresentation, mxShape);351352mxArchiMateRepresentation.prototype.cst = {353 REPRESENTATION : 'mxgraph.archimate.representation'354};355356/**357* Function: paintVertexShape358* 359* Paints the vertex shape.360*/361mxArchiMateRepresentation.prototype.paintVertexShape = function(c, x, y, w, h)362{363 c.translate(x, y);364 this.background(c, 0, 0, w, h);365};366367mxArchiMateRepresentation.prototype.background = function(c, x, y, w, h)368{369 c.begin();370 c.moveTo(0, 0);371 c.lineTo(w, 0);372 c.lineTo(w, h * 0.85);373 c.arcTo(w * 0.35, h * 0.35, 0, 0, 0, w * 0.5, h * 0.85);374 c.arcTo(w * 0.35, h * 0.35, 0, 0, 1, 0, h * 0.85);375 c.close();376 c.fillAndStroke();377};378379mxCellRenderer.registerShape(mxArchiMateRepresentation.prototype.cst.REPRESENTATION, mxArchiMateRepresentation);380381mxArchiMateRepresentation.prototype.getConstraints = function(style, w, h)382{383 var constr = [];384385 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false));386 constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));387 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));388 constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));389 constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));390 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false));391 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));392 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false));393 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.85), false, null));394 constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0.745), false));395 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0.85), false));396 constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0.955), false));397 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.85), false));398 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.75), false));399 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));400 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.25), false));401402 return (constr);403};404405//**********************************************************************************************************************************************************406//Product407//**********************************************************************************************************************************************************408/**409* Extends mxShape.410*/411function mxArchiMateProduct(bounds, fill, stroke, strokewidth)412{413 mxShape.call(this);414 this.bounds = bounds;415 this.fill = fill;416 this.stroke = stroke;417 this.strokewidth = (strokewidth != null) ? strokewidth : 1;418};419420/**421* Extends mxShape.422*/423mxUtils.extend(mxArchiMateProduct, mxShape);424425mxArchiMateProduct.prototype.cst = {426 PRODUCT : 'mxgraph.archimate.product'427};428429/**430* Function: paintVertexShape431* 432* Paints the vertex shape.433*/434mxArchiMateProduct.prototype.paintVertexShape = function(c, x, y, w, h)435{436 c.translate(x, y);437 this.background(c, 0, 0, w, h);438 c.setShadow(false);439 this.foreground(c, 0, 0, w, h);440};441442mxArchiMateProduct.prototype.background = function(c, x, y, w, h)443{444 c.rect(0, 0, w, h);445 c.fillAndStroke();446};447448mxArchiMateProduct.prototype.foreground = function(c, x, y, w, h)449{450 if (h >= 15)451 {452 c.begin();453 c.moveTo(0, 15);454 c.lineTo(w * 0.6, 15);455 c.lineTo(w * 0.6, 0);456 c.stroke();457 }458};459460mxCellRenderer.registerShape(mxArchiMateProduct.prototype.cst.PRODUCT, mxArchiMateProduct);461462//**********************************************************************************************************************************************************463//Application464//**********************************************************************************************************************************************************465/**466* Extends mxShape.467*/468function mxArchiMateApplication(bounds, fill, stroke, strokewidth)469{470 mxShape.call(this);471 this.bounds = bounds;472 this.fill = fill;473 this.stroke = stroke;474 this.strokewidth = (strokewidth != null) ? strokewidth : 1;475};476477/**478* Extends mxShape.479*/480mxUtils.extend(mxArchiMateApplication, mxShape);481482mxArchiMateApplication.prototype.cst = {483 APPLICATION : 'mxgraph.archimate.application',484 TYPE : 'appType',485 COMPONENT : 'comp',486 INTERFACE : 'interface',487 INTERFACE2 : 'interface2',488 FUNCTION : 'function',489 INTERACTION : 'interaction',490 SERVICE : 'service',491 NODE : 'node',492 NETWORK : 'network',493 COMM_PATH : 'commPath',494 SYS_SW : 'sysSw',495 ARTIFACT : 'artifact',496 ACTOR : 'actor',497 ROLE : 'role',498 COLLABORATION : 'collab'499};500501mxArchiMateApplication.prototype.customProperties = [502 {name: 'appType', dispName: 'App Type', type: 'enum', 503 enumList: [{val: 'comp', dispName: 'Component'}, 504 {val: 'interface', dispName: 'Interface'}, 505 {val: 'interface2', dispName: 'Interface2'}, 506 {val: 'function', dispName: 'Function'}, 507 {val: 'interaction', dispName: 'Interaction'}, 508 {val: 'service', dispName: 'Service'}, 509 {val: 'node', dispName: 'Node'}, 510 {val: 'network', dispName: 'Network'}, 511 {val: 'commPath', dispName: 'Comm Path'}, 512 {val: 'artifact', dispName: 'Artifact'}, 513 {val: 'sysSw', dispName: 'System Sw'}, 514 {val: 'path', dispName: 'Path'},515 {val: 'actor', dispName: 'Actor'}, 516 {val: 'role', dispName: 'Role'}, 517 {val: 'collab', dispName: 'Collaboration'}]518 }519];520521/**522* Function: paintVertexShape523* 524* Paints the vertex shape.525*/526mxArchiMateApplication.prototype.paintVertexShape = function(c, x, y, w, h)527{528 c.translate(x, y);529 this.background(c, 0, 0, w, h);530 c.setShadow(false);531 c.translate(w - 20, 5);532 this.foreground(c, w - 20, 5, 15, 15);533};534535mxArchiMateApplication.prototype.background = function(c, x, y, w, h)536{537 c.rect(0, 0, w, h);538 c.fillAndStroke();539};540541mxArchiMateApplication.prototype.foreground = function(c, x, y, w, h)542{543 var type = mxUtils.getValue(this.style, mxArchiMateApplication.prototype.cst.TYPE, mxArchiMateApplication.prototype.cst.COMPONENT);544 545 c.setDashed(false);546 547 if (type === mxArchiMateApplication.prototype.cst.COMPONENT)548 {549 c.translate(1, 0);550 w = w - 2;551552 c.rect(w * 0.25, 0, w * 0.75, h);553 c.stroke();554 555 c.rect(0, h * 0.25, w * 0.5, h * 0.15);556 c.fillAndStroke();557 558 c.rect(0, h * 0.6, w * 0.5, h * 0.15);559 c.fillAndStroke();560 }561 else if (type === mxArchiMateApplication.prototype.cst.COLLABORATION)562 {563 c.translate(0, 3);564 h = h - 6;565 566 c.ellipse(0, 0, w * 0.6, h);567 c.stroke();568 c.ellipse(w * 0.4, 0, w * 0.6, h);569 c.fillAndStroke();570 }571 else if (type === mxArchiMateApplication.prototype.cst.INTERFACE)572 {573 c.translate(0, 4);574 h = h - 8;575 576 c.ellipse(w * 0.5, 0, w * 0.5, h);577 c.stroke();578 579 c.begin();580 c.moveTo(0, h * 0.5);581 c.lineTo(w * 0.5, h * 0.5);582 c.stroke();583 }584 else if (type === mxArchiMateApplication.prototype.cst.INTERFACE2)585 {586 c.translate(0, 1);587 h = h - 2;588 589 c.begin();590 c.moveTo(0, h * 0.5);591 c.lineTo(w * 0.6, h * 0.5);592 c.moveTo(w, 0);593 c.arcTo(w * 0.4, h * 0.5, 0, 0, 0, w, h);594 c.stroke();595 }596 else if (type === mxArchiMateApplication.prototype.cst.FUNCTION)597 {598 c.begin();599 c.moveTo(w * 0.5, 0);600 c.lineTo(w, h * 0.2);601 c.lineTo(w, h);602 c.lineTo(w * 0.5, h * 0.8);603 c.lineTo(0, h);604 c.lineTo(0, h * 0.2);605 c.close();606 c.stroke();607 }608 else if (type === mxArchiMateApplication.prototype.cst.INTERACTION)609 {610 c.begin();611 c.moveTo(w * 0.55, 0);612 c.arcTo(w * 0.45, h * 0.5, 0, 0, 1, w * 0.55, h);613 c.close();614 c.moveTo(w * 0.45, 0);615 c.arcTo(w * 0.45, h * 0.5, 0, 0, 0, w * 0.45, h);616 c.close();617 c.stroke();618 }619 else if (type === mxArchiMateApplication.prototype.cst.SERVICE)620 {621 c.translate(0, 3);622 h = h - 6;623 624 c.begin();625 c.moveTo(w - h * 0.5, 0);626 c.arcTo(h * 0.5, h * 0.5, 0, 0, 1, w - h * 0.5, h);627 c.lineTo(0, h);628 c.arcTo(h * 0.5, h * 0.5, 0, 0, 1, 0, 0);629 c.close();630 c.stroke();631 }632 else if (type === mxArchiMateApplication.prototype.cst.NODE)633 {634 c.begin();635 c.moveTo(0, h * 0.25);636 c.lineTo(w * 0.25, 0);637 c.lineTo(w, 0);638 c.lineTo(w, h * 0.75);639 c.lineTo(w * 0.75, h);640 c.lineTo(0, h);641 c.close();642 c.moveTo(0, h * 0.25);643 c.lineTo(w * 0.75, h * 0.25);644 c.lineTo(w * 0.75, h);645 c.moveTo(w, 0);646 c.lineTo(w * 0.75, h * 0.25);647 c.stroke();648 }649 else if (type === mxArchiMateApplication.prototype.cst.NETWORK)650 {651 c.translate(0, 2);652 h = h - 4;653 654 c.begin();655 c.moveTo(w * 0.4, h * 0.2);656 c.lineTo(w * 0.85, h * 0.2);657 c.lineTo(w * 0.6, h * 0.8);658 c.lineTo(w * 0.15, h * 0.8);659 c.close();660 c.stroke();661 662 var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#000000');663 c.setFillColor(strokeColor);664 665 c.ellipse(w * 0.25, 0, w * 0.3, h * 0.4);666 c.fill();667 668 c.ellipse(w * 0.7, 0, w * 0.3, h * 0.4);669 c.fill();670 671 c.ellipse(0, h * 0.6, w * 0.3, h * 0.4);672 c.fill();673 674 c.ellipse(w * 0.45, h * 0.6, w * 0.3, h * 0.4);675 c.fill();676 }677 else if (type === mxArchiMateApplication.prototype.cst.COMM_PATH)678 {679 c.translate(0, 5);680 h = h - 10;681 682 c.begin();683 c.moveTo(w * 0.1, 0);684 c.lineTo(0, h * 0.5);685 c.lineTo(w * 0.1, h);686 c.moveTo(w * 0.9, 0);687 c.lineTo(w, h * 0.5);688 c.lineTo(w * 0.9, h);689 c.stroke();690 691 c.setDashed(true);692 c.begin();693 c.moveTo(0, h * 0.5);694 c.lineTo(w, h * 0.5);695 c.stroke();696 }697 else if (type === mxArchiMateApplication.prototype.cst.SYS_SW)698 {699 c.ellipse(w * 0.3, 0, w * 0.7, h * 0.7);700 c.stroke();701 702 c.ellipse(0, h * 0.02, w * 0.98, h * 0.98);703 c.fillAndStroke();704 }705 else if (type === mxArchiMateApplication.prototype.cst.ARTIFACT)706 {707 c.translate(2, 0);708 w = w - 4;709710 c.begin();711 c.moveTo(0, 0);712 c.lineTo(w * 0.7, 0);713 c.lineTo(w, h * 0.22);714 c.lineTo(w, h);715 c.lineTo(0, h);716 c.close();717 c.moveTo(w * 0.7, 0);718 c.lineTo(w * 0.7, h * 0.22);719 c.lineTo(w, h * 0.22);720 c.stroke();721 }722 else if (type === mxArchiMateApplication.prototype.cst.ACTOR)723 {724 c.translate(3, 0);725 w = w - 6;726 c.ellipse(w * 0.2, 0, w * 0.6, h * 0.3);727 c.stroke();728 729 c.begin();730 c.moveTo(w * 0.5, h * 0.3);731 c.lineTo(w * 0.5, h * 0.75);732 c.moveTo(0, h * 0.45);733 c.lineTo(w, h * 0.45);734 c.moveTo(0, h);735 c.lineTo(w * 0.5, h * 0.75);736 c.lineTo(w, h);737 c.stroke();738 }739 if (type === mxArchiMateApplication.prototype.cst.ROLE)740 {741 c.translate(0, 4);742 h = h - 8;743744 c.begin();745 c.moveTo(w * 0.8, 0);746 c.lineTo(w * 0.2, 0);747 c.arcTo(w * 0.2, h * 0.5, 0, 0, 0, w * 0.2, h);748 c.lineTo(w * 0.8, h);749 c.stroke();750 751 c.ellipse(w * 0.6, 0, w * 0.4, h);752 c.stroke();753 }754};755756mxCellRenderer.registerShape(mxArchiMateApplication.prototype.cst.APPLICATION, mxArchiMateApplication);757758mxArchiMateApplication.prototype.getConstraints = function(style, w, h)759{760 var constr = [];761762 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false));763 constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));764 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));765 constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));766 constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));767 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false));768 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));769 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false));770 constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false));771 constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));772 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));773 constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));774 constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));775 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.75), false));776 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));777 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.25), false));778779 return (constr);780};781782//**********************************************************************************************************************************************************783//Tech784//**********************************************************************************************************************************************************785/**786* Extends mxShape.787*/788function mxArchiMateTech(bounds, fill, stroke, strokewidth)789{790 mxShape.call(this);791 this.bounds = bounds;792 this.fill = fill;793 this.stroke = stroke;794 this.strokewidth = (strokewidth != null) ? strokewidth : 1;795};796797/**798* Extends mxShape.799*/800mxUtils.extend(mxArchiMateTech, mxShape);801802mxArchiMateTech.prototype.cst = {803 TECH : 'mxgraph.archimate.tech',804 TYPE : 'techType',805 DEVICE : 'device',806 PLATEAU : 'plateau'807};808809mxArchiMateTech.prototype.customProperties = [810 {name: 'techType', dispName: 'Tech Type', type: 'enum', 811 enumList: [{val: 'device', dispName: 'Device'}, 812 {val: 'plateau', dispName: 'Plateau'}]813 }814];815816/**817* Function: paintVertexShape818* 819* Paints the vertex shape.820*/821mxArchiMateTech.prototype.paintVertexShape = function(c, x, y, w, h)822{823 c.translate(x, y);824 this.background(c, 0, 0, w, h);825 c.setShadow(false);826 c.translate(w - 30, 15);827 this.foreground(c, w - 30, 15, 15, 15);828};829830mxArchiMateTech.prototype.background = function(c, x, y, w, h)831{832 c.begin();833 c.moveTo(0, 10);834 c.lineTo(10, 0);835 c.lineTo(w, 0);836 c.lineTo(w, h - 10);837 c.lineTo(w - 10, h);838 c.lineTo(0, h);839 c.close();840 c.moveTo(0, 10);841 c.lineTo(w - 10, 10);842 c.lineTo(w - 10, h);843 c.moveTo(w, 0);844 c.lineTo(w - 10, 10);845 c.fillAndStroke();846};847848mxArchiMateTech.prototype.foreground = function(c, x, y, w, h)849{850 var type = mxUtils.getValue(this.style, mxArchiMateTech.prototype.cst.TYPE, mxArchiMateTech.prototype.cst.DEVICE);851 852 c.setDashed(false);853 854 if (type === mxArchiMateTech.prototype.cst.DEVICE)855 {856 c.roundrect(0, 0, w, h * 0.88, w * 0.05, h * 0.05);857 c.stroke();858 c.begin();859 c.moveTo(w * 0.1, h * 0.88);860 c.lineTo(0, h);861 c.lineTo(w, h);862 c.lineTo(w * 0.9, h * 0.88);863 c.stroke();864 }865 else if (type === mxArchiMateTech.prototype.cst.PLATEAU)866 {867 var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#000000');868 c.setFillColor(strokeColor);869 870 c.rect(w * 0.4, 0, w * 0.6, h * 0.2);871 c.fill();872 873 c.rect(w * 0.2, h * 0.4, w * 0.6, h * 0.2);874 c.fill();875 876 c.rect(0, h * 0.8, w * 0.6, h * 0.2);877 c.fill();878 }879};880881mxCellRenderer.registerShape(mxArchiMateTech.prototype.cst.TECH, mxArchiMateTech);882883mxArchiMateTech.prototype.getConstraints = function(style, w, h)884{885 var constr = [];886887 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, 10));888 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 10, 0));889 constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));890 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));891 constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));892 constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));893 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false));894 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));895 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false));896 constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false, null, 0, -10));897 constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false, null, -10, 0));898 constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));899 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));900 constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));901 constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));902 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.75), false));903 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));904 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.25), false));905906 return (constr);907};908909//**********************************************************************************************************************************************************910//Motivational911//**********************************************************************************************************************************************************912/**913* Extends mxShape.914*/915function mxArchiMateMotivational(bounds, fill, stroke, strokewidth)916{917 mxShape.call(this);918 this.bounds = bounds;919 this.fill = fill;920 this.stroke = stroke;921 this.strokewidth = (strokewidth != null) ? strokewidth : 1;922};923924/**925* Extends mxShape.926*/927mxUtils.extend(mxArchiMateMotivational, mxShape);928929mxArchiMateMotivational.prototype.cst = {930 MOTIV : 'mxgraph.archimate.motiv',931 TYPE : 'motivType',932 STAKE : 'stake',933 DRIVER : 'driver',934 ASSESSMENT : 'assess',935 GOAL : 'goal',936 REQUIREMENT : 'req',937 CONSTRAINT : 'const',938 PRINCIPLE : 'princ'939};940941mxArchiMateMotivational.prototype.customProperties = [942 {name: 'motivType', dispName: 'Motivational Type', type: 'enum', 943 enumList: [{val: 'stake', dispName: 'Stake'}, 944 {val: 'driver', dispName: 'Driver'},945 {val: 'assess', dispName: 'Assessment'},946 {val: 'goal', dispName: 'Goal'},947 {val: 'req', dispName: 'Requirement'},948 {val: 'const', dispName: 'Constraint'},949 {val: 'princ', dispName: 'Principle'}]950 }951];952953/**954* Function: paintVertexShape955* 956* Paints the vertex shape.957*/958mxArchiMateMotivational.prototype.paintVertexShape = function(c, x, y, w, h)959{960 c.translate(x, y);961 this.background(c, 0, 0, w, h);962 c.setShadow(false);963 c.translate(w - 20, 5);964 this.foreground(c, w - 20, 5, 15, 15);965};966967mxArchiMateMotivational.prototype.background = function(c, x, y, w, h)968{969 c.begin();970 c.moveTo(10, 0);971 c.lineTo(w - 10, 0);972 c.lineTo(w, 10);973 c.lineTo(w, h - 10);974 c.lineTo(w - 10, h);975 c.lineTo(10, h);976 c.lineTo(0, h - 10);977 c.lineTo(0, 10);978 c.close();979 c.fillAndStroke();980};981982mxArchiMateMotivational.prototype.foreground = function(c, x, y, w, h)983{984 var type = mxUtils.getValue(this.style, mxArchiMateMotivational.prototype.cst.TYPE, mxArchiMateMotivational.prototype.cst.STAKE);985 986 c.setDashed(false);987 988 if (type === mxArchiMateMotivational.prototype.cst.STAKE)989 {990 c.translate(0, 4);991 h = h - 8;992993 c.begin();994 c.moveTo(w * 0.8, 0);995 c.lineTo(w * 0.2, 0);996 c.arcTo(w * 0.2, h * 0.5, 0, 0, 0, w * 0.2, h);997 c.lineTo(w * 0.8, h);998 c.stroke();999 1000 c.ellipse(w * 0.6, 0, w * 0.4, h);1001 c.stroke();1002 }1003 else if (type === mxArchiMateMotivational.prototype.cst.DRIVER)1004 {1005 c.ellipse(w * 0.1, h * 0.1, w * 0.8, h * 0.8);1006 c.stroke();1007 1008 c.begin();1009 c.moveTo(0, h * 0.5);1010 c.lineTo(w, h * 0.5);1011 c.moveTo(w * 0.5, 0);1012 c.lineTo(w * 0.5, h);1013 c.moveTo(w * 0.145, h * 0.145);1014 c.lineTo(w * 0.855, h * 0.855);1015 c.moveTo(w * 0.145, h * 0.855);1016 c.lineTo(w * 0.855, h * 0.145);1017 c.stroke();1018 1019 var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#000000');1020 c.setFillColor(strokeColor);1021 1022 c.ellipse(w * 0.35, h * 0.35, w * 0.3, h * 0.3);1023 c.fillAndStroke();1024 }1025 else if (type === mxArchiMateMotivational.prototype.cst.ASSESSMENT)1026 {1027 c.ellipse(w * 0.2, 0, w * 0.8, h * 0.8);1028 c.stroke();1029 1030 c.begin();1031 c.moveTo(0, h);1032 c.lineTo(w * 0.32, h * 0.68);1033 c.stroke();1034 }1035 else if (type === mxArchiMateMotivational.prototype.cst.GOAL)1036 {1037 c.ellipse(0, 0, w, h);1038 c.stroke();1039 c.ellipse(w * 0.15, h * 0.15, w * 0.7, h * 0.7);1040 c.stroke();1041 var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#000000');1042 c.setFillColor(strokeColor);1043 c.ellipse(w * 0.3, h * 0.3, w * 0.4, h * 0.4);1044 c.fillAndStroke();1045 }1046 else if (type === mxArchiMateMotivational.prototype.cst.REQUIREMENT)1047 {1048 c.translate(0, 4);1049 h = h - 8;10501051 c.begin();1052 c.moveTo(w * 0.25, 0);1053 c.lineTo(w, 0);1054 c.lineTo(w * 0.75, h);1055 c.lineTo(0, h);1056 c.close();1057 c.stroke();1058 }1059 else if (type === mxArchiMateMotivational.prototype.cst.CONSTRAINT)1060 {1061 c.translate(0, 4);1062 h = h - 8;10631064 c.begin();1065 c.moveTo(w * 0.25, 0);1066 c.lineTo(w, 0);1067 c.lineTo(w * 0.75, h);1068 c.lineTo(0, h);1069 c.close();1070 c.moveTo(w * 0.45, 0);1071 c.lineTo(w * 0.2, h);1072 c.stroke();1073 }1074 else if (type === mxArchiMateMotivational.prototype.cst.PRINCIPLE)1075 {1076 c.begin();1077 c.moveTo(w * 0.05, h * 0.05);1078 c.arcTo(w * 2.3, h * 2.3, 0, 0, 1, w * 0.95, h * 0.05);1079 c.arcTo(w * 2.3, h * 2.3, 0, 0, 1, w * 0.95, h * 0.95);1080 c.arcTo(w * 2.3, h * 2.3, 0, 0, 1, w * 0.05, h * 0.95);1081 c.arcTo(w * 2.3, h * 2.3, 0, 0, 1, w * 0.05, h * 0.05);1082 c.close();1083 c.stroke();1084 1085 var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#000000');1086 c.setFillColor(strokeColor);1087 1088 c.begin();1089 c.moveTo(w * 0.45, h * 0.7);1090 c.lineTo(w * 0.42, h * 0.15);1091 c.lineTo(w * 0.58, h * 0.15);1092 c.lineTo(w * 0.55, h * 0.7);1093 c.close();1094 c.fill();1095 1096 c.rect(w * 0.45, h * 0.75, w * 0.1, h * 0.1);1097 c.fill();1098 }1099};11001101mxCellRenderer.registerShape(mxArchiMateMotivational.prototype.cst.MOTIV, mxArchiMateMotivational);11021103mxArchiMateMotivational.prototype.getConstraints = function(style, w, h)1104{1105 var constr = [];11061107 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 5, 5));1108 constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));1109 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));1110 constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));1111 constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false, null, -5, 5));1112 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false));1113 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));1114 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false));1115 constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false, null, -5, -5));1116 constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));1117 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));1118 constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));1119 constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false, null, 5, -5));1120 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.75), false));1121 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));1122 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.25), false));11231124 return (constr);1125};11261127//**********************************************************************************************************************************************************1128//Gap1129//**********************************************************************************************************************************************************1130/**1131* Extends mxShape.1132*/1133function mxArchiMateGap(bounds, fill, stroke, strokewidth)1134{1135 mxShape.call(this);1136 this.bounds = bounds;1137 this.fill = fill;1138 this.stroke = stroke;1139 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1140};11411142/**1143* Extends mxShape.1144*/1145mxUtils.extend(mxArchiMateGap, mxShape);11461147mxArchiMateGap.prototype.cst = {1148 GAP : 'mxgraph.archimate.gap'1149};11501151/**1152* Function: paintVertexShape1153* 1154* Paints the vertex shape.1155*/1156mxArchiMateGap.prototype.paintVertexShape = function(c, x, y, w, h)1157{1158 c.translate(x, y);1159 this.background(c, 0, 0, w, h);1160 c.setShadow(false);1161 c.translate(w - 20, 5);1162 this.foreground(c, w - 20, 5, 15, 15);1163};11641165mxArchiMateGap.prototype.background = function(c, x, y, w, h)1166{1167 c.begin();1168 c.moveTo(0, 0);1169 c.lineTo(w, 0);1170 c.lineTo(w, h * 0.85);1171 c.arcTo(w * 0.35, h * 0.35, 0, 0, 0, w * 0.5, h * 0.85);1172 c.arcTo(w * 0.35, h * 0.35, 0, 0, 1, 0, h * 0.85);1173 c.close();1174 c.fillAndStroke();1175};11761177mxArchiMateGap.prototype.foreground = function(c, x, y, w, h)1178{1179 c.setDashed(false);1180 1181 c.translate(0, 2);1182 h = h - 4;11831184 c.ellipse(w * 0.15, 0, w * 0.7, h);1185 c.stroke();1186 1187 c.begin();1188 c.moveTo(0, h * 0.35);1189 c.lineTo(w, h * 0.35);1190 c.moveTo(0, h * 0.65);1191 c.lineTo(w, h * 0.65);1192 c.stroke();1193};11941195mxCellRenderer.registerShape(mxArchiMateGap.prototype.cst.GAP, mxArchiMateGap);11961197mxArchiMateGap.prototype.getConstraints = function(style, w, h)1198{1199 var constr = [];12001201 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false));1202 constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));1203 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));1204 constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));1205 constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));1206 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false));1207 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));1208 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false));1209 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.85), false, null));1210 constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0.745), false));1211 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0.85), false));1212 constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0.955), false));1213 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.85), false));1214 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.75), false));1215 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));1216 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.25), false));12171218 return (constr);1219};