UNPKG

@zklogic/draw.io

Version:

Draw.IO - Graph Editor integration in Angular-cli

1 lines 31.8 kB
function mxShapeElectricalTestPoint(e,t,n,i){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=n,this.strokewidth=null!=i?i:1}function mxShapeElectricalStraightBus(e,t,n,i){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=n,this.strokewidth=null!=i?i:1}function mxShapeElectricalTwoLineBusElbow(e,t,n,i){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=n,this.strokewidth=null!=i?i:1,this.notch=0}function mxShapeElectricalThreeLineBusElbow(e,t,n,i){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=n,this.strokewidth=null!=i?i:1,this.notch=0}function mxShapeElectricalFourLineBusElbow(e,t,n,i){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=n,this.strokewidth=null!=i?i:1,this.notch=0}function mxShapeElectricalEightLineBusElbow(e,t,n,i){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=n,this.strokewidth=null!=i?i:1,this.notch=0}function mxShapeElectricalLogicGate(e,t,n,i){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=n,this.strokewidth=null!=i?i:1}function mxShapeElectricalBuffer(e,t,n,i){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=n,this.strokewidth=null!=i?i:1}function mxShapeElectricalDualInLineIC(e,t,n,i){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=n,this.strokewidth=null!=i?i:1}function mxShapeElectricalQFPIC(e,t,n,i){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=n,this.strokewidth=null!=i?i:1}function mxShapeElectricalMux(e,t,n,i){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=n,this.strokewidth=null!=i?i:1}function mxShapeElectricalBatteryStack(e,t,n,i){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=n,this.strokewidth=null!=i?i:1}function mxShapeElectricalDCSource3_v2(e,t,n,i){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=n,this.strokewidth=null!=i?i:1}function mxShapeElectricalSource(e,t,n,i){mxShape.call(this),this.bounds=e,this.fill=t,this.stroke=n,this.strokewidth=null!=i?i:1}mxUtils.extend(mxShapeElectricalTestPoint,mxShape),mxShapeElectricalTestPoint.prototype.cst={SHAPE_TEST_POINT:"mxgraph.electrical.transmission.testPoint"},mxShapeElectricalTestPoint.prototype.paintVertexShape=function(e,t,n,i,o){e.translate(t,n);var a=mxUtils.getValue(this.style,mxConstants.STYLE_STROKECOLOR,"#000000"),l=Math.min(i,o);e.setFillColor(a),e.begin(),e.ellipse(.5*i-l/2,0,l,l),e.fillAndStroke(),o>i&&(e.begin(),e.moveTo(.5*i,l),e.lineTo(.5*i,o),e.stroke())},mxCellRenderer.registerShape(mxShapeElectricalTestPoint.prototype.cst.SHAPE_TEST_POINT,mxShapeElectricalTestPoint),mxShapeElectricalTestPoint.prototype.constraints=[new mxConnectionConstraint(new mxPoint(.5,0),!0),new mxConnectionConstraint(new mxPoint(.5,1),!0)],mxUtils.extend(mxShapeElectricalStraightBus,mxShape),mxShapeElectricalStraightBus.prototype.cst={SHAPE_STRAIGHT_BUS:"mxgraph.electrical.transmission.straightBus"},mxShapeElectricalStraightBus.prototype.paintVertexShape=function(e,t,n,i,o){e.translate(t,n);var a,l=.2*i;a=i>o?.5*o:i/2,e.begin(),e.moveTo(i-l,0),e.lineTo(i-l,o-a),e.lineTo(i,o-a),e.lineTo(.5*i,o),e.lineTo(0,o-a),e.lineTo(l,o-a),e.lineTo(l,0),e.fillAndStroke()},mxCellRenderer.registerShape(mxShapeElectricalStraightBus.prototype.cst.SHAPE_STRAIGHT_BUS,mxShapeElectricalStraightBus),mxShapeElectricalStraightBus.prototype.constraints=[new mxConnectionConstraint(new mxPoint(.5,0),!0),new mxConnectionConstraint(new mxPoint(.5,1),!0)],mxUtils.extend(mxShapeElectricalTwoLineBusElbow,mxShape),mxShapeElectricalTwoLineBusElbow.prototype.cst={SHAPE_TWO_LINE_BUS_ELBOW:"mxgraph.electrical.transmission.twoLineBusElbow"},mxShapeElectricalTwoLineBusElbow.prototype.customProperties=[{name:"notch",dispName:"Spacing",type:"float",min:0,defVal:25}],mxShapeElectricalTwoLineBusElbow.prototype.paintVertexShape=function(e,t,n,i,o){var a=Math.max(0,Math.min(i,parseFloat(mxUtils.getValue(this.style,"notch",this.notch))));e.translate(t,n),e.begin(),e.moveTo(0,o),e.lineTo(i,o),e.lineTo(i,0),e.stroke();var l=Math.min(i,a),s=Math.min(o,a);e.begin(),e.moveTo(0,o-s),e.lineTo(i-l,o-s),e.lineTo(i-l,0),e.stroke()},mxCellRenderer.registerShape(mxShapeElectricalTwoLineBusElbow.prototype.cst.SHAPE_TWO_LINE_BUS_ELBOW,mxShapeElectricalTwoLineBusElbow),mxShapeElectricalTwoLineBusElbow.prototype.constraints=null,Graph.handleFactory[mxShapeElectricalTwoLineBusElbow.prototype.cst.SHAPE_TWO_LINE_BUS_ELBOW]=function(e){return[Graph.createHandle(e,["notch"],(function(e){var t=Math.max(Math.min(e.height,parseFloat(mxUtils.getValue(this.state.style,"notch",this.notch))),0);return new mxPoint(e.x+e.width/4,e.y+e.height-t)}),(function(e,t){this.state.style.notch=Math.round(.2*Math.max(0,e.width-t.y+e.y))/.2}))]},mxUtils.extend(mxShapeElectricalThreeLineBusElbow,mxShape),mxShapeElectricalThreeLineBusElbow.prototype.cst={SHAPE_THREE_LINE_BUS_ELBOW:"mxgraph.electrical.transmission.threeLineBusElbow"},mxShapeElectricalThreeLineBusElbow.prototype.customProperties=[{name:"notch",dispName:"Spacing",type:"float",min:0,defVal:30}],mxShapeElectricalThreeLineBusElbow.prototype.paintVertexShape=function(e,t,n,i,o){var a=Math.max(0,Math.min(i,parseFloat(mxUtils.getValue(this.style,"notch",this.notch))));e.translate(t,n),e.begin(),e.moveTo(0,o),e.lineTo(i,o),e.lineTo(i,0),e.stroke();var l=Math.min(i,a),s=Math.min(o,a);e.begin(),e.moveTo(0,o-s),e.lineTo(i-l,o-s),e.lineTo(i-l,0),e.stroke(),e.begin(),e.moveTo(0,o-s/2),e.lineTo(i-l/2,o-s/2),e.lineTo(i-l/2,0),e.stroke()},mxCellRenderer.registerShape(mxShapeElectricalThreeLineBusElbow.prototype.cst.SHAPE_THREE_LINE_BUS_ELBOW,mxShapeElectricalThreeLineBusElbow),mxShapeElectricalThreeLineBusElbow.prototype.constraints=null,Graph.handleFactory[mxShapeElectricalThreeLineBusElbow.prototype.cst.SHAPE_THREE_LINE_BUS_ELBOW]=function(e){return[Graph.createHandle(e,["notch"],(function(e){var t=Math.max(Math.min(e.height,parseFloat(mxUtils.getValue(this.state.style,"notch",this.notch))),0);return new mxPoint(e.x+e.width/4,e.y+e.height-t)}),(function(e,t){this.state.style.notch=Math.round(.2*Math.max(0,e.width-t.y+e.y))/.2}))]},mxUtils.extend(mxShapeElectricalFourLineBusElbow,mxShape),mxShapeElectricalFourLineBusElbow.prototype.cst={SHAPE_FOUR_LINE_BUS_ELBOW:"mxgraph.electrical.transmission.fourLineBusElbow"},mxShapeElectricalFourLineBusElbow.prototype.customProperties=[{name:"notch",dispName:"Spacing",type:"float",min:0,defVal:75}],mxShapeElectricalFourLineBusElbow.prototype.paintVertexShape=function(e,t,n,i,o){var a=Math.max(0,Math.min(i,parseFloat(mxUtils.getValue(this.style,"notch",this.notch))));e.translate(t,n),e.begin(),e.moveTo(0,o),e.lineTo(i,o),e.lineTo(i,0),e.stroke();var l=Math.min(i,a),s=Math.min(o,a);e.begin(),e.moveTo(0,o-s),e.lineTo(i-l,o-s),e.lineTo(i-l,0),e.stroke(),e.begin(),e.moveTo(0,o-s/3),e.lineTo(i-l/3,o-s/3),e.lineTo(i-l/3,0),e.stroke(),e.begin(),e.moveTo(0,o-2*s/3),e.lineTo(i-2*l/3,o-2*s/3),e.lineTo(i-2*l/3,0),e.stroke()},mxCellRenderer.registerShape(mxShapeElectricalFourLineBusElbow.prototype.cst.SHAPE_FOUR_LINE_BUS_ELBOW,mxShapeElectricalFourLineBusElbow),mxShapeElectricalFourLineBusElbow.prototype.constraints=null,Graph.handleFactory[mxShapeElectricalFourLineBusElbow.prototype.cst.SHAPE_FOUR_LINE_BUS_ELBOW]=function(e){return[Graph.createHandle(e,["notch"],(function(e){var t=Math.max(Math.min(e.height,parseFloat(mxUtils.getValue(this.state.style,"notch",this.notch))),0);return new mxPoint(e.x+e.width/4,e.y+e.height-t)}),(function(e,t){this.state.style.notch=Math.round(.2*Math.max(0,e.width-t.y+e.y))/.2}))]},mxUtils.extend(mxShapeElectricalEightLineBusElbow,mxShape),mxShapeElectricalEightLineBusElbow.prototype.cst={SHAPE_EIGHT_LINE_BUS_ELBOW:"mxgraph.electrical.transmission.eightLineBusElbow"},mxShapeElectricalEightLineBusElbow.prototype.customProperties=[{name:"notch",dispName:"Spacing",type:"float",min:0,defVal:180}],mxShapeElectricalEightLineBusElbow.prototype.paintVertexShape=function(e,t,n,i,o){var a=Math.max(0,Math.min(i,parseFloat(mxUtils.getValue(this.style,"notch",this.notch))));e.translate(t,n),e.begin(),e.moveTo(0,o),e.lineTo(i,o),e.lineTo(i,0),e.stroke();var l=Math.min(i,a),s=Math.min(o,a);e.begin(),e.moveTo(0,o-s),e.lineTo(i-l,o-s),e.lineTo(i-l,0),e.stroke(),e.begin(),e.moveTo(0,o-s/7),e.lineTo(i-l/7,o-s/7),e.lineTo(i-l/7,0),e.stroke(),e.begin(),e.moveTo(0,o-2*s/7),e.lineTo(i-2*l/7,o-2*s/7),e.lineTo(i-2*l/7,0),e.stroke(),e.begin(),e.moveTo(0,o-3*s/7),e.lineTo(i-3*l/7,o-3*s/7),e.lineTo(i-3*l/7,0),e.stroke(),e.begin(),e.moveTo(0,o-4*s/7),e.lineTo(i-4*l/7,o-4*s/7),e.lineTo(i-4*l/7,0),e.stroke(),e.begin(),e.moveTo(0,o-5*s/7),e.lineTo(i-5*l/7,o-5*s/7),e.lineTo(i-5*l/7,0),e.stroke(),e.begin(),e.moveTo(0,o-6*s/7),e.lineTo(i-6*l/7,o-6*s/7),e.lineTo(i-6*l/7,0),e.stroke()},mxCellRenderer.registerShape(mxShapeElectricalEightLineBusElbow.prototype.cst.SHAPE_EIGHT_LINE_BUS_ELBOW,mxShapeElectricalEightLineBusElbow),mxShapeElectricalEightLineBusElbow.prototype.constraints=null,Graph.handleFactory[mxShapeElectricalEightLineBusElbow.prototype.cst.SHAPE_EIGHT_LINE_BUS_ELBOW]=function(e){return[Graph.createHandle(e,["notch"],(function(e){var t=Math.max(Math.min(e.height,parseFloat(mxUtils.getValue(this.state.style,"notch",this.notch))),0);return new mxPoint(e.x+e.width/4,e.y+e.height-t)}),(function(e,t){this.state.style.notch=Math.round(.2*Math.max(0,e.width-t.y+e.y))/.2}))]},mxUtils.extend(mxShapeElectricalLogicGate,mxShape),mxShapeElectricalLogicGate.prototype.cst={SHAPE_LOGIC_GATE:"mxgraph.electrical.logic_gates.logic_gate"},mxShapeElectricalLogicGate.prototype.customProperties=[{name:"operation",dispName:"Operation",type:"enum",defVal:"and",enumList:[{val:"and",dispName:"And"},{val:"or",dispName:"Or"},{val:"xor",dispName:"Xor"}]},{name:"numInputs",dispName:"Inputs",type:"int",min:2,defVal:2},{name:"negating",dispName:"Negating",type:"bool",defVal:0}],mxShapeElectricalLogicGate.prototype.paintVertexShape=function(e,t,n,i,o){e.translate(t,n);var a=parseInt(mxUtils.getValue(this.style,"numInputs","2")),l=o/a,s=.5*l;e.begin(),e.moveTo(.8*i,.5*o),e.lineTo(i,.5*o);for(var r=mxUtils.getValue(this.style,"operation","and"),m=0;m<a;m++)e.moveTo(0,s),"and"==r?e.lineTo(.2*i,s):e.lineTo(.23*i,s),s+=l;switch(e.stroke(),r){case"xor":e.begin(),e.moveTo(.1*i,0),e.arcTo(.6*i,o,0,0,1,.1*i,o),e.stroke();case"or":e.begin(),e.moveTo(.4*i,0),e.arcTo(.45*i,.83*o,0,0,1,.8*i,.5*o),e.arcTo(.45*i,.83*o,0,0,1,.4*i,o),e.lineTo(.15*i,o),e.arcTo(.6*i,o,0,0,0,.15*i,0),e.close(),e.fillAndStroke();break;default:e.begin(),e.moveTo(.2*i,0),e.lineTo(.5*i,0),e.arcTo(.3*i,.5*o,0,0,1,.5*i,o),e.lineTo(.2*i,o),e.close(),e.fillAndStroke()}if("1"==mxUtils.getValue(this.style,"negating","0")){var c;if(this.style.negSize){var p=parseFloat(mxUtils.getValue(this.style,"negSize","0.13"));c=Math.min(i*p*.5,o*p)}else c=Math.min(.04*i,.07*o);e.begin(),e.ellipse(.8*i,.5*o-.5*c,c,c),e.fillAndStroke()}},mxCellRenderer.registerShape(mxShapeElectricalLogicGate.prototype.cst.SHAPE_LOGIC_GATE,mxShapeElectricalLogicGate),mxShapeElectricalLogicGate.prototype.getConstraints=function(e){for(var t=[new mxConnectionConstraint(new mxPoint(1,.5),!1)],n=parseInt(mxUtils.getValue(e,"numInputs","2")),i=1/n,o=.5*i,a=0;a<n;a++)t.push(new mxConnectionConstraint(new mxPoint(0,o),!1)),o+=i;return t},mxUtils.extend(mxShapeElectricalBuffer,mxShape),mxShapeElectricalBuffer.prototype.cst={SHAPE_BUFFER2:"mxgraph.electrical.logic_gates.buffer2"},mxShapeElectricalBuffer.prototype.customProperties=[{name:"negating",dispName:"Negating",type:"bool",defVal:0}],mxShapeElectricalBuffer.prototype.paintVertexShape=function(e,t,n,i,o){if(e.translate(t,n),e.begin(),e.moveTo(0,.5*o),e.lineTo(.2*i,.5*o),e.moveTo(.8*i,.5*o),e.lineTo(i,.5*o),e.stroke(),e.begin(),e.moveTo(.2*i,0),e.lineTo(.8*i,.5*o),e.lineTo(.2*i,o),e.close(),e.fillAndStroke(),"1"==mxUtils.getValue(this.style,"negating","0")){var a=Math.min(.04*i,.07*o);e.begin(),e.ellipse(.8*i,.5*o-.5*a,a,a),e.fillAndStroke()}},mxCellRenderer.registerShape(mxShapeElectricalBuffer.prototype.cst.SHAPE_BUFFER2,mxShapeElectricalBuffer),mxShapeElectricalBuffer.prototype.constraints=[new mxConnectionConstraint(new mxPoint(0,.5),!0),new mxConnectionConstraint(new mxPoint(1,.5),!0)],mxUtils.extend(mxShapeElectricalDualInLineIC,mxShape),mxShapeElectricalDualInLineIC.prototype.cst={SHAPE_DUAL_INLINE_IC:"mxgraph.electrical.logic_gates.dual_inline_ic"},mxShapeElectricalDualInLineIC.prototype.customProperties=[{name:"pinStyle",dispName:"Pin Style",type:"enum",defVal:"line",enumList:[{val:"line",dispName:"Line"},{val:"square",dispName:"Square"}]},{name:"startPin",dispName:"Starting Pin",type:"enum",defVal:"n",enumList:[{val:"n",dispName:"N"},{val:"e",dispName:"E"},{val:"s",dispName:"S"},{val:"w",dispName:"W"}]},{name:"pinSpacing",dispName:"Pin Spacing",type:"float",min:1,defVal:20},{name:"pinLabelType",dispName:"Pin Label Type",type:"enum",defVal:"gen",enumList:[{val:"gen",dispName:"Generated"},{val:"cust",dispName:"Custom"}]},{name:"labelCount",dispName:"Number of Labels",type:"int",defVal:20,dependentProps:["labelNames"]},{name:"labelNames",dispName:"Label Names",type:"staticArr",subType:"string",sizeProperty:"labelCount",subDefVal:"a"}],mxShapeElectricalDualInLineIC.prototype.paintVertexShape=function(e,t,n,i,o){e.translate(t,n);var a=mxUtils.getValue(this.style,"fontColor","#000000");e.setFontColor(a);var l=mxUtils.getValue(this.style,"startPin","n"),s=mxUtils.getValue(this.style,"pinLabelType","gen"),r=mxUtils.getValue(this.style,"labelNames","").toString().split(",");e.begin(),"n"==l||"s"==l?e.rect(10,0,i-20,o):e.rect(0,10,i,o-20),e.fillAndStroke();var m=parseFloat(mxUtils.getValue(this.style,"pinSpacing","20")),c=mxUtils.getValue(this.style,"pinStyle","line"),p=parseFloat(mxUtils.getValue(this.style,"fontSize","12"));if("n"==l||"s"==l)var h=parseInt(o/m);else h=parseInt(i/m);if("line"==c){e.setFontSize(.8*p);var x=1,u=.5*m;if(e.begin(),"n"==l||"s"==l)for(;x*m<=o;){if(e.moveTo(0,u),e.lineTo(10,u),e.moveTo(i-10,u),e.lineTo(i,u),"n"==l)var S=x;else S=h+x;if("gen"==s?e.text(20,u,0,0,S.toString(),mxConstants.ALIGN_LEFT,mxConstants.ALIGN_MIDDLE,0,null,0,0,0):S-1<r.length&&e.text(20,u,0,0,r[S-1].toString(),mxConstants.ALIGN_LEFT,mxConstants.ALIGN_MIDDLE,0,null,0,0,0),"n"==l)var E=2*h-x+1;else E=h-x+1;"gen"==s?e.text(i-20,u,0,0,E.toString(),mxConstants.ALIGN_RIGHT,mxConstants.ALIGN_MIDDLE,0,null,0,0,0):E-1<r.length&&e.text(i-20,u,0,0,r[E-1].toString(),mxConstants.ALIGN_RIGHT,mxConstants.ALIGN_MIDDLE,0,null,0,0,0),u+=m,x++}else for(;x*m<=i;)e.moveTo(u,0),e.lineTo(u,10),e.moveTo(u,o-10),e.lineTo(u,o),S="e"==l?h-x+1:2*h-x+1,"gen"==s?e.text(u,20,0,0,S.toString(),mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0):S-1<r.length&&e.text(u,20,0,0,r[S-1].toString(),mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0),E="e"==l?h+x:x,"gen"==s?e.text(u,o-20,0,0,E.toString(),mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0):E-1<r.length&&e.text(u,o-20,0,0,r[E-1].toString(),mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0),u+=m,x++;e.stroke()}else if(e.setFontSize(.5*p),x=1,u=.5*m,"n"==l||"s"==l)for(;x*m<=o;)e.begin(),e.rect(0,u-.25*m,10,.5*m),e.fillAndStroke(),e.begin(),e.rect(i-10,u-.25*m,10,.5*m),e.fillAndStroke(),S="n"==l?x:h+x,"gen"==s?e.text(5,u+1,0,0,S.toString(),mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0):S-1<r.length&&e.text(5,u+1,0,0,r[S-1].toString(),mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0),E="n"==l?2*h-x+1:h-x+1,"gen"==s?e.text(i-5,u+1,0,0,E.toString(),mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0):E-1<r.length&&e.text(i-5,u+1,0,0,r[E-1].toString(),mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0),u+=m,x++;else for(;x*m<=i;)e.begin(),e.rect(u-.25*m,0,.5*m,10),e.fillAndStroke(),e.begin(),e.rect(u-.25*m,o-10,.5*m,10),e.fillAndStroke(),S="e"==l?h-x+1:2*h-x+1,"gen"==s?e.text(u,5,0,0,S.toString(),mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0):S-1<r.length&&e.text(u,5,0,0,r[S-1].toString(),mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0),E="e"==l?h+x:x,"gen"==s?e.text(u,o-5,0,0,E.toString(),mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0):E-1<r.length&&e.text(u,o-5,0,0,r[E-1].toString(),mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0),u+=m,x++;switch(e.setShadow(!1),e.begin(),l){case"e":o>40&&(e.moveTo(i,.5*o-10),e.arcTo(12,12,0,0,0,i,.5*o+10));break;case"s":i>40&&(e.moveTo(.5*i-10,o),e.arcTo(12,12,0,0,1,.5*i+10,o));break;case"w":o>40&&(e.moveTo(0,.5*o-10),e.arcTo(12,12,0,0,1,0,.5*o+10));break;default:i>40&&(e.moveTo(.5*i-10,0),e.arcTo(12,12,0,0,0,.5*i+10,0))}e.stroke()},mxCellRenderer.registerShape(mxShapeElectricalDualInLineIC.prototype.cst.SHAPE_DUAL_INLINE_IC,mxShapeElectricalDualInLineIC),mxShapeElectricalDualInLineIC.prototype.getConstraints=function(e,t,n){var i=[],o=parseFloat(mxUtils.getValue(this.style,"pinSpacing","20")),a=mxUtils.getValue(this.style,"startPin","n"),l=1,s=.5*o;if(parseInt(n/o),"n"==a||"s"==a)for(;l*o<=n;)i.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,0,s)),i.push(new mxConnectionConstraint(new mxPoint(1,0),!1,null,0,s)),s+=o,l++;else for(;l*o<=t;)i.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,s,0)),i.push(new mxConnectionConstraint(new mxPoint(0,1),!1,null,s,0)),s+=o,l++;return i},mxUtils.extend(mxShapeElectricalQFPIC,mxShape),mxShapeElectricalQFPIC.prototype.cst={SHAPE_QFP_IC:"mxgraph.electrical.logic_gates.qfp_ic"},mxShapeElectricalQFPIC.prototype.customProperties=[{name:"pinStyle",dispName:"Pin Style",type:"enum",defVal:"line",enumList:[{val:"line",dispName:"Line"},{val:"square",dispName:"Square"}]},{name:"startPin",dispName:"Starting Pin",type:"enum",defVal:"sw",enumList:[{val:"sw",dispName:"SW"},{val:"nw",dispName:"NW"},{val:"ne",dispName:"NE"},{val:"se",dispName:"SE"}]},{name:"pinSpacing",dispName:"Pin Spacing",type:"float",min:1,defVal:20},{name:"pinLabelType",dispName:"Pin Label Type",type:"enum",defVal:"gen",enumList:[{val:"gen",dispName:"Generated"},{val:"cust",dispName:"Custom"}]},{name:"labelCount",dispName:"Number of Labels",type:"int",defVal:40,dependentProps:["labelNames"]},{name:"labelNames",dispName:"Label Names",type:"staticArr",subType:"string",sizeProperty:"labelCount",subDefVal:"a"}],mxShapeElectricalQFPIC.prototype.paintVertexShape=function(e,t,n,i,o){e.translate(t,n),e.begin(),e.moveTo(15,10),e.lineTo(i-15,10),e.lineTo(i-10,15),e.lineTo(i-10,o-15),e.lineTo(i-15,o-10),e.lineTo(15,o-10),e.lineTo(10,o-15),e.lineTo(10,15),e.close(),e.fillAndStroke();var a=parseFloat(mxUtils.getValue(this.style,"pinSpacing","20")),l=mxUtils.getValue(this.style,"pinStyle","line"),s=mxUtils.getValue(this.style,"pinLabelType","gen"),r=mxUtils.getValue(this.style,"labelNames","").toString().split(","),m=parseFloat(mxUtils.getValue(this.style,"fontSize","12")),c=mxUtils.getValue(this.style,"fontColor","#000000");e.setFontColor(c);var p=mxUtils.getValue(this.style,"startPin","sw");if("line"==l){e.setFontSize(.8*m);var h=1,x=.5*a+20;e.begin();for(var u=parseInt((o-a-40)/a)+1,S=parseInt((i-a-40)/a)+1;x<=o-.5*a-20;){switch(e.moveTo(0,x),e.lineTo(10,x),e.moveTo(i-10,x),e.lineTo(i,x),p){case"nw":var E=h;break;case"ne":E=S+h;break;case"se":E=u+S+h;break;default:E=u+2*S+h}switch("gen"==s?e.text(20,x,0,0,E.toString(),mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0):E-1<r.length&&e.text(20,x,0,0,r[E-1].toString(),mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0),p){case"nw":var T=S+2*u-h+1;break;case"ne":T=2*S+2*u-h+1;break;case"se":T=u-h+1;break;default:T=S+u-h+1}"gen"==s?e.text(i-20,x,0,0,T.toString(),mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0):T-1<r.length&&e.text(i-20,x,0,0,r[T-1].toString(),mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0),x+=a,h++}for(h=1,x=.5*a+20;x<=i-.5*a-20;){switch(e.moveTo(x,0),e.lineTo(x,10),e.moveTo(x,o-10),e.lineTo(x,o),p){case"nw":E=u+h;break;case"ne":E=u+S+h;break;case"se":E=2*u+S+h;break;default:E=h}switch("gen"==s?e.text(x,o-20,0,0,E.toString(),mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0):E-1<r.length&&e.text(x,o-20,0,0,r[E-1].toString(),mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0),p){case"nw":T=2*S+2*u-h+1;break;case"ne":T=S-h+1;break;case"se":T=S+u-h+1;break;default:T=2*S+u-h+1}"gen"==s?e.text(x,20,0,0,T.toString(),mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0):T-1<r.length&&e.text(x,20,0,0,r[T-1].toString(),mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0),x+=a,h++}e.stroke()}else{for(e.setFontSize(.5*m),h=1,x=.5*a+20,u=parseInt((o-a-40)/a)+1,S=parseInt((i-a-40)/a)+1;x<=o-.5*a-20;){switch(e.begin(),e.rect(0,x-.25*a,10,.5*a),e.fillAndStroke(),e.begin(),e.rect(i-10,x-.25*a,10,.5*a),e.fillAndStroke(),p){case"nw":E=h;break;case"ne":E=S+h;break;case"se":E=u+S+h;break;default:E=u+2*S+h}switch("gen"==s?e.text(5,x+1,0,0,E.toString(),mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0):E-1<r.length&&e.text(5,x+1,0,0,r[E-1].toString(),mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0),p){case"nw":T=S+2*u-h+1;break;case"ne":T=2*S+2*u-h+1;break;case"se":T=u-h+1;break;default:T=S+u-h+1}"gen"==s?e.text(i-5,x+1,0,0,T.toString(),mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0):T-1<r.length&&e.text(i-5,x+1,0,0,r[T-1].toString(),mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0),x+=a,h++}for(h=1,x=.5*a+20;x<=i-.5*a-20;){switch(e.begin(),e.rect(x-.25*a,0,.5*a,10),e.fillAndStroke(),e.begin(),e.rect(x-.25*a,o-10,.5*a,10),e.fillAndStroke(),p){case"nw":E=u+h;break;case"ne":E=u+S+h;break;case"se":E=2*u+S+h;break;default:E=h}switch("gen"==s?e.text(x,o-4,0,0,E.toString(),mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0):E-1<r.length&&e.text(x,o-4,0,0,r[E-1].toString(),mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0),p){case"nw":T=2*S+2*u-h+1;break;case"ne":T=S-h+1;break;case"se":T=S+u-h+1;break;default:T=2*S+u-h+1}"gen"==s?e.text(x,6,0,0,T.toString(),mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0):T-1<r.length&&e.text(x,6,0,0,r[T-1].toString(),mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,0),x+=a,h++}}if(e.setShadow(!1),i>40){switch(e.setFillColor(mxUtils.getValue(this.style,"strokeColor","#000000")),e.begin(),p){case"nw":e.ellipse(15,15,10,10);break;case"ne":e.ellipse(i-25,15,10,10);break;case"se":e.ellipse(i-25,o-25,10,10);break;default:e.ellipse(15,o-25,10,10)}e.fillAndStroke()}},mxCellRenderer.registerShape(mxShapeElectricalQFPIC.prototype.cst.SHAPE_QFP_IC,mxShapeElectricalQFPIC),mxShapeElectricalQFPIC.prototype.getConstraints=function(e,t,n){var i=[],o=parseFloat(mxUtils.getValue(this.style,"pinSpacing","20")),a=.5*o+20;for(parseInt(n/o);a<=n-.5*o-20;)i.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,0,a)),i.push(new mxConnectionConstraint(new mxPoint(1,0),!1,null,0,a)),a+=o;for(a=.5*o+20;a<=t-.5*o-20;)i.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,a,0)),i.push(new mxConnectionConstraint(new mxPoint(0,1),!1,null,a,0)),a+=o;return i},mxUtils.extend(mxShapeElectricalMux,mxShape),mxShapeElectricalMux.prototype.cst={SHAPE_MUX:"mxgraph.electrical.abstract.mux2"},mxShapeElectricalMux.prototype.customProperties=[{name:"operation",dispName:"Operation",type:"enum",defVal:"mux",enumList:[{val:"mux",dispName:"Mux"},{val:"demux",dispName:"Demux"}]},{name:"selectorPins",dispName:"Selector Pins",type:"int",min:1,max:8,defVal:1}],mxShapeElectricalMux.prototype.paintVertexShape=function(e,t,n,i,o){e.translate(t,n);var a=parseInt(mxUtils.getValue(this.style,"selectorPins","1")),l=mxUtils.getValue(this.style,"operation","mux"),s=parseFloat(mxUtils.getValue(this.style,"fontSize","12"));e.setFontSize(.5*s);var r=mxUtils.getValue(this.style,"fontColor","#000000");e.setFontColor(r);var m=0;switch(mxUtils.getValue(this.style,"direction","east")){case"south":m=270;break;case"west":m=180;break;case"north":m=90}"demux"===l?(e.begin(),e.moveTo(i-10,0),e.lineTo(10,.1*o),e.lineTo(10,.9*o-10),e.lineTo(i-10,o-10),e.close(),e.fillAndStroke()):(e.begin(),e.moveTo(10,0),e.lineTo(i-10,.1*o),e.lineTo(i-10,.9*o-10),e.lineTo(10,o-10),e.close(),e.fillAndStroke());var c=1,p=1;if("mux"==l)var h=(o-16)/(c=Math.pow(2,a));else h=(o-16)/(p=Math.pow(2,a));var x=3+.5*h;if(e.begin(),1==c)e.moveTo(0,.5*(o-10)),e.lineTo(10,.5*(o-10));else for(var u=0;u<c;u++)e.moveTo(0,x),e.lineTo(10,x),e.text(14,x+1,0,0,""+u.toString(),mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,m),x+=h;if(1==p)e.moveTo(i-10,.5*(o-10)),e.lineTo(i,.5*(o-10));else for(u=0;u<p;u++)e.moveTo(i-10,x),e.lineTo(i,x),e.text(i-14,x+1,0,0,""+u.toString(),mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,m),x+=h;var S=10+.5*(h=(i-20)/a);for(u=0;u<a;u++)"mux"==l?e.moveTo(S,o-10-(S-10)/(i-20)*o*.1):e.moveTo(S,o-10-(i-S-10)/(i-20)*o*.1),e.lineTo(S,o),e.text(S+5,o-4,0,0,"S"+(a-u-1).toString(),mxConstants.ALIGN_CENTER,mxConstants.ALIGN_MIDDLE,0,null,0,0,m),S+=h;e.stroke()},mxCellRenderer.registerShape(mxShapeElectricalMux.prototype.cst.SHAPE_MUX,mxShapeElectricalMux),mxShapeElectricalMux.prototype.getConstraints=function(e,t,n){var i=[],o=(n-16)/n,a=parseInt(mxUtils.getValue(this.style,"selectorPins","1")),l=1,s=1;if("mux"==mxUtils.getValue(this.style,"operation","mux"))var r=o/(l=Math.pow(2,a));else r=o/(s=Math.pow(2,a));var m=.5*r;if(1==l)i.push(new mxConnectionConstraint(new mxPoint(0,.5*(n-10)/n),!1,0,0));else for(var c=0;c<l;c++)i.push(new mxConnectionConstraint(new mxPoint(0,m),!1,null,0,3)),m+=r;if(1==s)i.push(new mxConnectionConstraint(new mxPoint(1,.5),!1,null,0,-5));else for(c=0;c<s;c++)i.push(new mxConnectionConstraint(new mxPoint(1,m),!1,null,0,3)),m+=r;var p=.5*(r=(t-20)/(t*a));for(c=0;c<a;c++)i.push(new mxConnectionConstraint(new mxPoint(p,1),!1,null,10,0)),p+=r;return i},mxUtils.extend(mxShapeElectricalBatteryStack,mxShape),mxShapeElectricalBatteryStack.prototype.cst={SHAPE_BATTERY_STACK:"mxgraph.electrical.miscellaneous.batteryStack"},mxShapeElectricalBatteryStack.prototype.paintVertexShape=function(e,t,n,i,o){e.translate(t,n);var a=.3*o,l=mxUtils.getValue(this.style,mxConstants.STYLE_STROKECOLOR,"#000000"),s=mxUtils.getValue(this.style,mxConstants.STYLE_DASHED,"0"),r=Math.floor((i-20)/a),m=.5*(i-r*a);if(r>0){e.begin(),e.moveTo(0,.5*o),e.lineTo(m+.2*a,.5*o),e.moveTo(i-m-.2*a,.5*o),e.lineTo(i,.5*o),e.stroke();var c=m;e.setFillColor(l);for(var p=0;p<r;p++)e.rect(c+.2*a,.25*o,.2*a,.5*o),e.fillAndStroke(),e.begin(),e.moveTo(c+.8*a,0),e.lineTo(c+.8*a,o),e.stroke(),p>0&&(e.setDashed("1"),e.begin(),e.moveTo(c-.2*a,.5*o),e.lineTo(c+.2*a,.5*o),e.stroke(),e.setDashed(s)),c+=a}},mxCellRenderer.registerShape(mxShapeElectricalBatteryStack.prototype.cst.SHAPE_BATTERY_STACK,mxShapeElectricalBatteryStack),mxShapeElectricalBatteryStack.prototype.constraints=[new mxConnectionConstraint(new mxPoint(0,.5),!0),new mxConnectionConstraint(new mxPoint(1,.5),!0)],mxUtils.extend(mxShapeElectricalDCSource3_v2,mxShape),mxShapeElectricalDCSource3_v2.prototype.cst={SHAPE_DC_SOURCE_3_V2:"mxgraph.electrical.signal_sources.dc_source_3_v2"},mxShapeElectricalDCSource3_v2.prototype.paintVertexShape=function(e,t,n,i,o){e.translate(t,n);var a=Math.max(3,.05*Math.min(o,i));e.ellipse(0,0,i,o),e.fillAndStroke(),e.begin(),e.moveTo(.5*i-a,.05*o+3),e.lineTo(.5*i+a,.05*o+3),e.moveTo(.5*i,.05*o-a+3),e.lineTo(.5*i,.05*o+a+3),e.moveTo(.5*i-a,.95*o-3),e.lineTo(.5*i+a,.95*o-3),e.stroke()},mxCellRenderer.registerShape(mxShapeElectricalDCSource3_v2.prototype.cst.SHAPE_DC_SOURCE_3_V2,mxShapeElectricalDCSource3_v2),mxShapeElectricalDCSource3_v2.prototype.constraints=[new mxConnectionConstraint(new mxPoint(.5,0),!0),new mxConnectionConstraint(new mxPoint(.5,1),!0)],mxUtils.extend(mxShapeElectricalSource,mxShape),mxShapeElectricalSource.prototype.cst={SHAPE_SOURCE:"mxgraph.electrical.signal_sources.source"},mxShapeElectricalSource.prototype.customProperties=[{name:"elSourceType",dispName:"Source Type",type:"enum",defVal:"independent",enumList:[{val:"independent",dispName:"Independent"},{val:"dependent",dispName:"Dependent"}]},{name:"elSignalType",dispName:"Signal Type",type:"enum",defVal:"ac",enumList:[{val:"ac",dispName:"AC"},{val:"none",dispName:"None"},{val:"square",dispName:"Square"},{val:"triangular",dispName:"Triangular"},{val:"sawtooth",dispName:"Sawtooth"},{val:"noise",dispName:"Noise"},{val:"ideal",dispName:"Ideal"},{val:"expSquib",dispName:"Explosive Squib"},{val:"pulse",dispName:"Pulse"},{val:"invPulse",dispName:"Inverse Pulse"},{val:"chopSquare",dispName:"Chopped Square"},{val:"stepOn",dispName:"Step On"},{val:"stepOff",dispName:"Step Off"},{val:"dc1",dispName:"DC Horizontal"},{val:"dc2",dispName:"DC Vertical"},{val:"dc3",dispName:"DC Plus minus"}]}],mxShapeElectricalSource.prototype.paintVertexShape=function(e,t,n,i,o){e.translate(t,n);var a=mxUtils.getValue(this.style,"elSourceType","independent"),l=mxUtils.getValue(this.style,"elSignalType","none");switch(a){case"independent":e.ellipse(0,0,i,o),e.fillAndStroke();break;case"dependent":e.begin(),e.moveTo(0,.5*o),e.lineTo(.5*i,0),e.lineTo(i,.5*o),e.lineTo(.5*i,o),e.lineTo(0,.5*o),e.close(),e.fillAndStroke()}switch(l){case"ac":e.begin(),e.moveTo(.3*i,.5*o),e.quadTo(.34*i,.35*o,.4*i,.35*o),e.quadTo(.46*i,.35*o,.5*i,.5*o),e.quadTo(.53*i,.65*o,.6*i,.65*o),e.quadTo(.66*i,.65*o,.7*i,.5*o),e.stroke();break;case"square":e.begin(),e.moveTo(.3*i,.5*o),e.lineTo(.3*i,.35*o),e.lineTo(.5*i,.35*o),e.lineTo(.5*i,.65*o),e.lineTo(.7*i,.65*o),e.lineTo(.7*i,.5*o),e.stroke();break;case"triangular":e.begin(),e.moveTo(.3*i,.65*o),e.lineTo(.4*i,.35*o),e.lineTo(.5*i,.65*o),e.lineTo(.6*i,.35*o),e.lineTo(.7*i,.65*o),e.stroke();break;case"sawtooth":e.begin(),e.moveTo(.24*i,.65*o),e.lineTo(.42*i,.35*o),e.lineTo(.42*i,.65*o),e.lineTo(.58*i,.35*o),e.lineTo(.58*i,.65*o),e.lineTo(.76*i,.35*o),e.lineTo(.76*i,.65*o),e.stroke();break;case"noise":e.begin(),e.moveTo(.5*i,.17*o),e.lineTo(.5*i,.5*o),e.moveTo(.18*i,.42*o),e.lineTo(.5*i,.5*o),e.moveTo(.32*i,.78*o),e.lineTo(.5*i,.5*o),e.moveTo(.82*i,.42*o),e.lineTo(.5*i,.5*o),e.moveTo(.68*i,.78*o),e.lineTo(.5*i,.5*o),e.stroke();break;case"ideal":e.begin(),e.moveTo(0,.5*o),e.lineTo(i,.5*o),e.stroke();break;case"expSquib":e.ellipse(0,.43*o,.14*i,.14*o),e.stroke(),e.ellipse(.86*i,.43*o,.14*i,.14*o),e.stroke(),e.begin(),e.moveTo(.83*i,.63*o),e.lineTo(.73*i,.73*o),e.lineTo(.27*i,.27*o),e.lineTo(.17*i,.37*o),e.stroke(),e.begin();var s=mxUtils.getValue(this.style,mxConstants.STYLE_STROKECOLOR,"#000000");e.setFillColor(s),e.moveTo(.2*i,.25*o),e.lineTo(.13*i,.4*o),e.lineTo(.28*i,.33*o),e.close(),e.fillAndStroke();break;case"pulse":e.begin(),e.moveTo(.3*i,.65*o),e.lineTo(.4*i,.65*o),e.lineTo(.4*i,.35*o),e.lineTo(.6*i,.35*o),e.lineTo(.6*i,.65*o),e.lineTo(.7*i,.65*o),e.stroke();break;case"invPulse":e.begin(),e.moveTo(.3*i,.35*o),e.lineTo(.4*i,.35*o),e.lineTo(.4*i,.65*o),e.lineTo(.6*i,.65*o),e.lineTo(.6*i,.35*o),e.lineTo(.7*i,.35*o),e.stroke();break;case"chopSquare":e.begin(),e.moveTo(.3*i,.5*o),e.lineTo(.33*i,.35*o),e.lineTo(.47*i,.35*o),e.lineTo(.53*i,.65*o),e.lineTo(.67*i,.65*o),e.lineTo(.7*i,.5*o),e.stroke();break;case"stepOn":e.begin(),e.moveTo(.3*i,.65*o),e.lineTo(.5*i,.65*o),e.lineTo(.5*i,.35*o),e.lineTo(.7*i,.35*o),e.stroke();break;case"stepOff":e.begin(),e.moveTo(.3*i,.35*o),e.lineTo(.5*i,.35*o),e.lineTo(.5*i,.65*o),e.lineTo(.7*i,.65*o),e.stroke();break;case"dc1":e.begin(),e.moveTo(.17*i,.5*o),e.lineTo(.83*i,.5*o),e.moveTo(.67*i,.42*o),e.lineTo(.83*i,.5*o),e.lineTo(.67*i,.58*o),e.stroke();break;case"dc2":e.begin(),e.moveTo(.5*i,.17*o),e.lineTo(.5*i,.83*o),e.moveTo(.42*i,.67*o),e.lineTo(.5*i,.83*o),e.lineTo(.58*i,.67*o),e.stroke();break;case"dc3":var r=Math.max(3,.05*Math.min(o,i)),m=3;"dependent"==a&&(m+=3),e.begin(),e.moveTo(.5*i-r,.05*o+m),e.lineTo(.5*i+r,.05*o+m),e.moveTo(.5*i,.05*o-r+m),e.lineTo(.5*i,.05*o+r+m),e.moveTo(.5*i-r,.95*o-m),e.lineTo(.5*i+r,.95*o-m),e.stroke()}},mxCellRenderer.registerShape(mxShapeElectricalSource.prototype.cst.SHAPE_SOURCE,mxShapeElectricalSource);