mxArchiMate.js 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219
  1. /**
  2. * Copyright (c) 2006-2014, JGraph Holdings Ltd
  3. */
  4. //**********************************************************************************************************************************************************
  5. //Location
  6. //**********************************************************************************************************************************************************
  7. /**
  8. * Extends mxShape.
  9. */
  10. function mxArchiMateLocation(bounds, fill, stroke, strokewidth)
  11. {
  12. mxShape.call(this);
  13. this.bounds = bounds;
  14. this.fill = fill;
  15. this.stroke = stroke;
  16. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  17. };
  18. /**
  19. * Extends mxShape.
  20. */
  21. mxUtils.extend(mxArchiMateLocation, mxShape);
  22. mxArchiMateLocation.prototype.cst = {
  23. LOCATION : 'mxgraph.archimate.location'
  24. };
  25. /**
  26. * Function: paintVertexShape
  27. *
  28. * Paints the vertex shape.
  29. */
  30. mxArchiMateLocation.prototype.paintVertexShape = function(c, x, y, w, h)
  31. {
  32. c.translate(x, y);
  33. this.background(c, 0, 0, w, h);
  34. c.setShadow(false);
  35. c.translate(w - 20, 5);
  36. this.foreground(c, w - 20, 5, 15, 15);
  37. };
  38. mxArchiMateLocation.prototype.background = function(c, x, y, w, h)
  39. {
  40. c.rect(0, 0, w, h);
  41. c.fillAndStroke();
  42. };
  43. mxArchiMateLocation.prototype.foreground = function(c, x, y, w, h)
  44. {
  45. c.setDashed(false);
  46. c.translate(3 ,0);
  47. w = w - 6;
  48. c.begin();
  49. c.moveTo(w * 0.5, h);
  50. c.arcTo(w * 0.1775, h * 0.3, 0, 0, 0, w * 0.345, h * 0.7);
  51. c.arcTo(w * 0.538, h * 0.364, 0, 0, 1, w * 0.5, 0);
  52. c.arcTo(w * 0.538, h * 0.364, 0, 0, 1, w * 0.655, h * 0.7);
  53. c.arcTo(w * 0.1775, h * 0.3, 0, 0, 0, w * 0.5, h);
  54. c.stroke();
  55. };
  56. mxCellRenderer.registerShape(mxArchiMateLocation.prototype.cst.LOCATION, mxArchiMateLocation);
  57. mxArchiMateLocation.prototype.getConstraints = function(style, w, h)
  58. {
  59. var constr = [];
  60. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false));
  61. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));
  62. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
  63. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));
  64. constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));
  65. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false));
  66. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  67. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false));
  68. constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false));
  69. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));
  70. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
  71. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));
  72. constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));
  73. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.75), false));
  74. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  75. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.25), false));
  76. return (constr);
  77. };
  78. //**********************************************************************************************************************************************************
  79. //Business
  80. //**********************************************************************************************************************************************************
  81. /**
  82. * Extends mxShape.
  83. */
  84. function mxArchiMateBusiness(bounds, fill, stroke, strokewidth)
  85. {
  86. mxShape.call(this);
  87. this.bounds = bounds;
  88. this.fill = fill;
  89. this.stroke = stroke;
  90. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  91. };
  92. /**
  93. * Extends mxShape.
  94. */
  95. mxUtils.extend(mxArchiMateBusiness, mxShape);
  96. mxArchiMateBusiness.prototype.cst = {
  97. BUSINESS : 'mxgraph.archimate.business',
  98. TYPE : 'busType',
  99. PROCESS : 'process',
  100. FUNCTION : 'function',
  101. INTERACTION : 'interaction',
  102. EVENT : 'event',
  103. SERVICE : 'service'
  104. };
  105. mxArchiMateBusiness.prototype.customProperties = [
  106. {name: 'busType', dispName: 'Business Type', type: 'enum',
  107. enumList: [{val: 'process', dispName: 'Process'},
  108. {val: 'function', dispName: 'Function'},
  109. {val: 'interaction', dispName: 'Interaction'},
  110. {val: 'event', dispName: 'Event'},
  111. {val: 'service', dispName: 'Service'}]
  112. }
  113. ];
  114. /**
  115. * Function: paintVertexShape
  116. *
  117. * Paints the vertex shape.
  118. */
  119. mxArchiMateBusiness.prototype.paintVertexShape = function(c, x, y, w, h)
  120. {
  121. c.translate(x, y);
  122. this.background(c, 0, 0, w, h);
  123. c.setShadow(false);
  124. c.translate(w - 20, 5);
  125. this.foreground(c, w - 20, 5, 15, 15);
  126. };
  127. mxArchiMateBusiness.prototype.background = function(c, x, y, w, h)
  128. {
  129. c.roundrect(0, 0, w, h, 10, 10);
  130. c.fillAndStroke();
  131. };
  132. mxArchiMateBusiness.prototype.foreground = function(c, x, y, w, h)
  133. {
  134. var type = mxUtils.getValue(this.style, mxArchiMateBusiness.prototype.cst.TYPE, mxArchiMateBusiness.prototype.cst.PROCESS);
  135. c.setDashed(false);
  136. if (type === mxArchiMateBusiness.prototype.cst.PROCESS)
  137. {
  138. c.translate(0, 2);
  139. h = h - 4;
  140. c.begin();
  141. c.moveTo(0, h * 0.15);
  142. c.lineTo(w * 0.65, h * 0.15);
  143. c.lineTo(w * 0.65, 0);
  144. c.lineTo(w, h * 0.5);
  145. c.lineTo(w * 0.65, h);
  146. c.lineTo(w * 0.65, h * 0.85);
  147. c.lineTo(0, h * 0.85);
  148. c.close();
  149. c.stroke();
  150. }
  151. else if (type === mxArchiMateBusiness.prototype.cst.FUNCTION)
  152. {
  153. c.translate(2, 0);
  154. w = w - 4;
  155. c.begin();
  156. c.moveTo(0, h * 0.15);
  157. c.lineTo(w * 0.5, 0);
  158. c.lineTo(w, h * 0.15);
  159. c.lineTo(w, h);
  160. c.lineTo(w * 0.5, h * 0.85);
  161. c.lineTo(0, h);
  162. c.close();
  163. c.stroke();
  164. }
  165. else if (type === mxArchiMateBusiness.prototype.cst.INTERACTION)
  166. {
  167. c.begin();
  168. c.moveTo(w * 0.55, 0);
  169. c.arcTo(w * 0.45, h * 0.5, 0, 0, 1, w * 0.55, h);
  170. c.close();
  171. c.moveTo(w * 0.45, 0);
  172. c.arcTo(w * 0.45, h * 0.5, 0, 0, 0, w * 0.45, h);
  173. c.close();
  174. c.stroke();
  175. }
  176. else if (type === mxArchiMateBusiness.prototype.cst.EVENT)
  177. {
  178. c.translate(0, 3);
  179. h = h - 6;
  180. c.begin();
  181. c.moveTo(w - h * 0.5, 0);
  182. c.arcTo(h * 0.5, h * 0.5, 0, 0, 1, w - h * 0.5, h);
  183. c.lineTo(0, h);
  184. c.arcTo(h * 0.5, h * 0.5, 0, 0, 0, 0, 0);
  185. c.close();
  186. c.stroke();
  187. }
  188. else if (type === mxArchiMateBusiness.prototype.cst.SERVICE)
  189. {
  190. c.translate(0, 3);
  191. h = h - 6;
  192. c.begin();
  193. c.moveTo(w - h * 0.5, 0);
  194. c.arcTo(h * 0.5, h * 0.5, 0, 0, 1, w - h * 0.5, h);
  195. c.lineTo(0, h);
  196. c.arcTo(h * 0.5, h * 0.5, 0, 0, 1, 0, 0);
  197. c.close();
  198. c.stroke();
  199. }
  200. };
  201. mxCellRenderer.registerShape(mxArchiMateBusiness.prototype.cst.BUSINESS, mxArchiMateBusiness);
  202. mxArchiMateBusiness.prototype.getConstraints = function(style, w, h)
  203. {
  204. var constr = [];
  205. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 2.9, 2.9));
  206. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));
  207. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
  208. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));
  209. constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false, null, -2.9, 2.9));
  210. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false));
  211. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  212. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false));
  213. constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false, null, -2.9, -2.9));
  214. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));
  215. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
  216. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));
  217. constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false, null, 2.9, -2.9));
  218. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.75), false));
  219. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  220. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.25), false));
  221. return (constr);
  222. };
  223. //**********************************************************************************************************************************************************
  224. //Business Object
  225. //**********************************************************************************************************************************************************
  226. /**
  227. * Extends mxShape.
  228. */
  229. function mxArchiMateBusinessObject(bounds, fill, stroke, strokewidth)
  230. {
  231. mxShape.call(this);
  232. this.bounds = bounds;
  233. this.fill = fill;
  234. this.stroke = stroke;
  235. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  236. };
  237. /**
  238. * Extends mxShape.
  239. */
  240. mxUtils.extend(mxArchiMateBusinessObject, mxShape);
  241. mxArchiMateBusinessObject.prototype.cst = {
  242. BUSINESS_OBJECT : 'mxgraph.archimate.businessObject'
  243. };
  244. /**
  245. * Function: paintVertexShape
  246. *
  247. * Paints the vertex shape.
  248. */
  249. mxArchiMateBusinessObject.prototype.paintVertexShape = function(c, x, y, w, h)
  250. {
  251. c.translate(x, y);
  252. this.background(c, 0, 0, w, h);
  253. c.setShadow(false);
  254. this.foreground(c, 0, 0, w, h);
  255. };
  256. mxArchiMateBusinessObject.prototype.background = function(c, x, y, w, h)
  257. {
  258. c.rect(0, 0, w, h);
  259. c.fillAndStroke();
  260. };
  261. mxArchiMateBusinessObject.prototype.foreground = function(c, x, y, w, h)
  262. {
  263. if (h >= 15)
  264. {
  265. c.begin();
  266. c.moveTo(0, 15);
  267. c.lineTo(w, 15);
  268. c.stroke();
  269. }
  270. };
  271. mxCellRenderer.registerShape(mxArchiMateBusinessObject.prototype.cst.BUSINESS_OBJECT, mxArchiMateBusinessObject);
  272. mxArchiMateBusinessObject.prototype.getConstraints = function(style, w, h)
  273. {
  274. var constr = [];
  275. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 2.9, 2.9));
  276. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));
  277. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
  278. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));
  279. constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false, null, -2.9, 2.9));
  280. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false));
  281. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  282. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false));
  283. constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false, null, -2.9, -2.9));
  284. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));
  285. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
  286. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));
  287. constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false, null, 2.9, -2.9));
  288. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.75), false));
  289. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  290. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.25), false));
  291. return (constr);
  292. };
  293. //**********************************************************************************************************************************************************
  294. //Representation
  295. //**********************************************************************************************************************************************************
  296. /**
  297. * Extends mxShape.
  298. */
  299. function mxArchiMateRepresentation(bounds, fill, stroke, strokewidth)
  300. {
  301. mxShape.call(this);
  302. this.bounds = bounds;
  303. this.fill = fill;
  304. this.stroke = stroke;
  305. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  306. };
  307. /**
  308. * Extends mxShape.
  309. */
  310. mxUtils.extend(mxArchiMateRepresentation, mxShape);
  311. mxArchiMateRepresentation.prototype.cst = {
  312. REPRESENTATION : 'mxgraph.archimate.representation'
  313. };
  314. /**
  315. * Function: paintVertexShape
  316. *
  317. * Paints the vertex shape.
  318. */
  319. mxArchiMateRepresentation.prototype.paintVertexShape = function(c, x, y, w, h)
  320. {
  321. c.translate(x, y);
  322. this.background(c, 0, 0, w, h);
  323. };
  324. mxArchiMateRepresentation.prototype.background = function(c, x, y, w, h)
  325. {
  326. c.begin();
  327. c.moveTo(0, 0);
  328. c.lineTo(w, 0);
  329. c.lineTo(w, h * 0.85);
  330. c.arcTo(w * 0.35, h * 0.35, 0, 0, 0, w * 0.5, h * 0.85);
  331. c.arcTo(w * 0.35, h * 0.35, 0, 0, 1, 0, h * 0.85);
  332. c.close();
  333. c.fillAndStroke();
  334. };
  335. mxCellRenderer.registerShape(mxArchiMateRepresentation.prototype.cst.REPRESENTATION, mxArchiMateRepresentation);
  336. mxArchiMateRepresentation.prototype.getConstraints = function(style, w, h)
  337. {
  338. var constr = [];
  339. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false));
  340. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));
  341. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
  342. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));
  343. constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));
  344. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false));
  345. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  346. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false));
  347. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.85), false, null));
  348. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0.745), false));
  349. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0.85), false));
  350. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0.955), false));
  351. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.85), false));
  352. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.75), false));
  353. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  354. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.25), false));
  355. return (constr);
  356. };
  357. //**********************************************************************************************************************************************************
  358. //Product
  359. //**********************************************************************************************************************************************************
  360. /**
  361. * Extends mxShape.
  362. */
  363. function mxArchiMateProduct(bounds, fill, stroke, strokewidth)
  364. {
  365. mxShape.call(this);
  366. this.bounds = bounds;
  367. this.fill = fill;
  368. this.stroke = stroke;
  369. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  370. };
  371. /**
  372. * Extends mxShape.
  373. */
  374. mxUtils.extend(mxArchiMateProduct, mxShape);
  375. mxArchiMateProduct.prototype.cst = {
  376. PRODUCT : 'mxgraph.archimate.product'
  377. };
  378. /**
  379. * Function: paintVertexShape
  380. *
  381. * Paints the vertex shape.
  382. */
  383. mxArchiMateProduct.prototype.paintVertexShape = function(c, x, y, w, h)
  384. {
  385. c.translate(x, y);
  386. this.background(c, 0, 0, w, h);
  387. c.setShadow(false);
  388. this.foreground(c, 0, 0, w, h);
  389. };
  390. mxArchiMateProduct.prototype.background = function(c, x, y, w, h)
  391. {
  392. c.rect(0, 0, w, h);
  393. c.fillAndStroke();
  394. };
  395. mxArchiMateProduct.prototype.foreground = function(c, x, y, w, h)
  396. {
  397. if (h >= 15)
  398. {
  399. c.begin();
  400. c.moveTo(0, 15);
  401. c.lineTo(w * 0.6, 15);
  402. c.lineTo(w * 0.6, 0);
  403. c.stroke();
  404. }
  405. };
  406. mxCellRenderer.registerShape(mxArchiMateProduct.prototype.cst.PRODUCT, mxArchiMateProduct);
  407. //**********************************************************************************************************************************************************
  408. //Application
  409. //**********************************************************************************************************************************************************
  410. /**
  411. * Extends mxShape.
  412. */
  413. function mxArchiMateApplication(bounds, fill, stroke, strokewidth)
  414. {
  415. mxShape.call(this);
  416. this.bounds = bounds;
  417. this.fill = fill;
  418. this.stroke = stroke;
  419. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  420. };
  421. /**
  422. * Extends mxShape.
  423. */
  424. mxUtils.extend(mxArchiMateApplication, mxShape);
  425. mxArchiMateApplication.prototype.cst = {
  426. APPLICATION : 'mxgraph.archimate.application',
  427. TYPE : 'appType',
  428. COMPONENT : 'comp',
  429. INTERFACE : 'interface',
  430. INTERFACE2 : 'interface2',
  431. FUNCTION : 'function',
  432. INTERACTION : 'interaction',
  433. SERVICE : 'service',
  434. NODE : 'node',
  435. NETWORK : 'network',
  436. COMM_PATH : 'commPath',
  437. SYS_SW : 'sysSw',
  438. ARTIFACT : 'artifact',
  439. ACTOR : 'actor',
  440. ROLE : 'role',
  441. COLLABORATION : 'collab'
  442. };
  443. mxArchiMateApplication.prototype.customProperties = [
  444. {name: 'appType', dispName: 'App Type', type: 'enum',
  445. enumList: [{val: 'comp', dispName: 'Component'},
  446. {val: 'interface', dispName: 'Interface'},
  447. {val: 'interface2', dispName: 'Interface2'},
  448. {val: 'function', dispName: 'Function'},
  449. {val: 'interaction', dispName: 'Interaction'},
  450. {val: 'service', dispName: 'Service'},
  451. {val: 'node', dispName: 'Node'},
  452. {val: 'network', dispName: 'Network'},
  453. {val: 'commPath', dispName: 'Comm Path'},
  454. {val: 'artifact', dispName: 'Artifact'},
  455. {val: 'sysSw', dispName: 'System Sw'},
  456. {val: 'path', dispName: 'Path'},
  457. {val: 'actor', dispName: 'Actor'},
  458. {val: 'role', dispName: 'Role'},
  459. {val: 'collab', dispName: 'Collaboration'}]
  460. }
  461. ];
  462. /**
  463. * Function: paintVertexShape
  464. *
  465. * Paints the vertex shape.
  466. */
  467. mxArchiMateApplication.prototype.paintVertexShape = function(c, x, y, w, h)
  468. {
  469. c.translate(x, y);
  470. this.background(c, 0, 0, w, h);
  471. c.setShadow(false);
  472. c.translate(w - 20, 5);
  473. this.foreground(c, w - 20, 5, 15, 15);
  474. };
  475. mxArchiMateApplication.prototype.background = function(c, x, y, w, h)
  476. {
  477. c.rect(0, 0, w, h);
  478. c.fillAndStroke();
  479. };
  480. mxArchiMateApplication.prototype.foreground = function(c, x, y, w, h)
  481. {
  482. var type = mxUtils.getValue(this.style, mxArchiMateApplication.prototype.cst.TYPE, mxArchiMateApplication.prototype.cst.COMPONENT);
  483. c.setDashed(false);
  484. if (type === mxArchiMateApplication.prototype.cst.COMPONENT)
  485. {
  486. c.translate(1, 0);
  487. w = w - 2;
  488. c.rect(w * 0.25, 0, w * 0.75, h);
  489. c.stroke();
  490. c.rect(0, h * 0.25, w * 0.5, h * 0.15);
  491. c.fillAndStroke();
  492. c.rect(0, h * 0.6, w * 0.5, h * 0.15);
  493. c.fillAndStroke();
  494. }
  495. else if (type === mxArchiMateApplication.prototype.cst.COLLABORATION)
  496. {
  497. c.translate(0, 3);
  498. h = h - 6;
  499. c.ellipse(0, 0, w * 0.6, h);
  500. c.stroke();
  501. c.ellipse(w * 0.4, 0, w * 0.6, h);
  502. c.fillAndStroke();
  503. }
  504. else if (type === mxArchiMateApplication.prototype.cst.INTERFACE)
  505. {
  506. c.translate(0, 4);
  507. h = h - 8;
  508. c.ellipse(w * 0.5, 0, w * 0.5, h);
  509. c.stroke();
  510. c.begin();
  511. c.moveTo(0, h * 0.5);
  512. c.lineTo(w * 0.5, h * 0.5);
  513. c.stroke();
  514. }
  515. else if (type === mxArchiMateApplication.prototype.cst.INTERFACE2)
  516. {
  517. c.translate(0, 1);
  518. h = h - 2;
  519. c.begin();
  520. c.moveTo(0, h * 0.5);
  521. c.lineTo(w * 0.6, h * 0.5);
  522. c.moveTo(w, 0);
  523. c.arcTo(w * 0.4, h * 0.5, 0, 0, 0, w, h);
  524. c.stroke();
  525. }
  526. else if (type === mxArchiMateApplication.prototype.cst.FUNCTION)
  527. {
  528. c.begin();
  529. c.moveTo(w * 0.5, 0);
  530. c.lineTo(w, h * 0.2);
  531. c.lineTo(w, h);
  532. c.lineTo(w * 0.5, h * 0.8);
  533. c.lineTo(0, h);
  534. c.lineTo(0, h * 0.2);
  535. c.close();
  536. c.stroke();
  537. }
  538. else if (type === mxArchiMateApplication.prototype.cst.INTERACTION)
  539. {
  540. c.begin();
  541. c.moveTo(w * 0.55, 0);
  542. c.arcTo(w * 0.45, h * 0.5, 0, 0, 1, w * 0.55, h);
  543. c.close();
  544. c.moveTo(w * 0.45, 0);
  545. c.arcTo(w * 0.45, h * 0.5, 0, 0, 0, w * 0.45, h);
  546. c.close();
  547. c.stroke();
  548. }
  549. else if (type === mxArchiMateApplication.prototype.cst.SERVICE)
  550. {
  551. c.translate(0, 3);
  552. h = h - 6;
  553. c.begin();
  554. c.moveTo(w - h * 0.5, 0);
  555. c.arcTo(h * 0.5, h * 0.5, 0, 0, 1, w - h * 0.5, h);
  556. c.lineTo(0, h);
  557. c.arcTo(h * 0.5, h * 0.5, 0, 0, 1, 0, 0);
  558. c.close();
  559. c.stroke();
  560. }
  561. else if (type === mxArchiMateApplication.prototype.cst.NODE)
  562. {
  563. c.begin();
  564. c.moveTo(0, h * 0.25);
  565. c.lineTo(w * 0.25, 0);
  566. c.lineTo(w, 0);
  567. c.lineTo(w, h * 0.75);
  568. c.lineTo(w * 0.75, h);
  569. c.lineTo(0, h);
  570. c.close();
  571. c.moveTo(0, h * 0.25);
  572. c.lineTo(w * 0.75, h * 0.25);
  573. c.lineTo(w * 0.75, h);
  574. c.moveTo(w, 0);
  575. c.lineTo(w * 0.75, h * 0.25);
  576. c.stroke();
  577. }
  578. else if (type === mxArchiMateApplication.prototype.cst.NETWORK)
  579. {
  580. c.translate(0, 2);
  581. h = h - 4;
  582. c.begin();
  583. c.moveTo(w * 0.4, h * 0.2);
  584. c.lineTo(w * 0.85, h * 0.2);
  585. c.lineTo(w * 0.6, h * 0.8);
  586. c.lineTo(w * 0.15, h * 0.8);
  587. c.close();
  588. c.stroke();
  589. var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#000000');
  590. c.setFillColor(strokeColor);
  591. c.ellipse(w * 0.25, 0, w * 0.3, h * 0.4);
  592. c.fill();
  593. c.ellipse(w * 0.7, 0, w * 0.3, h * 0.4);
  594. c.fill();
  595. c.ellipse(0, h * 0.6, w * 0.3, h * 0.4);
  596. c.fill();
  597. c.ellipse(w * 0.45, h * 0.6, w * 0.3, h * 0.4);
  598. c.fill();
  599. }
  600. else if (type === mxArchiMateApplication.prototype.cst.COMM_PATH)
  601. {
  602. c.translate(0, 5);
  603. h = h - 10;
  604. c.begin();
  605. c.moveTo(w * 0.1, 0);
  606. c.lineTo(0, h * 0.5);
  607. c.lineTo(w * 0.1, h);
  608. c.moveTo(w * 0.9, 0);
  609. c.lineTo(w, h * 0.5);
  610. c.lineTo(w * 0.9, h);
  611. c.stroke();
  612. c.setDashed(true);
  613. c.begin();
  614. c.moveTo(0, h * 0.5);
  615. c.lineTo(w, h * 0.5);
  616. c.stroke();
  617. }
  618. else if (type === mxArchiMateApplication.prototype.cst.SYS_SW)
  619. {
  620. c.ellipse(w * 0.3, 0, w * 0.7, h * 0.7);
  621. c.stroke();
  622. c.ellipse(0, h * 0.02, w * 0.98, h * 0.98);
  623. c.fillAndStroke();
  624. }
  625. else if (type === mxArchiMateApplication.prototype.cst.ARTIFACT)
  626. {
  627. c.translate(2, 0);
  628. w = w - 4;
  629. c.begin();
  630. c.moveTo(0, 0);
  631. c.lineTo(w * 0.7, 0);
  632. c.lineTo(w, h * 0.22);
  633. c.lineTo(w, h);
  634. c.lineTo(0, h);
  635. c.close();
  636. c.moveTo(w * 0.7, 0);
  637. c.lineTo(w * 0.7, h * 0.22);
  638. c.lineTo(w, h * 0.22);
  639. c.stroke();
  640. }
  641. else if (type === mxArchiMateApplication.prototype.cst.ACTOR)
  642. {
  643. c.translate(3, 0);
  644. w = w - 6;
  645. c.ellipse(w * 0.2, 0, w * 0.6, h * 0.3);
  646. c.stroke();
  647. c.begin();
  648. c.moveTo(w * 0.5, h * 0.3);
  649. c.lineTo(w * 0.5, h * 0.75);
  650. c.moveTo(0, h * 0.45);
  651. c.lineTo(w, h * 0.45);
  652. c.moveTo(0, h);
  653. c.lineTo(w * 0.5, h * 0.75);
  654. c.lineTo(w, h);
  655. c.stroke();
  656. }
  657. if (type === mxArchiMateApplication.prototype.cst.ROLE)
  658. {
  659. c.translate(0, 4);
  660. h = h - 8;
  661. c.begin();
  662. c.moveTo(w * 0.8, 0);
  663. c.lineTo(w * 0.2, 0);
  664. c.arcTo(w * 0.2, h * 0.5, 0, 0, 0, w * 0.2, h);
  665. c.lineTo(w * 0.8, h);
  666. c.stroke();
  667. c.ellipse(w * 0.6, 0, w * 0.4, h);
  668. c.stroke();
  669. }
  670. };
  671. mxCellRenderer.registerShape(mxArchiMateApplication.prototype.cst.APPLICATION, mxArchiMateApplication);
  672. mxArchiMateApplication.prototype.getConstraints = function(style, w, h)
  673. {
  674. var constr = [];
  675. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false));
  676. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));
  677. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
  678. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));
  679. constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));
  680. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false));
  681. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  682. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false));
  683. constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false));
  684. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));
  685. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
  686. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));
  687. constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));
  688. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.75), false));
  689. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  690. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.25), false));
  691. return (constr);
  692. };
  693. //**********************************************************************************************************************************************************
  694. //Tech
  695. //**********************************************************************************************************************************************************
  696. /**
  697. * Extends mxShape.
  698. */
  699. function mxArchiMateTech(bounds, fill, stroke, strokewidth)
  700. {
  701. mxShape.call(this);
  702. this.bounds = bounds;
  703. this.fill = fill;
  704. this.stroke = stroke;
  705. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  706. };
  707. /**
  708. * Extends mxShape.
  709. */
  710. mxUtils.extend(mxArchiMateTech, mxShape);
  711. mxArchiMateTech.prototype.cst = {
  712. TECH : 'mxgraph.archimate.tech',
  713. TYPE : 'techType',
  714. DEVICE : 'device',
  715. PLATEAU : 'plateau'
  716. };
  717. mxArchiMateTech.prototype.customProperties = [
  718. {name: 'techType', dispName: 'Tech Type', type: 'enum',
  719. enumList: [{val: 'device', dispName: 'Device'},
  720. {val: 'plateau', dispName: 'Plateau'}]
  721. }
  722. ];
  723. /**
  724. * Function: paintVertexShape
  725. *
  726. * Paints the vertex shape.
  727. */
  728. mxArchiMateTech.prototype.paintVertexShape = function(c, x, y, w, h)
  729. {
  730. c.translate(x, y);
  731. this.background(c, 0, 0, w, h);
  732. c.setShadow(false);
  733. c.translate(w - 30, 15);
  734. this.foreground(c, w - 30, 15, 15, 15);
  735. };
  736. mxArchiMateTech.prototype.background = function(c, x, y, w, h)
  737. {
  738. c.begin();
  739. c.moveTo(0, 10);
  740. c.lineTo(10, 0);
  741. c.lineTo(w, 0);
  742. c.lineTo(w, h - 10);
  743. c.lineTo(w - 10, h);
  744. c.lineTo(0, h);
  745. c.close();
  746. c.moveTo(0, 10);
  747. c.lineTo(w - 10, 10);
  748. c.lineTo(w - 10, h);
  749. c.moveTo(w, 0);
  750. c.lineTo(w - 10, 10);
  751. c.fillAndStroke();
  752. };
  753. mxArchiMateTech.prototype.foreground = function(c, x, y, w, h)
  754. {
  755. var type = mxUtils.getValue(this.style, mxArchiMateTech.prototype.cst.TYPE, mxArchiMateTech.prototype.cst.DEVICE);
  756. c.setDashed(false);
  757. if (type === mxArchiMateTech.prototype.cst.DEVICE)
  758. {
  759. c.roundrect(0, 0, w, h * 0.88, w * 0.05, h * 0.05);
  760. c.stroke();
  761. c.begin();
  762. c.moveTo(w * 0.1, h * 0.88);
  763. c.lineTo(0, h);
  764. c.lineTo(w, h);
  765. c.lineTo(w * 0.9, h * 0.88);
  766. c.stroke();
  767. }
  768. else if (type === mxArchiMateTech.prototype.cst.PLATEAU)
  769. {
  770. var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#000000');
  771. c.setFillColor(strokeColor);
  772. c.rect(w * 0.4, 0, w * 0.6, h * 0.2);
  773. c.fill();
  774. c.rect(w * 0.2, h * 0.4, w * 0.6, h * 0.2);
  775. c.fill();
  776. c.rect(0, h * 0.8, w * 0.6, h * 0.2);
  777. c.fill();
  778. }
  779. };
  780. mxCellRenderer.registerShape(mxArchiMateTech.prototype.cst.TECH, mxArchiMateTech);
  781. mxArchiMateTech.prototype.getConstraints = function(style, w, h)
  782. {
  783. var constr = [];
  784. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, 10));
  785. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 10, 0));
  786. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));
  787. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
  788. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));
  789. constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));
  790. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false));
  791. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  792. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false));
  793. constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false, null, 0, -10));
  794. constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false, null, -10, 0));
  795. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));
  796. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
  797. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));
  798. constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));
  799. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.75), false));
  800. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  801. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.25), false));
  802. return (constr);
  803. };
  804. //**********************************************************************************************************************************************************
  805. //Motivational
  806. //**********************************************************************************************************************************************************
  807. /**
  808. * Extends mxShape.
  809. */
  810. function mxArchiMateMotivational(bounds, fill, stroke, strokewidth)
  811. {
  812. mxShape.call(this);
  813. this.bounds = bounds;
  814. this.fill = fill;
  815. this.stroke = stroke;
  816. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  817. };
  818. /**
  819. * Extends mxShape.
  820. */
  821. mxUtils.extend(mxArchiMateMotivational, mxShape);
  822. mxArchiMateMotivational.prototype.cst = {
  823. MOTIV : 'mxgraph.archimate.motiv',
  824. TYPE : 'motivType',
  825. STAKE : 'stake',
  826. DRIVER : 'driver',
  827. ASSESSMENT : 'assess',
  828. GOAL : 'goal',
  829. REQUIREMENT : 'req',
  830. CONSTRAINT : 'const',
  831. PRINCIPLE : 'princ'
  832. };
  833. mxArchiMateMotivational.prototype.customProperties = [
  834. {name: 'motivType', dispName: 'Motivational Type', type: 'enum',
  835. enumList: [{val: 'stake', dispName: 'Stake'},
  836. {val: 'driver', dispName: 'Driver'},
  837. {val: 'assess', dispName: 'Assessment'},
  838. {val: 'goal', dispName: 'Goal'},
  839. {val: 'req', dispName: 'Requirement'},
  840. {val: 'const', dispName: 'Constraint'},
  841. {val: 'princ', dispName: 'Principle'}]
  842. }
  843. ];
  844. /**
  845. * Function: paintVertexShape
  846. *
  847. * Paints the vertex shape.
  848. */
  849. mxArchiMateMotivational.prototype.paintVertexShape = function(c, x, y, w, h)
  850. {
  851. c.translate(x, y);
  852. this.background(c, 0, 0, w, h);
  853. c.setShadow(false);
  854. c.translate(w - 20, 5);
  855. this.foreground(c, w - 20, 5, 15, 15);
  856. };
  857. mxArchiMateMotivational.prototype.background = function(c, x, y, w, h)
  858. {
  859. c.begin();
  860. c.moveTo(10, 0);
  861. c.lineTo(w - 10, 0);
  862. c.lineTo(w, 10);
  863. c.lineTo(w, h - 10);
  864. c.lineTo(w - 10, h);
  865. c.lineTo(10, h);
  866. c.lineTo(0, h - 10);
  867. c.lineTo(0, 10);
  868. c.close();
  869. c.fillAndStroke();
  870. };
  871. mxArchiMateMotivational.prototype.foreground = function(c, x, y, w, h)
  872. {
  873. var type = mxUtils.getValue(this.style, mxArchiMateMotivational.prototype.cst.TYPE, mxArchiMateMotivational.prototype.cst.STAKE);
  874. c.setDashed(false);
  875. if (type === mxArchiMateMotivational.prototype.cst.STAKE)
  876. {
  877. c.translate(0, 4);
  878. h = h - 8;
  879. c.begin();
  880. c.moveTo(w * 0.8, 0);
  881. c.lineTo(w * 0.2, 0);
  882. c.arcTo(w * 0.2, h * 0.5, 0, 0, 0, w * 0.2, h);
  883. c.lineTo(w * 0.8, h);
  884. c.stroke();
  885. c.ellipse(w * 0.6, 0, w * 0.4, h);
  886. c.stroke();
  887. }
  888. else if (type === mxArchiMateMotivational.prototype.cst.DRIVER)
  889. {
  890. c.ellipse(w * 0.1, h * 0.1, w * 0.8, h * 0.8);
  891. c.stroke();
  892. c.begin();
  893. c.moveTo(0, h * 0.5);
  894. c.lineTo(w, h * 0.5);
  895. c.moveTo(w * 0.5, 0);
  896. c.lineTo(w * 0.5, h);
  897. c.moveTo(w * 0.145, h * 0.145);
  898. c.lineTo(w * 0.855, h * 0.855);
  899. c.moveTo(w * 0.145, h * 0.855);
  900. c.lineTo(w * 0.855, h * 0.145);
  901. c.stroke();
  902. var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#000000');
  903. c.setFillColor(strokeColor);
  904. c.ellipse(w * 0.35, h * 0.35, w * 0.3, h * 0.3);
  905. c.fillAndStroke();
  906. }
  907. else if (type === mxArchiMateMotivational.prototype.cst.ASSESSMENT)
  908. {
  909. c.ellipse(w * 0.2, 0, w * 0.8, h * 0.8);
  910. c.stroke();
  911. c.begin();
  912. c.moveTo(0, h);
  913. c.lineTo(w * 0.32, h * 0.68);
  914. c.stroke();
  915. }
  916. else if (type === mxArchiMateMotivational.prototype.cst.GOAL)
  917. {
  918. c.ellipse(0, 0, w, h);
  919. c.stroke();
  920. c.ellipse(w * 0.15, h * 0.15, w * 0.7, h * 0.7);
  921. c.stroke();
  922. var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#000000');
  923. c.setFillColor(strokeColor);
  924. c.ellipse(w * 0.3, h * 0.3, w * 0.4, h * 0.4);
  925. c.fillAndStroke();
  926. }
  927. else if (type === mxArchiMateMotivational.prototype.cst.REQUIREMENT)
  928. {
  929. c.translate(0, 4);
  930. h = h - 8;
  931. c.begin();
  932. c.moveTo(w * 0.25, 0);
  933. c.lineTo(w, 0);
  934. c.lineTo(w * 0.75, h);
  935. c.lineTo(0, h);
  936. c.close();
  937. c.stroke();
  938. }
  939. else if (type === mxArchiMateMotivational.prototype.cst.CONSTRAINT)
  940. {
  941. c.translate(0, 4);
  942. h = h - 8;
  943. c.begin();
  944. c.moveTo(w * 0.25, 0);
  945. c.lineTo(w, 0);
  946. c.lineTo(w * 0.75, h);
  947. c.lineTo(0, h);
  948. c.close();
  949. c.moveTo(w * 0.45, 0);
  950. c.lineTo(w * 0.2, h);
  951. c.stroke();
  952. }
  953. else if (type === mxArchiMateMotivational.prototype.cst.PRINCIPLE)
  954. {
  955. c.begin();
  956. c.moveTo(w * 0.05, h * 0.05);
  957. c.arcTo(w * 2.3, h * 2.3, 0, 0, 1, w * 0.95, h * 0.05);
  958. c.arcTo(w * 2.3, h * 2.3, 0, 0, 1, w * 0.95, h * 0.95);
  959. c.arcTo(w * 2.3, h * 2.3, 0, 0, 1, w * 0.05, h * 0.95);
  960. c.arcTo(w * 2.3, h * 2.3, 0, 0, 1, w * 0.05, h * 0.05);
  961. c.close();
  962. c.stroke();
  963. var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#000000');
  964. c.setFillColor(strokeColor);
  965. c.begin();
  966. c.moveTo(w * 0.45, h * 0.7);
  967. c.lineTo(w * 0.42, h * 0.15);
  968. c.lineTo(w * 0.58, h * 0.15);
  969. c.lineTo(w * 0.55, h * 0.7);
  970. c.close();
  971. c.fill();
  972. c.rect(w * 0.45, h * 0.75, w * 0.1, h * 0.1);
  973. c.fill();
  974. }
  975. };
  976. mxCellRenderer.registerShape(mxArchiMateMotivational.prototype.cst.MOTIV, mxArchiMateMotivational);
  977. mxArchiMateMotivational.prototype.getConstraints = function(style, w, h)
  978. {
  979. var constr = [];
  980. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 5, 5));
  981. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));
  982. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
  983. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));
  984. constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false, null, -5, 5));
  985. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false));
  986. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  987. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false));
  988. constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false, null, -5, -5));
  989. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));
  990. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
  991. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));
  992. constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false, null, 5, -5));
  993. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.75), false));
  994. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  995. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.25), false));
  996. return (constr);
  997. };
  998. //**********************************************************************************************************************************************************
  999. //Gap
  1000. //**********************************************************************************************************************************************************
  1001. /**
  1002. * Extends mxShape.
  1003. */
  1004. function mxArchiMateGap(bounds, fill, stroke, strokewidth)
  1005. {
  1006. mxShape.call(this);
  1007. this.bounds = bounds;
  1008. this.fill = fill;
  1009. this.stroke = stroke;
  1010. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1011. };
  1012. /**
  1013. * Extends mxShape.
  1014. */
  1015. mxUtils.extend(mxArchiMateGap, mxShape);
  1016. mxArchiMateGap.prototype.cst = {
  1017. GAP : 'mxgraph.archimate.gap'
  1018. };
  1019. /**
  1020. * Function: paintVertexShape
  1021. *
  1022. * Paints the vertex shape.
  1023. */
  1024. mxArchiMateGap.prototype.paintVertexShape = function(c, x, y, w, h)
  1025. {
  1026. c.translate(x, y);
  1027. this.background(c, 0, 0, w, h);
  1028. c.setShadow(false);
  1029. c.translate(w - 20, 5);
  1030. this.foreground(c, w - 20, 5, 15, 15);
  1031. };
  1032. mxArchiMateGap.prototype.background = function(c, x, y, w, h)
  1033. {
  1034. c.begin();
  1035. c.moveTo(0, 0);
  1036. c.lineTo(w, 0);
  1037. c.lineTo(w, h * 0.85);
  1038. c.arcTo(w * 0.35, h * 0.35, 0, 0, 0, w * 0.5, h * 0.85);
  1039. c.arcTo(w * 0.35, h * 0.35, 0, 0, 1, 0, h * 0.85);
  1040. c.close();
  1041. c.fillAndStroke();
  1042. };
  1043. mxArchiMateGap.prototype.foreground = function(c, x, y, w, h)
  1044. {
  1045. c.setDashed(false);
  1046. c.translate(0, 2);
  1047. h = h - 4;
  1048. c.ellipse(w * 0.15, 0, w * 0.7, h);
  1049. c.stroke();
  1050. c.begin();
  1051. c.moveTo(0, h * 0.35);
  1052. c.lineTo(w, h * 0.35);
  1053. c.moveTo(0, h * 0.65);
  1054. c.lineTo(w, h * 0.65);
  1055. c.stroke();
  1056. };
  1057. mxCellRenderer.registerShape(mxArchiMateGap.prototype.cst.GAP, mxArchiMateGap);
  1058. mxArchiMateGap.prototype.getConstraints = function(style, w, h)
  1059. {
  1060. var constr = [];
  1061. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false));
  1062. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));
  1063. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
  1064. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));
  1065. constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));
  1066. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false));
  1067. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  1068. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false));
  1069. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.85), false, null));
  1070. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0.745), false));
  1071. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0.85), false));
  1072. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0.955), false));
  1073. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.85), false));
  1074. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.75), false));
  1075. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  1076. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.25), false));
  1077. return (constr);
  1078. };