1/**2 * Copyright (c) 2006-2016, JGraph Holdings Ltd3 */45//**********************************************************************************************************************************************************6//Test Point7//**********************************************************************************************************************************************************8/**9* Extends mxShape.10*/11function mxShapeElectricalTestPoint(bounds, fill, stroke, strokewidth)12{13 mxShape.call(this);14 this.bounds = bounds;15 this.fill = fill;16 this.stroke = stroke;17 this.strokewidth = (strokewidth != null) ? strokewidth : 1;18};1920/**21* Extends mxShape.22*/23mxUtils.extend(mxShapeElectricalTestPoint, mxShape);2425mxShapeElectricalTestPoint.prototype.cst = {26 SHAPE_TEST_POINT : 'mxgraph.electrical.transmission.testPoint'27};2829/**30* Function: paintVertexShape31* 32* Paints the vertex shape.33*/34mxShapeElectricalTestPoint.prototype.paintVertexShape = function(c, x, y, w, h)35{36 c.translate(x, y);37 var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#000000');3839 var size = Math.min(w, h); 40 41 c.setFillColor(strokeColor);42 c.begin();43 c.ellipse(w * 0.5 - size / 2, 0, size, size);44 c.fillAndStroke();45 46 if (h > w)47 {48 c.begin();49 c.moveTo(w * 0.5, size);50 c.lineTo(w * 0.5, h);51 c.stroke();52 }53};5455mxCellRenderer.registerShape(mxShapeElectricalTestPoint.prototype.cst.SHAPE_TEST_POINT, mxShapeElectricalTestPoint);5657mxShapeElectricalTestPoint.prototype.constraints = [58 new mxConnectionConstraint(new mxPoint(0.5, 0), true),59 new mxConnectionConstraint(new mxPoint(0.5, 1), true)60 ];6162//**********************************************************************************************************************************************************63//Straight Bus64//**********************************************************************************************************************************************************65/**66* Extends mxShape.67*/68function mxShapeElectricalStraightBus(bounds, fill, stroke, strokewidth)69{70 mxShape.call(this);71 this.bounds = bounds;72 this.fill = fill;73 this.stroke = stroke;74 this.strokewidth = (strokewidth != null) ? strokewidth : 1;75};7677/**78* Extends mxShape.79*/80mxUtils.extend(mxShapeElectricalStraightBus, mxShape);8182mxShapeElectricalStraightBus.prototype.cst = {83 SHAPE_STRAIGHT_BUS : 'mxgraph.electrical.transmission.straightBus'84};85868788/**89* Function: paintVertexShape90* 91* Paints the vertex shape.92*/93mxShapeElectricalStraightBus.prototype.paintVertexShape = function(c, x, y, w, h)94{95 c.translate(x, y);9697 var x1 = w * 0.2;98 var y1 = 0;99 100 if (w > h)101 {102 y1 = h * 0.5;103 }104 else105 {106 y1 = w / 2;107 }108 109 c.begin();110 c.moveTo(w - x1, 0);111 c.lineTo(w - x1, h - y1);112 c.lineTo(w, h - y1);113 c.lineTo(w * 0.5, h);114 c.lineTo(0, h - y1);115 c.lineTo(x1, h - y1);116 c.lineTo(x1, 0);117 c.fillAndStroke();118};119120mxCellRenderer.registerShape(mxShapeElectricalStraightBus.prototype.cst.SHAPE_STRAIGHT_BUS, mxShapeElectricalStraightBus);121122mxShapeElectricalStraightBus.prototype.constraints = [123 new mxConnectionConstraint(new mxPoint(0.5, 0), true),124 new mxConnectionConstraint(new mxPoint(0.5, 1), true)125 ];126127//**********************************************************************************************************************************************************128//Two-Line Bus Elbow129//**********************************************************************************************************************************************************130/**131* Extends mxShape.132*/133function mxShapeElectricalTwoLineBusElbow(bounds, fill, stroke, strokewidth)134{135 mxShape.call(this);136 this.bounds = bounds;137 this.fill = fill;138 this.stroke = stroke;139 this.strokewidth = (strokewidth != null) ? strokewidth : 1;140 this.notch = 0;141};142143/**144* Extends mxShape.145*/146mxUtils.extend(mxShapeElectricalTwoLineBusElbow, mxShape);147148mxShapeElectricalTwoLineBusElbow.prototype.cst = {149 SHAPE_TWO_LINE_BUS_ELBOW : 'mxgraph.electrical.transmission.twoLineBusElbow'150};151152mxShapeElectricalTwoLineBusElbow.prototype.customProperties = [153 {name:'notch', dispName:'Spacing', type:'float', min:0, defVal:25}154];155156/**157* Function: paintVertexShape158* 159* Paints the vertex shape.160*/161mxShapeElectricalTwoLineBusElbow.prototype.paintVertexShape = function(c, x, y, w, h)162{163 var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));164165 c.translate(x, y);166167 c.begin();168 c.moveTo(0, h);169 c.lineTo(w, h);170 c.lineTo(w, 0);171 c.stroke();172 173 var wn = Math.min(w, notch);174 var hn = Math.min(h, notch);175 176 c.begin();177 c.moveTo(0, h - hn);178 c.lineTo(w - wn, h - hn);179 c.lineTo(w - wn, 0);180 c.stroke();181};182183mxCellRenderer.registerShape(mxShapeElectricalTwoLineBusElbow.prototype.cst.SHAPE_TWO_LINE_BUS_ELBOW, mxShapeElectricalTwoLineBusElbow);184185mxShapeElectricalTwoLineBusElbow.prototype.constraints = null;186187Graph.handleFactory[mxShapeElectricalTwoLineBusElbow.prototype.cst.SHAPE_TWO_LINE_BUS_ELBOW] = function(state)188{189 var handles = [Graph.createHandle(state, ['notch'], function(bounds)190 {191 var notch = Math.max(Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))), 0);192193 return new mxPoint(bounds.x + bounds.width / 4, bounds.y + bounds.height - notch);194 }, function(bounds, pt)195 {196 this.state.style['notch'] = Math.round(0.2 * Math.max(0, bounds.width - pt.y + bounds.y)) / 0.2;197 })];198 199 return handles;200201}202203//**********************************************************************************************************************************************************204//Three-Line Bus Elbow205//**********************************************************************************************************************************************************206/**207* Extends mxShape.208*/209function mxShapeElectricalThreeLineBusElbow(bounds, fill, stroke, strokewidth)210{211 mxShape.call(this);212 this.bounds = bounds;213 this.fill = fill;214 this.stroke = stroke;215 this.strokewidth = (strokewidth != null) ? strokewidth : 1;216 this.notch = 0;217};218219/**220* Extends mxShape.221*/222mxUtils.extend(mxShapeElectricalThreeLineBusElbow, mxShape);223224mxShapeElectricalThreeLineBusElbow.prototype.cst = {225 SHAPE_THREE_LINE_BUS_ELBOW : 'mxgraph.electrical.transmission.threeLineBusElbow'226};227228mxShapeElectricalThreeLineBusElbow.prototype.customProperties = [229 {name:'notch', dispName:'Spacing', type:'float', min:0, defVal:30}230];231232/**233* Function: paintVertexShape234* 235* Paints the vertex shape.236*/237mxShapeElectricalThreeLineBusElbow.prototype.paintVertexShape = function(c, x, y, w, h)238{239 var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));240241 c.translate(x, y);242243 c.begin();244 c.moveTo(0, h);245 c.lineTo(w, h);246 c.lineTo(w, 0);247 c.stroke();248 249 var wn = Math.min(w, notch);250 var hn = Math.min(h, notch);251 252 c.begin();253 c.moveTo(0, h - hn);254 c.lineTo(w - wn, h - hn);255 c.lineTo(w - wn, 0);256 c.stroke();257 258 c.begin();259 c.moveTo(0, h - hn / 2);260 c.lineTo(w - wn / 2, h - hn / 2);261 c.lineTo(w - wn / 2, 0);262 c.stroke();263};264265mxCellRenderer.registerShape(mxShapeElectricalThreeLineBusElbow.prototype.cst.SHAPE_THREE_LINE_BUS_ELBOW, mxShapeElectricalThreeLineBusElbow);266267mxShapeElectricalThreeLineBusElbow.prototype.constraints = null;268269Graph.handleFactory[mxShapeElectricalThreeLineBusElbow.prototype.cst.SHAPE_THREE_LINE_BUS_ELBOW] = function(state)270{271 var handles = [Graph.createHandle(state, ['notch'], function(bounds)272 {273 var notch = Math.max(Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))), 0);274275 return new mxPoint(bounds.x + bounds.width / 4, bounds.y + bounds.height - notch);276 }, function(bounds, pt)277 {278 this.state.style['notch'] = Math.round(0.2 * Math.max(0, bounds.width - pt.y + bounds.y)) / 0.2;279 })];280 281 return handles;282}283284//**********************************************************************************************************************************************************285//Four-Line Bus Elbow286//**********************************************************************************************************************************************************287/**288* Extends mxShape.289*/290function mxShapeElectricalFourLineBusElbow(bounds, fill, stroke, strokewidth)291{292 mxShape.call(this);293 this.bounds = bounds;294 this.fill = fill;295 this.stroke = stroke;296 this.strokewidth = (strokewidth != null) ? strokewidth : 1;297 this.notch = 0;298};299300/**301* Extends mxShape.302*/303mxUtils.extend(mxShapeElectricalFourLineBusElbow, mxShape);304305mxShapeElectricalFourLineBusElbow.prototype.cst = {306 SHAPE_FOUR_LINE_BUS_ELBOW : 'mxgraph.electrical.transmission.fourLineBusElbow'307};308309mxShapeElectricalFourLineBusElbow.prototype.customProperties = [310 {name:'notch', dispName:'Spacing', type:'float', min:0, defVal:75}311];312313/**314* Function: paintVertexShape315* 316* Paints the vertex shape.317*/318mxShapeElectricalFourLineBusElbow.prototype.paintVertexShape = function(c, x, y, w, h)319{320 var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));321322 c.translate(x, y);323324 c.begin();325 c.moveTo(0, h);326 c.lineTo(w, h);327 c.lineTo(w, 0);328 c.stroke();329 330 var wn = Math.min(w, notch);331 var hn = Math.min(h, notch);332 333 c.begin();334 c.moveTo(0, h - hn);335 c.lineTo(w - wn, h - hn);336 c.lineTo(w - wn, 0);337 c.stroke();338 339 c.begin();340 c.moveTo(0, h - hn / 3);341 c.lineTo(w - wn / 3, h - hn / 3);342 c.lineTo(w - wn / 3, 0);343 c.stroke();344 345 c.begin();346 c.moveTo(0, h - hn * 2 / 3);347 c.lineTo(w - wn * 2 / 3, h - hn * 2 / 3);348 c.lineTo(w - wn * 2 / 3, 0);349 c.stroke();350};351352mxCellRenderer.registerShape(mxShapeElectricalFourLineBusElbow.prototype.cst.SHAPE_FOUR_LINE_BUS_ELBOW, mxShapeElectricalFourLineBusElbow);353354mxShapeElectricalFourLineBusElbow.prototype.constraints = null;355356Graph.handleFactory[mxShapeElectricalFourLineBusElbow.prototype.cst.SHAPE_FOUR_LINE_BUS_ELBOW] = function(state)357{358 var handles = [Graph.createHandle(state, ['notch'], function(bounds)359 {360 var notch = Math.max(Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))), 0);361362 return new mxPoint(bounds.x + bounds.width / 4, bounds.y + bounds.height - notch);363 }, function(bounds, pt)364 {365 this.state.style['notch'] = Math.round(0.2 * Math.max(0, bounds.width - pt.y + bounds.y)) / 0.2;366 })];367 368 return handles;369}370371//**********************************************************************************************************************************************************372//Four-Line Bus Elbow373//**********************************************************************************************************************************************************374/**375* Extends mxShape.376*/377function mxShapeElectricalEightLineBusElbow(bounds, fill, stroke, strokewidth)378{379 mxShape.call(this);380 this.bounds = bounds;381 this.fill = fill;382 this.stroke = stroke;383 this.strokewidth = (strokewidth != null) ? strokewidth : 1;384 this.notch = 0;385};386387/**388* Extends mxShape.389*/390mxUtils.extend(mxShapeElectricalEightLineBusElbow, mxShape);391392mxShapeElectricalEightLineBusElbow.prototype.cst = {393 SHAPE_EIGHT_LINE_BUS_ELBOW : 'mxgraph.electrical.transmission.eightLineBusElbow'394};395396mxShapeElectricalEightLineBusElbow.prototype.customProperties = [397 {name:'notch', dispName:'Spacing', type:'float', min:0, defVal:180}398];399400/**401* Function: paintVertexShape402* 403* Paints the vertex shape.404*/405mxShapeElectricalEightLineBusElbow.prototype.paintVertexShape = function(c, x, y, w, h)406{407 var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));408409 c.translate(x, y);410411 c.begin();412 c.moveTo(0, h);413 c.lineTo(w, h);414 c.lineTo(w, 0);415 c.stroke();416 417 var wn = Math.min(w, notch);418 var hn = Math.min(h, notch);419 420 c.begin();421 c.moveTo(0, h - hn);422 c.lineTo(w - wn, h - hn);423 c.lineTo(w - wn, 0);424 c.stroke();425 426 c.begin();427 c.moveTo(0, h - hn / 7);428 c.lineTo(w - wn / 7, h - hn / 7);429 c.lineTo(w - wn / 7, 0);430 c.stroke();431 432 c.begin();433 c.moveTo(0, h - hn * 2 / 7);434 c.lineTo(w - wn * 2 / 7, h - hn * 2 / 7);435 c.lineTo(w - wn * 2 / 7, 0);436 c.stroke();437 438 c.begin();439 c.moveTo(0, h - hn * 3 / 7);440 c.lineTo(w - wn * 3 / 7, h - hn * 3 / 7);441 c.lineTo(w - wn * 3 / 7, 0);442 c.stroke();443 444 c.begin();445 c.moveTo(0, h - hn * 4 / 7);446 c.lineTo(w - wn * 4 / 7, h - hn * 4 / 7);447 c.lineTo(w - wn * 4 / 7, 0);448 c.stroke();449 450 c.begin();451 c.moveTo(0, h - hn * 5 / 7);452 c.lineTo(w - wn * 5 / 7, h - hn * 5 / 7);453 c.lineTo(w - wn * 5 / 7, 0);454 c.stroke();455 456 c.begin();457 c.moveTo(0, h - hn * 6 / 7);458 c.lineTo(w - wn * 6 / 7, h - hn * 6 / 7);459 c.lineTo(w - wn * 6 / 7, 0);460 c.stroke();461 462};463464mxCellRenderer.registerShape(mxShapeElectricalEightLineBusElbow.prototype.cst.SHAPE_EIGHT_LINE_BUS_ELBOW, mxShapeElectricalEightLineBusElbow);465466mxShapeElectricalEightLineBusElbow.prototype.constraints = null;467468Graph.handleFactory[mxShapeElectricalEightLineBusElbow.prototype.cst.SHAPE_EIGHT_LINE_BUS_ELBOW] = function(state)469{470 var handles = [Graph.createHandle(state, ['notch'], function(bounds)471 {472 var notch = Math.max(Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))), 0);473474 return new mxPoint(bounds.x + bounds.width / 4, bounds.y + bounds.height - notch);475 }, function(bounds, pt)476 {477 this.state.style['notch'] = Math.round(0.2 * Math.max(0, bounds.width - pt.y + bounds.y)) / 0.2;478 })];479 480 return handles;481}482483//**********************************************************************************************************************************************************484//Logic Gate485//**********************************************************************************************************************************************************486/**487* Extends mxShape.488*/489function mxShapeElectricalLogicGate(bounds, fill, stroke, strokewidth)490{491 mxShape.call(this);492 this.bounds = bounds;493 this.fill = fill;494 this.stroke = stroke;495 this.strokewidth = (strokewidth != null) ? strokewidth : 1;496};497498/**499* Extends mxShape.500*/501mxUtils.extend(mxShapeElectricalLogicGate, mxShape);502503mxShapeElectricalLogicGate.prototype.cst = {504 SHAPE_LOGIC_GATE : 'mxgraph.electrical.logic_gates.logic_gate'505};506507mxShapeElectricalLogicGate.prototype.customProperties = [508 {name: 'operation', dispName: 'Operation', type: 'enum', defVal:'and',509 enumList:[510 {val:'and', dispName:'And'},511 {val:'or', dispName:'Or'},512 {val:'xor', dispName:'Xor'}513 ]},514 {name: 'numInputs', dispName: 'Inputs', type: 'int', min:2, defVal:2},515 {name: 'negating', dispName: 'Negating', type: 'bool', defVal:0}516];517518/**519* Function: paintVertexShape520* 521* Paints the vertex shape.522*/523mxShapeElectricalLogicGate.prototype.paintVertexShape = function(c, x, y, w, h)524{525 c.translate(x, y);526 var numInputs = parseInt(mxUtils.getValue(this.style, 'numInputs', '2'));527 var spacing = h / numInputs;528 var currH = spacing * 0.5;529530 c.begin();531 c.moveTo(w * 0.8, h * 0.5);532 c.lineTo(w, h * 0.5);533534 var operation = mxUtils.getValue(this.style, 'operation', 'and');535536 for (var i = 0; i < numInputs; i++)537 {538 c.moveTo(0, currH);539 540 if (operation == 'and')541 {542 c.lineTo(w * 0.2, currH);543 }544 else545 {546 c.lineTo(w * 0.23, currH);547 }548 549 currH = currH + spacing;550 }551552 c.stroke();553554555 switch(operation) {556 case 'xor':557 c.begin();558 c.moveTo(w * 0.1, 0);559 c.arcTo(w * 0.6, h, 0, 0, 1, w * 0.1, h);560 c.stroke();561 //no break operation needed, XOR needs to draw an OR shape too562 case 'or':563 c.begin();564 c.moveTo(w * 0.4, 0);565 c.arcTo(w * 0.45, h * 0.83, 0, 0, 1, w * 0.8, h * 0.5);566 c.arcTo(w * 0.45, h * 0.83, 0, 0, 1, w * 0.4, h);567 c.lineTo(w * 0.15, h);568 c.arcTo(w * 0.6, h, 0, 0, 0, w * 0.15, 0);569 c.close();570 c.fillAndStroke();571 break;572 default:573 c.begin();574 c.moveTo(w * 0.2, 0);575 c.lineTo(w * 0.5, 0);576 c.arcTo(w * 0.3, h * 0.5, 0, 0, 1, w * 0.5, h);577 c.lineTo(w * 0.2, h);578 c.close();579 c.fillAndStroke();580 };581 582 var negating = mxUtils.getValue(this.style, 'negating', '0');583584 if (negating == '1')585 {586 var negSize;587 588 if(this.style.negSize)589 {590 var tmpSize = parseFloat(mxUtils.getValue(this.style, 'negSize', '0.13'));591 negSize = Math.min(w * tmpSize * 0.5, h * tmpSize);592 }593 else594 {595 negSize = Math.min(w * 0.04, h * 0.07);596 }597 598 c.begin();599 c.ellipse(w * 0.8, h * 0.5 - negSize * 0.5, negSize, negSize);600 c.fillAndStroke();601 }602};603604mxCellRenderer.registerShape(mxShapeElectricalLogicGate.prototype.cst.SHAPE_LOGIC_GATE, mxShapeElectricalLogicGate);605606mxShapeElectricalLogicGate.prototype.getConstraints = function(style)607{608 var constr = [new mxConnectionConstraint(new mxPoint(1, 0.5), false)];609 610 var numInputs = parseInt(mxUtils.getValue(style, 'numInputs', '2'));611 var spacing = 1 / numInputs;612 var currH = spacing * 0.5;613614 for (var i = 0; i < numInputs; i++)615 {616 constr.push(new mxConnectionConstraint(new mxPoint(0, currH), false));617 currH = currH + spacing;618 }619620 return (constr);621}622623//**********************************************************************************************************************************************************624//Buffer625//**********************************************************************************************************************************************************626/**627* Extends mxShape.628*/629function mxShapeElectricalBuffer(bounds, fill, stroke, strokewidth)630{631 mxShape.call(this);632 this.bounds = bounds;633 this.fill = fill;634 this.stroke = stroke;635 this.strokewidth = (strokewidth != null) ? strokewidth : 1;636};637638/**639* Extends mxShape.640*/641mxUtils.extend(mxShapeElectricalBuffer, mxShape);642643mxShapeElectricalBuffer.prototype.cst = {644 SHAPE_BUFFER2 : 'mxgraph.electrical.logic_gates.buffer2'645};646647mxShapeElectricalBuffer.prototype.customProperties = [648 {name: 'negating', dispName: 'Negating', type: 'bool', defVal:0}649];650651/**652* Function: paintVertexShape653* 654* Paints the vertex shape.655*/656mxShapeElectricalBuffer.prototype.paintVertexShape = function(c, x, y, w, h)657{658 c.translate(x, y);659660 c.begin();661 c.moveTo(0, h * 0.5);662 c.lineTo(w * 0.2, h * 0.5);663 c.moveTo(w * 0.8, h * 0.5);664 c.lineTo(w, h * 0.5);665 c.stroke();666 667 c.begin();668 c.moveTo(w * 0.2, 0);669 c.lineTo(w * 0.8, h * 0.5);670 c.lineTo(w * 0.2, h);671 c.close();672 c.fillAndStroke();673 674 var negating = mxUtils.getValue(this.style, 'negating', '0');675676 if (negating == '1')677 {678 var negSize = Math.min(w * 0.04, h * 0.07);679 c.begin();680 c.ellipse(w * 0.8, h * 0.5 - negSize * 0.5, negSize, negSize);681 c.fillAndStroke();682 }683};684685mxCellRenderer.registerShape(mxShapeElectricalBuffer.prototype.cst.SHAPE_BUFFER2, mxShapeElectricalBuffer);686687mxShapeElectricalBuffer.prototype.constraints = [688 new mxConnectionConstraint(new mxPoint(0, 0.5), true),689 new mxConnectionConstraint(new mxPoint(1, 0.5), true)690 ];691692//**********************************************************************************************************************************************************693//Dual In-Line IC694//**********************************************************************************************************************************************************695/**696* Extends mxShape.697*/698function mxShapeElectricalDualInLineIC(bounds, fill, stroke, strokewidth)699{700 mxShape.call(this);701 this.bounds = bounds;702 this.fill = fill;703 this.stroke = stroke;704 this.strokewidth = (strokewidth != null) ? strokewidth : 1;705};706707/**708* Extends mxShape.709*/710mxUtils.extend(mxShapeElectricalDualInLineIC, mxShape);711712mxShapeElectricalDualInLineIC.prototype.cst = {713 SHAPE_DUAL_INLINE_IC : 'mxgraph.electrical.logic_gates.dual_inline_ic'714};715716mxShapeElectricalDualInLineIC.prototype.customProperties = [717 {name: 'pinStyle', dispName: 'Pin Style', type: 'enum', defVal:'line',718 enumList:[719 {val:'line', dispName:'Line'},720 {val:'square', dispName:'Square'}721 ]},722 {name: 'startPin', dispName: 'Starting Pin', type: 'enum', defVal:'n',723 enumList:[724 {val:'n', dispName:'N'},725 {val:'e', dispName:'E'},726 {val:'s', dispName:'S'},727 {val:'w', dispName:'W'}728 ]},729 {name: 'pinSpacing', dispName: 'Pin Spacing', type: 'float', min:1, defVal:20},730 {name: 'pinLabelType', dispName: 'Pin Label Type', type: 'enum', defVal:'gen',731 enumList:[732 {val:'gen', dispName:'Generated'},733 {val:'cust', dispName:'Custom'}734 ]},735 {name: 'labelCount', dispName: 'Number of Labels', type: 'int', defVal: 20, dependentProps: ['labelNames']},736 {name: 'labelNames', dispName: 'Label Names', type: 'staticArr', subType: 'string', sizeProperty: 'labelCount', subDefVal: 'a'}737];738739/**740* Function: paintVertexShape741* 742* Paints the vertex shape.743*/744mxShapeElectricalDualInLineIC.prototype.paintVertexShape = function(c, x, y, w, h)745{746 c.translate(x, y);747 var fontColor = mxUtils.getValue(this.style, 'fontColor', '#000000');748 c.setFontColor(fontColor);749 var startPin = mxUtils.getValue(this.style, 'startPin', 'n');750 var pinLabelType = mxUtils.getValue(this.style, 'pinLabelType', 'gen');751 var labelNames = decodeURIComponent(mxUtils.getValue(this.style, 'labelNames', '').toString()).split(',');752753 c.begin();754 755 if (startPin == 'n' || startPin == 's')756 {757 c.rect(10, 0, w - 20, h);758 }759 else760 {761 c.rect(0, 10, w, h - 20);762 }763764 c.fillAndStroke();765766 var pinSpacing = parseFloat(mxUtils.getValue(this.style, 'pinSpacing', '20'));767 var pinStyle = mxUtils.getValue(this.style, 'pinStyle', 'line');768 var fontSize = parseFloat(mxUtils.getValue(this.style, 'fontSize', '12'));769 770 if (startPin == 'n' || startPin == 's')771 {772 var pinsOne = parseInt(h / pinSpacing);773 }774 else775 {776 var pinsOne = parseInt(w / pinSpacing);777 }778 779 if (pinStyle == 'line')780 {781 c.setFontSize(fontSize * 0.8);782 var pinCount = 1;783 var currH = pinSpacing * 0.5;784 785 c.begin();786 787 if (startPin == 'n' || startPin == 's')788 {789 while (pinCount * pinSpacing <= h)790 {791 c.moveTo(0, currH);792 c.lineTo(10, currH);793 c.moveTo(w - 10, currH);794 c.lineTo(w, currH);795 796 if (startPin == 'n')797 {798 var currPinNum = pinCount;799 }800 else801 {802 var currPinNum = pinsOne + pinCount;803 }804805 if (pinLabelType == 'gen')806 {807 c.text(20, currH, 0, 0, currPinNum.toString(), mxConstants.ALIGN_LEFT, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);808 }809 else if (currPinNum - 1 < labelNames.length)810 {811 c.text(20, currH, 0, 0, labelNames[currPinNum - 1].toString(), mxConstants.ALIGN_LEFT, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);812 }813 814 if (startPin == 'n')815 {816 var pc2 = 2 * pinsOne - pinCount + 1;817 }818 else819 {820 var pc2 = pinsOne - pinCount + 1;821 }822 823 if (pinLabelType == 'gen')824 {825 c.text(w - 20, currH, 0, 0, pc2.toString(), mxConstants.ALIGN_RIGHT, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);826 }827 else if (pc2 - 1 < labelNames.length)828 {829 c.text(w - 20, currH, 0, 0, labelNames[pc2 - 1].toString(), mxConstants.ALIGN_RIGHT, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);830 }831 832 currH = currH + pinSpacing;833 pinCount++;834 }835 }836 else837 {838 while (pinCount * pinSpacing <= w)839 {840 c.moveTo(currH, 0);841 c.lineTo(currH, 10);842 c.moveTo(currH, h - 10);843 c.lineTo(currH, h);844 845 if (startPin == 'e')846 {847 var currPinNum = pinsOne - pinCount + 1;848 }849 else850 {851 var currPinNum = 2 * pinsOne - pinCount + 1;852 }853 854 if (pinLabelType == 'gen')855 {856 c.text(currH, 20, 0, 0, currPinNum.toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);857 }858 else if (currPinNum - 1 < labelNames.length)859 {860 c.text(currH, 20, 0, 0, labelNames[currPinNum - 1].toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);861 }862 863 if (startPin == 'e')864 {865 var pc2 = pinsOne + pinCount;866 }867 else868 {869 var pc2 = pinCount;870 }871 872 if (pinLabelType == 'gen')873 {874 c.text(currH, h - 20, 0, 0, pc2.toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);875 }876 else if (pc2 - 1 < labelNames.length)877 {878 c.text(currH, h - 20, 0, 0, labelNames[pc2 - 1].toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);879 }880 881 currH = currH + pinSpacing;882 pinCount++;883 }884 }885 886 c.stroke();887 }888 else889 {890 c.setFontSize(fontSize * 0.5);891 var pinCount = 1;892 var currH = pinSpacing * 0.5;893894 if (startPin == 'n' || startPin == 's')895 {896 while (pinCount * pinSpacing <= h)897 {898 c.begin();899 c.rect(0, currH - pinSpacing * 0.25, 10, pinSpacing * 0.5);900 c.fillAndStroke();901902 c.begin();903 c.rect(w - 10, currH - pinSpacing * 0.25, 10, pinSpacing * 0.5);904 c.fillAndStroke();905 906 if (startPin == 'n')907 {908 var currPinNum = pinCount;909 }910 else911 {912 var currPinNum = pinsOne + pinCount;913 }914915 if (pinLabelType == 'gen')916 {917 c.text(5, currH + 1, 0, 0, currPinNum.toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);918 }919 else if (currPinNum - 1 < labelNames.length)920 {921 c.text(5, currH + 1, 0, 0, labelNames[currPinNum - 1].toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);922 }923 924 if (startPin == 'n')925 {926 var pc2 = 2 * pinsOne - pinCount + 1;927 }928 else929 {930 var pc2 = pinsOne - pinCount + 1;931 }932 933 if (pinLabelType == 'gen')934 {935 c.text(w - 5, currH + 1, 0, 0, pc2.toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);936 }937 else if (pc2 - 1 < labelNames.length)938 {939 c.text(w - 5, currH + 1, 0, 0, labelNames[pc2 - 1].toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);940 }941942 currH = currH + pinSpacing;943 pinCount++;944 }945 }946 else947 {948 while (pinCount * pinSpacing <= w)949 {950 c.begin();951 c.rect(currH - pinSpacing * 0.25, 0, pinSpacing * 0.5, 10);952 c.fillAndStroke();953954 c.begin();955 c.rect(currH - pinSpacing * 0.25, h - 10, pinSpacing * 0.5, 10);956 c.fillAndStroke();957 958 if (startPin == 'e')959 {960 var currPinNum = pinsOne - pinCount + 1;961 }962 else963 {964 var currPinNum = 2 * pinsOne - pinCount + 1;965 }966967 if (pinLabelType == 'gen')968 {969 c.text(currH, 5, 0, 0, currPinNum.toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);970 }971 else if (currPinNum - 1 < labelNames.length)972 {973 c.text(currH, 5, 0, 0, labelNames[currPinNum - 1].toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);974 }975 976 if (startPin == 'e')977 {978 var pc2 = pinsOne + pinCount;979 }980 else981 {982 var pc2 = pinCount;983 }984 985 if (pinLabelType == 'gen')986 {987 c.text(currH, h - 5, 0, 0, pc2.toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);988 }989 else if (pc2 - 1 < labelNames.length)990 {991 c.text(currH, h - 5, 0, 0, labelNames[pc2 - 1].toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);992 }993994 currH = currH + pinSpacing;995 pinCount++;996 }997 }998 999 }1000 1001 c.setShadow(false);1002 1003 c.begin();1004 1005 switch(startPin) {1006 case 'e':1007 if (h > 40)1008 {1009 c.moveTo(w, h * 0.5 - 10);1010 c.arcTo(12, 12, 0, 0, 0, w, h * 0.5 + 10);1011 }1012 break;1013 case 's':1014 if (w > 40)1015 {1016 c.moveTo(w * 0.5 - 10, h);1017 c.arcTo(12, 12, 0, 0, 1, w * 0.5 + 10, h);1018 }1019 break;1020 case 'w':1021 if (h > 40)1022 {1023 c.moveTo(0, h * 0.5 - 10);1024 c.arcTo(12, 12, 0, 0, 1, 0, h * 0.5 + 10);1025 }1026 break;1027 default:1028 if (w > 40)1029 {1030 c.moveTo(w * 0.5 - 10, 0);1031 c.arcTo(12, 12, 0, 0, 0, w * 0.5 + 10, 0);1032 }1033 }1034 1035 c.stroke();1036};10371038mxCellRenderer.registerShape(mxShapeElectricalDualInLineIC.prototype.cst.SHAPE_DUAL_INLINE_IC, mxShapeElectricalDualInLineIC);10391040mxShapeElectricalDualInLineIC.prototype.getConstraints = function(style, w, h)1041{1042 var constr = [];10431044 var pinSpacing = parseFloat(mxUtils.getValue(this.style, 'pinSpacing', '20'));1045 var startPin = mxUtils.getValue(this.style, 'startPin', 'n');1046 var pinCount = 1;1047 var currH = pinSpacing * 0.5;1048 var pinsOne = parseInt(h / pinSpacing);1049 1050 if (startPin == 'n' || startPin == 's')1051 {1052 while (pinCount * pinSpacing <= h)1053 {1054 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, currH));1055 constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false, null, 0, currH));1056 currH = currH + pinSpacing;1057 pinCount++;1058 }1059 }1060 else1061 {1062 while (pinCount * pinSpacing <= w)1063 {1064 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, currH, 0));1065 constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false, null, currH, 0));1066 currH = currH + pinSpacing;1067 pinCount++;1068 }1069 }1070 1071 return (constr);1072}10731074//**********************************************************************************************************************************************************1075//Quad Flat Package IC1076//**********************************************************************************************************************************************************1077/**1078* Extends mxShape.1079*/1080function mxShapeElectricalQFPIC(bounds, fill, stroke, strokewidth)1081{1082 mxShape.call(this);1083 this.bounds = bounds;1084 this.fill = fill;1085 this.stroke = stroke;1086 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1087};10881089/**1090* Extends mxShape.1091*/1092mxUtils.extend(mxShapeElectricalQFPIC, mxShape);10931094mxShapeElectricalQFPIC.prototype.cst = {1095 SHAPE_QFP_IC : 'mxgraph.electrical.logic_gates.qfp_ic'1096};10971098mxShapeElectricalQFPIC.prototype.customProperties = [1099 {name: 'pinStyle', dispName: 'Pin Style', type: 'enum', defVal:'line',1100 enumList:[1101 {val:'line', dispName:'Line'},1102 {val:'square', dispName:'Square'}1103 ]},1104 {name: 'startPin', dispName: 'Starting Pin', type: 'enum', defVal:'sw',1105 enumList:[1106 {val:'sw', dispName:'SW'},1107 {val:'nw', dispName:'NW'},1108 {val:'ne', dispName:'NE'},1109 {val:'se', dispName:'SE'}1110 ]},1111 {name: 'pinSpacing', dispName: 'Pin Spacing', type: 'float', min:1, defVal:20},1112 {name: 'pinLabelType', dispName: 'Pin Label Type', type: 'enum', defVal:'gen',1113 enumList:[1114 {val:'gen', dispName:'Generated'},1115 {val:'cust', dispName:'Custom'}1116 ]},1117 {name: 'labelCount', dispName: 'Number of Labels', type: 'int', defVal: 40, dependentProps: ['labelNames']},1118 {name: 'labelNames', dispName: 'Label Names', type: 'staticArr', subType: 'string', sizeProperty: 'labelCount', subDefVal: 'a'}1119];11201121/**1122* Function: paintVertexShape1123* 1124* Paints the vertex shape.1125*/1126mxShapeElectricalQFPIC.prototype.paintVertexShape = function(c, x, y, w, h)1127{1128 c.translate(x, y);1129 1130 c.begin();1131 c.moveTo(15, 10);1132 c.lineTo(w - 15, 10);1133 c.lineTo(w - 10, 15);1134 c.lineTo(w - 10, h - 15);1135 c.lineTo(w - 15, h - 10);1136 c.lineTo(15, h - 10);1137 c.lineTo(10, h - 15);1138 c.lineTo(10, 15);1139 c.close();1140 c.fillAndStroke();11411142 var pinSpacing = parseFloat(mxUtils.getValue(this.style, 'pinSpacing', '20'));1143 var pinStyle = mxUtils.getValue(this.style, 'pinStyle', 'line');1144 var pinLabelType = mxUtils.getValue(this.style, 'pinLabelType', 'gen');1145 var labelNames = decodeURIComponent(mxUtils.getValue(this.style, 'labelNames', '').toString()).split(',');1146 var fontSize = parseFloat(mxUtils.getValue(this.style, 'fontSize', '12'));1147 var fontColor = mxUtils.getValue(this.style, 'fontColor', '#000000');1148 c.setFontColor(fontColor);1149 var startPin = mxUtils.getValue(this.style, 'startPin', 'sw');1150 1151 if (pinStyle == 'line')1152 {1153 c.setFontSize(fontSize * 0.8);1154 var pinCount = 1;1155 var currH = pinSpacing * 0.5 + 20;1156 1157 c.begin();1158 1159 var pinsVOne = parseInt((h - pinSpacing - 40) / pinSpacing) + 1;1160 var pinsHOne = parseInt((w - pinSpacing - 40) / pinSpacing) + 1;1161 1162 while (currH <= h - pinSpacing * 0.5 - 20)1163 {1164 c.moveTo(0, currH);1165 c.lineTo(10, currH);1166 c.moveTo(w - 10, currH);1167 c.lineTo(w, currH);1168 1169 //west pins1170 switch(startPin) {1171 case 'nw':1172 var currPinNum = pinCount;1173 break;1174 case 'ne':1175 var currPinNum = pinsHOne + pinCount;1176 break;1177 case 'se':1178 var currPinNum = pinsVOne + pinsHOne + pinCount;1179 break;1180 default:1181 var currPinNum = pinsVOne + 2 * pinsHOne + pinCount;1182 }11831184 if (pinLabelType == 'gen')1185 {1186 c.text(20, currH, 0, 0, currPinNum.toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);1187 }1188 else if (currPinNum - 1 < labelNames.length)1189 {1190 c.text(20, currH, 0, 0, labelNames[currPinNum - 1].toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);1191 }1192 1193 //east pins1194 switch(startPin) {1195 case 'nw':1196 var pc2 = pinsHOne + 2 * pinsVOne - pinCount + 1;1197 break;1198 case 'ne':1199 var pc2 = 2 * pinsHOne + 2 * pinsVOne - pinCount + 1;1200 break;1201 case 'se':1202 var pc2 = pinsVOne - pinCount + 1;1203 break;1204 default:1205 var pc2 = pinsHOne + pinsVOne - pinCount + 1;1206 }12071208 if (pinLabelType == 'gen')1209 {1210 c.text(w - 20, currH, 0, 0, pc2.toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);1211 }1212 else if (pc2 - 1 < labelNames.length)1213 {1214 c.text(w - 20, currH, 0, 0, labelNames[pc2 - 1].toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);1215 }1216 1217 currH = currH + pinSpacing;1218 pinCount++;1219 }1220 1221 var pinCount = 1;1222 var currH = pinSpacing * 0.5 + 20;1223 1224 while (currH <= w - pinSpacing * 0.5 - 20)1225 {1226 c.moveTo(currH, 0);1227 c.lineTo(currH, 10);1228 c.moveTo(currH, h - 10);1229 c.lineTo(currH, h);1230 1231 //south pins1232 switch(startPin) {1233 case 'nw':1234 var currPinNum = pinsVOne + pinCount;1235 break;1236 case 'ne':1237 var currPinNum = pinsVOne + pinsHOne + pinCount;1238 break;1239 case 'se':1240 var currPinNum = 2 * pinsVOne + pinsHOne + pinCount;1241 break;1242 default:1243 var currPinNum = pinCount;1244 }1245 1246 if (pinLabelType == 'gen')1247 {1248 c.text(currH, h - 20, 0, 0, currPinNum.toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);1249 }1250 else if (currPinNum - 1 < labelNames.length)1251 {1252 c.text(currH, h - 20, 0, 0, labelNames[currPinNum - 1].toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);1253 }12541255 //north pins1256 switch(startPin) {1257 case 'nw':1258 var pc2 = 2 * pinsHOne + 2 * pinsVOne - pinCount + 1;1259 break;1260 case 'ne':1261 var pc2 = pinsHOne - pinCount + 1;1262 break;1263 case 'se':1264 var pc2 = pinsHOne + pinsVOne - pinCount + 1;1265 break;1266 default:1267 var pc2 = 2 * pinsHOne + pinsVOne - pinCount + 1;1268 }1269 1270 if (pinLabelType == 'gen')1271 {1272 c.text(currH, 20, 0, 0, pc2.toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);1273 }1274 else if (pc2 - 1 < labelNames.length)1275 {1276 c.text(currH, 20, 0, 0, labelNames[pc2 - 1].toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);1277 }1278 1279 currH = currH + pinSpacing;1280 pinCount++;1281 }1282 1283 c.stroke();1284 }1285 else1286 {1287 c.setFontSize(fontSize * 0.5);1288 var pinCount = 1;1289 var currH = pinSpacing * 0.5 + 20;1290 var pinsVOne = parseInt((h - pinSpacing - 40) / pinSpacing) + 1;1291 var pinsHOne = parseInt((w - pinSpacing - 40) / pinSpacing) + 1;1292 1293 while (currH <= h - pinSpacing * 0.5 - 20)1294 {1295 c.begin();1296 c.rect(0, currH - pinSpacing * 0.25, 10, pinSpacing * 0.5);1297 c.fillAndStroke();12981299 c.begin();1300 c.rect(w - 10, currH - pinSpacing * 0.25, 10, pinSpacing * 0.5);1301 c.fillAndStroke();1302 1303 //west pins1304 switch(startPin) {1305 case 'nw':1306 var currPinNum = pinCount;1307 break;1308 case 'ne':1309 var currPinNum = pinsHOne + pinCount;1310 break;1311 case 'se':1312 var currPinNum = pinsVOne + pinsHOne + pinCount;1313 break;1314 default:1315 var currPinNum = pinsVOne + 2 * pinsHOne + pinCount;1316 }13171318 if (pinLabelType == 'gen')1319 {1320 c.text(5, currH + 1, 0, 0, currPinNum.toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);1321 }1322 else if (currPinNum - 1 < labelNames.length)1323 {1324 c.text(5, currH + 1, 0, 0, labelNames[currPinNum - 1].toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);1325 }1326 1327 //east pins1328 switch(startPin) {1329 case 'nw':1330 var pc2 = pinsHOne + 2 * pinsVOne - pinCount + 1;1331 break;1332 case 'ne':1333 var pc2 = 2 * pinsHOne + 2 * pinsVOne - pinCount + 1;1334 break;1335 case 'se':1336 var pc2 = pinsVOne - pinCount + 1;1337 break;1338 default:1339 var pc2 = pinsHOne + pinsVOne - pinCount + 1;1340 }13411342 if (pinLabelType == 'gen')1343 {1344 c.text(w - 5, currH + 1, 0, 0, pc2.toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);1345 }1346 else if (pc2 - 1 < labelNames.length)1347 {1348 c.text(w - 5, currH + 1, 0, 0, labelNames[pc2 - 1].toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);1349 }13501351 currH = currH + pinSpacing;1352 pinCount++;1353 }1354 1355 var pinCount = 1;1356 var currH = pinSpacing * 0.5 + 20;1357 1358 while (currH <= w - pinSpacing * 0.5 - 20)1359 {1360 c.begin();1361 c.rect(currH - pinSpacing * 0.25, 0, pinSpacing * 0.5, 10);1362 c.fillAndStroke();13631364 c.begin();1365 c.rect(currH - pinSpacing * 0.25, h - 10, pinSpacing * 0.5, 10);1366 c.fillAndStroke();1367 1368 //south pins1369 switch(startPin) {1370 case 'nw':1371 var currPinNum = pinsVOne + pinCount;1372 break;1373 case 'ne':1374 var currPinNum = pinsVOne + pinsHOne + pinCount;1375 break;1376 case 'se':1377 var currPinNum = 2 * pinsVOne + pinsHOne + pinCount;1378 break;1379 default:1380 var currPinNum = pinCount;1381 }1382 1383 if (pinLabelType == 'gen')1384 {1385 c.text(currH, h - 4, 0, 0, currPinNum.toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);1386 }1387 else if (currPinNum - 1 < labelNames.length)1388 {1389 c.text(currH, h - 4, 0, 0, labelNames[currPinNum - 1].toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);1390 }13911392 //north pins1393 switch(startPin) {1394 case 'nw':1395 var pc2 = 2 * pinsHOne + 2 * pinsVOne - pinCount + 1;1396 break;1397 case 'ne':1398 var pc2 = pinsHOne - pinCount + 1;1399 break;1400 case 'se':1401 var pc2 = pinsHOne + pinsVOne - pinCount + 1;1402 break;1403 default:1404 var pc2 = 2 * pinsHOne + pinsVOne - pinCount + 1;1405 }1406 1407 if (pinLabelType == 'gen')1408 {1409 c.text(currH, 6, 0, 0, pc2.toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);1410 }1411 else if (pc2 - 1 < labelNames.length)1412 {1413 c.text(currH, 6, 0, 0, labelNames[pc2 - 1].toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);1414 }14151416 currH = currH + pinSpacing;1417 pinCount++;1418 }1419 }1420 1421 c.setShadow(false);1422 1423 if (w > 40)1424 {1425 c.setFillColor(mxUtils.getValue(this.style, 'strokeColor', '#000000'));14261427 c.begin();1428 1429 switch(startPin) {1430 case 'nw':1431 c.ellipse(15, 15, 10, 10);1432 break;1433 case 'ne':1434 c.ellipse(w - 25, 15, 10, 10);1435 break;1436 case 'se':1437 c.ellipse(w - 25, h - 25, 10, 10);1438 break;1439 default:1440 c.ellipse(15, h - 25, 10, 10);1441 }1442 1443 c.fillAndStroke();1444 }1445};14461447mxCellRenderer.registerShape(mxShapeElectricalQFPIC.prototype.cst.SHAPE_QFP_IC, mxShapeElectricalQFPIC);14481449mxShapeElectricalQFPIC.prototype.getConstraints = function(style, w, h)1450{1451 var constr = [];14521453 var pinSpacing = parseFloat(mxUtils.getValue(this.style, 'pinSpacing', '20'));1454 var currH = pinSpacing * 0.5 + 20;1455 1456 while (currH <= h - pinSpacing * 0.5 - 20)1457 {1458 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, currH));1459 constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false, null, 0, currH));1460 currH = currH + pinSpacing;1461 }1462 1463 var currH = pinSpacing * 0.5 + 20;1464 1465 while (currH <= w - pinSpacing * 0.5 - 20)1466 {1467 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, currH, 0));1468 constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false, null, currH, 0));1469 currH = currH + pinSpacing;1470 }1471 1472 1473 return (constr);1474}14751476//**********************************************************************************************************************************************************1477//Mux1478//**********************************************************************************************************************************************************1479/**1480* Extends mxShape.1481*/1482function mxShapeElectricalMux(bounds, fill, stroke, strokewidth)1483{1484 mxShape.call(this);1485 this.bounds = bounds;1486 this.fill = fill;1487 this.stroke = stroke;1488 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1489};14901491/**1492* Extends mxShape.1493*/1494mxUtils.extend(mxShapeElectricalMux, mxShape);14951496mxShapeElectricalMux.prototype.cst = {1497 SHAPE_MUX : 'mxgraph.electrical.abstract.mux2'1498};14991500mxShapeElectricalMux.prototype.customProperties = [1501 {name: 'operation', dispName: 'Operation', type: 'enum', defVal:'mux',1502 enumList:[1503 {val:'mux', dispName:'Mux'},1504 {val:'demux', dispName:'Demux'}1505 ]},1506 {name: 'selectorPins', dispName: 'Selector Pins', type: 'int', min:1, max:8, defVal:1},1507];15081509/**1510* Function: paintVertexShape1511* 1512* Paints the vertex shape.1513*/1514mxShapeElectricalMux.prototype.paintVertexShape = function(c, x, y, w, h)1515{1516 c.translate(x, y);1517 var selectorPins = parseInt(mxUtils.getValue(this.style, 'selectorPins', '1'));1518 var operation = mxUtils.getValue(this.style, 'operation', 'mux');1519 var fontSize = parseFloat(mxUtils.getValue(this.style, 'fontSize', '12'));1520 c.setFontSize(fontSize * 0.5);1521 var fontColor = mxUtils.getValue(this.style, 'fontColor', '#000000');1522 c.setFontColor(fontColor);1523 var dir = mxUtils.getValue(this.style, 'direction', 'east');1524 var txtRot = 0;1525 1526 switch(dir)1527 {1528 case 'south' :1529 txtRot = 270;1530 break;1531 case 'west' :1532 txtRot = 180;1533 break;1534 case 'north' :1535 txtRot = 90;1536 break;1537 }1538 1539 switch(operation) 1540 {1541 case 'demux':1542 c.begin();1543 c.moveTo(w - 10, 0);1544 c.lineTo(10, h * 0.1);1545 c.lineTo(10, h * 0.9 - 10);1546 c.lineTo(w - 10, h - 10);1547 c.close();1548 c.fillAndStroke();1549 break;1550 default:1551 c.begin();1552 c.moveTo(10, 0);1553 c.lineTo(w - 10, h * 0.1);1554 c.lineTo(w - 10, h * 0.9 - 10);1555 c.lineTo(10, h - 10);1556 c.close();1557 c.fillAndStroke();1558 };1559 1560 var numInputs = 1;1561 var numOutputs = 1;1562 1563 if (operation == 'mux')1564 {1565 numInputs = Math.pow(2, selectorPins);1566 var spacing = (h - 16) / numInputs;1567 }1568 else1569 {1570 numOutputs = Math.pow(2, selectorPins);1571 var spacing = (h - 16) / numOutputs;1572 }1573 1574 var currH = 3 + spacing * 0.5;1575 1576 c.begin();1577 1578 if (numInputs == 1)1579 {1580 c.moveTo(0, (h - 10) * 0.5);1581 c.lineTo(10, (h - 10) * 0.5);1582 }1583 else1584 {1585 for (var i = 0; i < numInputs; i++)1586 {1587 c.moveTo(0, currH);1588 c.lineTo(10, currH);1589 c.text(14, currH + 1, 0, 0, '' + i.toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, txtRot);1590 currH = currH + spacing;1591 }1592 }15931594 if (numOutputs == 1)1595 {1596 c.moveTo(w - 10, (h - 10) * 0.5);1597 c.lineTo(w, (h - 10) * 0.5);1598 }1599 else1600 {1601 for (var i = 0; i < numOutputs; i++)1602 {1603 c.moveTo(w - 10, currH);1604 c.lineTo(w, currH);1605 c.text(w - 14, currH + 1, 0, 0, '' + i.toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, txtRot);1606 currH = currH + spacing;1607 }1608 }16091610 var spacing = (w - 20) / selectorPins;1611 var currW = 10 + spacing * 0.5;1612 1613 for (var i = 0; i < selectorPins; i++)1614 {1615 if (operation == 'mux')1616 {1617 c.moveTo(currW, h - 10 - (currW - 10) / (w - 20) * h * 0.1);1618 }1619 else1620 {1621 c.moveTo(currW, h - 10 - (w - currW - 10) / (w - 20) * h * 0.1);1622 }16231624 c.lineTo(currW, h);16251626 c.text(currW + 5, h -4, 0, 0, 'S' + (selectorPins - i - 1).toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, txtRot);1627 currW = currW + spacing;1628 }16291630 c.stroke();1631};16321633mxCellRenderer.registerShape(mxShapeElectricalMux.prototype.cst.SHAPE_MUX, mxShapeElectricalMux);16341635mxShapeElectricalMux.prototype.getConstraints = function(style, w, h)1636{1637 var constr = [];1638 var pinRange = (h - 16) / h;1639 var selectorPins = parseInt(mxUtils.getValue(this.style, 'selectorPins', '1'));1640 var operation = mxUtils.getValue(this.style, 'operation', 'mux');1641 1642 var numInputs = 1;1643 var numOutputs = 1;1644 1645 if (operation == 'mux')1646 {1647 numInputs = Math.pow(2, selectorPins);1648 var spacing = pinRange / numInputs;1649 }1650 else1651 {1652 numOutputs = Math.pow(2, selectorPins);1653 var spacing = pinRange / numOutputs;1654 }1655 1656 var currH = spacing * 0.5;1657 1658 if (numInputs == 1)1659 {1660 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5 * (h - 10) / h), false, 0, 0));1661 }1662 else1663 {1664 for (var i = 0; i < numInputs; i++)1665 {1666 constr.push(new mxConnectionConstraint(new mxPoint(0, currH), false, null, 0, 3));1667 currH = currH + spacing;1668 }1669 }16701671 if (numOutputs == 1)1672 {1673 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false, null, 0, -5));1674 }1675 else1676 {1677 for (var i = 0; i < numOutputs; i++)1678 {1679 constr.push(new mxConnectionConstraint(new mxPoint(1, currH), false, null, 0, 3));1680 currH = currH + spacing;1681 }1682 }16831684 var spacing = (w - 20) / (w * selectorPins);1685 var currW = spacing * 0.5;1686 1687 for (var i = 0; i < selectorPins; i++)1688 {1689 constr.push(new mxConnectionConstraint(new mxPoint(currW, 1), false, null, 10, 0));1690 currW = currW + spacing;1691 }16921693 return (constr);1694}16951696//**********************************************************************************************************************************************************1697//Battery stack1698//**********************************************************************************************************************************************************1699/**1700* Extends mxShape.1701*/1702function mxShapeElectricalBatteryStack(bounds, fill, stroke, strokewidth)1703{1704 mxShape.call(this);1705 this.bounds = bounds;1706 this.fill = fill;1707 this.stroke = stroke;1708 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1709};17101711/**1712* Extends mxShape.1713*/1714mxUtils.extend(mxShapeElectricalBatteryStack, mxShape);17151716mxShapeElectricalBatteryStack.prototype.cst = {1717 SHAPE_BATTERY_STACK : 'mxgraph.electrical.miscellaneous.batteryStack'1718};17191720/**1721* Function: paintVertexShape1722* 1723* Paints the vertex shape.1724*/1725mxShapeElectricalBatteryStack.prototype.paintVertexShape = function(c, x, y, w, h)1726{1727 c.translate(x, y);17281729 var bw = h * 0.3;1730 var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#000000');1731 var dashed = mxUtils.getValue(this.style, mxConstants.STYLE_DASHED, '0');1732 1733 var bNum = Math.floor((w - 20) / bw);1734 var startX = (w - bNum * bw) * 0.5;17351736 if (bNum > 0)1737 {1738 c.begin();1739 c.moveTo(0, h * 0.5);1740 c.lineTo(startX + bw * 0.2, h * 0.5);1741 c.moveTo(w - startX - bw * 0.2, h * 0.5);1742 c.lineTo(w, h * 0.5);1743 c.stroke();1744 1745 var currX = startX;1746 c.setFillColor(strokeColor);1747 1748 for (var i = 0; i < bNum; i++)1749 {1750 c.rect(currX + bw * 0.2, h * 0.25, bw * 0.2, h * 0.5);1751 c.fillAndStroke();1752 1753 c.begin();1754 c.moveTo(currX + bw * 0.8, 0);1755 c.lineTo(currX + bw * 0.8, h);1756 c.stroke();1757 1758 if (i > 0)1759 {1760 c.setDashed('1');1761 c.begin();1762 c.moveTo(currX - bw * 0.2, h * 0.5);1763 c.lineTo(currX + bw * 0.2, h * 0.5);1764 c.stroke();1765 c.setDashed(dashed);1766 }1767 1768 currX = currX + bw;1769 }1770 }1771};17721773mxCellRenderer.registerShape(mxShapeElectricalBatteryStack.prototype.cst.SHAPE_BATTERY_STACK, mxShapeElectricalBatteryStack);17741775mxShapeElectricalBatteryStack.prototype.constraints = [1776 new mxConnectionConstraint(new mxPoint(0, 0.5), true),1777 new mxConnectionConstraint(new mxPoint(1, 0.5), true)1778 ];17791780//**********************************************************************************************************************************************************1781//DC Source 3 v21782//**********************************************************************************************************************************************************1783/**1784* Extends mxShape.1785*/1786function mxShapeElectricalDCSource3_v2(bounds, fill, stroke, strokewidth)1787{1788 mxShape.call(this);1789 this.bounds = bounds;1790 this.fill = fill;1791 this.stroke = stroke;1792 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1793};17941795/**1796* Extends mxShape.1797*/1798mxUtils.extend(mxShapeElectricalDCSource3_v2, mxShape);17991800mxShapeElectricalDCSource3_v2.prototype.cst = {1801 SHAPE_DC_SOURCE_3_V2 : 'mxgraph.electrical.signal_sources.dc_source_3_v2'1802};18031804/**1805* Function: paintVertexShape1806* 1807* Paints the vertex shape.1808*/1809mxShapeElectricalDCSource3_v2.prototype.paintVertexShape = function(c, x, y, w, h)1810{1811 c.translate(x, y);1812 1813 var ss = Math.max(3, Math.min(h, w) * 0.05); // half of symbol size1814 var i = 3; //indent1815 c.ellipse(0, 0, w, h);1816 c.fillAndStroke();1817 1818 c.begin();1819 c.moveTo(w * 0.5 - ss, h * 0.05 + i);1820 c.lineTo(w * 0.5 + ss, h * 0.05 + i);1821 c.moveTo(w * 0.5, h * 0.05 - ss + i);1822 c.lineTo(w * 0.5, h * 0.05 + ss + i);1823 c.moveTo(w * 0.5 - ss, h * 0.95 - i);1824 c.lineTo(w * 0.5 + ss, h * 0.95 - i);1825 c.stroke();1826};18271828mxCellRenderer.registerShape(mxShapeElectricalDCSource3_v2.prototype.cst.SHAPE_DC_SOURCE_3_V2, mxShapeElectricalDCSource3_v2);18291830mxShapeElectricalDCSource3_v2.prototype.constraints = [1831 new mxConnectionConstraint(new mxPoint(0.5, 0), true),1832 new mxConnectionConstraint(new mxPoint(0.5, 1), true)1833 ];18341835//**********************************************************************************************************************************************************1836//Source1837//**********************************************************************************************************************************************************1838/**1839* Extends mxShape.1840*/1841function mxShapeElectricalSource(bounds, fill, stroke, strokewidth)1842{1843 mxShape.call(this);1844 this.bounds = bounds;1845 this.fill = fill;1846 this.stroke = stroke;1847 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1848};18491850/**1851* Extends mxShape.1852*/1853mxUtils.extend(mxShapeElectricalSource, mxShape);18541855mxShapeElectricalSource.prototype.cst = {1856 SHAPE_SOURCE : 'mxgraph.electrical.signal_sources.source'1857};18581859mxShapeElectricalSource.prototype.customProperties = [1860 {name: 'elSourceType', dispName: 'Source Type', type: 'enum', defVal: 'independent',1861 enumList: [{val: 'independent', dispName: 'Independent'}, 1862 {val: 'dependent', dispName: 'Dependent'}]1863 },1864 {name: 'elSignalType', dispName: 'Signal Type', type: 'enum', defVal: 'ac',1865 enumList: [{val: 'ac', dispName: 'AC'}, 1866 {val: 'none', dispName: 'None'},1867 {val: 'square', dispName: 'Square'},1868 {val: 'triangular', dispName: 'Triangular'},1869 {val: 'sawtooth', dispName: 'Sawtooth'},1870 {val: 'noise', dispName: 'Noise'},1871 {val: 'ideal', dispName: 'Ideal'},1872 {val: 'expSquib', dispName: 'Explosive Squib'},1873 {val: 'pulse', dispName: 'Pulse'},1874 {val: 'invPulse', dispName: 'Inverse Pulse'},1875 {val: 'chopSquare', dispName: 'Chopped Square'},1876 {val: 'stepOn', dispName: 'Step On'},1877 {val: 'stepOff', dispName: 'Step Off'},1878 {val: 'dc1', dispName: 'DC Horizontal'},1879 {val: 'dc2', dispName: 'DC Vertical'},1880 {val: 'dc3', dispName: 'DC Plus minus'}]1881 }1882];18831884/**1885* Function: paintVertexShape1886* 1887* Paints the vertex shape.1888*/1889mxShapeElectricalSource.prototype.paintVertexShape = function(c, x, y, w, h)1890{1891 c.translate(x, y);1892 1893 var sourceType = mxUtils.getValue(this.style, 'elSourceType', 'independent');1894 var signalType = mxUtils.getValue(this.style, 'elSignalType', 'none');18951896 switch (sourceType)1897 {1898 case "independent" :1899 c.ellipse(0, 0, w, h);1900 c.fillAndStroke();1901 break;1902 case "dependent" :1903 c.begin();1904 c.moveTo(0, h * 0.5);1905 c.lineTo(w * 0.5, 0);1906 c.lineTo(w, h * 0.5);1907 c.lineTo(w * 0.5, h);1908 c.lineTo(0, h * 0.5);1909 c.close();1910 c.fillAndStroke();1911 break;1912 }1913 1914 switch (signalType)1915 {1916 case "ac" :1917 c.begin();1918 c.moveTo(w * 0.3, h * 0.5);1919 c.quadTo(w * 0.34, h * 0.35, w * 0.4, h * 0.35);1920 c.quadTo(w * 0.46, h * 0.35, w * 0.5, h * 0.5);1921 c.quadTo(w * 0.53, h * 0.65, w * 0.6, h * 0.65);1922 c.quadTo(w * 0.66, h * 0.65, w * 0.7, h * 0.5);1923 c.stroke();1924 break;1925 case "square" :1926 c.begin();1927 c.moveTo(w * 0.3, h * 0.5);1928 c.lineTo(w * 0.3, h * 0.35);1929 c.lineTo(w * 0.5, h * 0.35);1930 c.lineTo(w * 0.5, h * 0.65);1931 c.lineTo(w * 0.7, h * 0.65);1932 c.lineTo(w * 0.7, h * 0.5);1933 c.stroke();1934 break;1935 case "triangular" :1936 c.begin();1937 c.moveTo(w * 0.3, h * 0.65);1938 c.lineTo(w * 0.4, h * 0.35);1939 c.lineTo(w * 0.5, h * 0.65);1940 c.lineTo(w * 0.6, h * 0.35);1941 c.lineTo(w * 0.7, h * 0.65);1942 c.stroke();1943 break;1944 case "sawtooth" :1945 c.begin();1946 c.moveTo(w * 0.24, h * 0.65);1947 c.lineTo(w * 0.42, h * 0.35);1948 c.lineTo(w * 0.42, h * 0.65);1949 c.lineTo(w * 0.58, h * 0.35);1950 c.lineTo(w * 0.58, h * 0.65);1951 c.lineTo(w * 0.76, h * 0.35);1952 c.lineTo(w * 0.76, h * 0.65);1953 c.stroke();1954 break;1955 case "noise" :1956 c.begin();1957 c.moveTo(w * 0.5, h * 0.17);1958 c.lineTo(w * 0.5, h * 0.5);1959 c.moveTo(w * 0.18, h * 0.42);1960 c.lineTo(w * 0.5, h * 0.5);1961 c.moveTo(w * 0.32, h * 0.78);1962 c.lineTo(w * 0.5, h * 0.5);1963 c.moveTo(w * 0.82, h * 0.42);1964 c.lineTo(w * 0.5, h * 0.5);1965 c.moveTo(w * 0.68, h * 0.78);1966 c.lineTo(w * 0.5, h * 0.5);1967 c.stroke();1968 break;1969 case "ideal" :1970 c.begin();1971 c.moveTo(0, h * 0.5);1972 c.lineTo(w, h * 0.5);1973 c.stroke();1974 break;1975 case "expSquib" :1976 c.ellipse(0, h * 0.43, w * 0.14, h * 0.14);1977 c.stroke();1978 c.ellipse(w * 0.86, h * 0.43, w * 0.14, h * 0.14);1979 c.stroke();1980 c.begin();1981 c.moveTo(w * 0.83, h * 0.63);1982 c.lineTo(w * 0.73, h * 0.73);1983 c.lineTo(w * 0.27, h * 0.27);1984 c.lineTo(w * 0.17, h * 0.37);1985 c.stroke();1986 c.begin();19871988 var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#000000');1989 c.setFillColor(strokeColor);1990 1991 c.moveTo(w * 0.2, h * 0.25);1992 c.lineTo(w * 0.13, h * 0.4);1993 c.lineTo(w * 0.28, h * 0.33);1994 c.close();1995 c.fillAndStroke();1996 break;1997 case "pulse" :1998 c.begin();1999 c.moveTo(w * 0.3, h * 0.65);2000 c.lineTo(w * 0.4, h * 0.65);2001 c.lineTo(w * 0.4, h * 0.35);2002 c.lineTo(w * 0.6, h * 0.35);2003 c.lineTo(w * 0.6, h * 0.65);2004 c.lineTo(w * 0.7, h * 0.65);2005 c.stroke();2006 break;2007 case "invPulse" :2008 c.begin();2009 c.moveTo(w * 0.3, h * 0.35);2010 c.lineTo(w * 0.4, h * 0.35);2011 c.lineTo(w * 0.4, h * 0.65);2012 c.lineTo(w * 0.6, h * 0.65);2013 c.lineTo(w * 0.6, h * 0.35);2014 c.lineTo(w * 0.7, h * 0.35);2015 c.stroke();2016 break;2017 case "chopSquare" :2018 c.begin();2019 c.moveTo(w * 0.3, h * 0.5);2020 c.lineTo(w * 0.33, h * 0.35);2021 c.lineTo(w * 0.47, h * 0.35);2022 c.lineTo(w * 0.53, h * 0.65);2023 c.lineTo(w * 0.67, h * 0.65);2024 c.lineTo(w * 0.7, h * 0.5);2025 c.stroke();2026 break;2027 case "stepOn" :2028 c.begin();2029 c.moveTo(w * 0.3, h * 0.65);2030 c.lineTo(w * 0.5, h * 0.65);2031 c.lineTo(w * 0.5, h * 0.35);2032 c.lineTo(w * 0.7, h * 0.35);2033 c.stroke();2034 break;2035 case "stepOff" :2036 c.begin();2037 c.moveTo(w * 0.3, h * 0.35);2038 c.lineTo(w * 0.5, h * 0.35);2039 c.lineTo(w * 0.5, h * 0.65);2040 c.lineTo(w * 0.7, h * 0.65);2041 c.stroke();2042 break;2043 case "dc1" :2044 c.begin();2045 c.moveTo(w * 0.17, h * 0.5);2046 c.lineTo(w * 0.83, h * 0.5);2047 c.moveTo(w * 0.67, h * 0.42);2048 c.lineTo(w * 0.83, h * 0.5);2049 c.lineTo(w * 0.67, h * 0.58);2050 c.stroke();2051 break;2052 case "dc2" :2053 c.begin();2054 c.moveTo(w * 0.5, h * 0.17);2055 c.lineTo(w * 0.5, h * 0.83);2056 c.moveTo(w * 0.42, h * 0.67);2057 c.lineTo(w * 0.5, h * 0.83);2058 c.lineTo(w * 0.58, h * 0.67);2059 c.stroke();2060 break;2061 case "dc3" :2062 var ss = Math.max(3, Math.min(h, w) * 0.05); // half of symbol size2063 var i = 3; //indent2064 2065 if (sourceType == 'dependent')2066 {2067 i += 3;2068 }2069 2070 c.begin();2071 c.moveTo(w * 0.5 - ss, h * 0.05 + i);2072 c.lineTo(w * 0.5 + ss, h * 0.05 + i);2073 c.moveTo(w * 0.5, h * 0.05 - ss + i);2074 c.lineTo(w * 0.5, h * 0.05 + ss + i);2075 c.moveTo(w * 0.5 - ss, h * 0.95 - i);2076 c.lineTo(w * 0.5 + ss, h * 0.95 - i);2077 c.stroke();2078 break;2079 }2080};20812082mxCellRenderer.registerShape(mxShapeElectricalSource.prototype.cst.SHAPE_SOURCE, mxShapeElectricalSource);20832084//**********************************************************************************************************************************************************2085// Two way switch2086//**********************************************************************************************************************************************************2087/**2088* Extends mxShape.2089*/2090function mxShapeElectricalTwoWaySwitch(bounds, fill, stroke, strokewidth)2091{2092 mxShape.call(this);2093 this.bounds = bounds;2094 this.fill = fill;2095 this.stroke = stroke;2096 this.strokewidth = (strokewidth != null) ? strokewidth : 1;2097};20982099/**2100* Extends mxShape.2101*/2102mxUtils.extend(mxShapeElectricalTwoWaySwitch, mxShape);21032104mxShapeElectricalTwoWaySwitch.prototype.cst = {2105 SHAPE_TWO_WAY_SWITCH : 'mxgraph.electrical.electro-mechanical.twoWaySwitch'2106};21072108mxShapeElectricalTwoWaySwitch.prototype.customProperties = [2109 {name: 'elSwitchState', dispName: 'Switch State', type: 'int', min:1, defVal: '1'}2110];21112112/**2113* Function: paintVertexShape2114* 2115* Paints the vertex shape.2116*/2117mxShapeElectricalTwoWaySwitch.prototype.paintVertexShape = function(c, x, y, w, h)2118{2119 c.translate(x, y);2120 var switchState = mxUtils.getValue(this.style, 'elSwitchState', '1');2121 2122 c.begin();21232124 c.moveTo(0, 0.5 * h);2125 c.lineTo(0.2 * w, 0.5 * h);2126 2127 c.moveTo(0.8 * w, 0.88 * h);2128 c.lineTo(w, 0.88 * h);21292130 c.moveTo(0.8 * w, 0.12 * h);2131 c.lineTo(w, 0.12 * h);21322133 if (switchState == '2')2134 {2135 c.moveTo(0.28 * w, 0.48 * h);2136 c.lineTo(0.72 * w, 0.15 * h);2137 }2138 else2139 {2140 c.moveTo(0.28 * w, 0.52 * h);2141 c.lineTo(0.72 * w, 0.85 * h);2142 }21432144 c.stroke();2145 2146 c.ellipse(0.72 * w, 0.77 * h, 0.08 * w, 0.23 * h);2147 c.fillAndStroke();2148 c.ellipse(0.72 * w, 0, 0.08 * w, 0.23 * h);2149 c.fillAndStroke();2150 c.ellipse(0.2 * w, 0.385 * h, 0.08 * w, 0.23 * h);2151 c.fillAndStroke();2152};21532154mxCellRenderer.registerShape(mxShapeElectricalTwoWaySwitch.prototype.cst.SHAPE_TWO_WAY_SWITCH, mxShapeElectricalTwoWaySwitch);21552156mxShapeElectricalTwoWaySwitch.prototype.constraints = [2157 new mxConnectionConstraint(new mxPoint(1, 0.12), true),2158 new mxConnectionConstraint(new mxPoint(0, 0.5), true),2159 new mxConnectionConstraint(new mxPoint(1, 0.88), true)2160 ];21612162//**********************************************************************************************************************************************************2163// Pushbutton2164//**********************************************************************************************************************************************************2165/**2166* Extends mxShape.2167*/2168function mxShapeElectricalPushbutton(bounds, fill, stroke, strokewidth)2169{2170 mxShape.call(this);2171 this.bounds = bounds;2172 this.fill = fill;2173 this.stroke = stroke;2174 this.strokewidth = (strokewidth != null) ? strokewidth : 1;2175};21762177/**2178* Extends mxShape.2179*/2180mxUtils.extend(mxShapeElectricalPushbutton, mxShape);21812182mxShapeElectricalPushbutton.prototype.cst = {2183 SHAPE_PUSHBUTTON : 'mxgraph.electrical.electro-mechanical.pushbutton'2184};21852186mxShapeElectricalPushbutton.prototype.customProperties = [2187 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: 'on',2188 enumList:[2189 {val:'on', dispName:'On'},2190 {val:'off', dispName:'Off'}2191 ]}2192];21932194/**2195* Function: paintVertexShape2196* 2197* Paints the vertex shape.2198*/2199mxShapeElectricalPushbutton.prototype.paintVertexShape = function(c, x, y, w, h)2200{2201 c.translate(x, y);2202 var switchState = mxUtils.getValue(this.style, 'elSwitchState', 'on');22032204 c.begin();22052206 c.moveTo(0, 0.8 * h);2207 c.lineTo(0.2 * w, 0.8 * h);2208 c.moveTo(0.8 * w, 0.8 * h);2209 c.lineTo(w, 0.8 * h);22102211 if (switchState == 'off')2212 {2213 c.moveTo(0.5 * w, 0.5 * h);2214 c.lineTo(0.5 * w, 0);2215 c.moveTo(0.46 * w, 0);2216 c.lineTo(0.54 * w, 0);2217 c.moveTo(0.2 * w, 0.5 * h);2218 c.lineTo(0.8 * w, 0.5 * h);2219 }2220 else2221 {2222 c.moveTo(0.5 * w, h);2223 c.lineTo(0.5 * w, 0.5 * h);2224 c.moveTo(0.46 * w, 0.5 * h);2225 c.lineTo(0.54 * w, 0.5 * h);2226 c.moveTo(0.2 * w, h);2227 c.lineTo(0.8 * w, h);2228 }22292230 c.stroke();2231 2232 c.ellipse(0.72 * w, 0.65 * h, 0.08 * w, 0.3 * h);2233 c.fillAndStroke();2234 c.ellipse(0.2 * w, 0.65 * h, 0.08 * w, 0.3 * h);2235 c.fillAndStroke();2236};22372238mxCellRenderer.registerShape(mxShapeElectricalPushbutton.prototype.cst.SHAPE_PUSHBUTTON, mxShapeElectricalPushbutton);22392240mxShapeElectricalPushbutton.prototype.constraints = [2241 new mxConnectionConstraint(new mxPoint(0, 0.8), true),2242 new mxConnectionConstraint(new mxPoint(1, 0.8), true)2243 ];22442245//**********************************************************************************************************************************************************2246// Single switch2247//**********************************************************************************************************************************************************2248/**2249* Extends mxShape.2250*/2251function mxShapeElectricalSingleSwitch(bounds, fill, stroke, strokewidth)2252{2253 mxShape.call(this);2254 this.bounds = bounds;2255 this.fill = fill;2256 this.stroke = stroke;2257 this.strokewidth = (strokewidth != null) ? strokewidth : 1;2258};22592260/**2261* Extends mxShape.2262*/2263mxUtils.extend(mxShapeElectricalSingleSwitch, mxShape);22642265mxShapeElectricalSingleSwitch.prototype.cst = {2266 SHAPE_SINGLE_SWITCH : 'mxgraph.electrical.electro-mechanical.singleSwitch'2267};22682269mxShapeElectricalSingleSwitch.prototype.customProperties = [2270 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: 'on',2271 enumList:[2272 {val:'on', dispName:'On'},2273 {val:'off', dispName:'Off'}2274 ]}2275];22762277/**2278* Function: paintVertexShape2279* 2280* Paints the vertex shape.2281*/2282mxShapeElectricalSingleSwitch.prototype.paintVertexShape = function(c, x, y, w, h)2283{2284 c.translate(x, y);2285 var switchState = mxUtils.getValue(this.style, 'elSwitchState', 'on');22862287 c.begin();22882289 c.moveTo(0, 0.8 * h);2290 c.lineTo(0.2 * w, 0.8 * h);2291 c.moveTo(0.8 * w, 0.8 * h);2292 c.lineTo(w, 0.8 * h);22932294 if (switchState == 'off')2295 {2296 c.moveTo(0.28 * w, 0.75 * h);2297 c.lineTo(0.76 * w, 0);2298 }2299 else2300 {2301 c.moveTo(0.2 * w, 0.8 * h);2302 c.lineTo(0.8 * w, 0.8 * h);2303 }23042305 c.stroke();2306 2307 c.ellipse(0.72 * w, 0.65 * h, 0.08 * w, 0.3 * h);2308 c.fillAndStroke();2309 c.ellipse(0.2 * w, 0.65 * h, 0.08 * w, 0.3 * h);2310 c.fillAndStroke();2311};23122313mxCellRenderer.registerShape(mxShapeElectricalSingleSwitch.prototype.cst.SHAPE_SINGLE_SWITCH, mxShapeElectricalSingleSwitch);23142315mxShapeElectricalSingleSwitch.prototype.constraints = [2316 new mxConnectionConstraint(new mxPoint(0, 0.8), true),2317 new mxConnectionConstraint(new mxPoint(1, 0.8), true)2318 ];23192320//**********************************************************************************************************************************************************2321// Switch disconnector2322//**********************************************************************************************************************************************************2323/**2324* Extends mxShape.2325*/2326function mxShapeElectricalSwitchDisconnector(bounds, fill, stroke, strokewidth)2327{2328 mxShape.call(this);2329 this.bounds = bounds;2330 this.fill = fill;2331 this.stroke = stroke;2332 this.strokewidth = (strokewidth != null) ? strokewidth : 1;2333};23342335/**2336* Extends mxShape.2337*/2338mxUtils.extend(mxShapeElectricalSwitchDisconnector, mxShape);23392340mxShapeElectricalSwitchDisconnector.prototype.cst = {2341 SHAPE_SWITCH_DISCONNECTOR : 'mxgraph.electrical.electro-mechanical.switchDisconnector'2342};23432344mxShapeElectricalSwitchDisconnector.prototype.customProperties = [2345 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: 'on',2346 enumList:[2347 {val:'on', dispName:'On'},2348 {val:'off', dispName:'Off'}2349 ]}2350];23512352/**2353* Function: paintVertexShape2354* 2355* Paints the vertex shape.2356*/2357mxShapeElectricalSwitchDisconnector.prototype.paintVertexShape = function(c, x, y, w, h)2358{2359 c.translate(x, y);2360 var switchState = mxUtils.getValue(this.style, 'elSwitchState', 'on');23612362 c.begin();23632364 c.moveTo(0.8 * w, 0.84 * h);2365 c.lineTo(w, 0.84 * h);2366 c.moveTo(0.8 * w, 0.68 * h);2367 c.lineTo(0.8 * w, h);2368 c.moveTo(0, 0.84 * h);2369 c.lineTo(0.24 * w, 0.84 * h);23702371 if (switchState == 'off')2372 {2373 c.lineTo(0.76 * w, 0);2374 }2375 else2376 {2377 c.lineTo(0.8 * w, 0.84 * h);2378 }23792380 c.stroke();2381 2382 c.ellipse(0.72 * w, 0.68 * h, 0.08 * w, 0.32 * h);2383 c.fillAndStroke();2384};23852386mxCellRenderer.registerShape(mxShapeElectricalSwitchDisconnector.prototype.cst.SHAPE_SWITCH_DISCONNECTOR, mxShapeElectricalSwitchDisconnector);23872388mxShapeElectricalSwitchDisconnector.prototype.constraints = [2389 new mxConnectionConstraint(new mxPoint(0, 0.84), true),2390 new mxConnectionConstraint(new mxPoint(1, 0.84), true)2391 ];23922393//**********************************************************************************************************************************************************2394// Fuse 22395//**********************************************************************************************************************************************************2396/**2397* Extends mxShape.2398*/2399function mxShapeElectricalFuse2(bounds, fill, stroke, strokewidth)2400{2401 mxShape.call(this);2402 this.bounds = bounds;2403 this.fill = fill;2404 this.stroke = stroke;2405 this.strokewidth = (strokewidth != null) ? strokewidth : 1;2406};24072408/**2409* Extends mxShape.2410*/2411mxUtils.extend(mxShapeElectricalFuse2, mxShape);24122413mxShapeElectricalFuse2.prototype.cst = {2414 SHAPE_FUSE2 : 'mxgraph.electrical.electro-mechanical.fuse2'2415};24162417mxShapeElectricalFuse2.prototype.customProperties = [2418 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: 'on',2419 enumList:[2420 {val:'on', dispName:'On'},2421 {val:'off', dispName:'Off'}2422 ]}2423];24242425/**2426* Function: paintVertexShape2427* 2428* Paints the vertex shape.2429*/2430mxShapeElectricalFuse2.prototype.paintVertexShape = function(c, x, y, w, h)2431{2432 c.translate(x, y);2433 var switchState = mxUtils.getValue(this.style, 'elSwitchState', 'on');24342435 c.begin();24362437 c.moveTo(0.8 * w, 0.8 * h);2438 c.lineTo(w, 0.8 * h);2439 c.moveTo(0, 0.8 * h);2440 c.lineTo(0.25 * w, 0.8 * h);24412442 if (switchState == 'off')2443 {2444 c.lineTo(0.76 * w, 0);2445 2446 c.moveTo(0.348 * w, 0.47 * h);2447 c.lineTo(0.563 * w, 0.13 * h);2448 c.lineTo(0.603 * w, 0.46 * h);2449 c.lineTo(0.387 * w, 0.78 * h);2450 c.close();2451 }2452 else2453 {2454 c.lineTo(0.8 * w, 0.8 * h);24552456 c.moveTo(0.38 * w, 0.6 * h);2457 c.lineTo(0.62 * w, 0.6 * h);2458 c.lineTo(0.62 * w, h);2459 c.lineTo(0.38 * w, h);2460 c.close();2461 }24622463 c.stroke();2464};24652466mxCellRenderer.registerShape(mxShapeElectricalFuse2.prototype.cst.SHAPE_FUSE2, mxShapeElectricalFuse2);24672468mxShapeElectricalFuse2.prototype.constraints = [2469 new mxConnectionConstraint(new mxPoint(0, 0.8), true),2470 new mxConnectionConstraint(new mxPoint(1, 0.8), true)2471 ];24722473//**********************************************************************************************************************************************************2474// Liquid Level Actuated Switch2475//**********************************************************************************************************************************************************2476/**2477* Extends mxShape.2478*/2479function mxShapeElectricalLiquidLevelActuatedSwitch(bounds, fill, stroke, strokewidth)2480{2481 mxShape.call(this);2482 this.bounds = bounds;2483 this.fill = fill;2484 this.stroke = stroke;2485 this.strokewidth = (strokewidth != null) ? strokewidth : 1;2486};24872488/**2489* Extends mxShape.2490*/2491mxUtils.extend(mxShapeElectricalLiquidLevelActuatedSwitch, mxShape);24922493mxShapeElectricalLiquidLevelActuatedSwitch.prototype.cst = {2494 SHAPE_LIQUID_LEVEL_ACTUATED_SWITCH : 'mxgraph.electrical.electro-mechanical.liquidLevelActuatedSwitch'2495};24962497mxShapeElectricalLiquidLevelActuatedSwitch.prototype.customProperties = [2498 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: 'on',2499 enumList:[2500 {val:'on', dispName:'On'},2501 {val:'off', dispName:'Off'}2502 ]}2503];25042505/**2506* Function: paintVertexShape2507* 2508* Paints the vertex shape.2509*/2510mxShapeElectricalLiquidLevelActuatedSwitch.prototype.paintVertexShape = function(c, x, y, w, h)2511{2512 c.translate(x, y);2513 var switchState = mxUtils.getValue(this.style, 'elSwitchState', 'on');25142515 c.begin();25162517 c.moveTo(0.8 * w, 0.27 * h);2518 c.lineTo(w, 0.27 * h);2519 c.moveTo(0, 0.27 * h);2520 c.lineTo(0.2 * w, 0.27 * h);25212522 if (switchState == 'off')2523 {2524 c.moveTo(0.24 * w, 0);2525 c.lineTo(0.76 * w, 0);2526 c.moveTo(0.5 * w, 0);2527 c.lineTo(0.5 * w, 0.47 * h);2528 c.stroke();25292530 c.ellipse(0.45 * w, 0.47 * h, 0.1 * w, 0.26 * h);2531 c.fillAndStroke();2532 }2533 else2534 {2535 c.moveTo(0.28 * w, 0.27 * h);2536 c.lineTo(0.72 * w, 0.27 * h);2537 c.moveTo(0.5 * w, 0.27 * h);2538 c.lineTo(0.5 * w, 0.74 * h);2539 c.stroke();25402541 c.ellipse(0.45 * w, 0.74 * h, 0.1 * w, 0.26 * h);2542 c.fillAndStroke();2543 }254425452546 c.ellipse(0.2 * w, 0.17 * h, 0.08 * w, 0.2 * h);2547 c.fillAndStroke();25482549 c.ellipse(0.72 * w, 0.17 * h, 0.08 * w, 0.2 * h);2550 c.fillAndStroke();2551};25522553mxCellRenderer.registerShape(mxShapeElectricalLiquidLevelActuatedSwitch.prototype.cst.SHAPE_LIQUID_LEVEL_ACTUATED_SWITCH, mxShapeElectricalLiquidLevelActuatedSwitch);25542555mxShapeElectricalLiquidLevelActuatedSwitch.prototype.constraints = [2556 new mxConnectionConstraint(new mxPoint(0, 0.27), true),2557 new mxConnectionConstraint(new mxPoint(1, 0.27), true)2558 ];25592560//**********************************************************************************************************************************************************2561// Liquid Level Actuated Switch 22562//**********************************************************************************************************************************************************2563/**2564* Extends mxShape.2565*/2566function mxShapeElectricalLiquidLevelActuatedSwitch2(bounds, fill, stroke, strokewidth)2567{2568 mxShape.call(this);2569 this.bounds = bounds;2570 this.fill = fill;2571 this.stroke = stroke;2572 this.strokewidth = (strokewidth != null) ? strokewidth : 1;2573};25742575/**2576* Extends mxShape.2577*/2578mxUtils.extend(mxShapeElectricalLiquidLevelActuatedSwitch2, mxShape);25792580mxShapeElectricalLiquidLevelActuatedSwitch2.prototype.cst = {2581 SHAPE_LIQUID_LEVEL_ACTUATED_SWITCH_2 : 'mxgraph.electrical.electro-mechanical.liquidLevelActuatedSwitch2'2582};25832584mxShapeElectricalLiquidLevelActuatedSwitch2.prototype.customProperties = [2585 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: 'on',2586 enumList:[2587 {val:'on', dispName:'On'},2588 {val:'off', dispName:'Off'}2589 ]}2590];25912592/**2593* Function: paintVertexShape2594* 2595* Paints the vertex shape.2596*/2597mxShapeElectricalLiquidLevelActuatedSwitch2.prototype.paintVertexShape = function(c, x, y, w, h)2598{2599 c.translate(x, y);2600 var switchState = mxUtils.getValue(this.style, 'elSwitchState', 'on');26012602 c.begin();26032604 c.moveTo(0.76 * w, h);2605 c.lineTo(w, h);2606 c.moveTo(0, h);2607 c.lineTo(0.24 * w, h);26082609 if (switchState == 'off')2610 {2611 c.lineTo(0.76 * w, 0.5 * h);2612 c.moveTo(0.42 * w, 0);2613 c.lineTo(0.58 * w, 0);2614 c.lineTo(0.58 * w, 0.4 * h);2615 c.lineTo(0.42 * w, 0.4 * h);2616 c.close();2617 c.moveTo(0.46 * w, 0.22 * h);2618 c.arcTo(0.05 * w, 0.1 * h, 0, 0, 1, 0.54 * w, 0.22 * h);2619 c.arcTo(0.05 * w, 0.1 * h, 0, 0, 1, 0.46 * w, 0.22 * h);2620 c.close();2621 c.moveTo(0.5 * w, 0.1 * h);2622 c.lineTo(0.5 * w, 0.17 * h);2623 c.moveTo(0.5 * w, 0.4 * h);2624 c.lineTo(0.5 * w, 0.55 * h);2625 c.moveTo(0.5 * w, 0.63 * h);2626 c.lineTo(0.5 * w, 0.75 * h);2627 c.stroke();2628 }2629 else2630 {2631 c.lineTo(0.76 * w, h);2632 c.moveTo(0.42 * w, 0.25 * h);2633 c.lineTo(0.58 * w, 0.25 * h);2634 c.lineTo(0.58 * w, 0.65 * h);2635 c.lineTo(0.42 * w, 0.65 * h);2636 c.close();2637 c.moveTo(0.46 * w, 0.47 * h);2638 c.arcTo(0.05 * w, 0.1 * h, 0, 0, 1, 0.54 * w, 0.47 * h);2639 c.arcTo(0.05 * w, 0.1 * h, 0, 0, 1, 0.46 * w, 0.47 * h);2640 c.close();2641 c.moveTo(0.5 * w, 0.35 * h);2642 c.lineTo(0.5 * w, 0.42 * h);2643 c.moveTo(0.5 * w, 0.65 * h);2644 c.lineTo(0.5 * w, 0.8 * h);2645 c.moveTo(0.5 * w, 0.88 * h);2646 c.lineTo(0.5 * w, h);2647 c.stroke();2648 c.stroke();2649 }2650};26512652mxCellRenderer.registerShape(mxShapeElectricalLiquidLevelActuatedSwitch2.prototype.cst.SHAPE_LIQUID_LEVEL_ACTUATED_SWITCH_2, mxShapeElectricalLiquidLevelActuatedSwitch2);26532654mxShapeElectricalLiquidLevelActuatedSwitch2.prototype.constraints = [2655 new mxConnectionConstraint(new mxPoint(0, 1), true),2656 new mxConnectionConstraint(new mxPoint(1, 1), true)2657 ];26582659//**********************************************************************************************************************************************************2660// Gas Flow Actuated Switch2661//**********************************************************************************************************************************************************2662/**2663* Extends mxShape.2664*/2665function mxShapeElectricalGasFlowActuatedSwitch(bounds, fill, stroke, strokewidth)2666{2667 mxShape.call(this);2668 this.bounds = bounds;2669 this.fill = fill;2670 this.stroke = stroke;2671 this.strokewidth = (strokewidth != null) ? strokewidth : 1;2672};26732674/**2675* Extends mxShape.2676*/2677mxUtils.extend(mxShapeElectricalGasFlowActuatedSwitch, mxShape);26782679mxShapeElectricalGasFlowActuatedSwitch.prototype.cst = {2680 SHAPE_GAS_FLOW_ACTUATED_SWITCH : 'mxgraph.electrical.electro-mechanical.gasFlowActuatedSwitch'2681};26822683mxShapeElectricalGasFlowActuatedSwitch.prototype.customProperties = [2684 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: 'on',2685 enumList:[2686 {val:'on', dispName:'On'},2687 {val:'off', dispName:'Off'}2688 ]}2689];26902691/**2692* Function: paintVertexShape2693* 2694* Paints the vertex shape.2695*/2696mxShapeElectricalGasFlowActuatedSwitch.prototype.paintVertexShape = function(c, x, y, w, h)2697{2698 c.translate(x, y);2699 var switchState = mxUtils.getValue(this.style, 'elSwitchState', 'on');27002701 c.begin();27022703 c.moveTo(0.76 * w, h);2704 c.lineTo(w, h);2705 c.moveTo(0, h);2706 c.lineTo(0.24 * w, h);27072708 if (switchState == 'off')2709 {2710 c.lineTo(0.76 * w, 0.5 * h);2711 c.moveTo(0.42 * w, 0);2712 c.lineTo(0.58 * w, 0);2713 c.lineTo(0.58 * w, 0.4 * h);2714 c.lineTo(0.42 * w, 0.4 * h);2715 c.close();2716 2717 c.moveTo(0.54 * w, 0.34 * h);2718 c.lineTo(0.54 * w, 0.09 * h);2719 c.lineTo(0.46 * w, 0.09 * h);2720 c.lineTo(0.46 * w, 0.26 * h);2721 c.lineTo(0.54 * w, 0.26 * h);2722 c.moveTo(0.5 * w, 0.4 * h);2723 c.lineTo(0.5 * w, 0.55 * h);2724 c.moveTo(0.5 * w, 0.63 * h);2725 c.lineTo(0.5 * w, 0.75 * h);2726 c.stroke();2727 2728 c.ellipse(0.475 * w, 0.165 * h, 0.025 * w, 0.06 * h);2729 c.stroke();2730 }2731 else2732 {2733 c.lineTo(0.76 * w, h);2734 c.moveTo(0.42 * w, 0.25 * h);2735 c.lineTo(0.58 * w, 0.25 * h);2736 c.lineTo(0.58 * w, 0.65 * h);2737 c.lineTo(0.42 * w, 0.65 * h);2738 c.close();2739 2740 c.moveTo(0.54 * w, 0.59 * h);2741 c.lineTo(0.54 * w, 0.34 * h);2742 c.lineTo(0.46 * w, 0.34 * h);2743 c.lineTo(0.46 * w, 0.51 * h);2744 c.lineTo(0.54 * w, 0.51 * h);2745 c.moveTo(0.5 * w, 0.65 * h);2746 c.lineTo(0.5 * w, 0.80 * h);2747 c.moveTo(0.5 * w, 0.88 * h);2748 c.lineTo(0.5 * w, h);2749 c.stroke();2750 2751 c.ellipse(0.475 * w, 0.415 * h, 0.025 * w, 0.06 * h);2752 c.stroke();2753 }2754};27552756mxCellRenderer.registerShape(mxShapeElectricalGasFlowActuatedSwitch.prototype.cst.SHAPE_GAS_FLOW_ACTUATED_SWITCH, mxShapeElectricalGasFlowActuatedSwitch);27572758mxShapeElectricalGasFlowActuatedSwitch.prototype.constraints = [2759 new mxConnectionConstraint(new mxPoint(0, 1), true),2760 new mxConnectionConstraint(new mxPoint(1, 1), true)2761 ];27622763//**********************************************************************************************************************************************************2764// Flow Actuated Switch2765//**********************************************************************************************************************************************************2766/**2767* Extends mxShape.2768*/2769function mxShapeElectricalFlowActuatedSwitch(bounds, fill, stroke, strokewidth)2770{2771 mxShape.call(this);2772 this.bounds = bounds;2773 this.fill = fill;2774 this.stroke = stroke;2775 this.strokewidth = (strokewidth != null) ? strokewidth : 1;2776};27772778/**2779* Extends mxShape.2780*/2781mxUtils.extend(mxShapeElectricalFlowActuatedSwitch, mxShape);27822783mxShapeElectricalFlowActuatedSwitch.prototype.cst = {2784 SHAPE_FLOW_ACTUATED_SWITCH : 'mxgraph.electrical.electro-mechanical.flowActuatedSwitch'2785};27862787mxShapeElectricalFlowActuatedSwitch.prototype.customProperties = [2788 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: 'on',2789 enumList:[2790 {val:'on', dispName:'On'},2791 {val:'off', dispName:'Off'}2792 ]}2793];27942795/**2796* Function: paintVertexShape2797* 2798* Paints the vertex shape.2799*/2800mxShapeElectricalFlowActuatedSwitch.prototype.paintVertexShape = function(c, x, y, w, h)2801{2802 c.translate(x, y);2803 var switchState = mxUtils.getValue(this.style, 'elSwitchState', 'on');28042805 c.begin();28062807 c.moveTo(0.8 * w, 0.1 * h);2808 c.lineTo(w, 0.1 * h);2809 c.moveTo(0, 0.1 * h);2810 c.lineTo(0.2 * w, 0.1 * h);28112812 if (switchState == 'off')2813 {2814 c.moveTo(0.28 * w, 0.13 * h);2815 c.lineTo(0.76 * w, 0.61 * h);2816 c.moveTo(0.5 * w, 0.35 * h);2817 c.lineTo(0.5 * w, h);2818 c.lineTo(0.6 * w, h);2819 c.lineTo(0.5 * w, 0.68 * h);2820 }2821 else2822 {2823 c.moveTo(0.28 * w, 0.1 * h);2824 c.lineTo(0.72 * w, 0.1 * h);2825 c.moveTo(0.5 * w, 0.1 * h);2826 c.lineTo(0.5 * w, 0.85 * h);2827 c.lineTo(0.6 * w, 0.85 * h);2828 c.lineTo(0.5 * w, 0.53 * h);2829 }28302831 c.stroke();2832 2833 c.ellipse(0.2 * w, 0, 0.08 * w, 0.2 * h);2834 c.stroke();28352836 c.ellipse(0.72 * w, 0, 0.08 * w, 0.2 * h);2837 c.stroke();2838};28392840mxCellRenderer.registerShape(mxShapeElectricalFlowActuatedSwitch.prototype.cst.SHAPE_FLOW_ACTUATED_SWITCH, mxShapeElectricalFlowActuatedSwitch);28412842mxShapeElectricalFlowActuatedSwitch.prototype.constraints = [2843 new mxConnectionConstraint(new mxPoint(0, 0.27), true),2844 new mxConnectionConstraint(new mxPoint(1, 0.27), true)2845 ];28462847//**********************************************************************************************************************************************************2848// Pressure Actuated Switch2849//**********************************************************************************************************************************************************2850/**2851* Extends mxShape.2852*/2853function mxShapeElectricalPressureActuatedSwitch(bounds, fill, stroke, strokewidth)2854{2855 mxShape.call(this);2856 this.bounds = bounds;2857 this.fill = fill;2858 this.stroke = stroke;2859 this.strokewidth = (strokewidth != null) ? strokewidth : 1;2860};28612862/**2863* Extends mxShape.2864*/2865mxUtils.extend(mxShapeElectricalPressureActuatedSwitch, mxShape);28662867mxShapeElectricalPressureActuatedSwitch.prototype.cst = {2868 SHAPE_PRESSURE_ACTUATED_SWITCH : 'mxgraph.electrical.electro-mechanical.pressureActuatedSwitch'2869};28702871mxShapeElectricalPressureActuatedSwitch.prototype.customProperties = [2872 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: 'on',2873 enumList:[2874 {val:'on', dispName:'On'},2875 {val:'off', dispName:'Off'}2876 ]}2877];28782879/**2880* Function: paintVertexShape2881* 2882* Paints the vertex shape.2883*/2884mxShapeElectricalPressureActuatedSwitch.prototype.paintVertexShape = function(c, x, y, w, h)2885{2886 c.translate(x, y);2887 var switchState = mxUtils.getValue(this.style, 'elSwitchState', 'on');28882889 c.begin();28902891 c.moveTo(0.8 * w, 0.1 * h);2892 c.lineTo(w, 0.1 * h);2893 c.moveTo(0, 0.1 * h);2894 c.lineTo(0.2 * w, 0.1 * h);28952896 if (switchState == 'off')2897 {2898 c.moveTo(0.28 * w, 0.13 * h);2899 c.lineTo(0.76 * w, 0.61 * h);2900 c.moveTo(0.5 * w, 0.35 * h);2901 c.lineTo(0.5 * w, 0.74 * h);2902 c.moveTo(0.39 * w, h);2903 c.arcTo(0.11 * w, 0.26 * h, 0, 0, 1, 0.5 * w, 0.74 * h);2904 c.arcTo(0.11 * w, 0.26 * h, 0, 0, 1, 0.61 * w, h);2905 c.close();2906 }2907 else2908 {2909 c.moveTo(0.28 * w, 0.1 * h);2910 c.lineTo(0.72 * w, 0.1 * h);2911 c.moveTo(0.5 * w, 0.1 * h);2912 c.lineTo(0.5 * w, 0.49 * h);2913 c.moveTo(0.39 * w, 0.75 * h);2914 c.arcTo(0.11 * w, 0.26 * h, 0, 0, 1, 0.5 * w, 0.49 * h);2915 c.arcTo(0.11 * w, 0.26 * h, 0, 0, 1, 0.61 * w, 0.75 * h);2916 c.close();2917 }29182919 c.stroke();2920 2921 c.ellipse(0.2 * w, 0, 0.08 * w, 0.2 * h);2922 c.stroke();29232924 c.ellipse(0.72 * w, 0, 0.08 * w, 0.2 * h);2925 c.stroke();2926};29272928mxCellRenderer.registerShape(mxShapeElectricalPressureActuatedSwitch.prototype.cst.SHAPE_PRESSURE_ACTUATED_SWITCH, mxShapeElectricalPressureActuatedSwitch);29292930mxShapeElectricalPressureActuatedSwitch.prototype.constraints = [2931 new mxConnectionConstraint(new mxPoint(0, 0.1), true),2932 new mxConnectionConstraint(new mxPoint(1, 0.1), true)2933 ];29342935//**********************************************************************************************************************************************************2936// Temperature Actuated Switch2937//**********************************************************************************************************************************************************2938/**2939* Extends mxShape.2940*/2941function mxShapeElectricalTemperatureActuatedSwitch(bounds, fill, stroke, strokewidth)2942{2943 mxShape.call(this);2944 this.bounds = bounds;2945 this.fill = fill;2946 this.stroke = stroke;2947 this.strokewidth = (strokewidth != null) ? strokewidth : 1;2948};29492950/**2951* Extends mxShape.2952*/2953mxUtils.extend(mxShapeElectricalTemperatureActuatedSwitch, mxShape);29542955mxShapeElectricalTemperatureActuatedSwitch.prototype.cst = {2956 SHAPE_TEMPERATURE_ACTUATED_SWITCH : 'mxgraph.electrical.electro-mechanical.temperatureActuatedSwitch'2957};29582959mxShapeElectricalTemperatureActuatedSwitch.prototype.customProperties = [2960 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: 'on',2961 enumList:[2962 {val:'on', dispName:'On'},2963 {val:'off', dispName:'Off'}2964 ]}2965];29662967/**2968* Function: paintVertexShape2969* 2970* Paints the vertex shape.2971*/2972mxShapeElectricalTemperatureActuatedSwitch.prototype.paintVertexShape = function(c, x, y, w, h)2973{2974 c.translate(x, y);2975 var switchState = mxUtils.getValue(this.style, 'elSwitchState', 'on');29762977 c.begin();29782979 c.moveTo(0.8 * w, 0.1 * h);2980 c.lineTo(w, 0.1 * h);2981 c.moveTo(0, 0.1 * h);2982 c.lineTo(0.2 * w, 0.1 * h);29832984 if (switchState == 'off')2985 {2986 c.moveTo(0.28 * w, 0.13 * h);2987 c.lineTo(0.76 * w, 0.61 * h);2988 c.moveTo(0.5 * w, 0.35 * h);2989 c.lineTo(0.5 * w, 0.64 * h);2990 c.lineTo(0.57 * w, 0.64 * h);2991 c.lineTo(0.57 * w, 0.81 * h);2992 c.lineTo(0.5 * w, 0.81 * h);2993 c.lineTo(0.5 * w, h);2994 }2995 else2996 {2997 c.moveTo(0.28 * w, 0.1 * h);2998 c.lineTo(0.72 * w, 0.1 * h);2999 c.moveTo(0.5 * w, 0.1 * h);3000 c.lineTo(0.5 * w, 0.39 * h);3001 c.lineTo(0.57 * w, 0.39 * h);3002 c.lineTo(0.57 * w, 0.56 * h);3003 c.lineTo(0.5 * w, 0.56 * h);3004 c.lineTo(0.5 * w, 0.75 * h);3005 }30063007 c.stroke();3008 3009 c.ellipse(0.2 * w, 0, 0.08 * w, 0.2 * h);3010 c.stroke();30113012 c.ellipse(0.72 * w, 0, 0.08 * w, 0.2 * h);3013 c.stroke();3014};30153016mxCellRenderer.registerShape(mxShapeElectricalTemperatureActuatedSwitch.prototype.cst.SHAPE_TEMPERATURE_ACTUATED_SWITCH, mxShapeElectricalTemperatureActuatedSwitch);30173018mxShapeElectricalTemperatureActuatedSwitch.prototype.constraints = [3019 new mxConnectionConstraint(new mxPoint(0, 0.1), true),3020 new mxConnectionConstraint(new mxPoint(1, 0.1), true)3021 ];30223023//**********************************************************************************************************************************************************3024// Safety Interlock Switch3025//**********************************************************************************************************************************************************3026/**3027* Extends mxShape.3028*/3029function mxShapeElectricalSafetyInterlockSwitch(bounds, fill, stroke, strokewidth)3030{3031 mxShape.call(this);3032 this.bounds = bounds;3033 this.fill = fill;3034 this.stroke = stroke;3035 this.strokewidth = (strokewidth != null) ? strokewidth : 1;3036};30373038/**3039* Extends mxShape.3040*/3041mxUtils.extend(mxShapeElectricalSafetyInterlockSwitch, mxShape);30423043mxShapeElectricalSafetyInterlockSwitch.prototype.cst = {3044 SHAPE_SAFETY_INTERLOCK_SWITCH : 'mxgraph.electrical.electro-mechanical.safetyInterlockSwitch'3045};30463047mxShapeElectricalSafetyInterlockSwitch.prototype.customProperties = [3048 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: 'on',3049 enumList:[3050 {val:'on', dispName:'On'},3051 {val:'off', dispName:'Off'}3052 ]}3053];30543055/**3056* Function: paintVertexShape3057* 3058* Paints the vertex shape.3059*/3060mxShapeElectricalSafetyInterlockSwitch.prototype.paintVertexShape = function(c, x, y, w, h)3061{3062 c.translate(x, y);3063 var switchState = mxUtils.getValue(this.style, 'elSwitchState', 'on');30643065 c.begin();30663067 c.moveTo(0.8 * w, 0.34 * h);3068 c.lineTo(w, 0.34 * h);3069 c.moveTo(0, 0.34 * h);3070 c.lineTo(0.2 * w, 0.34 * h);30713072 if (switchState == 'off')3073 {3074 c.moveTo(0.25 * w, 0);3075 c.lineTo(0.75 * w, 0);3076 c.lineTo(0.5 * w, 0.81 * h);3077 c.close();3078 }3079 else3080 {3081 c.moveTo(0.25 * w, 0.19 * h);3082 c.lineTo(0.75 * w, 0.19 * h);3083 c.lineTo(0.5 * w, h);3084 c.close();3085 }30863087 c.stroke();3088 3089 c.ellipse(0.2 * w, 0.27 * h, 0.08 * w, 0.14 * h);3090 c.stroke();30913092 c.ellipse(0.72 * w, 0.27 * h, 0.08 * w, 0.14 * h);3093 c.stroke();3094};30953096mxCellRenderer.registerShape(mxShapeElectricalSafetyInterlockSwitch.prototype.cst.SHAPE_SAFETY_INTERLOCK_SWITCH, mxShapeElectricalSafetyInterlockSwitch);30973098mxShapeElectricalSafetyInterlockSwitch.prototype.constraints = [3099 new mxConnectionConstraint(new mxPoint(0, 0.35), true),3100 new mxConnectionConstraint(new mxPoint(1, 0.35), true)3101 ];31023103//**********************************************************************************************************************************************************3104// Temperature Switch3105//**********************************************************************************************************************************************************3106/**3107* Extends mxShape.3108*/3109function mxShapeElectricalTemperatureSwitch(bounds, fill, stroke, strokewidth)3110{3111 mxShape.call(this);3112 this.bounds = bounds;3113 this.fill = fill;3114 this.stroke = stroke;3115 this.strokewidth = (strokewidth != null) ? strokewidth : 1;3116};31173118/**3119* Extends mxShape.3120*/3121mxUtils.extend(mxShapeElectricalTemperatureSwitch, mxShape);31223123mxShapeElectricalTemperatureSwitch.prototype.cst = {3124 SHAPE_TEMPERATURE_SWITCH : 'mxgraph.electrical.electro-mechanical.temperatureSwitch'3125};31263127mxShapeElectricalTemperatureSwitch.prototype.customProperties = [3128 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: 'on',3129 enumList:[3130 {val:'on', dispName:'On'},3131 {val:'off', dispName:'Off'}3132 ]}3133];31343135/**3136* Function: paintVertexShape3137* 3138* Paints the vertex shape.3139*/3140mxShapeElectricalTemperatureSwitch.prototype.paintVertexShape = function(c, x, y, w, h)3141{3142 c.translate(x, y);3143 var switchState = mxUtils.getValue(this.style, 'elSwitchState', 'on');31443145 c.begin();3146 c.moveTo(0.76 * w, h);3147 c.lineTo(w, h);3148 c.moveTo(0, h);3149 c.lineTo(0.24 * w, h);31503151 if (switchState == 'off')3152 {3153 c.lineTo(0.76 * w, 0.1 * h);3154 }3155 else3156 {3157 c.lineTo(0.76 * w, h);3158 }31593160 c.stroke();3161 3162 c.ellipse(0.43 * w, 0, 0.1 * w, 0.22 * h);3163 c.fillAndStroke();3164 c.begin();3165 c.moveTo(0.48 * w, 0);3166 c.lineTo(0.48 * w, 0.22 * h);3167 c.stroke();3168};31693170mxCellRenderer.registerShape(mxShapeElectricalTemperatureSwitch.prototype.cst.SHAPE_TEMPERATURE_SWITCH, mxShapeElectricalTemperatureSwitch);31713172mxShapeElectricalTemperatureSwitch.prototype.constraints = [3173 new mxConnectionConstraint(new mxPoint(0, 1), true),3174 new mxConnectionConstraint(new mxPoint(1, 1), true)3175 ];3176 3177//**********************************************************************************************************************************************************3178// Thermostat23179//**********************************************************************************************************************************************************3180/**3181* Extends mxShape.3182*/3183function mxShapeElectricalThermostat2(bounds, fill, stroke, strokewidth)3184{3185 mxShape.call(this);3186 this.bounds = bounds;3187 this.fill = fill;3188 this.stroke = stroke;3189 this.strokewidth = (strokewidth != null) ? strokewidth : 1;3190};31913192/**3193* Extends mxShape.3194*/3195mxUtils.extend(mxShapeElectricalThermostat2, mxShape);31963197mxShapeElectricalThermostat2.prototype.cst = {3198 SHAPE_THERMOSTAT2 : 'mxgraph.electrical.electro-mechanical.thermostat2'3199};32003201mxShapeElectricalThermostat2.prototype.customProperties = [3202 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: 'on',3203 enumList:[3204 {val:'on', dispName:'On'},3205 {val:'off', dispName:'Off'}3206 ]}3207];32083209/**3210* Function: paintVertexShape3211* 3212* Paints the vertex shape.3213*/3214mxShapeElectricalThermostat2.prototype.paintVertexShape = function(c, x, y, w, h)3215{3216 c.translate(x, y);3217 var switchState = mxUtils.getValue(this.style, 'elSwitchState', 'on');32183219 c.begin();3220 c.moveTo(0.8 * w, 0.86 * h);3221 c.lineTo(w, 0.86 * h);3222 c.moveTo(0, 0.86 * h); 3223 c.lineTo(0.2 * w, 0.86 * h);32243225 if (switchState == 'off')3226 {3227 c.moveTo(0.28 * w, 0.82 * h);3228 c.lineTo(0.76 * w, 0.2 * h);3229 }3230 else3231 {3232 c.moveTo(0.28 * w, 0.86 * h);3233 c.lineTo(0.72 * w, 0.85 * h);3234 }32353236 c.stroke();3237 c.ellipse(0.2 * w, 0.72 * h, 0.08 * w, 0.28 * h);3238 c.fillAndStroke();3239 c.ellipse(0.72 * w, 0.72 * h, 0.08 * w, 0.28 * h);3240 c.fillAndStroke();3241 c.text(0.5 * w, 0.2 * h, 0, 0, 'tº', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);3242};32433244mxCellRenderer.registerShape(mxShapeElectricalThermostat2.prototype.cst.SHAPE_THERMOSTAT2, mxShapeElectricalThermostat2);32453246mxShapeElectricalThermostat2.prototype.constraints = [3247 new mxConnectionConstraint(new mxPoint(0, 1), true),3248 new mxConnectionConstraint(new mxPoint(1, 1), true)3249 ];32503251//**********************************************************************************************************************************************************3252// Limit Switch 23253//**********************************************************************************************************************************************************3254/**3255* Extends mxShape.3256*/3257function mxShapeElectricalLimitSwitch2(bounds, fill, stroke, strokewidth)3258{3259 mxShape.call(this);3260 this.bounds = bounds;3261 this.fill = fill;3262 this.stroke = stroke;3263 this.strokewidth = (strokewidth != null) ? strokewidth : 1;3264};32653266/**3267* Extends mxShape.3268*/3269mxUtils.extend(mxShapeElectricalLimitSwitch2, mxShape);32703271mxShapeElectricalLimitSwitch2.prototype.cst = {3272 SHAPE_LIMIT_SWITCH2 : 'mxgraph.electrical.electro-mechanical.limitSwitch2'3273};32743275mxShapeElectricalLimitSwitch2.prototype.customProperties = [3276 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: 'on',3277 enumList:[3278 {val:'on', dispName:'On'},3279 {val:'off', dispName:'Off'}3280 ]}3281];32823283/**3284* Function: paintVertexShape3285* 3286* Paints the vertex shape.3287*/3288mxShapeElectricalLimitSwitch2.prototype.paintVertexShape = function(c, x, y, w, h)3289{3290 c.translate(x, y);3291 var switchState = mxUtils.getValue(this.style, 'elSwitchState', 'on');32923293 c.begin();3294 c.moveTo(0.8 * w, 0.84 * h);3295 c.lineTo(w, 0.84 * h);3296 c.moveTo(0, 0.84 * h); 3297 c.lineTo(0.2 * w, 0.84 * h);32983299 if (switchState == 'off')3300 {3301 c.moveTo(0.28 * w, 0.8 * h);3302 c.lineTo(0.76 * w, 0);3303 c.moveTo(0.46 * w, 0.5 * h);3304 c.lineTo(0.545 * w, 0.07 * h);3305 c.lineTo(0.57 * w, 0.3 * h);3306 }3307 else3308 {3309 c.moveTo(0.28 * w, 0.84 * h);3310 c.lineTo(0.72 * w, 0.84 * h);3311 c.moveTo(0.47 * w, 0.84 * h);3312 c.lineTo(0.58 * w, 0.57 * h);3313 c.lineTo(0.58 * w, 0.84 * h);3314 }33153316 c.stroke();3317 c.ellipse(0.2 * w, 0.68 * h, 0.08 * w, 0.32 * h);3318 c.fillAndStroke();3319 c.ellipse(0.72 * w, 0.68 * h, 0.08 * w, 0.32 * h);3320 c.fillAndStroke();3321};33223323mxCellRenderer.registerShape(mxShapeElectricalLimitSwitch2.prototype.cst.SHAPE_LIMIT_SWITCH2, mxShapeElectricalLimitSwitch2);33243325mxShapeElectricalLimitSwitch2.prototype.constraints = [3326 new mxConnectionConstraint(new mxPoint(0, 1), true),3327 new mxConnectionConstraint(new mxPoint(1, 1), true)3328 ];33293330//**********************************************************************************************************************************************************3331// Circuit Breaker 23332//**********************************************************************************************************************************************************3333/**3334* Extends mxShape.3335*/3336function mxShapeElectricalCircuitBreaker2(bounds, fill, stroke, strokewidth)3337{3338 mxShape.call(this);3339 this.bounds = bounds;3340 this.fill = fill;3341 this.stroke = stroke;3342 this.strokewidth = (strokewidth != null) ? strokewidth : 1;3343};33443345/**3346* Extends mxShape.3347*/3348mxUtils.extend(mxShapeElectricalCircuitBreaker2, mxShape);33493350mxShapeElectricalCircuitBreaker2.prototype.cst = {3351 SHAPE_CIRCUIT_BREAKER2 : 'mxgraph.electrical.electro-mechanical.circuitBreaker2'3352};33533354mxShapeElectricalCircuitBreaker2.prototype.customProperties = [3355 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: 'on',3356 enumList:[3357 {val:'on', dispName:'On'},3358 {val:'off', dispName:'Off'}3359 ]}3360];33613362/**3363* Function: paintVertexShape3364* 3365* Paints the vertex shape.3366*/3367mxShapeElectricalCircuitBreaker2.prototype.paintVertexShape = function(c, x, y, w, h)3368{3369 c.translate(x, y);3370 var switchState = mxUtils.getValue(this.style, 'elSwitchState', 'on');33713372 c.begin();3373 c.moveTo(0.8 * w, 0.8 * h);3374 c.lineTo(w, 0.8 * h);3375 c.moveTo(0.75 * w, 0.6 * h);3376 c.lineTo(0.85 * w, h);3377 c.moveTo(0.85 * w, 0.6 * h);3378 c.lineTo(0.75 * w, h);3379 c.moveTo(0, 0.8 * h); 3380 c.lineTo(0.24 * w, 0.8 * h);33813382 if (switchState == 'off')3383 {3384 c.lineTo(0.76 * w, 0);3385 }3386 else3387 {3388 c.lineTo(0.8 * w, 0.8 * h);3389 }33903391 c.stroke();3392};33933394mxCellRenderer.registerShape(mxShapeElectricalCircuitBreaker2.prototype.cst.SHAPE_CIRCUIT_BREAKER2, mxShapeElectricalCircuitBreaker2);33953396mxShapeElectricalCircuitBreaker2.prototype.constraints = [3397 new mxConnectionConstraint(new mxPoint(0, 0.8), true),3398 new mxConnectionConstraint(new mxPoint(1, 0.8), true)3399 ];34003401//**********************************************************************************************************************************************************3402// Selector Switch - 3 Position 23403//**********************************************************************************************************************************************************3404/**3405* Extends mxShape.3406*/3407function mxShapeElectricalSelectorSwitch3Position2(bounds, fill, stroke, strokewidth)3408{3409 mxShape.call(this);3410 this.bounds = bounds;3411 this.fill = fill;3412 this.stroke = stroke;3413 this.strokewidth = (strokewidth != null) ? strokewidth : 1;3414};34153416/**3417* Extends mxShape.3418*/3419mxUtils.extend(mxShapeElectricalSelectorSwitch3Position2, mxShape);34203421mxShapeElectricalSelectorSwitch3Position2.prototype.cst = {3422 SHAPE_SELECTOR_SWITCH_3_POSITION : 'mxgraph.electrical.electro-mechanical.selectorSwitch3Position2'3423};34243425mxShapeElectricalSelectorSwitch3Position2.prototype.customProperties = [3426 {name: 'elSwitchState', dispName: 'Switch State', type: 'int', min:1, max:3, defVal: '1',}3427];34283429/**3430* Function: paintVertexShape3431* 3432* Paints the vertex shape.3433*/3434mxShapeElectricalSelectorSwitch3Position2.prototype.paintVertexShape = function(c, x, y, w, h)3435{3436 c.translate(x, y);3437 var switchState = mxUtils.getValue(this.style, 'elSwitchState', '1');3438 var strokeColor = mxUtils.getValue(this.style, 'strokeColor', '#000000');34393440 c.begin();3441 c.moveTo(0, 0.5 * h);3442 c.lineTo(0.2 * w, 0.5 * h);3443 c.moveTo(0.68 * w, 0.06 * h);3444 c.lineTo(w, 0.06 * h);3445 c.moveTo(0.75 * w, 0.5 * h);3446 c.lineTo(w, 0.5 * h);3447 c.moveTo(0.68 * w, 0.94 * h);3448 c.lineTo(w, 0.94 * h);3449 c.stroke();3450 c.ellipse(0.2 * w, 0.435 * h, 0.08 * w, 0.13 * h);3451 c.fillAndStroke();3452 c.ellipse(0.6 * w, 0, 0.08 * w, 0.13 * h);3453 c.fillAndStroke();3454 c.ellipse(0.67 * w, 0.435 * h, 0.08 * w, 0.13 * h);3455 c.fillAndStroke();3456 c.ellipse(0.6 * w, 0.87 * h, 0.08 * w, 0.13 * h);3457 c.fillAndStroke();3458 c.setFillColor(strokeColor);3459 3460 if (switchState == '1')3461 {3462 c.begin();3463 c.moveTo(0.27 * w, 0.47 * h);3464 c.lineTo(0.59 * w, 0.12 * h);3465 c.stroke();3466 c.begin();3467 c.moveTo(0.52 * w, 0.12 * h);3468 c.lineTo(0.61 * w, 0.095 * h);3469 c.lineTo(0.565 * w, 0.22 * h);3470 c.close();3471 c.fill();3472 }3473 else if (switchState == '2')3474 {3475 c.begin();3476 c.moveTo(0.28 * w, 0.5 * h);3477 c.lineTo(0.64 * w, 0.5 * h);3478 c.stroke();3479 c.begin();3480 c.moveTo(0.59 * w, 0.44 * h);3481 c.lineTo(0.67 * w, 0.5 * h);3482 c.lineTo(0.59 * w, 0.56 * h);3483 c.close();3484 c.fill();3485 }3486 else3487 {3488 c.begin();3489 c.moveTo(0.27 * w, 0.53 * h);3490 c.lineTo(0.59 * w, 0.88 * h);3491 c.stroke();3492 c.begin();3493 c.moveTo(0.52 * w, 0.88 * h);3494 c.lineTo(0.61 * w, 0.905 * h);3495 c.lineTo(0.565 * w, 0.78 * h);3496 c.close();3497 c.fill();3498 }3499};35003501mxCellRenderer.registerShape(mxShapeElectricalSelectorSwitch3Position2.prototype.cst.SHAPE_SELECTOR_SWITCH_3_POSITION, mxShapeElectricalSelectorSwitch3Position2);35023503mxShapeElectricalSelectorSwitch3Position2.prototype.constraints = [3504 new mxConnectionConstraint(new mxPoint(0, 0.8), true),3505 new mxConnectionConstraint(new mxPoint(1, 0.8), true)3506 ];35073508//**********************************************************************************************************************************************************3509// Selector Switch - 4 Position 23510//**********************************************************************************************************************************************************3511/**3512* Extends mxShape.3513*/3514function mxShapeElectricalSelectorSwitch4Position2(bounds, fill, stroke, strokewidth)3515{3516 mxShape.call(this);3517 this.bounds = bounds;3518 this.fill = fill;3519 this.stroke = stroke;3520 this.strokewidth = (strokewidth != null) ? strokewidth : 1;3521};35223523/**3524* Extends mxShape.3525*/3526mxUtils.extend(mxShapeElectricalSelectorSwitch4Position2, mxShape);35273528mxShapeElectricalSelectorSwitch4Position2.prototype.cst = {3529 SHAPE_SELECTOR_SWITCH_4_POSITION : 'mxgraph.electrical.electro-mechanical.selectorSwitch4Position2'3530};35313532mxShapeElectricalSelectorSwitch4Position2.prototype.customProperties = [3533 {name: 'elSwitchState', dispName: 'Switch State', type: 'int', min:1, max:4, defVal: '1',}3534];35353536/**3537* Function: paintVertexShape3538* 3539* Paints the vertex shape.3540*/3541mxShapeElectricalSelectorSwitch4Position2.prototype.paintVertexShape = function(c, x, y, w, h)3542{3543 c.translate(x, y);3544 var switchState = mxUtils.getValue(this.style, 'elSwitchState', '1');3545 var strokeColor = mxUtils.getValue(this.style, 'strokeColor', '#000000');35463547 c.begin();3548 c.moveTo(0, 0.5 * h);3549 c.lineTo(0.2 * w, 0.5 * h);3550 c.moveTo(0.68 * w, 0.045 * h);3551 c.lineTo(w, 0.045 * h);3552 c.moveTo(0.8 * w, 0.35 * h);3553 c.lineTo(w, 0.35 * h);3554 c.moveTo(0.8 * w, 0.65 * h);3555 c.lineTo(w, 0.65 * h);3556 c.moveTo(0.68 * w, 0.955 * h);3557 c.lineTo(w, 0.955 * h);3558 c.stroke();3559 c.ellipse(0.2 * w, 0.455 * h, 0.08 * w, 0.09 * h);3560 c.fillAndStroke();3561 c.ellipse(0.6 * w, 0, 0.08 * w, 0.09 * h);3562 c.fillAndStroke();3563 c.ellipse(0.72 * w, 0.305 * h, 0.08 * w, 0.09 * h);3564 c.fillAndStroke();3565 c.ellipse(0.72 * w, 0.605 * h, 0.08 * w, 0.09 * h);3566 c.fillAndStroke();3567 c.ellipse(0.6 * w, 0.91 * h, 0.08 * w, 0.09 * h);3568 c.fillAndStroke();3569 c.setFillColor(strokeColor);3570 3571 if (switchState == '1')3572 {3573 c.begin();3574 c.moveTo(0.27 * w, 0.47 * h);3575 c.lineTo(0.58 * w, 0.11 * h);3576 c.stroke();3577 c.begin();3578 c.moveTo(0.515 * w, 0.115 * h);3579 c.lineTo(0.61 * w, 0.08 * h);3580 c.lineTo(0.58 * w, 0.18 * h);3581 c.close();3582 c.fill();3583 }3584 else if (switchState == '2')3585 {3586 c.begin();3587 c.moveTo(0.28 * w, 0.485 * h);3588 c.lineTo(0.69 * w, 0.37 * h);3589 c.stroke();3590 c.begin();3591 c.moveTo(0.62 * w, 0.34 * h);3592 c.lineTo(0.72 * w, 0.36 * h);3593 c.lineTo(0.64 * w, 0.43 * h);3594 c.close();3595 c.fill();3596 }3597 else if (switchState == '3')3598 {3599 c.begin();3600 c.moveTo(0.28 * w, 0.515 * h);3601 c.lineTo(0.69 * w, 0.63 * h);3602 c.stroke();3603 c.begin();3604 c.moveTo(0.62 * w, 0.66 * h);3605 c.lineTo(0.72 * w, 0.64 * h);3606 c.lineTo(0.64 * w, 0.57 * h);3607 c.close();3608 c.fill();3609 }3610 else3611 {3612 c.begin();3613 c.moveTo(0.27 * w, 0.53 * h);3614 c.lineTo(0.58 * w, 0.89 * h);3615 c.stroke();3616 c.begin();3617 c.moveTo(0.515 * w, 0.885 * h);3618 c.lineTo(0.61 * w, 0.92 * h);3619 c.lineTo(0.58 * w, 0.82 * h);3620 c.close();3621 c.fill();3622 }3623};36243625mxCellRenderer.registerShape(mxShapeElectricalSelectorSwitch4Position2.prototype.cst.SHAPE_SELECTOR_SWITCH_4_POSITION, mxShapeElectricalSelectorSwitch4Position2);36263627mxShapeElectricalSelectorSwitch4Position2.prototype.constraints = [3628 new mxConnectionConstraint(new mxPoint(0, 0.8), true),3629 new mxConnectionConstraint(new mxPoint(1, 0.8), true)3630 ];36313632//**********************************************************************************************************************************************************3633// Selector Switch - 6 Position 23634//**********************************************************************************************************************************************************3635/**3636* Extends mxShape.3637*/3638function mxShapeElectricalSelectorSwitch6Position2(bounds, fill, stroke, strokewidth)3639{3640 mxShape.call(this);3641 this.bounds = bounds;3642 this.fill = fill;3643 this.stroke = stroke;3644 this.strokewidth = (strokewidth != null) ? strokewidth : 1;3645};36463647/**3648* Extends mxShape.3649*/3650mxUtils.extend(mxShapeElectricalSelectorSwitch6Position2, mxShape);36513652mxShapeElectricalSelectorSwitch6Position2.prototype.cst = {3653 SHAPE_SELECTOR_SWITCH_6_POSITION : 'mxgraph.electrical.electro-mechanical.selectorSwitch6Position2'3654};36553656mxShapeElectricalSelectorSwitch6Position2.prototype.customProperties = [3657 {name: 'elSwitchState', dispName: 'Switch State', type: 'int', min:1, max:6, defVal: '1',}3658];36593660/**3661* Function: paintVertexShape3662* 3663* Paints the vertex shape.3664*/3665mxShapeElectricalSelectorSwitch6Position2.prototype.paintVertexShape = function(c, x, y, w, h)3666{3667 c.translate(x, y);3668 var switchState = mxUtils.getValue(this.style, 'elSwitchState', '1');3669 var strokeColor = mxUtils.getValue(this.style, 'strokeColor', '#000000');36703671 c.begin();3672 c.moveTo(0, 0.5 * h);3673 c.lineTo(0.2 * w, 0.5 * h);3674 c.moveTo(0.39 * w, 0.03 * h);3675 c.lineTo(w, 0.03 * h);3676 c.moveTo(0.68 * w, 0.22 * h);3677 c.lineTo(w, 0.22 * h);3678 c.moveTo(0.8 * w, 0.405 * h);3679 c.lineTo(w, 0.405 * h);3680 c.moveTo(0.8 * w, 0.595 * h);3681 c.lineTo(w, 0.595 * h);3682 c.moveTo(0.68 * w, 0.78 * h);3683 c.lineTo(w, 0.78 * h);3684 c.moveTo(0.39 * w, 0.97 * h);3685 c.lineTo(w, 0.97 * h);3686 c.stroke();3687 c.ellipse(0.2 * w, 0.47 * h, 0.08 * w, 0.06 * h);3688 c.fillAndStroke();3689 c.ellipse(0.31 * w, 0, 0.08 * w, 0.06 * h);3690 c.fillAndStroke();3691 c.ellipse(0.6 * w, 0.19 * h, 0.08 * w, 0.06 * h);3692 c.fillAndStroke();3693 c.ellipse(0.72 * w, 0.375 * h, 0.08 * w, 0.06 * h);3694 c.fillAndStroke();3695 c.ellipse(0.72 * w, 0.565 * h, 0.08 * w, 0.06 * h);3696 c.fillAndStroke();3697 c.ellipse(0.6 * w, 0.75 * h, 0.08 * w, 0.06 * h);3698 c.fillAndStroke();3699 c.ellipse(0.31 * w, 0.94 * h, 0.08 * w, 0.06 * h);3700 c.fillAndStroke();3701 c.setFillColor(strokeColor);3702 3703 if (switchState == '1')3704 {3705 c.begin();3706 c.moveTo(0.25 * w, 0.47 * h);3707 c.lineTo(0.34 * w, 0.08 * h);3708 c.stroke();3709 c.begin();3710 c.moveTo(0.29 * w, 0.115 * h);3711 c.lineTo(0.34 * w, 0.06 * h);3712 c.lineTo(0.37 * w, 0.12 * h);3713 c.close();3714 c.fill();3715 }3716 else if (switchState == '2')3717 {3718 c.begin();3719 c.moveTo(0.27 * w, 0.48 * h);3720 c.lineTo(0.595 * w, 0.25 * h);3721 c.stroke();3722 c.begin();3723 c.moveTo(0.52 * w, 0.265 * h);3724 c.lineTo(0.61 * w, 0.24 * h);3725 c.lineTo(0.58 * w, 0.302 * h);3726 c.close();3727 c.fill();3728 }3729 else if (switchState == '3')3730 {3731 c.begin();3732 c.moveTo(0.28 * w, 0.495 * h);3733 c.lineTo(0.69 * w, 0.42 * h);3734 c.stroke();3735 c.begin();3736 c.moveTo(0.63 * w, 0.405 * h);3737 c.lineTo(0.72 * w, 0.415 * h);3738 c.lineTo(0.65 * w, 0.455 * h);3739 c.close();3740 c.fill();3741 }3742 else if (switchState == '4')3743 {3744 c.begin();3745 c.moveTo(0.28 * w, 0.505 * h);3746 c.lineTo(0.69 * w, 0.58 * h);3747 c.stroke();3748 c.begin();3749 c.moveTo(0.63 * w, 0.595 * h);3750 c.lineTo(0.72 * w, 0.585 * h);3751 c.lineTo(0.65 * w, 0.545 * h);3752 c.close();3753 c.fill();3754 }3755 else if (switchState == '5')3756 {3757 c.begin();3758 c.moveTo(0.27 * w, 0.52 * h);3759 c.lineTo(0.595 * w, 0.75 * h);3760 c.stroke();3761 c.begin();3762 c.moveTo(0.52 * w, 0.735 * h);3763 c.lineTo(0.61 * w, 0.76 * h);3764 c.lineTo(0.58 * w, 0.698 * h);3765 c.close();3766 c.fill();3767 }3768 else3769 {3770 c.begin();3771 c.moveTo(0.25 * w, 0.53 * h);3772 c.lineTo(0.34 * w, 0.92 * h);3773 c.stroke();3774 c.begin();3775 c.moveTo(0.29 * w, 0.885 * h);3776 c.lineTo(0.34 * w, 0.94 * h);3777 c.lineTo(0.37 * w, 0.88 * h);3778 c.close();3779 c.fill();3780 }3781};37823783mxCellRenderer.registerShape(mxShapeElectricalSelectorSwitch6Position2.prototype.cst.SHAPE_SELECTOR_SWITCH_6_POSITION, mxShapeElectricalSelectorSwitch6Position2);37843785mxShapeElectricalSelectorSwitch6Position2.prototype.constraints = [3786 new mxConnectionConstraint(new mxPoint(0, 0.5), true),3787 new mxConnectionConstraint(new mxPoint(1, 0.03), true),3788 new mxConnectionConstraint(new mxPoint(1, 0.22), true),3789 new mxConnectionConstraint(new mxPoint(1, 0.405), true),3790 new mxConnectionConstraint(new mxPoint(1, 0.595), true),3791 new mxConnectionConstraint(new mxPoint(1, 0.78), true),3792 new mxConnectionConstraint(new mxPoint(1, 0.97), true)3793 ];37943795//**********************************************************************************************************************************************************3796// Shorting Selector Switch 23797//**********************************************************************************************************************************************************3798/**3799* Extends mxShape.3800*/3801function mxShapeElectricalShortingSelectorSwitch2(bounds, fill, stroke, strokewidth)3802{3803 mxShape.call(this);3804 this.bounds = bounds;3805 this.fill = fill;3806 this.stroke = stroke;3807 this.strokewidth = (strokewidth != null) ? strokewidth : 1;3808};38093810/**3811* Extends mxShape.3812*/3813mxUtils.extend(mxShapeElectricalShortingSelectorSwitch2, mxShape);38143815mxShapeElectricalShortingSelectorSwitch2.prototype.cst = {3816 SHAPE_SHORTING_SELECTOR_SWITCH_2 : 'mxgraph.electrical.electro-mechanical.shortingSelectorSwitch2'3817};38183819mxShapeElectricalShortingSelectorSwitch2.prototype.customProperties = [3820 {name: 'elSwitchState', dispName: 'Switch State', type: 'int', min:1, max:4, defVal: '1',}3821];38223823/**3824* Function: paintVertexShape3825* 3826* Paints the vertex shape.3827*/3828mxShapeElectricalShortingSelectorSwitch2.prototype.paintVertexShape = function(c, x, y, w, h)3829{3830 c.translate(x, y);3831 var switchState = mxUtils.getValue(this.style, 'elSwitchState', '1');3832 var strokeColor = mxUtils.getValue(this.style, 'strokeColor', '#000000');38333834 c.begin();3835 c.moveTo(0, 0.5 * h);3836 c.lineTo(0.25 * w, 0.5 * h);3837 c.stroke();3838 c.ellipse(0.25 * w, 0.455 * h, 0.1 * w, 0.09 * h);3839 c.fillAndStroke();3840 c.ellipse(0.75 * w, 0, 0.1 * w, 0.09 * h);3841 c.fillAndStroke();3842 c.ellipse(0.9 * w, 0.305 * h, 0.1 * w, 0.09 * h);3843 c.fillAndStroke();3844 c.ellipse(0.9 * w, 0.605 * h, 0.1 * w, 0.09 * h);3845 c.fillAndStroke();3846 c.ellipse(0.75 * w, 0.91 * h, 0.1 * w, 0.09 * h);3847 c.fillAndStroke();38483849 if (switchState == '1')3850 {3851 c.begin();3852 c.moveTo(0.33 * w, 0.47 * h);3853 c.lineTo(0.72 * w, 0.12 * h);3854 c.stroke();3855 c.begin();3856 c.moveTo(0.617 * w, 0.044 * h);3857 c.arcTo(0.21 * w, 0.17 * h, 0, 0, 1, 0.818 * w, 0.182 * h);3858 c.lineTo(0.766 * w, 0.198 * h);3859 c.arcTo(0.15 * w, 0.13 * h, 0, 0, 0, 0.617 * w, 0.092 * h);3860 c.close();3861 c.fillAndStroke();3862 }3863 else if (switchState == '2')3864 {3865 c.begin();3866 c.moveTo(0.34 * w, 0.49 * h);3867 c.lineTo(0.83 * w, 0.375 * h);3868 c.stroke();3869 c.begin();3870 c.moveTo(0.791 * w, 0.263 * h);3871 c.arcTo(0.24 * w, 0.2 * h, 0, 0, 1, 0.889 * w, 0.474 * h);3872 c.lineTo(0.837 * w, 0.465 * h);3873 c.arcTo(0.16 * w, 0.14 * h, 0, 0, 0, 0.767 * w, 0.303 * h);3874 c.close();3875 c.fillAndStroke();3876 }3877 else if (switchState == '3')3878 {3879 c.begin();3880 c.moveTo(0.34 * w, 0.51 * h);3881 c.lineTo(0.83 * w, 0.625 * h);3882 c.stroke();3883 c.begin();3884 c.moveTo(0.791 * w, 0.737 * h);3885 c.arcTo(0.24 * w, 0.2 * h, 0, 0, 0, 0.889 * w, 0.526 * h);3886 c.lineTo(0.837 * w, 0.535 * h);3887 c.arcTo(0.16 * w, 0.14 * h, 0, 0, 1, 0.767 * w, 0.697 * h);3888 c.close();3889 c.fillAndStroke();3890 }3891 else3892 {3893 c.begin();3894 c.moveTo(0.33 * w, 0.53 * h);3895 c.lineTo(0.72 * w, 0.88 * h);3896 c.stroke();3897 c.begin();3898 c.moveTo(0.617 * w, 0.956 * h);3899 c.arcTo(0.21 * w, 0.17 * h, 0, 0, 0, 0.818 * w, 0.818 * h);3900 c.lineTo(0.766 * w, 0.802 * h);3901 c.arcTo(0.15 * w, 0.13 * h, 0, 0, 1, 0.617 * w, 0.908 * h);3902 c.close();3903 c.fillAndStroke();3904 }3905};39063907mxCellRenderer.registerShape(mxShapeElectricalShortingSelectorSwitch2.prototype.cst.SHAPE_SHORTING_SELECTOR_SWITCH_2, mxShapeElectricalShortingSelectorSwitch2);39083909mxShapeElectricalShortingSelectorSwitch2.prototype.constraints = [3910 new mxConnectionConstraint(new mxPoint(0, 0.5), true)3911 ];39123913//**********************************************************************************************************************************************************3914// Proximity Limit Switch 23915//**********************************************************************************************************************************************************3916/**3917* Extends mxShape.3918*/3919function mxShapeElectricalProximityLimitSwitch2(bounds, fill, stroke, strokewidth)3920{3921 mxShape.call(this);3922 this.bounds = bounds;3923 this.fill = fill;3924 this.stroke = stroke;3925 this.strokewidth = (strokewidth != null) ? strokewidth : 1;3926};39273928/**3929* Extends mxShape.3930*/3931mxUtils.extend(mxShapeElectricalProximityLimitSwitch2, mxShape);39323933mxShapeElectricalProximityLimitSwitch2.prototype.cst = {3934 SHAPE_PROXIMITY_LIMIT_SWITCH_2 : 'mxgraph.electrical.electro-mechanical.proximityLimitSwitch2'3935};39363937mxShapeElectricalProximityLimitSwitch2.prototype.customProperties = [3938 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: 'on',3939 enumList:[3940 {val:'on', dispName:'On'},3941 {val:'off', dispName:'Off'}3942 ]}3943];39443945/**3946* Function: paintVertexShape3947* 3948* Paints the vertex shape.3949*/3950mxShapeElectricalProximityLimitSwitch2.prototype.paintVertexShape = function(c, x, y, w, h)3951{3952 c.translate(x, y);3953 var switchState = mxUtils.getValue(this.style, 'elSwitchState', 'on');39543955 c.begin();3956 c.moveTo(0, 0.5 * h);3957 c.lineTo(0.2 * w, 0.5 * h);3958 c.moveTo(0.8 * w, 0.5 * h);3959 c.lineTo(w, 0.5 * h);3960 c.moveTo(0.13 * w, 0.5 * h);3961 c.lineTo(0.5 * w, 0);3962 c.lineTo(0.87 * w, 0.5 * h);3963 c.lineTo(0.5 * w, h);3964 c.close();3965 c.stroke();3966 3967 if (switchState == 'off')3968 {3969 c.begin();3970 c.moveTo(0.755 * w, 0.355 * h);3971 c.lineTo(0.22 * w, 0.5 * h);3972 c.lineTo(0.625 * w, 0.61 * h);3973 c.lineTo(0.72 * w, 0.36 * h);3974 c.stroke();3975 }3976 else3977 {3978 c.begin();3979 c.moveTo(0.76 * w, 0.43 * h);3980 c.lineTo(0.235 * w, 0.5 * h);3981 c.lineTo(0.615 * w, 0.66 * h);3982 c.lineTo(0.72 * w, 0.44 * h);3983 c.stroke();3984 }39853986 c.ellipse(0.2 * w, 0.445 * h, 0.08 * w, 0.11 * h);3987 c.fillAndStroke();3988 c.ellipse(0.72 * w, 0.445 * h, 0.08 * w, 0.11 * h);3989 c.fillAndStroke();3990};39913992mxCellRenderer.registerShape(mxShapeElectricalProximityLimitSwitch2.prototype.cst.SHAPE_PROXIMITY_LIMIT_SWITCH_2, mxShapeElectricalProximityLimitSwitch2);39933994mxShapeElectricalProximityLimitSwitch2.prototype.constraints = [3995 new mxConnectionConstraint(new mxPoint(0, 0.5), true),3996 new mxConnectionConstraint(new mxPoint(1, 0.5), true)3997 ];39983999//**********************************************************************************************************************************************************4000// Inertia Switch 24001//**********************************************************************************************************************************************************4002/**4003* Extends mxShape.4004*/4005function mxShapeElectricalInertiaSwitch2(bounds, fill, stroke, strokewidth)4006{4007 mxShape.call(this);4008 this.bounds = bounds;4009 this.fill = fill;4010 this.stroke = stroke;4011 this.strokewidth = (strokewidth != null) ? strokewidth : 1;4012};40134014/**4015* Extends mxShape.4016*/4017mxUtils.extend(mxShapeElectricalInertiaSwitch2, mxShape);40184019mxShapeElectricalInertiaSwitch2.prototype.cst = {4020 SHAPE_INERTIA_SWITCH_2 : 'mxgraph.electrical.electro-mechanical.inertiaSwitch2'4021};40224023mxShapeElectricalInertiaSwitch2.prototype.customProperties = [4024 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: 'on',4025 enumList:[4026 {val:'on', dispName:'On'},4027 {val:'off', dispName:'Off'}4028 ]}4029];40304031/**4032* Function: paintVertexShape4033* 4034* Paints the vertex shape.4035*/4036mxShapeElectricalInertiaSwitch2.prototype.paintVertexShape = function(c, x, y, w, h)4037{4038 c.translate(x, y);4039 var switchState = mxUtils.getValue(this.style, 'elSwitchState', 'on');40404041 c.begin();4042 c.moveTo(0, 0.85 * h);4043 c.lineTo(0.2 * w, 0.85 * h);4044 c.moveTo(0.8 * w, 0.85 * h);4045 c.lineTo(w, 0.85 * h);4046 c.stroke();4047 4048 if (switchState == 'off')4049 {4050 c.begin();4051 c.moveTo(0.28 * w, 0.79 * h);4052 c.lineTo(0.76 * w, 0);4053 c.moveTo(0.493 * w, 0.45 * h);4054 c.lineTo(0.493 * w, 0.26 * h);4055 c.lineTo(0.43 * w, 0.26 * h);4056 c.stroke();4057 c.ellipse(0.35 * w, 0.1 * h, 0.08 * w, 0.3 * h);4058 c.fillAndStroke();4059 }4060 else4061 {4062 c.begin();4063 c.moveTo(0.28 * w, 0.85 * h);4064 c.lineTo(0.76 * w, 0.85 * h);4065 c.moveTo(0.51 * w, 0.85 * h);4066 c.lineTo(0.51 * w, 0.26 * h);4067 c.lineTo(0.43 * w, 0.26 * h);4068 c.stroke();4069 c.ellipse(0.35 * w, 0.1 * h, 0.08 * w, 0.3 * h);4070 c.fillAndStroke();4071 }40724073 c.ellipse(0.2 * w, 0.7 * h, 0.08 * w, 0.3 * h);4074 c.fillAndStroke();4075 c.ellipse(0.72 * w, 0.7 * h, 0.08 * w, 0.3 * h);4076 c.fillAndStroke();4077};40784079mxCellRenderer.registerShape(mxShapeElectricalInertiaSwitch2.prototype.cst.SHAPE_INERTIA_SWITCH_2, mxShapeElectricalInertiaSwitch2);40804081mxShapeElectricalInertiaSwitch2.prototype.constraints = [4082 new mxConnectionConstraint(new mxPoint(0, 0.85), true),4083 new mxConnectionConstraint(new mxPoint(1, 0.85), true)4084 ];40854086//**********************************************************************************************************************************************************4087// Pushbutton Break 24088//**********************************************************************************************************************************************************4089/**4090* Extends mxShape.4091*/4092function mxShapeElectricalPushbuttonBreak2(bounds, fill, stroke, strokewidth)4093{4094 mxShape.call(this);4095 this.bounds = bounds;4096 this.fill = fill;4097 this.stroke = stroke;4098 this.strokewidth = (strokewidth != null) ? strokewidth : 1;4099};41004101/**4102* Extends mxShape.4103*/4104mxUtils.extend(mxShapeElectricalPushbuttonBreak2, mxShape);41054106mxShapeElectricalPushbuttonBreak2.prototype.cst = {4107 SHAPE_PUSHBUTTON_BREAK_2 : 'mxgraph.electrical.electro-mechanical.pushbuttonBreak2'4108};41094110mxShapeElectricalPushbuttonBreak2.prototype.customProperties = [4111 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: 'on',4112 enumList:[4113 {val:'on', dispName:'On'},4114 {val:'off', dispName:'Off'}4115 ]}4116];41174118/**4119* Function: paintVertexShape4120* 4121* Paints the vertex shape.4122*/4123mxShapeElectricalPushbuttonBreak2.prototype.paintVertexShape = function(c, x, y, w, h)4124{4125 c.translate(x, y);4126 var switchState = mxUtils.getValue(this.style, 'elSwitchState', 'on');41274128 c.begin();4129 c.moveTo(0, 0.8 * h);4130 c.lineTo(0.2 * w, 0.8 * h);4131 c.moveTo(0.8 * w, 0.8 * h);4132 c.lineTo(w, 0.8 * h);4133 c.stroke();4134 4135 if (switchState == 'off')4136 {4137 c.begin();4138 c.moveTo(0.24 * w, h);4139 c.lineTo(0.76 * w, h);4140 c.moveTo(0.5 * w, h);4141 c.lineTo(0.5 * w, 0.1 * h);4142 c.stroke();4143 }4144 else4145 {4146 c.begin();4147 c.moveTo(0.24 * w, 0.9 * h);4148 c.lineTo(0.76 * w, 0.9 * h);4149 c.moveTo(0.5 * w, 0.9 * h);4150 c.lineTo(0.5 * w, 0);4151 c.stroke();4152 }41534154 c.ellipse(0.2 * w, 0.725 * h, 0.08 * w, 0.15 * h);4155 c.fillAndStroke();4156 c.ellipse(0.72 * w, 0.725 * h, 0.08 * w, 0.15 * h);4157 c.fillAndStroke();4158};41594160mxCellRenderer.registerShape(mxShapeElectricalPushbuttonBreak2.prototype.cst.SHAPE_PUSHBUTTON_BREAK_2, mxShapeElectricalPushbuttonBreak2);41614162mxShapeElectricalPushbuttonBreak2.prototype.constraints = [4163 new mxConnectionConstraint(new mxPoint(0, 0.8), true),4164 new mxConnectionConstraint(new mxPoint(1, 0.8), true)4165 ];41664167//**********************************************************************************************************************************************************4168// Manual Switch 24169//**********************************************************************************************************************************************************4170/**4171* Extends mxShape.4172*/4173function mxShapeElectricalManualSwitch2(bounds, fill, stroke, strokewidth)4174{4175 mxShape.call(this);4176 this.bounds = bounds;4177 this.fill = fill;4178 this.stroke = stroke;4179 this.strokewidth = (strokewidth != null) ? strokewidth : 1;4180};41814182/**4183* Extends mxShape.4184*/4185mxUtils.extend(mxShapeElectricalManualSwitch2, mxShape);41864187mxShapeElectricalManualSwitch2.prototype.cst = {4188 SHAPE_MANUAL_SWITCH_2 : 'mxgraph.electrical.electro-mechanical.manualSwitch2'4189};41904191mxShapeElectricalManualSwitch2.prototype.customProperties = [4192 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: 'on',4193 enumList:[4194 {val:'on', dispName:'On'},4195 {val:'off', dispName:'Off'}4196 ]}4197];41984199/**4200* Function: paintVertexShape4201* 4202* Paints the vertex shape.4203*/4204mxShapeElectricalManualSwitch2.prototype.paintVertexShape = function(c, x, y, w, h)4205{4206 c.translate(x, y);4207 var switchState = mxUtils.getValue(this.style, 'elSwitchState', 'on');42084209 c.begin();4210 c.moveTo(0.8 * w, h);4211 c.lineTo(w, h);4212 c.moveTo(0, h);4213 c.lineTo(0.25 * w, h);4214 4215 if (switchState == 'off')4216 {4217 c.lineTo(0.76 * w, 0.1 * h);4218 c.moveTo(0.49 * w, 0);4219 c.lineTo(0.49 * w, 0.2 * h);4220 c.moveTo(0.49 * w, 0.3 * h);4221 c.lineTo(0.49 * w, 0.55 * h);4222 c.moveTo(0.41 * w, 0);4223 c.lineTo(0.57 * w, 0);4224 }4225 else4226 {4227 c.lineTo(0.8 * w, h);4228 c.moveTo(0.49 * w, 0.45 * h);4229 c.lineTo(0.49 * w, 0.65 * h);4230 c.moveTo(0.49 * w, 0.75 * h);4231 c.lineTo(0.49 * w, h);4232 c.moveTo(0.41 * w, 0.45 * h);4233 c.lineTo(0.57 * w, 0.45 * h);4234 }4235 4236 c.stroke();4237};42384239mxCellRenderer.registerShape(mxShapeElectricalManualSwitch2.prototype.cst.SHAPE_MANUAL_SWITCH_2, mxShapeElectricalManualSwitch2);42404241mxShapeElectricalManualSwitch2.prototype.constraints = [4242 new mxConnectionConstraint(new mxPoint(0, 0.8), true),4243 new mxConnectionConstraint(new mxPoint(1, 0.8), true)4244 ];42454246//**********************************************************************************************************************************************************4247// Two Way Contact 24248//**********************************************************************************************************************************************************4249/**4250* Extends mxShape.4251*/4252function mxShapeElectricalTwoWayContact2(bounds, fill, stroke, strokewidth)4253{4254 mxShape.call(this);4255 this.bounds = bounds;4256 this.fill = fill;4257 this.stroke = stroke;4258 this.strokewidth = (strokewidth != null) ? strokewidth : 1;4259};42604261/**4262* Extends mxShape.4263*/4264mxUtils.extend(mxShapeElectricalTwoWayContact2, mxShape);42654266mxShapeElectricalTwoWayContact2.prototype.cst = {4267 SHAPE_TWO_WAY_CONTACT_2 : 'mxgraph.electrical.electro-mechanical.twoWayContact2'4268};42694270mxShapeElectricalTwoWayContact2.prototype.customProperties = [4271 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: 'neutral',4272 enumList:[4273 {val:'1', dispName:'1'},4274 {val:'neutral', dispName:'Neutral'},4275 {val:'2', dispName:'2'}4276 ]}4277];42784279/**4280* Function: paintVertexShape4281* 4282* Paints the vertex shape.4283*/4284mxShapeElectricalTwoWayContact2.prototype.paintVertexShape = function(c, x, y, w, h)4285{4286 c.translate(x, y);4287 var switchState = mxUtils.getValue(this.style, 'elSwitchState', 'neutral');42884289 c.begin();4290 c.moveTo(0, 0.5 * h);4291 c.lineTo(0.21 * w, 0.5 * h);4292 c.moveTo(0.67 * w, 0);4293 c.lineTo(w, 0);4294 c.moveTo(0.67 * w, h);4295 c.lineTo(w, h);4296 4297 if (switchState == '1')4298 {4299 c.moveTo(0.28 * w, 0.46 * h);4300 c.lineTo(0.67 * w, 0);4301 }4302 else if (switchState == '2')4303 {4304 c.moveTo(0.28 * w, 0.54 * h);4305 c.lineTo(0.67 * w, h);4306 }4307 else4308 {4309 c.moveTo(0.28 * w, 0.5 * h);4310 c.lineTo(0.67 * w, 0.5 * h);4311 }4312 4313 c.stroke();4314 c.ellipse(0.2 * w, 0.4 * h, 0.08 * w, 0.2 * h);4315 c.fillAndStroke();4316};43174318mxCellRenderer.registerShape(mxShapeElectricalTwoWayContact2.prototype.cst.SHAPE_TWO_WAY_CONTACT_2, mxShapeElectricalTwoWayContact2);43194320mxShapeElectricalTwoWayContact2.prototype.constraints = [4321 new mxConnectionConstraint(new mxPoint(0, 0.5), true),4322 new mxConnectionConstraint(new mxPoint(1, 0), true),4323 new mxConnectionConstraint(new mxPoint(1, 1), true)4324 ];43254326//**********************************************************************************************************************************************************4327// Passing Make-Contact 24328//**********************************************************************************************************************************************************4329/**4330* Extends mxShape.4331*/4332function mxShapeElectricalPassingMakeContact2(bounds, fill, stroke, strokewidth)4333{4334 mxShape.call(this);4335 this.bounds = bounds;4336 this.fill = fill;4337 this.stroke = stroke;4338 this.strokewidth = (strokewidth != null) ? strokewidth : 1;4339};43404341/**4342* Extends mxShape.4343*/4344mxUtils.extend(mxShapeElectricalPassingMakeContact2, mxShape);43454346mxShapeElectricalPassingMakeContact2.prototype.cst = {4347 SHAPE_PASSING_MAKE_CONTACT_2 : 'mxgraph.electrical.electro-mechanical.passingMakeContact2'4348};43494350mxShapeElectricalPassingMakeContact2.prototype.customProperties = [4351 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: 'on',4352 enumList:[4353 {val:'on', dispName:'On'},4354 {val:'off', dispName:'Off'}4355 ]}4356];43574358/**4359* Function: paintVertexShape4360* 4361* Paints the vertex shape.4362*/4363mxShapeElectricalPassingMakeContact2.prototype.paintVertexShape = function(c, x, y, w, h)4364{4365 c.translate(x, y);4366 var switchState = mxUtils.getValue(this.style, 'elSwitchState', 'neutral');43674368 c.begin();4369 c.moveTo(w, 0.7 * h);4370 c.lineTo(0.77 * w, 0.7 * h);4371 c.lineTo(0.93 * w, h);4372 c.moveTo(0, 0.7 * h);4373 c.lineTo(0.25 * w, 0.7 * h);4374 4375 if (switchState == 'off')4376 {4377 c.lineTo(0.76 * w, 0);4378 }4379 else4380 {4381 c.lineTo(0.76 * w, 0.7 * h);4382 }4383 4384 c.stroke();4385};43864387mxCellRenderer.registerShape(mxShapeElectricalPassingMakeContact2.prototype.cst.SHAPE_PASSING_MAKE_CONTACT_2, mxShapeElectricalPassingMakeContact2);43884389mxShapeElectricalPassingMakeContact2.prototype.constraints = [4390 new mxConnectionConstraint(new mxPoint(0, 0.7), true),4391 new mxConnectionConstraint(new mxPoint(1, 0.7), true)4392 ];43934394//**********************************************************************************************************************************************************4395// DPST 24396//**********************************************************************************************************************************************************4397/**4398* Extends mxShape.4399*/4400function mxShapeElectricalDPST2(bounds, fill, stroke, strokewidth)4401{4402 mxShape.call(this);4403 this.bounds = bounds;4404 this.fill = fill;4405 this.stroke = stroke;4406 this.strokewidth = (strokewidth != null) ? strokewidth : 1;4407};44084409/**4410* Extends mxShape.4411*/4412mxUtils.extend(mxShapeElectricalDPST2, mxShape);44134414mxShapeElectricalDPST2.prototype.cst = {4415 SHAPE_DPST_2 : 'mxgraph.electrical.electro-mechanical.dpst2'4416};44174418mxShapeElectricalDPST2.prototype.customProperties = [4419 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: 'on',4420 enumList:[4421 {val:'on', dispName:'On'},4422 {val:'off', dispName:'Off'}4423 ]}4424];44254426/**4427* Function: paintVertexShape4428* 4429* Paints the vertex shape.4430*/4431mxShapeElectricalDPST2.prototype.paintVertexShape = function(c, x, y, w, h)4432{4433 c.translate(x, y);4434 var switchState = mxUtils.getValue(this.style, 'elSwitchState', 'neutral');44354436 c.begin();4437 c.moveTo(0, 0.4 * h);4438 c.lineTo(0.2 * w, 0.4 * h);4439 c.moveTo(0.8 * w, 0.4 * h);4440 c.lineTo(w, 0.4 * h);4441 c.moveTo(0, 0.92 * h);4442 c.lineTo(0.2 * w, 0.92 * h);4443 c.moveTo(0.8 * w, 0.92 * h);4444 c.lineTo(w, 0.92 * h);4445 4446 if (switchState == 'off')4447 {4448 c.moveTo(0.28 * w, 0.38 * h);4449 c.lineTo(0.76 * w, 0);4450 c.moveTo(0.28 * w, 0.9 * h);4451 c.lineTo(0.76 * w, 0.52 * h);4452 c.moveTo(0.5 * w, 0.2 * h);4453 c.lineTo(0.5 * w, 0.33 * h);4454 c.moveTo(0.5 * w, 0.38 * h);4455 c.lineTo(0.5 * w, 0.51 * h);4456 c.moveTo(0.5 * w, 0.56 * h);4457 c.lineTo(0.5 * w, 0.69 * h);4458 }4459 else4460 {4461 c.moveTo(0.28 * w, 0.4 * h);4462 c.lineTo(0.72 * w, 0.4 * h);4463 c.moveTo(0.28 * w, 0.92 * h);4464 c.lineTo(0.72 * w, 0.92 * h);4465 c.moveTo(0.5 * w, 0.4 * h);4466 c.lineTo(0.5 * w, 0.53 * h);4467 c.moveTo(0.5 * w, 0.58 * h);4468 c.lineTo(0.5 * w, 0.71 * h);4469 c.moveTo(0.5 * w, 0.76 * h);4470 c.lineTo(0.5 * w, 0.89 * h);4471 }4472 4473 c.stroke();4474 c.ellipse(0.2 * w, 0.325 * h, 0.08 * w, 0.15 * h);4475 c.fillAndStroke();4476 c.ellipse(0.2 * w, 0.845 * h, 0.08 * w, 0.15 * h);4477 c.fillAndStroke();4478 c.ellipse(0.72 * w, 0.325 * h, 0.08 * w, 0.15 * h);4479 c.fillAndStroke();4480 c.ellipse(0.72 * w, 0.845 * h, 0.08 * w, 0.15 * h);4481 c.fillAndStroke();4482};44834484mxCellRenderer.registerShape(mxShapeElectricalDPST2.prototype.cst.SHAPE_DPST_2, mxShapeElectricalDPST2);44854486mxShapeElectricalDPST2.prototype.constraints = [4487 new mxConnectionConstraint(new mxPoint(0, 0.4), true),4488 new mxConnectionConstraint(new mxPoint(0, 0.92), true),4489 new mxConnectionConstraint(new mxPoint(1, 0.4), true),4490 new mxConnectionConstraint(new mxPoint(1, 0.92), true)4491 ];44924493//**********************************************************************************************************************************************************4494// Spring Return Switch 34495//**********************************************************************************************************************************************************4496/**4497* Extends mxShape.4498*/4499function mxShapeElectricalSpringReturn3(bounds, fill, stroke, strokewidth)4500{4501 mxShape.call(this);4502 this.bounds = bounds;4503 this.fill = fill;4504 this.stroke = stroke;4505 this.strokewidth = (strokewidth != null) ? strokewidth : 1;4506};45074508/**4509* Extends mxShape.4510*/4511mxUtils.extend(mxShapeElectricalSpringReturn3, mxShape);45124513mxShapeElectricalSpringReturn3.prototype.cst = {4514 SHAPE_SPRING_RETURN_3 : 'mxgraph.electrical.electro-mechanical.springReturn3'4515};45164517mxShapeElectricalSpringReturn3.prototype.customProperties = [4518 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: 'on',4519 enumList:[4520 {val:'on', dispName:'On'},4521 {val:'off', dispName:'Off'}4522 ]}4523];45244525/**4526* Function: paintVertexShape4527* 4528* Paints the vertex shape.4529*/4530mxShapeElectricalSpringReturn3.prototype.paintVertexShape = function(c, x, y, w, h)4531{4532 c.translate(x, y);4533 var switchState = mxUtils.getValue(this.style, 'elSwitchState', 'neutral');45344535 c.begin();4536 c.moveTo(0, 0.62 * h);4537 c.lineTo(0.21 * w, 0.62 * h);4538 c.stroke();45394540 if (switchState == 'off')4541 {4542 c.begin();4543 c.moveTo(0.28 * w, 0.57 * h);4544 c.lineTo(0.76 * w, 0);4545 c.moveTo(w, 0.62 * h);4546 c.lineTo(0.625 * w, 0.62 * h);4547 c.lineTo(0.695 * w, 0.31 * h);4548 c.lineTo(0.765 * w, 0.62 * h);4549 c.fillAndStroke();4550 }4551 else4552 {4553 c.begin();4554 c.moveTo(0.28 * w, 0.64 * h);4555 c.lineTo(0.76 * w, h);4556 c.moveTo(w, 0.62 * h);4557 c.lineTo(0.625 * w, 0.62 * h);4558 c.lineTo(0.695 * w, 0.93 * h);4559 c.lineTo(0.765 * w, 0.62 * h);4560 c.fillAndStroke();4561 }4562 4563 c.ellipse(0.205 * w, 0.5 * h, 0.08 * w, 0.24 * h);4564 c.fillAndStroke();4565};45664567mxCellRenderer.registerShape(mxShapeElectricalSpringReturn3.prototype.cst.SHAPE_SPRING_RETURN_3, mxShapeElectricalSpringReturn3);45684569mxShapeElectricalSpringReturn3.prototype.constraints = [4570 new mxConnectionConstraint(new mxPoint(0, 0.62), true),4571 new mxConnectionConstraint(new mxPoint(1, 0.62), true)4572 ];45734574//**********************************************************************************************************************************************************4575// Limit Switch4576//**********************************************************************************************************************************************************4577/**4578* Extends mxShape.4579*/4580function mxShapeElectricalLimitSwitch(bounds, fill, stroke, strokewidth)4581{4582 mxShape.call(this);4583 this.bounds = bounds;4584 this.fill = fill;4585 this.stroke = stroke;4586 this.strokewidth = (strokewidth != null) ? strokewidth : 1;4587};45884589/**4590* Extends mxShape.4591*/4592mxUtils.extend(mxShapeElectricalLimitSwitch, mxShape);45934594mxShapeElectricalLimitSwitch.prototype.cst = {4595 SHAPE_LIMIT_SWITCH : 'mxgraph.electrical.electro-mechanical.limitSwitch'4596};45974598mxShapeElectricalLimitSwitch.prototype.customProperties = [4599 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: 'on',4600 enumList:[4601 {val:'on', dispName:'On'},4602 {val:'off', dispName:'Off'}4603 ]}4604];46054606/**4607* Function: paintVertexShape4608* 4609* Paints the vertex shape.4610*/4611mxShapeElectricalLimitSwitch.prototype.paintVertexShape = function(c, x, y, w, h)4612{4613 c.translate(x, y);4614 var switchState = mxUtils.getValue(this.style, 'elSwitchState', 'neutral');46154616 c.begin();4617 c.moveTo(0, 0.16 * h);4618 c.lineTo(0.2 * w, 0.16 * h);4619 c.moveTo(0.8 * w, 0.16 * h);4620 c.lineTo(w, 0.16 * h);4621 c.stroke();46224623 if (switchState == 'off')4624 {4625 c.begin();4626 c.moveTo(0.725 * w, 0.75 * h);4627 c.lineTo(0.24 * w, 0.16 * h);4628 c.lineTo(0.515 * w, h);4629 c.lineTo(0.69 * w, 0.72 * h);4630 c.fillAndStroke();4631 }4632 else4633 {4634 c.begin();4635 c.moveTo(0.76 * w, 0);4636 c.lineTo(0.24 * w, 0.16 * h);4637 c.lineTo(0.615 * w, 0.52 * h);4638 c.lineTo(0.72 * w, 0.02 * h);4639 c.fillAndStroke();4640 }4641 4642 c.ellipse(0.2 * w, 0.04 * h, 0.08 * w, 0.24 * h);4643 c.fillAndStroke();4644 c.ellipse(0.72 * w, 0.04 * h, 0.08 * w, 0.24 * h);4645 c.fillAndStroke();4646};46474648mxCellRenderer.registerShape(mxShapeElectricalLimitSwitch.prototype.cst.SHAPE_LIMIT_SWITCH, mxShapeElectricalLimitSwitch);46494650mxShapeElectricalLimitSwitch.prototype.constraints = [4651 new mxConnectionConstraint(new mxPoint(0, 0.16), true),4652 new mxConnectionConstraint(new mxPoint(1, 0.16), true)4653 ];46544655//**********************************************************************************************************************************************************4656// DPDT 34657//**********************************************************************************************************************************************************4658/**4659* Extends mxShape.4660*/4661function mxShapeElectricalDPDT3(bounds, fill, stroke, strokewidth)4662{4663 mxShape.call(this);4664 this.bounds = bounds;4665 this.fill = fill;4666 this.stroke = stroke;4667 this.strokewidth = (strokewidth != null) ? strokewidth : 1;4668};46694670/**4671* Extends mxShape.4672*/4673mxUtils.extend(mxShapeElectricalDPDT3, mxShape);46744675mxShapeElectricalDPDT3.prototype.cst = {4676 SHAPE_DPDT_3 : 'mxgraph.electrical.electro-mechanical.dpdt3'4677};46784679mxShapeElectricalDPDT3.prototype.customProperties = [4680 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: '1',4681 enumList:[4682 {val:'1', dispName:'1'},4683 {val:'2', dispName:'2'}4684 ]}4685];46864687/**4688* Function: paintVertexShape4689* 4690* Paints the vertex shape.4691*/4692mxShapeElectricalDPDT3.prototype.paintVertexShape = function(c, x, y, w, h)4693{4694 c.translate(x, y);4695 var switchState = mxUtils.getValue(this.style, 'elSwitchState', 'neutral');46964697 c.begin();4698 c.moveTo(0, 0.23 * h);4699 c.lineTo(0.27 * w, 0.23 * h);4700 c.moveTo(0, 0.79 * h);4701 c.lineTo(0.27 * w, 0.79 * h);4702 c.moveTo(0.74 * w, 0.05 * h);4703 c.lineTo(w, 0.05 * h);4704 c.moveTo(0.74 * w, 0.39 * h);4705 c.lineTo(w, 0.39 * h);4706 c.moveTo(0.74 * w, 0.61 * h);4707 c.lineTo(w, 0.61 * h);4708 c.moveTo(0.74 * w, 0.95 * h);4709 c.lineTo(w, 0.95 * h);47104711 if (switchState == '1')4712 {4713 c.moveTo(0.37 * w, 0.215 * h);4714 c.lineTo(0.69 * w, 0.105 * h);4715 c.moveTo(0.37 * w, 0.775 * h);4716 c.lineTo(0.69 * w, 0.665 * h);4717 c.moveTo(0.515 * w, 0.17 * h);4718 c.lineTo(0.515 * w, 0.245 * h);4719 c.moveTo(0.515 * w, 0.28 * h);4720 c.lineTo(0.515 * w, 0.355 * h);4721 c.moveTo(0.515 * w, 0.39 * h);4722 c.lineTo(0.515 * w, 0.465 * h);4723 c.moveTo(0.515 * w, 0.5 * h);4724 c.lineTo(0.515 * w, 0.575 * h);4725 c.moveTo(0.515 * w, 0.61 * h);4726 c.lineTo(0.515 * w, 0.685 * h);4727 }4728 else4729 {4730 c.moveTo(0.37 * w, 0.245 * h);4731 c.lineTo(0.69 * w, 0.335 * h);4732 c.moveTo(0.37 * w, 0.805 * h);4733 c.lineTo(0.69 * w, 0.895 * h);4734 c.moveTo(0.515 * w, 0.29 * h);4735 c.lineTo(0.515 * w, 0.365 * h);4736 c.moveTo(0.515 * w, 0.4 * h);4737 c.lineTo(0.515 * w, 0.475 * h);4738 c.moveTo(0.515 * w, 0.51 * h);4739 c.lineTo(0.515 * w, 0.585 * h);4740 c.moveTo(0.515 * w, 0.62 * h);4741 c.lineTo(0.515 * w, 0.695 * h);4742 c.moveTo(0.515 * w, 0.73 * h);4743 c.lineTo(0.515 * w, 0.805 * h);4744 }4745 4746 c.stroke();4747 c.ellipse(0.265 * w, 0.18 * h, 0.105 * w, 0.095 * h);4748 c.fillAndStroke();4749 c.ellipse(0.265 * w, 0.745 * h, 0.105 * w, 0.095 * h);4750 c.fillAndStroke();4751 c.ellipse(0.635 * w, 0, 0.105 * w, 0.095 * h);4752 c.fillAndStroke();4753 c.ellipse(0.635 * w, 0.345 * h, 0.105 * w, 0.095 * h);4754 c.fillAndStroke();4755 c.ellipse(0.635 * w, 0.56 * h, 0.105 * w, 0.095 * h);4756 c.fillAndStroke();4757 c.ellipse(0.635 * w, 0.905 * h, 0.105 * w, 0.095 * h);4758 c.fillAndStroke();4759};47604761mxCellRenderer.registerShape(mxShapeElectricalDPDT3.prototype.cst.SHAPE_DPDT_3, mxShapeElectricalDPDT3);47624763mxShapeElectricalDPDT3.prototype.constraints = [4764 new mxConnectionConstraint(new mxPoint(0, 0.23), true),4765 new mxConnectionConstraint(new mxPoint(0, 0.79), true),4766 new mxConnectionConstraint(new mxPoint(1, 0.05), true),4767 new mxConnectionConstraint(new mxPoint(1, 0.39), true),4768 new mxConnectionConstraint(new mxPoint(1, 0.61), true),4769 new mxConnectionConstraint(new mxPoint(1, 0.95), true)4770 ];47714772//**********************************************************************************************************************************************************4773// Two Position Switch 24774//**********************************************************************************************************************************************************4775/**4776* Extends mxShape.4777*/4778function mxShapeElectricalTwoPositionSwitch2(bounds, fill, stroke, strokewidth)4779{4780 mxShape.call(this);4781 this.bounds = bounds;4782 this.fill = fill;4783 this.stroke = stroke;4784 this.strokewidth = (strokewidth != null) ? strokewidth : 1;4785};47864787/**4788* Extends mxShape.4789*/4790mxUtils.extend(mxShapeElectricalTwoPositionSwitch2, mxShape);47914792mxShapeElectricalTwoPositionSwitch2.prototype.cst = {4793 SHAPE_TWO_POSITION_SWITCH_2 : 'mxgraph.electrical.electro-mechanical.twoPositionSwitch2'4794};47954796mxShapeElectricalTwoPositionSwitch2.prototype.customProperties = [4797 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: '1',4798 enumList:[4799 {val:'1', dispName:'1'},4800 {val:'2', dispName:'2'}4801 ]}4802];48034804/**4805* Function: paintVertexShape4806* 4807* Paints the vertex shape.4808*/4809mxShapeElectricalTwoPositionSwitch2.prototype.paintVertexShape = function(c, x, y, w, h)4810{4811 c.translate(x, y);4812 var switchState = mxUtils.getValue(this.style, 'elSwitchState', '1');48134814 c.begin();4815 c.moveTo(0, 0.5 * h);4816 c.lineTo(0.2 * w, 0.5 * h);4817 c.moveTo(0.8 * w, 0.5 * h);4818 c.lineTo(w, 0.5 * h);4819 c.moveTo(0.5 * w, 0);4820 c.lineTo(0.5 * w, 0.18 * h);4821 c.moveTo(0.5 * w, 0.82 * h);4822 c.lineTo(0.5 * w, h);4823 c.moveTo(0.63 * w, 0.145 * h);4824 c.arcTo(0.2 * w, 0.22 * h, 0, 0, 1, 0.835 * w, 0.36 * h);4825 4826 if (switchState == '1')4827 {4828 c.moveTo(0.24 * w, 0.5 * h);4829 c.arcTo(0.27 * w, 0.27 * h, 0, 0, 1, 0.5 * w, 0.78 * h);4830 c.moveTo(0.76 * w, 0.5 * h);4831 c.arcTo(0.27 * w, 0.27 * h, 0, 0, 1, 0.5 * w, 0.22 * h);4832 c.moveTo(0.39 * w, 0.56 * h);4833 c.lineTo(0.55 * w, 0.39 * h);4834 c.moveTo(0.39 * w, 0.56 * h);4835 c.lineTo(0.55 * w, 0.39 * h);4836 c.moveTo(0.61 * w, 0.44 * h);4837 c.lineTo(0.45 * w, 0.61 * h);4838 c.moveTo(0.61 * w, 0.44 * h);4839 c.lineTo(0.45 * w, 0.61 * h);4840 }4841 else4842 {4843 c.moveTo(0.76 * w, 0.5 * h);4844 c.arcTo(0.27 * w, 0.27 * h, 0, 0, 0, 0.5 * w, 0.78 * h);4845 c.moveTo(0.24 * w, 0.5 * h);4846 c.arcTo(0.27 * w, 0.27 * h, 0, 0, 0, 0.5 * w, 0.22 * h);4847 c.moveTo(0.61 * w, 0.56 * h);4848 c.lineTo(0.45 * w, 0.39 * h);4849 c.moveTo(0.61 * w, 0.56 * h);4850 c.lineTo(0.45 * w, 0.39 * h);4851 c.moveTo(0.39 * w, 0.44 * h);4852 c.lineTo(0.55 * w, 0.61 * h);4853 c.moveTo(0.39 * w, 0.44 * h);4854 c.lineTo(0.55 * w, 0.61 * h);4855 }4856 4857 c.stroke();4858 c.ellipse(0.2 * w, 0.4575 * h, 0.08 * w, 0.085 * h);4859 c.fillAndStroke();4860 c.ellipse(0.72 * w, 0.4575 * h, 0.08 * w, 0.085 * h);4861 c.fillAndStroke();4862 c.ellipse(0.46 * w, 0.18 * h, 0.08 * w, 0.085 * h);4863 c.fillAndStroke();4864 c.ellipse(0.46 * w, 0.735 * h, 0.08 * w, 0.085 * h);4865 c.fillAndStroke();4866 var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#000000');4867 c.setFillColor(strokeColor);4868 c.begin();4869 c.moveTo(0.633 * w, 0.1 * h);4870 c.lineTo(0.633 * w, 0.185 * h);4871 c.lineTo(0.56 * w, 0.1425 * h);4872 c.close();4873 c.moveTo(0.795 * w, 0.355 * h);4874 c.lineTo(0.875 * w, 0.355 * h);4875 c.lineTo(0.835 * w, 0.435 * h);4876 c.close();4877 c.fillAndStroke();4878};48794880mxCellRenderer.registerShape(mxShapeElectricalTwoPositionSwitch2.prototype.cst.SHAPE_TWO_POSITION_SWITCH_2, mxShapeElectricalTwoPositionSwitch2);48814882mxShapeElectricalTwoPositionSwitch2.prototype.constraints = [4883 new mxConnectionConstraint(new mxPoint(0, 0.5), true),4884 new mxConnectionConstraint(new mxPoint(1, 0.5), true),4885 new mxConnectionConstraint(new mxPoint(0.5, 0), true),4886 new mxConnectionConstraint(new mxPoint(0.5, 1), true)4887 ];48884889//**********************************************************************************************************************************************************4890// Three Position Switch 24891//**********************************************************************************************************************************************************4892/**4893* Extends mxShape.4894*/4895function mxShapeElectricalThreePositionSwitch2(bounds, fill, stroke, strokewidth)4896{4897 mxShape.call(this);4898 this.bounds = bounds;4899 this.fill = fill;4900 this.stroke = stroke;4901 this.strokewidth = (strokewidth != null) ? strokewidth : 1;4902};49034904/**4905* Extends mxShape.4906*/4907mxUtils.extend(mxShapeElectricalThreePositionSwitch2, mxShape);49084909mxShapeElectricalThreePositionSwitch2.prototype.cst = {4910 SHAPE_THREE_POSITION_SWITCH_2 : 'mxgraph.electrical.electro-mechanical.threePositionSwitch2'4911};49124913mxShapeElectricalThreePositionSwitch2.prototype.customProperties = [4914 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: '1',4915 enumList:[4916 {val:'1', dispName:'1'},4917 {val:'2', dispName:'2'},4918 {val:'3', dispName:'3'}4919 ]}4920];49214922/**4923* Function: paintVertexShape4924* 4925* Paints the vertex shape.4926*/4927mxShapeElectricalThreePositionSwitch2.prototype.paintVertexShape = function(c, x, y, w, h)4928{4929 c.translate(x, y);4930 var switchState = mxUtils.getValue(this.style, 'elSwitchState', '1');49314932 c.begin();4933 c.moveTo(0.5 * w, 0);4934 c.lineTo(0.5 * w, 0.2 * h);4935 c.moveTo(0, h);4936 c.lineTo(0.215 * w, 0.825 * h);4937 c.moveTo(w, h);4938 c.lineTo(0.785 * w, 0.825 * h);4939 c.moveTo(0.12 * w, 0.62 * h);4940 c.arcTo(0.38 * w, 0.38 * h, 0, 0, 1, 0.31 * w, 0.26 * h);4941 4942 if (switchState == '1')4943 {4944 c.moveTo(0.5 * w, 0.26 * h);4945 c.arcTo(0.65 * w, 0.65 * h, 0, 0, 1, 0.25 * w, 0.79 * h);4946 }4947 else if (switchState == '2')4948 {4949 c.moveTo(0.5 * w, 0.26 * h);4950 c.arcTo(0.65 * w, 0.65 * h, 0, 0, 0, 0.75 * w, 0.79 * h);4951 }4952 else4953 {4954 c.moveTo(0.25 * w, 0.79 * h);4955 c.arcTo(0.5 * w, 0.5 * h, 0, 0, 1, 0.75 * w, 0.79 * h);4956 }4957 4958 c.stroke();4959 c.ellipse(0.2 * w, 0.74 * h, 0.1 * w, 0.1 * h);4960 c.fillAndStroke();4961 c.ellipse(0.45 * w, 0.21 * h, 0.1 * w, 0.1 * h);4962 c.fillAndStroke();4963 c.ellipse(0.7 * w, 0.74 * h, 0.1 * w, 0.1 * h);4964 c.fillAndStroke();4965 var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#000000');4966 c.setFillColor(strokeColor);4967 c.begin();4968 c.moveTo(0.285 * w, 0.215 * h);4969 c.lineTo(0.39 * w, 0.2 * h);4970 c.lineTo(0.345 * w, 0.295 * h);4971 c.close();4972 c.moveTo(0.07 * w, 0.63 * h);4973 c.lineTo(0.18 * w, 0.61 * h);4974 c.lineTo(0.14 * w, 0.71 * h);4975 c.close();4976 c.fillAndStroke();4977};49784979mxCellRenderer.registerShape(mxShapeElectricalThreePositionSwitch2.prototype.cst.SHAPE_THREE_POSITION_SWITCH_2, mxShapeElectricalThreePositionSwitch2);49804981mxShapeElectricalThreePositionSwitch2.prototype.constraints = [4982 new mxConnectionConstraint(new mxPoint(0.5, 0), true),4983 new mxConnectionConstraint(new mxPoint(0, 1), true),4984 new mxConnectionConstraint(new mxPoint(1, 1), true)4985 ];49864987//**********************************************************************************************************************************************************4988// Four Position Switch 24989//**********************************************************************************************************************************************************4990/**4991* Extends mxShape.4992*/4993function mxShapeElectricalFourPositionSwitch2(bounds, fill, stroke, strokewidth)4994{4995 mxShape.call(this);4996 this.bounds = bounds;4997 this.fill = fill;4998 this.stroke = stroke;4999 this.strokewidth = (strokewidth != null) ? strokewidth : 1;5000};50015002/**5003* Extends mxShape.5004*/5005mxUtils.extend(mxShapeElectricalFourPositionSwitch2, mxShape);50065007mxShapeElectricalFourPositionSwitch2.prototype.cst = {5008 SHAPE_FOUR_POSITION_SWITCH_2 : 'mxgraph.electrical.electro-mechanical.fourPositionSwitch2'5009};50105011mxShapeElectricalFourPositionSwitch2.prototype.customProperties = [5012 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: '1',5013 enumList:[5014 {val:'1', dispName:'1'},5015 {val:'2', dispName:'2'},5016 {val:'3', dispName:'3'},5017 {val:'4', dispName:'4'}5018 ]}5019];50205021/**5022* Function: paintVertexShape5023* 5024* Paints the vertex shape.5025*/5026mxShapeElectricalFourPositionSwitch2.prototype.paintVertexShape = function(c, x, y, w, h)5027{5028 c.translate(x, y);5029 var switchState = mxUtils.getValue(this.style, 'elSwitchState', '1');50305031 c.begin();5032 c.moveTo(0, 0.5 * h);5033 c.lineTo(0.2 * w, 0.5 * h);5034 c.moveTo(0.8 * w, 0.5 * h);5035 c.lineTo(w, 0.5 * h);5036 c.moveTo(0.5 * w, 0);5037 c.lineTo(0.5 * w, 0.18 * h);5038 c.moveTo(0.5 * w, 0.82 * h);5039 c.lineTo(0.5 * w, h);5040 c.moveTo(0.37 * w, 0.145 * h);5041 c.arcTo(0.2 * w, 0.22 * h, 0, 0, 0, 0.165 * w, 0.36 * h);5042 5043 if (switchState == '1')5044 {5045 c.moveTo(0.32 * w, 0.7 * h);5046 c.arcTo(0.25 * w, 0.25 * h, 0, 0, 1, 0.68 * w, 0.7 * h);5047 c.moveTo(0.32 * w, 0.3 * h);5048 c.arcTo(0.25 * w, 0.25 * h, 0, 0, 0, 0.68 * w, 0.3 * h);5049 c.moveTo(0.46 * w, 0.37 * h);5050 c.lineTo(0.46 * w, 0.63 * h);5051 c.moveTo(0.54 * w, 0.37 * h);5052 c.lineTo(0.54 * w, 0.63 * h);5053 c.moveTo(0.28 * w, 0.5 * h);5054 c.lineTo(0.72 * w, 0.5 * h);5055 }5056 else if (switchState == '2')5057 {5058 c.moveTo(0.24 * w, 0.5 * h);5059 c.arcTo(0.27 * w, 0.27 * h, 0, 0, 1, 0.5 * w, 0.78 * h);5060 c.moveTo(0.76 * w, 0.5 * h);5061 c.arcTo(0.27 * w, 0.27 * h, 0, 0, 1, 0.5 * w, 0.22 * h);5062 c.moveTo(0.39 * w, 0.56 * h);5063 c.lineTo(0.55 * w, 0.39 * h);5064 c.moveTo(0.39 * w, 0.56 * h);5065 c.lineTo(0.55 * w, 0.39 * h);5066 c.moveTo(0.61 * w, 0.44 * h);5067 c.lineTo(0.45 * w, 0.61 * h);5068 c.moveTo(0.61 * w, 0.44 * h);5069 c.lineTo(0.45 * w, 0.61 * h);5070 c.moveTo(0.32 * w, 0.32 * h);5071 c.lineTo(0.68 * w, 0.68 * h);5072 }5073 else if (switchState == '3')5074 {5075 c.moveTo(0.7 * w, 0.32 * h);5076 c.arcTo(0.25 * w, 0.25 * h, 0, 0, 0, 0.7 * w, 0.68 * h);5077 c.moveTo(0.3 * w, 0.32 * h);5078 c.arcTo(0.25 * w, 0.25 * h, 0, 0, 1, 0.3 * w, 0.68 * h);5079 c.moveTo(0.37 * w, 0.46 * h);5080 c.lineTo(0.63 * w, 0.46 * h);5081 c.moveTo(0.37 * w, 0.54 * h);5082 c.lineTo(0.63 * w, 0.54 * h);5083 c.moveTo(0.5 * w, 0.26 * h);5084 c.lineTo(0.5 * w, 0.74 * h);5085 }5086 else5087 {5088 c.moveTo(0.76 * w, 0.5 * h);5089 c.arcTo(0.27 * w, 0.27 * h, 0, 0, 0, 0.5 * w, 0.78 * h);5090 c.moveTo(0.24 * w, 0.5 * h);5091 c.arcTo(0.27 * w, 0.27 * h, 0, 0, 0, 0.5 * w, 0.22 * h);5092 c.moveTo(0.61 * w, 0.56 * h);5093 c.lineTo(0.45 * w, 0.39 * h);5094 c.moveTo(0.61 * w, 0.56 * h);5095 c.lineTo(0.45 * w, 0.39 * h);5096 c.moveTo(0.39 * w, 0.44 * h);5097 c.lineTo(0.55 * w, 0.61 * h);5098 c.moveTo(0.39 * w, 0.44 * h);5099 c.lineTo(0.55 * w, 0.61 * h);5100 c.moveTo(0.68 * w, 0.32 * h);5101 c.lineTo(0.32 * w, 0.68 * h);5102 }5103 5104 c.stroke();5105 c.ellipse(0.2 * w, 0.4575 * h, 0.08 * w, 0.085 * h);5106 c.fillAndStroke();5107 c.ellipse(0.72 * w, 0.4575 * h, 0.08 * w, 0.085 * h);5108 c.fillAndStroke();5109 c.ellipse(0.46 * w, 0.18 * h, 0.08 * w, 0.085 * h);5110 c.fillAndStroke();5111 c.ellipse(0.46 * w, 0.735 * h, 0.08 * w, 0.085 * h);5112 c.fillAndStroke();5113 var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#000000');5114 c.setFillColor(strokeColor);5115 c.begin();5116 c.moveTo(0.367 * w, 0.1 * h);5117 c.lineTo(0.367 * w, 0.185 * h);5118 c.lineTo(0.44 * w, 0.1425 * h);5119 c.close();5120 c.moveTo(0.205 * w, 0.355 * h);5121 c.lineTo(0.125 * w, 0.355 * h);5122 c.lineTo(0.165 * w, 0.435 * h);5123 c.close();5124 c.fillAndStroke();5125};51265127mxCellRenderer.registerShape(mxShapeElectricalFourPositionSwitch2.prototype.cst.SHAPE_FOUR_POSITION_SWITCH_2, mxShapeElectricalFourPositionSwitch2);51285129mxShapeElectricalFourPositionSwitch2.prototype.constraints = [5130 new mxConnectionConstraint(new mxPoint(0, 0.5), true),5131 new mxConnectionConstraint(new mxPoint(1, 0.5), true),5132 new mxConnectionConstraint(new mxPoint(0.5, 0), true),5133 new mxConnectionConstraint(new mxPoint(0.5, 1), true)5134 ];51355136//**********************************************************************************************************************************************************5137// Pushubutton Make Switch 25138//**********************************************************************************************************************************************************5139/**5140* Extends mxShape.5141*/5142function mxShapeElectricalPushbuttonMakeSwitch2(bounds, fill, stroke, strokewidth)5143{5144 mxShape.call(this);5145 this.bounds = bounds;5146 this.fill = fill;5147 this.stroke = stroke;5148 this.strokewidth = (strokewidth != null) ? strokewidth : 1;5149};51505151/**5152* Extends mxShape.5153*/5154mxUtils.extend(mxShapeElectricalPushbuttonMakeSwitch2, mxShape);51555156mxShapeElectricalPushbuttonMakeSwitch2.prototype.cst = {5157 SHAPE_PUSHBUTTON_MAKE_SWITCH_2 : 'mxgraph.electrical.electro-mechanical.pushbuttonMakeSwitch2'5158};51595160mxShapeElectricalPushbuttonMakeSwitch2.prototype.customProperties = [5161 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: '1',5162 enumList:[5163 {val:'1', dispName:'1'},5164 {val:'2', dispName:'2'}5165 ]}5166];51675168/**5169* Function: paintVertexShape5170* 5171* Paints the vertex shape.5172*/5173mxShapeElectricalPushbuttonMakeSwitch2.prototype.paintVertexShape = function(c, x, y, w, h)5174{5175 c.translate(x, y);5176 var switchState = mxUtils.getValue(this.style, 'elSwitchState', '1');51775178 c.begin();5179 c.moveTo(0, 0.94 * h);5180 c.lineTo(0.2 * w, 0.94 * h);5181 c.moveTo(0.8 * w, 0.94 * h);5182 c.lineTo(w, 0.94 * h);5183 5184 if (switchState == '1')5185 {5186 c.moveTo(0.5 * w, 0);5187 c.lineTo(0.5 * w, 0.8 * h);5188 c.moveTo(0.24 * w, 0.8 * h);5189 c.lineTo(0.76 * w, 0.8 * h);5190 }5191 else5192 {5193 c.moveTo(0.5 * w, 0.07 * h);5194 c.lineTo(0.5 * w, 0.87 * h);5195 c.moveTo(0.24 * w, 0.87 * h);5196 c.lineTo(0.76 * w, 0.87 * h);5197 }5198 5199 c.stroke();5200 c.ellipse(0.2 * w, 0.88 * h, 0.08 * w, 0.12 * h);5201 c.fillAndStroke();5202 c.ellipse(0.72 * w, 0.88 * h, 0.08 * w, 0.12 * h);5203 c.fillAndStroke();5204};52055206mxCellRenderer.registerShape(mxShapeElectricalPushbuttonMakeSwitch2.prototype.cst.SHAPE_PUSHBUTTON_MAKE_SWITCH_2, mxShapeElectricalPushbuttonMakeSwitch2);52075208mxShapeElectricalPushbuttonMakeSwitch2.prototype.constraints = [5209 new mxConnectionConstraint(new mxPoint(0, 0.94), true),5210 new mxConnectionConstraint(new mxPoint(1, 0.94), true)5211 ];52125213//**********************************************************************************************************************************************************5214// Pushubutton Two-Circuit Switch 25215//**********************************************************************************************************************************************************5216/**5217* Extends mxShape.5218*/5219function mxShapeElectricalPushbuttonTwoCircuitSwitch2(bounds, fill, stroke, strokewidth)5220{5221 mxShape.call(this);5222 this.bounds = bounds;5223 this.fill = fill;5224 this.stroke = stroke;5225 this.strokewidth = (strokewidth != null) ? strokewidth : 1;5226};52275228/**5229* Extends mxShape.5230*/5231mxUtils.extend(mxShapeElectricalPushbuttonTwoCircuitSwitch2, mxShape);52325233mxShapeElectricalPushbuttonTwoCircuitSwitch2.prototype.cst = {5234 SHAPE_PUSHBUTTON_TWO_CIRCUIT_SWITCH_2 : 'mxgraph.electrical.electro-mechanical.pushbuttonTwoCircuitSwitch2'5235};52365237mxShapeElectricalPushbuttonTwoCircuitSwitch2.prototype.customProperties = [5238 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: '1',5239 enumList:[5240 {val:'1', dispName:'1'},5241 {val:'2', dispName:'2'}5242 ]}5243];52445245/**5246* Function: paintVertexShape5247* 5248* Paints the vertex shape.5249*/5250mxShapeElectricalPushbuttonTwoCircuitSwitch2.prototype.paintVertexShape = function(c, x, y, w, h)5251{5252 c.translate(x, y);5253 var switchState = mxUtils.getValue(this.style, 'elSwitchState', '1');52545255 c.begin();5256 c.moveTo(0, 0.68 * h);5257 c.lineTo(0.2 * w, 0.68 * h);5258 c.moveTo(0.8 * w, 0.68 * h);5259 c.lineTo(w, 0.68 * h);5260 c.moveTo(0, 0.96 * h);5261 c.lineTo(0.2 * w, 0.96 * h);5262 c.moveTo(0.8 * w, 0.96 * h);5263 c.lineTo(w, 0.96 * h);5264 5265 if (switchState == '1')5266 {5267 c.moveTo(0.5 * w, 0);5268 c.lineTo(0.5 * w, 0.73 * h);5269 c.moveTo(0.24 * w, 0.73 * h);5270 c.lineTo(0.76 * w, 0.73 * h);5271 }5272 else5273 {5274 c.moveTo(0.5 * w, 0.18 * h);5275 c.lineTo(0.5 * w, 0.91 * h);5276 c.moveTo(0.24 * w, 0.91 * h);5277 c.lineTo(0.76 * w, 0.91 * h);5278 }5279 5280 c.stroke();5281 c.ellipse(0.2 * w, 0.92 * h, 0.08 * w, 0.08 * h);5282 c.fillAndStroke();5283 c.ellipse(0.72 * w, 0.92 * h, 0.08 * w, 0.08 * h);5284 c.fillAndStroke();5285 c.ellipse(0.2 * w, 0.64 * h, 0.08 * w, 0.08 * h);5286 c.fillAndStroke();5287 c.ellipse(0.72 * w, 0.64 * h, 0.08 * w, 0.08 * h);5288 c.fillAndStroke();5289};52905291mxCellRenderer.registerShape(mxShapeElectricalPushbuttonTwoCircuitSwitch2.prototype.cst.SHAPE_PUSHBUTTON_TWO_CIRCUIT_SWITCH_2, mxShapeElectricalPushbuttonTwoCircuitSwitch2);52925293mxShapeElectricalPushbuttonTwoCircuitSwitch2.prototype.constraints = [5294 new mxConnectionConstraint(new mxPoint(0, 0.68), true),5295 new mxConnectionConstraint(new mxPoint(1, 0.68), true),5296 new mxConnectionConstraint(new mxPoint(0, 0.96), true),5297 new mxConnectionConstraint(new mxPoint(1, 0.96), true)5298 ];52995300//**********************************************************************************************************************************************************5301// Time Delay Switch5302//**********************************************************************************************************************************************************5303/**5304* Extends mxShape.5305*/5306function mxShapeElectricalTimeDelaySwitch(bounds, fill, stroke, strokewidth)5307{5308 mxShape.call(this);5309 this.bounds = bounds;5310 this.fill = fill;5311 this.stroke = stroke;5312 this.strokewidth = (strokewidth != null) ? strokewidth : 1;5313};53145315/**5316* Extends mxShape.5317*/5318mxUtils.extend(mxShapeElectricalTimeDelaySwitch, mxShape);53195320mxShapeElectricalTimeDelaySwitch.prototype.cst = {5321 SHAPE_TIME_DELAY_SWITCH : 'mxgraph.electrical.electro-mechanical.timeDelaySwitch'5322};53235324mxShapeElectricalTimeDelaySwitch.prototype.customProperties = [5325 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: 'on',5326 enumList:[5327 {val:'on', dispName:'On'},5328 {val:'off', dispName:'Off'}5329 ]}5330];53315332/**5333* Function: paintVertexShape5334* 5335* Paints the vertex shape.5336*/5337mxShapeElectricalTimeDelaySwitch.prototype.paintVertexShape = function(c, x, y, w, h)5338{5339 c.translate(x, y);5340 var switchState = mxUtils.getValue(this.style, 'elSwitchState', 'off');53415342 c.begin();5343 c.moveTo(0, 0.13 * h);5344 c.lineTo(0.2 * w, 0.13 * h);5345 c.moveTo(0.8 * w, 0.13 * h);5346 c.lineTo(w, 0.13 * h);5347 5348 if (switchState == 'off')5349 {5350 c.moveTo(0.5 * w, 0.37 * h);5351 c.lineTo(0.5 * w, 0.83 * h);5352 c.moveTo(0.28 * w, 0.16 * h);5353 c.lineTo(0.76 * w, 0.62 * h);5354 c.moveTo(0.44 * w, h);5355 c.lineTo(0.5 * w, 0.83 * h);5356 c.lineTo(0.56 * w, h);5357 }5358 else5359 {5360 c.moveTo(0.5 * w, 0.04 * h);5361 c.lineTo(0.5 * w, 0.5 * h);5362 c.moveTo(0.28 * w, 0.09 * h);5363 c.lineTo(0.76 * w, 0);5364 c.moveTo(0.44 * w, 0.67 * h);5365 c.lineTo(0.5 * w, 0.5 * h);5366 c.lineTo(0.56 * w, 0.67 * h);5367 }5368 5369 c.stroke();5370 c.ellipse(0.2 * w, 0.03 * h, 0.08 * w, 0.19 * h);5371 c.fillAndStroke();5372 c.ellipse(0.72 * w, 0.03 * h, 0.08 * w, 0.19 * h);5373 c.fillAndStroke();5374};53755376mxCellRenderer.registerShape(mxShapeElectricalTimeDelaySwitch.prototype.cst.SHAPE_TIME_DELAY_SWITCH, mxShapeElectricalTimeDelaySwitch);53775378mxShapeElectricalTimeDelaySwitch.prototype.constraints = [5379 new mxConnectionConstraint(new mxPoint(0, 0.13), true),5380 new mxConnectionConstraint(new mxPoint(1, 0.13), true)5381 ];53825383//**********************************************************************************************************************************************************5384// Time Delay Switch 25385//**********************************************************************************************************************************************************5386/**5387* Extends mxShape.5388*/5389function mxShapeElectricalTimeDelaySwitch2(bounds, fill, stroke, strokewidth)5390{5391 mxShape.call(this);5392 this.bounds = bounds;5393 this.fill = fill;5394 this.stroke = stroke;5395 this.strokewidth = (strokewidth != null) ? strokewidth : 1;5396};53975398/**5399* Extends mxShape.5400*/5401mxUtils.extend(mxShapeElectricalTimeDelaySwitch2, mxShape);54025403mxShapeElectricalTimeDelaySwitch2.prototype.cst = {5404 SHAPE_TIME_DELAY_SWITCH2 : 'mxgraph.electrical.electro-mechanical.timeDelaySwitch2'5405};54065407mxShapeElectricalTimeDelaySwitch2.prototype.customProperties = [5408 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: 'on',5409 enumList:[5410 {val:'on', dispName:'On'},5411 {val:'off', dispName:'Off'}5412 ]}5413];54145415/**5416* Function: paintVertexShape5417* 5418* Paints the vertex shape.5419*/5420mxShapeElectricalTimeDelaySwitch2.prototype.paintVertexShape = function(c, x, y, w, h)5421{5422 c.translate(x, y);5423 var switchState = mxUtils.getValue(this.style, 'elSwitchState', 'off');54245425 c.begin();5426 c.moveTo(0, 0.45 * h);5427 c.lineTo(0.23 * w, 0.45 * h);5428 5429 if (switchState == 'off')5430 {5431 c.lineTo(0.75 * w, 0);5432 c.moveTo(w, 0.45 * h);5433 c.lineTo(0.8 * w, 0.45 * h);5434 c.moveTo(0.465 * w, 0.25 * h);5435 c.lineTo(0.465 * w, 0.76 * h);5436 c.moveTo(0.535 * w, 0.19 * h);5437 c.lineTo(0.535 * w, 0.76 * h);5438 c.moveTo(0.4 * w, 0.89 * h);5439 c.arcTo(0.11 * w, 0.25 * h, 0, 0, 1, 0.6 * w, 0.89 * h);5440 }5441 else5442 {5443 c.lineTo(0.73 * w, 0.25 * h);5444 c.moveTo(w, 0.45 * h);5445 c.lineTo(0.67 * w, 0.45 * h);5446 c.lineTo(0.67 * w, 0.16 * h);5447 c.moveTo(0.465 * w, 0.36 * h);5448 c.lineTo(0.465 * w, 0.87 * h);5449 c.moveTo(0.535 * w, 0.33 * h);5450 c.lineTo(0.535 * w, 0.87 * h);5451 c.moveTo(0.4 * w, h);5452 c.arcTo(0.11 * w, 0.25 * h, 0, 0, 1, 0.6 * w, h);5453 }5454 5455 c.stroke();5456};54575458mxCellRenderer.registerShape(mxShapeElectricalTimeDelaySwitch2.prototype.cst.SHAPE_TIME_DELAY_SWITCH2, mxShapeElectricalTimeDelaySwitch2);54595460mxShapeElectricalTimeDelaySwitch2.prototype.constraints = [5461 new mxConnectionConstraint(new mxPoint(0, 0.45), true),5462 new mxConnectionConstraint(new mxPoint(1, 0.45), true)5463 ];54645465//**********************************************************************************************************************************************************5466// Isolator Switch 25467//**********************************************************************************************************************************************************5468/**5469* Extends mxShape.5470*/5471function mxShapeElectricalIsolatorSwitch2(bounds, fill, stroke, strokewidth)5472{5473 mxShape.call(this);5474 this.bounds = bounds;5475 this.fill = fill;5476 this.stroke = stroke;5477 this.strokewidth = (strokewidth != null) ? strokewidth : 1;5478};54795480/**5481* Extends mxShape.5482*/5483mxUtils.extend(mxShapeElectricalIsolatorSwitch2, mxShape);54845485mxShapeElectricalIsolatorSwitch2.prototype.cst = {5486 SHAPE_ISOLATOR_SWITCH2 : 'mxgraph.electrical.electro-mechanical.isolatorSwitch2'5487};54885489mxShapeElectricalIsolatorSwitch2.prototype.customProperties = [5490 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: 'on',5491 enumList:[5492 {val:'on', dispName:'On'},5493 {val:'off', dispName:'Off'}5494 ]}5495];54965497/**5498* Function: paintVertexShape5499* 5500* Paints the vertex shape.5501*/5502mxShapeElectricalIsolatorSwitch2.prototype.paintVertexShape = function(c, x, y, w, h)5503{5504 c.translate(x, y);5505 var switchState = mxUtils.getValue(this.style, 'elSwitchState', 'off');55065507 c.begin();5508 c.moveTo(w, 0.8 * h);5509 c.lineTo(0.8 * w, 0.8 * h);5510 c.moveTo(0.8 * w, 0.6 * h);5511 c.lineTo(0.8 * w, h);5512 c.moveTo(0, 0.8 * h);5513 c.lineTo(0.23 * w, 0.8 * h);5514 5515 if (switchState == 'off')5516 {5517 c.lineTo(0.75 * w, 0);5518 }5519 else5520 {5521 c.lineTo(0.8 * w, 0.8 * h);5522 }5523 5524 c.stroke();5525};55265527mxCellRenderer.registerShape(mxShapeElectricalIsolatorSwitch2.prototype.cst.SHAPE_ISOLATOR_SWITCH2, mxShapeElectricalIsolatorSwitch2);55285529mxShapeElectricalIsolatorSwitch2.prototype.constraints = [5530 new mxConnectionConstraint(new mxPoint(0, 0.8), true),5531 new mxConnectionConstraint(new mxPoint(1, 0.8), true)5532 ];55335534//**********************************************************************************************************************************************************5535// Isolator Switch 25536//**********************************************************************************************************************************************************5537/**5538* Extends mxShape.5539*/5540function mxShapeElectricalChangeoverContactSwitch2(bounds, fill, stroke, strokewidth)5541{5542 mxShape.call(this);5543 this.bounds = bounds;5544 this.fill = fill;5545 this.stroke = stroke;5546 this.strokewidth = (strokewidth != null) ? strokewidth : 1;5547};55485549/**5550* Extends mxShape.5551*/5552mxUtils.extend(mxShapeElectricalChangeoverContactSwitch2, mxShape);55535554mxShapeElectricalChangeoverContactSwitch2.prototype.cst = {5555 SHAPE_CHANGEOVER_CONTACT_SWITCH2 : 'mxgraph.electrical.electro-mechanical.changeoverContactSwitch2'5556};55575558mxShapeElectricalChangeoverContactSwitch2.prototype.customProperties = [5559 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: '1',5560 enumList:[5561 {val:'1', dispName:'1'},5562 {val:'2', dispName:'2'}5563 ]}5564];55655566/**5567* Function: paintVertexShape5568* 5569* Paints the vertex shape.5570*/5571mxShapeElectricalChangeoverContactSwitch2.prototype.paintVertexShape = function(c, x, y, w, h)5572{5573 c.translate(x, y);5574 var switchState = mxUtils.getValue(this.style, 'elSwitchState', '1');55755576 c.begin();5577 c.moveTo(0, h);5578 c.lineTo(0.25 * w, h);5579 5580 if (switchState == '1')5581 {5582 c.lineTo(0.76 * w, 0.2 * h);5583 c.moveTo(w, 0);5584 c.lineTo(0.67 * w, 0);5585 c.lineTo(0.67 * w, 0.5 * h);5586 c.moveTo(w, h);5587 c.lineTo(0.8 * w, h);5588 }5589 else5590 {5591 c.lineTo(0.77 * w, 0.6 * h);5592 c.moveTo(w, h);5593 c.lineTo(0.67 * w, h);5594 c.lineTo(0.67 * w, 0.5 * h);5595 c.moveTo(w, 0);5596 c.lineTo(0.8 * w, 0);5597 }5598 5599 c.stroke();5600};56015602mxCellRenderer.registerShape(mxShapeElectricalChangeoverContactSwitch2.prototype.cst.SHAPE_CHANGEOVER_CONTACT_SWITCH2, mxShapeElectricalChangeoverContactSwitch2);56035604mxShapeElectricalChangeoverContactSwitch2.prototype.constraints = [5605 new mxConnectionConstraint(new mxPoint(0, 0.8), true),5606 new mxConnectionConstraint(new mxPoint(0, 0.8), true),5607 new mxConnectionConstraint(new mxPoint(1, 0.8), true)5608 ];56095610//**********************************************************************************************************************************************************5611// Reed Switch 25612//**********************************************************************************************************************************************************5613/**5614* Extends mxShape.5615*/5616function mxShapeElectricalReedSwitch2(bounds, fill, stroke, strokewidth)5617{5618 mxShape.call(this);5619 this.bounds = bounds;5620 this.fill = fill;5621 this.stroke = stroke;5622 this.strokewidth = (strokewidth != null) ? strokewidth : 1;5623};56245625/**5626* Extends mxShape.5627*/5628mxUtils.extend(mxShapeElectricalReedSwitch2, mxShape);56295630mxShapeElectricalReedSwitch2.prototype.cst = {5631 SHAPE_REED_SWITCH2 : 'mxgraph.electrical.electro-mechanical.reedSwitch2'5632};56335634mxShapeElectricalReedSwitch2.prototype.customProperties = [5635 {name: 'elSwitchState', dispName: 'Switch State', type: 'enum', defVal: 'on',5636 enumList:[5637 {val:'on', dispName:'On'},5638 {val:'off', dispName:'Off'}5639 ]}5640];56415642/**5643* Function: paintVertexShape5644* 5645* Paints the vertex shape.5646*/5647mxShapeElectricalReedSwitch2.prototype.paintVertexShape = function(c, x, y, w, h)5648{5649 c.translate(x, y);5650 var switchState = mxUtils.getValue(this.style, 'elSwitchState', 'off');56515652 c.begin();5653 c.moveTo(0.69 * w, 0);5654 c.arcTo(0.13 * w, 0.5 * h, 0, 0, 1, 0.82 * w, 0.5 * h);5655 c.arcTo(0.13 * w, 0.5 * h, 0, 0, 1, 0.69 * w, h);5656 c.lineTo(0.31 * w, h);5657 c.arcTo(0.13 * w, 0.5 * h, 0, 0, 1, 0.18 * w, 0.5 * h);5658 c.arcTo(0.13 * w, 0.5 * h, 0, 0, 1, 0.31 * w, 0);5659 c.close();5660 c.fillAndStroke();56615662 c.begin();5663 c.moveTo(w, 0.5 * h);5664 c.lineTo(0.65 * w, 0.5 * h);5665 c.moveTo(0, 0.5 * h);5666 c.lineTo(0.35 * w, 0.5 * h);5667 5668 if (switchState == 'on')5669 {5670 c.lineTo(0.65 * w, 0.5 * h);5671 }5672 else5673 {5674 c.lineTo(0.65 * w, 0.25 * h);5675 }5676 5677 c.stroke();5678};56795680mxCellRenderer.registerShape(mxShapeElectricalReedSwitch2.prototype.cst.SHAPE_REED_SWITCH2, mxShapeElectricalReedSwitch2);56815682mxShapeElectricalReedSwitch2.prototype.constraints = [5683 new mxConnectionConstraint(new mxPoint(0, 0.5), true),5684 new mxConnectionConstraint(new mxPoint(1, 0.5), true)5685 ];5686