Select.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  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. this.currentState.currentWallId = wallid;
  181. var point=this.layer.vectors[wallid].geometry.points[index];
  182. var r=this.layer.parameter.wallThickness;
  183. if(r!=null)
  184. {
  185. r=(r/2)/this.layer.res;
  186. }
  187. var vectors=[];
  188. var circle = new Circle(point.x,point.y,r);
  189. var vector1 = new Vector(circle, circleStyle);
  190. this.currentState.currentCircleId=vector1.id;
  191. vector1.geometry.contextIndex=this.contextIndex;
  192. var point = new Point(point.x,point.y,point_r);
  193. var vector2 = new Vector(point, pointStyle);
  194. this.currentState.currentPointId=vector2.id;
  195. vector2.geometry.contextIndex=this.contextIndex;
  196. this.layer.drawSingleVector(vector1);
  197. this.layer.drawSingleVector(vector2);
  198. var sectorinfo=this.editSector(index);
  199. if(sectorinfo!=null)
  200. {
  201. var sector = new Sector(sectorinfo.x,sectorinfo.y,Sector_r,sectorinfo.start,sectorinfo.end);
  202. var vector3 = new Vector(sector,sectorStyle);
  203. this.currentState.currentSecotrId=vector3.id;
  204. vector3.geometry.contextIndex=this.contextIndex;
  205. this.currentState.selectWallSet={id:wallid,index:index,type:0};
  206. this.currentState.currentstartlinePointIndex=index;
  207. this.layer.drawSingleVector(vector3);
  208. }
  209. this.f_selectWallCorner=true;
  210. };
  211. Select.prototype.selectStairWallLine=function(id,startindex,endindex)
  212. {
  213. var pt1=this.layer.vectors[id].geometry.points[startindex];
  214. var pt2=this.layer.vectors[id].geometry.points[endindex];
  215. //不能用引用,可能选中的线的index和墙面的index不一致
  216. var points=[];
  217. points.push({x:pt1.x,y:pt1.y});
  218. points.push({x:pt2.x,y:pt2.y});
  219. var line = new Vector(new Line(points),selectLineStyle);
  220. this.currentState.currentLineId=line.id;
  221. line.geometry.contextIndex=this.contextIndex;
  222. this.layer.drawSingleVector(line);
  223. var point1 = new Point(pt1.x,pt1.y,point_r);
  224. var point2 = new Point(pt2.x,pt2.y,point_r);
  225. var vector1 = new Vector(point1, pointStyle);
  226. vector1.geometry.contextIndex=this.contextIndex;
  227. this.currentState.currentLinePoint1Id=vector1.id;
  228. this.layer.drawSingleVector(vector1);
  229. var vector2 = new Vector(point2, pointStyle);
  230. vector2.geometry.contextIndex=this.contextIndex;
  231. this.currentState.currentLinePoint2Id=vector2.id;
  232. this.layer.drawSingleVector(vector2);
  233. if(this.layer.vectors[id].geometry.geoType=="Wall")
  234. {
  235. this.f_selectWallLine=true;
  236. this.currentState.selectWallSet={id:id,index:startindex,type:1,endindex:endindex};
  237. }
  238. else if(this.layer.vectors[id].geometry.geoType=="WinderStair")
  239. {
  240. this.f_selectStairLine=true;
  241. this.currentState.selectStairSet={id:id,index:startindex,type:1,endindex:endindex};
  242. }
  243. };
  244. /*
  245. //选择楼梯面
  246. Select.prototype.selectStairLine=function(stairid,startindex,endindex)
  247. {
  248. };
  249. //选择墙面
  250. Select.prototype.selectWallLine=function(wallid,startindex,endindex)
  251. {
  252. var pt1=this.layer.vectors[wallid].geometry.points[startindex];
  253. var pt2=this.layer.vectors[wallid].geometry.points[endindex];
  254. //不能用引用,可能选中的线的index和墙面的index不一致
  255. var points=[];
  256. points.push({x:pt1.x,y:pt1.y});
  257. points.push({x:pt2.x,y:pt2.y});
  258. var line = new Vector(new Line(points),selectLineStyle);
  259. this.currentState.currentLineId=line.id;
  260. line.geometry.contextIndex=this.contextIndex;
  261. this.layer.drawSingleVector(line);
  262. var point1 = new Point(pt1.x,pt1.y,point_r);
  263. var point2 = new Point(pt2.x,pt2.y,point_r);
  264. var vector1 = new Vector(point1, pointStyle);
  265. vector1.geometry.contextIndex=this.contextIndex;
  266. this.currentState.currentLinePoint1Id=vector1.id;
  267. this.layer.drawSingleVector(vector1);
  268. var vector2 = new Vector(point2, pointStyle);
  269. vector2.geometry.contextIndex=this.contextIndex;
  270. this.currentState.currentLinePoint2Id=vector2.id;
  271. this.currentState.selectWallSet={id:wallid,index:startindex,type:1,endindex:endindex};
  272. this.layer.drawSingleVector(vector2);
  273. this.f_selectWallLine=true;
  274. };
  275. */
  276. //选择Symbol
  277. Select.prototype.selectSymbol=function(symbol2d)
  278. {
  279. var points=[];
  280. points.push(symbol2d.geometry.point1);
  281. points.push(symbol2d.geometry.point2);
  282. var selectSymbolIds=[];
  283. var vectorline=new Vector(new Line(points),selectLineStyle);
  284. vectorline.geometry.contextIndex=this.contextIndex;
  285. this.layer.drawSingleVector(vectorline);
  286. this.layer.vectors[vectorline.id] = vectorline;
  287. selectSymbolIds.push(vectorline.id);
  288. var vectorp1=new Vector(new Circle(points[0].x,points[0].y,this.r),selectCircleStyle);
  289. vectorp1.geometry.contextIndex=this.contextIndex;
  290. this.layer.drawSingleVector(vectorp1);
  291. this.layer.vectors[vectorp1.id] = vectorp1;
  292. selectSymbolIds.push(vectorp1.id);
  293. var vectorp2=new Vector(new Circle(points[1].x,points[1].y,this.r),selectCircleStyle);
  294. vectorp2.geometry.contextIndex=this.contextIndex;
  295. this.layer.drawSingleVector(vectorp2);
  296. this.layer.vectors[vectorp2.id] = vectorp2;
  297. selectSymbolIds.push(vectorp2.id);
  298. this.currentState.currentSymbolCircleId1=vectorp1.id;
  299. this.currentState.currentSymbolCircleId2=vectorp2.id;
  300. this.currentState.currentSymbolId=symbol2d.id;
  301. this.f_selectSymbol=true;
  302. this.selectSymbolIds.vectorid=symbol2d.id;
  303. this.selectSymbolIds.vectorMeasureid=symbol2d.attributes.vectorMeasureid;
  304. this.selectSymbolIds.selects=selectSymbolIds;
  305. symbol2d.attributes.selectSymbolIds=selectSymbolIds;
  306. return selectSymbolIds;
  307. };
  308. Select.prototype.reset=function()
  309. {
  310. this.f_selectSymbol=false;
  311. this.f_selectSymbolEndPoint=false;
  312. this.f_selectWallCorner=false;
  313. this.f_selectWallLine=false;
  314. };
  315. Select.prototype.endSelectSymbol=function(vectorid,selects,vectorMeasureid)
  316. {
  317. this.layer.vectors[vectorid].attributes.vectorMeasureid=null;
  318. this.layer.vectors[vectorid].attributes.selectSymbolIds=[];
  319. if(this.layer.vectors[vectorid]&&this.layer.vectors[vectorid].symbol2Ds)
  320. {
  321. for(var i=0;i<selects.length;++i)
  322. {
  323. this.layer.deleteVector(selects[i]);
  324. }
  325. }
  326. this.layer.deleteVector(vectorMeasureid);
  327. this.selectSymbolIds={};
  328. this.currentState.clearSelectSymbol();
  329. this.f_selectSymbolEndPoint=false;
  330. this.f_selectSymbol=false;
  331. this.layer.control.refreshSelectCanvas=true;
  332. };
  333. Select.prototype.endSelectWallLine=function()
  334. {
  335. if(this.currentState.currentLineId!=null)
  336. {
  337. this.layer.deleteVector(this.currentState.currentLineId);
  338. this.currentState.currentLineId=null;
  339. this.layer.control.refreshSelectCanvas=true;
  340. }
  341. if(this.currentState.currentLinePoint1Id!=null)
  342. {
  343. this.layer.deleteVector(this.currentState.currentLinePoint1Id);
  344. this.currentState.currentLinePoint1Id=null;
  345. this.layer.control.refreshSelectCanvas=true;
  346. }
  347. if(this.currentState.currentLinePoint2Id!=null)
  348. {
  349. this.layer.deleteVector(this.currentState.currentLinePoint2Id);
  350. this.currentState.currentLinePoint2Id=null;
  351. this.layer.control.refreshSelectCanvas=true;
  352. }
  353. };
  354. Select.prototype.endSelectWallCorner=function()
  355. {
  356. if(this.currentState.currentWallId==null)
  357. {
  358. return;
  359. }
  360. if(this.layer.vectors[this.currentState.currentWallId].geometry.disappearPointIndex!=-1)
  361. {
  362. var index=this.layer.vectors[this.currentState.currentWallId].geometry.disappearPointIndex;
  363. this.layer.vectors[this.currentState.currentWallId].geometry.disappearPointIndex=-1;
  364. var wallId = this.currentState.currentWallId;
  365. var point=this.layer.vectors[this.currentState.currentWallId].geometry.points[index];
  366. this.calculateElement.updateSymbolsForDeleteOnePoint(wallId,index);
  367. this.layer.vectors[this.currentState.currentWallId].geometry.points.splice(index,1);
  368. this.layer.vectors[this.currentState.currentWallId].geometry.wallInfo.splice(index,1);
  369. var startinidex=this.calculateElement.getPreIndex(this.layer.vectors[this.currentState.currentWallId].geometry.points,index);
  370. var endindex=this.calculateElement.getNextIndex(this.layer.vectors[this.currentState.currentWallId].geometry.points,startinidex);
  371. this.clearSelect();
  372. this.layer.control.refreshSelectCanvas=true;
  373. this.layer.control.refreshCanvas=true;
  374. this.layer.renderer.autoRedraw();
  375. this.currentState.selectWallSet=this.layer.calculateElement.wallsContain(point);
  376. this.selectStairWallLine(wallId,startinidex,endindex)
  377. }
  378. else
  379. {
  380. var index=this.currentState.currentstartlinePointIndex;
  381. var point=this.layer.vectors[this.currentState.currentWallId].geometry.points[index];
  382. var id=this.currentState.currentWallId;
  383. this.currentState.selectWallSet=this.calculateElement.wallsContain(point,this.currentState.currentWallId);
  384. if(this.currentState.selectWallSet==null)
  385. {
  386. this.layer.vectors[id].geometry.firstLines=[];
  387. this.layer.vectors[id].geometry.endLines=[];
  388. }
  389. else
  390. {
  391. if(index==0)
  392. {
  393. this.layer.vectors[id].geometry.firstLines=this.layer.build.getRelaEndLines();
  394. point=this.layer.build.adjustPoint(point);
  395. this.layer.vectors[id].geometry.points[index]=point;
  396. }
  397. else if(index==this.layer.vectors[id].geometry.points.length-1)
  398. {
  399. this.layer.vectors[id].geometry.endLines=this.layer.build.getRelaEndLines();
  400. point=this.layer.build.adjustPoint(point);
  401. this.layer.vectors[id].geometry.points[index]=point;
  402. }
  403. }
  404. }
  405. this.layer.control.refreshCanvas=true;
  406. this.layer.control.refreshSelectCanvas=true;
  407. };
  408. Select.prototype.clearSelect=function()
  409. {
  410. this.reset();
  411. if(this.currentState.currentSymbolCircleId1!=null)
  412. {
  413. this.layer.deleteVector(this.currentState.currentSymbolCircleId1);
  414. this.currentState.currentSymbolCircleId1=null;
  415. this.layer.control.refreshSelectCanvas=true;
  416. }
  417. if(this.currentState.currentSymbolCircleId2!=null)
  418. {
  419. this.layer.deleteVector(this.currentState.currentSymbolCircleId2);
  420. this.currentState.currentSymbolCircleId2=null;
  421. this.layer.control.refreshSelectCanvas=true;
  422. }
  423. if(this.currentState.currentCircleId!=null)
  424. {
  425. this.layer.deleteVector(this.currentState.currentCircleId);
  426. this.currentState.currentCircleId=null;
  427. this.layer.control.refreshSelectCanvas=true;
  428. }
  429. if(this.currentState.currentPointId!=null)
  430. {
  431. this.layer.deleteVector(this.currentState.currentPointId);
  432. this.currentState.currentPointId=null;
  433. this.layer.control.refreshSelectCanvas=true;
  434. }
  435. if(this.currentState.currentSecotrId!=null)
  436. {
  437. this.layer.deleteVector(this.currentState.currentSecotrId);
  438. this.currentState.currentSecotrId=null;
  439. this.layer.control.refreshSelectCanvas=true;
  440. }
  441. if(this.currentState.currentLineId!=null)
  442. {
  443. this.layer.deleteVector(this.currentState.currentLineId);
  444. this.currentState.currentLineId=null;
  445. this.layer.control.refreshSelectCanvas=true;
  446. }
  447. if(this.currentState.currentLinePoint1Id!=null)
  448. {
  449. this.layer.deleteVector(this.currentState.currentLinePoint1Id);
  450. this.currentState.currentLinePoint1Id=null;
  451. this.layer.control.refreshSelectCanvas=true;
  452. }
  453. if(this.currentState.currentLinePoint2Id!=null)
  454. {
  455. this.layer.deleteVector(this.currentState.currentLinePoint2Id);
  456. this.currentState.currentLinePoint2Id=null;
  457. this.layer.control.refreshSelectCanvas=true;
  458. }
  459. if(this.currentState.currentSymbolId!=null)
  460. {
  461. var symbol = this.layer.vectors[this.currentState.currentSymbolId];
  462. symbol.attributes.selectSymbolIds=[];
  463. symbol.vectorMeasureid=null;
  464. }
  465. if(typeof(this.selectSymbolIds.selects)!="undefined"&&this.selectSymbolIds.selects.length>0)
  466. {
  467. var selectSymbolIds=this.selectSymbolIds.selects;
  468. if(selectSymbolIds.length>0)
  469. {
  470. this.layer.deleteVector(selectSymbolIds[0]);
  471. this.layer.control.refreshSelectCanvas=true;
  472. }
  473. }
  474. if(typeof(this.selectSymbolIds.vectorMeasureid)!="undefined")
  475. {
  476. this.layer.deleteVector(this.selectSymbolIds.vectorMeasureid);
  477. this.layer.control.refreshSelectCanvas=true;
  478. }
  479. if(this.f_selectSpiralCorner)
  480. {
  481. this.endselectSpiralCorner();
  482. }
  483. if(this.f_selectSpiralLine)
  484. {
  485. this.endselectSpiralPlane();
  486. }
  487. this.selectSymbolIds={};
  488. this.currentState.clearSelects();
  489. };
  490. //symbol由虚转实
  491. Select.prototype.convertTrue=function(symbol)
  492. {
  493. var contextIndex=this.layer.parameter.contextIndex;
  494. this.drawMeasure(symbol);
  495. symbol.geometry.contextIndex=contextIndex;
  496. this.layer.vectors[symbol.attributes.wallId].symbol2Ds[symbol.id]=symbol;
  497. ++this.layer.vectors[symbol.attributes.wallId].symbol2dsCount;
  498. this.f_selectWallLine=false;
  499. this.f_selectSymbol=true;
  500. this.selectSymbolIds.vectorid=symbol.id;
  501. this.selectSymbolIds.vectorMeasureid=symbol.attributes.vectorMeasureid;
  502. this.layer.control.refreshCanvas=true;
  503. this.layer.control.refreshSelectCanvas=true;
  504. this.layer.data2d.symbol2DIds.push(symbol.id);
  505. };
  506. //当选择symbol时候,会显示测量
  507. Select.prototype.drawMeasure=function(symbol)
  508. {
  509. var wallType=this.layer.vectors[symbol.attributes.wallId].geometry.wallType;
  510. var vectorMeasure = new Vector(new LineMeasure([symbol.geometry.point1,symbol.geometry.point2]),selectLineStyle);
  511. vectorMeasure.geometry.contextIndex=this.contextIndex;
  512. vectorMeasure.geometry.wallType=wallType;
  513. this.layer.drawSingleVector(vectorMeasure);
  514. this.layer.vectors[vectorMeasure.id] = vectorMeasure;
  515. symbol.attributes.vectorMeasureid=vectorMeasure.id;
  516. };