排布图图元.js 54 KB

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