mxSysML.js 67 KB

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