mxSysML.js 98 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268
  1. /**
  2. * Copyright (c) 2006-2014, JGraph Holdings Ltd
  3. */
  4. //**********************************************************************************************************************************************************
  5. //Composite
  6. //**********************************************************************************************************************************************************
  7. function mxShapeSysMLComposite()
  8. {
  9. mxCylinder.call(this);
  10. };
  11. mxUtils.extend(mxShapeSysMLComposite, mxShape);
  12. mxShapeSysMLComposite.prototype.isHtmlAllowed = function()
  13. {
  14. return false;
  15. };
  16. mxShapeSysMLComposite.prototype.paintForeground = function(c, x, y, w, h)
  17. {
  18. if (this.style != null)
  19. {
  20. var shape = mxCellRenderer.defaultShapes[this.style['symbol0']];
  21. c.save();
  22. var tmp = new shape();
  23. tmp.style = this.style;
  24. shape.prototype.paintVertexShape.call(tmp, c, x, y, w, h);
  25. c.restore();
  26. c.setDashed(false);
  27. // Draws the symbols defined in the style. The symbols are
  28. // numbered from 1...n. Possible postfixes are align,
  29. // verticalAlign, spacing, arcSpacing, width, height
  30. var counter = 1;
  31. do
  32. {
  33. shape = mxCellRenderer.defaultShapes[this.style['symbol' + counter]];
  34. if (shape != null)
  35. {
  36. var align = this.style['symbol' + counter + 'Align'];
  37. var valign = this.style['symbol' + counter + 'VerticalAlign'];
  38. var width = this.style['symbol' + counter + 'Width'];
  39. var height = this.style['symbol' + counter + 'Height'];
  40. var spacing = this.style['symbol' + counter + 'Spacing'] || 0;
  41. var vspacing = this.style['symbol' + counter + 'VSpacing'] || 0;
  42. var arcspacing = this.style['symbol' + counter + 'ArcSpacing'];
  43. var direction = this.style['symbol' + counter + 'Direction'];
  44. if (arcspacing != null)
  45. {
  46. spacing += this.getArcSize(w + this.strokewidth, h + this.strokewidth) * arcspacing;
  47. vspacing += this.getArcSize(w + this.strokewidth, h + this.strokewidth) * arcspacing;
  48. }
  49. var x2 = x;
  50. var y2 = y;
  51. if (align == mxConstants.ALIGN_CENTER)
  52. {
  53. x2 += (w - width) / 2;
  54. }
  55. else if (align == mxConstants.ALIGN_RIGHT)
  56. {
  57. x2 += w - width - spacing;
  58. }
  59. else
  60. {
  61. x2 += spacing;
  62. }
  63. if (valign == mxConstants.ALIGN_MIDDLE)
  64. {
  65. y2 += (h - height) / 2;
  66. }
  67. else if (valign == mxConstants.ALIGN_BOTTOM)
  68. {
  69. y2 += h - height - vspacing;
  70. }
  71. else
  72. {
  73. y2 += vspacing;
  74. }
  75. c.save();
  76. var tmp = new shape();
  77. tmp.style = mxUtils.clone(this.style);
  78. tmp.direction = direction;
  79. tmp.updateTransform(c, x2, y2, width, height);
  80. shape.prototype.paintVertexShape.call(tmp, c, x2, y2, width, height);
  81. c.restore();
  82. }
  83. counter++;
  84. }
  85. while (shape != null);
  86. }
  87. };
  88. mxCellRenderer.registerShape('mxgraph.sysml.composite', mxShapeSysMLComposite);
  89. //**********************************************************************************************************************************************************
  90. //Package
  91. //**********************************************************************************************************************************************************
  92. /**
  93. * Extends mxShape.
  94. */
  95. function mxShapeSysMLPackage(bounds, fill, stroke, strokewidth)
  96. {
  97. mxShape.call(this);
  98. this.bounds = bounds;
  99. this.fill = fill;
  100. this.stroke = stroke;
  101. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  102. };
  103. /**
  104. * Extends mxShape.
  105. */
  106. mxUtils.extend(mxShapeSysMLPackage, mxShape);
  107. mxShapeSysMLPackage.prototype.cst = {
  108. PACKAGE : 'mxgraph.sysml.package',
  109. LABEL_X : 'labelX'
  110. };
  111. mxShapeSysMLPackage.prototype.customProperties = [
  112. {name: 'labelX', dispName: 'Header Width', type: 'float', min:0, defVal:90}
  113. ];
  114. mxShapeSysMLPackage.prototype.getConstraints = function(style, w, h)
  115. {
  116. var constr = [];
  117. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false));
  118. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));
  119. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
  120. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));
  121. constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));
  122. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false));
  123. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  124. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false));
  125. constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false));
  126. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));
  127. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
  128. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));
  129. constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));
  130. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.75), false));
  131. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  132. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.25), false));
  133. return (constr);
  134. };
  135. /**
  136. * Function: paintVertexShape
  137. *
  138. * Paints the vertex shape.
  139. */
  140. mxShapeSysMLPackage.prototype.paintVertexShape = function(c, x, y, w, h)
  141. {
  142. c.translate(x, y);
  143. this.background(c, x, y, w, h);
  144. c.setShadow(false);
  145. this.foreground(c, x, y, w, h);
  146. };
  147. mxShapeSysMLPackage.prototype.background = function(c, x, y, w, h)
  148. {
  149. c.rect(0, 0, w, h);
  150. c.fillAndStroke();
  151. };
  152. mxShapeSysMLPackage.prototype.foreground = function(c, x, y, w, h)
  153. {
  154. var xSize = parseInt(mxUtils.getValue(this.style, mxShapeSysMLPackage.prototype.cst.LABEL_X, '90'));
  155. var ySize = 20;
  156. xSize = Math.min(xSize, w);
  157. if (xSize > ySize)
  158. {
  159. c.begin();
  160. c.moveTo(0, ySize);
  161. c.lineTo(xSize - ySize * 0.5, ySize);
  162. c.lineTo(xSize, ySize * 0.5);
  163. c.lineTo(xSize, 0);
  164. c.stroke();
  165. }
  166. };
  167. mxCellRenderer.registerShape(mxShapeSysMLPackage.prototype.cst.PACKAGE, mxShapeSysMLPackage);
  168. Graph.handleFactory[mxShapeSysMLPackage.prototype.cst.PACKAGE] = function(state)
  169. {
  170. var handles = [Graph.createHandle(state, ['labelX'], function(bounds)
  171. {
  172. var labelX = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'labelX', 90))));
  173. return new mxPoint(bounds.x + labelX, bounds.y + 10);
  174. }, function(bounds, pt)
  175. {
  176. this.state.style['labelX'] = Math.round(100 * Math.max(0, Math.min(bounds.width, pt.x - bounds.x))) / 100;
  177. })];
  178. return handles;
  179. }
  180. //**********************************************************************************************************************************************************
  181. //Package2
  182. //**********************************************************************************************************************************************************
  183. /**
  184. * Extends mxShape.
  185. */
  186. function mxShapeSysMLPackage2(bounds, fill, stroke, strokewidth)
  187. {
  188. mxShape.call(this);
  189. this.bounds = bounds;
  190. this.fill = fill;
  191. this.stroke = stroke;
  192. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  193. };
  194. /**
  195. * Extends mxShape.
  196. */
  197. mxUtils.extend(mxShapeSysMLPackage2, mxShape);
  198. mxShapeSysMLPackage2.prototype.cst = {
  199. PACKAGE2 : 'mxgraph.sysml.package2',
  200. LABEL_X : 'labelX'
  201. };
  202. mxShapeSysMLPackage2.prototype.customProperties = [
  203. {name: 'labelX', dispName: 'Header Width', type: 'float', min:0, defVal:90}
  204. ];
  205. /**
  206. * Function: paintVertexShape
  207. *
  208. * Paints the vertex shape.
  209. */
  210. mxShapeSysMLPackage2.prototype.paintVertexShape = function(c, x, y, w, h)
  211. {
  212. c.translate(x, y);
  213. this.background(c, x, y, w, h);
  214. c.setShadow(false);
  215. this.foreground(c, x, y, w, h);
  216. };
  217. mxShapeSysMLPackage2.prototype.background = function(c, x, y, w, h)
  218. {
  219. c.rect(0, 0, w, h);
  220. c.stroke();
  221. };
  222. mxShapeSysMLPackage2.prototype.foreground = function(c, x, y, w, h)
  223. {
  224. var xSize = parseInt(mxUtils.getValue(this.style, mxShapeSysMLPackage2.prototype.cst.LABEL_X, '90'));
  225. var ySize = 20;
  226. xSize = Math.min(xSize, w);
  227. if (xSize > ySize)
  228. {
  229. c.begin();
  230. c.moveTo(0, ySize);
  231. c.lineTo(xSize - ySize * 0.5, ySize);
  232. c.lineTo(xSize, ySize * 0.5);
  233. c.lineTo(xSize, 0);
  234. c.lineTo(0, 0);
  235. c.close();
  236. c.fillAndStroke();
  237. }
  238. };
  239. mxCellRenderer.registerShape(mxShapeSysMLPackage2.prototype.cst.PACKAGE2, mxShapeSysMLPackage2);
  240. Graph.handleFactory[mxShapeSysMLPackage2.prototype.cst.PACKAGE2] = function(state)
  241. {
  242. var handles = [Graph.createHandle(state, ['labelX'], function(bounds)
  243. {
  244. var labelX = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'labelX', 90))));
  245. return new mxPoint(bounds.x + labelX, bounds.y + 10);
  246. }, function(bounds, pt)
  247. {
  248. this.state.style['labelX'] = Math.round(100 * Math.max(0, Math.min(bounds.width, pt.x - bounds.x))) / 100;
  249. })];
  250. return handles;
  251. }
  252. //**********************************************************************************************************************************************************
  253. //None
  254. //**********************************************************************************************************************************************************
  255. /**
  256. * Extends mxShape.
  257. */
  258. function mxShapeSysMLNone(bounds, fill, stroke, strokewidth)
  259. {
  260. mxShape.call(this);
  261. this.bounds = bounds;
  262. this.fill = fill;
  263. this.stroke = stroke;
  264. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  265. };
  266. /**
  267. * Extends mxShape.
  268. */
  269. mxUtils.extend(mxShapeSysMLNone, mxShape);
  270. mxShapeSysMLNone.prototype.cst = {
  271. NONE : 'mxgraph.sysml.none'
  272. };
  273. /**
  274. * Function: paintVertexShape
  275. *
  276. * Paints the vertex shape.
  277. */
  278. mxShapeSysMLNone.prototype.paintVertexShape = function(c, x, y, w, h)
  279. {
  280. };
  281. mxCellRenderer.registerShape(mxShapeSysMLNone.prototype.cst.NONE, mxShapeSysMLNone);
  282. //**********************************************************************************************************************************************************
  283. //Rectangle
  284. //**********************************************************************************************************************************************************
  285. /**
  286. * Extends mxShape.
  287. */
  288. function mxShapeSysMLRect(bounds, fill, stroke, strokewidth)
  289. {
  290. mxShape.call(this);
  291. this.bounds = bounds;
  292. this.fill = fill;
  293. this.stroke = stroke;
  294. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  295. };
  296. /**
  297. * Extends mxShape.
  298. */
  299. mxUtils.extend(mxShapeSysMLRect, mxShape);
  300. mxShapeSysMLRect.prototype.cst = {
  301. RECT : 'mxgraph.sysml.rect'
  302. };
  303. /**
  304. * Function: paintVertexShape
  305. *
  306. * Paints the vertex shape.
  307. */
  308. mxShapeSysMLRect.prototype.paintVertexShape = function(c, x, y, w, h)
  309. {
  310. c.rect(x, y, w, h);
  311. c.fillAndStroke();
  312. };
  313. mxCellRenderer.registerShape(mxShapeSysMLRect.prototype.cst.RECT, mxShapeSysMLRect);
  314. //**********************************************************************************************************************************************************
  315. //Port
  316. //**********************************************************************************************************************************************************
  317. /**
  318. * Extends mxShape.
  319. */
  320. function mxShapeSysMLPortOne(bounds, fill, stroke, strokewidth)
  321. {
  322. mxShape.call(this);
  323. this.bounds = bounds;
  324. this.fill = fill;
  325. this.stroke = stroke;
  326. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  327. };
  328. /**
  329. * Extends mxShape.
  330. */
  331. mxUtils.extend(mxShapeSysMLPortOne, mxShape);
  332. mxShapeSysMLPortOne.prototype.cst = {
  333. PORT1 : 'mxgraph.sysml.port1'
  334. };
  335. /**
  336. * Function: paintVertexShape
  337. *
  338. * Paints the vertex shape.
  339. */
  340. mxShapeSysMLPortOne.prototype.paintVertexShape = function(c, x, y, w, h)
  341. {
  342. c.rect(x + w * 0.05, y, w - w * 0.1, h);
  343. c.fillAndStroke();
  344. };
  345. mxCellRenderer.registerShape(mxShapeSysMLPortOne.prototype.cst.PORT1, mxShapeSysMLPortOne);
  346. mxShapeSysMLPortOne.prototype.getConstraints = function(style, w, h)
  347. {
  348. var constr = [];
  349. constr.push(new mxConnectionConstraint(new mxPoint(0.05, 0), false));
  350. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));
  351. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
  352. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));
  353. constr.push(new mxConnectionConstraint(new mxPoint(0.95, 0), false));
  354. constr.push(new mxConnectionConstraint(new mxPoint(0.95, 0.25), false));
  355. constr.push(new mxConnectionConstraint(new mxPoint(0.95, 0.75), false));
  356. constr.push(new mxConnectionConstraint(new mxPoint(0.95, 1), false));
  357. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));
  358. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
  359. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));
  360. constr.push(new mxConnectionConstraint(new mxPoint(0.05, 1), false));
  361. constr.push(new mxConnectionConstraint(new mxPoint(0.05, 0.75), false));
  362. constr.push(new mxConnectionConstraint(new mxPoint(0.05, 0.25), false));
  363. return (constr);
  364. };
  365. //**********************************************************************************************************************************************************
  366. //Port2
  367. //**********************************************************************************************************************************************************
  368. /**
  369. * Extends mxShape.
  370. */
  371. function mxShapeSysMLPortTwo(bounds, fill, stroke, strokewidth)
  372. {
  373. mxShape.call(this);
  374. this.bounds = bounds;
  375. this.fill = fill;
  376. this.stroke = stroke;
  377. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  378. };
  379. /**
  380. * Extends mxShape.
  381. */
  382. mxUtils.extend(mxShapeSysMLPortTwo, mxShape);
  383. mxShapeSysMLPortTwo.prototype.cst = {
  384. PORT2 : 'mxgraph.sysml.port2'
  385. };
  386. /**
  387. * Function: paintVertexShape
  388. *
  389. * Paints the vertex shape.
  390. */
  391. mxShapeSysMLPortTwo.prototype.paintVertexShape = function(c, x, y, w, h)
  392. {
  393. c.rect(x + w * 0.05, y, w * 0.8, h);
  394. c.fillAndStroke();
  395. };
  396. mxCellRenderer.registerShape(mxShapeSysMLPortTwo.prototype.cst.PORT2, mxShapeSysMLPortTwo);
  397. mxShapeSysMLPortTwo.prototype.getConstraints = function(style, w, h)
  398. {
  399. var constr = [];
  400. constr.push(new mxConnectionConstraint(new mxPoint(0.05, 0), false));
  401. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));
  402. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
  403. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));
  404. constr.push(new mxConnectionConstraint(new mxPoint(0.95, 0), false));
  405. constr.push(new mxConnectionConstraint(new mxPoint(0.95, 0.25), false));
  406. constr.push(new mxConnectionConstraint(new mxPoint(0.95, 0.75), false));
  407. constr.push(new mxConnectionConstraint(new mxPoint(0.95, 1), false));
  408. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));
  409. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
  410. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));
  411. constr.push(new mxConnectionConstraint(new mxPoint(0.05, 1), false));
  412. constr.push(new mxConnectionConstraint(new mxPoint(0.05, 0.75), false));
  413. constr.push(new mxConnectionConstraint(new mxPoint(0.05, 0.25), false));
  414. return (constr);
  415. };
  416. //**********************************************************************************************************************************************************
  417. //Port3
  418. //**********************************************************************************************************************************************************
  419. /**
  420. * Extends mxShape.
  421. */
  422. function mxShapeSysMLPortThree(bounds, fill, stroke, strokewidth)
  423. {
  424. mxShape.call(this);
  425. this.bounds = bounds;
  426. this.fill = fill;
  427. this.stroke = stroke;
  428. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  429. };
  430. /**
  431. * Extends mxShape.
  432. */
  433. mxUtils.extend(mxShapeSysMLPortThree, mxShape);
  434. mxShapeSysMLPortThree.prototype.cst = {
  435. PORT3 : 'mxgraph.sysml.port3'
  436. };
  437. /**
  438. * Function: paintVertexShape
  439. *
  440. * Paints the vertex shape.
  441. */
  442. mxShapeSysMLPortThree.prototype.paintVertexShape = function(c, x, y, w, h)
  443. {
  444. c.rect(x + w * 0.07, y, w * 0.86, h);
  445. c.fillAndStroke();
  446. c.rect(x, y + h * 0.125, w * 0.14, h * 0.25);
  447. c.fillAndStroke();
  448. c.rect(x, y + h * 0.625, w * 0.14, h * 0.25);
  449. c.fillAndStroke();
  450. c.rect(x + w * 0.86, y + h * 0.375, w * 0.14, h * 0.25);
  451. c.fillAndStroke();
  452. this.drawIn(c, x + w * 0.01, y + h * 0.2, w * 0.11, h * 0.10);
  453. this.drawOut(c, x + w * 0.02, y + h * 0.7, w * 0.11, h * 0.10);
  454. this.drawInOut(c, x + w * 0.88, y + h * 0.45, w * 0.1, h * 0.10);
  455. };
  456. mxShapeSysMLPortThree.prototype.drawIn = function(c, x, y, w, h)
  457. {
  458. c.begin();
  459. c.moveTo(x, y + h * 0.5);
  460. c.lineTo(x + w, y + h * 0.5);
  461. c.moveTo(x + w * 0.75, y);
  462. c.lineTo(x + w, y + h * 0.5);
  463. c.lineTo(x + w * 0.75, y + h);
  464. c.stroke();
  465. }
  466. mxShapeSysMLPortThree.prototype.drawOut = function(c, x, y, w, h)
  467. {
  468. c.begin();
  469. c.moveTo(x, y + h * 0.5);
  470. c.lineTo(x + w, y + h * 0.5);
  471. c.moveTo(x + w * 0.25, y);
  472. c.lineTo(x, y + h * 0.5);
  473. c.lineTo(x + w * 0.25, y + h);
  474. c.stroke();
  475. }
  476. mxShapeSysMLPortThree.prototype.drawInOut = function(c, x, y, w, h)
  477. {
  478. c.begin();
  479. c.moveTo(x + w * 0.75, y);
  480. c.lineTo(x + w, y + h * 0.5);
  481. c.lineTo(x + w * 0.75, y + h);
  482. c.moveTo(x + w * 0.25, y);
  483. c.lineTo(x, y + h * 0.5);
  484. c.lineTo(x + w * 0.25, y + h);
  485. c.stroke();
  486. }
  487. mxCellRenderer.registerShape(mxShapeSysMLPortThree.prototype.cst.PORT3, mxShapeSysMLPortThree);
  488. //**********************************************************************************************************************************************************
  489. //Port
  490. //**********************************************************************************************************************************************************
  491. /**
  492. * Extends mxShape.
  493. */
  494. function mxShapeSysMLPortFour(bounds, fill, stroke, strokewidth)
  495. {
  496. mxShape.call(this);
  497. this.bounds = bounds;
  498. this.fill = fill;
  499. this.stroke = stroke;
  500. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  501. };
  502. /**
  503. * Extends mxShape.
  504. */
  505. mxUtils.extend(mxShapeSysMLPortFour, mxShape);
  506. mxShapeSysMLPortFour.prototype.cst = {
  507. PORT4 : 'mxgraph.sysml.port4'
  508. };
  509. /**
  510. * Function: paintVertexShape
  511. *
  512. * Paints the vertex shape.
  513. */
  514. mxShapeSysMLPortFour.prototype.paintVertexShape = function(c, x, y, w, h)
  515. {
  516. c.rect(x + w * 0.05, y, w - w * 0.05, h);
  517. c.fillAndStroke();
  518. };
  519. mxCellRenderer.registerShape(mxShapeSysMLPortFour.prototype.cst.PORT4, mxShapeSysMLPortFour);
  520. mxShapeSysMLPortFour.prototype.constraints = [
  521. new mxConnectionConstraint(new mxPoint(0.5, 0), true),
  522. new mxConnectionConstraint(new mxPoint(0, 0.5), true),
  523. new mxConnectionConstraint(new mxPoint(0.5, 1), true),
  524. new mxConnectionConstraint(new mxPoint(1, 0.5), true)
  525. ];
  526. //**********************************************************************************************************************************************************
  527. //Item Flow
  528. //**********************************************************************************************************************************************************
  529. /**
  530. * Extends mxShape.
  531. */
  532. function mxShapeSysMLItemFlow(bounds, fill, stroke, strokewidth)
  533. {
  534. mxShape.call(this);
  535. this.bounds = bounds;
  536. this.fill = fill;
  537. this.stroke = stroke;
  538. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  539. };
  540. /**
  541. * Extends mxShape.
  542. */
  543. mxUtils.extend(mxShapeSysMLItemFlow, mxShape);
  544. mxShapeSysMLItemFlow.prototype.cst = {
  545. ITEM_FLOW : 'mxgraph.sysml.itemFlow',
  546. FLOW_DIR : 'flowDir',
  547. FLOW_TYPE : 'flowType'
  548. };
  549. mxShapeSysMLItemFlow.prototype.customProperties = [
  550. {name: 'flowDir', dispName: 'Flow Direction', type: 'enum',
  551. enumList:[
  552. {val:'n', dispName:'North'},
  553. {val:'s', dispName:'South'},
  554. {val:'e', dispName:'East'},
  555. {val:'w', dispName:'West'}
  556. ]},
  557. {name: 'flowType', dispName: 'Flow Type', type: 'enum',
  558. enumList:[
  559. {val:'in', dispName:'In'},
  560. {val:'out', dispName:'Out'}
  561. ]}];
  562. /**
  563. * Function: paintVertexShape
  564. *
  565. * Paints the vertex shape.
  566. */
  567. mxShapeSysMLItemFlow.prototype.paintVertexShape = function(c, x, y, w, h)
  568. {
  569. var flowDir = mxUtils.getValue(this.style, mxShapeSysMLItemFlow.prototype.cst.FLOW_DIR, 'none').toLowerCase();
  570. var flowType = mxUtils.getValue(this.style, mxShapeSysMLItemFlow.prototype.cst.FLOW_TYPE, 'none');
  571. if (flowDir === 'n')
  572. {
  573. c.rect(x, y + 10, w, h - 10);
  574. c.fillAndStroke();
  575. c.setShadow(false);
  576. c.rect(x + w * 0.5 - 10, y, 20, 20);
  577. c.fillAndStroke();
  578. if (flowType === 'in')
  579. {
  580. this.drawDown(c, x + w * 0.5 - 5, y + 2, 10, 16);
  581. }
  582. else if (flowType === 'out')
  583. {
  584. this.drawUp(c, x + w * 0.5 - 5, y + 2, 10, 16);
  585. }
  586. }
  587. else if (flowDir === 's')
  588. {
  589. c.rect(x, y, w, h - 10);
  590. c.fillAndStroke();
  591. c.setShadow(false);
  592. c.rect(x + w * 0.5 - 10, y + h - 20, 20, 20);
  593. c.fillAndStroke();
  594. if (flowType === 'in')
  595. {
  596. this.drawUp(c, x + w * 0.5 - 5, y + h - 18, 10, 16);
  597. }
  598. else if (flowType === 'out')
  599. {
  600. this.drawDown(c, x + w * 0.5 - 5, y + h - 18, 10, 16);
  601. }
  602. }
  603. else if (flowDir === 'w')
  604. {
  605. c.rect(x + 10, y, w - 10, h);
  606. c.fillAndStroke();
  607. c.setShadow(false);
  608. c.rect(x, y + h * 0.5 - 10, 20, 20);
  609. c.fillAndStroke();
  610. if (flowType === 'in')
  611. {
  612. this.drawRight(c, x + 2, y + h * 0.5 - 5, 16, 10);
  613. }
  614. else if (flowType === 'out')
  615. {
  616. this.drawLeft(c, x + 2, y + h * 0.5 - 5, 16, 10);
  617. }
  618. }
  619. else if (flowDir === 'e')
  620. {
  621. c.rect(x, y, w - 10, h);
  622. c.fillAndStroke();
  623. c.setShadow(false);
  624. c.rect(x + w - 20, y + h * 0.5 - 10, 20, 20);
  625. c.fillAndStroke();
  626. if (flowType === 'in')
  627. {
  628. this.drawLeft(c, x + w - 18, y + h * 0.5 - 5, 16, 10);
  629. }
  630. else if (flowType === 'out')
  631. {
  632. this.drawRight(c, x + w - 18, y + h * 0.5 - 5, 16, 10);
  633. }
  634. }
  635. };
  636. mxShapeSysMLItemFlow.prototype.drawRight = function(c, x, y, w, h)
  637. {
  638. c.begin();
  639. c.moveTo(x, y + h * 0.5);
  640. c.lineTo(x + w, y + h * 0.5);
  641. c.moveTo(x + w * 0.75, y);
  642. c.lineTo(x + w, y + h * 0.5);
  643. c.lineTo(x + w * 0.75, y + h);
  644. c.stroke();
  645. }
  646. mxShapeSysMLItemFlow.prototype.drawDown = function(c, x, y, w, h)
  647. {
  648. c.begin();
  649. c.moveTo(x + w * 0.5, y);
  650. c.lineTo(x + w * 0.5, y + h);
  651. c.moveTo(x, y + h * 0.75);
  652. c.lineTo(x + w * 0.5, y + h);
  653. c.lineTo(x + w, y + h * 0.75);
  654. c.stroke();
  655. }
  656. mxShapeSysMLItemFlow.prototype.drawLeft = function(c, x, y, w, h)
  657. {
  658. c.begin();
  659. c.moveTo(x, y + h * 0.5);
  660. c.lineTo(x + w, y + h * 0.5);
  661. c.moveTo(x + w * 0.25, y);
  662. c.lineTo(x, y + h * 0.5);
  663. c.lineTo(x + w * 0.25, y + h);
  664. c.stroke();
  665. }
  666. mxShapeSysMLItemFlow.prototype.drawUp = function(c, x, y, w, h)
  667. {
  668. c.begin();
  669. c.moveTo(x + w * 0.5, y + h);
  670. c.lineTo(x + w * 0.5, y);
  671. c.moveTo(x, y + h * 0.25);
  672. c.lineTo(x + w * 0.5, y);
  673. c.lineTo(x + w, y + h * 0.25);
  674. c.stroke();
  675. }
  676. mxCellRenderer.registerShape(mxShapeSysMLItemFlow.prototype.cst.ITEM_FLOW, mxShapeSysMLItemFlow);
  677. mxShapeSysMLItemFlow.prototype.constraints = [
  678. new mxConnectionConstraint(new mxPoint(0.5, 0), true),
  679. new mxConnectionConstraint(new mxPoint(1, 0.5), true),
  680. new mxConnectionConstraint(new mxPoint(0.5, 1), true),
  681. new mxConnectionConstraint(new mxPoint(0, 0.5), true)
  682. ];
  683. //**********************************************************************************************************************************************************
  684. //Item Flow Left
  685. //**********************************************************************************************************************************************************
  686. /**
  687. * Extends mxShape.
  688. */
  689. function mxShapeSysMLItemFlowLeft(bounds, fill, stroke, strokewidth)
  690. {
  691. mxShape.call(this);
  692. this.bounds = bounds;
  693. this.fill = fill;
  694. this.stroke = stroke;
  695. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  696. };
  697. /**
  698. * Extends mxShape.
  699. */
  700. mxUtils.extend(mxShapeSysMLItemFlowLeft, mxShape);
  701. mxShapeSysMLItemFlowLeft.prototype.cst = {
  702. ITEM_FLOW_LEFT : 'mxgraph.sysml.itemFlowLeft'
  703. };
  704. /**
  705. * Function: paintVertexShape
  706. *
  707. * Paints the vertex shape.
  708. */
  709. mxShapeSysMLItemFlowLeft.prototype.paintVertexShape = function(c, x, y, w, h)
  710. {
  711. c.rect(x + 10, y, w - 10, h);
  712. c.fillAndStroke();
  713. c.rect(x, y + h * 0.25 - 10, 20, 20);
  714. c.fillAndStroke();
  715. c.rect(x, y + h * 0.5 - 10, 20, 20);
  716. c.fillAndStroke();
  717. c.rect(x, y + h * 0.75 - 10, 20, 20);
  718. c.fillAndStroke();
  719. };
  720. mxCellRenderer.registerShape(mxShapeSysMLItemFlowLeft.prototype.cst.ITEM_FLOW_LEFT, mxShapeSysMLItemFlowLeft);
  721. mxShapeSysMLItemFlowLeft.prototype.constraints = [
  722. new mxConnectionConstraint(new mxPoint(0.5, 0), true),
  723. new mxConnectionConstraint(new mxPoint(1, 0.5), true),
  724. new mxConnectionConstraint(new mxPoint(0.5, 1), true),
  725. new mxConnectionConstraint(new mxPoint(0, 0.25), true),
  726. new mxConnectionConstraint(new mxPoint(0, 0.5), true),
  727. new mxConnectionConstraint(new mxPoint(0, 0.75), true)
  728. ];
  729. //**********************************************************************************************************************************************************
  730. //Item Flow Right
  731. //**********************************************************************************************************************************************************
  732. /**
  733. * Extends mxShape.
  734. */
  735. function mxShapeSysMLItemFlowRight(bounds, fill, stroke, strokewidth)
  736. {
  737. mxShape.call(this);
  738. this.bounds = bounds;
  739. this.fill = fill;
  740. this.stroke = stroke;
  741. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  742. };
  743. /**
  744. * Extends mxShape.
  745. */
  746. mxUtils.extend(mxShapeSysMLItemFlowRight, mxShape);
  747. mxShapeSysMLItemFlowRight.prototype.cst = {
  748. ITEM_FLOW_RIGHT : 'mxgraph.sysml.itemFlowRight'
  749. };
  750. /**
  751. * Function: paintVertexShape
  752. *
  753. * Paints the vertex shape.
  754. */
  755. mxShapeSysMLItemFlowRight.prototype.paintVertexShape = function(c, x, y, w, h)
  756. {
  757. c.rect(x, y, w - 10, h);
  758. c.fillAndStroke();
  759. c.rect(x + w - 20, y + h * 0.25 - 10, 20, 20);
  760. c.fillAndStroke();
  761. c.rect(x + w - 20, y + h * 0.5 - 10, 20, 20);
  762. c.fillAndStroke();
  763. c.rect(x + w - 20, y + h * 0.75 - 10, 20, 20);
  764. c.fillAndStroke();
  765. };
  766. mxCellRenderer.registerShape(mxShapeSysMLItemFlowRight.prototype.cst.ITEM_FLOW_RIGHT, mxShapeSysMLItemFlowRight);
  767. mxShapeSysMLItemFlowRight.prototype.constraints = [
  768. new mxConnectionConstraint(new mxPoint(0.5, 0), true),
  769. new mxConnectionConstraint(new mxPoint(0, 0.5), true),
  770. new mxConnectionConstraint(new mxPoint(0.5, 1), true),
  771. new mxConnectionConstraint(new mxPoint(1, 0.25), true),
  772. new mxConnectionConstraint(new mxPoint(1, 0.5), true),
  773. new mxConnectionConstraint(new mxPoint(1, 0.75), true)
  774. ];
  775. //**********************************************************************************************************************************************************
  776. //Nested Port
  777. //**********************************************************************************************************************************************************
  778. /**
  779. * Extends mxShape.
  780. */
  781. function mxShapeSysMLNestedPort(bounds, fill, stroke, strokewidth)
  782. {
  783. mxShape.call(this);
  784. this.bounds = bounds;
  785. this.fill = fill;
  786. this.stroke = stroke;
  787. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  788. };
  789. /**
  790. * Extends mxShape.
  791. */
  792. mxUtils.extend(mxShapeSysMLNestedPort, mxShape);
  793. mxShapeSysMLNestedPort.prototype.cst = {
  794. NESTED_PORT : 'mxgraph.sysml.nestedPort'
  795. };
  796. /**
  797. * Function: paintVertexShape
  798. *
  799. * Paints the vertex shape.
  800. */
  801. mxShapeSysMLNestedPort.prototype.paintVertexShape = function(c, x, y, w, h)
  802. {
  803. c.rect(x + w * 0.08, y, w * 0.92, h);
  804. c.fillAndStroke();
  805. c.rect(x + w * 0.03, y + h * 0.1, w * 0.1, h * 0.8);
  806. c.fillAndStroke();
  807. c.rect(x, y + h * 0.15, w * 0.06, h * 0.16);
  808. c.fillAndStroke();
  809. c.rect(x, y + h * 0.42, w * 0.06, h * 0.16);
  810. c.fillAndStroke();
  811. c.rect(x, y + h * 0.69, w * 0.06, h * 0.16);
  812. c.fillAndStroke();
  813. };
  814. mxCellRenderer.registerShape(mxShapeSysMLNestedPort.prototype.cst.NESTED_PORT, mxShapeSysMLNestedPort);
  815. //**********************************************************************************************************************************************************
  816. //Package Containment
  817. //**********************************************************************************************************************************************************
  818. mxMarker.addMarker('sysMLPackCont', function(c, shape, type, pe, unitX, unitY, size, source, sw, filled)
  819. {
  820. var nx = unitX * (size + sw + 1);
  821. var ny = unitY * (size + sw + 1);
  822. var a = size / 2;
  823. return function()
  824. {
  825. c.begin();
  826. c.moveTo(pe.x - nx / 2 - ny / 2, pe.y - ny / 2 + nx / 2);
  827. c.lineTo(pe.x - nx / 2 + ny / 2, pe.y - ny / 2 - nx / 2);
  828. c.stroke();
  829. c.ellipse(pe.x - 0.5 * nx - a, pe.y - 0.5 * ny - a, 2 * a, 2 * a);
  830. c.stroke();
  831. };
  832. });
  833. //**********************************************************************************************************************************************************
  834. //Required Interface
  835. //**********************************************************************************************************************************************************
  836. mxMarker.addMarker('sysMLReqInt', function(c, shape, type, pe, unitX, unitY, size, source, sw, filled)
  837. {
  838. var nx = unitX * (size + sw + 1);
  839. var ny = unitY * (size + sw + 1);
  840. var a = size / 2;
  841. return function()
  842. {
  843. var fillColor = mxUtils.getValue(shape.style, mxConstants.STYLE_FILLCOLOR, 'none');
  844. c.setFillColor(fillColor);
  845. c.ellipse(pe.x - 0.5 * nx - a, pe.y - 0.5 * ny - a, 2 * a, 2 * a);
  846. c.fillAndStroke();
  847. };
  848. });
  849. //**********************************************************************************************************************************************************
  850. //Provided Interface
  851. //**********************************************************************************************************************************************************
  852. mxMarker.addMarker('sysMLProvInt', function(c, shape, type, pe, unitX, unitY, size, source, sw, filled)
  853. {
  854. var nx = unitX * (size + sw + 1);
  855. var ny = unitY * (size + sw + 1);
  856. var a = size / 2;
  857. return function()
  858. {
  859. var fillColor = mxUtils.getValue(shape.style, mxConstants.STYLE_FILLCOLOR, 'none');
  860. c.setFillColor(fillColor);
  861. c.begin();
  862. c.moveTo(pe.x - ny / 2, pe.y + nx / 2);
  863. c.arcTo(a, a, 0, 0, 1, pe.x + ny / 2, pe.y - nx / 2);
  864. c.fillAndStroke();
  865. };
  866. });
  867. //**********************************************************************************************************************************************************
  868. //Parametric Diagram
  869. //**********************************************************************************************************************************************************
  870. /**
  871. * Extends mxShape.
  872. */
  873. function mxShapeSysMLParametricDiagram(bounds, fill, stroke, strokewidth)
  874. {
  875. mxShape.call(this);
  876. this.bounds = bounds;
  877. this.fill = fill;
  878. this.stroke = stroke;
  879. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  880. };
  881. /**
  882. * Extends mxShape.
  883. */
  884. mxUtils.extend(mxShapeSysMLParametricDiagram, mxShape);
  885. mxShapeSysMLParametricDiagram.prototype.cst = {
  886. PARAM_DGM : 'mxgraph.sysml.paramDgm'
  887. };
  888. /**
  889. * Function: paintVertexShape
  890. *
  891. * Paints the vertex shape.
  892. */
  893. mxShapeSysMLParametricDiagram.prototype.paintVertexShape = function(c, x, y, w, h)
  894. {
  895. c.roundrect(x, y, w, h, 10, 10);
  896. c.fillAndStroke();
  897. c.setShadow(false);
  898. if (h > 60)
  899. {
  900. c.rect(x, y + h * 0.25 - 10, 20, 20);
  901. c.stroke();
  902. c.rect(x, y + h * 0.75 - 10, 20, 20);
  903. c.stroke();
  904. }
  905. };
  906. mxCellRenderer.registerShape(mxShapeSysMLParametricDiagram.prototype.cst.PARAM_DGM, mxShapeSysMLParametricDiagram);
  907. //**********************************************************************************************************************************************************
  908. //Constraint Property
  909. //**********************************************************************************************************************************************************
  910. /**
  911. * Extends mxShape.
  912. */
  913. function mxShapeSysMLConstraintProperty(bounds, fill, stroke, strokewidth)
  914. {
  915. mxShape.call(this);
  916. this.bounds = bounds;
  917. this.fill = fill;
  918. this.stroke = stroke;
  919. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  920. };
  921. /**
  922. * Extends mxShape.
  923. */
  924. mxUtils.extend(mxShapeSysMLConstraintProperty, mxShape);
  925. mxShapeSysMLConstraintProperty.prototype.cst = {
  926. CONS_PROP : 'mxgraph.sysml.consProp'
  927. };
  928. /**
  929. * Function: paintVertexShape
  930. *
  931. * Paints the vertex shape.
  932. */
  933. mxShapeSysMLConstraintProperty.prototype.paintVertexShape = function(c, x, y, w, h)
  934. {
  935. c.rect(x, y, w, h);
  936. c.fillAndStroke();
  937. c.setShadow(false);
  938. if (h > 60)
  939. {
  940. c.rect(x, y + 50, 20, 20);
  941. c.stroke();
  942. c.rect(x, y + 80, 20, 20);
  943. c.stroke();
  944. }
  945. };
  946. mxCellRenderer.registerShape(mxShapeSysMLConstraintProperty.prototype.cst.CONS_PROP, mxShapeSysMLConstraintProperty);
  947. //**********************************************************************************************************************************************************
  948. //Call Behavior Action
  949. //**********************************************************************************************************************************************************
  950. /**
  951. * Extends mxShape.
  952. */
  953. function mxShapeSysMLCallBehaviorAction(bounds, fill, stroke, strokewidth)
  954. {
  955. mxShape.call(this);
  956. this.bounds = bounds;
  957. this.fill = fill;
  958. this.stroke = stroke;
  959. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  960. };
  961. /**
  962. * Extends mxShape.
  963. */
  964. mxUtils.extend(mxShapeSysMLCallBehaviorAction, mxShape);
  965. mxShapeSysMLCallBehaviorAction.prototype.cst = {
  966. CALL_BEH_ACT : 'mxgraph.sysml.callBehAct'
  967. };
  968. /**
  969. * Function: paintVertexShape
  970. *
  971. * Paints the vertex shape.
  972. */
  973. mxShapeSysMLCallBehaviorAction.prototype.paintVertexShape = function(c, x, y, w, h)
  974. {
  975. c.roundrect(x, y, w, h, 10, 10);
  976. c.fillAndStroke();
  977. if ((h > 30) && (w > 40))
  978. {
  979. c.setShadow(false);
  980. this.drawSymb(c, x + w - 30, y + h - 30, 20, 20);
  981. }
  982. };
  983. mxShapeSysMLCallBehaviorAction.prototype.drawSymb = function(c, x, y, w, h)
  984. {
  985. c.begin();
  986. c.moveTo(x + w * 0.5, y);
  987. c.lineTo(x + w * 0.5, y + h);
  988. c.moveTo(x, y + h);
  989. c.lineTo(x, y + h * 0.5);
  990. c.lineTo(x + w, y + h * 0.5);
  991. c.lineTo(x + w, y + h);
  992. c.stroke();
  993. };
  994. mxCellRenderer.registerShape(mxShapeSysMLCallBehaviorAction.prototype.cst.CALL_BEH_ACT, mxShapeSysMLCallBehaviorAction);
  995. mxShapeSysMLCallBehaviorAction.prototype.getConstraints = function(style, w, h)
  996. {
  997. var constr = [];
  998. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 2.9, 2.9));
  999. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));
  1000. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
  1001. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));
  1002. constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false, null, -2.9, 2.9));
  1003. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false));
  1004. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  1005. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false));
  1006. constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false, null, -2.9, -2.9));
  1007. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));
  1008. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
  1009. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));
  1010. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));
  1011. constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false, null, 2.9, -2.9));
  1012. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.75), false));
  1013. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  1014. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.25), false));
  1015. return (constr);
  1016. };
  1017. //**********************************************************************************************************************************************************
  1018. //Accept Event Action
  1019. //**********************************************************************************************************************************************************
  1020. /**
  1021. * Extends mxShape.
  1022. */
  1023. function mxShapeSysMLAcceptEventAction(bounds, fill, stroke, strokewidth)
  1024. {
  1025. mxShape.call(this);
  1026. this.bounds = bounds;
  1027. this.fill = fill;
  1028. this.stroke = stroke;
  1029. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1030. };
  1031. /**
  1032. * Extends mxShape.
  1033. */
  1034. mxUtils.extend(mxShapeSysMLAcceptEventAction, mxShape);
  1035. mxShapeSysMLAcceptEventAction.prototype.cst = {
  1036. ACC_EVENT : 'mxgraph.sysml.accEvent'
  1037. };
  1038. /**
  1039. * Function: paintVertexShape
  1040. *
  1041. * Paints the vertex shape.
  1042. */
  1043. mxShapeSysMLAcceptEventAction.prototype.paintVertexShape = function(c, x, y, w, h)
  1044. {
  1045. c.begin();
  1046. c.moveTo(x, y);
  1047. c.lineTo(x + w, y);
  1048. c.lineTo(x + w, y + h);
  1049. c.lineTo(x, y + h);
  1050. c.lineTo(x + h * 0.3, y + h * 0.5);
  1051. c.close();
  1052. c.fillAndStroke();
  1053. };
  1054. mxCellRenderer.registerShape(mxShapeSysMLAcceptEventAction.prototype.cst.ACC_EVENT, mxShapeSysMLAcceptEventAction);
  1055. mxShapeSysMLAcceptEventAction.prototype.getConstraints = function(style, w, h)
  1056. {
  1057. var constr = [];
  1058. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false));
  1059. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));
  1060. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
  1061. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));
  1062. constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));
  1063. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false));
  1064. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  1065. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false));
  1066. constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false));
  1067. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));
  1068. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
  1069. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));
  1070. constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));
  1071. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false, null, h * 0.3, 0));
  1072. return (constr);
  1073. };
  1074. //**********************************************************************************************************************************************************
  1075. //Time Event
  1076. //**********************************************************************************************************************************************************
  1077. /**
  1078. * Extends mxShape.
  1079. */
  1080. function mxShapeSysMLTimeEvent(bounds, fill, stroke, strokewidth)
  1081. {
  1082. mxShape.call(this);
  1083. this.bounds = bounds;
  1084. this.fill = fill;
  1085. this.stroke = stroke;
  1086. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1087. };
  1088. /**
  1089. * Extends mxShape.
  1090. */
  1091. mxUtils.extend(mxShapeSysMLTimeEvent, mxShape);
  1092. mxShapeSysMLTimeEvent.prototype.cst = {
  1093. TIME_EVENT : 'mxgraph.sysml.timeEvent'
  1094. };
  1095. /**
  1096. * Function: paintVertexShape
  1097. *
  1098. * Paints the vertex shape.
  1099. */
  1100. mxShapeSysMLTimeEvent.prototype.paintVertexShape = function(c, x, y, w, h)
  1101. {
  1102. c.begin();
  1103. c.moveTo(x, y);
  1104. c.lineTo(x + w, y);
  1105. c.lineTo(x, y + h);
  1106. c.lineTo(x + w, y + h);
  1107. c.close();
  1108. c.fillAndStroke();
  1109. };
  1110. mxCellRenderer.registerShape(mxShapeSysMLTimeEvent.prototype.cst.TIME_EVENT, mxShapeSysMLTimeEvent);
  1111. mxShapeSysMLTimeEvent.prototype.getConstraints = function(style, w, h)
  1112. {
  1113. var constr = [];
  1114. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false));
  1115. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
  1116. constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));
  1117. constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false));
  1118. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
  1119. constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));
  1120. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0.5), false));
  1121. return (constr);
  1122. };
  1123. //**********************************************************************************************************************************************************
  1124. //Send Signal Action
  1125. //**********************************************************************************************************************************************************
  1126. /**
  1127. * Extends mxShape.
  1128. */
  1129. function mxShapeSysMLSendSignalAction(bounds, fill, stroke, strokewidth)
  1130. {
  1131. mxShape.call(this);
  1132. this.bounds = bounds;
  1133. this.fill = fill;
  1134. this.stroke = stroke;
  1135. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1136. };
  1137. /**
  1138. * Extends mxShape.
  1139. */
  1140. mxUtils.extend(mxShapeSysMLSendSignalAction, mxShape);
  1141. mxShapeSysMLSendSignalAction.prototype.cst = {
  1142. SEND_SIG_ACT : 'mxgraph.sysml.sendSigAct'
  1143. };
  1144. /**
  1145. * Function: paintVertexShape
  1146. *
  1147. * Paints the vertex shape.
  1148. */
  1149. mxShapeSysMLSendSignalAction.prototype.paintVertexShape = function(c, x, y, w, h)
  1150. {
  1151. c.begin();
  1152. c.moveTo(x, y);
  1153. c.lineTo(x + w - h * 0.3, y);
  1154. c.lineTo(x + w, y + h * 0.5);
  1155. c.lineTo(x + w - h * 0.3, y + h);
  1156. c.lineTo(x, y + h);
  1157. c.close();
  1158. c.fillAndStroke();
  1159. };
  1160. mxCellRenderer.registerShape(mxShapeSysMLSendSignalAction.prototype.cst.SEND_SIG_ACT, mxShapeSysMLSendSignalAction);
  1161. mxShapeSysMLSendSignalAction.prototype.getConstraints = function(style, w, h)
  1162. {
  1163. var constr = [];
  1164. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false));
  1165. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));
  1166. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
  1167. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));
  1168. constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false, null, -h * 0.3, 0));
  1169. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  1170. constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false, null, -h * 0.3, 0));
  1171. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));
  1172. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
  1173. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));
  1174. constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));
  1175. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.25), false));
  1176. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  1177. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.75), false));
  1178. return (constr);
  1179. };
  1180. //**********************************************************************************************************************************************************
  1181. //Activity Final
  1182. //**********************************************************************************************************************************************************
  1183. /**
  1184. * Extends mxShape.
  1185. */
  1186. function mxShapeSysMLActivityFinal(bounds, fill, stroke, strokewidth)
  1187. {
  1188. mxShape.call(this);
  1189. this.bounds = bounds;
  1190. this.fill = fill;
  1191. this.stroke = stroke;
  1192. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1193. };
  1194. /**
  1195. * Extends mxShape.
  1196. */
  1197. mxUtils.extend(mxShapeSysMLActivityFinal, mxShape);
  1198. mxShapeSysMLActivityFinal.prototype.cst = {
  1199. ACT_FINAL : 'mxgraph.sysml.actFinal'
  1200. };
  1201. /**
  1202. * Function: paintVertexShape
  1203. *
  1204. * Paints the vertex shape.
  1205. */
  1206. mxShapeSysMLActivityFinal.prototype.paintVertexShape = function(c, x, y, w, h)
  1207. {
  1208. c.ellipse(x, y, w, h);
  1209. c.fillAndStroke();
  1210. var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#000000');
  1211. c.setFillColor(strokeColor);
  1212. c.ellipse(x + 5, y + 5, w - 10, h - 10);
  1213. c.fillAndStroke();
  1214. };
  1215. mxCellRenderer.registerShape(mxShapeSysMLActivityFinal.prototype.cst.ACT_FINAL, mxShapeSysMLActivityFinal);
  1216. mxShapeSysMLActivityFinal.prototype.getConstraints = function(style, w, h)
  1217. {
  1218. var constr = [];
  1219. constr.push(new mxConnectionConstraint(new mxPoint(0.145, 0.145), false));
  1220. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
  1221. constr.push(new mxConnectionConstraint(new mxPoint(0.855, 0.145), false));
  1222. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  1223. constr.push(new mxConnectionConstraint(new mxPoint(0.855, 0.855), false));
  1224. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
  1225. constr.push(new mxConnectionConstraint(new mxPoint(0.145, 0.855), false));
  1226. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  1227. return (constr);
  1228. };
  1229. //**********************************************************************************************************************************************************
  1230. //Activity Parameter Node
  1231. //**********************************************************************************************************************************************************
  1232. /**
  1233. * Extends mxShape.
  1234. */
  1235. function mxShapeSysMLActivityParameterNode(bounds, fill, stroke, strokewidth)
  1236. {
  1237. mxShape.call(this);
  1238. this.bounds = bounds;
  1239. this.fill = fill;
  1240. this.stroke = stroke;
  1241. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1242. };
  1243. /**
  1244. * Extends mxShape.
  1245. */
  1246. mxUtils.extend(mxShapeSysMLActivityParameterNode, mxShape);
  1247. mxShapeSysMLActivityParameterNode.prototype.cst = {
  1248. ACT_PARAM_NODE : 'mxgraph.sysml.actParamNode'
  1249. };
  1250. /**
  1251. * Function: paintVertexShape
  1252. *
  1253. * Paints the vertex shape.
  1254. */
  1255. mxShapeSysMLActivityParameterNode.prototype.paintVertexShape = function(c, x, y, w, h)
  1256. {
  1257. c.translate(x, y);
  1258. c.begin();
  1259. var minX = Math.max(w * 0.35, 70);
  1260. var maxX = Math.min(w * 0.65, w - 10);
  1261. c.begin();
  1262. c.moveTo(minX, h);
  1263. c.lineTo(10, h);
  1264. c.lineTo(10, 0);
  1265. c.lineTo(minX, 0);
  1266. c.moveTo(maxX, h);
  1267. c.lineTo(w - 10, h);
  1268. c.lineTo(w - 10, 0);
  1269. c.lineTo(maxX, 0);
  1270. c.stroke();
  1271. var xSize = 50;
  1272. var ySize = 20;
  1273. xSize = Math.min(xSize, w);
  1274. if (xSize > ySize)
  1275. {
  1276. c.begin();
  1277. c.moveTo(10, ySize);
  1278. c.lineTo(xSize - ySize * 0.5, ySize);
  1279. c.lineTo(xSize, ySize * 0.5);
  1280. c.lineTo(xSize, 0);
  1281. c.lineTo(10, 0);
  1282. c.close();
  1283. c.fillAndStroke();
  1284. }
  1285. c.rect(0, h * 0.35 - 10, 20, 20);
  1286. c.fillAndStroke();
  1287. c.rect(0, h * 0.65 - 10, 20, 20);
  1288. c.fillAndStroke();
  1289. c.rect(w - 20, h * 0.5 - 10, 20, 20);
  1290. c.fillAndStroke();
  1291. };
  1292. mxCellRenderer.registerShape(mxShapeSysMLActivityParameterNode.prototype.cst.ACT_PARAM_NODE, mxShapeSysMLActivityParameterNode);
  1293. mxShapeSysMLActivityParameterNode.prototype.getConstraints = function(style, w, h)
  1294. {
  1295. var constr = [];
  1296. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.35), false));
  1297. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.65), false));
  1298. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  1299. return (constr);
  1300. };
  1301. //**********************************************************************************************************************************************************
  1302. //Control Operator
  1303. //**********************************************************************************************************************************************************
  1304. /**
  1305. * Extends mxShape.
  1306. */
  1307. function mxShapeSysMLControlOperator(bounds, fill, stroke, strokewidth)
  1308. {
  1309. mxShape.call(this);
  1310. this.bounds = bounds;
  1311. this.fill = fill;
  1312. this.stroke = stroke;
  1313. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1314. };
  1315. /**
  1316. * Extends mxShape.
  1317. */
  1318. mxUtils.extend(mxShapeSysMLControlOperator, mxShape);
  1319. mxShapeSysMLControlOperator.prototype.cst = {
  1320. CONT_OPER : 'mxgraph.sysml.contOper'
  1321. };
  1322. /**
  1323. * Function: paintVertexShape
  1324. *
  1325. * Paints the vertex shape.
  1326. */
  1327. mxShapeSysMLControlOperator.prototype.paintVertexShape = function(c, x, y, w, h)
  1328. {
  1329. c.translate(x, y);
  1330. this.background(c, x, y, w, h);
  1331. c.setShadow(false);
  1332. this.foreground(c, x, y, w, h);
  1333. };
  1334. mxShapeSysMLControlOperator.prototype.background = function(c, x, y, w, h)
  1335. {
  1336. c.rect(0, 0, w, h);
  1337. c.fillAndStroke();
  1338. };
  1339. mxShapeSysMLControlOperator.prototype.foreground = function(c, x, y, w, h)
  1340. {
  1341. var xSize = 130;
  1342. var ySize = 20;
  1343. xSize = Math.min(xSize, w);
  1344. if (xSize > ySize)
  1345. {
  1346. c.begin();
  1347. c.moveTo(0, ySize);
  1348. c.lineTo(xSize - ySize * 0.5, ySize);
  1349. c.lineTo(xSize, ySize * 0.5);
  1350. c.lineTo(xSize, 0);
  1351. c.stroke();
  1352. }
  1353. };
  1354. mxCellRenderer.registerShape(mxShapeSysMLControlOperator.prototype.cst.CONT_OPER, mxShapeSysMLControlOperator);
  1355. //**********************************************************************************************************************************************************
  1356. //Flow Final
  1357. //**********************************************************************************************************************************************************
  1358. /**
  1359. * Extends mxShape.
  1360. */
  1361. function mxShapeSysMLFlowFinal(bounds, fill, stroke, strokewidth)
  1362. {
  1363. mxShape.call(this);
  1364. this.bounds = bounds;
  1365. this.fill = fill;
  1366. this.stroke = stroke;
  1367. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1368. };
  1369. /**
  1370. * Extends mxShape.
  1371. */
  1372. mxUtils.extend(mxShapeSysMLFlowFinal, mxShape);
  1373. mxShapeSysMLFlowFinal.prototype.cst = {
  1374. FLOW_FINAL : 'mxgraph.sysml.flowFinal'
  1375. };
  1376. /**
  1377. * Function: paintVertexShape
  1378. *
  1379. * Paints the vertex shape.
  1380. */
  1381. mxShapeSysMLFlowFinal.prototype.paintVertexShape = function(c, x, y, w, h)
  1382. {
  1383. c.translate(x, y);
  1384. c.ellipse(0, 0, w, h);
  1385. c.fillAndStroke();
  1386. c.setShadow(false);
  1387. c.begin();
  1388. c.moveTo(w * 0.145, h * 0.145);
  1389. c.lineTo(w * 0.855, h * 0.855);
  1390. c.moveTo(w * 0.855, h * 0.145);
  1391. c.lineTo(w * 0.145, h * 0.855);
  1392. c.stroke();
  1393. };
  1394. mxCellRenderer.registerShape(mxShapeSysMLFlowFinal.prototype.cst.FLOW_FINAL, mxShapeSysMLFlowFinal);
  1395. mxShapeSysMLFlowFinal.prototype.getConstraints = function(style, w, h)
  1396. {
  1397. var constr = [];
  1398. constr.push(new mxConnectionConstraint(new mxPoint(0.145, 0.145), false));
  1399. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
  1400. constr.push(new mxConnectionConstraint(new mxPoint(0.855, 0.145), false));
  1401. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  1402. constr.push(new mxConnectionConstraint(new mxPoint(0.855, 0.855), false));
  1403. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
  1404. constr.push(new mxConnectionConstraint(new mxPoint(0.145, 0.855), false));
  1405. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  1406. return (constr);
  1407. };
  1408. //**********************************************************************************************************************************************************
  1409. //Is Control
  1410. //**********************************************************************************************************************************************************
  1411. /**
  1412. * Extends mxShape.
  1413. */
  1414. function mxShapeSysMLIsControl(bounds, fill, stroke, strokewidth)
  1415. {
  1416. mxShape.call(this);
  1417. this.bounds = bounds;
  1418. this.fill = fill;
  1419. this.stroke = stroke;
  1420. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1421. };
  1422. /**
  1423. * Extends mxShape.
  1424. */
  1425. mxUtils.extend(mxShapeSysMLIsControl, mxShape);
  1426. mxShapeSysMLIsControl.prototype.cst = {
  1427. IS_CONTROL : 'mxgraph.sysml.isControl'
  1428. };
  1429. /**
  1430. * Function: paintVertexShape
  1431. *
  1432. * Paints the vertex shape.
  1433. */
  1434. mxShapeSysMLIsControl.prototype.paintVertexShape = function(c, x, y, w, h)
  1435. {
  1436. c.translate(x, y);
  1437. c.rect(0, h * 0.5 - 10, 10, 20);
  1438. c.fillAndStroke();
  1439. c.roundrect(10, 0, w - 20, h, 10, 10);
  1440. c.fillAndStroke();
  1441. c.rect(w - 10, h * 0.5 - 10, 10, 20);
  1442. c.fillAndStroke();
  1443. };
  1444. mxCellRenderer.registerShape(mxShapeSysMLIsControl.prototype.cst.IS_CONTROL, mxShapeSysMLIsControl);
  1445. mxShapeSysMLIsControl.prototype.getConstraints = function(style, w, h)
  1446. {
  1447. var constr = [];
  1448. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  1449. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  1450. return (constr);
  1451. };
  1452. //**********************************************************************************************************************************************************
  1453. //Is Stream
  1454. //**********************************************************************************************************************************************************
  1455. /**
  1456. * Extends mxShape.
  1457. */
  1458. function mxShapeSysMLIsStream(bounds, fill, stroke, strokewidth)
  1459. {
  1460. mxShape.call(this);
  1461. this.bounds = bounds;
  1462. this.fill = fill;
  1463. this.stroke = stroke;
  1464. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1465. };
  1466. /**
  1467. * Extends mxShape.
  1468. */
  1469. mxUtils.extend(mxShapeSysMLIsStream, mxShape);
  1470. mxShapeSysMLIsStream.prototype.cst = {
  1471. IS_STREAM : 'mxgraph.sysml.isStream'
  1472. };
  1473. /**
  1474. * Function: paintVertexShape
  1475. *
  1476. * Paints the vertex shape.
  1477. */
  1478. mxShapeSysMLIsStream.prototype.paintVertexShape = function(c, x, y, w, h)
  1479. {
  1480. c.translate(x, y);
  1481. var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#000000');
  1482. var fillColor = mxUtils.getValue(this.style, mxConstants.STYLE_FILLCOLOR, '#ffffff');
  1483. c.setFillColor(strokeColor);
  1484. c.rect(0, h * 0.5 - 10, 10, 20);
  1485. c.fillAndStroke();
  1486. c.setFillColor(fillColor);
  1487. c.roundrect(10, 0, w - 20, h, 10, 10);
  1488. c.fillAndStroke();
  1489. c.setFillColor(strokeColor);
  1490. c.rect(w - 10, h * 0.5 - 10, 10, 20);
  1491. c.fillAndStroke();
  1492. };
  1493. mxCellRenderer.registerShape(mxShapeSysMLIsStream.prototype.cst.IS_STREAM, mxShapeSysMLIsStream);
  1494. mxShapeSysMLIsStream.prototype.getConstraints = function(style, w, h)
  1495. {
  1496. var constr = [];
  1497. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  1498. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  1499. return (constr);
  1500. };
  1501. //**********************************************************************************************************************************************************
  1502. //Is Activity Stream
  1503. //**********************************************************************************************************************************************************
  1504. /**
  1505. * Extends mxShape.
  1506. */
  1507. function mxShapeSysMLIsActStream(bounds, fill, stroke, strokewidth)
  1508. {
  1509. mxShape.call(this);
  1510. this.bounds = bounds;
  1511. this.fill = fill;
  1512. this.stroke = stroke;
  1513. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1514. };
  1515. /**
  1516. * Extends mxShape.
  1517. */
  1518. mxUtils.extend(mxShapeSysMLIsActStream, mxShape);
  1519. mxShapeSysMLIsActStream.prototype.cst = {
  1520. IS_ACT_STREAM : 'mxgraph.sysml.isActStream'
  1521. };
  1522. /**
  1523. * Function: paintVertexShape
  1524. *
  1525. * Paints the vertex shape.
  1526. */
  1527. mxShapeSysMLIsActStream.prototype.paintVertexShape = function(c, x, y, w, h)
  1528. {
  1529. c.translate(x, y);
  1530. c.begin();
  1531. c.rect(0, 0, w - 10, h);
  1532. c.fillAndStroke();
  1533. var xSize = 40;
  1534. var ySize = 20;
  1535. xSize = Math.min(xSize, w);
  1536. if (xSize > ySize)
  1537. {
  1538. c.begin();
  1539. c.moveTo(0, ySize);
  1540. c.lineTo(xSize - ySize * 0.5, ySize);
  1541. c.lineTo(xSize, ySize * 0.5);
  1542. c.lineTo(xSize, 0);
  1543. c.lineTo(0, 0);
  1544. c.close();
  1545. c.fillAndStroke();
  1546. }
  1547. c.rect(w - 20, h * 0.5 - 10, 20, 20);
  1548. c.fillAndStroke();
  1549. };
  1550. mxCellRenderer.registerShape(mxShapeSysMLIsActStream.prototype.cst.IS_ACT_STREAM, mxShapeSysMLIsActStream);
  1551. mxShapeSysMLIsActStream.prototype.getConstraints = function(style, w, h)
  1552. {
  1553. var constr = [];
  1554. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  1555. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  1556. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
  1557. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
  1558. return (constr);
  1559. };
  1560. //**********************************************************************************************************************************************************
  1561. //Parameter Set
  1562. //**********************************************************************************************************************************************************
  1563. /**
  1564. * Extends mxShape.
  1565. */
  1566. function mxShapeSysMLParameterSet(bounds, fill, stroke, strokewidth)
  1567. {
  1568. mxShape.call(this);
  1569. this.bounds = bounds;
  1570. this.fill = fill;
  1571. this.stroke = stroke;
  1572. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1573. };
  1574. /**
  1575. * Extends mxShape.
  1576. */
  1577. mxUtils.extend(mxShapeSysMLParameterSet, mxShape);
  1578. mxShapeSysMLParameterSet.prototype.cst = {
  1579. PARAM_SET : 'mxgraph.sysml.paramSet'
  1580. };
  1581. /**
  1582. * Function: paintVertexShape
  1583. *
  1584. * Paints the vertex shape.
  1585. */
  1586. mxShapeSysMLParameterSet.prototype.paintVertexShape = function(c, x, y, w, h)
  1587. {
  1588. c.translate(x, y);
  1589. c.rect(0, h * 0.5 - 28, 10, 56);
  1590. c.fillAndStroke();
  1591. c.roundrect(10, 0, w - 20, h, 10, 10);
  1592. c.fillAndStroke();
  1593. c.rect(w - 10, h * 0.5 - 28, 10, 56);
  1594. c.fillAndStroke();
  1595. c.setShadow(false);
  1596. c.rect(4, h * 0.5 - 24, 6, 20);
  1597. c.fillAndStroke();
  1598. c.rect(4, h * 0.5 + 4, 6, 20);
  1599. c.fillAndStroke();
  1600. c.rect(w - 10, h * 0.5 - 24, 6, 20);
  1601. c.fillAndStroke();
  1602. c.rect(w - 10, h * 0.5 + 4, 6, 20);
  1603. c.fillAndStroke();
  1604. };
  1605. mxCellRenderer.registerShape(mxShapeSysMLParameterSet.prototype.cst.PARAM_SET, mxShapeSysMLParameterSet);
  1606. mxShapeSysMLParameterSet.prototype.getConstraints = function(style, w, h)
  1607. {
  1608. var constr = [];
  1609. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false, null, 0, -14));
  1610. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  1611. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false, null, 0, 14));
  1612. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false, null, 0, -14));
  1613. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  1614. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false, null, 0, 14));
  1615. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));
  1616. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
  1617. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));
  1618. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));
  1619. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
  1620. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));
  1621. return (constr);
  1622. };
  1623. //**********************************************************************************************************************************************************
  1624. //Is Parameter Activity Set
  1625. //**********************************************************************************************************************************************************
  1626. /**
  1627. * Extends mxShape.
  1628. */
  1629. function mxShapeSysMLParameterActivitySet(bounds, fill, stroke, strokewidth)
  1630. {
  1631. mxShape.call(this);
  1632. this.bounds = bounds;
  1633. this.fill = fill;
  1634. this.stroke = stroke;
  1635. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1636. };
  1637. /**
  1638. * Extends mxShape.
  1639. */
  1640. mxUtils.extend(mxShapeSysMLParameterActivitySet, mxShape);
  1641. mxShapeSysMLParameterActivitySet.prototype.cst = {
  1642. PARAM_ACT_SET : 'mxgraph.sysml.paramActSet'
  1643. };
  1644. /**
  1645. * Function: paintVertexShape
  1646. *
  1647. * Paints the vertex shape.
  1648. */
  1649. mxShapeSysMLParameterActivitySet.prototype.paintVertexShape = function(c, x, y, w, h)
  1650. {
  1651. c.translate(x, y);
  1652. c.begin();
  1653. c.rect(10, 0, w - 20, h);
  1654. c.fillAndStroke();
  1655. var xSize = 50;
  1656. var ySize = 20;
  1657. xSize = Math.min(xSize, w);
  1658. if (xSize > ySize)
  1659. {
  1660. c.begin();
  1661. c.moveTo(10, ySize);
  1662. c.lineTo(xSize - ySize * 0.5, ySize);
  1663. c.lineTo(xSize, ySize * 0.5);
  1664. c.lineTo(xSize, 0);
  1665. c.lineTo(10, 0);
  1666. c.close();
  1667. c.fillAndStroke();
  1668. }
  1669. c.setShadow(false);
  1670. if (h > 70)
  1671. {
  1672. c.rect(0, h * 0.5 - 28, 15, 56);
  1673. c.fillAndStroke();
  1674. c.rect(4, h * 0.5 - 24, 15, 20);
  1675. c.fillAndStroke();
  1676. c.rect(4, h * 0.5 + 4, 15, 20);
  1677. c.fillAndStroke();
  1678. c.rect(w - 15, h * 0.5 - 28, 15, 56);
  1679. c.fillAndStroke();
  1680. c.rect(w - 19, h * 0.5 - 24, 15, 20);
  1681. c.fillAndStroke();
  1682. c.rect(w - 19, h * 0.5 + 4, 15, 20);
  1683. c.fillAndStroke();
  1684. }
  1685. };
  1686. mxCellRenderer.registerShape(mxShapeSysMLParameterActivitySet.prototype.cst.PARAM_ACT_SET, mxShapeSysMLParameterActivitySet);
  1687. mxShapeSysMLParameterActivitySet.prototype.getConstraints = function(style, w, h)
  1688. {
  1689. var constr = [];
  1690. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false, null, 0, -14));
  1691. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  1692. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false, null, 0, 14));
  1693. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false, null, 0, -14));
  1694. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  1695. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false, null, 0, 14));
  1696. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));
  1697. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
  1698. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));
  1699. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));
  1700. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
  1701. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));
  1702. return (constr);
  1703. };
  1704. //**********************************************************************************************************************************************************
  1705. //Probability
  1706. //**********************************************************************************************************************************************************
  1707. /**
  1708. * Extends mxShape.
  1709. */
  1710. function mxShapeSysMLProbability(bounds, fill, stroke, strokewidth)
  1711. {
  1712. mxShape.call(this);
  1713. this.bounds = bounds;
  1714. this.fill = fill;
  1715. this.stroke = stroke;
  1716. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1717. };
  1718. /**
  1719. * Extends mxShape.
  1720. */
  1721. mxUtils.extend(mxShapeSysMLProbability, mxShape);
  1722. mxShapeSysMLProbability.prototype.cst = {
  1723. PROBABILITY : 'mxgraph.sysml.probability'
  1724. };
  1725. /**
  1726. * Function: paintVertexShape
  1727. *
  1728. * Paints the vertex shape.
  1729. */
  1730. mxShapeSysMLProbability.prototype.paintVertexShape = function(c, x, y, w, h)
  1731. {
  1732. c.translate(x, y);
  1733. c.roundrect(0, 0, w - 10, h, 10, 10);
  1734. c.fillAndStroke();
  1735. c.rect(w - 10, h * 0.25 - 28, 10, 56);
  1736. c.fillAndStroke();
  1737. c.rect(w - 10, h * 0.75 - 28, 10, 56);
  1738. c.fillAndStroke();
  1739. c.setShadow(false);
  1740. c.rect(w - 10, h * 0.25 - 24, 6, 20);
  1741. c.fillAndStroke();
  1742. c.rect(w - 10, h * 0.25 + 4, 6, 20);
  1743. c.fillAndStroke();
  1744. c.rect(w - 10, h * 0.75 - 24, 6, 20);
  1745. c.fillAndStroke();
  1746. c.rect(w - 10, h * 0.75 + 4, 6, 20);
  1747. c.fillAndStroke();
  1748. };
  1749. mxCellRenderer.registerShape(mxShapeSysMLProbability.prototype.cst.PROBABILITY, mxShapeSysMLProbability);
  1750. mxShapeSysMLProbability.prototype.getConstraints = function(style, w, h)
  1751. {
  1752. var constr = [];
  1753. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.25), false));
  1754. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  1755. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.75), false));
  1756. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false, null, 0, -14));
  1757. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false, null, 0, 14));
  1758. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false));
  1759. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false, null, 0, -14));
  1760. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false));
  1761. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false, null, 0, 14));
  1762. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false, null, -5, 0));
  1763. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false, null, -5, 0));
  1764. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false, null, -5, 0));
  1765. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false, null, -5, 0));
  1766. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false, null, -5, 0));
  1767. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false, null, -5, 0));
  1768. return (constr);
  1769. };
  1770. //**********************************************************************************************************************************************************
  1771. //Is Activity Stream
  1772. //**********************************************************************************************************************************************************
  1773. /**
  1774. * Extends mxShape.
  1775. */
  1776. function mxShapeSysMLActivityProbability(bounds, fill, stroke, strokewidth)
  1777. {
  1778. mxShape.call(this);
  1779. this.bounds = bounds;
  1780. this.fill = fill;
  1781. this.stroke = stroke;
  1782. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1783. };
  1784. /**
  1785. * Extends mxShape.
  1786. */
  1787. mxUtils.extend(mxShapeSysMLActivityProbability, mxShape);
  1788. mxShapeSysMLActivityProbability.prototype.cst = {
  1789. ACT_PROB : 'mxgraph.sysml.actProb'
  1790. };
  1791. /**
  1792. * Function: paintVertexShape
  1793. *
  1794. * Paints the vertex shape.
  1795. */
  1796. mxShapeSysMLActivityProbability.prototype.paintVertexShape = function(c, x, y, w, h)
  1797. {
  1798. c.translate(x, y);
  1799. c.begin();
  1800. c.rect(0, 0, w - 10, h);
  1801. c.fillAndStroke();
  1802. var xSize = 40;
  1803. var ySize = 20;
  1804. xSize = Math.min(xSize, w);
  1805. if (xSize > ySize)
  1806. {
  1807. c.begin();
  1808. c.moveTo(0, ySize);
  1809. c.lineTo(xSize - ySize * 0.5, ySize);
  1810. c.lineTo(xSize, ySize * 0.5);
  1811. c.lineTo(xSize, 0);
  1812. c.lineTo(0, 0);
  1813. c.close();
  1814. c.fillAndStroke();
  1815. }
  1816. c.setShadow(false);
  1817. if (h > 70)
  1818. {
  1819. c.rect(w - 15, h * 0.25 - 28, 15, 56);
  1820. c.fillAndStroke();
  1821. c.rect(w - 19, h * 0.25 - 24, 15, 20);
  1822. c.fillAndStroke();
  1823. c.rect(w - 19, h * 0.25 + 4, 15, 20);
  1824. c.fillAndStroke();
  1825. c.rect(w - 15, h * 0.75 - 28, 15, 56);
  1826. c.fillAndStroke();
  1827. c.rect(w - 19, h * 0.75 - 24, 15, 20);
  1828. c.fillAndStroke();
  1829. c.rect(w - 19, h * 0.75 + 4, 15, 20);
  1830. c.fillAndStroke();
  1831. }
  1832. };
  1833. mxCellRenderer.registerShape(mxShapeSysMLActivityProbability.prototype.cst.ACT_PROB, mxShapeSysMLActivityProbability);
  1834. mxShapeSysMLActivityProbability.prototype.getConstraints = function(style, w, h)
  1835. {
  1836. var constr = [];
  1837. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.25), false));
  1838. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  1839. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.75), false));
  1840. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false, null, 0, -14));
  1841. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false, null, 0, 14));
  1842. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false));
  1843. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false, null, 0, -14));
  1844. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false));
  1845. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false, null, 0, 14));
  1846. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false, null, -5, 0));
  1847. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false, null, -5, 0));
  1848. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false, null, -5, 0));
  1849. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false, null, -5, 0));
  1850. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false, null, -5, 0));
  1851. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false, null, -5, 0));
  1852. return (constr);
  1853. };
  1854. //**********************************************************************************************************************************************************
  1855. //Object Flow Right
  1856. //**********************************************************************************************************************************************************
  1857. /**
  1858. * Extends mxShape.
  1859. */
  1860. function mxShapeSysMLObjectFlowRight(bounds, fill, stroke, strokewidth)
  1861. {
  1862. mxShape.call(this);
  1863. this.bounds = bounds;
  1864. this.fill = fill;
  1865. this.stroke = stroke;
  1866. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1867. };
  1868. /**
  1869. * Extends mxShape.
  1870. */
  1871. mxUtils.extend(mxShapeSysMLObjectFlowRight, mxShape);
  1872. mxShapeSysMLObjectFlowRight.prototype.cst = {
  1873. OBJ_FLOW_R : 'mxgraph.sysml.objFlowR'
  1874. };
  1875. /**
  1876. * Function: paintVertexShape
  1877. *
  1878. * Paints the vertex shape.
  1879. */
  1880. mxShapeSysMLObjectFlowRight.prototype.paintVertexShape = function(c, x, y, w, h)
  1881. {
  1882. c.translate(x, y);
  1883. c.roundrect(0, 0, w - 10, h, 10, 10);
  1884. c.fillAndStroke();
  1885. c.rect(w - 10, h * 0.5 - 10, 10, 20);
  1886. c.fillAndStroke();
  1887. };
  1888. mxCellRenderer.registerShape(mxShapeSysMLObjectFlowRight.prototype.cst.OBJ_FLOW_R, mxShapeSysMLObjectFlowRight);
  1889. mxShapeSysMLObjectFlowRight.prototype.getConstraints = function(style, w, h)
  1890. {
  1891. var constr = [];
  1892. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  1893. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  1894. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false, null, -5, 0));
  1895. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false, null, -5, 0));
  1896. return (constr);
  1897. };
  1898. //**********************************************************************************************************************************************************
  1899. //Object Flow Left
  1900. //**********************************************************************************************************************************************************
  1901. /**
  1902. * Extends mxShape.
  1903. */
  1904. function mxShapeSysMLObjectFlowLeft(bounds, fill, stroke, strokewidth)
  1905. {
  1906. mxShape.call(this);
  1907. this.bounds = bounds;
  1908. this.fill = fill;
  1909. this.stroke = stroke;
  1910. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1911. };
  1912. /**
  1913. * Extends mxShape.
  1914. */
  1915. mxUtils.extend(mxShapeSysMLObjectFlowLeft, mxShape);
  1916. mxShapeSysMLObjectFlowLeft.prototype.cst = {
  1917. OBJ_FLOW_L : 'mxgraph.sysml.objFlowL'
  1918. };
  1919. /**
  1920. * Function: paintVertexShape
  1921. *
  1922. * Paints the vertex shape.
  1923. */
  1924. mxShapeSysMLObjectFlowLeft.prototype.paintVertexShape = function(c, x, y, w, h)
  1925. {
  1926. c.translate(x, y);
  1927. c.rect(0, h * 0.5 - 10, 10, 20);
  1928. c.fillAndStroke();
  1929. c.roundrect(10, 0, w - 10, h, 10, 10);
  1930. c.fillAndStroke();
  1931. };
  1932. mxCellRenderer.registerShape(mxShapeSysMLObjectFlowLeft.prototype.cst.OBJ_FLOW_L, mxShapeSysMLObjectFlowLeft);
  1933. mxShapeSysMLObjectFlowLeft.prototype.getConstraints = function(style, w, h)
  1934. {
  1935. var constr = [];
  1936. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  1937. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  1938. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false, null, 5, 0));
  1939. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false, null, 5, 0));
  1940. return (constr);
  1941. };
  1942. //**********************************************************************************************************************************************************
  1943. //Activity Partition
  1944. //**********************************************************************************************************************************************************
  1945. /**
  1946. * Extends mxShape.
  1947. */
  1948. function mxShapeSysMLActivityPartition(bounds, fill, stroke, strokewidth)
  1949. {
  1950. mxShape.call(this);
  1951. this.bounds = bounds;
  1952. this.fill = fill;
  1953. this.stroke = stroke;
  1954. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1955. };
  1956. /**
  1957. * Extends mxShape.
  1958. */
  1959. mxUtils.extend(mxShapeSysMLActivityPartition, mxShape);
  1960. mxShapeSysMLActivityPartition.prototype.cst = {
  1961. ACT_PART : 'mxgraph.sysml.actPart'
  1962. };
  1963. /**
  1964. * Function: paintVertexShape
  1965. *
  1966. * Paints the vertex shape.
  1967. */
  1968. mxShapeSysMLActivityPartition.prototype.paintVertexShape = function(c, x, y, w, h)
  1969. {
  1970. c.translate(x, y);
  1971. c.begin();
  1972. c.moveTo(0, 0);
  1973. c.lineTo(0, h);
  1974. c.moveTo(w, 0);
  1975. c.lineTo(w, h);
  1976. c.stroke();
  1977. };
  1978. mxCellRenderer.registerShape(mxShapeSysMLActivityPartition.prototype.cst.ACT_PART, mxShapeSysMLActivityPartition);
  1979. //**********************************************************************************************************************************************************
  1980. //Continuation
  1981. //**********************************************************************************************************************************************************
  1982. /**
  1983. * Extends mxShape.
  1984. */
  1985. function mxShapeSysMLContinuation(bounds, fill, stroke, strokewidth)
  1986. {
  1987. mxShape.call(this);
  1988. this.bounds = bounds;
  1989. this.fill = fill;
  1990. this.stroke = stroke;
  1991. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1992. };
  1993. /**
  1994. * Extends mxShape.
  1995. */
  1996. mxUtils.extend(mxShapeSysMLContinuation, mxShape);
  1997. mxShapeSysMLContinuation.prototype.cst = {
  1998. CONT : 'mxgraph.sysml.cont'
  1999. };
  2000. /**
  2001. * Function: paintVertexShape
  2002. *
  2003. * Paints the vertex shape.
  2004. */
  2005. mxShapeSysMLContinuation.prototype.paintVertexShape = function(c, x, y, w, h)
  2006. {
  2007. c.translate(x, y);
  2008. if (w > h)
  2009. {
  2010. var r = h * 0.5;
  2011. c.begin();
  2012. c.moveTo(w - r, 0);
  2013. c.arcTo(r, r, 0, 0, 1, w - r, h);
  2014. c.lineTo(r, h);
  2015. c.arcTo(r, r, 0, 0, 1, r, 0);
  2016. c.close();
  2017. c.fillAndStroke();
  2018. }
  2019. else
  2020. {
  2021. var r = w * 0.5;
  2022. c.begin();
  2023. c.moveTo(0, h - r);
  2024. c.arcTo(r, r, 0, 0, 0, w, h - r);
  2025. c.lineTo(w, r);
  2026. c.arcTo(r, r, 0, 0, 0, 0, r);
  2027. c.close();
  2028. c.fillAndStroke();
  2029. }
  2030. };
  2031. mxCellRenderer.registerShape(mxShapeSysMLContinuation.prototype.cst.CONT, mxShapeSysMLContinuation);
  2032. mxShapeSysMLContinuation.prototype.getConstraints = function(style, w, h)
  2033. {
  2034. var constr = [];
  2035. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  2036. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  2037. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
  2038. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
  2039. if (w > h)
  2040. {
  2041. var r = h * 0.5;
  2042. if (w > 2 * h)
  2043. {
  2044. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));
  2045. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));
  2046. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));
  2047. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));
  2048. }
  2049. }
  2050. else
  2051. {
  2052. var r = w * 0.5;
  2053. if (h > 2 * w)
  2054. {
  2055. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.25), false));
  2056. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.75), false));
  2057. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false));
  2058. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false));
  2059. }
  2060. }
  2061. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, r * 0.29, r * 0.29));
  2062. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - r * 0.29, r * 0.29));
  2063. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, r * 0.29, h - r * 0.29));
  2064. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - r * 0.29, h - r * 0.29));
  2065. return (constr);
  2066. };
  2067. //**********************************************************************************************************************************************************
  2068. //Coregion
  2069. //**********************************************************************************************************************************************************
  2070. /**
  2071. * Extends mxShape.
  2072. */
  2073. function mxShapeSysMLCoregion(bounds, fill, stroke, strokewidth)
  2074. {
  2075. mxShape.call(this);
  2076. this.bounds = bounds;
  2077. this.fill = fill;
  2078. this.stroke = stroke;
  2079. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  2080. };
  2081. /**
  2082. * Extends mxShape.
  2083. */
  2084. mxUtils.extend(mxShapeSysMLCoregion, mxShape);
  2085. mxShapeSysMLCoregion.prototype.cst = {
  2086. COREGION : 'mxgraph.sysml.coregion'
  2087. };
  2088. /**
  2089. * Function: paintVertexShape
  2090. *
  2091. * Paints the vertex shape.
  2092. */
  2093. mxShapeSysMLCoregion.prototype.paintVertexShape = function(c, x, y, w, h)
  2094. {
  2095. c.translate(x, y);
  2096. var brack = 10;
  2097. brack = Math.min(brack, h);
  2098. c.begin();
  2099. c.moveTo(0, brack);
  2100. c.lineTo(0, 0);
  2101. c.lineTo(w, 0);
  2102. c.lineTo(w, brack);
  2103. c.moveTo(0, h - brack);
  2104. c.lineTo(0, h);
  2105. c.lineTo(w, h);
  2106. c.lineTo(w, h - brack);
  2107. c.stroke();
  2108. };
  2109. mxCellRenderer.registerShape(mxShapeSysMLCoregion.prototype.cst.COREGION, mxShapeSysMLCoregion);
  2110. //**********************************************************************************************************************************************************
  2111. //X marker
  2112. //**********************************************************************************************************************************************************
  2113. mxMarker.addMarker('sysMLx', function(c, shape, type, pe, unitX, unitY, size, source, sw, filled)
  2114. {
  2115. var nx = unitX * (size + sw + 1);
  2116. var ny = unitY * (size + sw + 1);
  2117. return function()
  2118. {
  2119. c.begin();
  2120. c.moveTo(pe.x - nx / 2 - ny / 2, pe.y - ny / 2 + nx / 2);
  2121. c.lineTo(pe.x + nx / 2 + ny / 2, pe.y + ny / 2 - nx / 2);
  2122. c.moveTo(pe.x + nx / 2 - ny / 2, pe.y + ny / 2 + nx / 2);
  2123. c.lineTo(pe.x - nx / 2 + ny / 2, pe.y - ny / 2 - nx / 2);
  2124. c.stroke();
  2125. };
  2126. });
  2127. //**********************************************************************************************************************************************************
  2128. //Dimension
  2129. //**********************************************************************************************************************************************************
  2130. /**
  2131. * Extends mxShape.
  2132. */
  2133. function mxShapeSysMLDimension(bounds, fill, stroke, strokewidth)
  2134. {
  2135. mxShape.call(this);
  2136. this.bounds = bounds;
  2137. this.fill = fill;
  2138. this.stroke = stroke;
  2139. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  2140. };
  2141. /**
  2142. * Extends mxShape.
  2143. */
  2144. mxUtils.extend(mxShapeSysMLDimension, mxShape);
  2145. mxShapeSysMLDimension.prototype.cst = {
  2146. DIMENSION : 'mxgraph.sysml.dimension'
  2147. };
  2148. /**
  2149. * Function: paintVertexShape
  2150. *
  2151. * Paints the vertex shape.
  2152. */
  2153. mxShapeSysMLDimension.prototype.paintVertexShape = function(c, x, y, w, h)
  2154. {
  2155. c.translate(x, y);
  2156. this.background(c, x, y, w, h);
  2157. };
  2158. mxShapeSysMLDimension.prototype.background = function(c, x, y, w, h)
  2159. {
  2160. c.begin();
  2161. c.moveTo(0, 20);
  2162. c.lineTo(w, 20);
  2163. c.moveTo(10, 15);
  2164. c.lineTo(0, 20);
  2165. c.lineTo(10, 25);
  2166. c.moveTo(w - 10, 15);
  2167. c.lineTo(w, 20);
  2168. c.lineTo(w - 10, 25);
  2169. c.moveTo(0, 15);
  2170. c.lineTo(0, h);
  2171. c.moveTo(w, 15);
  2172. c.lineTo(w, h);
  2173. c.stroke();
  2174. };
  2175. mxCellRenderer.registerShape(mxShapeSysMLDimension.prototype.cst.DIMENSION, mxShapeSysMLDimension);
  2176. //**********************************************************************************************************************************************************
  2177. //Lost marker
  2178. //**********************************************************************************************************************************************************
  2179. mxMarker.addMarker('sysMLLost', function(c, shape, type, pe, unitX, unitY, size, source, sw, filled)
  2180. {
  2181. var nx = unitX * (size + sw + 1);
  2182. var ny = unitY * (size + sw + 1);
  2183. var a = size / 2;
  2184. return function()
  2185. {
  2186. c.begin();
  2187. c.moveTo(pe.x - 1.5 * nx - ny / 2, pe.y - 1.5 * ny + nx / 2);
  2188. c.lineTo(pe.x - nx / 2, pe.y - ny / 2);
  2189. c.lineTo(pe.x - 1.5 * nx + ny / 2, pe.y - 1.5 * ny - nx / 2);
  2190. c.stroke();
  2191. c.ellipse(pe.x - 0.5 * nx - a, pe.y - 0.5 * ny - a, 2 * a, 2 * a);
  2192. var strokeColor = mxUtils.getValue(shape.style, mxConstants.STYLE_STROKECOLOR, '#000000');
  2193. c.setFillColor(strokeColor);
  2194. c.fillAndStroke();
  2195. };
  2196. });
  2197. //**********************************************************************************************************************************************************
  2198. //Found marker
  2199. //**********************************************************************************************************************************************************
  2200. mxMarker.addMarker('sysMLFound', function(c, shape, type, pe, unitX, unitY, size, source, sw, filled)
  2201. {
  2202. var nx = unitX * (size + sw + 1);
  2203. var ny = unitY * (size + sw + 1);
  2204. var a = size / 2;
  2205. return function()
  2206. {
  2207. c.ellipse(pe.x - 0.5 * nx - a, pe.y - 0.5 * ny - a, 2 * a, 2 * a);
  2208. var strokeColor = mxUtils.getValue(shape.style, mxConstants.STYLE_STROKECOLOR, '#000000');
  2209. c.setFillColor(strokeColor);
  2210. c.fillAndStroke();
  2211. };
  2212. });
  2213. //**********************************************************************************************************************************************************
  2214. //Composite State
  2215. //**********************************************************************************************************************************************************
  2216. /**
  2217. * Extends mxShape.
  2218. */
  2219. function mxShapeSysMLCompositeState(bounds, fill, stroke, strokewidth)
  2220. {
  2221. mxShape.call(this);
  2222. this.bounds = bounds;
  2223. this.fill = fill;
  2224. this.stroke = stroke;
  2225. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  2226. };
  2227. /**
  2228. * Extends mxShape.
  2229. */
  2230. mxUtils.extend(mxShapeSysMLCompositeState, mxShape);
  2231. mxShapeSysMLCompositeState.prototype.cst = {
  2232. COMP_STATE : 'mxgraph.sysml.compState'
  2233. };
  2234. /**
  2235. * Function: paintVertexShape
  2236. *
  2237. * Paints the vertex shape.
  2238. */
  2239. mxShapeSysMLCompositeState.prototype.paintVertexShape = function(c, x, y, w, h)
  2240. {
  2241. c.translate(x, y);
  2242. this.background(c, x, y, w, h);
  2243. };
  2244. mxShapeSysMLCompositeState.prototype.background = function(c, x, y, w, h)
  2245. {
  2246. var tabH = 20;
  2247. var tabW = 110;
  2248. c.roundrect(0, tabH, w, h - tabH, 10, 10);
  2249. c.fillAndStroke();
  2250. c.rect(15, 0, tabW, tabH);
  2251. c.fillAndStroke();
  2252. };
  2253. mxCellRenderer.registerShape(mxShapeSysMLCompositeState.prototype.cst.COMP_STATE, mxShapeSysMLCompositeState);
  2254. mxShapeSysMLCompositeState.prototype.getConstraints = function(style, w, h)
  2255. {
  2256. var constr = [];
  2257. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 2.9, 22.9));
  2258. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - 2.9, 22.9));
  2259. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 2.9, h - 2.9));
  2260. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - 2.9, h - 2.9));
  2261. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, (h - 20) * 0.25 + 20));
  2262. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, (h - 20) * 0.5 + 20));
  2263. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, (h - 20) * 0.75 + 20));
  2264. constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false, null, 0, (h - 20) * 0.25 + 20));
  2265. constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false, null, 0, (h - 20) * 0.5 + 20));
  2266. constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false, null, 0, (h - 20) * 0.75 + 20));
  2267. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));
  2268. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
  2269. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));
  2270. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 15, 0));
  2271. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 70, 0));
  2272. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 125, 0));
  2273. if (w * 0.75 > 125)
  2274. {
  2275. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false, null, 0, 20));
  2276. if (w * 0.5 > 125)
  2277. {
  2278. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false, null, 0, 20));
  2279. if (w * 0.25 > 125)
  2280. {
  2281. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false, null, 0, 20));
  2282. }
  2283. }
  2284. }
  2285. return (constr);
  2286. };
  2287. //**********************************************************************************************************************************************************
  2288. //Region
  2289. //**********************************************************************************************************************************************************
  2290. /**
  2291. * Extends mxShape.
  2292. */
  2293. function mxShapeSysMLRegion(bounds, fill, stroke, strokewidth)
  2294. {
  2295. mxShape.call(this);
  2296. this.bounds = bounds;
  2297. this.fill = fill;
  2298. this.stroke = stroke;
  2299. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  2300. };
  2301. /**
  2302. * Extends mxShape.
  2303. */
  2304. mxUtils.extend(mxShapeSysMLRegion, mxShape);
  2305. mxShapeSysMLRegion.prototype.cst = {
  2306. REGION : 'mxgraph.sysml.region'
  2307. };
  2308. /**
  2309. * Function: paintVertexShape
  2310. *
  2311. * Paints the vertex shape.
  2312. */
  2313. mxShapeSysMLRegion.prototype.paintVertexShape = function(c, x, y, w, h)
  2314. {
  2315. var tabH = 20;
  2316. var tabW = 50;
  2317. c.translate(x, y);
  2318. this.background(c, x, y, w, h, tabH, tabW);
  2319. c.setShadow(false);
  2320. this.foreground(c, x, y, w, h, tabH, tabW);
  2321. };
  2322. mxShapeSysMLRegion.prototype.background = function(c, x, y, w, h, tabH, tabW)
  2323. {
  2324. var strokeW = parseInt(mxUtils.getValue(this.style, mxConstants.STYLE_STROKEWIDTH, '1'));
  2325. c.roundrect(0, tabH, w, h - tabH, 10, 10);
  2326. c.fillAndStroke();
  2327. c.setStrokeWidth(strokeW * 2);
  2328. c.rect(15, 0, tabW, tabH);
  2329. c.fillAndStroke();
  2330. c.setStrokeWidth(strokeW);
  2331. };
  2332. mxShapeSysMLRegion.prototype.foreground = function(c, x, y, w, h, tabH, tabW)
  2333. {
  2334. c.setDashed(true);
  2335. c.begin();
  2336. c.moveTo(w * 0.5, tabH);
  2337. c.lineTo(w * 0.5, h);
  2338. c.stroke();
  2339. };
  2340. mxCellRenderer.registerShape(mxShapeSysMLRegion.prototype.cst.REGION, mxShapeSysMLRegion);
  2341. mxShapeSysMLRegion.prototype.getConstraints = function(style, w, h)
  2342. {
  2343. var constr = [];
  2344. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 2.9, 22.9));
  2345. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - 2.9, 22.9));
  2346. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 2.9, h - 2.9));
  2347. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - 2.9, h - 2.9));
  2348. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, (h - 20) * 0.25 + 20));
  2349. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, (h - 20) * 0.5 + 20));
  2350. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, (h - 20) * 0.75 + 20));
  2351. constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false, null, 0, (h - 20) * 0.25 + 20));
  2352. constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false, null, 0, (h - 20) * 0.5 + 20));
  2353. constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false, null, 0, (h - 20) * 0.75 + 20));
  2354. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));
  2355. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
  2356. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));
  2357. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 15, 0));
  2358. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 40, 0));
  2359. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 65, 0));
  2360. if (w * 0.75 > 65)
  2361. {
  2362. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false, null, 0, 20));
  2363. if (w * 0.5 > 65)
  2364. {
  2365. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false, null, 0, 20));
  2366. if (w * 0.25 > 65)
  2367. {
  2368. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false, null, 0, 20));
  2369. }
  2370. }
  2371. }
  2372. return (constr);
  2373. };
  2374. //**********************************************************************************************************************************************************
  2375. //Simple State
  2376. //**********************************************************************************************************************************************************
  2377. /**
  2378. * Extends mxShape.
  2379. */
  2380. function mxShapeSysMLSimpleState(bounds, fill, stroke, strokewidth)
  2381. {
  2382. mxShape.call(this);
  2383. this.bounds = bounds;
  2384. this.fill = fill;
  2385. this.stroke = stroke;
  2386. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  2387. };
  2388. /**
  2389. * Extends mxShape.
  2390. */
  2391. mxUtils.extend(mxShapeSysMLSimpleState, mxShape);
  2392. mxShapeSysMLSimpleState.prototype.cst = {
  2393. SIMPLE_STATE : 'mxgraph.sysml.simpleState'
  2394. };
  2395. /**
  2396. * Function: paintVertexShape
  2397. *
  2398. * Paints the vertex shape.
  2399. */
  2400. mxShapeSysMLSimpleState.prototype.paintVertexShape = function(c, x, y, w, h)
  2401. {
  2402. c.translate(x, y);
  2403. this.background(c, x, y, w, h);
  2404. c.setShadow(false);
  2405. // this.foreground(c, x, y, w, h);
  2406. };
  2407. mxShapeSysMLSimpleState.prototype.background = function(c, x, y, w, h)
  2408. {
  2409. var strokeW = parseInt(mxUtils.getValue(this.style, mxConstants.STYLE_STROKEWIDTH, '1'));
  2410. c.roundrect(0, 0, w, h, 10, 10);
  2411. c.fillAndStroke();
  2412. };
  2413. mxShapeSysMLSimpleState.prototype.foreground = function(c, x, y, w, h)
  2414. {
  2415. c.begin();
  2416. c.moveTo(0, 20);
  2417. c.lineTo(w, 20);
  2418. c.stroke();
  2419. };
  2420. mxCellRenderer.registerShape(mxShapeSysMLSimpleState.prototype.cst.SIMPLE_STATE, mxShapeSysMLSimpleState);
  2421. mxShapeSysMLSimpleState.prototype.getConstraints = function(style, w, h)
  2422. {
  2423. var constr = [];
  2424. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 2.9, 2.9));
  2425. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - 2.9, 2.9));
  2426. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 2.9, h - 2.9));
  2427. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - 2.9, h - 2.9));
  2428. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));
  2429. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
  2430. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));
  2431. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));
  2432. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
  2433. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));
  2434. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false));
  2435. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  2436. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false));
  2437. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.25), false));
  2438. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  2439. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.75), false));
  2440. return (constr);
  2441. };
  2442. //**********************************************************************************************************************************************************
  2443. //State Machine
  2444. //**********************************************************************************************************************************************************
  2445. /**
  2446. * Extends mxShape.
  2447. */
  2448. function mxShapeSysMLStateMachine(bounds, fill, stroke, strokewidth)
  2449. {
  2450. mxShape.call(this);
  2451. this.bounds = bounds;
  2452. this.fill = fill;
  2453. this.stroke = stroke;
  2454. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  2455. };
  2456. /**
  2457. * Extends mxShape.
  2458. */
  2459. mxUtils.extend(mxShapeSysMLStateMachine, mxShape);
  2460. mxShapeSysMLStateMachine.prototype.cst = {
  2461. STATE_MACHINE : 'mxgraph.sysml.stateMachine'
  2462. };
  2463. /**
  2464. * Function: paintVertexShape
  2465. *
  2466. * Paints the vertex shape.
  2467. */
  2468. mxShapeSysMLStateMachine.prototype.paintVertexShape = function(c, x, y, w, h)
  2469. {
  2470. c.translate(x, y);
  2471. this.background(c, x, y, w, h);
  2472. c.setShadow(false);
  2473. this.foreground(c, x, y, w, h);
  2474. };
  2475. mxShapeSysMLStateMachine.prototype.background = function(c, x, y, w, h)
  2476. {
  2477. c.roundrect(0, 0, w - 10, h, 10, 10);
  2478. c.fillAndStroke();
  2479. };
  2480. mxShapeSysMLStateMachine.prototype.foreground = function(c, x, y, w, h)
  2481. {
  2482. var strokeC = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#000000');
  2483. c.setFillColor(strokeC);
  2484. c.ellipse(w - 20, h * 0.5 - 10, 20, 20);
  2485. c.stroke();
  2486. c.ellipse(w - 17, h * 0.5 - 7, 14, 14);
  2487. c.fillAndStroke();
  2488. };
  2489. mxCellRenderer.registerShape(mxShapeSysMLStateMachine.prototype.cst.STATE_MACHINE, mxShapeSysMLStateMachine);
  2490. mxShapeSysMLStateMachine.prototype.getConstraints = function(style, w, h)
  2491. {
  2492. var constr = [];
  2493. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 2.9, 2.9));
  2494. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - 12.9, 2.9));
  2495. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 2.9, h - 2.9));
  2496. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - 12.9, h - 2.9));
  2497. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));
  2498. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
  2499. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));
  2500. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));
  2501. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
  2502. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));
  2503. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false, null, -10, 0));
  2504. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  2505. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false, null, -10, 0));
  2506. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.25), false));
  2507. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  2508. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.75), false));
  2509. return (constr);
  2510. };
  2511. //**********************************************************************************************************************************************************
  2512. // X
  2513. //**********************************************************************************************************************************************************
  2514. /**
  2515. * Extends mxShape.
  2516. */
  2517. function mxShapeSysMLX(bounds, fill, stroke, strokewidth)
  2518. {
  2519. mxShape.call(this);
  2520. this.bounds = bounds;
  2521. this.fill = fill;
  2522. this.stroke = stroke;
  2523. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  2524. };
  2525. /**
  2526. * Extends mxShape.
  2527. */
  2528. mxUtils.extend(mxShapeSysMLX, mxShape);
  2529. mxShapeSysMLX.prototype.cst = {
  2530. X : 'mxgraph.sysml.x'
  2531. };
  2532. /**
  2533. * Function: paintVertexShape
  2534. *
  2535. * Paints the vertex shape.
  2536. */
  2537. mxShapeSysMLX.prototype.paintVertexShape = function(c, x, y, w, h)
  2538. {
  2539. c.translate(x, y);
  2540. c.begin();
  2541. c.moveTo(0, 0);
  2542. c.lineTo(w, h);
  2543. c.moveTo(0, h);
  2544. c.lineTo(w, 0);
  2545. c.fillAndStroke();
  2546. };
  2547. mxCellRenderer.registerShape(mxShapeSysMLX.prototype.cst.X, mxShapeSysMLX);
  2548. mxShapeSysMLX.prototype.getConstraints = function(style, w, h)
  2549. {
  2550. var constr = [];
  2551. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false));
  2552. constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));
  2553. constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));
  2554. constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false));
  2555. return (constr);
  2556. };
  2557. //**********************************************************************************************************************************************************
  2558. //Submachine State
  2559. //**********************************************************************************************************************************************************
  2560. /**
  2561. * Extends mxShape.
  2562. */
  2563. function mxShapeSysMLSubmachineState(bounds, fill, stroke, strokewidth)
  2564. {
  2565. mxShape.call(this);
  2566. this.bounds = bounds;
  2567. this.fill = fill;
  2568. this.stroke = stroke;
  2569. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  2570. };
  2571. /**
  2572. * Extends mxShape.
  2573. */
  2574. mxUtils.extend(mxShapeSysMLSubmachineState, mxShape);
  2575. mxShapeSysMLSubmachineState.prototype.cst = {
  2576. SUBMACHINE_STATE : 'mxgraph.sysml.submState'
  2577. };
  2578. /**
  2579. * Function: paintVertexShape
  2580. *
  2581. * Paints the vertex shape.
  2582. */
  2583. mxShapeSysMLSubmachineState.prototype.paintVertexShape = function(c, x, y, w, h)
  2584. {
  2585. c.translate(x, y);
  2586. this.background(c, x, y, w, h);
  2587. c.setShadow(false);
  2588. this.foreground(c, x, y, w, h);
  2589. };
  2590. mxShapeSysMLSubmachineState.prototype.background = function(c, x, y, w, h)
  2591. {
  2592. c.roundrect(0, 0, w - 10, h, 10, 10);
  2593. c.fillAndStroke();
  2594. };
  2595. mxShapeSysMLSubmachineState.prototype.foreground = function(c, x, y, w, h)
  2596. {
  2597. var strokeC = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#000000');
  2598. c.setFillColor(strokeC);
  2599. c.ellipse(w - 20, h * 0.5 - 10, 20, 20);
  2600. c.stroke();
  2601. c.ellipse(w - 17, h * 0.5 - 7, 14, 14);
  2602. c.fillAndStroke();
  2603. };
  2604. mxCellRenderer.registerShape(mxShapeSysMLSubmachineState.prototype.cst.SUBMACHINE_STATE, mxShapeSysMLSubmachineState);
  2605. mxShapeSysMLSubmachineState.prototype.getConstraints = function(style, w, h)
  2606. {
  2607. var constr = [];
  2608. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 2.9, 2.9));
  2609. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - 12.9, 2.9));
  2610. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 2.9, h - 2.9));
  2611. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - 12.9, h - 2.9));
  2612. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));
  2613. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
  2614. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));
  2615. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));
  2616. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
  2617. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));
  2618. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false, null, -10, 0));
  2619. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  2620. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false, null, -10, 0));
  2621. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.25), false));
  2622. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  2623. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.75), false));
  2624. return (constr);
  2625. };
  2626. //**********************************************************************************************************************************************************
  2627. //Use Case with Extension Points
  2628. //**********************************************************************************************************************************************************
  2629. /**
  2630. * Extends mxShape.
  2631. */
  2632. function mxShapeSysMLUseCaseExtensionPoints(bounds, fill, stroke, strokewidth)
  2633. {
  2634. mxShape.call(this);
  2635. this.bounds = bounds;
  2636. this.fill = fill;
  2637. this.stroke = stroke;
  2638. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  2639. };
  2640. /**
  2641. * Extends mxShape.
  2642. */
  2643. mxUtils.extend(mxShapeSysMLUseCaseExtensionPoints, mxShape);
  2644. mxShapeSysMLUseCaseExtensionPoints.prototype.cst = {
  2645. USE_CASE_EXT_PT : 'mxgraph.sysml.useCaseExtPt'
  2646. };
  2647. /**
  2648. * Function: paintVertexShape
  2649. *
  2650. * Paints the vertex shape.
  2651. */
  2652. mxShapeSysMLUseCaseExtensionPoints.prototype.paintVertexShape = function(c, x, y, w, h)
  2653. {
  2654. c.translate(x, y);
  2655. this.background(c, x, y, w, h);
  2656. c.setShadow(false);
  2657. this.foreground(c, x, y, w, h);
  2658. };
  2659. mxShapeSysMLUseCaseExtensionPoints.prototype.background = function(c, x, y, w, h)
  2660. {
  2661. c.ellipse(0, 0, w, h);
  2662. c.fillAndStroke();
  2663. };
  2664. mxShapeSysMLUseCaseExtensionPoints.prototype.foreground = function(c, x, y, w, h)
  2665. {
  2666. c.begin();
  2667. c.moveTo(w * 0.02, h * 0.35);
  2668. c.lineTo(w * 0.98, h * 0.35);
  2669. c.stroke();
  2670. };
  2671. mxCellRenderer.registerShape(mxShapeSysMLUseCaseExtensionPoints.prototype.cst.USE_CASE_EXT_PT, mxShapeSysMLUseCaseExtensionPoints);
  2672. mxShapeSysMLUseCaseExtensionPoints.prototype.getConstraints = function(style, w, h)
  2673. {
  2674. var constr = [];
  2675. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  2676. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  2677. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
  2678. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
  2679. constr.push(new mxConnectionConstraint(new mxPoint(0.145, 0.145), false));
  2680. constr.push(new mxConnectionConstraint(new mxPoint(0.145, 0.855), false));
  2681. constr.push(new mxConnectionConstraint(new mxPoint(0.855, 0.855), false));
  2682. constr.push(new mxConnectionConstraint(new mxPoint(0.855, 0.145), false));
  2683. return (constr);
  2684. };
  2685. //**********************************************************************************************************************************************************
  2686. //Port
  2687. //**********************************************************************************************************************************************************
  2688. /**
  2689. * Extends mxShape.
  2690. */
  2691. function mxShapeSysMLPort(bounds, fill, stroke, strokewidth)
  2692. {
  2693. mxShape.call(this);
  2694. this.bounds = bounds;
  2695. this.fill = fill;
  2696. this.stroke = stroke;
  2697. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  2698. };
  2699. /**
  2700. * Extends mxShape.
  2701. */
  2702. mxUtils.extend(mxShapeSysMLPort, mxShape);
  2703. mxShapeSysMLPort.prototype.cst = {
  2704. PORT : 'mxgraph.sysml.port'
  2705. };
  2706. mxShapeSysMLPort.prototype.customProperties = [
  2707. {name: 'sysMLPortType', dispName: 'Port Type', type: 'enum',
  2708. enumList:[
  2709. {val:'empty', dispName:'Empty'},
  2710. {val:'flowN', dispName:'Flow Up'},
  2711. {val:'flowE', dispName:'Flow Right'},
  2712. {val:'flowS', dispName:'Flow Down'},
  2713. {val:'flowW', dispName:'Flow Left'},
  2714. {val:'doubleH', dispName:'Double Horizontal'},
  2715. {val:'doubleV', dispName:'Double Vertical'}
  2716. ]}
  2717. ];
  2718. /**
  2719. * Function: paintVertexShape
  2720. *
  2721. * Paints the vertex shape.
  2722. */
  2723. mxShapeSysMLPort.prototype.paintVertexShape = function(c, x, y, w, h)
  2724. {
  2725. c.translate(x, y);
  2726. c.rect(0, 0, w, h);
  2727. c.fillAndStroke();
  2728. var portType = mxUtils.getValue(this.style, 'sysMLPortType', 'empty');
  2729. switch (portType)
  2730. {
  2731. case 'flowN' :
  2732. c.begin();
  2733. c.moveTo(0.25 * w, 0.5 * h);
  2734. c.lineTo(0.5 * w, 0.25 * h);
  2735. c.lineTo(0.75 * w, 0.5 * h);
  2736. c.moveTo(0.5 * w, 0.25 * h);
  2737. c.lineTo(0.5 * w, 0.75 * h);
  2738. c.stroke();
  2739. break;
  2740. case 'flowE' :
  2741. c.begin();
  2742. c.moveTo(0.5 * w, 0.25 * h);
  2743. c.lineTo(0.75 * w, 0.5 * h);
  2744. c.lineTo(0.5 * w, 0.75 * h);
  2745. c.moveTo(0.75 * w, 0.5 * h);
  2746. c.lineTo(0.25 * w, 0.5 * h);
  2747. c.stroke();
  2748. break;
  2749. case 'flowS' :
  2750. c.begin();
  2751. c.moveTo(0.25 * w, 0.5 * h);
  2752. c.lineTo(0.5 * w, 0.75 * h);
  2753. c.lineTo(0.75 * w, 0.5 * h);
  2754. c.moveTo(0.5 * w, 0.75 * h);
  2755. c.lineTo(0.5 * w, 0.25 * h);
  2756. c.stroke();
  2757. break;
  2758. case 'flowW' :
  2759. c.begin();
  2760. c.moveTo(0.5 * w, 0.25 * h);
  2761. c.lineTo(0.25 * w, 0.5 * h);
  2762. c.lineTo(0.5 * w, 0.75 * h);
  2763. c.moveTo(0.25 * w, 0.5 * h);
  2764. c.lineTo(0.75 * w, 0.5 * h);
  2765. c.stroke();
  2766. break;
  2767. case 'doubleH' :
  2768. c.begin();
  2769. c.moveTo(0.6 * w, 0.25 * h);
  2770. c.lineTo(0.85 * w, 0.5 * h);
  2771. c.lineTo(0.6 * w, 0.75 * h);
  2772. c.moveTo(0.4 * w, 0.25 * h);
  2773. c.lineTo(0.15 * w, 0.5 * h);
  2774. c.lineTo(0.4 * w, 0.75 * h);
  2775. c.stroke();
  2776. break;
  2777. case 'doubleV' :
  2778. c.begin();
  2779. c.moveTo(0.25 * w, 0.6 * h);
  2780. c.lineTo(0.5 * w, 0.85 * h);
  2781. c.lineTo(0.75 * w, 0.6 * h);
  2782. c.moveTo(0.25 * w, 0.4 * h);
  2783. c.lineTo(0.5 * w, 0.15 * h);
  2784. c.lineTo(0.75 * w, 0.4 * h);
  2785. c.stroke();
  2786. break;
  2787. }
  2788. };
  2789. mxCellRenderer.registerShape(mxShapeSysMLPort.prototype.cst.PORT, mxShapeSysMLPort);
  2790. mxShapeSysMLPort.prototype.getConstraints = function(style, w, h)
  2791. {
  2792. var constr = [];
  2793. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
  2794. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
  2795. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  2796. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  2797. return (constr);
  2798. };