123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182 |
- ht.lib = ht.lib || {};
- if (!ht.lib['黄色向上接地']) {
- ht.lib['黄色向上接地'] = function (x, y, width, height, angle, localVarObj, localDynamicVar, nodename) {
- _ratio = GD.getRatioWithRotation(0, ratio);
- ht.lib['黄色向上接地'].superClass.constructor.apply(this);
- this.localVarObj = localVarObj;
- this.localDynamicVar = localDynamicVar;
- this.childNodes = [];
-
- this._styleObject = {};
- this._originWidth = 16*_ratio.ratioX;
- this._originHeight = 14*_ratio.ratioY;
- this._baseClass = "ht.lib.黄色向上接地";
- this._background = new ht.Node();
- this._background.setWidth(this._originWidth);
- this._background.setHeight(this._originHeight);
- this._background.setPosition(this._originWidth/2, this._originHeight/2);
- this._background.setImage({
- width: width,
- height: height,
- clip: true,
- comps: [
- {
- type: 'rect',
- background: 'rgba(0,255,0,0)',
- rect: [0,0,width, height]
- }
- ]
- });
- this._background.__parentLib = nodename;
- this._background.isLibBackground = true;
- this.childNodes.push(this._background);
- dataModel.add(this._background);
- /*@PageBackgroundInit@*/
- /*@PageBeforeInit@*/
- var Lib_黄色向上接地Node0_0points=[4, 13,10, 13],
- Lib_黄色向上接地Node0_0rect=ht.Default.unionPoint([{x:4,y:13},{x:10,y:13}]),
- Lib_黄色向上接地Node0_0compspts=[];
- _ratio = GD.getRatioWithRotation(0, ratio);
- var _startratio = GD.getRatioWithRotation(3.14159265358979, ratio),
- _endratio = GD.getRatioWithRotation(0, ratio);
- for(var i=0;i<Lib_黄色向上接地Node0_0points.length;i++){
- if(i%2==0){
- Lib_黄色向上接地Node0_0compspts.push(Lib_黄色向上接地Node0_0points[i]-Lib_黄色向上接地Node0_0rect.x);
- }else{
- Lib_黄色向上接地Node0_0compspts.push(Lib_黄色向上接地Node0_0points[i]-Lib_黄色向上接地Node0_0rect.y);
- }
- }
- var Lib_黄色向上接地Node0_0ptslength=Lib_黄色向上接地Node0_0compspts.length;
- if (Lib_黄色向上接地Node0_0rect.height === 0) {
- Lib_黄色向上接地Node0_0compspts[0] -= 0;
- Lib_黄色向上接地Node0_0compspts[Lib_黄色向上接地Node0_0ptslength-2] += 0;
- } else if (Lib_黄色向上接地Node0_0rect.width === 0){
- Lib_黄色向上接地Node0_0compspts[1] -= 0;
- Lib_黄色向上接地Node0_0compspts[Lib_黄色向上接地Node0_0ptslength-1] += 0;
- } else {
- Lib_黄色向上接地Node0_0compspts[0] -= 0;
- Lib_黄色向上接地Node0_0compspts[1] -= 0;
- Lib_黄色向上接地Node0_0compspts[Lib_黄色向上接地Node0_0ptslength-2] += 0;
- Lib_黄色向上接地Node0_0compspts[Lib_黄色向上接地Node0_0ptslength-1] += 0;
- }
- Lib_黄色向上接地Node0_0 = new ht.Node();
- Lib_黄色向上接地Node0_0.borderWidth = 1;
- Lib_黄色向上接地Node0_0rect.width = Lib_黄色向上接地Node0_0rect.width === 0 ? 0.0001 : Lib_黄色向上接地Node0_0rect.width;
- Lib_黄色向上接地Node0_0rect.height = Lib_黄色向上接地Node0_0rect.height === 0 ? 0.0001 : Lib_黄色向上接地Node0_0rect.height;
- var Lib_黄色向上接地Node0_0endCompspts = [Lib_黄色向上接地Node0_0compspts[Lib_黄色向上接地Node0_0ptslength-2],Lib_黄色向上接地Node0_0compspts[Lib_黄色向上接地Node0_0ptslength-1],0,0];
- var Lib_黄色向上接地Node0_0startCompspts = [Lib_黄色向上接地Node0_0compspts[0],Lib_黄色向上接地Node0_0compspts[1],0,0];
- Lib_黄色向上接地Node0_0.setImage(GD.getPolyLineJSON());
- Lib_黄色向上接地Node0_0.setPosition(Lib_黄色向上接地Node0_0rect.x+Lib_黄色向上接地Node0_0rect.width/2,Lib_黄色向上接地Node0_0rect.y+Lib_黄色向上接地Node0_0rect.height/2);
- Lib_黄色向上接地Node0_0.setSize(Lib_黄色向上接地Node0_0rect.width,Lib_黄色向上接地Node0_0rect.height);
- Lib_黄色向上接地Node0_0.setStyle("opacity",1);
- Lib_黄色向上接地Node0_0.s({'pixelPerfect':true});
- Lib_黄色向上接地Node0_0borderwidth=1;
- Lib_黄色向上接地Node0_0.setRotation(0);
- dataModel.add(Lib_黄色向上接地Node0_0);
- Lib_黄色向上接地Node0_0.a('node.points',Lib_黄色向上接地Node0_0compspts);
- Lib_黄色向上接地Node0_0.a('node.segments',[1,2]);
- Lib_黄色向上接地Node0_0.a('node.color','rgba(255,128,0,1)');
- Lib_黄色向上接地Node0_0.a('node.borderPattern',getDashStyle("@borderPattern@"));
- Lib_黄色向上接地Node0_0.a('node.borderColor','rgba(255,128,0,1)');
- Lib_黄色向上接地Node0_0.a('node.background','rgba(255,128,0,1)');
- Lib_黄色向上接地Node0_0.a('node.gradient','');
- Lib_黄色向上接地Node0_0.a('node.gradientcolor','rgba(255,128,0,1)');
- Lib_黄色向上接地Node0_0.a('node.endCompspts',Lib_黄色向上接地Node0_0endCompspts);
- Lib_黄色向上接地Node0_0.a('node.startCompspts',Lib_黄色向上接地Node0_0startCompspts);
- (function (node, img, compspts, endCompspts, startCompspts) {
- var position = node.getPosition(),
- w = node.getWidth()*_ratio.ratioX,
- h = node.getHeight()*_ratio.ratioY;
- function resetPoints(rx, ry) {
- for (var i = 0, len = compspts.length; i < len; i++) {
- if (i%2 === 0) {
- compspts[i]*=rx;
- } else {
- compspts[i]*=ry;
- }
- }
- endCompspts[0] = compspts[compspts.length-2];
- endCompspts[1] = compspts[compspts.length-1];
- endCompspts[2] *= rx;
- endCompspts[3] *= ry;
- node.a('node.offsetEndY', -(endCompspts[3]*0.5));
- node.a('node.offsetEndX', -(endCompspts[2]*0.5));
-
- startCompspts[0] = compspts[0];
- startCompspts[1] = compspts[1];
- startCompspts[2] *= rx;
- startCompspts[3] *= ry;
- node.a('node.offsetStartY', -(startCompspts[3]*0.5));
- node.a('node.offsetStartX', -(startCompspts[2]*0.5));
- node.a('node.endRotation', GD.calcRotationByStartAndEnd(compspts[i-4], compspts[i-3], compspts[i-2], compspts[i-1]));
- node.a('node.startRotation', GD.calcRotationByStartAndEnd(compspts[0], compspts[1], compspts[2], compspts[3]) + Math.PI);
- }
- node.setSize(w, h);
- node.setPosition(position.x * ratio.ratioX, position.y * ratio.ratioY);
- node.a('node.width', w);
- node.a('node.height', h);
- resetPoints(_ratio.ratioX, _ratio.ratioY);
- node.borderWidth = 1;
- node.a('node.borderwidth',node.borderWidth);
- node._nodename = 'Lib_黄色向上接地Node0_0';
- node._nodeType = 'line';
- zoomNodeList.push({
- node: node,
- attr: 'node.borderwidth'
- });
- var setWidth = node.setWidth,
- setHeight = node.setHeight,
- timer, rx = 1, ry = 1;
-
- node.setWidth = function (width) {
- var _width = this.getWidth();
- rx = width / _width;
- node.a('node.width', width);
- setWidth.apply(this, arguments);
- resetPoints(rx, 1);
- }
- node.setHeight = function (height) {
- var _height = this.getHeight();
- ry = height / _height;
- node.a('node.height', height);
- setHeight.apply(this, arguments);
- resetPoints(1, ry);
- }
- })(Lib_黄色向上接地Node0_0, Lib_黄色向上接地Node0_0.getImage(), Lib_黄色向上接地Node0_0compspts, Lib_黄色向上接地Node0_0endCompspts, Lib_黄色向上接地Node0_0startCompspts);
- var Lib_黄色向上接地Node0_1points=[2, 10,12, 10],
- Lib_黄色向上接地Node0_1rect=ht.Default.unionPoint([{x:2,y:10},{x:12,y:10}]),
- Lib_黄色向上接地Node0_1compspts=[];
- _ratio = GD.getRatioWithRotation(0, ratio);
- var _startratio = GD.getRatioWithRotation(3.14159265358979, ratio),
- _endratio = GD.getRatioWithRotation(0, ratio);
- for(var i=0;i<Lib_黄色向上接地Node0_1points.length;i++){
- if(i%2==0){
- Lib_黄色向上接地Node0_1compspts.push(Lib_黄色向上接地Node0_1points[i]-Lib_黄色向上接地Node0_1rect.x);
- }else{
- Lib_黄色向上接地Node0_1compspts.push(Lib_黄色向上接地Node0_1points[i]-Lib_黄色向上接地Node0_1rect.y);
- }
- }
- var Lib_黄色向上接地Node0_1ptslength=Lib_黄色向上接地Node0_1compspts.length;
- if (Lib_黄色向上接地Node0_1rect.height === 0) {
- Lib_黄色向上接地Node0_1compspts[0] -= 0;
- Lib_黄色向上接地Node0_1compspts[Lib_黄色向上接地Node0_1ptslength-2] += 0;
- } else if (Lib_黄色向上接地Node0_1rect.width === 0){
- Lib_黄色向上接地Node0_1compspts[1] -= 0;
- Lib_黄色向上接地Node0_1compspts[Lib_黄色向上接地Node0_1ptslength-1] += 0;
- } else {
- Lib_黄色向上接地Node0_1compspts[0] -= 0;
- Lib_黄色向上接地Node0_1compspts[1] -= 0;
- Lib_黄色向上接地Node0_1compspts[Lib_黄色向上接地Node0_1ptslength-2] += 0;
- Lib_黄色向上接地Node0_1compspts[Lib_黄色向上接地Node0_1ptslength-1] += 0;
- }
- Lib_黄色向上接地Node0_1 = new ht.Node();
- Lib_黄色向上接地Node0_1.borderWidth = 1;
- Lib_黄色向上接地Node0_1rect.width = Lib_黄色向上接地Node0_1rect.width === 0 ? 0.0001 : Lib_黄色向上接地Node0_1rect.width;
- Lib_黄色向上接地Node0_1rect.height = Lib_黄色向上接地Node0_1rect.height === 0 ? 0.0001 : Lib_黄色向上接地Node0_1rect.height;
- var Lib_黄色向上接地Node0_1endCompspts = [Lib_黄色向上接地Node0_1compspts[Lib_黄色向上接地Node0_1ptslength-2],Lib_黄色向上接地Node0_1compspts[Lib_黄色向上接地Node0_1ptslength-1],0,0];
- var Lib_黄色向上接地Node0_1startCompspts = [Lib_黄色向上接地Node0_1compspts[0],Lib_黄色向上接地Node0_1compspts[1],0,0];
- Lib_黄色向上接地Node0_1.setImage(GD.getPolyLineJSON());
- Lib_黄色向上接地Node0_1.setPosition(Lib_黄色向上接地Node0_1rect.x+Lib_黄色向上接地Node0_1rect.width/2,Lib_黄色向上接地Node0_1rect.y+Lib_黄色向上接地Node0_1rect.height/2);
- Lib_黄色向上接地Node0_1.setSize(Lib_黄色向上接地Node0_1rect.width,Lib_黄色向上接地Node0_1rect.height);
- Lib_黄色向上接地Node0_1.setStyle("opacity",1);
- Lib_黄色向上接地Node0_1.s({'pixelPerfect':true});
- Lib_黄色向上接地Node0_1borderwidth=1;
- Lib_黄色向上接地Node0_1.setRotation(0);
- dataModel.add(Lib_黄色向上接地Node0_1);
- Lib_黄色向上接地Node0_1.a('node.points',Lib_黄色向上接地Node0_1compspts);
- Lib_黄色向上接地Node0_1.a('node.segments',[1,2]);
- Lib_黄色向上接地Node0_1.a('node.color','rgba(255,128,0,1)');
- Lib_黄色向上接地Node0_1.a('node.borderPattern',getDashStyle("@borderPattern@"));
- Lib_黄色向上接地Node0_1.a('node.borderColor','rgba(255,128,0,1)');
- Lib_黄色向上接地Node0_1.a('node.background','rgba(255,128,0,1)');
- Lib_黄色向上接地Node0_1.a('node.gradient','');
- Lib_黄色向上接地Node0_1.a('node.gradientcolor','rgba(255,128,0,1)');
- Lib_黄色向上接地Node0_1.a('node.endCompspts',Lib_黄色向上接地Node0_1endCompspts);
- Lib_黄色向上接地Node0_1.a('node.startCompspts',Lib_黄色向上接地Node0_1startCompspts);
- (function (node, img, compspts, endCompspts, startCompspts) {
- var position = node.getPosition(),
- w = node.getWidth()*_ratio.ratioX,
- h = node.getHeight()*_ratio.ratioY;
- function resetPoints(rx, ry) {
- for (var i = 0, len = compspts.length; i < len; i++) {
- if (i%2 === 0) {
- compspts[i]*=rx;
- } else {
- compspts[i]*=ry;
- }
- }
- endCompspts[0] = compspts[compspts.length-2];
- endCompspts[1] = compspts[compspts.length-1];
- endCompspts[2] *= rx;
- endCompspts[3] *= ry;
- node.a('node.offsetEndY', -(endCompspts[3]*0.5));
- node.a('node.offsetEndX', -(endCompspts[2]*0.5));
-
- startCompspts[0] = compspts[0];
- startCompspts[1] = compspts[1];
- startCompspts[2] *= rx;
- startCompspts[3] *= ry;
- node.a('node.offsetStartY', -(startCompspts[3]*0.5));
- node.a('node.offsetStartX', -(startCompspts[2]*0.5));
- node.a('node.endRotation', GD.calcRotationByStartAndEnd(compspts[i-4], compspts[i-3], compspts[i-2], compspts[i-1]));
- node.a('node.startRotation', GD.calcRotationByStartAndEnd(compspts[0], compspts[1], compspts[2], compspts[3]) + Math.PI);
- }
- node.setSize(w, h);
- node.setPosition(position.x * ratio.ratioX, position.y * ratio.ratioY);
- node.a('node.width', w);
- node.a('node.height', h);
- resetPoints(_ratio.ratioX, _ratio.ratioY);
- node.borderWidth = 1;
- node.a('node.borderwidth',node.borderWidth);
- node._nodename = 'Lib_黄色向上接地Node0_1';
- node._nodeType = 'line';
- zoomNodeList.push({
- node: node,
- attr: 'node.borderwidth'
- });
- var setWidth = node.setWidth,
- setHeight = node.setHeight,
- timer, rx = 1, ry = 1;
-
- node.setWidth = function (width) {
- var _width = this.getWidth();
- rx = width / _width;
- node.a('node.width', width);
- setWidth.apply(this, arguments);
- resetPoints(rx, 1);
- }
- node.setHeight = function (height) {
- var _height = this.getHeight();
- ry = height / _height;
- node.a('node.height', height);
- setHeight.apply(this, arguments);
- resetPoints(1, ry);
- }
- })(Lib_黄色向上接地Node0_1, Lib_黄色向上接地Node0_1.getImage(), Lib_黄色向上接地Node0_1compspts, Lib_黄色向上接地Node0_1endCompspts, Lib_黄色向上接地Node0_1startCompspts);
- var Lib_黄色向上接地Node0_2points=[0, 7,15, 7],
- Lib_黄色向上接地Node0_2rect=ht.Default.unionPoint([{x:0,y:7},{x:15,y:7}]),
- Lib_黄色向上接地Node0_2compspts=[];
- _ratio = GD.getRatioWithRotation(0, ratio);
- var _startratio = GD.getRatioWithRotation(3.14159265358979, ratio),
- _endratio = GD.getRatioWithRotation(0, ratio);
- for(var i=0;i<Lib_黄色向上接地Node0_2points.length;i++){
- if(i%2==0){
- Lib_黄色向上接地Node0_2compspts.push(Lib_黄色向上接地Node0_2points[i]-Lib_黄色向上接地Node0_2rect.x);
- }else{
- Lib_黄色向上接地Node0_2compspts.push(Lib_黄色向上接地Node0_2points[i]-Lib_黄色向上接地Node0_2rect.y);
- }
- }
- var Lib_黄色向上接地Node0_2ptslength=Lib_黄色向上接地Node0_2compspts.length;
- if (Lib_黄色向上接地Node0_2rect.height === 0) {
- Lib_黄色向上接地Node0_2compspts[0] -= 0;
- Lib_黄色向上接地Node0_2compspts[Lib_黄色向上接地Node0_2ptslength-2] += 0;
- } else if (Lib_黄色向上接地Node0_2rect.width === 0){
- Lib_黄色向上接地Node0_2compspts[1] -= 0;
- Lib_黄色向上接地Node0_2compspts[Lib_黄色向上接地Node0_2ptslength-1] += 0;
- } else {
- Lib_黄色向上接地Node0_2compspts[0] -= 0;
- Lib_黄色向上接地Node0_2compspts[1] -= 0;
- Lib_黄色向上接地Node0_2compspts[Lib_黄色向上接地Node0_2ptslength-2] += 0;
- Lib_黄色向上接地Node0_2compspts[Lib_黄色向上接地Node0_2ptslength-1] += 0;
- }
- Lib_黄色向上接地Node0_2 = new ht.Node();
- Lib_黄色向上接地Node0_2.borderWidth = 1;
- Lib_黄色向上接地Node0_2rect.width = Lib_黄色向上接地Node0_2rect.width === 0 ? 0.0001 : Lib_黄色向上接地Node0_2rect.width;
- Lib_黄色向上接地Node0_2rect.height = Lib_黄色向上接地Node0_2rect.height === 0 ? 0.0001 : Lib_黄色向上接地Node0_2rect.height;
- var Lib_黄色向上接地Node0_2endCompspts = [Lib_黄色向上接地Node0_2compspts[Lib_黄色向上接地Node0_2ptslength-2],Lib_黄色向上接地Node0_2compspts[Lib_黄色向上接地Node0_2ptslength-1],0,0];
- var Lib_黄色向上接地Node0_2startCompspts = [Lib_黄色向上接地Node0_2compspts[0],Lib_黄色向上接地Node0_2compspts[1],0,0];
- Lib_黄色向上接地Node0_2.setImage(GD.getPolyLineJSON());
- Lib_黄色向上接地Node0_2.setPosition(Lib_黄色向上接地Node0_2rect.x+Lib_黄色向上接地Node0_2rect.width/2,Lib_黄色向上接地Node0_2rect.y+Lib_黄色向上接地Node0_2rect.height/2);
- Lib_黄色向上接地Node0_2.setSize(Lib_黄色向上接地Node0_2rect.width,Lib_黄色向上接地Node0_2rect.height);
- Lib_黄色向上接地Node0_2.setStyle("opacity",1);
- Lib_黄色向上接地Node0_2.s({'pixelPerfect':true});
- Lib_黄色向上接地Node0_2borderwidth=1;
- Lib_黄色向上接地Node0_2.setRotation(0);
- dataModel.add(Lib_黄色向上接地Node0_2);
- Lib_黄色向上接地Node0_2.a('node.points',Lib_黄色向上接地Node0_2compspts);
- Lib_黄色向上接地Node0_2.a('node.segments',[1,2]);
- Lib_黄色向上接地Node0_2.a('node.color','rgba(255,128,0,1)');
- Lib_黄色向上接地Node0_2.a('node.borderPattern',getDashStyle("@borderPattern@"));
- Lib_黄色向上接地Node0_2.a('node.borderColor','rgba(255,128,0,1)');
- Lib_黄色向上接地Node0_2.a('node.background','rgba(255,128,0,1)');
- Lib_黄色向上接地Node0_2.a('node.gradient','');
- Lib_黄色向上接地Node0_2.a('node.gradientcolor','rgba(255,128,0,1)');
- Lib_黄色向上接地Node0_2.a('node.endCompspts',Lib_黄色向上接地Node0_2endCompspts);
- Lib_黄色向上接地Node0_2.a('node.startCompspts',Lib_黄色向上接地Node0_2startCompspts);
- (function (node, img, compspts, endCompspts, startCompspts) {
- var position = node.getPosition(),
- w = node.getWidth()*_ratio.ratioX,
- h = node.getHeight()*_ratio.ratioY;
- function resetPoints(rx, ry) {
- for (var i = 0, len = compspts.length; i < len; i++) {
- if (i%2 === 0) {
- compspts[i]*=rx;
- } else {
- compspts[i]*=ry;
- }
- }
- endCompspts[0] = compspts[compspts.length-2];
- endCompspts[1] = compspts[compspts.length-1];
- endCompspts[2] *= rx;
- endCompspts[3] *= ry;
- node.a('node.offsetEndY', -(endCompspts[3]*0.5));
- node.a('node.offsetEndX', -(endCompspts[2]*0.5));
-
- startCompspts[0] = compspts[0];
- startCompspts[1] = compspts[1];
- startCompspts[2] *= rx;
- startCompspts[3] *= ry;
- node.a('node.offsetStartY', -(startCompspts[3]*0.5));
- node.a('node.offsetStartX', -(startCompspts[2]*0.5));
- node.a('node.endRotation', GD.calcRotationByStartAndEnd(compspts[i-4], compspts[i-3], compspts[i-2], compspts[i-1]));
- node.a('node.startRotation', GD.calcRotationByStartAndEnd(compspts[0], compspts[1], compspts[2], compspts[3]) + Math.PI);
- }
- node.setSize(w, h);
- node.setPosition(position.x * ratio.ratioX, position.y * ratio.ratioY);
- node.a('node.width', w);
- node.a('node.height', h);
- resetPoints(_ratio.ratioX, _ratio.ratioY);
- node.borderWidth = 1;
- node.a('node.borderwidth',node.borderWidth);
- node._nodename = 'Lib_黄色向上接地Node0_2';
- node._nodeType = 'line';
- zoomNodeList.push({
- node: node,
- attr: 'node.borderwidth'
- });
- var setWidth = node.setWidth,
- setHeight = node.setHeight,
- timer, rx = 1, ry = 1;
-
- node.setWidth = function (width) {
- var _width = this.getWidth();
- rx = width / _width;
- node.a('node.width', width);
- setWidth.apply(this, arguments);
- resetPoints(rx, 1);
- }
- node.setHeight = function (height) {
- var _height = this.getHeight();
- ry = height / _height;
- node.a('node.height', height);
- setHeight.apply(this, arguments);
- resetPoints(1, ry);
- }
- })(Lib_黄色向上接地Node0_2, Lib_黄色向上接地Node0_2.getImage(), Lib_黄色向上接地Node0_2compspts, Lib_黄色向上接地Node0_2endCompspts, Lib_黄色向上接地Node0_2startCompspts);
- var Lib_黄色向上接地Node0_3points=[7, 7,7, 0],
- Lib_黄色向上接地Node0_3rect=ht.Default.unionPoint([{x:7,y:7},{x:7,y:0}]),
- Lib_黄色向上接地Node0_3compspts=[];
- _ratio = GD.getRatioWithRotation(0, ratio);
- var _startratio = GD.getRatioWithRotation(1.5707963267949, ratio),
- _endratio = GD.getRatioWithRotation(4.71238898038469, ratio);
- for(var i=0;i<Lib_黄色向上接地Node0_3points.length;i++){
- if(i%2==0){
- Lib_黄色向上接地Node0_3compspts.push(Lib_黄色向上接地Node0_3points[i]-Lib_黄色向上接地Node0_3rect.x);
- }else{
- Lib_黄色向上接地Node0_3compspts.push(Lib_黄色向上接地Node0_3points[i]-Lib_黄色向上接地Node0_3rect.y);
- }
- }
- var Lib_黄色向上接地Node0_3ptslength=Lib_黄色向上接地Node0_3compspts.length;
- if (Lib_黄色向上接地Node0_3rect.height === 0) {
- Lib_黄色向上接地Node0_3compspts[0] -= 0;
- Lib_黄色向上接地Node0_3compspts[Lib_黄色向上接地Node0_3ptslength-2] += 0;
- } else if (Lib_黄色向上接地Node0_3rect.width === 0){
- Lib_黄色向上接地Node0_3compspts[1] -= 0;
- Lib_黄色向上接地Node0_3compspts[Lib_黄色向上接地Node0_3ptslength-1] += 0;
- } else {
- Lib_黄色向上接地Node0_3compspts[0] -= 0;
- Lib_黄色向上接地Node0_3compspts[1] -= 0;
- Lib_黄色向上接地Node0_3compspts[Lib_黄色向上接地Node0_3ptslength-2] += 0;
- Lib_黄色向上接地Node0_3compspts[Lib_黄色向上接地Node0_3ptslength-1] += 0;
- }
- Lib_黄色向上接地Node0_3 = new ht.Node();
- Lib_黄色向上接地Node0_3.borderWidth = 1;
- Lib_黄色向上接地Node0_3rect.width = Lib_黄色向上接地Node0_3rect.width === 0 ? 0.0001 : Lib_黄色向上接地Node0_3rect.width;
- Lib_黄色向上接地Node0_3rect.height = Lib_黄色向上接地Node0_3rect.height === 0 ? 0.0001 : Lib_黄色向上接地Node0_3rect.height;
- var Lib_黄色向上接地Node0_3endCompspts = [Lib_黄色向上接地Node0_3compspts[Lib_黄色向上接地Node0_3ptslength-2],Lib_黄色向上接地Node0_3compspts[Lib_黄色向上接地Node0_3ptslength-1],0,0];
- var Lib_黄色向上接地Node0_3startCompspts = [Lib_黄色向上接地Node0_3compspts[0],Lib_黄色向上接地Node0_3compspts[1],0,0];
- Lib_黄色向上接地Node0_3.setImage(GD.getPolyLineJSON());
- Lib_黄色向上接地Node0_3.setPosition(Lib_黄色向上接地Node0_3rect.x+Lib_黄色向上接地Node0_3rect.width/2,Lib_黄色向上接地Node0_3rect.y+Lib_黄色向上接地Node0_3rect.height/2);
- Lib_黄色向上接地Node0_3.setSize(Lib_黄色向上接地Node0_3rect.width,Lib_黄色向上接地Node0_3rect.height);
- Lib_黄色向上接地Node0_3.setStyle("opacity",1);
- Lib_黄色向上接地Node0_3.s({'pixelPerfect':true});
- Lib_黄色向上接地Node0_3borderwidth=1;
- Lib_黄色向上接地Node0_3.setRotation(0);
- dataModel.add(Lib_黄色向上接地Node0_3);
- Lib_黄色向上接地Node0_3.a('node.points',Lib_黄色向上接地Node0_3compspts);
- Lib_黄色向上接地Node0_3.a('node.segments',[1,2]);
- Lib_黄色向上接地Node0_3.a('node.color','rgba(255,128,0,1)');
- Lib_黄色向上接地Node0_3.a('node.borderPattern',getDashStyle("@borderPattern@"));
- Lib_黄色向上接地Node0_3.a('node.borderColor','rgba(255,128,0,1)');
- Lib_黄色向上接地Node0_3.a('node.background','rgba(255,128,0,1)');
- Lib_黄色向上接地Node0_3.a('node.gradient','');
- Lib_黄色向上接地Node0_3.a('node.gradientcolor','rgba(255,128,0,1)');
- Lib_黄色向上接地Node0_3.a('node.endCompspts',Lib_黄色向上接地Node0_3endCompspts);
- Lib_黄色向上接地Node0_3.a('node.startCompspts',Lib_黄色向上接地Node0_3startCompspts);
- (function (node, img, compspts, endCompspts, startCompspts) {
- var position = node.getPosition(),
- w = node.getWidth()*_ratio.ratioX,
- h = node.getHeight()*_ratio.ratioY;
- function resetPoints(rx, ry) {
- for (var i = 0, len = compspts.length; i < len; i++) {
- if (i%2 === 0) {
- compspts[i]*=rx;
- } else {
- compspts[i]*=ry;
- }
- }
- endCompspts[0] = compspts[compspts.length-2];
- endCompspts[1] = compspts[compspts.length-1];
- endCompspts[2] *= rx;
- endCompspts[3] *= ry;
- node.a('node.offsetEndY', -(endCompspts[3]*0.5));
- node.a('node.offsetEndX', -(endCompspts[2]*0.5));
-
- startCompspts[0] = compspts[0];
- startCompspts[1] = compspts[1];
- startCompspts[2] *= rx;
- startCompspts[3] *= ry;
- node.a('node.offsetStartY', -(startCompspts[3]*0.5));
- node.a('node.offsetStartX', -(startCompspts[2]*0.5));
- node.a('node.endRotation', GD.calcRotationByStartAndEnd(compspts[i-4], compspts[i-3], compspts[i-2], compspts[i-1]));
- node.a('node.startRotation', GD.calcRotationByStartAndEnd(compspts[0], compspts[1], compspts[2], compspts[3]) + Math.PI);
- }
- node.setSize(w, h);
- node.setPosition(position.x * ratio.ratioX, position.y * ratio.ratioY);
- node.a('node.width', w);
- node.a('node.height', h);
- resetPoints(_ratio.ratioX, _ratio.ratioY);
- node.borderWidth = 1;
- node.a('node.borderwidth',node.borderWidth);
- node._nodename = 'Lib_黄色向上接地Node0_3';
- node._nodeType = 'line';
- zoomNodeList.push({
- node: node,
- attr: 'node.borderwidth'
- });
- var setWidth = node.setWidth,
- setHeight = node.setHeight,
- timer, rx = 1, ry = 1;
-
- node.setWidth = function (width) {
- var _width = this.getWidth();
- rx = width / _width;
- node.a('node.width', width);
- setWidth.apply(this, arguments);
- resetPoints(rx, 1);
- }
- node.setHeight = function (height) {
- var _height = this.getHeight();
- ry = height / _height;
- node.a('node.height', height);
- setHeight.apply(this, arguments);
- resetPoints(1, ry);
- }
- })(Lib_黄色向上接地Node0_3, Lib_黄色向上接地Node0_3.getImage(), Lib_黄色向上接地Node0_3compspts, Lib_黄色向上接地Node0_3endCompspts, Lib_黄色向上接地Node0_3startCompspts);
- _ratio = GD.getRatioWithRotation(0*Math.PI/180, ratio);
- var Lib_黄色向上接地Node0boundtype = 'rect';
- var Lib_黄色向上接地Node0bound = new ht.Node(),
- Lib_黄色向上接地Node0boundBorderWidth = 0*2;
- if (Lib_黄色向上接地Node0boundtype === 'arc') {
- Lib_黄色向上接地Node0boundBorderWidth *= 0;
- }
- Lib_黄色向上接地Node0bound.setImage(GD.getRectJSON(15.05267*_ratio.ratioX, 13.66693*_ratio.ratioY, Lib_黄色向上接地Node0boundtype, '@arcFrom@', '@arcTo@', '@arcClose@'));
- Lib_黄色向上接地Node0bound.setPosition(7*ratio.ratioX, 7*ratio.ratioY);
- Lib_黄色向上接地Node0bound.setSize(15.05267*_ratio.ratioX, 13.66693*_ratio.ratioY);
- Lib_黄色向上接地Node0bound.s({
- 'pixelPerfect':true
- /*@AddPara@*/
- });
- Lib_黄色向上接地Node0bound.a('node.width', 15.05267*_ratio.ratioX);
- Lib_黄色向上接地Node0bound.a('node.height', 13.66693*_ratio.ratioY);
- Lib_黄色向上接地Node0bound.a('node.type', Lib_黄色向上接地Node0boundtype);
- Lib_黄色向上接地Node0bound.a('node.rect', [0, 0, 15.05267*_ratio.ratioX, 13.66693*_ratio.ratioY]);
- Lib_黄色向上接地Node0bound.a('node.background', 'rgba(255,255,255,0.003921569)');
- Lib_黄色向上接地Node0bound.a('node.gradientcolor', '');
- Lib_黄色向上接地Node0bound.a('node.gradient', '');
- Lib_黄色向上接地Node0bound.a('node.borderwidth', Lib_黄色向上接地Node0boundBorderWidth);
- Lib_黄色向上接地Node0bound.a('node.color', 'rgba(0,0,0,1)');
- Lib_黄色向上接地Node0bound.a('node.fillrect', [0,0,0,0]);
- Lib_黄色向上接地Node0bound.a('node.fillbackcolor', 'rgba(0,0,0,0)');
- Lib_黄色向上接地Node0bound.a('node.fillgradientcolor', 'rgba(0,0,0,0)');
- Lib_黄色向上接地Node0bound.a('node.fillgradient', '');
- if (Lib_黄色向上接地Node0boundtype !== 'rect') {
- Lib_黄色向上接地Node0bound.a('node.arcFrom', parseFloat('@arcFrom@'));
- Lib_黄色向上接地Node0bound.a('node.arcTo', parseFloat('@arcTo@'));
- Lib_黄色向上接地Node0bound.a('node.arcClose', '@arcClose@' === 'true' ? true : false);
- }
- if (Lib_黄色向上接地Node0boundtype === 'arc') {
- Lib_黄色向上接地Node0bound.a('node.arcOval', true);
- }
- Lib_黄色向上接地Node0bound.setRotation(0*Math.PI/180);
- Lib_黄色向上接地Node0bound.borderWidth = Lib_黄色向上接地Node0boundBorderWidth;
- Lib_黄色向上接地Node0bound.borderFillwidth = Lib_黄色向上接地Node0boundBorderWidth;
- dataModel.add(Lib_黄色向上接地Node0bound);
- Lib_黄色向上接地Node0bound._nodename = 'Lib_黄色向上接地Node0bound'
- Lib_黄色向上接地Node0bound._nodeType = 'rect';
- zoomNodeList.push({
- node: Lib_黄色向上接地Node0bound,
- attr: 'node.borderwidth'
- });
- (function (node, _img) {
- var setWidth = node.setWidth,
- setHeight = node.setHeight;
- node.setWidth = function (width) {
- if (width === this.getWidth()) return ;
- var height = this.getHeight();
- this.a('node.width', width);
- this.a('node.rect', [0,0,width, height]);
- setWidth.apply(this, arguments);
- }
- node.setHeight = function (height) {
- if (height === this.getHeight()) return ;
- var width = this.getWidth();
- this.a('node.height', height);
- this.a('node.rect', [0,0,width, height]);
- setHeight.apply(this, arguments);
- }
- })(Lib_黄色向上接地Node0bound, Lib_黄色向上接地Node0bound.getImage());
- /*@GraphList@*/
- GD.groupRotat(Lib_黄色向上接地Node0bound, Lib_黄色向上接地Node0_0, (180 )*Math.PI/180, ratio);
- GD.groupRotat(Lib_黄色向上接地Node0bound, Lib_黄色向上接地Node0_1, (180 )*Math.PI/180, ratio);
- GD.groupRotat(Lib_黄色向上接地Node0bound, Lib_黄色向上接地Node0_2, (180 )*Math.PI/180, ratio);
- GD.groupRotat(Lib_黄色向上接地Node0bound, Lib_黄色向上接地Node0_3, (180 )*Math.PI/180, ratio);
- /*@PageInit@*/
-
- var localVarObj = this.localVarObj;
- var localDynamicVarObj = this.localDynamicVar();
- this['Lib_黄色向上接地Node0_0'] = Lib_黄色向上接地Node0_0;
- Lib_黄色向上接地Node0_0.__parentLib = nodename;
- Lib_黄色向上接地Node0_0.__parent = this;
- this.childNodes.push(Lib_黄色向上接地Node0_0);
- this['Lib_黄色向上接地Node0_1'] = Lib_黄色向上接地Node0_1;
- Lib_黄色向上接地Node0_1.__parentLib = nodename;
- Lib_黄色向上接地Node0_1.__parent = this;
- this.childNodes.push(Lib_黄色向上接地Node0_1);
- this['Lib_黄色向上接地Node0_2'] = Lib_黄色向上接地Node0_2;
- Lib_黄色向上接地Node0_2.__parentLib = nodename;
- Lib_黄色向上接地Node0_2.__parent = this;
- this.childNodes.push(Lib_黄色向上接地Node0_2);
- this['Lib_黄色向上接地Node0_3'] = Lib_黄色向上接地Node0_3;
- Lib_黄色向上接地Node0_3.__parentLib = nodename;
- Lib_黄色向上接地Node0_3.__parent = this;
- this.childNodes.push(Lib_黄色向上接地Node0_3);
- this['Lib_黄色向上接地Node0bound'] = Lib_黄色向上接地Node0bound;
- Lib_黄色向上接地Node0bound.__parentLib = nodename;
- Lib_黄色向上接地Node0bound.__parent = this;
- this.childNodes.push(Lib_黄色向上接地Node0bound);
- /*@ControlContextMenu@*/
- /*@Declare@*/
- this.init(x, y, width, height, angle);
- };
- ht.Default.def('ht.lib.黄色向上接地', Object, {
- refresh10ms: function () {
-
- var localVarObj = this.localVarObj;
- var localDynamicVarObj = this.localDynamicVar();
- var Lib_黄色向上接地Node0_0= this.Lib_黄色向上接地Node0_0;
- var Lib_黄色向上接地Node0_1= this.Lib_黄色向上接地Node0_1;
- var Lib_黄色向上接地Node0_2= this.Lib_黄色向上接地Node0_2;
- var Lib_黄色向上接地Node0_3= this.Lib_黄色向上接地Node0_3;
- var Lib_黄色向上接地Node0bound= this.Lib_黄色向上接地Node0bound;
- /*@refresh10ms@*/
- },
- refresh100ms: function () {
-
- var localVarObj = this.localVarObj;
- var localDynamicVarObj = this.localDynamicVar();
- var Lib_黄色向上接地Node0_0= this.Lib_黄色向上接地Node0_0;
- var Lib_黄色向上接地Node0_1= this.Lib_黄色向上接地Node0_1;
- var Lib_黄色向上接地Node0_2= this.Lib_黄色向上接地Node0_2;
- var Lib_黄色向上接地Node0_3= this.Lib_黄色向上接地Node0_3;
- var Lib_黄色向上接地Node0bound= this.Lib_黄色向上接地Node0bound;
- /*@refresh100ms@*/
- },
- refresh500ms: function () {
-
- var localVarObj = this.localVarObj;
- var localDynamicVarObj = this.localDynamicVar();
- var Lib_黄色向上接地Node0_0= this.Lib_黄色向上接地Node0_0;
- var Lib_黄色向上接地Node0_1= this.Lib_黄色向上接地Node0_1;
- var Lib_黄色向上接地Node0_2= this.Lib_黄色向上接地Node0_2;
- var Lib_黄色向上接地Node0_3= this.Lib_黄色向上接地Node0_3;
- var Lib_黄色向上接地Node0bound= this.Lib_黄色向上接地Node0bound;
- /*@refresh500ms@*/
- },
- refresh1s: function () {
- var Counter1s = arguments[0] || 0;
-
- var localVarObj = this.localVarObj;
- var localDynamicVarObj = this.localDynamicVar();
- var Lib_黄色向上接地Node0_0= this.Lib_黄色向上接地Node0_0;
- var Lib_黄色向上接地Node0_1= this.Lib_黄色向上接地Node0_1;
- var Lib_黄色向上接地Node0_2= this.Lib_黄色向上接地Node0_2;
- var Lib_黄色向上接地Node0_3= this.Lib_黄色向上接地Node0_3;
- var Lib_黄色向上接地Node0bound= this.Lib_黄色向上接地Node0bound;
- /*@refresh1s@*/
- },
- refresh5s: function () {
-
- var localVarObj = this.localVarObj;
- var localDynamicVarObj = this.localDynamicVar();
- var Lib_黄色向上接地Node0_0= this.Lib_黄色向上接地Node0_0;
- var Lib_黄色向上接地Node0_1= this.Lib_黄色向上接地Node0_1;
- var Lib_黄色向上接地Node0_2= this.Lib_黄色向上接地Node0_2;
- var Lib_黄色向上接地Node0_3= this.Lib_黄色向上接地Node0_3;
- var Lib_黄色向上接地Node0bound= this.Lib_黄色向上接地Node0bound;
- /*@refresh5s@*/
- },
- /*@PageDynamic@*/
- onEvent: function (e, data, type, origin, offset, objMouseOn, ctm) {
-
- var localVarObj = this.localVarObj;
- var localDynamicVarObj = this.localDynamicVar();
- var Lib_黄色向上接地Node0_0= this.Lib_黄色向上接地Node0_0;
- var Lib_黄色向上接地Node0_1= this.Lib_黄色向上接地Node0_1;
- var Lib_黄色向上接地Node0_2= this.Lib_黄色向上接地Node0_2;
- var Lib_黄色向上接地Node0_3= this.Lib_黄色向上接地Node0_3;
- var Lib_黄色向上接地Node0bound= this.Lib_黄色向上接地Node0bound;
-
- if (type === 'click') {
- /*@EvnentClicked@*/
- } else if (type === 'mousedown') {
- mouseX=e.clientX;
- mouseY=e.clientY;
- /*@EvnentMouseDown@*/
- } else if (type === 'mouseup') {
- /*@EvnentMouseUp@*/
- } else if (type === 'mousemove') {
- var mouseX, mouseY, position, zoom;
- position=origin.getLogicalPoint(e);
- zoom = graphView.getZoom();
- if (origin === graphView) {
- mouseX= position.x + origin.tx();
- mouseY = position.y + origin.ty();
- } else {
- offset = offset || {x: 0, y: 0};
- mouseX = position.x / zoom + offset.x + origin.tx();
- mouseY = position.y / zoom + offset.y + origin.ty();
- }
- /*@EvnentMouseLeave@*/
- /*@EvnentMouseOver@*/
- } else if (type === 'keydown') {
- /*@EvnentKeyDown@*/
- } else if (type === 'contextmenu') {
- /*@Declare@*/
- /*@SetNodeContextMenu@*/
- /*@SetPageContextMenu@*/
- }
- /*@LibEvent@*/
- },
- getBaseClass: function () {
- return this._baseClass;
- },
- getWidth: function () {
- return this._width;
- },
- getHeight: function () {
- return this._height;
- },
- getSize: function () {
- return {
- width: this._width,
- height: this._height
- }
- },
- setWidth: function (width) {
- if (width === undefined || width === null || width != width) {
- return ;
- }
- var originWidth = this._width;
- var ratio = width / originWidth;
- var childNodes = this.childNodes, childNode, p, op = this.getPosition(), w, cw, ox, rotation = this.getRotation();
- for (var i = 0, len = childNodes.length; i < len; i++) {
- childNode = childNodes[i];
- p = childNode.getPosition();
- cw = childNode.getWidth();
- w = cw >=2 ? cw * ratio : cw;
- childNode.setWidth(w);
- ox = op.x + (p.x - op.x) * ratio;
- childNode.setPosition(ox, p.y);
- rotation = GD.calcRotation(rotation);
- if (rotation === 0 || rotation === Math.PI) {
- // 图元未旋转
- ox = op.x + (p.x - op.x)*ratio;
- childNode.setPosition(ox, p.y);
- } else if (rotation === 90 * Math.PI / 180) {
- // 图元旋转以后
- ox = op.y + (p.y - op.y)*ratio;
- childNode.setPosition(p.x, ox);
- }
- }
- this._width = width;
- this._originWidth = width;
- this._ratioX = ratio;
- return this;
- },
- setHeight: function (height) {
- if (height === undefined || height === null || height != height) {
- return ;
- }
- var originHeight = this._height;
- var ratio = height / originHeight;
- var childNodes = this.childNodes, childNode, p, op = this.getPosition(), h, ch, oy, rotation = this.getRotation();
- for (var i = 0, len = childNodes.length; i < len; i++) {
- childNode = childNodes[i];
- p = childNode.getPosition();
- ch = childNode.getHeight();
- h = ch >=2 ? ch * ratio : ch;
- childNode.setHeight(h);
-
- rotation = GD.calcRotation(rotation);
- if (rotation === 0 || rotation === Math.PI) {
- // 图元未旋转
- oy = op.y + (p.y - op.y)*ratio;
- childNode.setPosition(p.x, oy);
- } else if (rotation === 90 * Math.PI / 180) {
- // 图元旋转以后
- oy = op.x + (p.x - op.x)*ratio;
- childNode.setPosition(oy, p.y);
- }
- }
- this._height = height;
- this._originHeight = height;
- this._ratioY = ratio;
- return this;
- },
- setSize: function (size) {
- // var args = Array.prototype.slice.call(arguments, 0);
- // var height, width;
- // if (args.length === 0) {
- // return ;
- // }else if (args.length === 1) {
- // height = args[0].height;
- // width = args[0].width;
- // } else {
- // width = args[0];
- // height = args[1];
- // }
- // var wh = GD.getRatioWithRotation(angle, wid)
- // this.setHeight(height);
- // this.setWidth(width);
- // return this;
- var args = Array.prototype.slice.call(arguments, 0);
- var height, width;
- if (args.length === 0) {
- return ;
- }else if (args.length === 1) {
- height = args[0].height;
- width = args[0].width;
- angle = 0;
- } else if (args.length === 2) {
- if (typeof args[0] === 'object') {
- width = args[0].width;
- height = args[0].height;
- angle = args[1] || 0;
- } else {
- width = args[0];
- height = args[1];
- angle = 0;
- }
- } else if (args.length === 3) {
- width = args[0];
- height = args[1];
- angle = args[2] || 0;
- }
- var wh = GD.getRatioWithRotation(0, width, height);
- this.setHeight(wh.ratioY);
- this.setWidth(wh.ratioX);
- return this;
- },
- getPosition: function () {
- return {
- x: this._x,
- y: this._y
- }
- },
- setPosition: function () {
- var args = Array.prototype.slice.call(arguments, 0), x, y;
- if (args.length === 0) {
- return this;
- } else if (args.length === 1) {
- if (typeof args[0] != 'object') {
- return this;
- }
- x = args[0].x;
- y = args[0].y;
- } else {
- x = args[0];
- y = args[1];
- }
- if ((x !== 0 && !x) || (y !== 0 && !y)) {
- return this;
- }
- // var childNodes = this.childNodes, offset, childNode, p;
- // for (var i = 0, len = childNodes.length; i < len; i++) {
- // childNode = childNodes[i];
- // p = childNode.getPosition();
- // childNode.setPosition(x - (this._x-p.x)*this._ratioX, y - (this._y-p.y)*this._ratioY);
- // }
- // this._x = x;
- // this._y = y;
- // return this;
- var childNodes, childNode, background, offset = {}, op, cp;
- childNodes = this.childNodes;
- background = this._background;
- op = background.getPosition();
- offset.x = x - op.x;
- offset.y = y - op.y;
- for (var i = 0, len = childNodes.length; i < len; i++) {
- childNode = childNodes[i];
- cp = childNode.getPosition();
- childNode.setPosition(cp.x + offset.x, cp.y + offset.y);
- }
- this._x = x;
- this._y = y;
- this._position = {x: x, y: y};
- return this;
- },
- getStyle: function (key) {
- if (!key) {
- return undefined;
- }
- return this._styleObject[key];
- },
- setStyle: function (key, value, force) {
- var childNodes = this.childNodes, childNode;
-
- for (var i = 0, len = childNodes.length; i < len; i++) {
- childNode = childNodes[i];
- if (key === '2d.visible') {
- if (value === graphView.isVisible(childNode)) {
- continue;
- }
- if (!value) {
- childNode._savedIsVisible = graphView.isVisible(childNode);
- childNode.s({
- '2d.visible': false
- })
- } else {
- childNode.s({
- '2d.visible': childNode._savedIsVisible
- })
- }
- continue;
- }
- childNode.s({
- key: value
- });
- }
- this._styleObject[key] = value;
- return this;
- },
- calcSize: function () {
- var background = this._background;
- var position = background.getPosition(),
- width = background.getWidth(),
- height = background.getHeight();
- this._width = width;
- this._height = height;
- this._x = position.x;
- this._y = position.y;
- this._position = {
- x: this._x,
- y: this._y
- }
- return this;
- return this;
- },
- s: function (styleObj, force) {
- var args = Array.prototype.slice.call(arguments, 0);
- var styleObj;
- if (args.length === 0) {
- return this;
- } else if (args.length === 1) {
- styleObj = args[0];
- } else {
- this.setStyle(args[0], args[1]);
- return this;
- }
- for (var key in styleObj) {
- if (!styleObj.hasOwnProperty(key)) {
- continue;
- }
- this.setStyle(key, styleObj[key], force);
- }
- return this;
- },
- init: function (x, y, width, height, angle) {
- var that = this;
- this.calcSize();
- (function (width, height, angle) {
- // that.setSize(width, height, angle);
- // var wh = GD.getRatioWithRotation(angle, width, height);
- // width = wh.ratioX;
- // height = wh.ratioY;
- var originHeight = that._height;
- var originWidth = that._width;
- var ratioY = height / originHeight;
- var ratioX = width / originWidth;
- var childNodes = that.childNodes,
- childNode,p, op = that.getPosition(), h, ch, oy, w, cw, ox, name, borderRatio, borderWidth;
- for (var i = 0, len = childNodes.length; i < len; i++) {
- childNode = childNodes[i];
- p = childNode.getPosition();
- childNode.originHeight = childNode.originHeight || childNode.getHeight();
- ch = childNode.getHeight();
- cw = childNode.getWidth();
-
- if (ch > 2) {
- h = ch * ratioY;
- childNode.setHeight(h);
- }
- if (cw > 2) {
- w = cw * ratioX;
- childNode.setWidth(w);
- }
- borderRatio = (ratioX + ratioY)*0.5;
- if (childNode._nodeType === 'line') { // 如果是线,
- if (childNode.getWidth() > childNode.getHeight()) {
- borderRatio = ratioX;
- } else {
- borderRatio = ratioY;
- }
- }
- name = childNode._nodename;
- // if (childNode.borderWidth && name && ch > 2 && cw > 2) {
- // borderWidth = childNode.borderWidth / borderRatio;
- // if (borderWidth > ch*0.5 || borderWidth > cw *0.5) {
- // // borderWidth = childNode.borderWidth;
- // }
- // childNode.borderWidth = borderWidth;
- // childNode.a(name + '.borderwidth', borderWidth);
- // }
- }
- that._height = height;
- that._originHeight = height;
- that._ratioY = ratioY;
- that._width = width;
- that._originWidth = width;
- that._ratioX = ratioX;
- })(width, height, angle);
- that._x = width / 2;
- that._y = height / 2;
- that._rotation = 0;
- // that.setPosition(x, y);
- (function (x, y) {
- var childNodes = that.childNodes, offset, childNode;
- var w2 = that.getWidth() / 2, h2 = that.getHeight()/2;
- for (var i = 0, len = childNodes.length; i < len; i++) {
- childNode = childNodes[i];
- offset = childNode.getPosition();
- childNode.setPosition(x + offset.x * that._ratioX - w2, y + offset.y * that._ratioY - h2);
- }
- that._x = x;
- that._y = y;
- })(x, y);
- // setTimeout(that.addEVent, 1000);
- },
- setRotation: function (angle) {
- var that = this, _angle = that.getRotation();
- if (angle!==0 && !angle || angle === _angle) {
- return this;
- }
- var childNodes = this.childNodes, childNode, p = this.getPosition(), px = p.x, py = p.y;
- for (var i = 0, len = childNodes.length; i < len; i++) {
- childNode = childNodes[i];
- var x = childNode.getPosition().x - px;
- var y = childNode.getPosition().y - py;
- childNode.setPosition(Math.cos(angle-_angle) * x - Math.sin(angle-_angle) * y + px, Math.cos(angle-_angle) * y + Math.sin(angle-_angle) * x + py);
- childNode.setRotation(angle);
- }
- this._rotation = angle;
- return this;
- },
- getRotation: function () {
- return this._rotation;
- },
- setScale: function (sx, sy) {
- var that = this,
- childNodes = this.childNodes,
- childNode;
- if (sx === undefined || sx === null) return ;
- if (sy === undefined || sy === null) {
- sy = sx;
- }
- for (var i = 0, len = childNodes.length; i < len; i++) {
- childNode = childNodes[i];
- if (typeof childNode.setScale === 'function') {
- childNode.setScale(sx, sy);
- }
- }
- },
- getScale: function () {
- return this._background.getScale();
- },
- setScaleX: function (sx) {
- if (sx === undefined || sx === null) return;
- var that = this,
- childNodes = this.childNodes,
- childNode;
- for (var i = 0, len = childNodes.length; i < len; i++) {
- childNode = childNodes[i];
- if (typeof childNode.setScaleX === 'function') {
- childNode.setScaleX(sx);
- }
- }
- },
- setScaleY: function (sy) {
- if (sy === undefined || sy === null) return;
- var that = this,
- childNodes = this.childNodes,
- childNode;
- for (var i = 0, len = childNodes.length; i < len; i++) {
- childNode = childNodes[i];
- if (typeof childNode.setScaleY === 'function') {
- childNode.setScaleY(sy);
- }
- }
- },
- getScaleX: function () {
- return this._background.getScaleX();
- },
- getScaleY: function () {
- return this._background.getScaleY();
- },
- evert: function () {
- var that = this,
- childNodes = this.childNodes,
- background = this._background,
- bp = background.getPosition(),
- bx = bp.x,
- by = bp.y,
- childNode, distanceX, distanceY, x, y, p, nx, ny;
-
- for (var i = 0, len = childNodes.length; i < len; i++) {
- childNode = childNodes[i];
- p = childNode.getPosition();
- x = p.x;
- y = p.y;
- distanceX = bx - x;
- distanceY = by - y;
- nx = bx + distanceX;
- ny = by + distanceY;
- childNode.setPosition(nx, ny);
- if (typeof childNode.setScale === 'function') {
- if (!(childNode._disallowEvert === true))
- childNode.setScale(-1, -1);
- }
- }
- },
- evertX: function () {
- var that = this,
- childNodes = this.childNodes,
- background = this._background,
- bx = background.getPosition().x,
- childNode, distance, x, p, nx;
-
- for (var i = 0, len = childNodes.length; i < len; i++) {
- childNode = childNodes[i];
- p = childNode.getPosition();
- x = p.x;
- distance = bx - x;
- nx = bx + distance;
- childNode.setPosition(nx, p.y);
- if (typeof childNode.setScaleX === 'function') {
- if (!(childNode._disallowEvert === true))
- childNode.setScaleX(-1);
- }
- }
- },
- evertY: function () {
- var that = this,
- childNodes = this.childNodes,
- background = this._background,
- by = background.getPosition().y,
- childNode, distance, y, p, ny;
-
- for (var i = 0, len = childNodes.length; i < len; i++) {
- childNode = childNodes[i];
- p = childNode.getPosition();
- y = p.y;
- distance = by - y;
- ny = by + distance;
- childNode.setPosition(p.x, ny);
- if (typeof childNode.setScaleY === 'function') {
- if (!(childNode._disallowEvert === true))
- childNode.setScaleY(-1);
- }
- }
- },
- attr: function (key, value) {
- var _attrObj = this._attrObj || {};
- if (arguments.length === 1) {
- return _attrObj[key];
- }
- var childNodes = this.childNodes, childNode;
- _attrObj[key] = value;
- for (var i = 0; childNode = childNodes[i++];) {
- if (typeof childNode.a === 'function') {
- childNode.a(key, value);
- }
- }
- },
- a: function () {
- return this.attr.apply(this, arguments);
- }
- });
- }
|