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