GuideSizeArLawClass.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  1. using PaintDotNet.Base.CommTool;
  2. using PaintDotNet.Base.SettingModel;
  3. using System;
  4. using System.Collections;
  5. using System.Collections.Generic;
  6. using System.Drawing;
  7. using System.IO;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Windows.Forms;
  12. namespace PaintDotNet.DedicatedAnalysis.GrainSize
  13. {
  14. class GuideSizeArLawClass
  15. {
  16. GrainSizeArbitrationLawModel grainSizeArbitrationLawModel;
  17. ///// <summary>
  18. ///// 单位
  19. ///// </summary>
  20. //public double unitLength;
  21. /// <summary>
  22. /// 网格交点
  23. /// </summary>
  24. public List<RectangleF> rectangleFs = new List<RectangleF>();
  25. /// <summary>
  26. /// 旋转角度
  27. /// </summary>
  28. public int rotateAngleV = 0;
  29. /// <summary>
  30. /// 图形位置
  31. /// </summary>
  32. public PointF loctation;
  33. /// <summary>
  34. /// 图形位移
  35. /// </summary>
  36. public RectangleF rectangleFLine = new RectangleF();
  37. /// <summary>
  38. /// 网格绘制区域
  39. /// </summary>
  40. private float minX;
  41. private float maxX;
  42. private float minY;
  43. private float maxY;
  44. /// <summary>
  45. /// 水平数量
  46. /// </summary>
  47. public int hNumber;
  48. /// <summary>
  49. /// 垂直数量
  50. /// </summary>
  51. public int vNumber;
  52. /// <summary>
  53. /// 网格线宽
  54. /// </summary>
  55. public int gridWidth;
  56. /// <summary>
  57. /// 网格间距
  58. /// </summary>
  59. public float gridSpacing;
  60. public float gridSpacing1;
  61. /// <summary>
  62. /// 网格颜色
  63. /// </summary>
  64. public int gridColor;
  65. /// <summary>
  66. /// 全图 true:全图 false:非全图
  67. /// </summary>
  68. public bool wholePicture;
  69. /// <summary>
  70. /// 余白
  71. /// </summary>
  72. public int blank;
  73. /// <summary>
  74. /// 绘制网格
  75. /// </summary>
  76. /// <param name="graphics"></param>
  77. public void DrawGridViews(Graphics graphics, int CSHeight, int CSWidth)
  78. {
  79. Pen linePen = new Pen(Color.FromArgb(this.gridColor), this.gridWidth);
  80. //float panX = this.loctation.X - this.documentWorkspace.CompositionSurface.Width / 2;
  81. //float panY = this.loctation.Y - this.documentWorkspace.CompositionSurface.Height / 2;
  82. float hGridSpacingDraw;
  83. float vGridSpacingDraw;
  84. float blankDraw;
  85. if (this.wholePicture)
  86. {
  87. hGridSpacingDraw = (float)(CSHeight - 2 * this.blank) / (this.hNumber - 1);
  88. vGridSpacingDraw = (float)(CSWidth - 2 * this.blank) / (this.vNumber - 1);
  89. blankDraw = this.blank;
  90. }
  91. else
  92. {
  93. blankDraw = 0;
  94. hGridSpacingDraw = this.gridSpacing;
  95. vGridSpacingDraw = this.gridSpacing;
  96. }
  97. if (this.hNumber > 0)
  98. {
  99. if (this.hNumber % 2 == 0)
  100. {
  101. float Spacing = hGridSpacingDraw / 2;
  102. for (int i = 0; i < (float)this.hNumber / 2; i++)
  103. {
  104. if (this.wholePicture)
  105. {
  106. if (CSHeight > 2 * this.blank && CSWidth > 2 * this.blank)
  107. {
  108. if ((float)CSHeight / 2 - Spacing >= blankDraw)
  109. {
  110. //PointF pointF1 = rotatedAndPanPoint((float)(Convert.ToDecimal(x) - Convert.ToDecimal((float)this.gridWidth / 2) - 3)
  111. // , (float)(Convert.ToDecimal(y) - Convert.ToDecimal((float)this.gridWidth / 2) - 3));
  112. graphics.DrawLine(linePen, rotatedAndPanPoint(blankDraw, (float)CSHeight / 2 - Spacing, CSHeight, CSWidth)
  113. , rotatedAndPanPoint((float)(CSWidth - blankDraw), (float)CSHeight / 2 - Spacing, CSHeight, CSWidth));
  114. }
  115. if ((float)CSHeight / 2 + Spacing <= CSHeight - blankDraw)
  116. {
  117. graphics.DrawLine(linePen, rotatedAndPanPoint(blankDraw, (float)CSHeight / 2 + Spacing, CSHeight, CSWidth)
  118. , rotatedAndPanPoint((float)(CSWidth - blankDraw), (float)CSHeight / 2 + Spacing, CSHeight, CSWidth));
  119. }
  120. }
  121. }
  122. else
  123. {
  124. if ((float)CSHeight / 2 - Spacing >= 0)
  125. {
  126. graphics.DrawLine(linePen, rotatedAndPanPoint(minX, (float)CSHeight / 2 - Spacing, CSHeight, CSWidth)
  127. , rotatedAndPanPoint(maxX, (float)CSHeight / 2 - Spacing, CSHeight, CSWidth));
  128. }
  129. if ((float)CSHeight / 2 + Spacing <= CSHeight)
  130. {
  131. graphics.DrawLine(linePen, rotatedAndPanPoint(minX, (float)CSHeight / 2 + Spacing, CSHeight, CSWidth)
  132. , rotatedAndPanPoint(maxX, (float)CSHeight / 2 + Spacing, CSHeight, CSWidth));
  133. }
  134. }
  135. Spacing += hGridSpacingDraw;
  136. }
  137. }
  138. else
  139. {
  140. if ((float)CSWidth > 2 * blankDraw)
  141. {
  142. if (this.hNumber == 1)
  143. graphics.DrawLine(linePen, rotatedAndPanPoint(blankDraw, (float)CSHeight / 2, CSHeight, CSWidth)
  144. , rotatedAndPanPoint((float)(CSWidth - blankDraw), (float)CSHeight / 2, CSHeight, CSWidth));
  145. else
  146. {
  147. float Spacing = hGridSpacingDraw;
  148. for (int i = 0; i < (this.hNumber - 1) / 2; i++)
  149. {
  150. if (this.wholePicture)
  151. {
  152. if (CSHeight > 2 * this.blank && CSWidth > 2 * this.blank)
  153. {
  154. if (i == 0)
  155. graphics.DrawLine(linePen, rotatedAndPanPoint(blankDraw, (float)CSHeight / 2, CSHeight, CSWidth)
  156. , rotatedAndPanPoint((float)(CSWidth - blankDraw), (float)CSHeight / 2, CSHeight, CSWidth));
  157. if ((float)CSHeight / 2 - Spacing >= blankDraw)
  158. {
  159. graphics.DrawLine(linePen, rotatedAndPanPoint(blankDraw, (float)CSHeight / 2 - Spacing, CSHeight, CSWidth)
  160. , rotatedAndPanPoint((float)(CSWidth - blankDraw), (float)CSHeight / 2 - Spacing, CSHeight, CSWidth));
  161. }
  162. if ((float)CSHeight / 2 + Spacing <= CSHeight - blankDraw)
  163. {
  164. graphics.DrawLine(linePen, rotatedAndPanPoint(blankDraw, (float)CSHeight / 2 + Spacing, CSHeight, CSWidth)
  165. , rotatedAndPanPoint((float)(CSWidth - blankDraw), (float)CSHeight / 2 + Spacing, CSHeight, CSWidth));
  166. }
  167. }
  168. }
  169. else
  170. {
  171. if (i == 0)
  172. graphics.DrawLine(linePen, rotatedAndPanPoint(minX, (float)CSHeight / 2, CSHeight, CSWidth)
  173. , rotatedAndPanPoint(maxX, (float)CSHeight / 2, CSHeight, CSWidth));
  174. if ((float)CSHeight / 2 - Spacing >= 0)
  175. {
  176. graphics.DrawLine(linePen, rotatedAndPanPoint(minX, (float)CSHeight / 2 - Spacing, CSHeight, CSWidth)
  177. , rotatedAndPanPoint(maxX, (float)CSHeight / 2 - Spacing, CSHeight, CSWidth));
  178. }
  179. if ((float)CSHeight / 2 + Spacing <= CSHeight)
  180. {
  181. graphics.DrawLine(linePen, rotatedAndPanPoint(minX, (float)CSHeight / 2 + Spacing, CSHeight, CSWidth)
  182. , rotatedAndPanPoint(maxX, (float)CSHeight / 2 + Spacing, CSHeight, CSWidth));
  183. }
  184. }
  185. Spacing += hGridSpacingDraw;
  186. }
  187. }
  188. }
  189. }
  190. }
  191. if (this.vNumber > 0)
  192. {
  193. if (this.vNumber % 2 == 0)
  194. {
  195. float Spacing = vGridSpacingDraw / 2;
  196. for (int i = 0; i < (float)this.vNumber / 2; i++)
  197. {
  198. if (this.wholePicture)
  199. {
  200. if (CSHeight > 2 * this.blank && CSWidth > 2 * this.blank)
  201. {
  202. if ((float)CSWidth / 2 - Spacing >= 0
  203. && (float)CSWidth / 2 - Spacing >= blankDraw)
  204. {
  205. graphics.DrawLine(linePen, rotatedAndPanPoint((float)CSWidth / 2 - Spacing, blankDraw, CSHeight, CSWidth)
  206. , rotatedAndPanPoint((float)CSWidth / 2 - Spacing, (float)(CSHeight - blankDraw), CSHeight, CSWidth));
  207. }
  208. if ((float)CSWidth / 2 + Spacing <= CSWidth
  209. && (float)CSWidth / 2 + Spacing <= CSWidth - blankDraw)
  210. {
  211. graphics.DrawLine(linePen, rotatedAndPanPoint((float)CSWidth / 2 + Spacing, blankDraw, CSHeight, CSWidth)
  212. , rotatedAndPanPoint((float)CSWidth / 2 + Spacing, (float)(CSHeight - blankDraw), CSHeight, CSWidth));
  213. }
  214. }
  215. }
  216. else
  217. {
  218. if ((float)CSWidth / 2 - Spacing >= 0)
  219. {
  220. graphics.DrawLine(linePen, rotatedAndPanPoint((float)CSWidth / 2 - Spacing, minY, CSHeight, CSWidth)
  221. , rotatedAndPanPoint((float)CSWidth / 2 - Spacing, maxY, CSHeight, CSWidth));
  222. }
  223. if ((float)CSWidth / 2 + Spacing <= CSWidth)
  224. {
  225. graphics.DrawLine(linePen, rotatedAndPanPoint((float)CSWidth / 2 + Spacing, minY, CSHeight, CSWidth)
  226. , rotatedAndPanPoint((float)CSWidth / 2 + Spacing, maxY, CSHeight, CSWidth));
  227. }
  228. }
  229. Spacing += vGridSpacingDraw;
  230. }
  231. }
  232. else
  233. {
  234. if (CSHeight > 2 * blankDraw)
  235. {
  236. if (this.vNumber == 1)
  237. graphics.DrawLine(linePen, rotatedAndPanPoint((float)CSWidth / 2, blankDraw, CSHeight, CSWidth)
  238. , rotatedAndPanPoint((float)CSWidth / 2, (float)(CSHeight - blankDraw), CSHeight, CSWidth));
  239. else
  240. {
  241. float Spacing = vGridSpacingDraw;
  242. for (int i = 0; i < (this.vNumber - 1) / 2; i++)
  243. {
  244. if (this.wholePicture)
  245. {
  246. if (CSHeight > 2 * this.blank && CSWidth > 2 * this.blank)
  247. {
  248. if (i == 0)
  249. graphics.DrawLine(linePen, rotatedAndPanPoint((float)CSWidth / 2, blankDraw, CSHeight, CSWidth)
  250. , rotatedAndPanPoint((float)CSWidth / 2, (float)(CSHeight - blankDraw), CSHeight, CSWidth));
  251. if ((float)CSWidth / 2 + Spacing <= CSWidth
  252. && CSWidth / 2 + Spacing <= CSWidth - blankDraw)
  253. {
  254. graphics.DrawLine(linePen, rotatedAndPanPoint((float)CSWidth / 2 + Spacing, blankDraw, CSHeight, CSWidth)
  255. , rotatedAndPanPoint((float)CSWidth / 2 + Spacing, (float)(CSHeight - blankDraw), CSHeight, CSWidth));
  256. }
  257. if ((float)CSWidth / 2 - Spacing >= 0 && (float)CSWidth / 2 - Spacing >= blankDraw)
  258. {
  259. graphics.DrawLine(linePen, rotatedAndPanPoint((float)CSWidth / 2 - Spacing, blankDraw, CSHeight, CSWidth)
  260. , rotatedAndPanPoint((float)CSWidth / 2 - Spacing, (float)(CSHeight - blankDraw), CSHeight, CSWidth));
  261. }
  262. }
  263. }
  264. else
  265. {
  266. if (i == 0)
  267. graphics.DrawLine(linePen, rotatedAndPanPoint((float)CSWidth / 2, minY, CSHeight, CSWidth)
  268. , rotatedAndPanPoint((float)CSWidth / 2, maxY, CSHeight, CSWidth));
  269. if ((float)CSWidth / 2 + Spacing <= CSWidth)
  270. {
  271. graphics.DrawLine(linePen, rotatedAndPanPoint((float)CSWidth / 2 + Spacing, minY, CSHeight, CSWidth)
  272. , rotatedAndPanPoint((float)CSWidth / 2 + Spacing, maxY, CSHeight, CSWidth));
  273. }
  274. if ((float)CSWidth / 2 - Spacing >= 0)
  275. {
  276. graphics.DrawLine(linePen, rotatedAndPanPoint((float)CSWidth / 2 - Spacing, minY, CSHeight, CSWidth)
  277. , rotatedAndPanPoint((float)CSWidth / 2 - Spacing, maxY, CSHeight, CSWidth));
  278. }
  279. }
  280. Spacing += vGridSpacingDraw;
  281. }
  282. }
  283. }
  284. }
  285. }
  286. }
  287. /// <summary>
  288. /// 获取辅助线下拉集合
  289. /// </summary>
  290. /// <returns></returns>
  291. public ArrayList GetComboBox1DataSource()
  292. {
  293. ArrayList arrayList1 = new ArrayList();
  294. // 垂直辅助线
  295. if (grainSizeArbitrationLawModel.GridStyleList != null)
  296. {
  297. foreach (var vGuideStyle in grainSizeArbitrationLawModel.GridStyleList)
  298. {
  299. arrayList1.Add(vGuideStyle.gridName);
  300. }
  301. }
  302. arrayList1.Insert(0, PdnResources.GetString("Menu.Pleaseselecttheauxiliarylineused.text"));
  303. return arrayList1;
  304. }
  305. public void InitLawModel()
  306. {
  307. grainSizeArbitrationLawModel = XmlSerializeHelper.DESerializer<GrainSizeArbitrationLawModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeArbitrationLawModel.xml", FileMode.Open));
  308. }
  309. //public void InitUnitLength(Dictionary<MeasurementUnit, double> MeasureInfo)
  310. //{
  311. // MeasureInfo.TryGetValue(MeasurementUnit.Micron, out unitLength); double unitLength
  312. // //double physical_area_length_Micron = getCurrentWorkspace().GetRuler(MeasurementUnit.Micron);
  313. //}
  314. /// <summary>
  315. /// 更新辅助线及其样式
  316. /// </summary>
  317. public void UpdateGuideStyle(object comboBox1SelectedItem, double physical_Micron = 1.0)
  318. {
  319. if (grainSizeArbitrationLawModel.GridStyleList != null)
  320. {
  321. foreach (var GridStyle in grainSizeArbitrationLawModel.GridStyleList)
  322. {
  323. if (GridStyle.gridName.Equals(comboBox1SelectedItem))
  324. {
  325. this.hNumber = GridStyle.hNumber + 1;
  326. this.vNumber = GridStyle.vNumber + 1;
  327. this.gridWidth = GridStyle.gridWidth;
  328. this.gridSpacing = (float)(GridStyle.gridSpacing / physical_Micron);
  329. this.gridSpacing1 = (float)(GridStyle.gridSpacing);
  330. this.gridColor = GridStyle.gridColor;
  331. this.wholePicture = GridStyle.wholePicture;
  332. this.blank = GridStyle.blank;
  333. }
  334. }
  335. }
  336. }
  337. /// <summary>
  338. /// 初始化矩形
  339. /// </summary>
  340. public void InitRectangleF(PointF pointF, int CompositionSurfaceHeight, int CompositionSurfaceWidth)
  341. {
  342. // 全图
  343. if (this.wholePicture)
  344. {
  345. rectangleFLine = new RectangleF(pointF.X - CompositionSurfaceWidth / 2 + this.blank, pointF.Y - CompositionSurfaceHeight / 2 + this.blank
  346. , CompositionSurfaceWidth - 2 * this.blank, CompositionSurfaceHeight - 2 * this.blank);
  347. }
  348. else
  349. {
  350. rectangleFLine = new RectangleF(pointF.X - (this.vNumber - 1) * this.gridSpacing / 2, pointF.Y - (this.hNumber - 1) * this.gridSpacing / 2
  351. , (this.vNumber - 1) * this.gridSpacing, (this.hNumber - 1) * this.gridSpacing);
  352. }
  353. }
  354. /// <summary>
  355. /// 刷新网格矩形
  356. /// </summary>
  357. public void RefreshGridIntersections(int CompositionSurfaceHeight, int CompositionSurfaceWidth)
  358. {
  359. this.rectangleFs.Clear();
  360. ////float rectangleFLineX = this.rectangleFLine.X + this.lineWidth / 2 + spacing;
  361. //float panX = this.loctation.X - this.documentWorkspace.CompositionSurface.Width / 2;
  362. //float panY = this.loctation.Y - this.documentWorkspace.CompositionSurface.Height / 2;
  363. float hGridSpacingDraw;
  364. float vGridSpacingDraw;
  365. if (this.wholePicture)
  366. {
  367. hGridSpacingDraw = (float)(CompositionSurfaceHeight - 2 * this.blank) / (this.hNumber - 1);
  368. vGridSpacingDraw = (float)(CompositionSurfaceWidth - 2 * this.blank) / (this.vNumber - 1);
  369. }
  370. else
  371. {
  372. hGridSpacingDraw = this.gridSpacing;
  373. vGridSpacingDraw = this.gridSpacing;
  374. }
  375. ArrayList xs = new ArrayList();
  376. ArrayList ys = new ArrayList();
  377. if (this.hNumber > 0)
  378. {
  379. if (this.hNumber % 2 == 0)
  380. {
  381. float Spacing = hGridSpacingDraw / 2;
  382. for (int i = 0; i < this.hNumber / 2; i++)
  383. {
  384. if ((float)CompositionSurfaceHeight / 2 - Spacing >= 0
  385. && (float)CompositionSurfaceHeight / 2 + Spacing <= CompositionSurfaceHeight)
  386. {
  387. ys.Add((float)CompositionSurfaceHeight / 2 - Spacing);
  388. ys.Add((float)CompositionSurfaceHeight / 2 + Spacing);
  389. }
  390. Spacing += hGridSpacingDraw;
  391. }
  392. }
  393. else
  394. {
  395. if (this.hNumber == 1)
  396. ys.Add((float)CompositionSurfaceHeight / 2);
  397. else
  398. {
  399. float Spacing = hGridSpacingDraw;
  400. for (int i = 0; i < (this.hNumber - 1) / 2; i++)
  401. {
  402. if (i == 0)
  403. ys.Add((float)CompositionSurfaceHeight / 2);
  404. if ((float)CompositionSurfaceHeight / 2 - Spacing >= 0
  405. && (float)CompositionSurfaceHeight / 2 + Spacing <= CompositionSurfaceHeight)
  406. {
  407. ys.Add((float)CompositionSurfaceHeight / 2 - Spacing);
  408. ys.Add((float)CompositionSurfaceHeight / 2 + Spacing);
  409. }
  410. Spacing += hGridSpacingDraw;
  411. }
  412. }
  413. }
  414. }
  415. if (this.vNumber > 0)
  416. {
  417. if (this.vNumber % 2 == 0)
  418. {
  419. float Spacing = vGridSpacingDraw / 2;
  420. for (int i = 0; i < this.vNumber / 2; i++)
  421. {
  422. if ((float)CompositionSurfaceWidth / 2 - Spacing >= 0
  423. && (float)CompositionSurfaceWidth / 2 + Spacing <= CompositionSurfaceWidth)
  424. {
  425. xs.Add((float)CompositionSurfaceWidth / 2 - Spacing);
  426. xs.Add((float)CompositionSurfaceWidth / 2 + Spacing);
  427. }
  428. Spacing += vGridSpacingDraw;
  429. }
  430. }
  431. else
  432. {
  433. if (this.vNumber == 1)
  434. xs.Add((float)CompositionSurfaceWidth / 2);
  435. else
  436. {
  437. float Spacing = vGridSpacingDraw;
  438. for (int i = 0; i < (this.vNumber - 1) / 2; i++)
  439. {
  440. if (i == 0)
  441. xs.Add((float)CompositionSurfaceWidth / 2);
  442. if ((float)CompositionSurfaceWidth / 2 + Spacing <= CompositionSurfaceWidth
  443. && (float)CompositionSurfaceWidth / 2 - Spacing >= 0)
  444. {
  445. xs.Add((float)CompositionSurfaceWidth / 2 - Spacing);
  446. xs.Add((float)CompositionSurfaceWidth / 2 + Spacing);
  447. }
  448. Spacing += vGridSpacingDraw;
  449. }
  450. }
  451. }
  452. }
  453. if (xs.Count > 1)
  454. {
  455. this.minX = (float)xs[xs.Count - 2];
  456. this.maxX = (float)xs[xs.Count - 1];
  457. }
  458. if (ys.Count > 1)
  459. {
  460. this.minY = (float)ys[ys.Count - 2];
  461. this.maxY = (float)ys[ys.Count - 1];
  462. }
  463. foreach (var x in xs)
  464. {
  465. foreach (var y in ys)
  466. {
  467. PointF pointF1 = rotatedAndPanPoint/*计算旋转后的网点位置,同时需要加中心偏移*/((float)(Convert.ToDecimal(x) - 0/*Convert.ToDecimal((float)this.gridWidth / 2)*/)
  468. , (float)(Convert.ToDecimal(y) - 0/*Convert.ToDecimal((float)this.gridWidth / 2)*/), CompositionSurfaceHeight, CompositionSurfaceWidth);
  469. this.rectangleFs.Add(new RectangleF(pointF1.X - 6 - this.gridWidth / 2, pointF1.Y - 6 - this.gridWidth / 2, this.gridWidth + 6, this.gridWidth + 6));
  470. }
  471. }
  472. if (this.wholePicture)
  473. {
  474. int count = this.rectangleFs.Count;
  475. RectangleF rectangleF = new RectangleF(this.blank, this.blank, CompositionSurfaceWidth + 1 - 2 * this.blank
  476. , CompositionSurfaceHeight + 1 - 2 * this.blank);
  477. for (int i = count - 1; i >= 0; i--)
  478. {
  479. if (!rectangleF.Contains(new PointF(this.rectangleFs[i].X + 3 + (float)this.gridWidth / 2, this.rectangleFs[i].Y + 3 + (float)this.gridWidth / 2)))
  480. {
  481. this.rectangleFs.RemoveAt(i);
  482. }
  483. }
  484. }
  485. }
  486. private PointF rotatedPoint(float point_X, float point_Y, int CompositionSurfaceHeight, int CompositionSurfaceWidth)
  487. {
  488. double rotatedVPai = this.rotateAngleV * Math.PI / 180.0;
  489. double disX = point_X - CompositionSurfaceWidth / 2;
  490. double disY = point_Y - CompositionSurfaceHeight / 2;
  491. double outX = disX * Math.Cos(rotatedVPai) - disY * Math.Sin(rotatedVPai);
  492. double outY = disX * Math.Sin(rotatedVPai) + disY * Math.Cos(rotatedVPai);
  493. return new PointF((float)outX, (float)outY);
  494. }
  495. private PointF rotatedAndPanPoint(float point_X, float point_Y, int CompositionSurfaceHeight, int CompositionSurfaceWidth)
  496. {
  497. PointF point1 = rotatedPoint(point_X, point_Y, CompositionSurfaceHeight, CompositionSurfaceWidth);
  498. float panX = this.loctation.X;
  499. float panY = this.loctation.Y;
  500. return new PointF(point1.X + panX, point1.Y + panY);
  501. }
  502. }
  503. }