Select.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  1. function Select(layer){
  2. this.layer = layer;
  3. this.currentState=this.layer.currentState;
  4. this.calculateElement=this.layer.calculateElement;
  5. this.calculateLine=this.layer.calculateLine;
  6. this.contextIndex=this.layer.parameter.selectcontext;
  7. this.f_selectSymbol=false;
  8. this.f_selectSymbolEndPoint=false;
  9. this.f_selectWallCorner=false;
  10. this.f_selectWallLine=false;
  11. this.f_selectStairCorner=false;
  12. this.f_selectStairLine=false;
  13. this.f_selectSpiralCorner=false;
  14. this.f_selectSpiralLine=false;
  15. this.selectSymbolIds={};
  16. this.selectWall={wallid:null,index:null};
  17. this.r=this.layer.parameter.selectCircle_R;
  18. };
  19. //当鼠标单击symbol的端点时
  20. Select.prototype.selectSymbolPoint=function(symbol2d,point)
  21. {
  22. if(this.layer.move.draggingSymbol2dPoint==null)
  23. {
  24. this.layer.move.draggingSymbol2dPoint={};
  25. }
  26. this.layer.move.draggingSymbol2dPoint.wallid=this.currentState.currentWallId;
  27. this.layer.move.draggingSymbol2dPoint.wallStartindex=symbol2d.attributes.wallstartindex;
  28. this.layer.move.draggingSymbol2dPoint.wallEndindex=symbol2d.attributes.wallendindex;
  29. var point1={x:this.layer.vectors[this.currentState.currentSymbolCircleId1].geometry.x,y:this.layer.vectors[this.currentState.currentSymbolCircleId1].geometry.y};
  30. var point2={x:this.layer.vectors[this.currentState.currentSymbolCircleId2].geometry.x,y:this.layer.vectors[this.currentState.currentSymbolCircleId2].geometry.y};
  31. if(BABYLON.Vector2.Distance(point1,point)<this.r)
  32. {
  33. this.layer.move.draggingSymbol2dPoint.selectPoint=point1;
  34. this.layer.move.draggingSymbol2dPoint.noselectPoint=point2;
  35. this.layer.move.draggingSymbol2dPoint.selectVectorId=this.currentState.currentSymbolCircleId1;
  36. this.layer.move.draggingSymbol2dPoint.noselectVectorId=this.currentState.currentSymbolCircleId2;
  37. }
  38. else if(BABYLON.Vector2.Distance(point2,point)<this.r)
  39. {
  40. this.layer.move.draggingSymbol2dPoint.selectPoint=point2;
  41. this.layer.move.draggingSymbol2dPoint.noselectPoint=point1;
  42. this.layer.move.draggingSymbol2dPoint.selectVectorId=this.currentState.currentSymbolCircleId2;
  43. this.layer.move.draggingSymbol2dPoint.noselectVectorId=this.currentState.currentSymbolCircleId1;
  44. }
  45. this.f_selectSymbolEndPoint=true;
  46. this.layer.pan.f_draggingSymbol=false;
  47. };
  48. //编辑扇形
  49. Select.prototype.editSector=function(index)
  50. {
  51. var points=this.layer.vectors[this.currentState.currentWallId].geometry.points;
  52. var len=points.length;
  53. if(len<3)
  54. {
  55. return null;
  56. }
  57. if(this.layer.vectors[this.currentState.currentWallId].geometry.state==1)
  58. {
  59. if(index==0)
  60. {
  61. ++index;
  62. }
  63. else if(index==len-1)
  64. {
  65. --index;
  66. }
  67. }
  68. var sideIndex=this.calculateElement.getSideIndex(len,index);
  69. var temp={x:points[index].x+1,y:points[index].y};
  70. var tempangle1=this.calculateLine.Angle(points[index],points[sideIndex.pre],temp);
  71. var start,end;
  72. if(points[sideIndex.pre].y<temp.y)
  73. {
  74. start=tempangle1/180*Math.PI;
  75. }
  76. else if(points[sideIndex.pre].y>temp.y)
  77. {
  78. start=(360-tempangle1)/180*Math.PI;
  79. }
  80. else if(points[sideIndex.pre].x<temp.x)
  81. {
  82. start=Math.PI;
  83. }
  84. else
  85. {
  86. start=0;
  87. }
  88. var tempangle2=this.calculateLine.Angle(points[index],points[sideIndex.next],temp);
  89. if(points[sideIndex.next].y<temp.y)
  90. {
  91. end=tempangle2/180*Math.PI;
  92. }
  93. else if(points[sideIndex.next].y>temp.y)
  94. {
  95. end=(360-tempangle2)/180*Math.PI;
  96. }
  97. else if(points[sideIndex.next].x<temp.x)
  98. {
  99. end=Math.PI;
  100. }
  101. else
  102. {
  103. end=0;
  104. }
  105. if(start>end)
  106. {
  107. var t=start;
  108. start=end;
  109. end=t;
  110. }
  111. var angle=this.calculateLine.Angle(points[index],points[sideIndex.pre],points[sideIndex.next]);
  112. if(Math.round(angle)==180)
  113. {
  114. this.layer.vectors[this.currentState.currentWallId].geometry.disappearPointIndex=index;
  115. }
  116. else
  117. {
  118. this.layer.vectors[this.currentState.currentWallId].geometry.disappearPointIndex=-1;
  119. }
  120. return {x:points[index].x,y:points[index].y,start:start,end:end};
  121. };
  122. //选择拐角
  123. Select.prototype.selectStairCorner=function(id,index)
  124. {
  125. var point=this.layer.vectors[id].geometry.points[index];
  126. var r=(wallThickness/2)/this.layer.res;
  127. var circle = new Circle(point.x,point.y,r);
  128. var vector1 = new Vector(circle, circleStyle);
  129. this.currentState.currentCircleId=vector1.id;
  130. vector1.geometry.contextIndex=this.contextIndex;
  131. this.layer.drawSingleVector(vector1);
  132. this.f_selectStairCorner=true;
  133. };
  134. Select.prototype.selectSpiralCorner=function(id,index)
  135. {
  136. var point=null;
  137. if(index==1)
  138. {
  139. point=this.layer.vectors[id].geometry.point1;
  140. }
  141. else
  142. {
  143. point=this.layer.vectors[id].geometry.point2;
  144. }
  145. var vector1 = new Vector(new Point(point.x,point.y,point_r), pointStyle);
  146. this.currentState.currentPointId=vector1.id;
  147. vector1.geometry.contextIndex=this.contextIndex;
  148. var vector2 = new Vector(new Circle(point.x,point.y,this.layer.parameter.selectCircle_R/this.layer.res), circleStyle);
  149. this.currentState.currentCircleId=vector2.id;
  150. vector2.geometry.contextIndex=this.contextIndex;
  151. this.layer.drawSingleVector(vector1);
  152. this.layer.drawSingleVector(vector2);
  153. spiralStyle.strokeStyle2="#89b808";
  154. this.f_selectSpiralCorner=true;
  155. this.layer.control.refreshCanvas=true;
  156. };
  157. Select.prototype.selectSpiralPlane=function(id)
  158. {
  159. this.f_selectSpiralLine=true;
  160. spiralStyle.strokeStyle2="#89b808";
  161. this.layer.control.refreshCanvas=true;
  162. };
  163. Select.prototype.endselectSpiralCorner=function()
  164. {
  165. spiralStyle.strokeStyle2="#000000";
  166. this.f_selectSpiralCorner=false;
  167. this.layer.deleteVector(this.currentState.currentPointId);
  168. this.layer.deleteVector(this.currentState.currentCircleId);
  169. this.layer.control.refreshCanvas=true;
  170. };
  171. Select.prototype.endselectSpiralPlane=function()
  172. {
  173. spiralStyle.strokeStyle2="#000000";
  174. this.f_selectSpiralLine=false;
  175. this.layer.control.refreshCanvas=true;
  176. };
  177. //选择墙角
  178. Select.prototype.selectWallCorner=function(wallid,index)
  179. {
  180. console.log('----0')
  181. this.currentState.currentWallId = wallid;
  182. var point=this.layer.vectors[wallid].geometry.points[index];
  183. var r=this.layer.parameter.wallThickness;
  184. if(r!=null)
  185. {
  186. r=(r/2)/this.layer.res;
  187. }
  188. var vectors=[];
  189. var circle = new Circle(point.x,point.y,r);
  190. var vector1 = new Vector(circle, circleStyle);
  191. this.currentState.currentCircleId=vector1.id;
  192. vector1.geometry.contextIndex=this.contextIndex;
  193. var point = new Point(point.x,point.y,point_r);
  194. var vector2 = new Vector(point, pointStyle);
  195. this.currentState.currentPointId=vector2.id;
  196. vector2.geometry.contextIndex=this.contextIndex;
  197. this.layer.drawSingleVector(vector1);
  198. this.layer.drawSingleVector(vector2);
  199. var sectorinfo=this.editSector(index);
  200. if(sectorinfo!=null)
  201. {
  202. var sector = new Sector(sectorinfo.x,sectorinfo.y,Sector_r,sectorinfo.start,sectorinfo.end);
  203. var vector3 = new Vector(sector,sectorStyle);
  204. this.currentState.currentSecotrId=vector3.id;
  205. vector3.geometry.contextIndex=this.contextIndex;
  206. this.currentState.selectWallSet={id:wallid,index:index,type:0};
  207. this.currentState.currentstartlinePointIndex=index;
  208. this.layer.drawSingleVector(vector3);
  209. }
  210. this.f_selectWallCorner=true;
  211. };
  212. Select.prototype.selectStairWallLine=function(id,startindex,endindex)
  213. {
  214. var pt1=this.layer.vectors[id].geometry.points[startindex];
  215. var pt2=this.layer.vectors[id].geometry.points[endindex];
  216. //不能用引用,可能选中的线的index和墙面的index不一致
  217. var points=[];
  218. points.push({x:pt1.x,y:pt1.y});
  219. points.push({x:pt2.x,y:pt2.y});
  220. var line = new Vector(new Line(points),selectLineStyle);
  221. this.currentState.currentLineId=line.id;
  222. line.geometry.contextIndex=this.contextIndex;
  223. this.layer.drawSingleVector(line);
  224. var point1 = new Point(pt1.x,pt1.y,point_r);
  225. var point2 = new Point(pt2.x,pt2.y,point_r);
  226. var vector1 = new Vector(point1, pointStyle);
  227. vector1.geometry.contextIndex=this.contextIndex;
  228. this.currentState.currentLinePoint1Id=vector1.id;
  229. this.layer.drawSingleVector(vector1);
  230. var vector2 = new Vector(point2, pointStyle);
  231. vector2.geometry.contextIndex=this.contextIndex;
  232. this.currentState.currentLinePoint2Id=vector2.id;
  233. this.layer.drawSingleVector(vector2);
  234. if(this.layer.vectors[id].geometry.geoType=="Wall")
  235. {
  236. this.f_selectWallLine=true;
  237. this.currentState.selectWallSet={id:id,index:startindex,type:1,endindex:endindex};
  238. }
  239. else if(this.layer.vectors[id].geometry.geoType=="WinderStair")
  240. {
  241. this.f_selectStairLine=true;
  242. this.currentState.selectStairSet={id:id,index:startindex,type:1,endindex:endindex};
  243. }
  244. };
  245. /*
  246. //选择楼梯面
  247. Select.prototype.selectStairLine=function(stairid,startindex,endindex)
  248. {
  249. };
  250. //选择墙面
  251. Select.prototype.selectWallLine=function(wallid,startindex,endindex)
  252. {
  253. var pt1=this.layer.vectors[wallid].geometry.points[startindex];
  254. var pt2=this.layer.vectors[wallid].geometry.points[endindex];
  255. //不能用引用,可能选中的线的index和墙面的index不一致
  256. var points=[];
  257. points.push({x:pt1.x,y:pt1.y});
  258. points.push({x:pt2.x,y:pt2.y});
  259. var line = new Vector(new Line(points),selectLineStyle);
  260. this.currentState.currentLineId=line.id;
  261. line.geometry.contextIndex=this.contextIndex;
  262. this.layer.drawSingleVector(line);
  263. var point1 = new Point(pt1.x,pt1.y,point_r);
  264. var point2 = new Point(pt2.x,pt2.y,point_r);
  265. var vector1 = new Vector(point1, pointStyle);
  266. vector1.geometry.contextIndex=this.contextIndex;
  267. this.currentState.currentLinePoint1Id=vector1.id;
  268. this.layer.drawSingleVector(vector1);
  269. var vector2 = new Vector(point2, pointStyle);
  270. vector2.geometry.contextIndex=this.contextIndex;
  271. this.currentState.currentLinePoint2Id=vector2.id;
  272. this.currentState.selectWallSet={id:wallid,index:startindex,type:1,endindex:endindex};
  273. this.layer.drawSingleVector(vector2);
  274. this.f_selectWallLine=true;
  275. };
  276. */
  277. //选择Symbol
  278. Select.prototype.selectSymbol=function(symbol2d)
  279. {
  280. var points=[];
  281. points.push(symbol2d.geometry.point1);
  282. points.push(symbol2d.geometry.point2);
  283. var selectSymbolIds=[];
  284. var vectorline=new Vector(new Line(points),selectLineStyle);
  285. vectorline.geometry.contextIndex=this.contextIndex;
  286. this.layer.drawSingleVector(vectorline);
  287. this.layer.vectors[vectorline.id] = vectorline;
  288. selectSymbolIds.push(vectorline.id);
  289. var vectorp1=new Vector(new Circle(points[0].x,points[0].y,this.r),selectCircleStyle);
  290. vectorp1.geometry.contextIndex=this.contextIndex;
  291. this.layer.drawSingleVector(vectorp1);
  292. this.layer.vectors[vectorp1.id] = vectorp1;
  293. selectSymbolIds.push(vectorp1.id);
  294. var vectorp2=new Vector(new Circle(points[1].x,points[1].y,this.r),selectCircleStyle);
  295. vectorp2.geometry.contextIndex=this.contextIndex;
  296. this.layer.drawSingleVector(vectorp2);
  297. this.layer.vectors[vectorp2.id] = vectorp2;
  298. selectSymbolIds.push(vectorp2.id);
  299. this.currentState.currentSymbolCircleId1=vectorp1.id;
  300. this.currentState.currentSymbolCircleId2=vectorp2.id;
  301. this.currentState.currentSymbolId=symbol2d.id;
  302. this.f_selectSymbol=true;
  303. this.selectSymbolIds.vectorid=symbol2d.id;
  304. this.selectSymbolIds.vectorMeasureid=symbol2d.attributes.vectorMeasureid;
  305. this.selectSymbolIds.selects=selectSymbolIds;
  306. symbol2d.attributes.selectSymbolIds=selectSymbolIds;
  307. return selectSymbolIds;
  308. };
  309. Select.prototype.reset=function()
  310. {
  311. this.f_selectSymbol=false;
  312. this.f_selectSymbolEndPoint=false;
  313. this.f_selectWallCorner=false;
  314. this.f_selectWallLine=false;
  315. };
  316. Select.prototype.endSelectSymbol=function(vectorid,selects,vectorMeasureid)
  317. {
  318. this.layer.vectors[vectorid].attributes.vectorMeasureid=null;
  319. this.layer.vectors[vectorid].attributes.selectSymbolIds=[];
  320. if(this.layer.vectors[vectorid]&&this.layer.vectors[vectorid].symbol2Ds)
  321. {
  322. for(var i=0;i<selects.length;++i)
  323. {
  324. this.layer.deleteVector(selects[i]);
  325. }
  326. }
  327. this.layer.deleteVector(vectorMeasureid);
  328. this.selectSymbolIds={};
  329. this.currentState.clearSelectSymbol();
  330. this.f_selectSymbolEndPoint=false;
  331. this.f_selectSymbol=false;
  332. this.layer.control.refreshSelectCanvas=true;
  333. };
  334. Select.prototype.endSelectWallLine=function()
  335. {
  336. if(this.currentState.currentLineId!=null)
  337. {
  338. this.layer.deleteVector(this.currentState.currentLineId);
  339. this.currentState.currentLineId=null;
  340. this.layer.control.refreshSelectCanvas=true;
  341. }
  342. if(this.currentState.currentLinePoint1Id!=null)
  343. {
  344. this.layer.deleteVector(this.currentState.currentLinePoint1Id);
  345. this.currentState.currentLinePoint1Id=null;
  346. this.layer.control.refreshSelectCanvas=true;
  347. }
  348. if(this.currentState.currentLinePoint2Id!=null)
  349. {
  350. this.layer.deleteVector(this.currentState.currentLinePoint2Id);
  351. this.currentState.currentLinePoint2Id=null;
  352. this.layer.control.refreshSelectCanvas=true;
  353. }
  354. };
  355. Select.prototype.endSelectWallCorner=function()
  356. {
  357. if(this.currentState.currentWallId==null)
  358. {
  359. return;
  360. }
  361. if(this.layer.vectors[this.currentState.currentWallId].geometry.disappearPointIndex!=-1)
  362. {
  363. var index=this.layer.vectors[this.currentState.currentWallId].geometry.disappearPointIndex;
  364. this.layer.vectors[this.currentState.currentWallId].geometry.disappearPointIndex=-1;
  365. var wallId = this.currentState.currentWallId;
  366. var point=this.layer.vectors[this.currentState.currentWallId].geometry.points[index];
  367. this.calculateElement.updateSymbolsForDeleteOnePoint(wallId,index);
  368. this.layer.vectors[this.currentState.currentWallId].geometry.points.splice(index,1);
  369. this.layer.vectors[this.currentState.currentWallId].geometry.wallInfo.splice(index,1);
  370. var startinidex=this.calculateElement.getPreIndex(this.layer.vectors[this.currentState.currentWallId].geometry.points,index);
  371. var endindex=this.calculateElement.getNextIndex(this.layer.vectors[this.currentState.currentWallId].geometry.points,startinidex);
  372. this.clearSelect();
  373. this.layer.control.refreshSelectCanvas=true;
  374. this.layer.control.refreshCanvas=true;
  375. this.layer.renderer.autoRedraw();
  376. this.currentState.selectWallSet=this.layer.calculateElement.wallsContain(point);
  377. this.selectStairWallLine(wallId,startinidex,endindex)
  378. }
  379. else
  380. {
  381. var index=this.currentState.currentstartlinePointIndex;
  382. var point=this.layer.vectors[this.currentState.currentWallId].geometry.points[index];
  383. var id=this.currentState.currentWallId;
  384. this.currentState.selectWallSet=this.calculateElement.wallsContain(point,this.currentState.currentWallId);
  385. if(this.currentState.selectWallSet==null)
  386. {
  387. this.layer.vectors[id].geometry.firstLines=[];
  388. this.layer.vectors[id].geometry.endLines=[];
  389. }
  390. else
  391. {
  392. if(index==0)
  393. {
  394. this.layer.vectors[id].geometry.firstLines=this.layer.build.getRelaEndLines();
  395. point=this.layer.build.adjustPoint(point);
  396. this.layer.vectors[id].geometry.points[index]=point;
  397. }
  398. else if(index==this.layer.vectors[id].geometry.points.length-1)
  399. {
  400. this.layer.vectors[id].geometry.endLines=this.layer.build.getRelaEndLines();
  401. point=this.layer.build.adjustPoint(point);
  402. this.layer.vectors[id].geometry.points[index]=point;
  403. }
  404. }
  405. }
  406. this.layer.control.refreshCanvas=true;
  407. this.layer.control.refreshSelectCanvas=true;
  408. };
  409. Select.prototype.clearSelect=function()
  410. {
  411. this.reset();
  412. if(this.currentState.currentSymbolCircleId1!=null)
  413. {
  414. this.layer.deleteVector(this.currentState.currentSymbolCircleId1);
  415. this.currentState.currentSymbolCircleId1=null;
  416. this.layer.control.refreshSelectCanvas=true;
  417. }
  418. if(this.currentState.currentSymbolCircleId2!=null)
  419. {
  420. this.layer.deleteVector(this.currentState.currentSymbolCircleId2);
  421. this.currentState.currentSymbolCircleId2=null;
  422. this.layer.control.refreshSelectCanvas=true;
  423. }
  424. if(this.currentState.currentCircleId!=null)
  425. {
  426. this.layer.deleteVector(this.currentState.currentCircleId);
  427. this.currentState.currentCircleId=null;
  428. this.layer.control.refreshSelectCanvas=true;
  429. }
  430. if(this.currentState.currentPointId!=null)
  431. {
  432. this.layer.deleteVector(this.currentState.currentPointId);
  433. this.currentState.currentPointId=null;
  434. this.layer.control.refreshSelectCanvas=true;
  435. }
  436. if(this.currentState.currentSecotrId!=null)
  437. {
  438. this.layer.deleteVector(this.currentState.currentSecotrId);
  439. this.currentState.currentSecotrId=null;
  440. this.layer.control.refreshSelectCanvas=true;
  441. }
  442. if(this.currentState.currentLineId!=null)
  443. {
  444. this.layer.deleteVector(this.currentState.currentLineId);
  445. this.currentState.currentLineId=null;
  446. this.layer.control.refreshSelectCanvas=true;
  447. }
  448. if(this.currentState.currentLinePoint1Id!=null)
  449. {
  450. this.layer.deleteVector(this.currentState.currentLinePoint1Id);
  451. this.currentState.currentLinePoint1Id=null;
  452. this.layer.control.refreshSelectCanvas=true;
  453. }
  454. if(this.currentState.currentLinePoint2Id!=null)
  455. {
  456. this.layer.deleteVector(this.currentState.currentLinePoint2Id);
  457. this.currentState.currentLinePoint2Id=null;
  458. this.layer.control.refreshSelectCanvas=true;
  459. }
  460. if(this.currentState.currentSymbolId!=null)
  461. {
  462. var symbol = this.layer.vectors[this.currentState.currentSymbolId];
  463. symbol.attributes.selectSymbolIds=[];
  464. symbol.vectorMeasureid=null;
  465. }
  466. if(typeof(this.selectSymbolIds.selects)!="undefined"&&this.selectSymbolIds.selects.length>0)
  467. {
  468. var selectSymbolIds=this.selectSymbolIds.selects;
  469. if(selectSymbolIds.length>0)
  470. {
  471. this.layer.deleteVector(selectSymbolIds[0]);
  472. this.layer.control.refreshSelectCanvas=true;
  473. }
  474. }
  475. if(typeof(this.selectSymbolIds.vectorMeasureid)!="undefined")
  476. {
  477. this.layer.deleteVector(this.selectSymbolIds.vectorMeasureid);
  478. this.layer.control.refreshSelectCanvas=true;
  479. }
  480. if(this.f_selectSpiralCorner)
  481. {
  482. this.endselectSpiralCorner();
  483. }
  484. if(this.f_selectSpiralLine)
  485. {
  486. this.endselectSpiralPlane();
  487. }
  488. this.selectSymbolIds={};
  489. this.currentState.clearSelects();
  490. };
  491. //symbol由虚转实
  492. Select.prototype.convertTrue=function(symbol)
  493. {
  494. var contextIndex=this.layer.parameter.contextIndex;
  495. this.drawMeasure(symbol);
  496. symbol.geometry.contextIndex=contextIndex;
  497. this.layer.vectors[symbol.attributes.wallId].symbol2Ds[symbol.id]=symbol;
  498. ++this.layer.vectors[symbol.attributes.wallId].symbol2dsCount;
  499. this.f_selectWallLine=false;
  500. this.f_selectSymbol=true;
  501. this.selectSymbolIds.vectorid=symbol.id;
  502. this.selectSymbolIds.vectorMeasureid=symbol.attributes.vectorMeasureid;
  503. this.layer.control.refreshCanvas=true;
  504. this.layer.control.refreshSelectCanvas=true;
  505. this.layer.data2d.symbol2DIds.push(symbol.id);
  506. };
  507. //当选择symbol时候,会显示测量
  508. Select.prototype.drawMeasure=function(symbol)
  509. {
  510. var wallType=this.layer.vectors[symbol.attributes.wallId].geometry.wallType;
  511. var vectorMeasure = new Vector(new LineMeasure([symbol.geometry.point1,symbol.geometry.point2]),selectLineStyle);
  512. vectorMeasure.geometry.contextIndex=this.contextIndex;
  513. vectorMeasure.geometry.wallType=wallType;
  514. this.layer.drawSingleVector(vectorMeasure);
  515. this.layer.vectors[vectorMeasure.id] = vectorMeasure;
  516. symbol.attributes.vectorMeasureid=vectorMeasure.id;
  517. };