紫黄双圆.js 62 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493
  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 = 55.05298*_ratio.ratioX;
  11. this._originHeight = 52.72736*_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_紫黄双圆Node0type = 'oval';
  37. var Lib_紫黄双圆Node0 = new ht.Node(),
  38. Lib_紫黄双圆Node0BorderWidth = 2*2;
  39. if (Lib_紫黄双圆Node0type === 'arc') {
  40. Lib_紫黄双圆Node0BorderWidth *= 2;
  41. }
  42. Lib_紫黄双圆Node0.setImage(GD.getRectJSON(29.84125*_ratio.ratioX, 26.18182*_ratio.ratioY, Lib_紫黄双圆Node0type, '@arcFrom@', '@arcTo@', '@arcClose@'));
  43. Lib_紫黄双圆Node0.setPosition(24*ratio.ratioX, 16*ratio.ratioY);
  44. Lib_紫黄双圆Node0.setSize(29.84125*_ratio.ratioX, 26.18182*_ratio.ratioY);
  45. Lib_紫黄双圆Node0.s({
  46. 'pixelPerfect':true
  47. /*@AddPara@*/
  48. });
  49. Lib_紫黄双圆Node0.a('node.width', 29.84125*_ratio.ratioX);
  50. Lib_紫黄双圆Node0.a('node.height', 26.18182*_ratio.ratioY);
  51. Lib_紫黄双圆Node0.a('node.type', Lib_紫黄双圆Node0type);
  52. Lib_紫黄双圆Node0.a('node.rect', [0, 0, 29.84125*_ratio.ratioX, 26.18182*_ratio.ratioY]);
  53. Lib_紫黄双圆Node0.a('node.background', 'rgba(255,255,255,0.003921569)');
  54. Lib_紫黄双圆Node0.a('node.gradientcolor', '');
  55. Lib_紫黄双圆Node0.a('node.gradient', '');
  56. Lib_紫黄双圆Node0.a('node.borderwidth', Lib_紫黄双圆Node0BorderWidth);
  57. Lib_紫黄双圆Node0.a('node.color', 'rgba(255,0,255,1)');
  58. Lib_紫黄双圆Node0.a('node.fillrect', [0,0,0,0]);
  59. Lib_紫黄双圆Node0.a('node.fillbackcolor', 'rgba(0,0,0,0)');
  60. Lib_紫黄双圆Node0.a('node.fillgradientcolor', 'rgba(0,0,0,0)');
  61. Lib_紫黄双圆Node0.a('node.fillgradient', '');
  62. if (Lib_紫黄双圆Node0type !== 'rect') {
  63. Lib_紫黄双圆Node0.a('node.arcFrom', parseFloat('@arcFrom@'));
  64. Lib_紫黄双圆Node0.a('node.arcTo', parseFloat('@arcTo@'));
  65. Lib_紫黄双圆Node0.a('node.arcClose', '@arcClose@' === 'true' ? true : false);
  66. }
  67. if (Lib_紫黄双圆Node0type === 'arc') {
  68. Lib_紫黄双圆Node0.a('node.arcOval', true);
  69. }
  70. Lib_紫黄双圆Node0.setRotation(0*Math.PI/180);
  71. Lib_紫黄双圆Node0.borderWidth = Lib_紫黄双圆Node0BorderWidth;
  72. Lib_紫黄双圆Node0.borderFillwidth = Lib_紫黄双圆Node0BorderWidth;
  73. dataModel.add(Lib_紫黄双圆Node0);
  74. Lib_紫黄双圆Node0._nodename = 'Lib_紫黄双圆Node0'
  75. Lib_紫黄双圆Node0._nodeType = 'rect';
  76. zoomNodeList.push({
  77. node: Lib_紫黄双圆Node0,
  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, Lib_紫黄双圆Node0.getImage());var Lib_紫黄双圆Node1points=[24, 9,24, 16],
  98. Lib_紫黄双圆Node1rect=ht.Default.unionPoint([{x:24,y:9},{x:24,y:16}]),
  99. Lib_紫黄双圆Node1compspts=[];
  100. _ratio = GD.getRatioWithRotation(0, ratio);
  101. var _startratio = GD.getRatioWithRotation(4.71238898038469, ratio),
  102. _endratio = GD.getRatioWithRotation(7.85398163397448, ratio);
  103. for(var i=0;i<Lib_紫黄双圆Node1points.length;i++){
  104. if(i%2==0){
  105. Lib_紫黄双圆Node1compspts.push(Lib_紫黄双圆Node1points[i]-Lib_紫黄双圆Node1rect.x);
  106. }else{
  107. Lib_紫黄双圆Node1compspts.push(Lib_紫黄双圆Node1points[i]-Lib_紫黄双圆Node1rect.y);
  108. }
  109. }
  110. var Lib_紫黄双圆Node1ptslength=Lib_紫黄双圆Node1compspts.length;
  111. if (Lib_紫黄双圆Node1rect.height === 0) {
  112. Lib_紫黄双圆Node1compspts[0] -= 0;
  113. Lib_紫黄双圆Node1compspts[Lib_紫黄双圆Node1ptslength-2] += 0;
  114. } else if (Lib_紫黄双圆Node1rect.width === 0){
  115. Lib_紫黄双圆Node1compspts[1] -= 0;
  116. Lib_紫黄双圆Node1compspts[Lib_紫黄双圆Node1ptslength-1] += 0;
  117. } else {
  118. Lib_紫黄双圆Node1compspts[0] -= 0;
  119. Lib_紫黄双圆Node1compspts[1] -= 0;
  120. Lib_紫黄双圆Node1compspts[Lib_紫黄双圆Node1ptslength-2] += 0;
  121. Lib_紫黄双圆Node1compspts[Lib_紫黄双圆Node1ptslength-1] += 0;
  122. }
  123. Lib_紫黄双圆Node1 = new ht.Node();
  124. Lib_紫黄双圆Node1.borderWidth = 2;
  125. Lib_紫黄双圆Node1rect.width = Lib_紫黄双圆Node1rect.width === 0 ? 0.0001 : Lib_紫黄双圆Node1rect.width;
  126. Lib_紫黄双圆Node1rect.height = Lib_紫黄双圆Node1rect.height === 0 ? 0.0001 : Lib_紫黄双圆Node1rect.height;
  127. var Lib_紫黄双圆Node1endCompspts = [Lib_紫黄双圆Node1compspts[Lib_紫黄双圆Node1ptslength-2],Lib_紫黄双圆Node1compspts[Lib_紫黄双圆Node1ptslength-1],0,0];
  128. var Lib_紫黄双圆Node1startCompspts = [Lib_紫黄双圆Node1compspts[0],Lib_紫黄双圆Node1compspts[1],0,0];
  129. Lib_紫黄双圆Node1.setImage(GD.getPolyLineJSON());
  130. Lib_紫黄双圆Node1.setPosition(Lib_紫黄双圆Node1rect.x+Lib_紫黄双圆Node1rect.width/2,Lib_紫黄双圆Node1rect.y+Lib_紫黄双圆Node1rect.height/2);
  131. Lib_紫黄双圆Node1.setSize(Lib_紫黄双圆Node1rect.width,Lib_紫黄双圆Node1rect.height);
  132. Lib_紫黄双圆Node1.setStyle("opacity",1);
  133. Lib_紫黄双圆Node1.s({'pixelPerfect':true});
  134. Lib_紫黄双圆Node1borderwidth=2;
  135. Lib_紫黄双圆Node1.setRotation(0);
  136. dataModel.add(Lib_紫黄双圆Node1);
  137. Lib_紫黄双圆Node1.a('node.points',Lib_紫黄双圆Node1compspts);
  138. Lib_紫黄双圆Node1.a('node.segments',[1,2]);
  139. Lib_紫黄双圆Node1.a('node.color','rgba(255,0,255,1)');
  140. Lib_紫黄双圆Node1.a('node.borderPattern',getDashStyle("@borderPattern@"));
  141. Lib_紫黄双圆Node1.a('node.borderColor','rgba(255,0,255,1)');
  142. Lib_紫黄双圆Node1.a('node.background','rgba(255,0,255,1)');
  143. Lib_紫黄双圆Node1.a('node.gradient','');
  144. Lib_紫黄双圆Node1.a('node.gradientcolor','rgba(255,0,255,1)');
  145. Lib_紫黄双圆Node1.a('node.endCompspts',Lib_紫黄双圆Node1endCompspts);
  146. Lib_紫黄双圆Node1.a('node.startCompspts',Lib_紫黄双圆Node1startCompspts);
  147. (function (node, img, compspts, endCompspts, startCompspts) {
  148. var position = node.getPosition(),
  149. w = node.getWidth()*_ratio.ratioX,
  150. h = node.getHeight()*_ratio.ratioY;
  151. function resetPoints(rx, ry) {
  152. for (var i = 0, len = compspts.length; i < len; i++) {
  153. if (i%2 === 0) {
  154. compspts[i]*=rx;
  155. } else {
  156. compspts[i]*=ry;
  157. }
  158. }
  159. endCompspts[0] = compspts[compspts.length-2];
  160. endCompspts[1] = compspts[compspts.length-1];
  161. endCompspts[2] *= rx;
  162. endCompspts[3] *= ry;
  163. node.a('node.offsetEndY', -(endCompspts[3]*0.5));
  164. node.a('node.offsetEndX', -(endCompspts[2]*0.5));
  165. startCompspts[0] = compspts[0];
  166. startCompspts[1] = compspts[1];
  167. startCompspts[2] *= rx;
  168. startCompspts[3] *= ry;
  169. node.a('node.offsetStartY', -(startCompspts[3]*0.5));
  170. node.a('node.offsetStartX', -(startCompspts[2]*0.5));
  171. node.a('node.endRotation', GD.calcRotationByStartAndEnd(compspts[i-4], compspts[i-3], compspts[i-2], compspts[i-1]));
  172. node.a('node.startRotation', GD.calcRotationByStartAndEnd(compspts[0], compspts[1], compspts[2], compspts[3]) + Math.PI);
  173. }
  174. node.setSize(w, h);
  175. node.setPosition(position.x * ratio.ratioX, position.y * ratio.ratioY);
  176. node.a('node.width', w);
  177. node.a('node.height', h);
  178. resetPoints(_ratio.ratioX, _ratio.ratioY);
  179. node.borderWidth = 2;
  180. node.a('node.borderwidth',node.borderWidth);
  181. node._nodename = 'Lib_紫黄双圆Node1';
  182. node._nodeType = 'line';
  183. zoomNodeList.push({
  184. node: node,
  185. attr: 'node.borderwidth'
  186. });
  187. var setWidth = node.setWidth,
  188. setHeight = node.setHeight,
  189. timer, rx = 1, ry = 1;
  190. node.setWidth = function (width) {
  191. var _width = this.getWidth();
  192. rx = width / _width;
  193. node.a('node.width', width);
  194. setWidth.apply(this, arguments);
  195. resetPoints(rx, 1);
  196. }
  197. node.setHeight = function (height) {
  198. var _height = this.getHeight();
  199. ry = height / _height;
  200. node.a('node.height', height);
  201. setHeight.apply(this, arguments);
  202. resetPoints(1, ry);
  203. }
  204. })(Lib_紫黄双圆Node1, Lib_紫黄双圆Node1.getImage(), Lib_紫黄双圆Node1compspts, Lib_紫黄双圆Node1endCompspts, Lib_紫黄双圆Node1startCompspts);
  205. var Lib_紫黄双圆Node2points=[24, 16,31, 22],
  206. Lib_紫黄双圆Node2rect=ht.Default.unionPoint([{x:24,y:16},{x:31,y:22}]),
  207. Lib_紫黄双圆Node2compspts=[];
  208. _ratio = GD.getRatioWithRotation(0, ratio);
  209. var _startratio = GD.getRatioWithRotation(3.85021893062608, ratio),
  210. _endratio = GD.getRatioWithRotation(0.708626277036288, ratio);
  211. for(var i=0;i<Lib_紫黄双圆Node2points.length;i++){
  212. if(i%2==0){
  213. Lib_紫黄双圆Node2compspts.push(Lib_紫黄双圆Node2points[i]-Lib_紫黄双圆Node2rect.x);
  214. }else{
  215. Lib_紫黄双圆Node2compspts.push(Lib_紫黄双圆Node2points[i]-Lib_紫黄双圆Node2rect.y);
  216. }
  217. }
  218. var Lib_紫黄双圆Node2ptslength=Lib_紫黄双圆Node2compspts.length;
  219. if (Lib_紫黄双圆Node2rect.height === 0) {
  220. Lib_紫黄双圆Node2compspts[0] -= 0;
  221. Lib_紫黄双圆Node2compspts[Lib_紫黄双圆Node2ptslength-2] += 0;
  222. } else if (Lib_紫黄双圆Node2rect.width === 0){
  223. Lib_紫黄双圆Node2compspts[1] -= 0;
  224. Lib_紫黄双圆Node2compspts[Lib_紫黄双圆Node2ptslength-1] += 0;
  225. } else {
  226. Lib_紫黄双圆Node2compspts[0] -= 0;
  227. Lib_紫黄双圆Node2compspts[1] -= 0;
  228. Lib_紫黄双圆Node2compspts[Lib_紫黄双圆Node2ptslength-2] += 0;
  229. Lib_紫黄双圆Node2compspts[Lib_紫黄双圆Node2ptslength-1] += 0;
  230. }
  231. Lib_紫黄双圆Node2 = new ht.Node();
  232. Lib_紫黄双圆Node2.borderWidth = 2;
  233. Lib_紫黄双圆Node2rect.width = Lib_紫黄双圆Node2rect.width === 0 ? 0.0001 : Lib_紫黄双圆Node2rect.width;
  234. Lib_紫黄双圆Node2rect.height = Lib_紫黄双圆Node2rect.height === 0 ? 0.0001 : Lib_紫黄双圆Node2rect.height;
  235. var Lib_紫黄双圆Node2endCompspts = [Lib_紫黄双圆Node2compspts[Lib_紫黄双圆Node2ptslength-2],Lib_紫黄双圆Node2compspts[Lib_紫黄双圆Node2ptslength-1],0,0];
  236. var Lib_紫黄双圆Node2startCompspts = [Lib_紫黄双圆Node2compspts[0],Lib_紫黄双圆Node2compspts[1],0,0];
  237. Lib_紫黄双圆Node2.setImage(GD.getPolyLineJSON());
  238. Lib_紫黄双圆Node2.setPosition(Lib_紫黄双圆Node2rect.x+Lib_紫黄双圆Node2rect.width/2,Lib_紫黄双圆Node2rect.y+Lib_紫黄双圆Node2rect.height/2);
  239. Lib_紫黄双圆Node2.setSize(Lib_紫黄双圆Node2rect.width,Lib_紫黄双圆Node2rect.height);
  240. Lib_紫黄双圆Node2.setStyle("opacity",1);
  241. Lib_紫黄双圆Node2.s({'pixelPerfect':true});
  242. Lib_紫黄双圆Node2borderwidth=2;
  243. Lib_紫黄双圆Node2.setRotation(0);
  244. dataModel.add(Lib_紫黄双圆Node2);
  245. Lib_紫黄双圆Node2.a('node.points',Lib_紫黄双圆Node2compspts);
  246. Lib_紫黄双圆Node2.a('node.segments',[1,2]);
  247. Lib_紫黄双圆Node2.a('node.color','rgba(255,0,255,1)');
  248. Lib_紫黄双圆Node2.a('node.borderPattern',getDashStyle("@borderPattern@"));
  249. Lib_紫黄双圆Node2.a('node.borderColor','rgba(255,0,255,1)');
  250. Lib_紫黄双圆Node2.a('node.background','rgba(255,0,255,1)');
  251. Lib_紫黄双圆Node2.a('node.gradient','');
  252. Lib_紫黄双圆Node2.a('node.gradientcolor','rgba(255,0,255,1)');
  253. Lib_紫黄双圆Node2.a('node.endCompspts',Lib_紫黄双圆Node2endCompspts);
  254. Lib_紫黄双圆Node2.a('node.startCompspts',Lib_紫黄双圆Node2startCompspts);
  255. (function (node, img, compspts, endCompspts, startCompspts) {
  256. var position = node.getPosition(),
  257. w = node.getWidth()*_ratio.ratioX,
  258. h = node.getHeight()*_ratio.ratioY;
  259. function resetPoints(rx, ry) {
  260. for (var i = 0, len = compspts.length; i < len; i++) {
  261. if (i%2 === 0) {
  262. compspts[i]*=rx;
  263. } else {
  264. compspts[i]*=ry;
  265. }
  266. }
  267. endCompspts[0] = compspts[compspts.length-2];
  268. endCompspts[1] = compspts[compspts.length-1];
  269. endCompspts[2] *= rx;
  270. endCompspts[3] *= ry;
  271. node.a('node.offsetEndY', -(endCompspts[3]*0.5));
  272. node.a('node.offsetEndX', -(endCompspts[2]*0.5));
  273. startCompspts[0] = compspts[0];
  274. startCompspts[1] = compspts[1];
  275. startCompspts[2] *= rx;
  276. startCompspts[3] *= ry;
  277. node.a('node.offsetStartY', -(startCompspts[3]*0.5));
  278. node.a('node.offsetStartX', -(startCompspts[2]*0.5));
  279. node.a('node.endRotation', GD.calcRotationByStartAndEnd(compspts[i-4], compspts[i-3], compspts[i-2], compspts[i-1]));
  280. node.a('node.startRotation', GD.calcRotationByStartAndEnd(compspts[0], compspts[1], compspts[2], compspts[3]) + Math.PI);
  281. }
  282. node.setSize(w, h);
  283. node.setPosition(position.x * ratio.ratioX, position.y * ratio.ratioY);
  284. node.a('node.width', w);
  285. node.a('node.height', h);
  286. resetPoints(_ratio.ratioX, _ratio.ratioY);
  287. node.borderWidth = 2;
  288. node.a('node.borderwidth',node.borderWidth);
  289. node._nodename = 'Lib_紫黄双圆Node2';
  290. node._nodeType = 'line';
  291. zoomNodeList.push({
  292. node: node,
  293. attr: 'node.borderwidth'
  294. });
  295. var setWidth = node.setWidth,
  296. setHeight = node.setHeight,
  297. timer, rx = 1, ry = 1;
  298. node.setWidth = function (width) {
  299. var _width = this.getWidth();
  300. rx = width / _width;
  301. node.a('node.width', width);
  302. setWidth.apply(this, arguments);
  303. resetPoints(rx, 1);
  304. }
  305. node.setHeight = function (height) {
  306. var _height = this.getHeight();
  307. ry = height / _height;
  308. node.a('node.height', height);
  309. setHeight.apply(this, arguments);
  310. resetPoints(1, ry);
  311. }
  312. })(Lib_紫黄双圆Node2, Lib_紫黄双圆Node2.getImage(), Lib_紫黄双圆Node2compspts, Lib_紫黄双圆Node2endCompspts, Lib_紫黄双圆Node2startCompspts);
  313. var Lib_紫黄双圆Node3points=[24, 16,16, 22],
  314. Lib_紫黄双圆Node3rect=ht.Default.unionPoint([{x:24,y:16},{x:16,y:22}]),
  315. Lib_紫黄双圆Node3compspts=[];
  316. _ratio = GD.getRatioWithRotation(0, ratio);
  317. var _startratio = GD.getRatioWithRotation(-0.643501108793284, ratio),
  318. _endratio = GD.getRatioWithRotation(2.49809154479651, ratio);
  319. for(var i=0;i<Lib_紫黄双圆Node3points.length;i++){
  320. if(i%2==0){
  321. Lib_紫黄双圆Node3compspts.push(Lib_紫黄双圆Node3points[i]-Lib_紫黄双圆Node3rect.x);
  322. }else{
  323. Lib_紫黄双圆Node3compspts.push(Lib_紫黄双圆Node3points[i]-Lib_紫黄双圆Node3rect.y);
  324. }
  325. }
  326. var Lib_紫黄双圆Node3ptslength=Lib_紫黄双圆Node3compspts.length;
  327. if (Lib_紫黄双圆Node3rect.height === 0) {
  328. Lib_紫黄双圆Node3compspts[0] -= 0;
  329. Lib_紫黄双圆Node3compspts[Lib_紫黄双圆Node3ptslength-2] += 0;
  330. } else if (Lib_紫黄双圆Node3rect.width === 0){
  331. Lib_紫黄双圆Node3compspts[1] -= 0;
  332. Lib_紫黄双圆Node3compspts[Lib_紫黄双圆Node3ptslength-1] += 0;
  333. } else {
  334. Lib_紫黄双圆Node3compspts[0] -= 0;
  335. Lib_紫黄双圆Node3compspts[1] -= 0;
  336. Lib_紫黄双圆Node3compspts[Lib_紫黄双圆Node3ptslength-2] += 0;
  337. Lib_紫黄双圆Node3compspts[Lib_紫黄双圆Node3ptslength-1] += 0;
  338. }
  339. Lib_紫黄双圆Node3 = new ht.Node();
  340. Lib_紫黄双圆Node3.borderWidth = 2;
  341. Lib_紫黄双圆Node3rect.width = Lib_紫黄双圆Node3rect.width === 0 ? 0.0001 : Lib_紫黄双圆Node3rect.width;
  342. Lib_紫黄双圆Node3rect.height = Lib_紫黄双圆Node3rect.height === 0 ? 0.0001 : Lib_紫黄双圆Node3rect.height;
  343. var Lib_紫黄双圆Node3endCompspts = [Lib_紫黄双圆Node3compspts[Lib_紫黄双圆Node3ptslength-2],Lib_紫黄双圆Node3compspts[Lib_紫黄双圆Node3ptslength-1],0,0];
  344. var Lib_紫黄双圆Node3startCompspts = [Lib_紫黄双圆Node3compspts[0],Lib_紫黄双圆Node3compspts[1],0,0];
  345. Lib_紫黄双圆Node3.setImage(GD.getPolyLineJSON());
  346. Lib_紫黄双圆Node3.setPosition(Lib_紫黄双圆Node3rect.x+Lib_紫黄双圆Node3rect.width/2,Lib_紫黄双圆Node3rect.y+Lib_紫黄双圆Node3rect.height/2);
  347. Lib_紫黄双圆Node3.setSize(Lib_紫黄双圆Node3rect.width,Lib_紫黄双圆Node3rect.height);
  348. Lib_紫黄双圆Node3.setStyle("opacity",1);
  349. Lib_紫黄双圆Node3.s({'pixelPerfect':true});
  350. Lib_紫黄双圆Node3borderwidth=2;
  351. Lib_紫黄双圆Node3.setRotation(0);
  352. dataModel.add(Lib_紫黄双圆Node3);
  353. Lib_紫黄双圆Node3.a('node.points',Lib_紫黄双圆Node3compspts);
  354. Lib_紫黄双圆Node3.a('node.segments',[1,2]);
  355. Lib_紫黄双圆Node3.a('node.color','rgba(255,0,255,1)');
  356. Lib_紫黄双圆Node3.a('node.borderPattern',getDashStyle("@borderPattern@"));
  357. Lib_紫黄双圆Node3.a('node.borderColor','rgba(255,0,255,1)');
  358. Lib_紫黄双圆Node3.a('node.background','rgba(255,0,255,1)');
  359. Lib_紫黄双圆Node3.a('node.gradient','');
  360. Lib_紫黄双圆Node3.a('node.gradientcolor','rgba(255,0,255,1)');
  361. Lib_紫黄双圆Node3.a('node.endCompspts',Lib_紫黄双圆Node3endCompspts);
  362. Lib_紫黄双圆Node3.a('node.startCompspts',Lib_紫黄双圆Node3startCompspts);
  363. (function (node, img, compspts, endCompspts, startCompspts) {
  364. var position = node.getPosition(),
  365. w = node.getWidth()*_ratio.ratioX,
  366. h = node.getHeight()*_ratio.ratioY;
  367. function resetPoints(rx, ry) {
  368. for (var i = 0, len = compspts.length; i < len; i++) {
  369. if (i%2 === 0) {
  370. compspts[i]*=rx;
  371. } else {
  372. compspts[i]*=ry;
  373. }
  374. }
  375. endCompspts[0] = compspts[compspts.length-2];
  376. endCompspts[1] = compspts[compspts.length-1];
  377. endCompspts[2] *= rx;
  378. endCompspts[3] *= ry;
  379. node.a('node.offsetEndY', -(endCompspts[3]*0.5));
  380. node.a('node.offsetEndX', -(endCompspts[2]*0.5));
  381. startCompspts[0] = compspts[0];
  382. startCompspts[1] = compspts[1];
  383. startCompspts[2] *= rx;
  384. startCompspts[3] *= ry;
  385. node.a('node.offsetStartY', -(startCompspts[3]*0.5));
  386. node.a('node.offsetStartX', -(startCompspts[2]*0.5));
  387. node.a('node.endRotation', GD.calcRotationByStartAndEnd(compspts[i-4], compspts[i-3], compspts[i-2], compspts[i-1]));
  388. node.a('node.startRotation', GD.calcRotationByStartAndEnd(compspts[0], compspts[1], compspts[2], compspts[3]) + Math.PI);
  389. }
  390. node.setSize(w, h);
  391. node.setPosition(position.x * ratio.ratioX, position.y * ratio.ratioY);
  392. node.a('node.width', w);
  393. node.a('node.height', h);
  394. resetPoints(_ratio.ratioX, _ratio.ratioY);
  395. node.borderWidth = 2;
  396. node.a('node.borderwidth',node.borderWidth);
  397. node._nodename = 'Lib_紫黄双圆Node3';
  398. node._nodeType = 'line';
  399. zoomNodeList.push({
  400. node: node,
  401. attr: 'node.borderwidth'
  402. });
  403. var setWidth = node.setWidth,
  404. setHeight = node.setHeight,
  405. timer, rx = 1, ry = 1;
  406. node.setWidth = function (width) {
  407. var _width = this.getWidth();
  408. rx = width / _width;
  409. node.a('node.width', width);
  410. setWidth.apply(this, arguments);
  411. resetPoints(rx, 1);
  412. }
  413. node.setHeight = function (height) {
  414. var _height = this.getHeight();
  415. ry = height / _height;
  416. node.a('node.height', height);
  417. setHeight.apply(this, arguments);
  418. resetPoints(1, ry);
  419. }
  420. })(Lib_紫黄双圆Node3, Lib_紫黄双圆Node3.getImage(), Lib_紫黄双圆Node3compspts, Lib_紫黄双圆Node3endCompspts, Lib_紫黄双圆Node3startCompspts);
  421. var Lib_紫黄双圆Node4_0points=[0, 31,54, 0],
  422. Lib_紫黄双圆Node4_0rect=ht.Default.unionPoint([{x:0,y:31},{x:54,y:0}]),
  423. Lib_紫黄双圆Node4_0compspts=[];
  424. _ratio = GD.getRatioWithRotation(0, ratio);
  425. var _startratio = GD.getRatioWithRotation(2.620454498483, ratio),
  426. _endratio = GD.getRatioWithRotation(-0.521138155106793, ratio);
  427. for(var i=0;i<Lib_紫黄双圆Node4_0points.length;i++){
  428. if(i%2==0){
  429. Lib_紫黄双圆Node4_0compspts.push(Lib_紫黄双圆Node4_0points[i]-Lib_紫黄双圆Node4_0rect.x);
  430. }else{
  431. Lib_紫黄双圆Node4_0compspts.push(Lib_紫黄双圆Node4_0points[i]-Lib_紫黄双圆Node4_0rect.y);
  432. }
  433. }
  434. var Lib_紫黄双圆Node4_0ptslength=Lib_紫黄双圆Node4_0compspts.length;
  435. if (Lib_紫黄双圆Node4_0rect.height === 0) {
  436. Lib_紫黄双圆Node4_0compspts[0] -= 0;
  437. Lib_紫黄双圆Node4_0compspts[Lib_紫黄双圆Node4_0ptslength-2] += 0;
  438. } else if (Lib_紫黄双圆Node4_0rect.width === 0){
  439. Lib_紫黄双圆Node4_0compspts[1] -= 0;
  440. Lib_紫黄双圆Node4_0compspts[Lib_紫黄双圆Node4_0ptslength-1] += 0;
  441. } else {
  442. Lib_紫黄双圆Node4_0compspts[0] -= 0;
  443. Lib_紫黄双圆Node4_0compspts[1] -= 0;
  444. Lib_紫黄双圆Node4_0compspts[Lib_紫黄双圆Node4_0ptslength-2] += 0;
  445. Lib_紫黄双圆Node4_0compspts[Lib_紫黄双圆Node4_0ptslength-1] += 0;
  446. }
  447. Lib_紫黄双圆Node4_0 = new ht.Node();
  448. Lib_紫黄双圆Node4_0.borderWidth = 2;
  449. Lib_紫黄双圆Node4_0rect.width = Lib_紫黄双圆Node4_0rect.width === 0 ? 0.0001 : Lib_紫黄双圆Node4_0rect.width;
  450. Lib_紫黄双圆Node4_0rect.height = Lib_紫黄双圆Node4_0rect.height === 0 ? 0.0001 : Lib_紫黄双圆Node4_0rect.height;
  451. var Lib_紫黄双圆Node4_0endCompspts = [Lib_紫黄双圆Node4_0compspts[Lib_紫黄双圆Node4_0ptslength-2],Lib_紫黄双圆Node4_0compspts[Lib_紫黄双圆Node4_0ptslength-1],0,0];
  452. var Lib_紫黄双圆Node4_0startCompspts = [Lib_紫黄双圆Node4_0compspts[0],Lib_紫黄双圆Node4_0compspts[1],0,0];
  453. Lib_紫黄双圆Node4_0.setImage(GD.getPolyLineJSON());
  454. Lib_紫黄双圆Node4_0.setPosition(Lib_紫黄双圆Node4_0rect.x+Lib_紫黄双圆Node4_0rect.width/2,Lib_紫黄双圆Node4_0rect.y+Lib_紫黄双圆Node4_0rect.height/2);
  455. Lib_紫黄双圆Node4_0.setSize(Lib_紫黄双圆Node4_0rect.width,Lib_紫黄双圆Node4_0rect.height);
  456. Lib_紫黄双圆Node4_0.setStyle("opacity",1);
  457. Lib_紫黄双圆Node4_0.s({'pixelPerfect':true});
  458. Lib_紫黄双圆Node4_0borderwidth=2;
  459. Lib_紫黄双圆Node4_0.setRotation(0);
  460. dataModel.add(Lib_紫黄双圆Node4_0);
  461. Lib_紫黄双圆Node4_0.a('node.points',Lib_紫黄双圆Node4_0compspts);
  462. Lib_紫黄双圆Node4_0.a('node.segments',[1,2]);
  463. Lib_紫黄双圆Node4_0.a('node.color','rgba(255,0,255,1)');
  464. Lib_紫黄双圆Node4_0.a('node.borderPattern',getDashStyle("@borderPattern@"));
  465. Lib_紫黄双圆Node4_0.a('node.borderColor','rgba(255,0,255,1)');
  466. Lib_紫黄双圆Node4_0.a('node.background','rgba(255,0,255,1)');
  467. Lib_紫黄双圆Node4_0.a('node.gradient','');
  468. Lib_紫黄双圆Node4_0.a('node.gradientcolor','rgba(255,0,255,1)');
  469. Lib_紫黄双圆Node4_0.a('node.endCompspts',Lib_紫黄双圆Node4_0endCompspts);
  470. Lib_紫黄双圆Node4_0.a('node.startCompspts',Lib_紫黄双圆Node4_0startCompspts);
  471. (function (node, img, compspts, endCompspts, startCompspts) {
  472. var position = node.getPosition(),
  473. w = node.getWidth()*_ratio.ratioX,
  474. h = node.getHeight()*_ratio.ratioY;
  475. function resetPoints(rx, ry) {
  476. for (var i = 0, len = compspts.length; i < len; i++) {
  477. if (i%2 === 0) {
  478. compspts[i]*=rx;
  479. } else {
  480. compspts[i]*=ry;
  481. }
  482. }
  483. endCompspts[0] = compspts[compspts.length-2];
  484. endCompspts[1] = compspts[compspts.length-1];
  485. endCompspts[2] *= rx;
  486. endCompspts[3] *= ry;
  487. node.a('node.offsetEndY', -(endCompspts[3]*0.5));
  488. node.a('node.offsetEndX', -(endCompspts[2]*0.5));
  489. startCompspts[0] = compspts[0];
  490. startCompspts[1] = compspts[1];
  491. startCompspts[2] *= rx;
  492. startCompspts[3] *= ry;
  493. node.a('node.offsetStartY', -(startCompspts[3]*0.5));
  494. node.a('node.offsetStartX', -(startCompspts[2]*0.5));
  495. node.a('node.endRotation', GD.calcRotationByStartAndEnd(compspts[i-4], compspts[i-3], compspts[i-2], compspts[i-1]));
  496. node.a('node.startRotation', GD.calcRotationByStartAndEnd(compspts[0], compspts[1], compspts[2], compspts[3]) + Math.PI);
  497. }
  498. node.setSize(w, h);
  499. node.setPosition(position.x * ratio.ratioX, position.y * ratio.ratioY);
  500. node.a('node.width', w);
  501. node.a('node.height', h);
  502. resetPoints(_ratio.ratioX, _ratio.ratioY);
  503. node.borderWidth = 2;
  504. node.a('node.borderwidth',node.borderWidth);
  505. node._nodename = 'Lib_紫黄双圆Node4_0';
  506. node._nodeType = 'line';
  507. zoomNodeList.push({
  508. node: node,
  509. attr: 'node.borderwidth'
  510. });
  511. var setWidth = node.setWidth,
  512. setHeight = node.setHeight,
  513. timer, rx = 1, ry = 1;
  514. node.setWidth = function (width) {
  515. var _width = this.getWidth();
  516. rx = width / _width;
  517. node.a('node.width', width);
  518. setWidth.apply(this, arguments);
  519. resetPoints(rx, 1);
  520. }
  521. node.setHeight = function (height) {
  522. var _height = this.getHeight();
  523. ry = height / _height;
  524. node.a('node.height', height);
  525. setHeight.apply(this, arguments);
  526. resetPoints(1, ry);
  527. }
  528. })(Lib_紫黄双圆Node4_0, Lib_紫黄双圆Node4_0.getImage(), Lib_紫黄双圆Node4_0compspts, Lib_紫黄双圆Node4_0endCompspts, Lib_紫黄双圆Node4_0startCompspts);
  529. var Lib_紫黄双圆Node4_1rect=ht.Default.unionPoint([{x: 46, y: -2},{x: 46, y: -2},{x: 55, y: -2},{x: 50, y: 7}]),
  530. Lib_紫黄双圆Node4_1points=[46,-2,46,-2,55,-2,50,7],
  531. Lib_紫黄双圆Node4_1compsPoints=[],
  532. Lib_紫黄双圆Node4_1SetPoints = [{x: 46, y: -2},{x: 46, y: -2},{x: 55, y: -2},{x: 50, y: 7}],
  533. Lib_紫黄双圆Node4_1setSegments = [1,2,2,2];
  534. _ratio = GD.getRatioWithRotation(4.101523, ratio);
  535. for(var i=0;i<Lib_紫黄双圆Node4_1points.length;i++){
  536. if(i%2==0){
  537. Lib_紫黄双圆Node4_1compsPoints.push(Lib_紫黄双圆Node4_1points[i]-Lib_紫黄双圆Node4_1rect.x);
  538. }else{
  539. Lib_紫黄双圆Node4_1compsPoints.push(Lib_紫黄双圆Node4_1points[i]-Lib_紫黄双圆Node4_1rect.y);
  540. }
  541. }
  542. var Lib_紫黄双圆Node4_1 = new ht.Node();
  543. Lib_紫黄双圆Node4_1.setImage(GD.getPolyGonJSON());
  544. Lib_紫黄双圆Node4_1.setPosition(Lib_紫黄双圆Node4_1rect.x + Lib_紫黄双圆Node4_1rect.width/2, Lib_紫黄双圆Node4_1rect.y + Lib_紫黄双圆Node4_1rect.height/2);
  545. Lib_紫黄双圆Node4_1.setSize(Lib_紫黄双圆Node4_1rect.width, Lib_紫黄双圆Node4_1rect.height);
  546. Lib_紫黄双圆Node4_1.setRotation(4.101523);
  547. Lib_紫黄双圆Node4_1.borderWidth=2;
  548. Lib_紫黄双圆Node4_1.borderFillwidth=2*2;
  549. Lib_紫黄双圆Node4_1.s({'pixelPerfect':true});
  550. dataModel.add(Lib_紫黄双圆Node4_1);
  551. // Lib_紫黄双圆Node4_1.a('node.width', Lib_紫黄双圆Node4_1rect.width*_ratio.ratioX);
  552. // Lib_紫黄双圆Node4_1.a('node.height', Lib_紫黄双圆Node4_1rect.height*_ratio.ratioY);
  553. Lib_紫黄双圆Node4_1.a('node.clip', function(g,width,height,data) {
  554. var clippoints = Lib_紫黄双圆Node4_1SetPoints;
  555. if(clippoints.length<=3) return;
  556. if(Lib_紫黄双圆Node4_1.a('Lib_紫黄双圆Node4_1.isFill')=="false") return;
  557. var clipcompsPoints=[];
  558. var rect = ht.Default.unionPoint(clippoints);
  559. for(var i=0;i<clippoints.length;i++){
  560. clipcompsPoints.push({x:clippoints[i].x-rect.x,y:clippoints[i].y-rect.y});
  561. }
  562. var clipsegments=Lib_紫黄双圆Node4_1setSegments;
  563. g.beginPath();
  564. drawPoints(g,clipcompsPoints,clipsegments);
  565. g.clip();
  566. })
  567. Lib_紫黄双圆Node4_1.a('node.type', 'shape');
  568. Lib_紫黄双圆Node4_1.a('node.comsPoints', Lib_紫黄双圆Node4_1compsPoints);
  569. Lib_紫黄双圆Node4_1.a('node.closePath', true);
  570. Lib_紫黄双圆Node4_1.a('node.borderwidth', 2);
  571. Lib_紫黄双圆Node4_1.a('node.color', 'rgba(255,0,255,1)');
  572. Lib_紫黄双圆Node4_1.a('node.background','rgba(255,0,255,1)');
  573. Lib_紫黄双圆Node4_1.a('node.closePath', true);
  574. Lib_紫黄双圆Node4_1.a('node.closePath', true);
  575. Lib_紫黄双圆Node4_1.a('node.gradient','');
  576. Lib_紫黄双圆Node4_1.a('node.gradientcolor','rgba(255,0,255,1)');
  577. Lib_紫黄双圆Node4_1.a('node.isFill','false');
  578. Lib_紫黄双圆Node4_1.a('node.original',[0,0,0,0]);
  579. Lib_紫黄双圆Node4_1.a('node.fillrect',[0,0,0,0]);
  580. Lib_紫黄双圆Node4_1.a('node.fillbackcolor','rgba(255,0,255,1)');
  581. Lib_紫黄双圆Node4_1.a('node.fillgradient','');
  582. Lib_紫黄双圆Node4_1.a('node.fillgradientcolor','rgba(255,0,255,1)');
  583. Lib_紫黄双圆Node4_1.a('node.segments',Lib_紫黄双圆Node4_1setSegments);
  584. Lib_紫黄双圆Node4_1.a('node.borderPattern',"");
  585. (function (node, nodecompsPoints, setPoints) {
  586. var w = node.getWidth()*_ratio.ratioX,
  587. h = node.getHeight()*_ratio.ratioY,
  588. img = node.getImage();
  589. function resetPoints(rx, ry) {
  590. for (var i = 0, len = nodecompsPoints.length; i < len; i++) {
  591. if (i%2 === 0) {
  592. nodecompsPoints[i]*=rx;
  593. } else {
  594. nodecompsPoints[i]*=ry;
  595. }
  596. if (setPoints[i]) {
  597. setPoints[i].x *= rx;
  598. setPoints[i].y *= ry;
  599. }
  600. }
  601. }
  602. node.setSize(w, h);
  603. node.a('node.width', w);
  604. node.a('node.height', h);
  605. resetPoints(_ratio.ratioX, _ratio.ratioY);
  606. var position = node.getPosition();
  607. node.setPosition(position.x * ratio.ratioX, position.y * ratio.ratioY);
  608. node._nodename = 'Lib_紫黄双圆Node4_1';
  609. node._nodeType = 'polygon';
  610. zoomNodeList.push({
  611. node: node,
  612. attr: 'node.borderwidth'
  613. });
  614. // 重载setWidth, setHeight
  615. var setWidth = node.setWidth,
  616. setHeight = node.setHeight,
  617. timer, rx = 1, ry = 1;
  618. node.setWidth = function (width) {
  619. var _width = this.getWidth();
  620. rx = width / _width;
  621. node.a('node.width', width);
  622. setWidth.apply(this, arguments);
  623. resetPoints(rx, 1);
  624. }
  625. node.setHeight = function (height) {
  626. var _height = this.getHeight();
  627. ry = height / _height;
  628. node.a('node.height', height);
  629. setHeight.apply(this, arguments);
  630. resetPoints(1, ry);
  631. }
  632. })(Lib_紫黄双圆Node4_1, Lib_紫黄双圆Node4_1compsPoints, Lib_紫黄双圆Node4_1SetPoints );
  633. _ratio = GD.getRatioWithRotation(0*Math.PI/180, ratio);
  634. var Lib_紫黄双圆Node5_0type = 'oval';
  635. var Lib_紫黄双圆Node5_0 = new ht.Node(),
  636. Lib_紫黄双圆Node5_0BorderWidth = 2*2;
  637. if (Lib_紫黄双圆Node5_0type === 'arc') {
  638. Lib_紫黄双圆Node5_0BorderWidth *= 2;
  639. }
  640. Lib_紫黄双圆Node5_0.setImage(GD.getRectJSON(29.84119*_ratio.ratioX, 26.18182*_ratio.ratioY, Lib_紫黄双圆Node5_0type, '@arcFrom@', '@arcTo@', '@arcClose@'));
  641. Lib_紫黄双圆Node5_0.setPosition(25*ratio.ratioX, 39*ratio.ratioY);
  642. Lib_紫黄双圆Node5_0.setSize(29.84119*_ratio.ratioX, 26.18182*_ratio.ratioY);
  643. Lib_紫黄双圆Node5_0.s({
  644. 'pixelPerfect':true
  645. /*@AddPara@*/
  646. });
  647. Lib_紫黄双圆Node5_0.a('node.width', 29.84119*_ratio.ratioX);
  648. Lib_紫黄双圆Node5_0.a('node.height', 26.18182*_ratio.ratioY);
  649. Lib_紫黄双圆Node5_0.a('node.type', Lib_紫黄双圆Node5_0type);
  650. Lib_紫黄双圆Node5_0.a('node.rect', [0, 0, 29.84119*_ratio.ratioX, 26.18182*_ratio.ratioY]);
  651. Lib_紫黄双圆Node5_0.a('node.background', 'rgba(255,255,255,0.003921569)');
  652. Lib_紫黄双圆Node5_0.a('node.gradientcolor', '');
  653. Lib_紫黄双圆Node5_0.a('node.gradient', '');
  654. Lib_紫黄双圆Node5_0.a('node.borderwidth', Lib_紫黄双圆Node5_0BorderWidth);
  655. Lib_紫黄双圆Node5_0.a('node.color', 'rgba(255,128,0,1)');
  656. Lib_紫黄双圆Node5_0.a('node.fillrect', [0,0,0,0]);
  657. Lib_紫黄双圆Node5_0.a('node.fillbackcolor', 'rgba(0,0,0,0)');
  658. Lib_紫黄双圆Node5_0.a('node.fillgradientcolor', 'rgba(0,0,0,0)');
  659. Lib_紫黄双圆Node5_0.a('node.fillgradient', '');
  660. if (Lib_紫黄双圆Node5_0type !== 'rect') {
  661. Lib_紫黄双圆Node5_0.a('node.arcFrom', parseFloat('@arcFrom@'));
  662. Lib_紫黄双圆Node5_0.a('node.arcTo', parseFloat('@arcTo@'));
  663. Lib_紫黄双圆Node5_0.a('node.arcClose', '@arcClose@' === 'true' ? true : false);
  664. }
  665. if (Lib_紫黄双圆Node5_0type === 'arc') {
  666. Lib_紫黄双圆Node5_0.a('node.arcOval', true);
  667. }
  668. Lib_紫黄双圆Node5_0.setRotation(0*Math.PI/180);
  669. Lib_紫黄双圆Node5_0.borderWidth = Lib_紫黄双圆Node5_0BorderWidth;
  670. Lib_紫黄双圆Node5_0.borderFillwidth = Lib_紫黄双圆Node5_0BorderWidth;
  671. dataModel.add(Lib_紫黄双圆Node5_0);
  672. Lib_紫黄双圆Node5_0._nodename = 'Lib_紫黄双圆Node5_0'
  673. Lib_紫黄双圆Node5_0._nodeType = 'rect';
  674. zoomNodeList.push({
  675. node: Lib_紫黄双圆Node5_0,
  676. attr: 'node.borderwidth'
  677. });
  678. (function (node, _img) {
  679. var setWidth = node.setWidth,
  680. setHeight = node.setHeight;
  681. node.setWidth = function (width) {
  682. if (width === this.getWidth()) return ;
  683. var height = this.getHeight();
  684. this.a('node.width', width);
  685. this.a('node.rect', [0,0,width, height]);
  686. setWidth.apply(this, arguments);
  687. }
  688. node.setHeight = function (height) {
  689. if (height === this.getHeight()) return ;
  690. var width = this.getWidth();
  691. this.a('node.height', height);
  692. this.a('node.rect', [0,0,width, height]);
  693. setHeight.apply(this, arguments);
  694. }
  695. })(Lib_紫黄双圆Node5_0, Lib_紫黄双圆Node5_0.getImage());var Lib_紫黄双圆Node5_1rect=ht.Default.unionPoint([{x: 21, y: 32},{x: 21, y: 32},{x: 32, y: 32},{x: 26, y: 44}]),
  696. Lib_紫黄双圆Node5_1points=[21,32,21,32,32,32,26,44],
  697. Lib_紫黄双圆Node5_1compsPoints=[],
  698. Lib_紫黄双圆Node5_1SetPoints = [{x: 21, y: 32},{x: 21, y: 32},{x: 32, y: 32},{x: 26, y: 44}],
  699. Lib_紫黄双圆Node5_1setSegments = [1,2,2,2];
  700. _ratio = GD.getRatioWithRotation(4.712389, ratio);
  701. for(var i=0;i<Lib_紫黄双圆Node5_1points.length;i++){
  702. if(i%2==0){
  703. Lib_紫黄双圆Node5_1compsPoints.push(Lib_紫黄双圆Node5_1points[i]-Lib_紫黄双圆Node5_1rect.x);
  704. }else{
  705. Lib_紫黄双圆Node5_1compsPoints.push(Lib_紫黄双圆Node5_1points[i]-Lib_紫黄双圆Node5_1rect.y);
  706. }
  707. }
  708. var Lib_紫黄双圆Node5_1 = new ht.Node();
  709. Lib_紫黄双圆Node5_1.setImage(GD.getPolyGonJSON());
  710. Lib_紫黄双圆Node5_1.setPosition(Lib_紫黄双圆Node5_1rect.x + Lib_紫黄双圆Node5_1rect.width/2, Lib_紫黄双圆Node5_1rect.y + Lib_紫黄双圆Node5_1rect.height/2);
  711. Lib_紫黄双圆Node5_1.setSize(Lib_紫黄双圆Node5_1rect.width, Lib_紫黄双圆Node5_1rect.height);
  712. Lib_紫黄双圆Node5_1.setRotation(4.712389);
  713. Lib_紫黄双圆Node5_1.borderWidth=2;
  714. Lib_紫黄双圆Node5_1.borderFillwidth=2*2;
  715. Lib_紫黄双圆Node5_1.s({'pixelPerfect':true});
  716. dataModel.add(Lib_紫黄双圆Node5_1);
  717. // Lib_紫黄双圆Node5_1.a('node.width', Lib_紫黄双圆Node5_1rect.width*_ratio.ratioX);
  718. // Lib_紫黄双圆Node5_1.a('node.height', Lib_紫黄双圆Node5_1rect.height*_ratio.ratioY);
  719. Lib_紫黄双圆Node5_1.a('node.clip', function(g,width,height,data) {
  720. var clippoints = Lib_紫黄双圆Node5_1SetPoints;
  721. if(clippoints.length<=3) return;
  722. if(Lib_紫黄双圆Node5_1.a('Lib_紫黄双圆Node5_1.isFill')=="false") return;
  723. var clipcompsPoints=[];
  724. var rect = ht.Default.unionPoint(clippoints);
  725. for(var i=0;i<clippoints.length;i++){
  726. clipcompsPoints.push({x:clippoints[i].x-rect.x,y:clippoints[i].y-rect.y});
  727. }
  728. var clipsegments=Lib_紫黄双圆Node5_1setSegments;
  729. g.beginPath();
  730. drawPoints(g,clipcompsPoints,clipsegments);
  731. g.clip();
  732. })
  733. Lib_紫黄双圆Node5_1.a('node.type', 'shape');
  734. Lib_紫黄双圆Node5_1.a('node.comsPoints', Lib_紫黄双圆Node5_1compsPoints);
  735. Lib_紫黄双圆Node5_1.a('node.closePath', true);
  736. Lib_紫黄双圆Node5_1.a('node.borderwidth', 2);
  737. Lib_紫黄双圆Node5_1.a('node.color', 'rgba(255,128,0,1)');
  738. Lib_紫黄双圆Node5_1.a('node.background','rgba(255,255,255,0.003921569)');
  739. Lib_紫黄双圆Node5_1.a('node.closePath', true);
  740. Lib_紫黄双圆Node5_1.a('node.closePath', true);
  741. Lib_紫黄双圆Node5_1.a('node.gradient','');
  742. Lib_紫黄双圆Node5_1.a('node.gradientcolor','');
  743. Lib_紫黄双圆Node5_1.a('node.isFill','false');
  744. Lib_紫黄双圆Node5_1.a('node.original',[0,0,0,0]);
  745. Lib_紫黄双圆Node5_1.a('node.fillrect',[0,0,0,0]);
  746. Lib_紫黄双圆Node5_1.a('node.fillbackcolor','rgba(255,255,255,0.003921569)');
  747. Lib_紫黄双圆Node5_1.a('node.fillgradient','');
  748. Lib_紫黄双圆Node5_1.a('node.fillgradientcolor','');
  749. Lib_紫黄双圆Node5_1.a('node.segments',Lib_紫黄双圆Node5_1setSegments);
  750. Lib_紫黄双圆Node5_1.a('node.borderPattern',"");
  751. (function (node, nodecompsPoints, setPoints) {
  752. var w = node.getWidth()*_ratio.ratioX,
  753. h = node.getHeight()*_ratio.ratioY,
  754. img = node.getImage();
  755. function resetPoints(rx, ry) {
  756. for (var i = 0, len = nodecompsPoints.length; i < len; i++) {
  757. if (i%2 === 0) {
  758. nodecompsPoints[i]*=rx;
  759. } else {
  760. nodecompsPoints[i]*=ry;
  761. }
  762. if (setPoints[i]) {
  763. setPoints[i].x *= rx;
  764. setPoints[i].y *= ry;
  765. }
  766. }
  767. }
  768. node.setSize(w, h);
  769. node.a('node.width', w);
  770. node.a('node.height', h);
  771. resetPoints(_ratio.ratioX, _ratio.ratioY);
  772. var position = node.getPosition();
  773. node.setPosition(position.x * ratio.ratioX, position.y * ratio.ratioY);
  774. node._nodename = 'Lib_紫黄双圆Node5_1';
  775. node._nodeType = 'polygon';
  776. zoomNodeList.push({
  777. node: node,
  778. attr: 'node.borderwidth'
  779. });
  780. // 重载setWidth, setHeight
  781. var setWidth = node.setWidth,
  782. setHeight = node.setHeight,
  783. timer, rx = 1, ry = 1;
  784. node.setWidth = function (width) {
  785. var _width = this.getWidth();
  786. rx = width / _width;
  787. node.a('node.width', width);
  788. setWidth.apply(this, arguments);
  789. resetPoints(rx, 1);
  790. }
  791. node.setHeight = function (height) {
  792. var _height = this.getHeight();
  793. ry = height / _height;
  794. node.a('node.height', height);
  795. setHeight.apply(this, arguments);
  796. resetPoints(1, ry);
  797. }
  798. })(Lib_紫黄双圆Node5_1, Lib_紫黄双圆Node5_1compsPoints, Lib_紫黄双圆Node5_1SetPoints );
  799. /*@GraphList@*/
  800. /*@PageInit@*/
  801. var localVarObj = this.localVarObj;
  802. var localDynamicVarObj = this.localDynamicVar();
  803. this['Lib_紫黄双圆Node0'] = Lib_紫黄双圆Node0;
  804. Lib_紫黄双圆Node0.__parentLib = nodename;
  805. Lib_紫黄双圆Node0.__parent = this;
  806. this.childNodes.push(Lib_紫黄双圆Node0);
  807. this['Lib_紫黄双圆Node1'] = Lib_紫黄双圆Node1;
  808. Lib_紫黄双圆Node1.__parentLib = nodename;
  809. Lib_紫黄双圆Node1.__parent = this;
  810. this.childNodes.push(Lib_紫黄双圆Node1);
  811. this['Lib_紫黄双圆Node2'] = Lib_紫黄双圆Node2;
  812. Lib_紫黄双圆Node2.__parentLib = nodename;
  813. Lib_紫黄双圆Node2.__parent = this;
  814. this.childNodes.push(Lib_紫黄双圆Node2);
  815. this['Lib_紫黄双圆Node3'] = Lib_紫黄双圆Node3;
  816. Lib_紫黄双圆Node3.__parentLib = nodename;
  817. Lib_紫黄双圆Node3.__parent = this;
  818. this.childNodes.push(Lib_紫黄双圆Node3);
  819. this['Lib_紫黄双圆Node4_0'] = Lib_紫黄双圆Node4_0;
  820. Lib_紫黄双圆Node4_0.__parentLib = nodename;
  821. Lib_紫黄双圆Node4_0.__parent = this;
  822. this.childNodes.push(Lib_紫黄双圆Node4_0);
  823. this['Lib_紫黄双圆Node4_1'] = Lib_紫黄双圆Node4_1;
  824. Lib_紫黄双圆Node4_1.__parentLib = nodename;
  825. Lib_紫黄双圆Node4_1.__parent = this;
  826. this.childNodes.push(Lib_紫黄双圆Node4_1);
  827. this['Lib_紫黄双圆Node5_0'] = Lib_紫黄双圆Node5_0;
  828. Lib_紫黄双圆Node5_0.__parentLib = nodename;
  829. Lib_紫黄双圆Node5_0.__parent = this;
  830. this.childNodes.push(Lib_紫黄双圆Node5_0);
  831. this['Lib_紫黄双圆Node5_1'] = Lib_紫黄双圆Node5_1;
  832. Lib_紫黄双圆Node5_1.__parentLib = nodename;
  833. Lib_紫黄双圆Node5_1.__parent = this;
  834. this.childNodes.push(Lib_紫黄双圆Node5_1);
  835. /*@ControlContextMenu@*/
  836. /*@Declare@*/
  837. this.init(x, y, width, height, angle);
  838. };
  839. ht.Default.def('ht.lib.紫黄双圆', Object, {
  840. refresh10ms: function () {
  841. var localVarObj = this.localVarObj;
  842. var localDynamicVarObj = this.localDynamicVar();
  843. var Lib_紫黄双圆Node0= this.Lib_紫黄双圆Node0;
  844. var Lib_紫黄双圆Node1= this.Lib_紫黄双圆Node1;
  845. var Lib_紫黄双圆Node2= this.Lib_紫黄双圆Node2;
  846. var Lib_紫黄双圆Node3= this.Lib_紫黄双圆Node3;
  847. var Lib_紫黄双圆Node4_0= this.Lib_紫黄双圆Node4_0;
  848. var Lib_紫黄双圆Node4_1= this.Lib_紫黄双圆Node4_1;
  849. var Lib_紫黄双圆Node5_0= this.Lib_紫黄双圆Node5_0;
  850. var Lib_紫黄双圆Node5_1= this.Lib_紫黄双圆Node5_1;
  851. /*@refresh10ms@*/
  852. },
  853. refresh100ms: function () {
  854. var localVarObj = this.localVarObj;
  855. var localDynamicVarObj = this.localDynamicVar();
  856. var Lib_紫黄双圆Node0= this.Lib_紫黄双圆Node0;
  857. var Lib_紫黄双圆Node1= this.Lib_紫黄双圆Node1;
  858. var Lib_紫黄双圆Node2= this.Lib_紫黄双圆Node2;
  859. var Lib_紫黄双圆Node3= this.Lib_紫黄双圆Node3;
  860. var Lib_紫黄双圆Node4_0= this.Lib_紫黄双圆Node4_0;
  861. var Lib_紫黄双圆Node4_1= this.Lib_紫黄双圆Node4_1;
  862. var Lib_紫黄双圆Node5_0= this.Lib_紫黄双圆Node5_0;
  863. var Lib_紫黄双圆Node5_1= this.Lib_紫黄双圆Node5_1;
  864. /*@refresh100ms@*/
  865. },
  866. refresh500ms: function () {
  867. var localVarObj = this.localVarObj;
  868. var localDynamicVarObj = this.localDynamicVar();
  869. var Lib_紫黄双圆Node0= this.Lib_紫黄双圆Node0;
  870. var Lib_紫黄双圆Node1= this.Lib_紫黄双圆Node1;
  871. var Lib_紫黄双圆Node2= this.Lib_紫黄双圆Node2;
  872. var Lib_紫黄双圆Node3= this.Lib_紫黄双圆Node3;
  873. var Lib_紫黄双圆Node4_0= this.Lib_紫黄双圆Node4_0;
  874. var Lib_紫黄双圆Node4_1= this.Lib_紫黄双圆Node4_1;
  875. var Lib_紫黄双圆Node5_0= this.Lib_紫黄双圆Node5_0;
  876. var Lib_紫黄双圆Node5_1= this.Lib_紫黄双圆Node5_1;
  877. /*@refresh500ms@*/
  878. },
  879. refresh1s: function () {
  880. var Counter1s = arguments[0] || 0;
  881. var localVarObj = this.localVarObj;
  882. var localDynamicVarObj = this.localDynamicVar();
  883. var Lib_紫黄双圆Node0= this.Lib_紫黄双圆Node0;
  884. var Lib_紫黄双圆Node1= this.Lib_紫黄双圆Node1;
  885. var Lib_紫黄双圆Node2= this.Lib_紫黄双圆Node2;
  886. var Lib_紫黄双圆Node3= this.Lib_紫黄双圆Node3;
  887. var Lib_紫黄双圆Node4_0= this.Lib_紫黄双圆Node4_0;
  888. var Lib_紫黄双圆Node4_1= this.Lib_紫黄双圆Node4_1;
  889. var Lib_紫黄双圆Node5_0= this.Lib_紫黄双圆Node5_0;
  890. var Lib_紫黄双圆Node5_1= this.Lib_紫黄双圆Node5_1;
  891. /*@refresh1s@*/
  892. },
  893. refresh5s: function () {
  894. var localVarObj = this.localVarObj;
  895. var localDynamicVarObj = this.localDynamicVar();
  896. var Lib_紫黄双圆Node0= this.Lib_紫黄双圆Node0;
  897. var Lib_紫黄双圆Node1= this.Lib_紫黄双圆Node1;
  898. var Lib_紫黄双圆Node2= this.Lib_紫黄双圆Node2;
  899. var Lib_紫黄双圆Node3= this.Lib_紫黄双圆Node3;
  900. var Lib_紫黄双圆Node4_0= this.Lib_紫黄双圆Node4_0;
  901. var Lib_紫黄双圆Node4_1= this.Lib_紫黄双圆Node4_1;
  902. var Lib_紫黄双圆Node5_0= this.Lib_紫黄双圆Node5_0;
  903. var Lib_紫黄双圆Node5_1= this.Lib_紫黄双圆Node5_1;
  904. /*@refresh5s@*/
  905. },
  906. /*@PageDynamic@*/
  907. onEvent: function (e, data, type, origin, offset, objMouseOn, ctm) {
  908. var localVarObj = this.localVarObj;
  909. var localDynamicVarObj = this.localDynamicVar();
  910. var Lib_紫黄双圆Node0= this.Lib_紫黄双圆Node0;
  911. var Lib_紫黄双圆Node1= this.Lib_紫黄双圆Node1;
  912. var Lib_紫黄双圆Node2= this.Lib_紫黄双圆Node2;
  913. var Lib_紫黄双圆Node3= this.Lib_紫黄双圆Node3;
  914. var Lib_紫黄双圆Node4_0= this.Lib_紫黄双圆Node4_0;
  915. var Lib_紫黄双圆Node4_1= this.Lib_紫黄双圆Node4_1;
  916. var Lib_紫黄双圆Node5_0= this.Lib_紫黄双圆Node5_0;
  917. var Lib_紫黄双圆Node5_1= this.Lib_紫黄双圆Node5_1;
  918. if (type === 'click') {
  919. /*@EvnentClicked@*/
  920. } else if (type === 'mousedown') {
  921. mouseX=e.clientX;
  922. mouseY=e.clientY;
  923. /*@EvnentMouseDown@*/
  924. } else if (type === 'mouseup') {
  925. /*@EvnentMouseUp@*/
  926. } else if (type === 'mousemove') {
  927. var mouseX, mouseY, position, zoom;
  928. position=origin.getLogicalPoint(e);
  929. zoom = graphView.getZoom();
  930. if (origin === graphView) {
  931. mouseX= position.x + origin.tx();
  932. mouseY = position.y + origin.ty();
  933. } else {
  934. offset = offset || {x: 0, y: 0};
  935. mouseX = position.x / zoom + offset.x + origin.tx();
  936. mouseY = position.y / zoom + offset.y + origin.ty();
  937. }
  938. /*@EvnentMouseLeave@*/
  939. /*@EvnentMouseOver@*/
  940. } else if (type === 'keydown') {
  941. /*@EvnentKeyDown@*/
  942. } else if (type === 'contextmenu') {
  943. /*@Declare@*/
  944. /*@SetNodeContextMenu@*/
  945. /*@SetPageContextMenu@*/
  946. }
  947. /*@LibEvent@*/
  948. },
  949. getBaseClass: function () {
  950. return this._baseClass;
  951. },
  952. getWidth: function () {
  953. return this._width;
  954. },
  955. getHeight: function () {
  956. return this._height;
  957. },
  958. getSize: function () {
  959. return {
  960. width: this._width,
  961. height: this._height
  962. }
  963. },
  964. setWidth: function (width) {
  965. if (width === undefined || width === null || width != width) {
  966. return ;
  967. }
  968. var originWidth = this._width;
  969. var ratio = width / originWidth;
  970. var childNodes = this.childNodes, childNode, p, op = this.getPosition(), w, cw, ox, rotation = this.getRotation();
  971. for (var i = 0, len = childNodes.length; i < len; i++) {
  972. childNode = childNodes[i];
  973. p = childNode.getPosition();
  974. cw = childNode.getWidth();
  975. w = cw >=2 ? cw * ratio : cw;
  976. childNode.setWidth(w);
  977. ox = op.x + (p.x - op.x) * ratio;
  978. childNode.setPosition(ox, p.y);
  979. rotation = GD.calcRotation(rotation);
  980. if (rotation === 0 || rotation === Math.PI) {
  981. // 图元未旋转
  982. ox = op.x + (p.x - op.x)*ratio;
  983. childNode.setPosition(ox, p.y);
  984. } else if (rotation === 90 * Math.PI / 180) {
  985. // 图元旋转以后
  986. ox = op.y + (p.y - op.y)*ratio;
  987. childNode.setPosition(p.x, ox);
  988. }
  989. }
  990. this._width = width;
  991. this._originWidth = width;
  992. this._ratioX = ratio;
  993. return this;
  994. },
  995. setHeight: function (height) {
  996. if (height === undefined || height === null || height != height) {
  997. return ;
  998. }
  999. var originHeight = this._height;
  1000. var ratio = height / originHeight;
  1001. var childNodes = this.childNodes, childNode, p, op = this.getPosition(), h, ch, oy, rotation = this.getRotation();
  1002. for (var i = 0, len = childNodes.length; i < len; i++) {
  1003. childNode = childNodes[i];
  1004. p = childNode.getPosition();
  1005. ch = childNode.getHeight();
  1006. h = ch >=2 ? ch * ratio : ch;
  1007. childNode.setHeight(h);
  1008. rotation = GD.calcRotation(rotation);
  1009. if (rotation === 0 || rotation === Math.PI) {
  1010. // 图元未旋转
  1011. oy = op.y + (p.y - op.y)*ratio;
  1012. childNode.setPosition(p.x, oy);
  1013. } else if (rotation === 90 * Math.PI / 180) {
  1014. // 图元旋转以后
  1015. oy = op.x + (p.x - op.x)*ratio;
  1016. childNode.setPosition(oy, p.y);
  1017. }
  1018. }
  1019. this._height = height;
  1020. this._originHeight = height;
  1021. this._ratioY = ratio;
  1022. return this;
  1023. },
  1024. setSize: function (size) {
  1025. // var args = Array.prototype.slice.call(arguments, 0);
  1026. // var height, width;
  1027. // if (args.length === 0) {
  1028. // return ;
  1029. // }else if (args.length === 1) {
  1030. // height = args[0].height;
  1031. // width = args[0].width;
  1032. // } else {
  1033. // width = args[0];
  1034. // height = args[1];
  1035. // }
  1036. // var wh = GD.getRatioWithRotation(angle, wid)
  1037. // this.setHeight(height);
  1038. // this.setWidth(width);
  1039. // return this;
  1040. var args = Array.prototype.slice.call(arguments, 0);
  1041. var height, width;
  1042. if (args.length === 0) {
  1043. return ;
  1044. }else if (args.length === 1) {
  1045. height = args[0].height;
  1046. width = args[0].width;
  1047. angle = 0;
  1048. } else if (args.length === 2) {
  1049. if (typeof args[0] === 'object') {
  1050. width = args[0].width;
  1051. height = args[0].height;
  1052. angle = args[1] || 0;
  1053. } else {
  1054. width = args[0];
  1055. height = args[1];
  1056. angle = 0;
  1057. }
  1058. } else if (args.length === 3) {
  1059. width = args[0];
  1060. height = args[1];
  1061. angle = args[2] || 0;
  1062. }
  1063. var wh = GD.getRatioWithRotation(0, width, height);
  1064. this.setHeight(wh.ratioY);
  1065. this.setWidth(wh.ratioX);
  1066. return this;
  1067. },
  1068. getPosition: function () {
  1069. return {
  1070. x: this._x,
  1071. y: this._y
  1072. }
  1073. },
  1074. setPosition: function () {
  1075. var args = Array.prototype.slice.call(arguments, 0), x, y;
  1076. if (args.length === 0) {
  1077. return this;
  1078. } else if (args.length === 1) {
  1079. if (typeof args[0] != 'object') {
  1080. return this;
  1081. }
  1082. x = args[0].x;
  1083. y = args[0].y;
  1084. } else {
  1085. x = args[0];
  1086. y = args[1];
  1087. }
  1088. if ((x !== 0 && !x) || (y !== 0 && !y)) {
  1089. return this;
  1090. }
  1091. // var childNodes = this.childNodes, offset, childNode, p;
  1092. // for (var i = 0, len = childNodes.length; i < len; i++) {
  1093. // childNode = childNodes[i];
  1094. // p = childNode.getPosition();
  1095. // childNode.setPosition(x - (this._x-p.x)*this._ratioX, y - (this._y-p.y)*this._ratioY);
  1096. // }
  1097. // this._x = x;
  1098. // this._y = y;
  1099. // return this;
  1100. var childNodes, childNode, background, offset = {}, op, cp;
  1101. childNodes = this.childNodes;
  1102. background = this._background;
  1103. op = background.getPosition();
  1104. offset.x = x - op.x;
  1105. offset.y = y - op.y;
  1106. for (var i = 0, len = childNodes.length; i < len; i++) {
  1107. childNode = childNodes[i];
  1108. cp = childNode.getPosition();
  1109. childNode.setPosition(cp.x + offset.x, cp.y + offset.y);
  1110. }
  1111. this._x = x;
  1112. this._y = y;
  1113. this._position = {x: x, y: y};
  1114. return this;
  1115. },
  1116. getStyle: function (key) {
  1117. if (!key) {
  1118. return undefined;
  1119. }
  1120. return this._styleObject[key];
  1121. },
  1122. setStyle: function (key, value, force) {
  1123. var childNodes = this.childNodes, childNode;
  1124. for (var i = 0, len = childNodes.length; i < len; i++) {
  1125. childNode = childNodes[i];
  1126. if (key === '2d.visible') {
  1127. if (value === graphView.isVisible(childNode)) {
  1128. continue;
  1129. }
  1130. if (!value) {
  1131. childNode._savedIsVisible = graphView.isVisible(childNode);
  1132. childNode.s({
  1133. '2d.visible': false
  1134. })
  1135. } else {
  1136. childNode.s({
  1137. '2d.visible': childNode._savedIsVisible
  1138. })
  1139. }
  1140. continue;
  1141. }
  1142. childNode.s({
  1143. key: value
  1144. });
  1145. }
  1146. this._styleObject[key] = value;
  1147. return this;
  1148. },
  1149. calcSize: function () {
  1150. var background = this._background;
  1151. var position = background.getPosition(),
  1152. width = background.getWidth(),
  1153. height = background.getHeight();
  1154. this._width = width;
  1155. this._height = height;
  1156. this._x = position.x;
  1157. this._y = position.y;
  1158. this._position = {
  1159. x: this._x,
  1160. y: this._y
  1161. }
  1162. return this;
  1163. return this;
  1164. },
  1165. s: function (styleObj, force) {
  1166. var args = Array.prototype.slice.call(arguments, 0);
  1167. var styleObj;
  1168. if (args.length === 0) {
  1169. return this;
  1170. } else if (args.length === 1) {
  1171. styleObj = args[0];
  1172. } else {
  1173. this.setStyle(args[0], args[1]);
  1174. return this;
  1175. }
  1176. for (var key in styleObj) {
  1177. if (!styleObj.hasOwnProperty(key)) {
  1178. continue;
  1179. }
  1180. this.setStyle(key, styleObj[key], force);
  1181. }
  1182. return this;
  1183. },
  1184. init: function (x, y, width, height, angle) {
  1185. var that = this;
  1186. this.calcSize();
  1187. (function (width, height, angle) {
  1188. // that.setSize(width, height, angle);
  1189. // var wh = GD.getRatioWithRotation(angle, width, height);
  1190. // width = wh.ratioX;
  1191. // height = wh.ratioY;
  1192. var originHeight = that._height;
  1193. var originWidth = that._width;
  1194. var ratioY = height / originHeight;
  1195. var ratioX = width / originWidth;
  1196. var childNodes = that.childNodes,
  1197. childNode,p, op = that.getPosition(), h, ch, oy, w, cw, ox, name, borderRatio, borderWidth;
  1198. for (var i = 0, len = childNodes.length; i < len; i++) {
  1199. childNode = childNodes[i];
  1200. p = childNode.getPosition();
  1201. childNode.originHeight = childNode.originHeight || childNode.getHeight();
  1202. ch = childNode.getHeight();
  1203. cw = childNode.getWidth();
  1204. if (ch > 2) {
  1205. h = ch * ratioY;
  1206. childNode.setHeight(h);
  1207. }
  1208. if (cw > 2) {
  1209. w = cw * ratioX;
  1210. childNode.setWidth(w);
  1211. }
  1212. borderRatio = (ratioX + ratioY)*0.5;
  1213. if (childNode._nodeType === 'line') { // 如果是线,
  1214. if (childNode.getWidth() > childNode.getHeight()) {
  1215. borderRatio = ratioX;
  1216. } else {
  1217. borderRatio = ratioY;
  1218. }
  1219. }
  1220. name = childNode._nodename;
  1221. // if (childNode.borderWidth && name && ch > 2 && cw > 2) {
  1222. // borderWidth = childNode.borderWidth / borderRatio;
  1223. // if (borderWidth > ch*0.5 || borderWidth > cw *0.5) {
  1224. // // borderWidth = childNode.borderWidth;
  1225. // }
  1226. // childNode.borderWidth = borderWidth;
  1227. // childNode.a(name + '.borderwidth', borderWidth);
  1228. // }
  1229. }
  1230. that._height = height;
  1231. that._originHeight = height;
  1232. that._ratioY = ratioY;
  1233. that._width = width;
  1234. that._originWidth = width;
  1235. that._ratioX = ratioX;
  1236. })(width, height, angle);
  1237. that._x = width / 2;
  1238. that._y = height / 2;
  1239. that._rotation = 0;
  1240. // that.setPosition(x, y);
  1241. (function (x, y) {
  1242. var childNodes = that.childNodes, offset, childNode;
  1243. var w2 = that.getWidth() / 2, h2 = that.getHeight()/2;
  1244. for (var i = 0, len = childNodes.length; i < len; i++) {
  1245. childNode = childNodes[i];
  1246. offset = childNode.getPosition();
  1247. childNode.setPosition(x + offset.x * that._ratioX - w2, y + offset.y * that._ratioY - h2);
  1248. }
  1249. that._x = x;
  1250. that._y = y;
  1251. })(x, y);
  1252. // setTimeout(that.addEVent, 1000);
  1253. },
  1254. setRotation: function (angle) {
  1255. var that = this, _angle = that.getRotation();
  1256. if (angle!==0 && !angle || angle === _angle) {
  1257. return this;
  1258. }
  1259. var childNodes = this.childNodes, childNode, p = this.getPosition(), px = p.x, py = p.y;
  1260. for (var i = 0, len = childNodes.length; i < len; i++) {
  1261. childNode = childNodes[i];
  1262. var x = childNode.getPosition().x - px;
  1263. var y = childNode.getPosition().y - py;
  1264. childNode.setPosition(Math.cos(angle-_angle) * x - Math.sin(angle-_angle) * y + px, Math.cos(angle-_angle) * y + Math.sin(angle-_angle) * x + py);
  1265. childNode.setRotation(angle);
  1266. }
  1267. this._rotation = angle;
  1268. return this;
  1269. },
  1270. getRotation: function () {
  1271. return this._rotation;
  1272. },
  1273. setScale: function (sx, sy) {
  1274. var that = this,
  1275. childNodes = this.childNodes,
  1276. childNode;
  1277. if (sx === undefined || sx === null) return ;
  1278. if (sy === undefined || sy === null) {
  1279. sy = sx;
  1280. }
  1281. for (var i = 0, len = childNodes.length; i < len; i++) {
  1282. childNode = childNodes[i];
  1283. if (typeof childNode.setScale === 'function') {
  1284. childNode.setScale(sx, sy);
  1285. }
  1286. }
  1287. },
  1288. getScale: function () {
  1289. return this._background.getScale();
  1290. },
  1291. setScaleX: function (sx) {
  1292. if (sx === undefined || sx === null) return;
  1293. var that = this,
  1294. childNodes = this.childNodes,
  1295. childNode;
  1296. for (var i = 0, len = childNodes.length; i < len; i++) {
  1297. childNode = childNodes[i];
  1298. if (typeof childNode.setScaleX === 'function') {
  1299. childNode.setScaleX(sx);
  1300. }
  1301. }
  1302. },
  1303. setScaleY: function (sy) {
  1304. if (sy === undefined || sy === null) return;
  1305. var that = this,
  1306. childNodes = this.childNodes,
  1307. childNode;
  1308. for (var i = 0, len = childNodes.length; i < len; i++) {
  1309. childNode = childNodes[i];
  1310. if (typeof childNode.setScaleY === 'function') {
  1311. childNode.setScaleY(sy);
  1312. }
  1313. }
  1314. },
  1315. getScaleX: function () {
  1316. return this._background.getScaleX();
  1317. },
  1318. getScaleY: function () {
  1319. return this._background.getScaleY();
  1320. },
  1321. evert: function () {
  1322. var that = this,
  1323. childNodes = this.childNodes,
  1324. background = this._background,
  1325. bp = background.getPosition(),
  1326. bx = bp.x,
  1327. by = bp.y,
  1328. childNode, distanceX, distanceY, x, y, p, nx, ny;
  1329. for (var i = 0, len = childNodes.length; i < len; i++) {
  1330. childNode = childNodes[i];
  1331. p = childNode.getPosition();
  1332. x = p.x;
  1333. y = p.y;
  1334. distanceX = bx - x;
  1335. distanceY = by - y;
  1336. nx = bx + distanceX;
  1337. ny = by + distanceY;
  1338. childNode.setPosition(nx, ny);
  1339. if (typeof childNode.setScale === 'function') {
  1340. if (!(childNode._disallowEvert === true))
  1341. childNode.setScale(-1, -1);
  1342. }
  1343. }
  1344. },
  1345. evertX: function () {
  1346. var that = this,
  1347. childNodes = this.childNodes,
  1348. background = this._background,
  1349. bx = background.getPosition().x,
  1350. childNode, distance, x, p, nx;
  1351. for (var i = 0, len = childNodes.length; i < len; i++) {
  1352. childNode = childNodes[i];
  1353. p = childNode.getPosition();
  1354. x = p.x;
  1355. distance = bx - x;
  1356. nx = bx + distance;
  1357. childNode.setPosition(nx, p.y);
  1358. if (typeof childNode.setScaleX === 'function') {
  1359. if (!(childNode._disallowEvert === true))
  1360. childNode.setScaleX(-1);
  1361. }
  1362. }
  1363. },
  1364. evertY: function () {
  1365. var that = this,
  1366. childNodes = this.childNodes,
  1367. background = this._background,
  1368. by = background.getPosition().y,
  1369. childNode, distance, y, p, ny;
  1370. for (var i = 0, len = childNodes.length; i < len; i++) {
  1371. childNode = childNodes[i];
  1372. p = childNode.getPosition();
  1373. y = p.y;
  1374. distance = by - y;
  1375. ny = by + distance;
  1376. childNode.setPosition(p.x, ny);
  1377. if (typeof childNode.setScaleY === 'function') {
  1378. if (!(childNode._disallowEvert === true))
  1379. childNode.setScaleY(-1);
  1380. }
  1381. }
  1382. },
  1383. attr: function (key, value) {
  1384. var _attrObj = this._attrObj || {};
  1385. if (arguments.length === 1) {
  1386. return _attrObj[key];
  1387. }
  1388. var childNodes = this.childNodes, childNode;
  1389. _attrObj[key] = value;
  1390. for (var i = 0; childNode = childNodes[i++];) {
  1391. if (typeof childNode.a === 'function') {
  1392. childNode.a(key, value);
  1393. }
  1394. }
  1395. },
  1396. a: function () {
  1397. return this.attr.apply(this, arguments);
  1398. }
  1399. });
  1400. }