mxArchiMate.js 35 KB

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