黄色向上接地.js 52 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182
  1. ht.lib = ht.lib || {};
  2. if (!ht.lib['黄色向上接地']) {
  3. ht.lib['黄色向上接地'] = function (x, y, width, height, angle, localVarObj, localDynamicVar, nodename) {
  4. _ratio = GD.getRatioWithRotation(0, ratio);
  5. ht.lib['黄色向上接地'].superClass.constructor.apply(this);
  6. this.localVarObj = localVarObj;
  7. this.localDynamicVar = localDynamicVar;
  8. this.childNodes = [];
  9. this._styleObject = {};
  10. this._originWidth = 16*_ratio.ratioX;
  11. this._originHeight = 14*_ratio.ratioY;
  12. this._baseClass = "ht.lib.黄色向上接地";
  13. this._background = new ht.Node();
  14. this._background.setWidth(this._originWidth);
  15. this._background.setHeight(this._originHeight);
  16. this._background.setPosition(this._originWidth/2, this._originHeight/2);
  17. this._background.setImage({
  18. width: width,
  19. height: height,
  20. clip: true,
  21. comps: [
  22. {
  23. type: 'rect',
  24. background: 'rgba(0,255,0,0)',
  25. rect: [0,0,width, height]
  26. }
  27. ]
  28. });
  29. this._background.__parentLib = nodename;
  30. this._background.isLibBackground = true;
  31. this.childNodes.push(this._background);
  32. dataModel.add(this._background);
  33. /*@PageBackgroundInit@*/
  34. /*@PageBeforeInit@*/
  35. var Lib_黄色向上接地Node0_0points=[4, 13,10, 13],
  36. Lib_黄色向上接地Node0_0rect=ht.Default.unionPoint([{x:4,y:13},{x:10,y:13}]),
  37. Lib_黄色向上接地Node0_0compspts=[];
  38. _ratio = GD.getRatioWithRotation(0, ratio);
  39. var _startratio = GD.getRatioWithRotation(3.14159265358979, ratio),
  40. _endratio = GD.getRatioWithRotation(0, ratio);
  41. for(var i=0;i<Lib_黄色向上接地Node0_0points.length;i++){
  42. if(i%2==0){
  43. Lib_黄色向上接地Node0_0compspts.push(Lib_黄色向上接地Node0_0points[i]-Lib_黄色向上接地Node0_0rect.x);
  44. }else{
  45. Lib_黄色向上接地Node0_0compspts.push(Lib_黄色向上接地Node0_0points[i]-Lib_黄色向上接地Node0_0rect.y);
  46. }
  47. }
  48. var Lib_黄色向上接地Node0_0ptslength=Lib_黄色向上接地Node0_0compspts.length;
  49. if (Lib_黄色向上接地Node0_0rect.height === 0) {
  50. Lib_黄色向上接地Node0_0compspts[0] -= 0;
  51. Lib_黄色向上接地Node0_0compspts[Lib_黄色向上接地Node0_0ptslength-2] += 0;
  52. } else if (Lib_黄色向上接地Node0_0rect.width === 0){
  53. Lib_黄色向上接地Node0_0compspts[1] -= 0;
  54. Lib_黄色向上接地Node0_0compspts[Lib_黄色向上接地Node0_0ptslength-1] += 0;
  55. } else {
  56. Lib_黄色向上接地Node0_0compspts[0] -= 0;
  57. Lib_黄色向上接地Node0_0compspts[1] -= 0;
  58. Lib_黄色向上接地Node0_0compspts[Lib_黄色向上接地Node0_0ptslength-2] += 0;
  59. Lib_黄色向上接地Node0_0compspts[Lib_黄色向上接地Node0_0ptslength-1] += 0;
  60. }
  61. Lib_黄色向上接地Node0_0 = new ht.Node();
  62. Lib_黄色向上接地Node0_0.borderWidth = 1;
  63. Lib_黄色向上接地Node0_0rect.width = Lib_黄色向上接地Node0_0rect.width === 0 ? 0.0001 : Lib_黄色向上接地Node0_0rect.width;
  64. Lib_黄色向上接地Node0_0rect.height = Lib_黄色向上接地Node0_0rect.height === 0 ? 0.0001 : Lib_黄色向上接地Node0_0rect.height;
  65. var Lib_黄色向上接地Node0_0endCompspts = [Lib_黄色向上接地Node0_0compspts[Lib_黄色向上接地Node0_0ptslength-2],Lib_黄色向上接地Node0_0compspts[Lib_黄色向上接地Node0_0ptslength-1],0,0];
  66. var Lib_黄色向上接地Node0_0startCompspts = [Lib_黄色向上接地Node0_0compspts[0],Lib_黄色向上接地Node0_0compspts[1],0,0];
  67. Lib_黄色向上接地Node0_0.setImage(GD.getPolyLineJSON());
  68. Lib_黄色向上接地Node0_0.setPosition(Lib_黄色向上接地Node0_0rect.x+Lib_黄色向上接地Node0_0rect.width/2,Lib_黄色向上接地Node0_0rect.y+Lib_黄色向上接地Node0_0rect.height/2);
  69. Lib_黄色向上接地Node0_0.setSize(Lib_黄色向上接地Node0_0rect.width,Lib_黄色向上接地Node0_0rect.height);
  70. Lib_黄色向上接地Node0_0.setStyle("opacity",1);
  71. Lib_黄色向上接地Node0_0.s({'pixelPerfect':true});
  72. Lib_黄色向上接地Node0_0borderwidth=1;
  73. Lib_黄色向上接地Node0_0.setRotation(0);
  74. dataModel.add(Lib_黄色向上接地Node0_0);
  75. Lib_黄色向上接地Node0_0.a('node.points',Lib_黄色向上接地Node0_0compspts);
  76. Lib_黄色向上接地Node0_0.a('node.segments',[1,2]);
  77. Lib_黄色向上接地Node0_0.a('node.color','rgba(255,128,0,1)');
  78. Lib_黄色向上接地Node0_0.a('node.borderPattern',getDashStyle("@borderPattern@"));
  79. Lib_黄色向上接地Node0_0.a('node.borderColor','rgba(255,128,0,1)');
  80. Lib_黄色向上接地Node0_0.a('node.background','rgba(255,128,0,1)');
  81. Lib_黄色向上接地Node0_0.a('node.gradient','');
  82. Lib_黄色向上接地Node0_0.a('node.gradientcolor','rgba(255,128,0,1)');
  83. Lib_黄色向上接地Node0_0.a('node.endCompspts',Lib_黄色向上接地Node0_0endCompspts);
  84. Lib_黄色向上接地Node0_0.a('node.startCompspts',Lib_黄色向上接地Node0_0startCompspts);
  85. (function (node, img, compspts, endCompspts, startCompspts) {
  86. var position = node.getPosition(),
  87. w = node.getWidth()*_ratio.ratioX,
  88. h = node.getHeight()*_ratio.ratioY;
  89. function resetPoints(rx, ry) {
  90. for (var i = 0, len = compspts.length; i < len; i++) {
  91. if (i%2 === 0) {
  92. compspts[i]*=rx;
  93. } else {
  94. compspts[i]*=ry;
  95. }
  96. }
  97. endCompspts[0] = compspts[compspts.length-2];
  98. endCompspts[1] = compspts[compspts.length-1];
  99. endCompspts[2] *= rx;
  100. endCompspts[3] *= ry;
  101. node.a('node.offsetEndY', -(endCompspts[3]*0.5));
  102. node.a('node.offsetEndX', -(endCompspts[2]*0.5));
  103. startCompspts[0] = compspts[0];
  104. startCompspts[1] = compspts[1];
  105. startCompspts[2] *= rx;
  106. startCompspts[3] *= ry;
  107. node.a('node.offsetStartY', -(startCompspts[3]*0.5));
  108. node.a('node.offsetStartX', -(startCompspts[2]*0.5));
  109. node.a('node.endRotation', GD.calcRotationByStartAndEnd(compspts[i-4], compspts[i-3], compspts[i-2], compspts[i-1]));
  110. node.a('node.startRotation', GD.calcRotationByStartAndEnd(compspts[0], compspts[1], compspts[2], compspts[3]) + Math.PI);
  111. }
  112. node.setSize(w, h);
  113. node.setPosition(position.x * ratio.ratioX, position.y * ratio.ratioY);
  114. node.a('node.width', w);
  115. node.a('node.height', h);
  116. resetPoints(_ratio.ratioX, _ratio.ratioY);
  117. node.borderWidth = 1;
  118. node.a('node.borderwidth',node.borderWidth);
  119. node._nodename = 'Lib_黄色向上接地Node0_0';
  120. node._nodeType = 'line';
  121. zoomNodeList.push({
  122. node: node,
  123. attr: 'node.borderwidth'
  124. });
  125. var setWidth = node.setWidth,
  126. setHeight = node.setHeight,
  127. timer, rx = 1, ry = 1;
  128. node.setWidth = function (width) {
  129. var _width = this.getWidth();
  130. rx = width / _width;
  131. node.a('node.width', width);
  132. setWidth.apply(this, arguments);
  133. resetPoints(rx, 1);
  134. }
  135. node.setHeight = function (height) {
  136. var _height = this.getHeight();
  137. ry = height / _height;
  138. node.a('node.height', height);
  139. setHeight.apply(this, arguments);
  140. resetPoints(1, ry);
  141. }
  142. })(Lib_黄色向上接地Node0_0, Lib_黄色向上接地Node0_0.getImage(), Lib_黄色向上接地Node0_0compspts, Lib_黄色向上接地Node0_0endCompspts, Lib_黄色向上接地Node0_0startCompspts);
  143. var Lib_黄色向上接地Node0_1points=[2, 10,12, 10],
  144. Lib_黄色向上接地Node0_1rect=ht.Default.unionPoint([{x:2,y:10},{x:12,y:10}]),
  145. Lib_黄色向上接地Node0_1compspts=[];
  146. _ratio = GD.getRatioWithRotation(0, ratio);
  147. var _startratio = GD.getRatioWithRotation(3.14159265358979, ratio),
  148. _endratio = GD.getRatioWithRotation(0, ratio);
  149. for(var i=0;i<Lib_黄色向上接地Node0_1points.length;i++){
  150. if(i%2==0){
  151. Lib_黄色向上接地Node0_1compspts.push(Lib_黄色向上接地Node0_1points[i]-Lib_黄色向上接地Node0_1rect.x);
  152. }else{
  153. Lib_黄色向上接地Node0_1compspts.push(Lib_黄色向上接地Node0_1points[i]-Lib_黄色向上接地Node0_1rect.y);
  154. }
  155. }
  156. var Lib_黄色向上接地Node0_1ptslength=Lib_黄色向上接地Node0_1compspts.length;
  157. if (Lib_黄色向上接地Node0_1rect.height === 0) {
  158. Lib_黄色向上接地Node0_1compspts[0] -= 0;
  159. Lib_黄色向上接地Node0_1compspts[Lib_黄色向上接地Node0_1ptslength-2] += 0;
  160. } else if (Lib_黄色向上接地Node0_1rect.width === 0){
  161. Lib_黄色向上接地Node0_1compspts[1] -= 0;
  162. Lib_黄色向上接地Node0_1compspts[Lib_黄色向上接地Node0_1ptslength-1] += 0;
  163. } else {
  164. Lib_黄色向上接地Node0_1compspts[0] -= 0;
  165. Lib_黄色向上接地Node0_1compspts[1] -= 0;
  166. Lib_黄色向上接地Node0_1compspts[Lib_黄色向上接地Node0_1ptslength-2] += 0;
  167. Lib_黄色向上接地Node0_1compspts[Lib_黄色向上接地Node0_1ptslength-1] += 0;
  168. }
  169. Lib_黄色向上接地Node0_1 = new ht.Node();
  170. Lib_黄色向上接地Node0_1.borderWidth = 1;
  171. Lib_黄色向上接地Node0_1rect.width = Lib_黄色向上接地Node0_1rect.width === 0 ? 0.0001 : Lib_黄色向上接地Node0_1rect.width;
  172. Lib_黄色向上接地Node0_1rect.height = Lib_黄色向上接地Node0_1rect.height === 0 ? 0.0001 : Lib_黄色向上接地Node0_1rect.height;
  173. var Lib_黄色向上接地Node0_1endCompspts = [Lib_黄色向上接地Node0_1compspts[Lib_黄色向上接地Node0_1ptslength-2],Lib_黄色向上接地Node0_1compspts[Lib_黄色向上接地Node0_1ptslength-1],0,0];
  174. var Lib_黄色向上接地Node0_1startCompspts = [Lib_黄色向上接地Node0_1compspts[0],Lib_黄色向上接地Node0_1compspts[1],0,0];
  175. Lib_黄色向上接地Node0_1.setImage(GD.getPolyLineJSON());
  176. Lib_黄色向上接地Node0_1.setPosition(Lib_黄色向上接地Node0_1rect.x+Lib_黄色向上接地Node0_1rect.width/2,Lib_黄色向上接地Node0_1rect.y+Lib_黄色向上接地Node0_1rect.height/2);
  177. Lib_黄色向上接地Node0_1.setSize(Lib_黄色向上接地Node0_1rect.width,Lib_黄色向上接地Node0_1rect.height);
  178. Lib_黄色向上接地Node0_1.setStyle("opacity",1);
  179. Lib_黄色向上接地Node0_1.s({'pixelPerfect':true});
  180. Lib_黄色向上接地Node0_1borderwidth=1;
  181. Lib_黄色向上接地Node0_1.setRotation(0);
  182. dataModel.add(Lib_黄色向上接地Node0_1);
  183. Lib_黄色向上接地Node0_1.a('node.points',Lib_黄色向上接地Node0_1compspts);
  184. Lib_黄色向上接地Node0_1.a('node.segments',[1,2]);
  185. Lib_黄色向上接地Node0_1.a('node.color','rgba(255,128,0,1)');
  186. Lib_黄色向上接地Node0_1.a('node.borderPattern',getDashStyle("@borderPattern@"));
  187. Lib_黄色向上接地Node0_1.a('node.borderColor','rgba(255,128,0,1)');
  188. Lib_黄色向上接地Node0_1.a('node.background','rgba(255,128,0,1)');
  189. Lib_黄色向上接地Node0_1.a('node.gradient','');
  190. Lib_黄色向上接地Node0_1.a('node.gradientcolor','rgba(255,128,0,1)');
  191. Lib_黄色向上接地Node0_1.a('node.endCompspts',Lib_黄色向上接地Node0_1endCompspts);
  192. Lib_黄色向上接地Node0_1.a('node.startCompspts',Lib_黄色向上接地Node0_1startCompspts);
  193. (function (node, img, compspts, endCompspts, startCompspts) {
  194. var position = node.getPosition(),
  195. w = node.getWidth()*_ratio.ratioX,
  196. h = node.getHeight()*_ratio.ratioY;
  197. function resetPoints(rx, ry) {
  198. for (var i = 0, len = compspts.length; i < len; i++) {
  199. if (i%2 === 0) {
  200. compspts[i]*=rx;
  201. } else {
  202. compspts[i]*=ry;
  203. }
  204. }
  205. endCompspts[0] = compspts[compspts.length-2];
  206. endCompspts[1] = compspts[compspts.length-1];
  207. endCompspts[2] *= rx;
  208. endCompspts[3] *= ry;
  209. node.a('node.offsetEndY', -(endCompspts[3]*0.5));
  210. node.a('node.offsetEndX', -(endCompspts[2]*0.5));
  211. startCompspts[0] = compspts[0];
  212. startCompspts[1] = compspts[1];
  213. startCompspts[2] *= rx;
  214. startCompspts[3] *= ry;
  215. node.a('node.offsetStartY', -(startCompspts[3]*0.5));
  216. node.a('node.offsetStartX', -(startCompspts[2]*0.5));
  217. node.a('node.endRotation', GD.calcRotationByStartAndEnd(compspts[i-4], compspts[i-3], compspts[i-2], compspts[i-1]));
  218. node.a('node.startRotation', GD.calcRotationByStartAndEnd(compspts[0], compspts[1], compspts[2], compspts[3]) + Math.PI);
  219. }
  220. node.setSize(w, h);
  221. node.setPosition(position.x * ratio.ratioX, position.y * ratio.ratioY);
  222. node.a('node.width', w);
  223. node.a('node.height', h);
  224. resetPoints(_ratio.ratioX, _ratio.ratioY);
  225. node.borderWidth = 1;
  226. node.a('node.borderwidth',node.borderWidth);
  227. node._nodename = 'Lib_黄色向上接地Node0_1';
  228. node._nodeType = 'line';
  229. zoomNodeList.push({
  230. node: node,
  231. attr: 'node.borderwidth'
  232. });
  233. var setWidth = node.setWidth,
  234. setHeight = node.setHeight,
  235. timer, rx = 1, ry = 1;
  236. node.setWidth = function (width) {
  237. var _width = this.getWidth();
  238. rx = width / _width;
  239. node.a('node.width', width);
  240. setWidth.apply(this, arguments);
  241. resetPoints(rx, 1);
  242. }
  243. node.setHeight = function (height) {
  244. var _height = this.getHeight();
  245. ry = height / _height;
  246. node.a('node.height', height);
  247. setHeight.apply(this, arguments);
  248. resetPoints(1, ry);
  249. }
  250. })(Lib_黄色向上接地Node0_1, Lib_黄色向上接地Node0_1.getImage(), Lib_黄色向上接地Node0_1compspts, Lib_黄色向上接地Node0_1endCompspts, Lib_黄色向上接地Node0_1startCompspts);
  251. var Lib_黄色向上接地Node0_2points=[0, 7,15, 7],
  252. Lib_黄色向上接地Node0_2rect=ht.Default.unionPoint([{x:0,y:7},{x:15,y:7}]),
  253. Lib_黄色向上接地Node0_2compspts=[];
  254. _ratio = GD.getRatioWithRotation(0, ratio);
  255. var _startratio = GD.getRatioWithRotation(3.14159265358979, ratio),
  256. _endratio = GD.getRatioWithRotation(0, ratio);
  257. for(var i=0;i<Lib_黄色向上接地Node0_2points.length;i++){
  258. if(i%2==0){
  259. Lib_黄色向上接地Node0_2compspts.push(Lib_黄色向上接地Node0_2points[i]-Lib_黄色向上接地Node0_2rect.x);
  260. }else{
  261. Lib_黄色向上接地Node0_2compspts.push(Lib_黄色向上接地Node0_2points[i]-Lib_黄色向上接地Node0_2rect.y);
  262. }
  263. }
  264. var Lib_黄色向上接地Node0_2ptslength=Lib_黄色向上接地Node0_2compspts.length;
  265. if (Lib_黄色向上接地Node0_2rect.height === 0) {
  266. Lib_黄色向上接地Node0_2compspts[0] -= 0;
  267. Lib_黄色向上接地Node0_2compspts[Lib_黄色向上接地Node0_2ptslength-2] += 0;
  268. } else if (Lib_黄色向上接地Node0_2rect.width === 0){
  269. Lib_黄色向上接地Node0_2compspts[1] -= 0;
  270. Lib_黄色向上接地Node0_2compspts[Lib_黄色向上接地Node0_2ptslength-1] += 0;
  271. } else {
  272. Lib_黄色向上接地Node0_2compspts[0] -= 0;
  273. Lib_黄色向上接地Node0_2compspts[1] -= 0;
  274. Lib_黄色向上接地Node0_2compspts[Lib_黄色向上接地Node0_2ptslength-2] += 0;
  275. Lib_黄色向上接地Node0_2compspts[Lib_黄色向上接地Node0_2ptslength-1] += 0;
  276. }
  277. Lib_黄色向上接地Node0_2 = new ht.Node();
  278. Lib_黄色向上接地Node0_2.borderWidth = 1;
  279. Lib_黄色向上接地Node0_2rect.width = Lib_黄色向上接地Node0_2rect.width === 0 ? 0.0001 : Lib_黄色向上接地Node0_2rect.width;
  280. Lib_黄色向上接地Node0_2rect.height = Lib_黄色向上接地Node0_2rect.height === 0 ? 0.0001 : Lib_黄色向上接地Node0_2rect.height;
  281. var Lib_黄色向上接地Node0_2endCompspts = [Lib_黄色向上接地Node0_2compspts[Lib_黄色向上接地Node0_2ptslength-2],Lib_黄色向上接地Node0_2compspts[Lib_黄色向上接地Node0_2ptslength-1],0,0];
  282. var Lib_黄色向上接地Node0_2startCompspts = [Lib_黄色向上接地Node0_2compspts[0],Lib_黄色向上接地Node0_2compspts[1],0,0];
  283. Lib_黄色向上接地Node0_2.setImage(GD.getPolyLineJSON());
  284. Lib_黄色向上接地Node0_2.setPosition(Lib_黄色向上接地Node0_2rect.x+Lib_黄色向上接地Node0_2rect.width/2,Lib_黄色向上接地Node0_2rect.y+Lib_黄色向上接地Node0_2rect.height/2);
  285. Lib_黄色向上接地Node0_2.setSize(Lib_黄色向上接地Node0_2rect.width,Lib_黄色向上接地Node0_2rect.height);
  286. Lib_黄色向上接地Node0_2.setStyle("opacity",1);
  287. Lib_黄色向上接地Node0_2.s({'pixelPerfect':true});
  288. Lib_黄色向上接地Node0_2borderwidth=1;
  289. Lib_黄色向上接地Node0_2.setRotation(0);
  290. dataModel.add(Lib_黄色向上接地Node0_2);
  291. Lib_黄色向上接地Node0_2.a('node.points',Lib_黄色向上接地Node0_2compspts);
  292. Lib_黄色向上接地Node0_2.a('node.segments',[1,2]);
  293. Lib_黄色向上接地Node0_2.a('node.color','rgba(255,128,0,1)');
  294. Lib_黄色向上接地Node0_2.a('node.borderPattern',getDashStyle("@borderPattern@"));
  295. Lib_黄色向上接地Node0_2.a('node.borderColor','rgba(255,128,0,1)');
  296. Lib_黄色向上接地Node0_2.a('node.background','rgba(255,128,0,1)');
  297. Lib_黄色向上接地Node0_2.a('node.gradient','');
  298. Lib_黄色向上接地Node0_2.a('node.gradientcolor','rgba(255,128,0,1)');
  299. Lib_黄色向上接地Node0_2.a('node.endCompspts',Lib_黄色向上接地Node0_2endCompspts);
  300. Lib_黄色向上接地Node0_2.a('node.startCompspts',Lib_黄色向上接地Node0_2startCompspts);
  301. (function (node, img, compspts, endCompspts, startCompspts) {
  302. var position = node.getPosition(),
  303. w = node.getWidth()*_ratio.ratioX,
  304. h = node.getHeight()*_ratio.ratioY;
  305. function resetPoints(rx, ry) {
  306. for (var i = 0, len = compspts.length; i < len; i++) {
  307. if (i%2 === 0) {
  308. compspts[i]*=rx;
  309. } else {
  310. compspts[i]*=ry;
  311. }
  312. }
  313. endCompspts[0] = compspts[compspts.length-2];
  314. endCompspts[1] = compspts[compspts.length-1];
  315. endCompspts[2] *= rx;
  316. endCompspts[3] *= ry;
  317. node.a('node.offsetEndY', -(endCompspts[3]*0.5));
  318. node.a('node.offsetEndX', -(endCompspts[2]*0.5));
  319. startCompspts[0] = compspts[0];
  320. startCompspts[1] = compspts[1];
  321. startCompspts[2] *= rx;
  322. startCompspts[3] *= ry;
  323. node.a('node.offsetStartY', -(startCompspts[3]*0.5));
  324. node.a('node.offsetStartX', -(startCompspts[2]*0.5));
  325. node.a('node.endRotation', GD.calcRotationByStartAndEnd(compspts[i-4], compspts[i-3], compspts[i-2], compspts[i-1]));
  326. node.a('node.startRotation', GD.calcRotationByStartAndEnd(compspts[0], compspts[1], compspts[2], compspts[3]) + Math.PI);
  327. }
  328. node.setSize(w, h);
  329. node.setPosition(position.x * ratio.ratioX, position.y * ratio.ratioY);
  330. node.a('node.width', w);
  331. node.a('node.height', h);
  332. resetPoints(_ratio.ratioX, _ratio.ratioY);
  333. node.borderWidth = 1;
  334. node.a('node.borderwidth',node.borderWidth);
  335. node._nodename = 'Lib_黄色向上接地Node0_2';
  336. node._nodeType = 'line';
  337. zoomNodeList.push({
  338. node: node,
  339. attr: 'node.borderwidth'
  340. });
  341. var setWidth = node.setWidth,
  342. setHeight = node.setHeight,
  343. timer, rx = 1, ry = 1;
  344. node.setWidth = function (width) {
  345. var _width = this.getWidth();
  346. rx = width / _width;
  347. node.a('node.width', width);
  348. setWidth.apply(this, arguments);
  349. resetPoints(rx, 1);
  350. }
  351. node.setHeight = function (height) {
  352. var _height = this.getHeight();
  353. ry = height / _height;
  354. node.a('node.height', height);
  355. setHeight.apply(this, arguments);
  356. resetPoints(1, ry);
  357. }
  358. })(Lib_黄色向上接地Node0_2, Lib_黄色向上接地Node0_2.getImage(), Lib_黄色向上接地Node0_2compspts, Lib_黄色向上接地Node0_2endCompspts, Lib_黄色向上接地Node0_2startCompspts);
  359. var Lib_黄色向上接地Node0_3points=[7, 7,7, 0],
  360. Lib_黄色向上接地Node0_3rect=ht.Default.unionPoint([{x:7,y:7},{x:7,y:0}]),
  361. Lib_黄色向上接地Node0_3compspts=[];
  362. _ratio = GD.getRatioWithRotation(0, ratio);
  363. var _startratio = GD.getRatioWithRotation(1.5707963267949, ratio),
  364. _endratio = GD.getRatioWithRotation(4.71238898038469, ratio);
  365. for(var i=0;i<Lib_黄色向上接地Node0_3points.length;i++){
  366. if(i%2==0){
  367. Lib_黄色向上接地Node0_3compspts.push(Lib_黄色向上接地Node0_3points[i]-Lib_黄色向上接地Node0_3rect.x);
  368. }else{
  369. Lib_黄色向上接地Node0_3compspts.push(Lib_黄色向上接地Node0_3points[i]-Lib_黄色向上接地Node0_3rect.y);
  370. }
  371. }
  372. var Lib_黄色向上接地Node0_3ptslength=Lib_黄色向上接地Node0_3compspts.length;
  373. if (Lib_黄色向上接地Node0_3rect.height === 0) {
  374. Lib_黄色向上接地Node0_3compspts[0] -= 0;
  375. Lib_黄色向上接地Node0_3compspts[Lib_黄色向上接地Node0_3ptslength-2] += 0;
  376. } else if (Lib_黄色向上接地Node0_3rect.width === 0){
  377. Lib_黄色向上接地Node0_3compspts[1] -= 0;
  378. Lib_黄色向上接地Node0_3compspts[Lib_黄色向上接地Node0_3ptslength-1] += 0;
  379. } else {
  380. Lib_黄色向上接地Node0_3compspts[0] -= 0;
  381. Lib_黄色向上接地Node0_3compspts[1] -= 0;
  382. Lib_黄色向上接地Node0_3compspts[Lib_黄色向上接地Node0_3ptslength-2] += 0;
  383. Lib_黄色向上接地Node0_3compspts[Lib_黄色向上接地Node0_3ptslength-1] += 0;
  384. }
  385. Lib_黄色向上接地Node0_3 = new ht.Node();
  386. Lib_黄色向上接地Node0_3.borderWidth = 1;
  387. Lib_黄色向上接地Node0_3rect.width = Lib_黄色向上接地Node0_3rect.width === 0 ? 0.0001 : Lib_黄色向上接地Node0_3rect.width;
  388. Lib_黄色向上接地Node0_3rect.height = Lib_黄色向上接地Node0_3rect.height === 0 ? 0.0001 : Lib_黄色向上接地Node0_3rect.height;
  389. var Lib_黄色向上接地Node0_3endCompspts = [Lib_黄色向上接地Node0_3compspts[Lib_黄色向上接地Node0_3ptslength-2],Lib_黄色向上接地Node0_3compspts[Lib_黄色向上接地Node0_3ptslength-1],0,0];
  390. var Lib_黄色向上接地Node0_3startCompspts = [Lib_黄色向上接地Node0_3compspts[0],Lib_黄色向上接地Node0_3compspts[1],0,0];
  391. Lib_黄色向上接地Node0_3.setImage(GD.getPolyLineJSON());
  392. Lib_黄色向上接地Node0_3.setPosition(Lib_黄色向上接地Node0_3rect.x+Lib_黄色向上接地Node0_3rect.width/2,Lib_黄色向上接地Node0_3rect.y+Lib_黄色向上接地Node0_3rect.height/2);
  393. Lib_黄色向上接地Node0_3.setSize(Lib_黄色向上接地Node0_3rect.width,Lib_黄色向上接地Node0_3rect.height);
  394. Lib_黄色向上接地Node0_3.setStyle("opacity",1);
  395. Lib_黄色向上接地Node0_3.s({'pixelPerfect':true});
  396. Lib_黄色向上接地Node0_3borderwidth=1;
  397. Lib_黄色向上接地Node0_3.setRotation(0);
  398. dataModel.add(Lib_黄色向上接地Node0_3);
  399. Lib_黄色向上接地Node0_3.a('node.points',Lib_黄色向上接地Node0_3compspts);
  400. Lib_黄色向上接地Node0_3.a('node.segments',[1,2]);
  401. Lib_黄色向上接地Node0_3.a('node.color','rgba(255,128,0,1)');
  402. Lib_黄色向上接地Node0_3.a('node.borderPattern',getDashStyle("@borderPattern@"));
  403. Lib_黄色向上接地Node0_3.a('node.borderColor','rgba(255,128,0,1)');
  404. Lib_黄色向上接地Node0_3.a('node.background','rgba(255,128,0,1)');
  405. Lib_黄色向上接地Node0_3.a('node.gradient','');
  406. Lib_黄色向上接地Node0_3.a('node.gradientcolor','rgba(255,128,0,1)');
  407. Lib_黄色向上接地Node0_3.a('node.endCompspts',Lib_黄色向上接地Node0_3endCompspts);
  408. Lib_黄色向上接地Node0_3.a('node.startCompspts',Lib_黄色向上接地Node0_3startCompspts);
  409. (function (node, img, compspts, endCompspts, startCompspts) {
  410. var position = node.getPosition(),
  411. w = node.getWidth()*_ratio.ratioX,
  412. h = node.getHeight()*_ratio.ratioY;
  413. function resetPoints(rx, ry) {
  414. for (var i = 0, len = compspts.length; i < len; i++) {
  415. if (i%2 === 0) {
  416. compspts[i]*=rx;
  417. } else {
  418. compspts[i]*=ry;
  419. }
  420. }
  421. endCompspts[0] = compspts[compspts.length-2];
  422. endCompspts[1] = compspts[compspts.length-1];
  423. endCompspts[2] *= rx;
  424. endCompspts[3] *= ry;
  425. node.a('node.offsetEndY', -(endCompspts[3]*0.5));
  426. node.a('node.offsetEndX', -(endCompspts[2]*0.5));
  427. startCompspts[0] = compspts[0];
  428. startCompspts[1] = compspts[1];
  429. startCompspts[2] *= rx;
  430. startCompspts[3] *= ry;
  431. node.a('node.offsetStartY', -(startCompspts[3]*0.5));
  432. node.a('node.offsetStartX', -(startCompspts[2]*0.5));
  433. node.a('node.endRotation', GD.calcRotationByStartAndEnd(compspts[i-4], compspts[i-3], compspts[i-2], compspts[i-1]));
  434. node.a('node.startRotation', GD.calcRotationByStartAndEnd(compspts[0], compspts[1], compspts[2], compspts[3]) + Math.PI);
  435. }
  436. node.setSize(w, h);
  437. node.setPosition(position.x * ratio.ratioX, position.y * ratio.ratioY);
  438. node.a('node.width', w);
  439. node.a('node.height', h);
  440. resetPoints(_ratio.ratioX, _ratio.ratioY);
  441. node.borderWidth = 1;
  442. node.a('node.borderwidth',node.borderWidth);
  443. node._nodename = 'Lib_黄色向上接地Node0_3';
  444. node._nodeType = 'line';
  445. zoomNodeList.push({
  446. node: node,
  447. attr: 'node.borderwidth'
  448. });
  449. var setWidth = node.setWidth,
  450. setHeight = node.setHeight,
  451. timer, rx = 1, ry = 1;
  452. node.setWidth = function (width) {
  453. var _width = this.getWidth();
  454. rx = width / _width;
  455. node.a('node.width', width);
  456. setWidth.apply(this, arguments);
  457. resetPoints(rx, 1);
  458. }
  459. node.setHeight = function (height) {
  460. var _height = this.getHeight();
  461. ry = height / _height;
  462. node.a('node.height', height);
  463. setHeight.apply(this, arguments);
  464. resetPoints(1, ry);
  465. }
  466. })(Lib_黄色向上接地Node0_3, Lib_黄色向上接地Node0_3.getImage(), Lib_黄色向上接地Node0_3compspts, Lib_黄色向上接地Node0_3endCompspts, Lib_黄色向上接地Node0_3startCompspts);
  467. _ratio = GD.getRatioWithRotation(0*Math.PI/180, ratio);
  468. var Lib_黄色向上接地Node0boundtype = 'rect';
  469. var Lib_黄色向上接地Node0bound = new ht.Node(),
  470. Lib_黄色向上接地Node0boundBorderWidth = 0*2;
  471. if (Lib_黄色向上接地Node0boundtype === 'arc') {
  472. Lib_黄色向上接地Node0boundBorderWidth *= 0;
  473. }
  474. Lib_黄色向上接地Node0bound.setImage(GD.getRectJSON(15.05267*_ratio.ratioX, 13.66693*_ratio.ratioY, Lib_黄色向上接地Node0boundtype, '@arcFrom@', '@arcTo@', '@arcClose@'));
  475. Lib_黄色向上接地Node0bound.setPosition(7*ratio.ratioX, 7*ratio.ratioY);
  476. Lib_黄色向上接地Node0bound.setSize(15.05267*_ratio.ratioX, 13.66693*_ratio.ratioY);
  477. Lib_黄色向上接地Node0bound.s({
  478. 'pixelPerfect':true
  479. /*@AddPara@*/
  480. });
  481. Lib_黄色向上接地Node0bound.a('node.width', 15.05267*_ratio.ratioX);
  482. Lib_黄色向上接地Node0bound.a('node.height', 13.66693*_ratio.ratioY);
  483. Lib_黄色向上接地Node0bound.a('node.type', Lib_黄色向上接地Node0boundtype);
  484. Lib_黄色向上接地Node0bound.a('node.rect', [0, 0, 15.05267*_ratio.ratioX, 13.66693*_ratio.ratioY]);
  485. Lib_黄色向上接地Node0bound.a('node.background', 'rgba(255,255,255,0.003921569)');
  486. Lib_黄色向上接地Node0bound.a('node.gradientcolor', '');
  487. Lib_黄色向上接地Node0bound.a('node.gradient', '');
  488. Lib_黄色向上接地Node0bound.a('node.borderwidth', Lib_黄色向上接地Node0boundBorderWidth);
  489. Lib_黄色向上接地Node0bound.a('node.color', 'rgba(0,0,0,1)');
  490. Lib_黄色向上接地Node0bound.a('node.fillrect', [0,0,0,0]);
  491. Lib_黄色向上接地Node0bound.a('node.fillbackcolor', 'rgba(0,0,0,0)');
  492. Lib_黄色向上接地Node0bound.a('node.fillgradientcolor', 'rgba(0,0,0,0)');
  493. Lib_黄色向上接地Node0bound.a('node.fillgradient', '');
  494. if (Lib_黄色向上接地Node0boundtype !== 'rect') {
  495. Lib_黄色向上接地Node0bound.a('node.arcFrom', parseFloat('@arcFrom@'));
  496. Lib_黄色向上接地Node0bound.a('node.arcTo', parseFloat('@arcTo@'));
  497. Lib_黄色向上接地Node0bound.a('node.arcClose', '@arcClose@' === 'true' ? true : false);
  498. }
  499. if (Lib_黄色向上接地Node0boundtype === 'arc') {
  500. Lib_黄色向上接地Node0bound.a('node.arcOval', true);
  501. }
  502. Lib_黄色向上接地Node0bound.setRotation(0*Math.PI/180);
  503. Lib_黄色向上接地Node0bound.borderWidth = Lib_黄色向上接地Node0boundBorderWidth;
  504. Lib_黄色向上接地Node0bound.borderFillwidth = Lib_黄色向上接地Node0boundBorderWidth;
  505. dataModel.add(Lib_黄色向上接地Node0bound);
  506. Lib_黄色向上接地Node0bound._nodename = 'Lib_黄色向上接地Node0bound'
  507. Lib_黄色向上接地Node0bound._nodeType = 'rect';
  508. zoomNodeList.push({
  509. node: Lib_黄色向上接地Node0bound,
  510. attr: 'node.borderwidth'
  511. });
  512. (function (node, _img) {
  513. var setWidth = node.setWidth,
  514. setHeight = node.setHeight;
  515. node.setWidth = function (width) {
  516. if (width === this.getWidth()) return ;
  517. var height = this.getHeight();
  518. this.a('node.width', width);
  519. this.a('node.rect', [0,0,width, height]);
  520. setWidth.apply(this, arguments);
  521. }
  522. node.setHeight = function (height) {
  523. if (height === this.getHeight()) return ;
  524. var width = this.getWidth();
  525. this.a('node.height', height);
  526. this.a('node.rect', [0,0,width, height]);
  527. setHeight.apply(this, arguments);
  528. }
  529. })(Lib_黄色向上接地Node0bound, Lib_黄色向上接地Node0bound.getImage());
  530. /*@GraphList@*/
  531. GD.groupRotat(Lib_黄色向上接地Node0bound, Lib_黄色向上接地Node0_0, (180 )*Math.PI/180, ratio);
  532. GD.groupRotat(Lib_黄色向上接地Node0bound, Lib_黄色向上接地Node0_1, (180 )*Math.PI/180, ratio);
  533. GD.groupRotat(Lib_黄色向上接地Node0bound, Lib_黄色向上接地Node0_2, (180 )*Math.PI/180, ratio);
  534. GD.groupRotat(Lib_黄色向上接地Node0bound, Lib_黄色向上接地Node0_3, (180 )*Math.PI/180, ratio);
  535. /*@PageInit@*/
  536. var localVarObj = this.localVarObj;
  537. var localDynamicVarObj = this.localDynamicVar();
  538. this['Lib_黄色向上接地Node0_0'] = Lib_黄色向上接地Node0_0;
  539. Lib_黄色向上接地Node0_0.__parentLib = nodename;
  540. Lib_黄色向上接地Node0_0.__parent = this;
  541. this.childNodes.push(Lib_黄色向上接地Node0_0);
  542. this['Lib_黄色向上接地Node0_1'] = Lib_黄色向上接地Node0_1;
  543. Lib_黄色向上接地Node0_1.__parentLib = nodename;
  544. Lib_黄色向上接地Node0_1.__parent = this;
  545. this.childNodes.push(Lib_黄色向上接地Node0_1);
  546. this['Lib_黄色向上接地Node0_2'] = Lib_黄色向上接地Node0_2;
  547. Lib_黄色向上接地Node0_2.__parentLib = nodename;
  548. Lib_黄色向上接地Node0_2.__parent = this;
  549. this.childNodes.push(Lib_黄色向上接地Node0_2);
  550. this['Lib_黄色向上接地Node0_3'] = Lib_黄色向上接地Node0_3;
  551. Lib_黄色向上接地Node0_3.__parentLib = nodename;
  552. Lib_黄色向上接地Node0_3.__parent = this;
  553. this.childNodes.push(Lib_黄色向上接地Node0_3);
  554. this['Lib_黄色向上接地Node0bound'] = Lib_黄色向上接地Node0bound;
  555. Lib_黄色向上接地Node0bound.__parentLib = nodename;
  556. Lib_黄色向上接地Node0bound.__parent = this;
  557. this.childNodes.push(Lib_黄色向上接地Node0bound);
  558. /*@ControlContextMenu@*/
  559. /*@Declare@*/
  560. this.init(x, y, width, height, angle);
  561. };
  562. ht.Default.def('ht.lib.黄色向上接地', Object, {
  563. refresh10ms: function () {
  564. var localVarObj = this.localVarObj;
  565. var localDynamicVarObj = this.localDynamicVar();
  566. var Lib_黄色向上接地Node0_0= this.Lib_黄色向上接地Node0_0;
  567. var Lib_黄色向上接地Node0_1= this.Lib_黄色向上接地Node0_1;
  568. var Lib_黄色向上接地Node0_2= this.Lib_黄色向上接地Node0_2;
  569. var Lib_黄色向上接地Node0_3= this.Lib_黄色向上接地Node0_3;
  570. var Lib_黄色向上接地Node0bound= this.Lib_黄色向上接地Node0bound;
  571. /*@refresh10ms@*/
  572. },
  573. refresh100ms: function () {
  574. var localVarObj = this.localVarObj;
  575. var localDynamicVarObj = this.localDynamicVar();
  576. var Lib_黄色向上接地Node0_0= this.Lib_黄色向上接地Node0_0;
  577. var Lib_黄色向上接地Node0_1= this.Lib_黄色向上接地Node0_1;
  578. var Lib_黄色向上接地Node0_2= this.Lib_黄色向上接地Node0_2;
  579. var Lib_黄色向上接地Node0_3= this.Lib_黄色向上接地Node0_3;
  580. var Lib_黄色向上接地Node0bound= this.Lib_黄色向上接地Node0bound;
  581. /*@refresh100ms@*/
  582. },
  583. refresh500ms: function () {
  584. var localVarObj = this.localVarObj;
  585. var localDynamicVarObj = this.localDynamicVar();
  586. var Lib_黄色向上接地Node0_0= this.Lib_黄色向上接地Node0_0;
  587. var Lib_黄色向上接地Node0_1= this.Lib_黄色向上接地Node0_1;
  588. var Lib_黄色向上接地Node0_2= this.Lib_黄色向上接地Node0_2;
  589. var Lib_黄色向上接地Node0_3= this.Lib_黄色向上接地Node0_3;
  590. var Lib_黄色向上接地Node0bound= this.Lib_黄色向上接地Node0bound;
  591. /*@refresh500ms@*/
  592. },
  593. refresh1s: function () {
  594. var Counter1s = arguments[0] || 0;
  595. var localVarObj = this.localVarObj;
  596. var localDynamicVarObj = this.localDynamicVar();
  597. var Lib_黄色向上接地Node0_0= this.Lib_黄色向上接地Node0_0;
  598. var Lib_黄色向上接地Node0_1= this.Lib_黄色向上接地Node0_1;
  599. var Lib_黄色向上接地Node0_2= this.Lib_黄色向上接地Node0_2;
  600. var Lib_黄色向上接地Node0_3= this.Lib_黄色向上接地Node0_3;
  601. var Lib_黄色向上接地Node0bound= this.Lib_黄色向上接地Node0bound;
  602. /*@refresh1s@*/
  603. },
  604. refresh5s: function () {
  605. var localVarObj = this.localVarObj;
  606. var localDynamicVarObj = this.localDynamicVar();
  607. var Lib_黄色向上接地Node0_0= this.Lib_黄色向上接地Node0_0;
  608. var Lib_黄色向上接地Node0_1= this.Lib_黄色向上接地Node0_1;
  609. var Lib_黄色向上接地Node0_2= this.Lib_黄色向上接地Node0_2;
  610. var Lib_黄色向上接地Node0_3= this.Lib_黄色向上接地Node0_3;
  611. var Lib_黄色向上接地Node0bound= this.Lib_黄色向上接地Node0bound;
  612. /*@refresh5s@*/
  613. },
  614. /*@PageDynamic@*/
  615. onEvent: function (e, data, type, origin, offset, objMouseOn, ctm) {
  616. var localVarObj = this.localVarObj;
  617. var localDynamicVarObj = this.localDynamicVar();
  618. var Lib_黄色向上接地Node0_0= this.Lib_黄色向上接地Node0_0;
  619. var Lib_黄色向上接地Node0_1= this.Lib_黄色向上接地Node0_1;
  620. var Lib_黄色向上接地Node0_2= this.Lib_黄色向上接地Node0_2;
  621. var Lib_黄色向上接地Node0_3= this.Lib_黄色向上接地Node0_3;
  622. var Lib_黄色向上接地Node0bound= this.Lib_黄色向上接地Node0bound;
  623. if (type === 'click') {
  624. /*@EvnentClicked@*/
  625. } else if (type === 'mousedown') {
  626. mouseX=e.clientX;
  627. mouseY=e.clientY;
  628. /*@EvnentMouseDown@*/
  629. } else if (type === 'mouseup') {
  630. /*@EvnentMouseUp@*/
  631. } else if (type === 'mousemove') {
  632. var mouseX, mouseY, position, zoom;
  633. position=origin.getLogicalPoint(e);
  634. zoom = graphView.getZoom();
  635. if (origin === graphView) {
  636. mouseX= position.x + origin.tx();
  637. mouseY = position.y + origin.ty();
  638. } else {
  639. offset = offset || {x: 0, y: 0};
  640. mouseX = position.x / zoom + offset.x + origin.tx();
  641. mouseY = position.y / zoom + offset.y + origin.ty();
  642. }
  643. /*@EvnentMouseLeave@*/
  644. /*@EvnentMouseOver@*/
  645. } else if (type === 'keydown') {
  646. /*@EvnentKeyDown@*/
  647. } else if (type === 'contextmenu') {
  648. /*@Declare@*/
  649. /*@SetNodeContextMenu@*/
  650. /*@SetPageContextMenu@*/
  651. }
  652. /*@LibEvent@*/
  653. },
  654. getBaseClass: function () {
  655. return this._baseClass;
  656. },
  657. getWidth: function () {
  658. return this._width;
  659. },
  660. getHeight: function () {
  661. return this._height;
  662. },
  663. getSize: function () {
  664. return {
  665. width: this._width,
  666. height: this._height
  667. }
  668. },
  669. setWidth: function (width) {
  670. if (width === undefined || width === null || width != width) {
  671. return ;
  672. }
  673. var originWidth = this._width;
  674. var ratio = width / originWidth;
  675. var childNodes = this.childNodes, childNode, p, op = this.getPosition(), w, cw, ox, rotation = this.getRotation();
  676. for (var i = 0, len = childNodes.length; i < len; i++) {
  677. childNode = childNodes[i];
  678. p = childNode.getPosition();
  679. cw = childNode.getWidth();
  680. w = cw >=2 ? cw * ratio : cw;
  681. childNode.setWidth(w);
  682. ox = op.x + (p.x - op.x) * ratio;
  683. childNode.setPosition(ox, p.y);
  684. rotation = GD.calcRotation(rotation);
  685. if (rotation === 0 || rotation === Math.PI) {
  686. // 图元未旋转
  687. ox = op.x + (p.x - op.x)*ratio;
  688. childNode.setPosition(ox, p.y);
  689. } else if (rotation === 90 * Math.PI / 180) {
  690. // 图元旋转以后
  691. ox = op.y + (p.y - op.y)*ratio;
  692. childNode.setPosition(p.x, ox);
  693. }
  694. }
  695. this._width = width;
  696. this._originWidth = width;
  697. this._ratioX = ratio;
  698. return this;
  699. },
  700. setHeight: function (height) {
  701. if (height === undefined || height === null || height != height) {
  702. return ;
  703. }
  704. var originHeight = this._height;
  705. var ratio = height / originHeight;
  706. var childNodes = this.childNodes, childNode, p, op = this.getPosition(), h, ch, oy, rotation = this.getRotation();
  707. for (var i = 0, len = childNodes.length; i < len; i++) {
  708. childNode = childNodes[i];
  709. p = childNode.getPosition();
  710. ch = childNode.getHeight();
  711. h = ch >=2 ? ch * ratio : ch;
  712. childNode.setHeight(h);
  713. rotation = GD.calcRotation(rotation);
  714. if (rotation === 0 || rotation === Math.PI) {
  715. // 图元未旋转
  716. oy = op.y + (p.y - op.y)*ratio;
  717. childNode.setPosition(p.x, oy);
  718. } else if (rotation === 90 * Math.PI / 180) {
  719. // 图元旋转以后
  720. oy = op.x + (p.x - op.x)*ratio;
  721. childNode.setPosition(oy, p.y);
  722. }
  723. }
  724. this._height = height;
  725. this._originHeight = height;
  726. this._ratioY = ratio;
  727. return this;
  728. },
  729. setSize: function (size) {
  730. // var args = Array.prototype.slice.call(arguments, 0);
  731. // var height, width;
  732. // if (args.length === 0) {
  733. // return ;
  734. // }else if (args.length === 1) {
  735. // height = args[0].height;
  736. // width = args[0].width;
  737. // } else {
  738. // width = args[0];
  739. // height = args[1];
  740. // }
  741. // var wh = GD.getRatioWithRotation(angle, wid)
  742. // this.setHeight(height);
  743. // this.setWidth(width);
  744. // return this;
  745. var args = Array.prototype.slice.call(arguments, 0);
  746. var height, width;
  747. if (args.length === 0) {
  748. return ;
  749. }else if (args.length === 1) {
  750. height = args[0].height;
  751. width = args[0].width;
  752. angle = 0;
  753. } else if (args.length === 2) {
  754. if (typeof args[0] === 'object') {
  755. width = args[0].width;
  756. height = args[0].height;
  757. angle = args[1] || 0;
  758. } else {
  759. width = args[0];
  760. height = args[1];
  761. angle = 0;
  762. }
  763. } else if (args.length === 3) {
  764. width = args[0];
  765. height = args[1];
  766. angle = args[2] || 0;
  767. }
  768. var wh = GD.getRatioWithRotation(0, width, height);
  769. this.setHeight(wh.ratioY);
  770. this.setWidth(wh.ratioX);
  771. return this;
  772. },
  773. getPosition: function () {
  774. return {
  775. x: this._x,
  776. y: this._y
  777. }
  778. },
  779. setPosition: function () {
  780. var args = Array.prototype.slice.call(arguments, 0), x, y;
  781. if (args.length === 0) {
  782. return this;
  783. } else if (args.length === 1) {
  784. if (typeof args[0] != 'object') {
  785. return this;
  786. }
  787. x = args[0].x;
  788. y = args[0].y;
  789. } else {
  790. x = args[0];
  791. y = args[1];
  792. }
  793. if ((x !== 0 && !x) || (y !== 0 && !y)) {
  794. return this;
  795. }
  796. // var childNodes = this.childNodes, offset, childNode, p;
  797. // for (var i = 0, len = childNodes.length; i < len; i++) {
  798. // childNode = childNodes[i];
  799. // p = childNode.getPosition();
  800. // childNode.setPosition(x - (this._x-p.x)*this._ratioX, y - (this._y-p.y)*this._ratioY);
  801. // }
  802. // this._x = x;
  803. // this._y = y;
  804. // return this;
  805. var childNodes, childNode, background, offset = {}, op, cp;
  806. childNodes = this.childNodes;
  807. background = this._background;
  808. op = background.getPosition();
  809. offset.x = x - op.x;
  810. offset.y = y - op.y;
  811. for (var i = 0, len = childNodes.length; i < len; i++) {
  812. childNode = childNodes[i];
  813. cp = childNode.getPosition();
  814. childNode.setPosition(cp.x + offset.x, cp.y + offset.y);
  815. }
  816. this._x = x;
  817. this._y = y;
  818. this._position = {x: x, y: y};
  819. return this;
  820. },
  821. getStyle: function (key) {
  822. if (!key) {
  823. return undefined;
  824. }
  825. return this._styleObject[key];
  826. },
  827. setStyle: function (key, value, force) {
  828. var childNodes = this.childNodes, childNode;
  829. for (var i = 0, len = childNodes.length; i < len; i++) {
  830. childNode = childNodes[i];
  831. if (key === '2d.visible') {
  832. if (value === graphView.isVisible(childNode)) {
  833. continue;
  834. }
  835. if (!value) {
  836. childNode._savedIsVisible = graphView.isVisible(childNode);
  837. childNode.s({
  838. '2d.visible': false
  839. })
  840. } else {
  841. childNode.s({
  842. '2d.visible': childNode._savedIsVisible
  843. })
  844. }
  845. continue;
  846. }
  847. childNode.s({
  848. key: value
  849. });
  850. }
  851. this._styleObject[key] = value;
  852. return this;
  853. },
  854. calcSize: function () {
  855. var background = this._background;
  856. var position = background.getPosition(),
  857. width = background.getWidth(),
  858. height = background.getHeight();
  859. this._width = width;
  860. this._height = height;
  861. this._x = position.x;
  862. this._y = position.y;
  863. this._position = {
  864. x: this._x,
  865. y: this._y
  866. }
  867. return this;
  868. return this;
  869. },
  870. s: function (styleObj, force) {
  871. var args = Array.prototype.slice.call(arguments, 0);
  872. var styleObj;
  873. if (args.length === 0) {
  874. return this;
  875. } else if (args.length === 1) {
  876. styleObj = args[0];
  877. } else {
  878. this.setStyle(args[0], args[1]);
  879. return this;
  880. }
  881. for (var key in styleObj) {
  882. if (!styleObj.hasOwnProperty(key)) {
  883. continue;
  884. }
  885. this.setStyle(key, styleObj[key], force);
  886. }
  887. return this;
  888. },
  889. init: function (x, y, width, height, angle) {
  890. var that = this;
  891. this.calcSize();
  892. (function (width, height, angle) {
  893. // that.setSize(width, height, angle);
  894. // var wh = GD.getRatioWithRotation(angle, width, height);
  895. // width = wh.ratioX;
  896. // height = wh.ratioY;
  897. var originHeight = that._height;
  898. var originWidth = that._width;
  899. var ratioY = height / originHeight;
  900. var ratioX = width / originWidth;
  901. var childNodes = that.childNodes,
  902. childNode,p, op = that.getPosition(), h, ch, oy, w, cw, ox, name, borderRatio, borderWidth;
  903. for (var i = 0, len = childNodes.length; i < len; i++) {
  904. childNode = childNodes[i];
  905. p = childNode.getPosition();
  906. childNode.originHeight = childNode.originHeight || childNode.getHeight();
  907. ch = childNode.getHeight();
  908. cw = childNode.getWidth();
  909. if (ch > 2) {
  910. h = ch * ratioY;
  911. childNode.setHeight(h);
  912. }
  913. if (cw > 2) {
  914. w = cw * ratioX;
  915. childNode.setWidth(w);
  916. }
  917. borderRatio = (ratioX + ratioY)*0.5;
  918. if (childNode._nodeType === 'line') { // 如果是线,
  919. if (childNode.getWidth() > childNode.getHeight()) {
  920. borderRatio = ratioX;
  921. } else {
  922. borderRatio = ratioY;
  923. }
  924. }
  925. name = childNode._nodename;
  926. // if (childNode.borderWidth && name && ch > 2 && cw > 2) {
  927. // borderWidth = childNode.borderWidth / borderRatio;
  928. // if (borderWidth > ch*0.5 || borderWidth > cw *0.5) {
  929. // // borderWidth = childNode.borderWidth;
  930. // }
  931. // childNode.borderWidth = borderWidth;
  932. // childNode.a(name + '.borderwidth', borderWidth);
  933. // }
  934. }
  935. that._height = height;
  936. that._originHeight = height;
  937. that._ratioY = ratioY;
  938. that._width = width;
  939. that._originWidth = width;
  940. that._ratioX = ratioX;
  941. })(width, height, angle);
  942. that._x = width / 2;
  943. that._y = height / 2;
  944. that._rotation = 0;
  945. // that.setPosition(x, y);
  946. (function (x, y) {
  947. var childNodes = that.childNodes, offset, childNode;
  948. var w2 = that.getWidth() / 2, h2 = that.getHeight()/2;
  949. for (var i = 0, len = childNodes.length; i < len; i++) {
  950. childNode = childNodes[i];
  951. offset = childNode.getPosition();
  952. childNode.setPosition(x + offset.x * that._ratioX - w2, y + offset.y * that._ratioY - h2);
  953. }
  954. that._x = x;
  955. that._y = y;
  956. })(x, y);
  957. // setTimeout(that.addEVent, 1000);
  958. },
  959. setRotation: function (angle) {
  960. var that = this, _angle = that.getRotation();
  961. if (angle!==0 && !angle || angle === _angle) {
  962. return this;
  963. }
  964. var childNodes = this.childNodes, childNode, p = this.getPosition(), px = p.x, py = p.y;
  965. for (var i = 0, len = childNodes.length; i < len; i++) {
  966. childNode = childNodes[i];
  967. var x = childNode.getPosition().x - px;
  968. var y = childNode.getPosition().y - py;
  969. childNode.setPosition(Math.cos(angle-_angle) * x - Math.sin(angle-_angle) * y + px, Math.cos(angle-_angle) * y + Math.sin(angle-_angle) * x + py);
  970. childNode.setRotation(angle);
  971. }
  972. this._rotation = angle;
  973. return this;
  974. },
  975. getRotation: function () {
  976. return this._rotation;
  977. },
  978. setScale: function (sx, sy) {
  979. var that = this,
  980. childNodes = this.childNodes,
  981. childNode;
  982. if (sx === undefined || sx === null) return ;
  983. if (sy === undefined || sy === null) {
  984. sy = sx;
  985. }
  986. for (var i = 0, len = childNodes.length; i < len; i++) {
  987. childNode = childNodes[i];
  988. if (typeof childNode.setScale === 'function') {
  989. childNode.setScale(sx, sy);
  990. }
  991. }
  992. },
  993. getScale: function () {
  994. return this._background.getScale();
  995. },
  996. setScaleX: function (sx) {
  997. if (sx === undefined || sx === null) return;
  998. var that = this,
  999. childNodes = this.childNodes,
  1000. childNode;
  1001. for (var i = 0, len = childNodes.length; i < len; i++) {
  1002. childNode = childNodes[i];
  1003. if (typeof childNode.setScaleX === 'function') {
  1004. childNode.setScaleX(sx);
  1005. }
  1006. }
  1007. },
  1008. setScaleY: function (sy) {
  1009. if (sy === undefined || sy === null) return;
  1010. var that = this,
  1011. childNodes = this.childNodes,
  1012. childNode;
  1013. for (var i = 0, len = childNodes.length; i < len; i++) {
  1014. childNode = childNodes[i];
  1015. if (typeof childNode.setScaleY === 'function') {
  1016. childNode.setScaleY(sy);
  1017. }
  1018. }
  1019. },
  1020. getScaleX: function () {
  1021. return this._background.getScaleX();
  1022. },
  1023. getScaleY: function () {
  1024. return this._background.getScaleY();
  1025. },
  1026. evert: function () {
  1027. var that = this,
  1028. childNodes = this.childNodes,
  1029. background = this._background,
  1030. bp = background.getPosition(),
  1031. bx = bp.x,
  1032. by = bp.y,
  1033. childNode, distanceX, distanceY, x, y, p, nx, ny;
  1034. for (var i = 0, len = childNodes.length; i < len; i++) {
  1035. childNode = childNodes[i];
  1036. p = childNode.getPosition();
  1037. x = p.x;
  1038. y = p.y;
  1039. distanceX = bx - x;
  1040. distanceY = by - y;
  1041. nx = bx + distanceX;
  1042. ny = by + distanceY;
  1043. childNode.setPosition(nx, ny);
  1044. if (typeof childNode.setScale === 'function') {
  1045. if (!(childNode._disallowEvert === true))
  1046. childNode.setScale(-1, -1);
  1047. }
  1048. }
  1049. },
  1050. evertX: function () {
  1051. var that = this,
  1052. childNodes = this.childNodes,
  1053. background = this._background,
  1054. bx = background.getPosition().x,
  1055. childNode, distance, x, p, nx;
  1056. for (var i = 0, len = childNodes.length; i < len; i++) {
  1057. childNode = childNodes[i];
  1058. p = childNode.getPosition();
  1059. x = p.x;
  1060. distance = bx - x;
  1061. nx = bx + distance;
  1062. childNode.setPosition(nx, p.y);
  1063. if (typeof childNode.setScaleX === 'function') {
  1064. if (!(childNode._disallowEvert === true))
  1065. childNode.setScaleX(-1);
  1066. }
  1067. }
  1068. },
  1069. evertY: function () {
  1070. var that = this,
  1071. childNodes = this.childNodes,
  1072. background = this._background,
  1073. by = background.getPosition().y,
  1074. childNode, distance, y, p, ny;
  1075. for (var i = 0, len = childNodes.length; i < len; i++) {
  1076. childNode = childNodes[i];
  1077. p = childNode.getPosition();
  1078. y = p.y;
  1079. distance = by - y;
  1080. ny = by + distance;
  1081. childNode.setPosition(p.x, ny);
  1082. if (typeof childNode.setScaleY === 'function') {
  1083. if (!(childNode._disallowEvert === true))
  1084. childNode.setScaleY(-1);
  1085. }
  1086. }
  1087. },
  1088. attr: function (key, value) {
  1089. var _attrObj = this._attrObj || {};
  1090. if (arguments.length === 1) {
  1091. return _attrObj[key];
  1092. }
  1093. var childNodes = this.childNodes, childNode;
  1094. _attrObj[key] = value;
  1095. for (var i = 0; childNode = childNodes[i++];) {
  1096. if (typeof childNode.a === 'function') {
  1097. childNode.a(key, value);
  1098. }
  1099. }
  1100. },
  1101. a: function () {
  1102. return this.attr.apply(this, arguments);
  1103. }
  1104. });
  1105. }