mxSysML.js 69 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566
  1. /**
  2. * $Id: mxSysML.js,v 1.0 2014/07/23 07:05:39 mate Exp $
  3. * Copyright (c) 2006-2014, JGraph Ltd
  4. */
  5. //**********************************************************************************************************************************************************
  6. //Composite
  7. //**********************************************************************************************************************************************************
  8. function mxShapeSysMLComposite()
  9. {
  10. mxCylinder.call(this);
  11. };
  12. mxUtils.extend(mxShapeSysMLComposite, mxShape);
  13. mxShapeSysMLComposite.prototype.isHtmlAllowed = function()
  14. {
  15. return false;
  16. };
  17. mxShapeSysMLComposite.prototype.paintForeground = function(c, x, y, w, h)
  18. {
  19. if (this.style != null)
  20. {
  21. var shape = mxCellRenderer.prototype.defaultShapes[this.style['symbol0']];
  22. c.save();
  23. var tmp = new shape();
  24. tmp.style = this.style;
  25. shape.prototype.paintVertexShape.call(tmp, c, x, y, w, h);
  26. c.restore();
  27. c.setDashed(false);
  28. // Draws the symbols defined in the style. The symbols are
  29. // numbered from 1...n. Possible postfixes are align,
  30. // verticalAlign, spacing, arcSpacing, width, height
  31. var counter = 1;
  32. do
  33. {
  34. shape = mxCellRenderer.prototype.defaultShapes[this.style['symbol' + counter]];
  35. if (shape != null)
  36. {
  37. var align = this.style['symbol' + counter + 'Align'];
  38. var valign = this.style['symbol' + counter + 'VerticalAlign'];
  39. var width = this.style['symbol' + counter + 'Width'];
  40. var height = this.style['symbol' + counter + 'Height'];
  41. var spacing = this.style['symbol' + counter + 'Spacing'] || 0;
  42. var vspacing = this.style['symbol' + counter + 'VSpacing'] || 0;
  43. var arcspacing = this.style['symbol' + counter + 'ArcSpacing'];
  44. var direction = this.style['symbol' + counter + 'Direction'];
  45. if (arcspacing != null)
  46. {
  47. spacing += this.getArcSize(w + this.strokewidth, h + this.strokewidth) * arcspacing;
  48. vspacing += this.getArcSize(w + this.strokewidth, h + this.strokewidth) * arcspacing;
  49. }
  50. var x2 = x;
  51. var y2 = y;
  52. if (align == mxConstants.ALIGN_CENTER)
  53. {
  54. x2 += (w - width) / 2;
  55. }
  56. else if (align == mxConstants.ALIGN_RIGHT)
  57. {
  58. x2 += w - width - spacing;
  59. }
  60. else
  61. {
  62. x2 += spacing;
  63. }
  64. if (valign == mxConstants.ALIGN_MIDDLE)
  65. {
  66. y2 += (h - height) / 2;
  67. }
  68. else if (valign == mxConstants.ALIGN_BOTTOM)
  69. {
  70. y2 += h - height - vspacing;
  71. }
  72. else
  73. {
  74. y2 += vspacing;
  75. }
  76. c.save();
  77. var tmp = new shape();
  78. tmp.style = mxUtils.clone(this.style);
  79. tmp.direction = direction;
  80. tmp.updateTransform(c, x2, y2, width, height);
  81. shape.prototype.paintVertexShape.call(tmp, c, x2, y2, width, height);
  82. c.restore();
  83. }
  84. counter++;
  85. }
  86. while (shape != null);
  87. }
  88. };
  89. mxCellRenderer.prototype.defaultShapes['mxgraph.sysml.composite'] = mxShapeSysMLComposite;
  90. //**********************************************************************************************************************************************************
  91. //Package
  92. //**********************************************************************************************************************************************************
  93. /**
  94. * Extends mxShape.
  95. */
  96. function mxShapeSysMLPackage(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. };
  104. /**
  105. * Extends mxShape.
  106. */
  107. mxUtils.extend(mxShapeSysMLPackage, mxShape);
  108. mxShapeSysMLPackage.prototype.cst = {
  109. PACKAGE : 'mxgraph.sysml.package',
  110. LABEL_X : 'labelX'
  111. };
  112. /**
  113. * Function: paintVertexShape
  114. *
  115. * Paints the vertex shape.
  116. */
  117. mxShapeSysMLPackage.prototype.paintVertexShape = function(c, x, y, w, h)
  118. {
  119. c.translate(x, y);
  120. this.background(c, x, y, w, h);
  121. c.setShadow(false);
  122. this.foreground(c, x, y, w, h);
  123. };
  124. mxShapeSysMLPackage.prototype.background = function(c, x, y, w, h)
  125. {
  126. c.rect(0, 0, w, h);
  127. c.fillAndStroke();
  128. };
  129. mxShapeSysMLPackage.prototype.foreground = function(c, x, y, w, h)
  130. {
  131. var xSize = parseInt(mxUtils.getValue(this.style, mxShapeSysMLPackage.prototype.cst.LABEL_X, '90'));
  132. var ySize = 20;
  133. xSize = Math.min(xSize, w);
  134. if (xSize > ySize)
  135. {
  136. c.begin();
  137. c.moveTo(0, ySize);
  138. c.lineTo(xSize - ySize * 0.5, ySize);
  139. c.lineTo(xSize, ySize * 0.5);
  140. c.lineTo(xSize, 0);
  141. c.stroke();
  142. }
  143. };
  144. mxCellRenderer.registerShape(mxShapeSysMLPackage.prototype.cst.PACKAGE, mxShapeSysMLPackage);
  145. Graph.handleFactory[mxShapeSysMLPackage.prototype.cst.PACKAGE] = function(state)
  146. {
  147. var handles = [Graph.createHandle(state, ['labelX'], function(bounds)
  148. {
  149. var labelX = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'labelX', 90))));
  150. return new mxPoint(bounds.x + labelX, bounds.y + 10);
  151. }, function(bounds, pt)
  152. {
  153. this.state.style['labelX'] = Math.round(100 * Math.max(0, Math.min(bounds.width, pt.x - bounds.x))) / 100;
  154. })];
  155. return handles;
  156. }
  157. //**********************************************************************************************************************************************************
  158. //Package2
  159. //**********************************************************************************************************************************************************
  160. /**
  161. * Extends mxShape.
  162. */
  163. function mxShapeSysMLPackage2(bounds, fill, stroke, strokewidth)
  164. {
  165. mxShape.call(this);
  166. this.bounds = bounds;
  167. this.fill = fill;
  168. this.stroke = stroke;
  169. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  170. };
  171. /**
  172. * Extends mxShape.
  173. */
  174. mxUtils.extend(mxShapeSysMLPackage2, mxShape);
  175. mxShapeSysMLPackage2.prototype.cst = {
  176. PACKAGE2 : 'mxgraph.sysml.package2',
  177. LABEL_X : 'labelX'
  178. };
  179. /**
  180. * Function: paintVertexShape
  181. *
  182. * Paints the vertex shape.
  183. */
  184. mxShapeSysMLPackage2.prototype.paintVertexShape = function(c, x, y, w, h)
  185. {
  186. c.translate(x, y);
  187. this.background(c, x, y, w, h);
  188. c.setShadow(false);
  189. this.foreground(c, x, y, w, h);
  190. };
  191. mxShapeSysMLPackage2.prototype.background = function(c, x, y, w, h)
  192. {
  193. c.rect(0, 0, w, h);
  194. c.stroke();
  195. };
  196. mxShapeSysMLPackage2.prototype.foreground = function(c, x, y, w, h)
  197. {
  198. var xSize = parseInt(mxUtils.getValue(this.style, mxShapeSysMLPackage2.prototype.cst.LABEL_X, '90'));
  199. var ySize = 20;
  200. xSize = Math.min(xSize, w);
  201. if (xSize > ySize)
  202. {
  203. c.begin();
  204. c.moveTo(0, ySize);
  205. c.lineTo(xSize - ySize * 0.5, ySize);
  206. c.lineTo(xSize, ySize * 0.5);
  207. c.lineTo(xSize, 0);
  208. c.lineTo(0, 0);
  209. c.close();
  210. c.fillAndStroke();
  211. }
  212. };
  213. mxCellRenderer.registerShape(mxShapeSysMLPackage2.prototype.cst.PACKAGE2, mxShapeSysMLPackage2);
  214. Graph.handleFactory[mxShapeSysMLPackage2.prototype.cst.PACKAGE2] = function(state)
  215. {
  216. var handles = [Graph.createHandle(state, ['labelX'], function(bounds)
  217. {
  218. var labelX = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'labelX', 90))));
  219. return new mxPoint(bounds.x + labelX, bounds.y + 10);
  220. }, function(bounds, pt)
  221. {
  222. this.state.style['labelX'] = Math.round(100 * Math.max(0, Math.min(bounds.width, pt.x - bounds.x))) / 100;
  223. })];
  224. return handles;
  225. }
  226. //**********************************************************************************************************************************************************
  227. //None
  228. //**********************************************************************************************************************************************************
  229. /**
  230. * Extends mxShape.
  231. */
  232. function mxShapeSysMLNone(bounds, fill, stroke, strokewidth)
  233. {
  234. mxShape.call(this);
  235. this.bounds = bounds;
  236. this.fill = fill;
  237. this.stroke = stroke;
  238. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  239. };
  240. /**
  241. * Extends mxShape.
  242. */
  243. mxUtils.extend(mxShapeSysMLNone, mxShape);
  244. mxShapeSysMLNone.prototype.cst = {
  245. NONE : 'mxgraph.sysml.none'
  246. };
  247. /**
  248. * Function: paintVertexShape
  249. *
  250. * Paints the vertex shape.
  251. */
  252. mxShapeSysMLNone.prototype.paintVertexShape = function(c, x, y, w, h)
  253. {
  254. };
  255. mxCellRenderer.registerShape(mxShapeSysMLNone.prototype.cst.NONE, mxShapeSysMLNone);
  256. //**********************************************************************************************************************************************************
  257. //Rectangle
  258. //**********************************************************************************************************************************************************
  259. /**
  260. * Extends mxShape.
  261. */
  262. function mxShapeSysMLRect(bounds, fill, stroke, strokewidth)
  263. {
  264. mxShape.call(this);
  265. this.bounds = bounds;
  266. this.fill = fill;
  267. this.stroke = stroke;
  268. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  269. };
  270. /**
  271. * Extends mxShape.
  272. */
  273. mxUtils.extend(mxShapeSysMLRect, mxShape);
  274. mxShapeSysMLRect.prototype.cst = {
  275. RECT : 'mxgraph.sysml.rect'
  276. };
  277. /**
  278. * Function: paintVertexShape
  279. *
  280. * Paints the vertex shape.
  281. */
  282. mxShapeSysMLRect.prototype.paintVertexShape = function(c, x, y, w, h)
  283. {
  284. c.rect(x, y, w, h);
  285. c.fillAndStroke();
  286. };
  287. mxCellRenderer.registerShape(mxShapeSysMLRect.prototype.cst.RECT, mxShapeSysMLRect);
  288. //**********************************************************************************************************************************************************
  289. //Port
  290. //**********************************************************************************************************************************************************
  291. /**
  292. * Extends mxShape.
  293. */
  294. function mxShapeSysMLPortOne(bounds, fill, stroke, strokewidth)
  295. {
  296. mxShape.call(this);
  297. this.bounds = bounds;
  298. this.fill = fill;
  299. this.stroke = stroke;
  300. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  301. };
  302. /**
  303. * Extends mxShape.
  304. */
  305. mxUtils.extend(mxShapeSysMLPortOne, mxShape);
  306. mxShapeSysMLPortOne.prototype.cst = {
  307. PORT1 : 'mxgraph.sysml.port1'
  308. };
  309. /**
  310. * Function: paintVertexShape
  311. *
  312. * Paints the vertex shape.
  313. */
  314. mxShapeSysMLPortOne.prototype.paintVertexShape = function(c, x, y, w, h)
  315. {
  316. c.rect(x + w * 0.05, y, w - w * 0.1, h);
  317. c.fillAndStroke();
  318. };
  319. mxCellRenderer.registerShape(mxShapeSysMLPortOne.prototype.cst.PORT1, mxShapeSysMLPortOne);
  320. //**********************************************************************************************************************************************************
  321. //Port2
  322. //**********************************************************************************************************************************************************
  323. /**
  324. * Extends mxShape.
  325. */
  326. function mxShapeSysMLPortTwo(bounds, fill, stroke, strokewidth)
  327. {
  328. mxShape.call(this);
  329. this.bounds = bounds;
  330. this.fill = fill;
  331. this.stroke = stroke;
  332. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  333. };
  334. /**
  335. * Extends mxShape.
  336. */
  337. mxUtils.extend(mxShapeSysMLPortTwo, mxShape);
  338. mxShapeSysMLPortTwo.prototype.cst = {
  339. PORT2 : 'mxgraph.sysml.port2'
  340. };
  341. /**
  342. * Function: paintVertexShape
  343. *
  344. * Paints the vertex shape.
  345. */
  346. mxShapeSysMLPortTwo.prototype.paintVertexShape = function(c, x, y, w, h)
  347. {
  348. c.rect(x + w * 0.05, y, w * 0.8, h);
  349. c.fillAndStroke();
  350. };
  351. mxCellRenderer.registerShape(mxShapeSysMLPortTwo.prototype.cst.PORT2, mxShapeSysMLPortTwo);
  352. //**********************************************************************************************************************************************************
  353. //Port3
  354. //**********************************************************************************************************************************************************
  355. /**
  356. * Extends mxShape.
  357. */
  358. function mxShapeSysMLPortThree(bounds, fill, stroke, strokewidth)
  359. {
  360. mxShape.call(this);
  361. this.bounds = bounds;
  362. this.fill = fill;
  363. this.stroke = stroke;
  364. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  365. };
  366. /**
  367. * Extends mxShape.
  368. */
  369. mxUtils.extend(mxShapeSysMLPortThree, mxShape);
  370. mxShapeSysMLPortThree.prototype.cst = {
  371. PORT3 : 'mxgraph.sysml.port3'
  372. };
  373. /**
  374. * Function: paintVertexShape
  375. *
  376. * Paints the vertex shape.
  377. */
  378. mxShapeSysMLPortThree.prototype.paintVertexShape = function(c, x, y, w, h)
  379. {
  380. c.rect(x + w * 0.07, y, w * 0.86, h);
  381. c.fillAndStroke();
  382. c.rect(x, y + h * 0.125, w * 0.14, h * 0.25);
  383. c.fillAndStroke();
  384. c.rect(x, y + h * 0.625, w * 0.14, h * 0.25);
  385. c.fillAndStroke();
  386. c.rect(x + w * 0.86, y + h * 0.375, w * 0.14, h * 0.25);
  387. c.fillAndStroke();
  388. this.drawIn(c, x + w * 0.01, y + h * 0.2, w * 0.11, h * 0.10);
  389. this.drawOut(c, x + w * 0.02, y + h * 0.7, w * 0.11, h * 0.10);
  390. this.drawInOut(c, x + w * 0.88, y + h * 0.45, w * 0.1, h * 0.10);
  391. };
  392. mxShapeSysMLPortThree.prototype.drawIn = function(c, x, y, w, h)
  393. {
  394. c.begin();
  395. c.moveTo(x, y + h * 0.5);
  396. c.lineTo(x + w, y + h * 0.5);
  397. c.moveTo(x + w * 0.75, y);
  398. c.lineTo(x + w, y + h * 0.5);
  399. c.lineTo(x + w * 0.75, y + h);
  400. c.stroke();
  401. }
  402. mxShapeSysMLPortThree.prototype.drawOut = function(c, x, y, w, h)
  403. {
  404. c.begin();
  405. c.moveTo(x, y + h * 0.5);
  406. c.lineTo(x + w, y + h * 0.5);
  407. c.moveTo(x + w * 0.25, y);
  408. c.lineTo(x, y + h * 0.5);
  409. c.lineTo(x + w * 0.25, y + h);
  410. c.stroke();
  411. }
  412. mxShapeSysMLPortThree.prototype.drawInOut = function(c, x, y, w, h)
  413. {
  414. c.begin();
  415. c.moveTo(x + w * 0.75, y);
  416. c.lineTo(x + w, y + h * 0.5);
  417. c.lineTo(x + w * 0.75, y + h);
  418. c.moveTo(x + w * 0.25, y);
  419. c.lineTo(x, y + h * 0.5);
  420. c.lineTo(x + w * 0.25, y + h);
  421. c.stroke();
  422. }
  423. mxCellRenderer.registerShape(mxShapeSysMLPortThree.prototype.cst.PORT3, mxShapeSysMLPortThree);
  424. //**********************************************************************************************************************************************************
  425. //Port
  426. //**********************************************************************************************************************************************************
  427. /**
  428. * Extends mxShape.
  429. */
  430. function mxShapeSysMLPortFour(bounds, fill, stroke, strokewidth)
  431. {
  432. mxShape.call(this);
  433. this.bounds = bounds;
  434. this.fill = fill;
  435. this.stroke = stroke;
  436. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  437. };
  438. /**
  439. * Extends mxShape.
  440. */
  441. mxUtils.extend(mxShapeSysMLPortFour, mxShape);
  442. mxShapeSysMLPortFour.prototype.cst = {
  443. PORT4 : 'mxgraph.sysml.port4'
  444. };
  445. /**
  446. * Function: paintVertexShape
  447. *
  448. * Paints the vertex shape.
  449. */
  450. mxShapeSysMLPortFour.prototype.paintVertexShape = function(c, x, y, w, h)
  451. {
  452. c.rect(x + w * 0.05, y, w - w * 0.05, h);
  453. c.fillAndStroke();
  454. };
  455. mxCellRenderer.registerShape(mxShapeSysMLPortFour.prototype.cst.PORT4, mxShapeSysMLPortFour);
  456. mxShapeSysMLPortFour.prototype.constraints = [
  457. new mxConnectionConstraint(new mxPoint(0.5, 0), true),
  458. new mxConnectionConstraint(new mxPoint(0, 0.5), true),
  459. new mxConnectionConstraint(new mxPoint(0.5, 1), true),
  460. new mxConnectionConstraint(new mxPoint(1, 0.5), true)
  461. ];
  462. //**********************************************************************************************************************************************************
  463. //Item Flow
  464. //**********************************************************************************************************************************************************
  465. /**
  466. * Extends mxShape.
  467. */
  468. function mxShapeSysMLItemFlow(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. };
  476. /**
  477. * Extends mxShape.
  478. */
  479. mxUtils.extend(mxShapeSysMLItemFlow, mxShape);
  480. mxShapeSysMLItemFlow.prototype.cst = {
  481. ITEM_FLOW : 'mxgraph.sysml.itemFlow',
  482. FLOW_DIR : 'flowDir',
  483. FLOW_TYPE : 'flowType'
  484. };
  485. /**
  486. * Function: paintVertexShape
  487. *
  488. * Paints the vertex shape.
  489. */
  490. mxShapeSysMLItemFlow.prototype.paintVertexShape = function(c, x, y, w, h)
  491. {
  492. var flowDir = mxUtils.getValue(this.style, mxShapeSysMLItemFlow.prototype.cst.FLOW_DIR, 'none').toLowerCase();
  493. var flowType = mxUtils.getValue(this.style, mxShapeSysMLItemFlow.prototype.cst.FLOW_TYPE, 'none');
  494. if (flowDir === 'n')
  495. {
  496. c.rect(x, y + 10, w, h - 10);
  497. c.fillAndStroke();
  498. c.setShadow(false);
  499. c.rect(x + w * 0.5 - 10, y, 20, 20);
  500. c.fillAndStroke();
  501. if (flowType === 'in')
  502. {
  503. this.drawDown(c, x + w * 0.5 - 5, y + 2, 10, 16);
  504. }
  505. else if (flowType === 'out')
  506. {
  507. this.drawUp(c, x + w * 0.5 - 5, y + 2, 10, 16);
  508. }
  509. }
  510. else if (flowDir === 's')
  511. {
  512. c.rect(x, y, w, h - 10);
  513. c.fillAndStroke();
  514. c.setShadow(false);
  515. c.rect(x + w * 0.5 - 10, y + h - 20, 20, 20);
  516. c.fillAndStroke();
  517. if (flowType === 'in')
  518. {
  519. this.drawUp(c, x + w * 0.5 - 5, y + h - 18, 10, 16);
  520. }
  521. else if (flowType === 'out')
  522. {
  523. this.drawDown(c, x + w * 0.5 - 5, y + h - 18, 10, 16);
  524. }
  525. }
  526. else if (flowDir === 'w')
  527. {
  528. c.rect(x + 10, y, w - 10, h);
  529. c.fillAndStroke();
  530. c.setShadow(false);
  531. c.rect(x, y + h * 0.5 - 10, 20, 20);
  532. c.fillAndStroke();
  533. if (flowType === 'in')
  534. {
  535. this.drawRight(c, x + 2, y + h * 0.5 - 5, 16, 10);
  536. }
  537. else if (flowType === 'out')
  538. {
  539. this.drawLeft(c, x + 2, y + h * 0.5 - 5, 16, 10);
  540. }
  541. }
  542. else if (flowDir === 'e')
  543. {
  544. c.rect(x, y, w - 10, h);
  545. c.fillAndStroke();
  546. c.setShadow(false);
  547. c.rect(x + w - 20, y + h * 0.5 - 10, 20, 20);
  548. c.fillAndStroke();
  549. if (flowType === 'in')
  550. {
  551. this.drawLeft(c, x + w - 18, y + h * 0.5 - 5, 16, 10);
  552. }
  553. else if (flowType === 'out')
  554. {
  555. this.drawRight(c, x + w - 18, y + h * 0.5 - 5, 16, 10);
  556. }
  557. }
  558. };
  559. mxShapeSysMLItemFlow.prototype.drawRight = function(c, x, y, w, h)
  560. {
  561. c.begin();
  562. c.moveTo(x, y + h * 0.5);
  563. c.lineTo(x + w, y + h * 0.5);
  564. c.moveTo(x + w * 0.75, y);
  565. c.lineTo(x + w, y + h * 0.5);
  566. c.lineTo(x + w * 0.75, y + h);
  567. c.stroke();
  568. }
  569. mxShapeSysMLItemFlow.prototype.drawDown = function(c, x, y, w, h)
  570. {
  571. c.begin();
  572. c.moveTo(x + w * 0.5, y);
  573. c.lineTo(x + w * 0.5, y + h);
  574. c.moveTo(x, y + h * 0.75);
  575. c.lineTo(x + w * 0.5, y + h);
  576. c.lineTo(x + w, y + h * 0.75);
  577. c.stroke();
  578. }
  579. mxShapeSysMLItemFlow.prototype.drawLeft = function(c, x, y, w, h)
  580. {
  581. c.begin();
  582. c.moveTo(x, y + h * 0.5);
  583. c.lineTo(x + w, y + h * 0.5);
  584. c.moveTo(x + w * 0.25, y);
  585. c.lineTo(x, y + h * 0.5);
  586. c.lineTo(x + w * 0.25, y + h);
  587. c.stroke();
  588. }
  589. mxShapeSysMLItemFlow.prototype.drawUp = function(c, x, y, w, h)
  590. {
  591. c.begin();
  592. c.moveTo(x + w * 0.5, y + h);
  593. c.lineTo(x + w * 0.5, y);
  594. c.moveTo(x, y + h * 0.25);
  595. c.lineTo(x + w * 0.5, y);
  596. c.lineTo(x + w, y + h * 0.25);
  597. c.stroke();
  598. }
  599. mxCellRenderer.registerShape(mxShapeSysMLItemFlow.prototype.cst.ITEM_FLOW, mxShapeSysMLItemFlow);
  600. mxShapeSysMLItemFlow.prototype.constraints = [
  601. new mxConnectionConstraint(new mxPoint(0.5, 0), true),
  602. new mxConnectionConstraint(new mxPoint(1, 0.5), true),
  603. new mxConnectionConstraint(new mxPoint(0.5, 1), true),
  604. new mxConnectionConstraint(new mxPoint(0, 0.5), true)
  605. ];
  606. //**********************************************************************************************************************************************************
  607. //Item Flow Left
  608. //**********************************************************************************************************************************************************
  609. /**
  610. * Extends mxShape.
  611. */
  612. function mxShapeSysMLItemFlowLeft(bounds, fill, stroke, strokewidth)
  613. {
  614. mxShape.call(this);
  615. this.bounds = bounds;
  616. this.fill = fill;
  617. this.stroke = stroke;
  618. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  619. };
  620. /**
  621. * Extends mxShape.
  622. */
  623. mxUtils.extend(mxShapeSysMLItemFlowLeft, mxShape);
  624. mxShapeSysMLItemFlowLeft.prototype.cst = {
  625. ITEM_FLOW_LEFT : 'mxgraph.sysml.itemFlowLeft'
  626. };
  627. /**
  628. * Function: paintVertexShape
  629. *
  630. * Paints the vertex shape.
  631. */
  632. mxShapeSysMLItemFlowLeft.prototype.paintVertexShape = function(c, x, y, w, h)
  633. {
  634. c.rect(x + 10, y, w - 10, h);
  635. c.fillAndStroke();
  636. c.rect(x, y + h * 0.25 - 10, 20, 20);
  637. c.fillAndStroke();
  638. c.rect(x, y + h * 0.5 - 10, 20, 20);
  639. c.fillAndStroke();
  640. c.rect(x, y + h * 0.75 - 10, 20, 20);
  641. c.fillAndStroke();
  642. };
  643. mxCellRenderer.registerShape(mxShapeSysMLItemFlowLeft.prototype.cst.ITEM_FLOW_LEFT, mxShapeSysMLItemFlowLeft);
  644. mxShapeSysMLItemFlowLeft.prototype.constraints = [
  645. new mxConnectionConstraint(new mxPoint(0.5, 0), true),
  646. new mxConnectionConstraint(new mxPoint(1, 0.5), true),
  647. new mxConnectionConstraint(new mxPoint(0.5, 1), true),
  648. new mxConnectionConstraint(new mxPoint(0, 0.25), true),
  649. new mxConnectionConstraint(new mxPoint(0, 0.5), true),
  650. new mxConnectionConstraint(new mxPoint(0, 0.75), true)
  651. ];
  652. //**********************************************************************************************************************************************************
  653. //Item Flow Right
  654. //**********************************************************************************************************************************************************
  655. /**
  656. * Extends mxShape.
  657. */
  658. function mxShapeSysMLItemFlowRight(bounds, fill, stroke, strokewidth)
  659. {
  660. mxShape.call(this);
  661. this.bounds = bounds;
  662. this.fill = fill;
  663. this.stroke = stroke;
  664. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  665. };
  666. /**
  667. * Extends mxShape.
  668. */
  669. mxUtils.extend(mxShapeSysMLItemFlowRight, mxShape);
  670. mxShapeSysMLItemFlowRight.prototype.cst = {
  671. ITEM_FLOW_RIGHT : 'mxgraph.sysml.itemFlowRight'
  672. };
  673. /**
  674. * Function: paintVertexShape
  675. *
  676. * Paints the vertex shape.
  677. */
  678. mxShapeSysMLItemFlowRight.prototype.paintVertexShape = function(c, x, y, w, h)
  679. {
  680. c.rect(x, y, w - 10, h);
  681. c.fillAndStroke();
  682. c.rect(x + w - 20, y + h * 0.25 - 10, 20, 20);
  683. c.fillAndStroke();
  684. c.rect(x + w - 20, y + h * 0.5 - 10, 20, 20);
  685. c.fillAndStroke();
  686. c.rect(x + w - 20, y + h * 0.75 - 10, 20, 20);
  687. c.fillAndStroke();
  688. };
  689. mxCellRenderer.registerShape(mxShapeSysMLItemFlowRight.prototype.cst.ITEM_FLOW_RIGHT, mxShapeSysMLItemFlowRight);
  690. mxShapeSysMLItemFlowRight.prototype.constraints = [
  691. new mxConnectionConstraint(new mxPoint(0.5, 0), true),
  692. new mxConnectionConstraint(new mxPoint(0, 0.5), true),
  693. new mxConnectionConstraint(new mxPoint(0.5, 1), true),
  694. new mxConnectionConstraint(new mxPoint(1, 0.25), true),
  695. new mxConnectionConstraint(new mxPoint(1, 0.5), true),
  696. new mxConnectionConstraint(new mxPoint(1, 0.75), true)
  697. ];
  698. //**********************************************************************************************************************************************************
  699. //Nested Port
  700. //**********************************************************************************************************************************************************
  701. /**
  702. * Extends mxShape.
  703. */
  704. function mxShapeSysMLNestedPort(bounds, fill, stroke, strokewidth)
  705. {
  706. mxShape.call(this);
  707. this.bounds = bounds;
  708. this.fill = fill;
  709. this.stroke = stroke;
  710. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  711. };
  712. /**
  713. * Extends mxShape.
  714. */
  715. mxUtils.extend(mxShapeSysMLNestedPort, mxShape);
  716. mxShapeSysMLNestedPort.prototype.cst = {
  717. NESTED_PORT : 'mxgraph.sysml.nestedPort'
  718. };
  719. /**
  720. * Function: paintVertexShape
  721. *
  722. * Paints the vertex shape.
  723. */
  724. mxShapeSysMLNestedPort.prototype.paintVertexShape = function(c, x, y, w, h)
  725. {
  726. c.rect(x + w * 0.08, y, w * 0.92, h);
  727. c.fillAndStroke();
  728. c.rect(x + w * 0.03, y + h * 0.1, w * 0.1, h * 0.8);
  729. c.fillAndStroke();
  730. c.rect(x, y + h * 0.15, w * 0.06, h * 0.16);
  731. c.fillAndStroke();
  732. c.rect(x, y + h * 0.42, w * 0.06, h * 0.16);
  733. c.fillAndStroke();
  734. c.rect(x, y + h * 0.69, w * 0.06, h * 0.16);
  735. c.fillAndStroke();
  736. };
  737. mxCellRenderer.registerShape(mxShapeSysMLNestedPort.prototype.cst.NESTED_PORT, mxShapeSysMLNestedPort);
  738. //**********************************************************************************************************************************************************
  739. //Package Containment
  740. //**********************************************************************************************************************************************************
  741. mxMarker.addMarker('sysMLPackCont', function(c, shape, type, pe, unitX, unitY, size, source, sw, filled)
  742. {
  743. var nx = unitX * (size + sw + 1);
  744. var ny = unitY * (size + sw + 1);
  745. var a = size / 2;
  746. return function()
  747. {
  748. c.begin();
  749. c.moveTo(pe.x - nx / 2 - ny / 2, pe.y - ny / 2 + nx / 2);
  750. c.lineTo(pe.x - nx / 2 + ny / 2, pe.y - ny / 2 - nx / 2);
  751. c.stroke();
  752. c.ellipse(pe.x - 0.5 * nx - a, pe.y - 0.5 * ny - a, 2 * a, 2 * a);
  753. c.stroke();
  754. };
  755. });
  756. //**********************************************************************************************************************************************************
  757. //Required Interface
  758. //**********************************************************************************************************************************************************
  759. mxMarker.addMarker('sysMLReqInt', function(c, shape, type, pe, unitX, unitY, size, source, sw, filled)
  760. {
  761. var nx = unitX * (size + sw + 1);
  762. var ny = unitY * (size + sw + 1);
  763. var a = size / 2;
  764. return function()
  765. {
  766. var fillColor = mxUtils.getValue(shape.style, mxConstants.STYLE_FILLCOLOR, 'none');
  767. c.setFillColor(fillColor);
  768. c.ellipse(pe.x - 0.5 * nx - a, pe.y - 0.5 * ny - a, 2 * a, 2 * a);
  769. c.fillAndStroke();
  770. };
  771. });
  772. //**********************************************************************************************************************************************************
  773. //Provided Interface
  774. //**********************************************************************************************************************************************************
  775. mxMarker.addMarker('sysMLProvInt', function(c, shape, type, pe, unitX, unitY, size, source, sw, filled)
  776. {
  777. var nx = unitX * (size + sw + 1);
  778. var ny = unitY * (size + sw + 1);
  779. var a = size / 2;
  780. return function()
  781. {
  782. var fillColor = mxUtils.getValue(shape.style, mxConstants.STYLE_FILLCOLOR, 'none');
  783. c.setFillColor(fillColor);
  784. c.begin();
  785. c.moveTo(pe.x - ny / 2, pe.y + nx / 2);
  786. c.arcTo(a, a, 0, 0, 1, pe.x + ny / 2, pe.y - nx / 2);
  787. c.fillAndStroke();
  788. };
  789. });
  790. //**********************************************************************************************************************************************************
  791. //Parametric Diagram
  792. //**********************************************************************************************************************************************************
  793. /**
  794. * Extends mxShape.
  795. */
  796. function mxShapeSysMLParametricDiagram(bounds, fill, stroke, strokewidth)
  797. {
  798. mxShape.call(this);
  799. this.bounds = bounds;
  800. this.fill = fill;
  801. this.stroke = stroke;
  802. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  803. };
  804. /**
  805. * Extends mxShape.
  806. */
  807. mxUtils.extend(mxShapeSysMLParametricDiagram, mxShape);
  808. mxShapeSysMLParametricDiagram.prototype.cst = {
  809. PARAM_DGM : 'mxgraph.sysml.paramDgm'
  810. };
  811. /**
  812. * Function: paintVertexShape
  813. *
  814. * Paints the vertex shape.
  815. */
  816. mxShapeSysMLParametricDiagram.prototype.paintVertexShape = function(c, x, y, w, h)
  817. {
  818. c.roundrect(x, y, w, h, 10, 10);
  819. c.fillAndStroke();
  820. c.setShadow(false);
  821. if (h > 60)
  822. {
  823. c.rect(x, y + h * 0.25 - 10, 20, 20);
  824. c.stroke();
  825. c.rect(x, y + h * 0.75 - 10, 20, 20);
  826. c.stroke();
  827. }
  828. };
  829. mxCellRenderer.registerShape(mxShapeSysMLParametricDiagram.prototype.cst.PARAM_DGM, mxShapeSysMLParametricDiagram);
  830. //**********************************************************************************************************************************************************
  831. //Constraint Property
  832. //**********************************************************************************************************************************************************
  833. /**
  834. * Extends mxShape.
  835. */
  836. function mxShapeSysMLConstraintProperty(bounds, fill, stroke, strokewidth)
  837. {
  838. mxShape.call(this);
  839. this.bounds = bounds;
  840. this.fill = fill;
  841. this.stroke = stroke;
  842. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  843. };
  844. /**
  845. * Extends mxShape.
  846. */
  847. mxUtils.extend(mxShapeSysMLConstraintProperty, mxShape);
  848. mxShapeSysMLConstraintProperty.prototype.cst = {
  849. CONS_PROP : 'mxgraph.sysml.consProp'
  850. };
  851. /**
  852. * Function: paintVertexShape
  853. *
  854. * Paints the vertex shape.
  855. */
  856. mxShapeSysMLConstraintProperty.prototype.paintVertexShape = function(c, x, y, w, h)
  857. {
  858. c.rect(x, y, w, h);
  859. c.fillAndStroke();
  860. c.setShadow(false);
  861. if (h > 60)
  862. {
  863. c.rect(x, y + 50, 20, 20);
  864. c.stroke();
  865. c.rect(x, y + 80, 20, 20);
  866. c.stroke();
  867. }
  868. };
  869. mxCellRenderer.registerShape(mxShapeSysMLConstraintProperty.prototype.cst.CONS_PROP, mxShapeSysMLConstraintProperty);
  870. //**********************************************************************************************************************************************************
  871. //Call Behavior Action
  872. //**********************************************************************************************************************************************************
  873. /**
  874. * Extends mxShape.
  875. */
  876. function mxShapeSysMLCallBehaviorAction(bounds, fill, stroke, strokewidth)
  877. {
  878. mxShape.call(this);
  879. this.bounds = bounds;
  880. this.fill = fill;
  881. this.stroke = stroke;
  882. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  883. };
  884. /**
  885. * Extends mxShape.
  886. */
  887. mxUtils.extend(mxShapeSysMLCallBehaviorAction, mxShape);
  888. mxShapeSysMLCallBehaviorAction.prototype.cst = {
  889. CALL_BEH_ACT : 'mxgraph.sysml.callBehAct'
  890. };
  891. /**
  892. * Function: paintVertexShape
  893. *
  894. * Paints the vertex shape.
  895. */
  896. mxShapeSysMLCallBehaviorAction.prototype.paintVertexShape = function(c, x, y, w, h)
  897. {
  898. c.roundrect(x, y, w, h, 10, 10);
  899. c.fillAndStroke();
  900. if ((h > 30) && (w > 40))
  901. {
  902. c.setShadow(false);
  903. this.drawSymb(c, x + w - 30, y + h - 30, 20, 20);
  904. }
  905. };
  906. mxShapeSysMLCallBehaviorAction.prototype.drawSymb = function(c, x, y, w, h)
  907. {
  908. c.begin();
  909. c.moveTo(x + w * 0.5, y);
  910. c.lineTo(x + w * 0.5, y + h);
  911. c.moveTo(x, y + h);
  912. c.lineTo(x, y + h * 0.5);
  913. c.lineTo(x + w, y + h * 0.5);
  914. c.lineTo(x + w, y + h);
  915. c.stroke();
  916. };
  917. mxCellRenderer.registerShape(mxShapeSysMLCallBehaviorAction.prototype.cst.CALL_BEH_ACT, mxShapeSysMLCallBehaviorAction);
  918. //**********************************************************************************************************************************************************
  919. //Accept Event Action
  920. //**********************************************************************************************************************************************************
  921. /**
  922. * Extends mxShape.
  923. */
  924. function mxShapeSysMLAcceptEventAction(bounds, fill, stroke, strokewidth)
  925. {
  926. mxShape.call(this);
  927. this.bounds = bounds;
  928. this.fill = fill;
  929. this.stroke = stroke;
  930. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  931. };
  932. /**
  933. * Extends mxShape.
  934. */
  935. mxUtils.extend(mxShapeSysMLAcceptEventAction, mxShape);
  936. mxShapeSysMLAcceptEventAction.prototype.cst = {
  937. ACC_EVENT : 'mxgraph.sysml.accEvent'
  938. };
  939. /**
  940. * Function: paintVertexShape
  941. *
  942. * Paints the vertex shape.
  943. */
  944. mxShapeSysMLAcceptEventAction.prototype.paintVertexShape = function(c, x, y, w, h)
  945. {
  946. c.begin();
  947. c.moveTo(x, y);
  948. c.lineTo(x + w, y);
  949. c.lineTo(x + w, y + h);
  950. c.lineTo(x, y + h);
  951. c.lineTo(x + h * 0.3, y + h * 0.5);
  952. c.close();
  953. c.fillAndStroke();
  954. };
  955. mxCellRenderer.registerShape(mxShapeSysMLAcceptEventAction.prototype.cst.ACC_EVENT, mxShapeSysMLAcceptEventAction);
  956. //**********************************************************************************************************************************************************
  957. //Time Event
  958. //**********************************************************************************************************************************************************
  959. /**
  960. * Extends mxShape.
  961. */
  962. function mxShapeSysMLTimeEvent(bounds, fill, stroke, strokewidth)
  963. {
  964. mxShape.call(this);
  965. this.bounds = bounds;
  966. this.fill = fill;
  967. this.stroke = stroke;
  968. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  969. };
  970. /**
  971. * Extends mxShape.
  972. */
  973. mxUtils.extend(mxShapeSysMLTimeEvent, mxShape);
  974. mxShapeSysMLTimeEvent.prototype.cst = {
  975. TIME_EVENT : 'mxgraph.sysml.timeEvent'
  976. };
  977. /**
  978. * Function: paintVertexShape
  979. *
  980. * Paints the vertex shape.
  981. */
  982. mxShapeSysMLTimeEvent.prototype.paintVertexShape = function(c, x, y, w, h)
  983. {
  984. c.begin();
  985. c.moveTo(x, y);
  986. c.lineTo(x + w, y);
  987. c.lineTo(x, y + h);
  988. c.lineTo(x + w, y + h);
  989. c.close();
  990. c.fillAndStroke();
  991. };
  992. mxCellRenderer.registerShape(mxShapeSysMLTimeEvent.prototype.cst.TIME_EVENT, mxShapeSysMLTimeEvent);
  993. //**********************************************************************************************************************************************************
  994. //Send Signal Action
  995. //**********************************************************************************************************************************************************
  996. /**
  997. * Extends mxShape.
  998. */
  999. function mxShapeSysMLSendSignalAction(bounds, fill, stroke, strokewidth)
  1000. {
  1001. mxShape.call(this);
  1002. this.bounds = bounds;
  1003. this.fill = fill;
  1004. this.stroke = stroke;
  1005. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1006. };
  1007. /**
  1008. * Extends mxShape.
  1009. */
  1010. mxUtils.extend(mxShapeSysMLSendSignalAction, mxShape);
  1011. mxShapeSysMLSendSignalAction.prototype.cst = {
  1012. SEND_SIG_ACT : 'mxgraph.sysml.sendSigAct'
  1013. };
  1014. /**
  1015. * Function: paintVertexShape
  1016. *
  1017. * Paints the vertex shape.
  1018. */
  1019. mxShapeSysMLSendSignalAction.prototype.paintVertexShape = function(c, x, y, w, h)
  1020. {
  1021. c.begin();
  1022. c.moveTo(x, y);
  1023. c.lineTo(x + w - h * 0.3, y);
  1024. c.lineTo(x + w, y + h * 0.5);
  1025. c.lineTo(x + w - h * 0.3, y + h);
  1026. c.lineTo(x, y + h);
  1027. c.close();
  1028. c.fillAndStroke();
  1029. };
  1030. mxCellRenderer.registerShape(mxShapeSysMLSendSignalAction.prototype.cst.SEND_SIG_ACT, mxShapeSysMLSendSignalAction);
  1031. //**********************************************************************************************************************************************************
  1032. //Activity Final
  1033. //**********************************************************************************************************************************************************
  1034. /**
  1035. * Extends mxShape.
  1036. */
  1037. function mxShapeSysMLActivityFinal(bounds, fill, stroke, strokewidth)
  1038. {
  1039. mxShape.call(this);
  1040. this.bounds = bounds;
  1041. this.fill = fill;
  1042. this.stroke = stroke;
  1043. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1044. };
  1045. /**
  1046. * Extends mxShape.
  1047. */
  1048. mxUtils.extend(mxShapeSysMLActivityFinal, mxShape);
  1049. mxShapeSysMLActivityFinal.prototype.cst = {
  1050. ACT_FINAL : 'mxgraph.sysml.actFinal'
  1051. };
  1052. /**
  1053. * Function: paintVertexShape
  1054. *
  1055. * Paints the vertex shape.
  1056. */
  1057. mxShapeSysMLActivityFinal.prototype.paintVertexShape = function(c, x, y, w, h)
  1058. {
  1059. c.ellipse(x, y, w, h);
  1060. c.fillAndStroke();
  1061. var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#000000');
  1062. c.setFillColor(strokeColor);
  1063. c.ellipse(x + 5, y + 5, w - 10, h - 10);
  1064. c.fillAndStroke();
  1065. };
  1066. mxCellRenderer.registerShape(mxShapeSysMLActivityFinal.prototype.cst.ACT_FINAL, mxShapeSysMLActivityFinal);
  1067. //**********************************************************************************************************************************************************
  1068. //Activity Parameter Node
  1069. //**********************************************************************************************************************************************************
  1070. /**
  1071. * Extends mxShape.
  1072. */
  1073. function mxShapeSysMLActivityParameterNode(bounds, fill, stroke, strokewidth)
  1074. {
  1075. mxShape.call(this);
  1076. this.bounds = bounds;
  1077. this.fill = fill;
  1078. this.stroke = stroke;
  1079. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1080. };
  1081. /**
  1082. * Extends mxShape.
  1083. */
  1084. mxUtils.extend(mxShapeSysMLActivityParameterNode, mxShape);
  1085. mxShapeSysMLActivityParameterNode.prototype.cst = {
  1086. ACT_PARAM_NODE : 'mxgraph.sysml.actParamNode'
  1087. };
  1088. /**
  1089. * Function: paintVertexShape
  1090. *
  1091. * Paints the vertex shape.
  1092. */
  1093. mxShapeSysMLActivityParameterNode.prototype.paintVertexShape = function(c, x, y, w, h)
  1094. {
  1095. c.translate(x, y);
  1096. c.begin();
  1097. var minX = Math.max(w * 0.35, 70);
  1098. var maxX = Math.min(w * 0.65, w - 10);
  1099. c.begin();
  1100. c.moveTo(minX, h);
  1101. c.lineTo(10, h);
  1102. c.lineTo(10, 0);
  1103. c.lineTo(minX, 0);
  1104. c.moveTo(maxX, h);
  1105. c.lineTo(w - 10, h);
  1106. c.lineTo(w - 10, 0);
  1107. c.lineTo(maxX, 0);
  1108. c.stroke();
  1109. var xSize = 50;
  1110. var ySize = 20;
  1111. xSize = Math.min(xSize, w);
  1112. if (xSize > ySize)
  1113. {
  1114. c.begin();
  1115. c.moveTo(10, ySize);
  1116. c.lineTo(xSize - ySize * 0.5, ySize);
  1117. c.lineTo(xSize, ySize * 0.5);
  1118. c.lineTo(xSize, 0);
  1119. c.lineTo(10, 0);
  1120. c.close();
  1121. c.fillAndStroke();
  1122. }
  1123. c.rect(0, h * 0.35 - 10, 20, 20);
  1124. c.fillAndStroke();
  1125. c.rect(0, h * 0.65 - 10, 20, 20);
  1126. c.fillAndStroke();
  1127. c.rect(w - 20, h * 0.5 - 10, 20, 20);
  1128. c.fillAndStroke();
  1129. };
  1130. mxCellRenderer.registerShape(mxShapeSysMLActivityParameterNode.prototype.cst.ACT_PARAM_NODE, mxShapeSysMLActivityParameterNode);
  1131. //**********************************************************************************************************************************************************
  1132. //Control Operator
  1133. //**********************************************************************************************************************************************************
  1134. /**
  1135. * Extends mxShape.
  1136. */
  1137. function mxShapeSysMLControlOperator(bounds, fill, stroke, strokewidth)
  1138. {
  1139. mxShape.call(this);
  1140. this.bounds = bounds;
  1141. this.fill = fill;
  1142. this.stroke = stroke;
  1143. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1144. };
  1145. /**
  1146. * Extends mxShape.
  1147. */
  1148. mxUtils.extend(mxShapeSysMLControlOperator, mxShape);
  1149. mxShapeSysMLControlOperator.prototype.cst = {
  1150. CONT_OPER : 'mxgraph.sysml.contOper'
  1151. };
  1152. /**
  1153. * Function: paintVertexShape
  1154. *
  1155. * Paints the vertex shape.
  1156. */
  1157. mxShapeSysMLControlOperator.prototype.paintVertexShape = function(c, x, y, w, h)
  1158. {
  1159. c.translate(x, y);
  1160. this.background(c, x, y, w, h);
  1161. c.setShadow(false);
  1162. this.foreground(c, x, y, w, h);
  1163. };
  1164. mxShapeSysMLControlOperator.prototype.background = function(c, x, y, w, h)
  1165. {
  1166. c.rect(0, 0, w, h);
  1167. c.fillAndStroke();
  1168. };
  1169. mxShapeSysMLControlOperator.prototype.foreground = function(c, x, y, w, h)
  1170. {
  1171. var xSize = 130;
  1172. var ySize = 20;
  1173. xSize = Math.min(xSize, w);
  1174. if (xSize > ySize)
  1175. {
  1176. c.begin();
  1177. c.moveTo(0, ySize);
  1178. c.lineTo(xSize - ySize * 0.5, ySize);
  1179. c.lineTo(xSize, ySize * 0.5);
  1180. c.lineTo(xSize, 0);
  1181. c.stroke();
  1182. }
  1183. };
  1184. mxCellRenderer.registerShape(mxShapeSysMLControlOperator.prototype.cst.CONT_OPER, mxShapeSysMLControlOperator);
  1185. //**********************************************************************************************************************************************************
  1186. //Flow Final
  1187. //**********************************************************************************************************************************************************
  1188. /**
  1189. * Extends mxShape.
  1190. */
  1191. function mxShapeSysMLFlowFinal(bounds, fill, stroke, strokewidth)
  1192. {
  1193. mxShape.call(this);
  1194. this.bounds = bounds;
  1195. this.fill = fill;
  1196. this.stroke = stroke;
  1197. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1198. };
  1199. /**
  1200. * Extends mxShape.
  1201. */
  1202. mxUtils.extend(mxShapeSysMLFlowFinal, mxShape);
  1203. mxShapeSysMLFlowFinal.prototype.cst = {
  1204. FLOW_FINAL : 'mxgraph.sysml.flowFinal'
  1205. };
  1206. /**
  1207. * Function: paintVertexShape
  1208. *
  1209. * Paints the vertex shape.
  1210. */
  1211. mxShapeSysMLFlowFinal.prototype.paintVertexShape = function(c, x, y, w, h)
  1212. {
  1213. c.translate(x, y);
  1214. c.ellipse(0, 0, w, h);
  1215. c.fillAndStroke();
  1216. c.setShadow(false);
  1217. c.begin();
  1218. c.moveTo(w * 0.145, h * 0.145);
  1219. c.lineTo(w * 0.855, h * 0.855);
  1220. c.moveTo(w * 0.855, h * 0.145);
  1221. c.lineTo(w * 0.145, h * 0.855);
  1222. c.stroke();
  1223. };
  1224. mxCellRenderer.registerShape(mxShapeSysMLFlowFinal.prototype.cst.FLOW_FINAL, mxShapeSysMLFlowFinal);
  1225. //**********************************************************************************************************************************************************
  1226. //Is Control
  1227. //**********************************************************************************************************************************************************
  1228. /**
  1229. * Extends mxShape.
  1230. */
  1231. function mxShapeSysMLIsControl(bounds, fill, stroke, strokewidth)
  1232. {
  1233. mxShape.call(this);
  1234. this.bounds = bounds;
  1235. this.fill = fill;
  1236. this.stroke = stroke;
  1237. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1238. };
  1239. /**
  1240. * Extends mxShape.
  1241. */
  1242. mxUtils.extend(mxShapeSysMLIsControl, mxShape);
  1243. mxShapeSysMLIsControl.prototype.cst = {
  1244. IS_CONTROL : 'mxgraph.sysml.isControl'
  1245. };
  1246. /**
  1247. * Function: paintVertexShape
  1248. *
  1249. * Paints the vertex shape.
  1250. */
  1251. mxShapeSysMLIsControl.prototype.paintVertexShape = function(c, x, y, w, h)
  1252. {
  1253. c.translate(x, y);
  1254. c.rect(0, h * 0.5 - 10, 10, 20);
  1255. c.fillAndStroke();
  1256. c.roundrect(10, 0, w - 20, h, 10, 10);
  1257. c.fillAndStroke();
  1258. c.rect(w - 10, h * 0.5 - 10, 10, 20);
  1259. c.fillAndStroke();
  1260. };
  1261. mxCellRenderer.registerShape(mxShapeSysMLIsControl.prototype.cst.IS_CONTROL, mxShapeSysMLIsControl);
  1262. //**********************************************************************************************************************************************************
  1263. //Is Stream
  1264. //**********************************************************************************************************************************************************
  1265. /**
  1266. * Extends mxShape.
  1267. */
  1268. function mxShapeSysMLIsStream(bounds, fill, stroke, strokewidth)
  1269. {
  1270. mxShape.call(this);
  1271. this.bounds = bounds;
  1272. this.fill = fill;
  1273. this.stroke = stroke;
  1274. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1275. };
  1276. /**
  1277. * Extends mxShape.
  1278. */
  1279. mxUtils.extend(mxShapeSysMLIsStream, mxShape);
  1280. mxShapeSysMLIsStream.prototype.cst = {
  1281. IS_STREAM : 'mxgraph.sysml.isStream'
  1282. };
  1283. /**
  1284. * Function: paintVertexShape
  1285. *
  1286. * Paints the vertex shape.
  1287. */
  1288. mxShapeSysMLIsStream.prototype.paintVertexShape = function(c, x, y, w, h)
  1289. {
  1290. c.translate(x, y);
  1291. var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#000000');
  1292. var fillColor = mxUtils.getValue(this.style, mxConstants.STYLE_FILLCOLOR, '#ffffff');
  1293. c.setFillColor(strokeColor);
  1294. c.rect(0, h * 0.5 - 10, 10, 20);
  1295. c.fillAndStroke();
  1296. c.setFillColor(fillColor);
  1297. c.roundrect(10, 0, w - 20, h, 10, 10);
  1298. c.fillAndStroke();
  1299. c.setFillColor(strokeColor);
  1300. c.rect(w - 10, h * 0.5 - 10, 10, 20);
  1301. c.fillAndStroke();
  1302. };
  1303. mxCellRenderer.registerShape(mxShapeSysMLIsStream.prototype.cst.IS_STREAM, mxShapeSysMLIsStream);
  1304. //**********************************************************************************************************************************************************
  1305. //Is Activity Stream
  1306. //**********************************************************************************************************************************************************
  1307. /**
  1308. * Extends mxShape.
  1309. */
  1310. function mxShapeSysMLIsActStream(bounds, fill, stroke, strokewidth)
  1311. {
  1312. mxShape.call(this);
  1313. this.bounds = bounds;
  1314. this.fill = fill;
  1315. this.stroke = stroke;
  1316. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1317. };
  1318. /**
  1319. * Extends mxShape.
  1320. */
  1321. mxUtils.extend(mxShapeSysMLIsActStream, mxShape);
  1322. mxShapeSysMLIsActStream.prototype.cst = {
  1323. IS_ACT_STREAM : 'mxgraph.sysml.isActStream'
  1324. };
  1325. /**
  1326. * Function: paintVertexShape
  1327. *
  1328. * Paints the vertex shape.
  1329. */
  1330. mxShapeSysMLIsActStream.prototype.paintVertexShape = function(c, x, y, w, h)
  1331. {
  1332. c.translate(x, y);
  1333. c.begin();
  1334. c.rect(0, 0, w - 10, h);
  1335. c.fillAndStroke();
  1336. var xSize = 40;
  1337. var ySize = 20;
  1338. xSize = Math.min(xSize, w);
  1339. if (xSize > ySize)
  1340. {
  1341. c.begin();
  1342. c.moveTo(0, ySize);
  1343. c.lineTo(xSize - ySize * 0.5, ySize);
  1344. c.lineTo(xSize, ySize * 0.5);
  1345. c.lineTo(xSize, 0);
  1346. c.lineTo(0, 0);
  1347. c.close();
  1348. c.fillAndStroke();
  1349. }
  1350. c.rect(w - 20, h * 0.5 - 10, 20, 20);
  1351. c.fillAndStroke();
  1352. };
  1353. mxCellRenderer.registerShape(mxShapeSysMLIsActStream.prototype.cst.IS_ACT_STREAM, mxShapeSysMLIsActStream);
  1354. //**********************************************************************************************************************************************************
  1355. //Parameter Set
  1356. //**********************************************************************************************************************************************************
  1357. /**
  1358. * Extends mxShape.
  1359. */
  1360. function mxShapeSysMLParameterSet(bounds, fill, stroke, strokewidth)
  1361. {
  1362. mxShape.call(this);
  1363. this.bounds = bounds;
  1364. this.fill = fill;
  1365. this.stroke = stroke;
  1366. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1367. };
  1368. /**
  1369. * Extends mxShape.
  1370. */
  1371. mxUtils.extend(mxShapeSysMLParameterSet, mxShape);
  1372. mxShapeSysMLParameterSet.prototype.cst = {
  1373. PARAM_SET : 'mxgraph.sysml.paramSet'
  1374. };
  1375. /**
  1376. * Function: paintVertexShape
  1377. *
  1378. * Paints the vertex shape.
  1379. */
  1380. mxShapeSysMLParameterSet.prototype.paintVertexShape = function(c, x, y, w, h)
  1381. {
  1382. c.translate(x, y);
  1383. c.rect(0, h * 0.5 - 28, 10, 56);
  1384. c.fillAndStroke();
  1385. c.roundrect(10, 0, w - 20, h, 10, 10);
  1386. c.fillAndStroke();
  1387. c.rect(w - 10, h * 0.5 - 28, 10, 56);
  1388. c.fillAndStroke();
  1389. c.setShadow(false);
  1390. c.rect(4, h * 0.5 - 24, 6, 20);
  1391. c.fillAndStroke();
  1392. c.rect(4, h * 0.5 + 4, 6, 20);
  1393. c.fillAndStroke();
  1394. c.rect(w - 10, h * 0.5 - 24, 6, 20);
  1395. c.fillAndStroke();
  1396. c.rect(w - 10, h * 0.5 + 4, 6, 20);
  1397. c.fillAndStroke();
  1398. };
  1399. mxCellRenderer.registerShape(mxShapeSysMLParameterSet.prototype.cst.PARAM_SET, mxShapeSysMLParameterSet);
  1400. //**********************************************************************************************************************************************************
  1401. //Is Activity Stream
  1402. //**********************************************************************************************************************************************************
  1403. /**
  1404. * Extends mxShape.
  1405. */
  1406. function mxShapeSysMLParameterActivitySet(bounds, fill, stroke, strokewidth)
  1407. {
  1408. mxShape.call(this);
  1409. this.bounds = bounds;
  1410. this.fill = fill;
  1411. this.stroke = stroke;
  1412. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1413. };
  1414. /**
  1415. * Extends mxShape.
  1416. */
  1417. mxUtils.extend(mxShapeSysMLParameterActivitySet, mxShape);
  1418. mxShapeSysMLParameterActivitySet.prototype.cst = {
  1419. PARAM_ACT_SET : 'mxgraph.sysml.paramActSet'
  1420. };
  1421. /**
  1422. * Function: paintVertexShape
  1423. *
  1424. * Paints the vertex shape.
  1425. */
  1426. mxShapeSysMLParameterActivitySet.prototype.paintVertexShape = function(c, x, y, w, h)
  1427. {
  1428. c.translate(x, y);
  1429. c.begin();
  1430. c.rect(10, 0, w - 20, h);
  1431. c.fillAndStroke();
  1432. var xSize = 50;
  1433. var ySize = 20;
  1434. xSize = Math.min(xSize, w);
  1435. if (xSize > ySize)
  1436. {
  1437. c.begin();
  1438. c.moveTo(10, ySize);
  1439. c.lineTo(xSize - ySize * 0.5, ySize);
  1440. c.lineTo(xSize, ySize * 0.5);
  1441. c.lineTo(xSize, 0);
  1442. c.lineTo(10, 0);
  1443. c.close();
  1444. c.fillAndStroke();
  1445. }
  1446. c.setShadow(false);
  1447. if (h > 70)
  1448. {
  1449. c.rect(0, h * 0.5 - 28, 15, 56);
  1450. c.fillAndStroke();
  1451. c.rect(4, h * 0.5 - 24, 15, 20);
  1452. c.fillAndStroke();
  1453. c.rect(4, h * 0.5 + 4, 15, 20);
  1454. c.fillAndStroke();
  1455. c.rect(w - 15, h * 0.5 - 28, 15, 56);
  1456. c.fillAndStroke();
  1457. c.rect(w - 19, h * 0.5 - 24, 15, 20);
  1458. c.fillAndStroke();
  1459. c.rect(w - 19, h * 0.5 + 4, 15, 20);
  1460. c.fillAndStroke();
  1461. }
  1462. };
  1463. mxCellRenderer.registerShape(mxShapeSysMLParameterActivitySet.prototype.cst.PARAM_ACT_SET, mxShapeSysMLParameterActivitySet);
  1464. //**********************************************************************************************************************************************************
  1465. //Probability
  1466. //**********************************************************************************************************************************************************
  1467. /**
  1468. * Extends mxShape.
  1469. */
  1470. function mxShapeSysMLProbability(bounds, fill, stroke, strokewidth)
  1471. {
  1472. mxShape.call(this);
  1473. this.bounds = bounds;
  1474. this.fill = fill;
  1475. this.stroke = stroke;
  1476. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1477. };
  1478. /**
  1479. * Extends mxShape.
  1480. */
  1481. mxUtils.extend(mxShapeSysMLProbability, mxShape);
  1482. mxShapeSysMLProbability.prototype.cst = {
  1483. PROBABILITY : 'mxgraph.sysml.probability'
  1484. };
  1485. /**
  1486. * Function: paintVertexShape
  1487. *
  1488. * Paints the vertex shape.
  1489. */
  1490. mxShapeSysMLProbability.prototype.paintVertexShape = function(c, x, y, w, h)
  1491. {
  1492. c.translate(x, y);
  1493. c.roundrect(0, 0, w - 10, h, 10, 10);
  1494. c.fillAndStroke();
  1495. c.rect(w - 10, h * 0.25 - 28, 10, 56);
  1496. c.fillAndStroke();
  1497. c.rect(w - 10, h * 0.75 - 28, 10, 56);
  1498. c.fillAndStroke();
  1499. c.setShadow(false);
  1500. c.rect(w - 10, h * 0.25 - 24, 6, 20);
  1501. c.fillAndStroke();
  1502. c.rect(w - 10, h * 0.25 + 4, 6, 20);
  1503. c.fillAndStroke();
  1504. c.rect(w - 10, h * 0.75 - 24, 6, 20);
  1505. c.fillAndStroke();
  1506. c.rect(w - 10, h * 0.75 + 4, 6, 20);
  1507. c.fillAndStroke();
  1508. };
  1509. mxCellRenderer.registerShape(mxShapeSysMLProbability.prototype.cst.PROBABILITY, mxShapeSysMLProbability);
  1510. //**********************************************************************************************************************************************************
  1511. //Is Activity Stream
  1512. //**********************************************************************************************************************************************************
  1513. /**
  1514. * Extends mxShape.
  1515. */
  1516. function mxShapeSysMLActivityProbability(bounds, fill, stroke, strokewidth)
  1517. {
  1518. mxShape.call(this);
  1519. this.bounds = bounds;
  1520. this.fill = fill;
  1521. this.stroke = stroke;
  1522. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1523. };
  1524. /**
  1525. * Extends mxShape.
  1526. */
  1527. mxUtils.extend(mxShapeSysMLActivityProbability, mxShape);
  1528. mxShapeSysMLActivityProbability.prototype.cst = {
  1529. ACT_PROB : 'mxgraph.sysml.actProb'
  1530. };
  1531. /**
  1532. * Function: paintVertexShape
  1533. *
  1534. * Paints the vertex shape.
  1535. */
  1536. mxShapeSysMLActivityProbability.prototype.paintVertexShape = function(c, x, y, w, h)
  1537. {
  1538. c.translate(x, y);
  1539. c.begin();
  1540. c.rect(0, 0, w - 10, h);
  1541. c.fillAndStroke();
  1542. var xSize = 40;
  1543. var ySize = 20;
  1544. xSize = Math.min(xSize, w);
  1545. if (xSize > ySize)
  1546. {
  1547. c.begin();
  1548. c.moveTo(0, ySize);
  1549. c.lineTo(xSize - ySize * 0.5, ySize);
  1550. c.lineTo(xSize, ySize * 0.5);
  1551. c.lineTo(xSize, 0);
  1552. c.lineTo(0, 0);
  1553. c.close();
  1554. c.fillAndStroke();
  1555. }
  1556. c.setShadow(false);
  1557. if (h > 70)
  1558. {
  1559. c.rect(w - 15, h * 0.25 - 28, 15, 56);
  1560. c.fillAndStroke();
  1561. c.rect(w - 19, h * 0.25 - 24, 15, 20);
  1562. c.fillAndStroke();
  1563. c.rect(w - 19, h * 0.25 + 4, 15, 20);
  1564. c.fillAndStroke();
  1565. c.rect(w - 15, h * 0.75 - 28, 15, 56);
  1566. c.fillAndStroke();
  1567. c.rect(w - 19, h * 0.75 - 24, 15, 20);
  1568. c.fillAndStroke();
  1569. c.rect(w - 19, h * 0.75 + 4, 15, 20);
  1570. c.fillAndStroke();
  1571. }
  1572. };
  1573. mxCellRenderer.registerShape(mxShapeSysMLActivityProbability.prototype.cst.ACT_PROB, mxShapeSysMLActivityProbability);
  1574. //**********************************************************************************************************************************************************
  1575. //Object Flow Right
  1576. //**********************************************************************************************************************************************************
  1577. /**
  1578. * Extends mxShape.
  1579. */
  1580. function mxShapeSysMLObjectFlowRight(bounds, fill, stroke, strokewidth)
  1581. {
  1582. mxShape.call(this);
  1583. this.bounds = bounds;
  1584. this.fill = fill;
  1585. this.stroke = stroke;
  1586. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1587. };
  1588. /**
  1589. * Extends mxShape.
  1590. */
  1591. mxUtils.extend(mxShapeSysMLObjectFlowRight, mxShape);
  1592. mxShapeSysMLObjectFlowRight.prototype.cst = {
  1593. OBJ_FLOW_R : 'mxgraph.sysml.objFlowR'
  1594. };
  1595. /**
  1596. * Function: paintVertexShape
  1597. *
  1598. * Paints the vertex shape.
  1599. */
  1600. mxShapeSysMLObjectFlowRight.prototype.paintVertexShape = function(c, x, y, w, h)
  1601. {
  1602. c.translate(x, y);
  1603. c.roundrect(0, 0, w - 10, h, 10, 10);
  1604. c.fillAndStroke();
  1605. c.rect(w - 10, h * 0.5 - 10, 10, 20);
  1606. c.fillAndStroke();
  1607. };
  1608. mxCellRenderer.registerShape(mxShapeSysMLObjectFlowRight.prototype.cst.OBJ_FLOW_R, mxShapeSysMLObjectFlowRight);
  1609. //**********************************************************************************************************************************************************
  1610. //Object Flow Right
  1611. //**********************************************************************************************************************************************************
  1612. /**
  1613. * Extends mxShape.
  1614. */
  1615. function mxShapeSysMLObjectFlowLeft(bounds, fill, stroke, strokewidth)
  1616. {
  1617. mxShape.call(this);
  1618. this.bounds = bounds;
  1619. this.fill = fill;
  1620. this.stroke = stroke;
  1621. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1622. };
  1623. /**
  1624. * Extends mxShape.
  1625. */
  1626. mxUtils.extend(mxShapeSysMLObjectFlowLeft, mxShape);
  1627. mxShapeSysMLObjectFlowLeft.prototype.cst = {
  1628. OBJ_FLOW_L : 'mxgraph.sysml.objFlowL'
  1629. };
  1630. /**
  1631. * Function: paintVertexShape
  1632. *
  1633. * Paints the vertex shape.
  1634. */
  1635. mxShapeSysMLObjectFlowLeft.prototype.paintVertexShape = function(c, x, y, w, h)
  1636. {
  1637. c.translate(x, y);
  1638. c.rect(0, h * 0.5 - 10, 10, 20);
  1639. c.fillAndStroke();
  1640. c.roundrect(10, 0, w - 10, h, 10, 10);
  1641. c.fillAndStroke();
  1642. };
  1643. mxCellRenderer.registerShape(mxShapeSysMLObjectFlowLeft.prototype.cst.OBJ_FLOW_L, mxShapeSysMLObjectFlowLeft);
  1644. //**********************************************************************************************************************************************************
  1645. //Activity Partition
  1646. //**********************************************************************************************************************************************************
  1647. /**
  1648. * Extends mxShape.
  1649. */
  1650. function mxShapeSysMLActivityPartition(bounds, fill, stroke, strokewidth)
  1651. {
  1652. mxShape.call(this);
  1653. this.bounds = bounds;
  1654. this.fill = fill;
  1655. this.stroke = stroke;
  1656. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1657. };
  1658. /**
  1659. * Extends mxShape.
  1660. */
  1661. mxUtils.extend(mxShapeSysMLActivityPartition, mxShape);
  1662. mxShapeSysMLActivityPartition.prototype.cst = {
  1663. ACT_PART : 'mxgraph.sysml.actPart'
  1664. };
  1665. /**
  1666. * Function: paintVertexShape
  1667. *
  1668. * Paints the vertex shape.
  1669. */
  1670. mxShapeSysMLActivityPartition.prototype.paintVertexShape = function(c, x, y, w, h)
  1671. {
  1672. c.translate(x, y);
  1673. c.begin();
  1674. c.moveTo(0, 0);
  1675. c.lineTo(0, h);
  1676. c.moveTo(w, 0);
  1677. c.lineTo(w, h);
  1678. c.stroke();
  1679. };
  1680. mxCellRenderer.registerShape(mxShapeSysMLActivityPartition.prototype.cst.ACT_PART, mxShapeSysMLActivityPartition);
  1681. //**********************************************************************************************************************************************************
  1682. //Continuation
  1683. //**********************************************************************************************************************************************************
  1684. /**
  1685. * Extends mxShape.
  1686. */
  1687. function mxShapeSysMLContinuation(bounds, fill, stroke, strokewidth)
  1688. {
  1689. mxShape.call(this);
  1690. this.bounds = bounds;
  1691. this.fill = fill;
  1692. this.stroke = stroke;
  1693. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1694. };
  1695. /**
  1696. * Extends mxShape.
  1697. */
  1698. mxUtils.extend(mxShapeSysMLContinuation, mxShape);
  1699. mxShapeSysMLContinuation.prototype.cst = {
  1700. CONT : 'mxgraph.sysml.cont'
  1701. };
  1702. /**
  1703. * Function: paintVertexShape
  1704. *
  1705. * Paints the vertex shape.
  1706. */
  1707. mxShapeSysMLContinuation.prototype.paintVertexShape = function(c, x, y, w, h)
  1708. {
  1709. c.translate(x, y);
  1710. if (w > h)
  1711. {
  1712. var r = h * 0.5;
  1713. c.begin();
  1714. c.moveTo(w - r, 0);
  1715. c.arcTo(r, r, 0, 0, 1, w - r, h);
  1716. c.lineTo(r, h);
  1717. c.arcTo(r, r, 0, 0, 1, r, 0);
  1718. c.close();
  1719. c.fillAndStroke();
  1720. }
  1721. else
  1722. {
  1723. var r = w * 0.5;
  1724. c.begin();
  1725. c.moveTo(0, h - r);
  1726. c.arcTo(r, r, 0, 0, 0, w, h - r);
  1727. c.lineTo(w, r);
  1728. c.arcTo(r, r, 0, 0, 0, 0, r);
  1729. c.close();
  1730. c.fillAndStroke();
  1731. }
  1732. };
  1733. mxCellRenderer.registerShape(mxShapeSysMLContinuation.prototype.cst.CONT, mxShapeSysMLContinuation);
  1734. //**********************************************************************************************************************************************************
  1735. //Coregion
  1736. //**********************************************************************************************************************************************************
  1737. /**
  1738. * Extends mxShape.
  1739. */
  1740. function mxShapeSysMLCoregion(bounds, fill, stroke, strokewidth)
  1741. {
  1742. mxShape.call(this);
  1743. this.bounds = bounds;
  1744. this.fill = fill;
  1745. this.stroke = stroke;
  1746. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1747. };
  1748. /**
  1749. * Extends mxShape.
  1750. */
  1751. mxUtils.extend(mxShapeSysMLCoregion, mxShape);
  1752. mxShapeSysMLCoregion.prototype.cst = {
  1753. COREGION : 'mxgraph.sysml.coregion'
  1754. };
  1755. /**
  1756. * Function: paintVertexShape
  1757. *
  1758. * Paints the vertex shape.
  1759. */
  1760. mxShapeSysMLCoregion.prototype.paintVertexShape = function(c, x, y, w, h)
  1761. {
  1762. c.translate(x, y);
  1763. var brack = 10;
  1764. brack = Math.min(brack, h);
  1765. c.begin();
  1766. c.moveTo(0, brack);
  1767. c.lineTo(0, 0);
  1768. c.lineTo(w, 0);
  1769. c.lineTo(w, brack);
  1770. c.moveTo(0, h - brack);
  1771. c.lineTo(0, h);
  1772. c.lineTo(w, h);
  1773. c.lineTo(w, h - brack);
  1774. c.stroke();
  1775. };
  1776. mxCellRenderer.registerShape(mxShapeSysMLCoregion.prototype.cst.COREGION, mxShapeSysMLCoregion);
  1777. //**********************************************************************************************************************************************************
  1778. //X marker
  1779. //**********************************************************************************************************************************************************
  1780. mxMarker.addMarker('sysMLx', function(c, shape, type, pe, unitX, unitY, size, source, sw, filled)
  1781. {
  1782. var nx = unitX * (size + sw + 1);
  1783. var ny = unitY * (size + sw + 1);
  1784. return function()
  1785. {
  1786. c.begin();
  1787. c.moveTo(pe.x - nx / 2 - ny / 2, pe.y - ny / 2 + nx / 2);
  1788. c.lineTo(pe.x + nx / 2 + ny / 2, pe.y + ny / 2 - nx / 2);
  1789. c.moveTo(pe.x + nx / 2 - ny / 2, pe.y + ny / 2 + nx / 2);
  1790. c.lineTo(pe.x - nx / 2 + ny / 2, pe.y - ny / 2 - nx / 2);
  1791. c.stroke();
  1792. };
  1793. });
  1794. //**********************************************************************************************************************************************************
  1795. //Dimension
  1796. //**********************************************************************************************************************************************************
  1797. /**
  1798. * Extends mxShape.
  1799. */
  1800. function mxShapeSysMLDimension(bounds, fill, stroke, strokewidth)
  1801. {
  1802. mxShape.call(this);
  1803. this.bounds = bounds;
  1804. this.fill = fill;
  1805. this.stroke = stroke;
  1806. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1807. };
  1808. /**
  1809. * Extends mxShape.
  1810. */
  1811. mxUtils.extend(mxShapeSysMLDimension, mxShape);
  1812. mxShapeSysMLDimension.prototype.cst = {
  1813. DIMENSION : 'mxgraph.sysml.dimension'
  1814. };
  1815. /**
  1816. * Function: paintVertexShape
  1817. *
  1818. * Paints the vertex shape.
  1819. */
  1820. mxShapeSysMLDimension.prototype.paintVertexShape = function(c, x, y, w, h)
  1821. {
  1822. c.translate(x, y);
  1823. this.background(c, x, y, w, h);
  1824. };
  1825. mxShapeSysMLDimension.prototype.background = function(c, x, y, w, h)
  1826. {
  1827. c.begin();
  1828. c.moveTo(0, 20);
  1829. c.lineTo(w, 20);
  1830. c.moveTo(10, 15);
  1831. c.lineTo(0, 20);
  1832. c.lineTo(10, 25);
  1833. c.moveTo(w - 10, 15);
  1834. c.lineTo(w, 20);
  1835. c.lineTo(w - 10, 25);
  1836. c.moveTo(0, 15);
  1837. c.lineTo(0, h);
  1838. c.moveTo(w, 15);
  1839. c.lineTo(w, h);
  1840. c.stroke();
  1841. };
  1842. mxCellRenderer.registerShape(mxShapeSysMLDimension.prototype.cst.DIMENSION, mxShapeSysMLDimension);
  1843. //**********************************************************************************************************************************************************
  1844. //Lost marker
  1845. //**********************************************************************************************************************************************************
  1846. mxMarker.addMarker('sysMLLost', function(c, shape, type, pe, unitX, unitY, size, source, sw, filled)
  1847. {
  1848. var nx = unitX * (size + sw + 1);
  1849. var ny = unitY * (size + sw + 1);
  1850. var a = size / 2;
  1851. return function()
  1852. {
  1853. c.begin();
  1854. c.moveTo(pe.x - 1.5 * nx - ny / 2, pe.y - 1.5 * ny + nx / 2);
  1855. c.lineTo(pe.x - nx / 2, pe.y - ny / 2);
  1856. c.lineTo(pe.x - 1.5 * nx + ny / 2, pe.y - 1.5 * ny - nx / 2);
  1857. c.stroke();
  1858. c.ellipse(pe.x - 0.5 * nx - a, pe.y - 0.5 * ny - a, 2 * a, 2 * a);
  1859. var strokeColor = mxUtils.getValue(shape.style, mxConstants.STYLE_STROKECOLOR, '#000000');
  1860. c.setFillColor(strokeColor);
  1861. c.fillAndStroke();
  1862. };
  1863. });
  1864. //**********************************************************************************************************************************************************
  1865. //Found marker
  1866. //**********************************************************************************************************************************************************
  1867. mxMarker.addMarker('sysMLFound', function(c, shape, type, pe, unitX, unitY, size, source, sw, filled)
  1868. {
  1869. var nx = unitX * (size + sw + 1);
  1870. var ny = unitY * (size + sw + 1);
  1871. var a = size / 2;
  1872. return function()
  1873. {
  1874. c.ellipse(pe.x - 0.5 * nx - a, pe.y - 0.5 * ny - a, 2 * a, 2 * a);
  1875. var strokeColor = mxUtils.getValue(shape.style, mxConstants.STYLE_STROKECOLOR, '#000000');
  1876. c.setFillColor(strokeColor);
  1877. c.fillAndStroke();
  1878. };
  1879. });
  1880. //**********************************************************************************************************************************************************
  1881. //Composite State
  1882. //**********************************************************************************************************************************************************
  1883. /**
  1884. * Extends mxShape.
  1885. */
  1886. function mxShapeSysMLCompositeState(bounds, fill, stroke, strokewidth)
  1887. {
  1888. mxShape.call(this);
  1889. this.bounds = bounds;
  1890. this.fill = fill;
  1891. this.stroke = stroke;
  1892. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1893. };
  1894. /**
  1895. * Extends mxShape.
  1896. */
  1897. mxUtils.extend(mxShapeSysMLCompositeState, mxShape);
  1898. mxShapeSysMLCompositeState.prototype.cst = {
  1899. COMP_STATE : 'mxgraph.sysml.compState'
  1900. };
  1901. /**
  1902. * Function: paintVertexShape
  1903. *
  1904. * Paints the vertex shape.
  1905. */
  1906. mxShapeSysMLCompositeState.prototype.paintVertexShape = function(c, x, y, w, h)
  1907. {
  1908. c.translate(x, y);
  1909. this.background(c, x, y, w, h);
  1910. };
  1911. mxShapeSysMLCompositeState.prototype.background = function(c, x, y, w, h)
  1912. {
  1913. var tabH = 20;
  1914. var tabW = 110;
  1915. c.roundrect(0, tabH, w, h - tabH, 10, 10);
  1916. c.fillAndStroke();
  1917. c.rect(15, 0, tabW, tabH);
  1918. c.fillAndStroke();
  1919. };
  1920. mxCellRenderer.registerShape(mxShapeSysMLCompositeState.prototype.cst.COMP_STATE, mxShapeSysMLCompositeState);
  1921. //**********************************************************************************************************************************************************
  1922. //Region
  1923. //**********************************************************************************************************************************************************
  1924. /**
  1925. * Extends mxShape.
  1926. */
  1927. function mxShapeSysMLRegion(bounds, fill, stroke, strokewidth)
  1928. {
  1929. mxShape.call(this);
  1930. this.bounds = bounds;
  1931. this.fill = fill;
  1932. this.stroke = stroke;
  1933. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1934. };
  1935. /**
  1936. * Extends mxShape.
  1937. */
  1938. mxUtils.extend(mxShapeSysMLRegion, mxShape);
  1939. mxShapeSysMLRegion.prototype.cst = {
  1940. REGION : 'mxgraph.sysml.region'
  1941. };
  1942. /**
  1943. * Function: paintVertexShape
  1944. *
  1945. * Paints the vertex shape.
  1946. */
  1947. mxShapeSysMLRegion.prototype.paintVertexShape = function(c, x, y, w, h)
  1948. {
  1949. var tabH = 20;
  1950. var tabW = 50;
  1951. c.translate(x, y);
  1952. this.background(c, x, y, w, h, tabH, tabW);
  1953. c.setShadow(false);
  1954. this.foreground(c, x, y, w, h, tabH, tabW);
  1955. };
  1956. mxShapeSysMLRegion.prototype.background = function(c, x, y, w, h, tabH, tabW)
  1957. {
  1958. var strokeW = parseInt(mxUtils.getValue(this.style, mxConstants.STYLE_STROKEWIDTH, '1'));
  1959. c.roundrect(0, tabH, w, h - tabH, 10, 10);
  1960. c.fillAndStroke();
  1961. c.setStrokeWidth(strokeW * 2);
  1962. c.rect(15, 0, tabW, tabH);
  1963. c.fillAndStroke();
  1964. c.setStrokeWidth(strokeW);
  1965. };
  1966. mxShapeSysMLRegion.prototype.foreground = function(c, x, y, w, h, tabH, tabW)
  1967. {
  1968. c.setDashed(true);
  1969. c.begin();
  1970. c.moveTo(w * 0.5, tabH);
  1971. c.lineTo(w * 0.5, h);
  1972. c.stroke();
  1973. };
  1974. mxCellRenderer.registerShape(mxShapeSysMLRegion.prototype.cst.REGION, mxShapeSysMLRegion);
  1975. //**********************************************************************************************************************************************************
  1976. //Simple State
  1977. //**********************************************************************************************************************************************************
  1978. /**
  1979. * Extends mxShape.
  1980. */
  1981. function mxShapeSysMLSimpleState(bounds, fill, stroke, strokewidth)
  1982. {
  1983. mxShape.call(this);
  1984. this.bounds = bounds;
  1985. this.fill = fill;
  1986. this.stroke = stroke;
  1987. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1988. };
  1989. /**
  1990. * Extends mxShape.
  1991. */
  1992. mxUtils.extend(mxShapeSysMLSimpleState, mxShape);
  1993. mxShapeSysMLSimpleState.prototype.cst = {
  1994. SIMPLE_STATE : 'mxgraph.sysml.simpleState'
  1995. };
  1996. /**
  1997. * Function: paintVertexShape
  1998. *
  1999. * Paints the vertex shape.
  2000. */
  2001. mxShapeSysMLSimpleState.prototype.paintVertexShape = function(c, x, y, w, h)
  2002. {
  2003. c.translate(x, y);
  2004. this.background(c, x, y, w, h);
  2005. c.setShadow(false);
  2006. // this.foreground(c, x, y, w, h);
  2007. };
  2008. mxShapeSysMLSimpleState.prototype.background = function(c, x, y, w, h)
  2009. {
  2010. var strokeW = parseInt(mxUtils.getValue(this.style, mxConstants.STYLE_STROKEWIDTH, '1'));
  2011. c.roundrect(0, 0, w, h, 10, 10);
  2012. c.fillAndStroke();
  2013. };
  2014. mxShapeSysMLSimpleState.prototype.foreground = function(c, x, y, w, h)
  2015. {
  2016. c.begin();
  2017. c.moveTo(0, 20);
  2018. c.lineTo(w, 20);
  2019. c.stroke();
  2020. };
  2021. mxCellRenderer.registerShape(mxShapeSysMLSimpleState.prototype.cst.SIMPLE_STATE, mxShapeSysMLSimpleState);
  2022. //**********************************************************************************************************************************************************
  2023. //State Machine
  2024. //**********************************************************************************************************************************************************
  2025. /**
  2026. * Extends mxShape.
  2027. */
  2028. function mxShapeSysMLStateMachine(bounds, fill, stroke, strokewidth)
  2029. {
  2030. mxShape.call(this);
  2031. this.bounds = bounds;
  2032. this.fill = fill;
  2033. this.stroke = stroke;
  2034. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  2035. };
  2036. /**
  2037. * Extends mxShape.
  2038. */
  2039. mxUtils.extend(mxShapeSysMLStateMachine, mxShape);
  2040. mxShapeSysMLStateMachine.prototype.cst = {
  2041. STATE_MACHINE : 'mxgraph.sysml.stateMachine'
  2042. };
  2043. /**
  2044. * Function: paintVertexShape
  2045. *
  2046. * Paints the vertex shape.
  2047. */
  2048. mxShapeSysMLStateMachine.prototype.paintVertexShape = function(c, x, y, w, h)
  2049. {
  2050. c.translate(x, y);
  2051. this.background(c, x, y, w, h);
  2052. c.setShadow(false);
  2053. this.foreground(c, x, y, w, h);
  2054. };
  2055. mxShapeSysMLStateMachine.prototype.background = function(c, x, y, w, h)
  2056. {
  2057. c.roundrect(0, 0, w - 10, h, 10, 10);
  2058. c.fillAndStroke();
  2059. };
  2060. mxShapeSysMLStateMachine.prototype.foreground = function(c, x, y, w, h)
  2061. {
  2062. var strokeC = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#000000');
  2063. c.setFillColor(strokeC);
  2064. c.ellipse(w - 20, h * 0.5 - 10, 20, 20);
  2065. c.stroke();
  2066. c.ellipse(w - 17, h * 0.5 - 7, 14, 14);
  2067. c.fillAndStroke();
  2068. };
  2069. mxCellRenderer.registerShape(mxShapeSysMLStateMachine.prototype.cst.STATE_MACHINE, mxShapeSysMLStateMachine);
  2070. //**********************************************************************************************************************************************************
  2071. // X
  2072. //**********************************************************************************************************************************************************
  2073. /**
  2074. * Extends mxShape.
  2075. */
  2076. function mxShapeSysMLX(bounds, fill, stroke, strokewidth)
  2077. {
  2078. mxShape.call(this);
  2079. this.bounds = bounds;
  2080. this.fill = fill;
  2081. this.stroke = stroke;
  2082. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  2083. };
  2084. /**
  2085. * Extends mxShape.
  2086. */
  2087. mxUtils.extend(mxShapeSysMLX, mxShape);
  2088. mxShapeSysMLX.prototype.cst = {
  2089. X : 'mxgraph.sysml.x'
  2090. };
  2091. /**
  2092. * Function: paintVertexShape
  2093. *
  2094. * Paints the vertex shape.
  2095. */
  2096. mxShapeSysMLX.prototype.paintVertexShape = function(c, x, y, w, h)
  2097. {
  2098. c.translate(x, y);
  2099. c.begin();
  2100. c.moveTo(0, 0);
  2101. c.lineTo(w, h);
  2102. c.moveTo(0, h);
  2103. c.lineTo(w, 0);
  2104. c.fillAndStroke();
  2105. };
  2106. mxCellRenderer.registerShape(mxShapeSysMLX.prototype.cst.X, mxShapeSysMLX);
  2107. //**********************************************************************************************************************************************************
  2108. //Submachine State
  2109. //**********************************************************************************************************************************************************
  2110. /**
  2111. * Extends mxShape.
  2112. */
  2113. function mxShapeSysMLSubmachineState(bounds, fill, stroke, strokewidth)
  2114. {
  2115. mxShape.call(this);
  2116. this.bounds = bounds;
  2117. this.fill = fill;
  2118. this.stroke = stroke;
  2119. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  2120. };
  2121. /**
  2122. * Extends mxShape.
  2123. */
  2124. mxUtils.extend(mxShapeSysMLSubmachineState, mxShape);
  2125. mxShapeSysMLSubmachineState.prototype.cst = {
  2126. SUBMACHINE_STATE : 'mxgraph.sysml.submState'
  2127. };
  2128. /**
  2129. * Function: paintVertexShape
  2130. *
  2131. * Paints the vertex shape.
  2132. */
  2133. mxShapeSysMLSubmachineState.prototype.paintVertexShape = function(c, x, y, w, h)
  2134. {
  2135. c.translate(x, y);
  2136. this.background(c, x, y, w, h);
  2137. c.setShadow(false);
  2138. this.foreground(c, x, y, w, h);
  2139. };
  2140. mxShapeSysMLSubmachineState.prototype.background = function(c, x, y, w, h)
  2141. {
  2142. c.roundrect(0, 0, w - 10, h, 10, 10);
  2143. c.fillAndStroke();
  2144. };
  2145. mxShapeSysMLSubmachineState.prototype.foreground = function(c, x, y, w, h)
  2146. {
  2147. var strokeC = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#000000');
  2148. c.setFillColor(strokeC);
  2149. c.ellipse(w - 20, h * 0.5 - 10, 20, 20);
  2150. c.stroke();
  2151. c.ellipse(w - 17, h * 0.5 - 7, 14, 14);
  2152. c.fillAndStroke();
  2153. };
  2154. mxCellRenderer.registerShape(mxShapeSysMLSubmachineState.prototype.cst.SUBMACHINE_STATE, mxShapeSysMLSubmachineState);
  2155. //**********************************************************************************************************************************************************
  2156. //Use Case with Extension Points
  2157. //**********************************************************************************************************************************************************
  2158. /**
  2159. * Extends mxShape.
  2160. */
  2161. function mxShapeSysMLUseCaseExtensionPoints(bounds, fill, stroke, strokewidth)
  2162. {
  2163. mxShape.call(this);
  2164. this.bounds = bounds;
  2165. this.fill = fill;
  2166. this.stroke = stroke;
  2167. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  2168. };
  2169. /**
  2170. * Extends mxShape.
  2171. */
  2172. mxUtils.extend(mxShapeSysMLUseCaseExtensionPoints, mxShape);
  2173. mxShapeSysMLUseCaseExtensionPoints.prototype.cst = {
  2174. USE_CASE_EXT_PT : 'mxgraph.sysml.useCaseExtPt'
  2175. };
  2176. /**
  2177. * Function: paintVertexShape
  2178. *
  2179. * Paints the vertex shape.
  2180. */
  2181. mxShapeSysMLUseCaseExtensionPoints.prototype.paintVertexShape = function(c, x, y, w, h)
  2182. {
  2183. c.translate(x, y);
  2184. this.background(c, x, y, w, h);
  2185. c.setShadow(false);
  2186. this.foreground(c, x, y, w, h);
  2187. };
  2188. mxShapeSysMLUseCaseExtensionPoints.prototype.background = function(c, x, y, w, h)
  2189. {
  2190. c.ellipse(0, 0, w, h);
  2191. c.fillAndStroke();
  2192. };
  2193. mxShapeSysMLUseCaseExtensionPoints.prototype.foreground = function(c, x, y, w, h)
  2194. {
  2195. c.begin();
  2196. c.moveTo(w * 0.02, h * 0.35);
  2197. c.lineTo(w * 0.98, h * 0.35);
  2198. c.stroke();
  2199. };
  2200. mxCellRenderer.registerShape(mxShapeSysMLUseCaseExtensionPoints.prototype.cst.USE_CASE_EXT_PT, mxShapeSysMLUseCaseExtensionPoints);