mxSysML.js 98 KB

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