MeasurePointArcSize.cs 75 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670
  1. using PaintDotNet.Annotation.Enum;
  2. using PaintDotNet.Base.SettingModel;
  3. using PaintDotNet.Base.CommTool;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Drawing;
  7. using System.Drawing.Drawing2D;
  8. using System.Linq;
  9. using System.Windows.Forms;
  10. namespace PaintDotNet.Annotation.Measure
  11. {
  12. using PointList = List<PointF>;
  13. /// <summary>
  14. /// 测量->圆->点到圆距离
  15. /// </summary>
  16. public class MeasurePointArcSize : MeasureDrawObject
  17. {
  18. /// <summary>
  19. /// 点集合
  20. /// </summary>
  21. public PointList pointArray;
  22. /// <summary>
  23. /// 样式
  24. /// </summary>
  25. private MeasureStyleModel.MeasurePointArcSize measurePointArcSize;
  26. /// <summary>
  27. /// 圆心横坐标
  28. /// </summary>
  29. double x0;
  30. /// <summary>
  31. /// 圆心纵坐标
  32. /// </summary>
  33. double y0;
  34. /// <summary>
  35. /// 直径
  36. /// </summary>
  37. double radius = 0;
  38. /// <summary>
  39. /// 直线与圆心的交点
  40. /// </summary>
  41. Point distantPoint;
  42. /// <summary>
  43. /// 距离
  44. /// </summary>
  45. //private double length = 0.0;
  46. private GraphicsPath areaPath = null;
  47. private Pen areaPen = null;
  48. private Region areaRegion = null;
  49. /// <summary>
  50. /// 测量信息矩形定义
  51. /// </summary>
  52. private RectangleF rectangleF1 = new RectangleF();
  53. private RectangleF rectangleF2 = new RectangleF();
  54. private RectangleF rectangleF3 = new RectangleF();
  55. private RectangleF rectangleF4 = new RectangleF();
  56. private RectangleF rectangleF5 = new RectangleF();
  57. private RectangleF rectangleF6 = new RectangleF();
  58. private RectangleF rectangleF7 = new RectangleF();
  59. private RectangleF rectangleF8 = new RectangleF();
  60. private RectangleF rectangleF9 = new RectangleF();
  61. private RectangleF rectangleF10 = new RectangleF();
  62. private RectangleF rectangleF11 = new RectangleF();
  63. private RectangleF rectangleF12 = new RectangleF();
  64. private RectangleF rectangleF13 = new RectangleF();
  65. private RectangleF rectangleF14 = new RectangleF();
  66. private RectangleF rectangleF15 = new RectangleF();
  67. private RectangleF rectangleF16 = new RectangleF();
  68. private RectangleF rectangleF17 = new RectangleF();
  69. /// <summary>
  70. /// 文本上用于拖动的点
  71. /// </summary>
  72. private Point pointL = new Point();
  73. /// <summary>
  74. /// 绘制限制(第一次绘制时)
  75. /// </summary>
  76. public bool pointChange = true;
  77. /// <summary>
  78. /// 区分移动文本
  79. /// </summary>
  80. private int moveKb;
  81. /// <summary>
  82. /// 绘制限制(从配置文件加载)
  83. /// </summary>
  84. public bool configurationFile = false;
  85. /// <summary>
  86. /// 绘制限制(更改属性时)
  87. /// </summary>
  88. private bool SavePointChange;
  89. /// <summary>
  90. /// 绘制属性
  91. /// </summary>
  92. private string[] drawingPropertiesList;
  93. /// <summary>
  94. /// 绘制属性(克隆)
  95. /// </summary>
  96. private string[] drawingPropertiesListClone;
  97. /// <summary>
  98. /// 限制绘制(绘制中)
  99. /// </summary>
  100. public bool mouseUpPointChange = false;
  101. public MeasurePointArcSize(ISurfaceBox surfaceBox) : base(surfaceBox)
  102. {
  103. this.objectType = DrawClass.Measure;
  104. this.drawToolType = DrawToolType.MeasurePointArcSize;
  105. measurePointArcSize = surfaceBox.GetMeasureStyleModel().measurePointArcSize;
  106. pointArray = new PointList();
  107. Initialize();
  108. }
  109. public MeasurePointArcSize(ISurfaceBox surfaceBox, int x1, int y1, bool clone) : base(surfaceBox)
  110. {
  111. this.objectType = DrawClass.Measure;
  112. this.drawToolType = DrawToolType.MeasurePointArcSize;
  113. measurePointArcSize = surfaceBox.GetMeasureStyleModel().measurePointArcSize;
  114. pointArray = new PointList();
  115. if (clone)
  116. pointArray.Add(new Point(x1, y1));
  117. this.measurementUnit = (MeasurementUnit)System.Enum.Parse(typeof(MeasurementUnit), surfaceBox.GetPxPerUnit()[0]);
  118. this.unitString = surfaceBox.GetPxPerUnit()[1];
  119. this.unit = surfaceBox.GetPxPerUnit()[2];
  120. Initialize();
  121. }
  122. public MeasurePointArcSize(ISurfaceBox surfaceBox, List<PointF> points, ParentStyleModel parentStyleModel, Object content) : base(surfaceBox)
  123. {
  124. this.objectType = DrawClass.Measure;
  125. this.drawToolType = DrawToolType.MeasurePointArcSize;
  126. this.ISurfaceBox = surfaceBox;
  127. measurePointArcSize = (MeasureStyleModel.MeasurePointArcSize)parentStyleModel;
  128. pointArray = DrawRulerHelper.DeepCopyListByReflect(points);
  129. startPoint = points[0];
  130. this.measurementUnit = (MeasurementUnit)System.Enum.Parse(typeof(MeasurementUnit), surfaceBox.GetPxPerUnit()[0]);
  131. this.unitString = surfaceBox.GetPxPerUnit()[1];
  132. this.unit = surfaceBox.GetPxPerUnit()[2];
  133. this.configurationFile = true;
  134. }
  135. /// <summary>
  136. /// Clone this instance
  137. /// </summary>
  138. public override DrawObject Clone()
  139. {
  140. MeasurePointArcSize drawPointEdgeSize = new MeasurePointArcSize(ISurfaceBox, (int)pointArray[0].X, (int)pointArray[0].Y, false);
  141. drawPointEdgeSize.ISurfaceBox = ISurfaceBox;
  142. foreach (PointF p in this.pointArray)
  143. {
  144. drawPointEdgeSize.pointArray.Add(p);
  145. }
  146. if (drawingPropertiesList != null)
  147. drawPointEdgeSize.drawingPropertiesListClone = drawingPropertiesList;
  148. FillDrawObjectFields(drawPointEdgeSize);
  149. return drawPointEdgeSize;
  150. }
  151. public override DrawObject Clone(ISurfaceBox surfaceBox)
  152. {
  153. MeasurePointArcSize drawPointEdgeSize = new MeasurePointArcSize(surfaceBox, this.GetPoints(), this.measurePointArcSize, null);
  154. if (drawingPropertiesList != null)
  155. drawPointEdgeSize.drawingPropertiesListClone = drawingPropertiesList;
  156. FillDrawObjectFields(drawPointEdgeSize);
  157. return drawPointEdgeSize;
  158. }
  159. /// <summary>
  160. /// 测量属性
  161. /// </summary>
  162. /// <returns></returns>
  163. public override Dictionary<System.Enum, object> GetData()
  164. {
  165. if (data.ContainsKey(MeasureAttributes.MeasureMethod))
  166. data[MeasureAttributes.MeasureMethod] = PdnResources.GetString("Menu.MeasureAction.CircularMeasurement.Text");
  167. else
  168. data.Add(MeasureAttributes.MeasureMethod, PdnResources.GetString("Menu.MeasureAction.CircularMeasurement.Text"));
  169. if (data.ContainsKey(MeasureAttributes.MeasureUnitCN))
  170. data[MeasureAttributes.MeasureUnitCN] = this.unitString;
  171. else
  172. data.Add(MeasureAttributes.MeasureUnitCN, this.unitString);
  173. if (data.ContainsKey(MeasureAttributes.MeasureUnitEN))
  174. data[MeasureAttributes.MeasureUnitEN] = this.unit;
  175. else
  176. data.Add(MeasureAttributes.MeasureUnitEN, this.unit);
  177. if (data.ContainsKey(MeasureAttributes.PixelDistance))
  178. data[MeasureAttributes.PixelDistance] = Math.Round(this.length, decimalPlaces);
  179. else
  180. data.Add(MeasureAttributes.PixelDistance, Math.Round(this.length, decimalPlaces));
  181. string s = Math.Round(this.length * unitLength, decimalPlaces).ToString();
  182. if (s.IndexOf(".") == -1)
  183. {
  184. for (int i = 0; i < decimalPlaces; i++)
  185. {
  186. if (i == 0)
  187. s += ".";
  188. s += "0";
  189. }
  190. }
  191. else
  192. {
  193. int a = s.Length - s.IndexOf(".") - 1;
  194. if (a < decimalPlaces)
  195. {
  196. for (int i = 0; i < decimalPlaces - a; i++)
  197. {
  198. s += "0";
  199. }
  200. }
  201. }
  202. if (data.ContainsKey(MeasureAttributes.PhysicalDistance))
  203. data[MeasureAttributes.PhysicalDistance] = s;
  204. else
  205. data.Add(MeasureAttributes.PhysicalDistance, s);
  206. if (data.ContainsKey(MeasureAttributes.PixelArea))
  207. data[MeasureAttributes.PixelArea] = Math.Round(Math.PI * radius / 2 * radius / 2, decimalPlaces);
  208. else
  209. data.Add(MeasureAttributes.PixelArea, Math.Round(Math.PI * radius / 2 * radius / 2, decimalPlaces));
  210. s = Math.Round(Math.PI * radius / 2 * radius / 2 * unitLength, decimalPlaces).ToString();
  211. if (s.IndexOf(".") == -1)
  212. {
  213. for (int i = 0; i < decimalPlaces; i++)
  214. {
  215. if (i == 0)
  216. s += ".";
  217. s += "0";
  218. }
  219. }
  220. else
  221. {
  222. int dic = s.Length - s.IndexOf(".") - 1;
  223. if (dic < decimalPlaces)
  224. {
  225. for (int i = 0; i < decimalPlaces - dic; i++)
  226. {
  227. s += "0";
  228. }
  229. }
  230. }
  231. if (data.ContainsKey(MeasureAttributes.PhysicalArea))
  232. data[MeasureAttributes.PhysicalArea] = s;
  233. else
  234. data.Add(MeasureAttributes.PhysicalArea, s);
  235. if (data.ContainsKey(MeasureAttributes.PixelCircumference))
  236. data[MeasureAttributes.PixelCircumference] = Math.Round(Math.PI * radius , decimalPlaces);
  237. else
  238. data.Add(MeasureAttributes.PixelCircumference, Math.Round(Math.PI * radius, decimalPlaces));
  239. s = Math.Round(Math.PI * radius * unitLength, decimalPlaces).ToString();
  240. if (s.IndexOf(".") == -1)
  241. {
  242. for (int i = 0; i < decimalPlaces; i++)
  243. {
  244. if (i == 0)
  245. s += ".";
  246. s += "0";
  247. }
  248. }
  249. else
  250. {
  251. int dic = s.Length - s.IndexOf(".") - 1;
  252. if (dic < decimalPlaces)
  253. {
  254. for (int i = 0; i < decimalPlaces - dic; i++)
  255. {
  256. s += "0";
  257. }
  258. }
  259. }
  260. if (data.ContainsKey(MeasureAttributes.PhysicalCircumference))
  261. data[MeasureAttributes.PhysicalCircumference] = s;
  262. else
  263. data.Add(MeasureAttributes.PhysicalCircumference, s);
  264. if (data.ContainsKey(MeasureAttributes.PixelCenterX))
  265. data[MeasureAttributes.PixelCenterX] = Math.Round(this.x0, decimalPlaces);
  266. else
  267. data.Add(MeasureAttributes.PixelCenterX, Math.Round(this.x0, decimalPlaces));
  268. if (data.ContainsKey(MeasureAttributes.PixelCenterY))
  269. data[MeasureAttributes.PixelCenterY] = Math.Round(this.y0, decimalPlaces);
  270. else
  271. data.Add(MeasureAttributes.PixelCenterY, Math.Round(this.y0, decimalPlaces));
  272. if (data.ContainsKey(MeasureAttributes.PhysicalCenterX))
  273. data[MeasureAttributes.PhysicalCenterX] = Math.Round(this.x0 * unitLength, decimalPlaces);
  274. else
  275. data.Add(MeasureAttributes.PhysicalCenterX, Math.Round(this.x0 * unitLength, decimalPlaces));
  276. if (data.ContainsKey(MeasureAttributes.PhysicalCenterY))
  277. data[MeasureAttributes.PhysicalCenterY] = Math.Round(this.y0 * unitLength, decimalPlaces);
  278. else
  279. data.Add(MeasureAttributes.PhysicalCenterY, Math.Round(this.y0 * unitLength, decimalPlaces));
  280. if (data.ContainsKey(MeasureAttributes.PixelRadius))
  281. data[MeasureAttributes.PixelRadius] = Math.Round(radius / 2, decimalPlaces);
  282. else
  283. data.Add(MeasureAttributes.PixelRadius, Math.Round(radius / 2, decimalPlaces));
  284. s = Math.Round(radius / 2 * unitLength, decimalPlaces).ToString();
  285. if (s.IndexOf(".") == -1)
  286. {
  287. for (int i = 0; i < decimalPlaces; i++)
  288. {
  289. if (i == 0)
  290. s += ".";
  291. s += "0";
  292. }
  293. }
  294. else
  295. {
  296. int dic = s.Length - s.IndexOf(".") - 1;
  297. if (dic < decimalPlaces)
  298. {
  299. for (int i = 0; i < decimalPlaces - dic; i++)
  300. {
  301. s += "0";
  302. }
  303. }
  304. }
  305. if (data.ContainsKey(MeasureAttributes.PhysicalRadius))
  306. data[MeasureAttributes.PhysicalRadius] = s;
  307. else
  308. data.Add(MeasureAttributes.PhysicalRadius, s);
  309. if (data.ContainsKey(MeasureAttributes.PixelDiameter))
  310. data[MeasureAttributes.PixelDiameter] = Math.Round(radius, decimalPlaces);
  311. else
  312. data.Add(MeasureAttributes.PixelDiameter, Math.Round(radius, decimalPlaces));
  313. s = Math.Round(radius * unitLength, decimalPlaces).ToString();
  314. if (s.IndexOf(".") == -1)
  315. {
  316. for (int i = 0; i < decimalPlaces; i++)
  317. {
  318. if (i == 0)
  319. s += ".";
  320. s += "0";
  321. }
  322. }
  323. else
  324. {
  325. int dic = s.Length - s.IndexOf(".") - 1;
  326. if (dic < decimalPlaces)
  327. {
  328. for (int i = 0; i < decimalPlaces - dic; i++)
  329. {
  330. s += "0";
  331. }
  332. }
  333. }
  334. if (data.ContainsKey(MeasureAttributes.PhysicalDiameter))
  335. data[MeasureAttributes.PhysicalDiameter] = s;
  336. else
  337. data.Add(MeasureAttributes.PhysicalDiameter, s);
  338. return data;
  339. }
  340. GraphicsPath path = new GraphicsPath();
  341. public override void Draw(Graphics g)
  342. {
  343. path = new GraphicsPath();
  344. measurePointArcSize = this.ISurfaceBox.GetMeasureStyleModel().measurePointArcSize;
  345. drawingProperties.TryGetValue(this.drawToolType, out drawingPropertiesList);
  346. pointChangeObject.TryGetValue(this.drawToolType, out SavePointChange);
  347. Color color = Color.FromArgb(this.measurePointArcSize.lineColor);
  348. Pen pen = new Pen(color, PenWidth);
  349. int penWidth = this.measurePointArcSize.lineWidth;
  350. pen.DashStyle = (DashStyle)this.measurePointArcSize.lineStyle;
  351. pen.Width = penWidth;
  352. Font textfont = new Font(measurePointArcSize.font, measurePointArcSize.fontSize);
  353. Brush textbrush = new SolidBrush(Color.FromArgb(measurePointArcSize.textColor));
  354. Pen linePen = new Pen(Color.FromArgb(measurePointArcSize.lineColor), measurePointArcSize.lineWidth);
  355. linePen.DashStyle = (DashStyle)measurePointArcSize.lineStyle;
  356. if (this.Selected)
  357. {
  358. if (measurePointArcSize.chooseStyle != null)
  359. {
  360. textfont = new Font(measurePointArcSize.chooseStyle.font, measurePointArcSize.chooseStyle.fontSize);
  361. textbrush = new SolidBrush(Color.FromArgb(measurePointArcSize.chooseStyle.textColor));
  362. linePen = new Pen(Color.FromArgb(measurePointArcSize.chooseStyle.lineColor), measurePointArcSize.chooseStyle.lineWidth);
  363. linePen.DashStyle = (DashStyle)measurePointArcSize.chooseStyle.lineStyle;
  364. }
  365. }
  366. if (!this.Selected)
  367. {
  368. this.pointChange = true;
  369. rectangleF1 = new RectangleF();
  370. rectangleF2 = new RectangleF();
  371. rectangleF3 = new RectangleF();
  372. rectangleF4 = new RectangleF();
  373. rectangleF5 = new RectangleF();
  374. rectangleF6 = new RectangleF();
  375. rectangleF7 = new RectangleF();
  376. rectangleF8 = new RectangleF();
  377. rectangleF9 = new RectangleF();
  378. rectangleF10 = new RectangleF();
  379. rectangleF11 = new RectangleF();
  380. rectangleF12 = new RectangleF();
  381. rectangleF13 = new RectangleF();
  382. rectangleF14 = new RectangleF();
  383. rectangleF15 = new RectangleF();
  384. rectangleF16 = new RectangleF();
  385. rectangleF17 = new RectangleF();
  386. }
  387. g.SmoothingMode = SmoothingMode.AntiAlias;
  388. if (HandleCount - 1 == 2) {
  389. g.DrawLine(linePen, pointArray[0].X, pointArray[0].Y, pointArray[1].X, pointArray[1].Y);
  390. }
  391. string frontStr = string.Empty;
  392. if (this.measurePointArcSize.showSuffix)
  393. {
  394. frontStr = this.measurePointArcSize.suffixName;
  395. }
  396. if (this.measurePointArcSize.showSerial)
  397. {
  398. #region [获取序号]
  399. List<DrawObject> newGraphicsList = new List<DrawObject>();
  400. int n = ISurfaceBox.GraphicsList.Count;
  401. int num = 0;
  402. for (int i = n - 1; i >= 0; i--)
  403. {
  404. newGraphicsList.Add(ISurfaceBox.GraphicsList[i].Clone());
  405. }
  406. var newGraphics = newGraphicsList.Where(m => m.ID.Equals(this.ID)).FirstOrDefault();
  407. if (newGraphics != null)
  408. {
  409. num = newGraphicsList.IndexOf(newGraphics) + 1;
  410. }
  411. #endregion
  412. frontStr = $"[{ num }]{frontStr}";
  413. }
  414. if (this.measurePointArcSize.showAlias)
  415. {
  416. frontStr = this.measurePointArcSize.aliasName + frontStr;
  417. }
  418. if (HandleCount - 1 > 2)
  419. {
  420. if (drawingPropertiesList == null)
  421. {
  422. drawingPropertiesList = drawingPropertiesListClone;
  423. this.configurationFile = true;
  424. }
  425. double a = pointArray[0].X - pointArray[1].X;
  426. double b = pointArray[0].Y - pointArray[1].Y;
  427. double c = pointArray[0].X - pointArray[2].X;
  428. double d = pointArray[0].Y - pointArray[2].Y;
  429. double e = ((pointArray[0].X * pointArray[0].X - pointArray[1].X * pointArray[1].X)
  430. + (pointArray[0].Y * pointArray[0].Y - pointArray[1].Y * pointArray[1].Y)) / 2.0;
  431. double f = ((pointArray[0].X * pointArray[0].X - pointArray[2].X * pointArray[2].X)
  432. + (pointArray[0].Y * pointArray[0].Y - pointArray[2].Y * pointArray[2].Y)) / 2.0;
  433. double det = b * c - a * d;
  434. if (Math.Abs(det) > 0.001)
  435. {
  436. //x0,y0为计算得到的原点
  437. x0 = -(d * e - b * f) / det;
  438. y0 = -(a * f - c * e) / det;
  439. radius = Math.Sqrt((pointArray[0].X - x0) * (pointArray[0].X - x0) + (pointArray[0].Y - y0) * (pointArray[0].Y - y0));
  440. double angle1;
  441. double angle2;
  442. double angle3;
  443. double sinValue1;
  444. double cosValue1;
  445. double sinValue2;
  446. double cosValue2;
  447. double sinValue3;
  448. double cosValue3;
  449. sinValue1 = (pointArray[0].Y - y0) / radius; cosValue1 = (pointArray[0].X - x0) / radius;
  450. if (cosValue1 >= 0.99999)
  451. cosValue1 = 0.99999;
  452. if (cosValue1 <= -0.99999)
  453. cosValue1 = -0.99999;
  454. angle1 = Math.Acos(cosValue1); angle1 = angle1 / 3.14 * 180;
  455. if (sinValue1 < -0.05)
  456. angle1 = 360 - angle1;
  457. sinValue2 = (pointArray[1].Y - y0) / radius; cosValue2 = (pointArray[1].X - x0) / radius;
  458. if (cosValue2 >= 0.99999)
  459. cosValue2 = 0.99999;
  460. if (cosValue2 <= -0.99999)
  461. cosValue2 = -0.99999;
  462. angle2 = Math.Acos(cosValue2);
  463. angle2 = angle2 / 3.14 * 180;
  464. if (sinValue2 < -0.05)
  465. angle2 = 360 - angle2;
  466. sinValue3 = (pointArray[2].Y - y0) / radius; cosValue3 = (pointArray[2].X - x0) / radius;
  467. if (cosValue3 >= 0.99999)
  468. cosValue3 = 0.99999;
  469. if (cosValue3 <= -0.99999)
  470. cosValue3 = -0.99999;
  471. angle3 = Math.Acos(cosValue3); angle3 = angle3 / 3.14 * 180;
  472. if (sinValue3 < -0.05)
  473. angle3 = 360 - angle3;
  474. bool PosDown = false;
  475. double Delta13;
  476. if (angle1 < angle3)
  477. {
  478. Delta13 = angle3 - angle1;
  479. }
  480. else
  481. Delta13 = angle3 - angle1 + 360;
  482. double Delta12;
  483. if (angle1 < angle2)
  484. {
  485. Delta12 = angle2 - angle1;
  486. }
  487. else
  488. Delta12 = angle2 - angle1 + 360;
  489. if (Delta13 > Delta12)
  490. PosDown = true;
  491. else
  492. PosDown = false;
  493. double radius1 = radius + 5;
  494. if (PosDown)
  495. {
  496. if (angle3 > angle1)
  497. {
  498. g.DrawArc(pen, (int)(x0 - radius), (int)(y0 - radius),
  499. (int)(2 * radius), (int)(2 * radius), (int)(angle1), (int)(angle3 - angle1));
  500. path.AddArc((int)(x0 - radius1), (int)(y0 - radius1),
  501. (int)(2 * radius1), (int)(2 * radius1), (int)(angle1), (int)(angle3 - angle1));
  502. }
  503. else
  504. {
  505. g.DrawArc(pen, (int)(x0 - radius), (int)(y0 - radius),
  506. (int)(2 * radius), (int)(2 * radius), (int)(angle1), (int)(angle3 - angle1 + 360));
  507. path.AddArc((int)(x0 - radius1), (int)(y0 - radius1),
  508. (int)(2 * radius1), (int)(2 * radius1), (int)(angle1), (int)(angle3 - angle1 + 360));
  509. }
  510. }
  511. else
  512. {
  513. if (angle1 > angle3)
  514. {
  515. g.DrawArc(pen, (int)(x0 - radius), (int)(y0 - radius),
  516. (int)(2 * radius), (int)(2 * radius), (int)(angle3), (int)(angle1 - angle3));
  517. path.AddArc((int)(x0 - radius1), (int)(y0 - radius1),
  518. (int)(2 * radius1), (int)(2 * radius1), (int)(angle3), (int)(angle1 - angle3));
  519. }
  520. else
  521. {
  522. g.DrawArc(pen, (int)(x0 - radius), (int)(y0 - radius),
  523. (int)(2 * radius), (int)(2 * radius), (int)(angle3), (int)(angle1 - angle3 + 360));
  524. path.AddArc((int)(x0 - radius1), (int)(y0 - radius1),
  525. (int)(2 * radius1), (int)(2 * radius1), (int)(angle3), (int)(angle1 - angle3 + 360));
  526. }
  527. }
  528. }
  529. float x1 = pointArray[0].X;
  530. float y1 = pointArray[0].Y;
  531. float x2 = pointArray[1].X;
  532. float y2 = pointArray[1].Y;
  533. float x3 = pointArray[2].X;
  534. float y3 = pointArray[2].Y;
  535. a = x1 - x2;
  536. b = y1 - y2;
  537. c = x1 - x3;
  538. d = y1 - y3;
  539. e = ((x1 * x1 - x2 * x2) + (y1 * y1 - y2 * y2)) / 2.0;
  540. f = ((x1 * x1 - x3 * x3) + (y1 * y1 - y3 * y3)) / 2.0;
  541. x0 = x1;
  542. y0 = y1;
  543. double det1 = b * c - a * d;
  544. if (Math.Abs(det1) > 0.001)
  545. {
  546. //x0,y0为计算得到的原点
  547. x0 = -(d * e - b * f) / det1;
  548. y0 = -(a * f - c * e) / det1;
  549. radius = Math.Round(Math.Sqrt((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0)) * 2, 2);
  550. }
  551. rectangle.X = Convert.ToInt32(x0 - radius / 2);
  552. rectangle.Y = Convert.ToInt32(y0 - radius / 2);
  553. rectangle.Width = Convert.ToInt32(radius);
  554. rectangle.Height = Convert.ToInt32(radius);
  555. if (HandleCount - 1 == 4)
  556. {
  557. if (drawingPropertiesList == null)
  558. {
  559. drawingPropertiesList = drawingPropertiesListClone;
  560. this.configurationFile = true;
  561. }
  562. SizeF sizeF1 = new SizeF();
  563. double towPointDistance = BasicCalculationHelper.GetDistance(new Point(Convert.ToInt32(x0), Convert.ToInt32(y0)), new PointF(pointArray[3].X, pointArray[3].Y), 2);
  564. double edgeSize = Math.Abs(towPointDistance - (radius / 2));
  565. double arrowAngle = BasicCalculationHelper.CalculateAngle(x0, y0, x0 - radius / 2, y0, pointArray[3].X, pointArray[3].Y);
  566. if (pointArray[3].X - x0 >= 0 && pointArray[3].Y - y0 <= 0)
  567. {
  568. arrowAngle = arrowAngle + 180;
  569. }
  570. if (pointArray[3].X - x0 >= 0 && pointArray[3].Y - y0 >= 0)
  571. {
  572. arrowAngle = arrowAngle - 180;
  573. }
  574. distantPoint = BasicCalculationHelper.GetAnglePoint(new Point(Convert.ToInt32(x0 - radius / 2), Convert.ToInt32(y0)), new Point(Convert.ToInt32(x0), Convert.ToInt32(y0)), arrowAngle);
  575. System.Drawing.Region region = new Region(path);
  576. double length = BasicCalculationHelper.GetDistance(distantPoint, pointArray[0], 0);
  577. double length1 = BasicCalculationHelper.GetDistance(distantPoint, pointArray[2], 0);
  578. if (!region.IsVisible(distantPoint))
  579. {
  580. if(length >= length1)
  581. {
  582. pointArray[3] = BasicCalculationHelper.GetIntersection(new PointF((float)x0, (float)y0), pointArray[2], pointArray[3], new PointF(pointArray[3].X + 10, pointArray[3].Y));
  583. distantPoint = new Point((int)pointArray[2].X, (int)pointArray[2].Y);
  584. }
  585. else
  586. {
  587. pointArray[3] = BasicCalculationHelper.GetIntersection(new PointF((float)x0, (float)y0), pointArray[0], pointArray[3], new PointF(pointArray[3].X + 10, pointArray[3].Y));
  588. distantPoint = new Point((int)pointArray[0].X, (int)pointArray[0].Y);
  589. }
  590. }
  591. g.DrawLine(linePen, pointArray[3].X, pointArray[3].Y, distantPoint.X, distantPoint.Y);
  592. this.length = edgeSize;
  593. if (this.pointChange || this.SavePointChange || this.mouseUpPointChange || this.mouseUpAttribute)
  594. {
  595. int offsetValue = measurePointArcSize.fontSize + measurePointArcSize.fontSize / 2;
  596. int offsetValue1 = measurePointArcSize.lineWidth * 2 / 3;
  597. int offset = offsetValue1;
  598. this.pointL = new Point((int)pointArray[0].X, (int)pointArray[0].Y);
  599. if (drawingPropertiesList != null)
  600. {
  601. if (drawingPropertiesList.Contains(MeasureAttributes.PixelDistance.ToString()))
  602. {
  603. sizeF1 = g.MeasureString(frontStr + "" + Math.Round(this.length, decimalPlaces) + "px", textfont);
  604. rectangleF16.Location = new Point((int)pointArray[0].X + offsetValue1 - (int)sizeF1.Width / 2, (int)pointArray[0].Y + offset);
  605. offset += offsetValue;
  606. }
  607. if (drawingPropertiesList.Contains(MeasureAttributes.PhysicalDistance.ToString()))
  608. {
  609. string s = Math.Round(this.length * unitLength, decimalPlaces).ToString();
  610. if (s.IndexOf(".") == -1)
  611. {
  612. for (int i = 0; i < decimalPlaces; i++)
  613. {
  614. if (i == 0)
  615. s += ".";
  616. s += "0";
  617. }
  618. }
  619. else
  620. {
  621. int dic = s.Length - s.IndexOf(".") - 1;
  622. if (dic < decimalPlaces)
  623. {
  624. for (int i = 0; i < decimalPlaces - dic; i++)
  625. {
  626. s += "0";
  627. }
  628. }
  629. }
  630. sizeF1 = g.MeasureString(frontStr + "" + Math.Round(this.length * unitLength, decimalPlaces) + this.unit, textfont);
  631. rectangleF17.Location = new Point((int)pointArray[0].X + offsetValue1 - (int)sizeF1.Width / 2, (int)pointArray[0].Y + offset);
  632. offset += offsetValue;
  633. }
  634. if (drawingPropertiesList.Contains(MeasureAttributes.PixelRadius.ToString()))
  635. {
  636. sizeF1 = g.MeasureString(frontStr + "" + Math.Round(radius / 2, decimalPlaces) + "px", textfont);
  637. rectangleF12.Location = new Point((int)pointArray[0].X + offsetValue1 - (int)sizeF1.Width / 2, (int)pointArray[0].Y + offset);
  638. offset += offsetValue;
  639. }
  640. if (drawingPropertiesList.Contains(MeasureAttributes.PhysicalRadius.ToString()))
  641. {
  642. string s = Math.Round(radius / 2 * unitLength, decimalPlaces).ToString();
  643. if (s.IndexOf(".") == -1)
  644. {
  645. for (int i = 0; i < decimalPlaces; i++)
  646. {
  647. if (i == 0)
  648. s += ".";
  649. s += "0";
  650. }
  651. }
  652. else
  653. {
  654. int dic = s.Length - s.IndexOf(".") - 1;
  655. if (dic < decimalPlaces)
  656. {
  657. for (int i = 0; i < decimalPlaces - dic; i++)
  658. {
  659. s += "0";
  660. }
  661. }
  662. }
  663. sizeF1 = g.MeasureString(frontStr + s + this.unit, textfont);
  664. rectangleF13.Location = new Point((int)pointArray[0].X + offsetValue1 - (int)sizeF1.Width / 2, (int)pointArray[0].Y + offset);
  665. offset += offsetValue;
  666. }
  667. if (drawingPropertiesList.Contains(MeasureAttributes.PixelDiameter.ToString()))
  668. {
  669. sizeF1 = g.MeasureString(frontStr + "" + Math.Round(radius, decimalPlaces) + "px", textfont);
  670. rectangleF14.Location = new Point((int)pointArray[0].X + offsetValue1 - (int)sizeF1.Width / 2, (int)pointArray[0].Y + offset);
  671. offset += offsetValue;
  672. }
  673. if (drawingPropertiesList.Contains(MeasureAttributes.PhysicalDiameter.ToString()))
  674. {
  675. string s = Math.Round(radius * unitLength, decimalPlaces).ToString();
  676. if (s.IndexOf(".") == -1)
  677. {
  678. for (int i = 0; i < decimalPlaces; i++)
  679. {
  680. if (i == 0)
  681. s += ".";
  682. s += "0";
  683. }
  684. }
  685. else
  686. {
  687. int dic = s.Length - s.IndexOf(".") - 1;
  688. if (dic < decimalPlaces)
  689. {
  690. for (int i = 0; i < decimalPlaces - dic; i++)
  691. {
  692. s += "0";
  693. }
  694. }
  695. }
  696. sizeF1 = g.MeasureString(frontStr + s + this.unit, textfont);
  697. rectangleF15.Location = new Point((int)pointArray[0].X + offsetValue1 - (int)sizeF1.Width / 2, (int)pointArray[0].Y + offset);
  698. offset += offsetValue;
  699. }
  700. if (drawingPropertiesList.Contains(MeasureAttributes.PixelCircumference.ToString()))
  701. {
  702. sizeF1 = g.MeasureString(frontStr + "" + Math.Round(Math.PI * radius, decimalPlaces) + "px", textfont);
  703. rectangleF6.Location = new Point((int)pointArray[0].X + offsetValue1 - (int)sizeF1.Width / 2, (int)pointArray[0].Y + offset);
  704. offset += offsetValue;
  705. }
  706. if (drawingPropertiesList.Contains(MeasureAttributes.PhysicalCircumference.ToString()))
  707. {
  708. string s = Math.Round(Math.PI * radius * unitLength, decimalPlaces).ToString();
  709. if (s.IndexOf(".") == -1)
  710. {
  711. for (int i = 0; i < decimalPlaces; i++)
  712. {
  713. if (i == 0)
  714. s += ".";
  715. s += "0";
  716. }
  717. }
  718. else
  719. {
  720. int dic = s.Length - s.IndexOf(".") - 1;
  721. if (dic < decimalPlaces)
  722. {
  723. for (int i = 0; i < decimalPlaces - dic; i++)
  724. {
  725. s += "0";
  726. }
  727. }
  728. }
  729. sizeF1 = g.MeasureString(frontStr + s + this.unit, textfont);
  730. rectangleF7.Location = new Point((int)pointArray[0].X + offsetValue1 - (int)sizeF1.Width / 2, (int)pointArray[0].Y + offset);
  731. offset += offsetValue;
  732. }
  733. if (drawingPropertiesList.Contains(MeasureAttributes.PixelArea.ToString()))
  734. {
  735. sizeF1 = g.MeasureString(frontStr + "" + Math.Round(Math.PI * (radius / 2) * (radius / 2), decimalPlaces) + "px²", textfont);
  736. rectangleF4.Location = new Point((int)pointArray[0].X + offsetValue1 - (int)sizeF1.Width / 2, (int)pointArray[0].Y + offset);
  737. offset += offsetValue;
  738. }
  739. if (drawingPropertiesList.Contains(MeasureAttributes.PhysicalArea.ToString()))
  740. {
  741. string s = Math.Round(Math.PI * (radius / 2) * (radius / 2) * unitLength, decimalPlaces).ToString();
  742. if (s.IndexOf(".") == -1)
  743. {
  744. for (int i = 0; i < decimalPlaces; i++)
  745. {
  746. if (i == 0)
  747. s += ".";
  748. s += "0";
  749. }
  750. }
  751. else
  752. {
  753. int dic = s.Length - s.IndexOf(".") - 1;
  754. if (dic < decimalPlaces)
  755. {
  756. for (int i = 0; i < decimalPlaces - dic; i++)
  757. {
  758. s += "0";
  759. }
  760. }
  761. }
  762. sizeF1 = g.MeasureString(frontStr + s + this.unit + "²", textfont);
  763. rectangleF5.Location = new Point((int)pointArray[0].X + offsetValue1 - (int)sizeF1.Width / 2, (int)pointArray[0].Y + offset);
  764. offset += offsetValue;
  765. }
  766. if (drawingPropertiesList.Contains(MeasureAttributes.PixelCenterX.ToString()))
  767. {
  768. sizeF1 = g.MeasureString(frontStr + "" + Math.Round(this.x0, decimalPlaces), textfont);
  769. rectangleF8.Location = new Point((int)pointArray[0].X + offsetValue1 - (int)sizeF1.Width / 2, (int)pointArray[0].Y + offset);
  770. offset += offsetValue;
  771. }
  772. if (drawingPropertiesList.Contains(MeasureAttributes.PixelCenterY.ToString()))
  773. {
  774. sizeF1 = g.MeasureString(frontStr + "" + Math.Round(this.y0, decimalPlaces), textfont);
  775. rectangleF9.Location = new Point((int)pointArray[0].X + offsetValue1 - (int)sizeF1.Width / 2, (int)pointArray[0].Y + offset);
  776. offset += offsetValue;
  777. }
  778. if (drawingPropertiesList.Contains(MeasureAttributes.PhysicalCenterX.ToString()))
  779. {
  780. sizeF1 = g.MeasureString(frontStr + "" + Math.Round(this.x0 * unitLength, decimalPlaces), textfont);
  781. rectangleF10.Location = new Point((int)pointArray[0].X + offsetValue1 - (int)sizeF1.Width / 2, (int)pointArray[0].Y + offset);
  782. offset += offsetValue;
  783. }
  784. if (drawingPropertiesList.Contains(MeasureAttributes.PhysicalCenterY.ToString()))
  785. {
  786. sizeF1 = g.MeasureString(frontStr + "" + Math.Round(this.y0 * unitLength, decimalPlaces), textfont);
  787. rectangleF11.Location = new Point((int)pointArray[0].X + offsetValue1 - (int)sizeF1.Width / 2, (int)pointArray[0].Y + offset);
  788. offset += offsetValue;
  789. }
  790. if (drawingPropertiesList.Contains(MeasureAttributes.MeasureMethod.ToString()))
  791. {
  792. sizeF1 = g.MeasureString(frontStr + "" + PdnResources.GetString("Menu.MeasureAction.CircularMeasurement.Text"), textfont);
  793. rectangleF1.Location = new Point((int)pointArray[0].X + offsetValue1 - (int)sizeF1.Width / 2, (int)pointArray[0].Y + offset);
  794. offset += offsetValue;
  795. }
  796. if (drawingPropertiesList.Contains(MeasureAttributes.MeasureUnitCN.ToString()))
  797. {
  798. sizeF1 = g.MeasureString(frontStr + "" + this.unitString, textfont);
  799. rectangleF2.Location = new Point((int)pointArray[0].X + offsetValue1 - (int)sizeF1.Width / 2, (int)pointArray[0].Y + offset);
  800. offset += offsetValue;
  801. }
  802. if (drawingPropertiesList.Contains(MeasureAttributes.MeasureUnitEN.ToString()))
  803. {
  804. sizeF1 = g.MeasureString(frontStr + "" + this.unit, textfont);
  805. rectangleF3.Location = new Point((int)pointArray[0].X + offsetValue1 - (int)sizeF1.Width / 2, (int)pointArray[0].Y + offset);
  806. offset += offsetValue;
  807. }
  808. }
  809. }
  810. if (drawingPropertiesList != null)
  811. {
  812. if (drawingPropertiesList.Contains(MeasureAttributes.MeasureMethod.ToString()))
  813. {
  814. sizeF1 = g.MeasureString(frontStr + "" + PdnResources.GetString("Menu.MeasureAction.CircularMeasurement.Text"), textfont);
  815. rectangleF1.Width = sizeF1.Width;
  816. rectangleF1.Height = sizeF1.Height;
  817. g.DrawString(frontStr + "" + PdnResources.GetString("Menu.MeasureAction.CircularMeasurement.Text"), textfont, textbrush, rectangleF1);
  818. }
  819. else
  820. {
  821. rectangleF1 = new RectangleF();
  822. }
  823. if (drawingPropertiesList.Contains(MeasureAttributes.MeasureUnitCN.ToString()))
  824. {
  825. sizeF1 = g.MeasureString(frontStr + "" + this.unitString, textfont);
  826. rectangleF2.Width = sizeF1.Width;
  827. rectangleF2.Height = sizeF1.Height;
  828. g.DrawString(frontStr + "" + this.unitString, textfont, textbrush, rectangleF2);
  829. }
  830. else
  831. {
  832. rectangleF2 = new RectangleF();
  833. }
  834. if (drawingPropertiesList.Contains(MeasureAttributes.MeasureUnitEN.ToString()))
  835. {
  836. sizeF1 = g.MeasureString(frontStr + "" + this.unit, textfont);
  837. rectangleF3.Width = sizeF1.Width;
  838. rectangleF3.Height = sizeF1.Height;
  839. g.DrawString(frontStr + "" + this.unit, textfont, textbrush, rectangleF3);
  840. }
  841. else
  842. {
  843. rectangleF3 = new RectangleF();
  844. }
  845. if (drawingPropertiesList.Contains(MeasureAttributes.PixelArea.ToString()))
  846. {
  847. sizeF1 = g.MeasureString(frontStr + "" + Math.Round(Math.PI * (radius / 2) * (radius / 2), decimalPlaces) + "px²", textfont);
  848. rectangleF4.Width = sizeF1.Width;
  849. rectangleF4.Height = sizeF1.Height;
  850. g.DrawString(frontStr + "" + Math.Round(Math.PI * (radius / 2) * (radius / 2), decimalPlaces) + "px²", textfont, textbrush, rectangleF4);
  851. }
  852. else
  853. {
  854. rectangleF4 = new RectangleF();
  855. }
  856. if (drawingPropertiesList.Contains(MeasureAttributes.PhysicalArea.ToString()))
  857. {
  858. string s = Math.Round(Math.PI * (radius / 2) * (radius / 2) * unitLength, decimalPlaces).ToString();
  859. if (s.IndexOf(".") == -1)
  860. {
  861. for (int i = 0; i < decimalPlaces; i++)
  862. {
  863. if (i == 0)
  864. s += ".";
  865. s += "0";
  866. }
  867. }
  868. else
  869. {
  870. int dic = s.Length - s.IndexOf(".") - 1;
  871. if (dic < decimalPlaces)
  872. {
  873. for (int i = 0; i < decimalPlaces - dic; i++)
  874. {
  875. s += "0";
  876. }
  877. }
  878. }
  879. sizeF1 = g.MeasureString(frontStr + s + this.unit + "²", textfont);
  880. rectangleF5.Width = sizeF1.Width;
  881. rectangleF5.Height = sizeF1.Height;
  882. g.DrawString(frontStr + s + this.unit + "²", textfont, textbrush, rectangleF5);
  883. }
  884. else
  885. {
  886. rectangleF5 = new RectangleF();
  887. }
  888. if (drawingPropertiesList.Contains(MeasureAttributes.PixelCircumference.ToString()))
  889. {
  890. sizeF1 = g.MeasureString(frontStr + "" + Math.Round(Math.PI * radius, decimalPlaces) + "px", textfont);
  891. rectangleF6.Width = sizeF1.Width;
  892. rectangleF6.Height = sizeF1.Height;
  893. g.DrawString(frontStr + "" + Math.Round(Math.PI * radius, decimalPlaces) + "px", textfont, textbrush, rectangleF6);
  894. }
  895. else
  896. {
  897. rectangleF6 = new RectangleF();
  898. }
  899. if (drawingPropertiesList.Contains(MeasureAttributes.PhysicalCircumference.ToString()))
  900. {
  901. string s = Math.Round(Math.PI * radius * unitLength, decimalPlaces).ToString();
  902. if (s.IndexOf(".") == -1)
  903. {
  904. for (int i = 0; i < decimalPlaces; i++)
  905. {
  906. if (i == 0)
  907. s += ".";
  908. s += "0";
  909. }
  910. }
  911. else
  912. {
  913. int dic = s.Length - s.IndexOf(".") - 1;
  914. if (dic < decimalPlaces)
  915. {
  916. for (int i = 0; i < decimalPlaces - dic; i++)
  917. {
  918. s += "0";
  919. }
  920. }
  921. }
  922. sizeF1 = g.MeasureString(frontStr + s + this.unit, textfont);
  923. rectangleF7.Width = sizeF1.Width;
  924. rectangleF7.Height = sizeF1.Height;
  925. g.DrawString(frontStr + s + this.unit, textfont, textbrush, rectangleF7);
  926. }
  927. else
  928. {
  929. rectangleF7 = new RectangleF();
  930. }
  931. if (drawingPropertiesList.Contains(MeasureAttributes.PixelCenterX.ToString()))
  932. {
  933. sizeF1 = g.MeasureString(frontStr + "" + Math.Round(this.x0, decimalPlaces), textfont);
  934. rectangleF8.Width = sizeF1.Width;
  935. rectangleF8.Height = sizeF1.Height;
  936. g.DrawString(frontStr + "" + Math.Round(this.x0, decimalPlaces), textfont, textbrush, rectangleF8);
  937. }
  938. else
  939. {
  940. rectangleF8 = new RectangleF();
  941. }
  942. if (drawingPropertiesList.Contains(MeasureAttributes.PixelCenterY.ToString()))
  943. {
  944. sizeF1 = g.MeasureString(frontStr + "" + Math.Round(this.y0, decimalPlaces), textfont);
  945. rectangleF9.Width = sizeF1.Width;
  946. rectangleF9.Height = sizeF1.Height;
  947. g.DrawString(frontStr + "" + Math.Round(this.y0, decimalPlaces), textfont, textbrush, rectangleF9);
  948. }
  949. else
  950. {
  951. rectangleF9 = new RectangleF();
  952. }
  953. if (drawingPropertiesList.Contains(MeasureAttributes.PhysicalCenterX.ToString()))
  954. {
  955. sizeF1 = g.MeasureString(frontStr + "" + Math.Round(this.x0 * unitLength, decimalPlaces), textfont);
  956. rectangleF10.Width = sizeF1.Width;
  957. rectangleF10.Height = sizeF1.Height;
  958. g.DrawString(frontStr + "" + Math.Round(this.x0 * unitLength, decimalPlaces), textfont, textbrush, rectangleF10);
  959. }
  960. else
  961. {
  962. rectangleF10 = new RectangleF();
  963. }
  964. if (drawingPropertiesList.Contains(MeasureAttributes.PhysicalCenterY.ToString()))
  965. {
  966. sizeF1 = g.MeasureString(frontStr + "" + Math.Round(this.y0 * unitLength, decimalPlaces), textfont);
  967. rectangleF11.Width = sizeF1.Width;
  968. rectangleF11.Height = sizeF1.Height;
  969. g.DrawString(frontStr + "" + Math.Round(this.y0 * unitLength, decimalPlaces), textfont, textbrush, rectangleF11);
  970. }
  971. else
  972. {
  973. rectangleF11 = new RectangleF();
  974. }
  975. if (drawingPropertiesList.Contains(MeasureAttributes.PixelRadius.ToString()))
  976. {
  977. sizeF1 = g.MeasureString(frontStr + "" + Math.Round(radius / 2, decimalPlaces) + "px", textfont);
  978. rectangleF12.Width = sizeF1.Width;
  979. rectangleF12.Height = sizeF1.Height;
  980. g.DrawString(frontStr + "" + Math.Round(radius / 2, decimalPlaces) + "px", textfont, textbrush, rectangleF12);
  981. }
  982. else
  983. {
  984. rectangleF12 = new RectangleF();
  985. }
  986. if (drawingPropertiesList.Contains(MeasureAttributes.PhysicalRadius.ToString()))
  987. {
  988. string s = Math.Round(radius / 2 * unitLength, decimalPlaces).ToString();
  989. if (s.IndexOf(".") == -1)
  990. {
  991. for (int i = 0; i < decimalPlaces; i++)
  992. {
  993. if (i == 0)
  994. s += ".";
  995. s += "0";
  996. }
  997. }
  998. else
  999. {
  1000. int dic = s.Length - s.IndexOf(".") - 1;
  1001. if (dic < decimalPlaces)
  1002. {
  1003. for (int i = 0; i < decimalPlaces - dic; i++)
  1004. {
  1005. s += "0";
  1006. }
  1007. }
  1008. }
  1009. sizeF1 = g.MeasureString(frontStr + s + this.unit, textfont);
  1010. rectangleF13.Width = sizeF1.Width;
  1011. rectangleF13.Height = sizeF1.Height;
  1012. g.DrawString(frontStr + s + this.unit, textfont, textbrush, rectangleF13);
  1013. }
  1014. else
  1015. {
  1016. rectangleF13 = new RectangleF();
  1017. }
  1018. if (drawingPropertiesList.Contains(MeasureAttributes.PixelDiameter.ToString()))
  1019. {
  1020. sizeF1 = g.MeasureString(frontStr + "" + Math.Round(radius, decimalPlaces) + "px", textfont);
  1021. rectangleF14.Width = sizeF1.Width;
  1022. rectangleF14.Height = sizeF1.Height;
  1023. g.DrawString(frontStr + "" + Math.Round(radius, decimalPlaces) + "px", textfont, textbrush, rectangleF14);
  1024. }
  1025. else
  1026. {
  1027. rectangleF14 = new RectangleF();
  1028. }
  1029. if (drawingPropertiesList.Contains(MeasureAttributes.PhysicalDiameter.ToString()))
  1030. {
  1031. string s = Math.Round(radius * unitLength, decimalPlaces).ToString();
  1032. if (s.IndexOf(".") == -1)
  1033. {
  1034. for (int i = 0; i < decimalPlaces; i++)
  1035. {
  1036. if (i == 0)
  1037. s += ".";
  1038. s += "0";
  1039. }
  1040. }
  1041. else
  1042. {
  1043. int dic = s.Length - s.IndexOf(".") - 1;
  1044. if (dic < decimalPlaces)
  1045. {
  1046. for (int i = 0; i < decimalPlaces - dic; i++)
  1047. {
  1048. s += "0";
  1049. }
  1050. }
  1051. }
  1052. sizeF1 = g.MeasureString(frontStr + s + this.unit, textfont);
  1053. rectangleF15.Width = sizeF1.Width;
  1054. rectangleF15.Height = sizeF1.Height;
  1055. g.DrawString(frontStr + s + this.unit, textfont, textbrush, rectangleF15);
  1056. }
  1057. else
  1058. {
  1059. rectangleF15 = new RectangleF();
  1060. }
  1061. if (drawingPropertiesList.Contains(MeasureAttributes.PixelDistance.ToString()))
  1062. {
  1063. sizeF1 = g.MeasureString(frontStr + "" + Math.Round(this.length, decimalPlaces) + "px", textfont);
  1064. rectangleF16.Width = sizeF1.Width;
  1065. rectangleF16.Height = sizeF1.Height;
  1066. g.DrawString(frontStr + "" + Math.Round(this.length, decimalPlaces) + "px", textfont, textbrush, rectangleF16);
  1067. }
  1068. else
  1069. {
  1070. rectangleF16 = new RectangleF();
  1071. }
  1072. if (drawingPropertiesList.Contains(MeasureAttributes.PhysicalDistance.ToString()))
  1073. {
  1074. string s = Math.Round(this.length * unitLength, decimalPlaces).ToString();
  1075. if (s.IndexOf(".") == -1)
  1076. {
  1077. for (int i = 0; i < decimalPlaces; i++)
  1078. {
  1079. if (i == 0)
  1080. s += ".";
  1081. s += "0";
  1082. }
  1083. }
  1084. else
  1085. {
  1086. int dic = s.Length - s.IndexOf(".") - 1;
  1087. if (dic < decimalPlaces)
  1088. {
  1089. for (int i = 0; i < decimalPlaces - dic; i++)
  1090. {
  1091. s += "0";
  1092. }
  1093. }
  1094. }
  1095. sizeF1 = g.MeasureString(frontStr + s + this.unit, textfont);
  1096. rectangleF17.Width = sizeF1.Width;
  1097. rectangleF17.Height = sizeF1.Height;
  1098. g.DrawString(frontStr + s + this.unit, textfont, textbrush, rectangleF17);
  1099. }
  1100. else
  1101. {
  1102. rectangleF17 = new RectangleF();
  1103. }
  1104. }
  1105. }
  1106. }
  1107. pen.Dispose();
  1108. linePen.Dispose();
  1109. if (this.configurationFile)
  1110. this.pointChange = false;
  1111. this.mouseUpAttribute = false;
  1112. pointChangeObject.Remove(this.drawToolType);
  1113. }
  1114. /// <summary>
  1115. /// 停止绘制时
  1116. /// </summary>
  1117. /// <param name="up"></param>
  1118. public override void MouseUp(bool up)
  1119. {
  1120. mouseUpPointChange = up;
  1121. }
  1122. public void AddPoint(Point point)
  1123. {
  1124. pointArray.Add(point);
  1125. }
  1126. public override int HandleCount
  1127. {
  1128. get
  1129. {
  1130. return pointArray.Count + 1;
  1131. }
  1132. }
  1133. /// <summary>
  1134. /// Get handle pointscroll by 1-based number
  1135. /// </summary>
  1136. /// <param name="handleNumber"></param>
  1137. /// <returns></returns>
  1138. public override PointF GetHandle(int handleNumber)
  1139. {
  1140. float x = 0;
  1141. float y = 0;
  1142. switch (handleNumber)
  1143. {
  1144. case 1:
  1145. x = pointArray[0].X;
  1146. y = pointArray[0].Y;
  1147. break;
  1148. case 2:
  1149. x = pointArray[1].X;
  1150. y = pointArray[1].Y;
  1151. break;
  1152. case 3:
  1153. x = pointArray[2].X;
  1154. y = pointArray[2].Y;
  1155. break;
  1156. case 4:
  1157. x = pointArray[3].X;
  1158. y = pointArray[3].Y;
  1159. break;
  1160. case 5:
  1161. x = distantPoint.X;
  1162. y = distantPoint.Y;
  1163. break;
  1164. case 6:
  1165. x = Convert.ToInt32(x0);
  1166. y = Convert.ToInt32(y0);
  1167. break;
  1168. case 7:
  1169. x = this.pointL.X;
  1170. y = this.pointL.Y;
  1171. break;
  1172. }
  1173. return new PointF(x, y);
  1174. }
  1175. /// <summary>
  1176. /// Hit test.
  1177. /// Return value: -1 - no hit
  1178. /// 0 - hit anywhere
  1179. /// > 1 - handle number
  1180. /// </summary>
  1181. /// <param name="pointscroll"></param>
  1182. /// <returns></returns>
  1183. public override int HitTest(Point point)
  1184. {
  1185. if (Selected)
  1186. {
  1187. for (int i = 1; i <= 6; i++)
  1188. {
  1189. if (GetHandleRectangle(i).Contains(point))
  1190. return i;
  1191. }
  1192. if (this.rectangleF1.Contains(point))
  1193. {
  1194. this.pointL = point;
  1195. moveKb = 1;
  1196. return 7;
  1197. }
  1198. else if (this.rectangleF2.Contains(point))
  1199. {
  1200. this.pointL = point;
  1201. moveKb = 2;
  1202. return 7;
  1203. }
  1204. else if (this.rectangleF3.Contains(point))
  1205. {
  1206. this.pointL = point;
  1207. moveKb = 3;
  1208. return 7;
  1209. }
  1210. else if (this.rectangleF4.Contains(point))
  1211. {
  1212. this.pointL = point;
  1213. moveKb = 4;
  1214. return 7;
  1215. }
  1216. else if (this.rectangleF5.Contains(point))
  1217. {
  1218. this.pointL = point;
  1219. moveKb = 5;
  1220. return 7;
  1221. }
  1222. else if (this.rectangleF6.Contains(point))
  1223. {
  1224. this.pointL = point;
  1225. moveKb = 6;
  1226. return 7;
  1227. }
  1228. else if (this.rectangleF7.Contains(point))
  1229. {
  1230. this.pointL = point;
  1231. moveKb = 7;
  1232. return 7;
  1233. }
  1234. else if (this.rectangleF8.Contains(point))
  1235. {
  1236. this.pointL = point;
  1237. moveKb = 8;
  1238. return 7;
  1239. }
  1240. else if (this.rectangleF9.Contains(point))
  1241. {
  1242. this.pointL = point;
  1243. moveKb = 9;
  1244. return 7;
  1245. }
  1246. else if (this.rectangleF10.Contains(point))
  1247. {
  1248. this.pointL = point;
  1249. moveKb = 10;
  1250. return 7;
  1251. }
  1252. else if (this.rectangleF11.Contains(point))
  1253. {
  1254. this.pointL = point;
  1255. moveKb = 11;
  1256. return 7;
  1257. }
  1258. else if (this.rectangleF12.Contains(point))
  1259. {
  1260. this.pointL = point;
  1261. moveKb = 12;
  1262. return 7;
  1263. }
  1264. else if (this.rectangleF13.Contains(point))
  1265. {
  1266. this.pointL = point;
  1267. moveKb = 13;
  1268. return 7;
  1269. }
  1270. else if (this.rectangleF14.Contains(point))
  1271. {
  1272. this.pointL = point;
  1273. moveKb = 14;
  1274. return 7;
  1275. }
  1276. else if (this.rectangleF15.Contains(point))
  1277. {
  1278. this.pointL = point;
  1279. moveKb = 15;
  1280. return 7;
  1281. }
  1282. else if (this.rectangleF16.Contains(point))
  1283. {
  1284. this.pointL = point;
  1285. moveKb = 16;
  1286. return 7;
  1287. }
  1288. else if (this.rectangleF17.Contains(point))
  1289. {
  1290. this.pointL = point;
  1291. moveKb = 17;
  1292. return 7;
  1293. }
  1294. }
  1295. if (PointInObject(point))
  1296. return 0;
  1297. return -1;
  1298. }
  1299. protected override bool PointInObject(Point point)
  1300. {
  1301. CreateObjects();
  1302. return rectangle.Contains(point);
  1303. }
  1304. public override bool IntersectsWith(Rectangle rectangle)
  1305. {
  1306. CreateObjects();
  1307. return AreaRegion.IsVisible(rectangle);
  1308. }
  1309. protected virtual void CreateObjects()
  1310. {
  1311. if (AreaPath != null)
  1312. return;
  1313. AreaPath = new GraphicsPath();
  1314. AreaPath.AddRectangle(GetBoundingBox());
  1315. AreaPath.CloseFigure();
  1316. AreaRegion = new Region(AreaPath);
  1317. }
  1318. protected GraphicsPath AreaPath
  1319. {
  1320. get
  1321. {
  1322. return areaPath;
  1323. }
  1324. set
  1325. {
  1326. areaPath = value;
  1327. }
  1328. }
  1329. protected Region AreaRegion
  1330. {
  1331. get
  1332. {
  1333. return areaRegion;
  1334. }
  1335. set
  1336. {
  1337. areaRegion = value;
  1338. }
  1339. }
  1340. protected Pen AreaPen
  1341. {
  1342. get
  1343. {
  1344. return areaPen;
  1345. }
  1346. set
  1347. {
  1348. areaPen = value;
  1349. }
  1350. }
  1351. public override Cursor GetHandleCursor(int handleNumber)
  1352. {
  1353. return handleCursor;
  1354. }
  1355. public override void MoveHandleTo(Point point, int handleNumber)
  1356. {
  1357. //aaa = false;
  1358. //System.Drawing.Region region = new Region(path);
  1359. //if (region.IsVisible(distantPoint))
  1360. //{
  1361. // aaa = true;
  1362. //}
  1363. if (handleNumber < 5)
  1364. {
  1365. this.mouseUpPointChange = true;
  1366. if (handleNumber == 1)
  1367. {
  1368. this.rectangleF1.Offset(point.X - this.pointArray[0].X, point.Y - this.pointArray[0].Y);
  1369. this.rectangleF2.Offset(point.X - this.pointArray[0].X, point.Y - this.pointArray[0].Y);
  1370. this.rectangleF3.Offset(point.X - this.pointArray[0].X, point.Y - this.pointArray[0].Y);
  1371. this.rectangleF4.Offset(point.X - this.pointArray[0].X, point.Y - this.pointArray[0].Y);
  1372. this.rectangleF5.Offset(point.X - this.pointArray[0].X, point.Y - this.pointArray[0].Y);
  1373. this.rectangleF6.Offset(point.X - this.pointArray[0].X, point.Y - this.pointArray[0].Y);
  1374. this.rectangleF7.Offset(point.X - this.pointArray[0].X, point.Y - this.pointArray[0].Y);
  1375. this.rectangleF8.Offset(point.X - this.pointArray[0].X, point.Y - this.pointArray[0].Y);
  1376. this.rectangleF9.Offset(point.X - this.pointArray[0].X, point.Y - this.pointArray[0].Y);
  1377. this.rectangleF10.Offset(point.X - this.pointArray[0].X, point.Y - this.pointArray[0].Y);
  1378. this.rectangleF11.Offset(point.X - this.pointArray[0].X, point.Y - this.pointArray[0].Y);
  1379. this.rectangleF12.Offset(point.X - this.pointArray[0].X, point.Y - this.pointArray[0].Y);
  1380. this.rectangleF13.Offset(point.X - this.pointArray[0].X, point.Y - this.pointArray[0].Y);
  1381. this.rectangleF14.Offset(point.X - this.pointArray[0].X, point.Y - this.pointArray[0].Y);
  1382. this.rectangleF15.Offset(point.X - this.pointArray[0].X, point.Y - this.pointArray[0].Y);
  1383. this.rectangleF16.Offset(point.X - this.pointArray[0].X, point.Y - this.pointArray[0].Y);
  1384. this.rectangleF17.Offset(point.X - this.pointArray[0].X, point.Y - this.pointArray[0].Y);
  1385. }
  1386. //else if (handleNumber == 4)
  1387. //{
  1388. // if (aaa)
  1389. // pointArray[handleNumber - 1] = point;
  1390. // else
  1391. // {
  1392. // //pointArray[handleNumber - 1] = pointF;
  1393. // }
  1394. //}
  1395. //else
  1396. pointArray[handleNumber - 1] = point;
  1397. }
  1398. else if (handleNumber == 7)
  1399. {
  1400. if (this.moveKb == 1)
  1401. this.rectangleF1.Offset(point.X - this.pointL.X, point.Y - this.pointL.Y);
  1402. else if (this.moveKb == 2)
  1403. this.rectangleF2.Offset(point.X - this.pointL.X, point.Y - this.pointL.Y);
  1404. else if (this.moveKb == 3)
  1405. this.rectangleF3.Offset(point.X - this.pointL.X, point.Y - this.pointL.Y);
  1406. else if (this.moveKb == 4)
  1407. this.rectangleF4.Offset(point.X - this.pointL.X, point.Y - this.pointL.Y);
  1408. else if (this.moveKb == 5)
  1409. this.rectangleF5.Offset(point.X - this.pointL.X, point.Y - this.pointL.Y);
  1410. else if (this.moveKb == 6)
  1411. this.rectangleF6.Offset(point.X - this.pointL.X, point.Y - this.pointL.Y);
  1412. else if (this.moveKb == 7)
  1413. this.rectangleF7.Offset(point.X - this.pointL.X, point.Y - this.pointL.Y);
  1414. else if (this.moveKb == 8)
  1415. this.rectangleF8.Offset(point.X - this.pointL.X, point.Y - this.pointL.Y);
  1416. else if (this.moveKb == 9)
  1417. this.rectangleF9.Offset(point.X - this.pointL.X, point.Y - this.pointL.Y);
  1418. else if (this.moveKb == 10)
  1419. this.rectangleF10.Offset(point.X - this.pointL.X, point.Y - this.pointL.Y);
  1420. else if (this.moveKb == 11)
  1421. this.rectangleF11.Offset(point.X - this.pointL.X, point.Y - this.pointL.Y);
  1422. else if (this.moveKb == 12)
  1423. this.rectangleF12.Offset(point.X - this.pointL.X, point.Y - this.pointL.Y);
  1424. else if (this.moveKb == 13)
  1425. this.rectangleF13.Offset(point.X - this.pointL.X, point.Y - this.pointL.Y);
  1426. else if (this.moveKb == 14)
  1427. this.rectangleF14.Offset(point.X - this.pointL.X, point.Y - this.pointL.Y);
  1428. else if (this.moveKb == 15)
  1429. this.rectangleF15.Offset(point.X - this.pointL.X, point.Y - this.pointL.Y);
  1430. else if (this.moveKb == 16)
  1431. this.rectangleF16.Offset(point.X - this.pointL.X, point.Y - this.pointL.Y);
  1432. else if (this.moveKb == 17)
  1433. this.rectangleF17.Offset(point.X - this.pointL.X, point.Y - this.pointL.Y);
  1434. this.pointL = point;
  1435. }
  1436. }
  1437. public override void Move(int deltaX, int deltaY)
  1438. {
  1439. for (int i = 0; i < pointArray.Count; i++)
  1440. {
  1441. pointArray[i] = new PointF(pointArray[i].X + ISurfaceBox.UnscaleScalar(deltaX), pointArray[i].Y + ISurfaceBox.UnscaleScalar(deltaY));
  1442. }
  1443. this.startPoint = pointArray[0];
  1444. int x = ISurfaceBox.UnscaleScalar(deltaX);
  1445. int y = ISurfaceBox.UnscaleScalar(deltaY);
  1446. pointL.X += x;
  1447. pointL.Y += y;
  1448. this.rectangleF1.Offset(x, y);
  1449. this.rectangleF2.Offset(x, y);
  1450. this.rectangleF3.Offset(x, y);
  1451. this.rectangleF4.Offset(x, y);
  1452. this.rectangleF5.Offset(x, y);
  1453. this.rectangleF6.Offset(x, y);
  1454. this.rectangleF7.Offset(x, y);
  1455. this.rectangleF8.Offset(x, y);
  1456. this.rectangleF9.Offset(x, y);
  1457. this.rectangleF10.Offset(x, y);
  1458. this.rectangleF11.Offset(x, y);
  1459. this.rectangleF12.Offset(x, y);
  1460. this.rectangleF13.Offset(x, y);
  1461. this.rectangleF14.Offset(x, y);
  1462. this.rectangleF15.Offset(x, y);
  1463. this.rectangleF16.Offset(x, y);
  1464. this.rectangleF17.Offset(x, y);
  1465. Invalidate();
  1466. }
  1467. /// <summary>
  1468. /// Invalidate object.
  1469. /// When object is invalidated, path used for hit test
  1470. /// is released and should be created again.
  1471. /// </summary>
  1472. protected void Invalidate()
  1473. {
  1474. if (AreaPath != null)
  1475. {
  1476. AreaPath.Dispose();
  1477. AreaPath = null;
  1478. }
  1479. if (AreaPen != null)
  1480. {
  1481. AreaPen.Dispose();
  1482. AreaPen = null;
  1483. }
  1484. if (AreaRegion != null)
  1485. {
  1486. AreaRegion.Dispose();
  1487. AreaRegion = null;
  1488. }
  1489. }
  1490. /// <summary>
  1491. /// Normalize rectangle
  1492. /// </summary>
  1493. public override void Normalize()
  1494. {
  1495. rectangle = Annotation.DrawObject.GetNormalizedRectangle(rectangle);
  1496. }
  1497. public override RectangleF GetBoundingBox()
  1498. {
  1499. Rectangle rectangle;
  1500. int minx = 0, maxx = 0, miny = 0, maxy = 0;
  1501. for (int i = 0; i < pointArray.Count; i++)
  1502. {
  1503. if (i == 0)
  1504. {
  1505. minx = maxx = (int)pointArray[i].X;
  1506. miny = maxy = (int)pointArray[i].Y;
  1507. }
  1508. else
  1509. {
  1510. if (pointArray[i].X > maxx) maxx = (int)pointArray[i].X;
  1511. if (pointArray[i].X < minx) minx = (int)pointArray[i].X;
  1512. if (pointArray[i].Y > maxy) maxy = (int)pointArray[i].Y;
  1513. if (pointArray[i].Y < miny) miny = (int)pointArray[i].Y;
  1514. }
  1515. }
  1516. rectangle = new Rectangle(minx, miny, maxx - minx, maxy - miny);
  1517. return rectangle;
  1518. }
  1519. internal void setNextPoint(Point p)
  1520. {
  1521. AddPoint(p);
  1522. }
  1523. public override void DrawTracker(Graphics g)
  1524. {
  1525. if (!Selected)
  1526. return;
  1527. if (pointArray.Count >= 4)
  1528. {
  1529. SolidBrush brush = new SolidBrush(Color.FromArgb(MarkpointAreaColor));
  1530. Pen pen = new Pen(Color.FromArgb(MarkpointLineColor), MarkpointLineWidth);
  1531. for (int i = 1; i <= 6; i++)
  1532. {
  1533. if (i == 7)
  1534. {
  1535. brush = new SolidBrush(Color.Transparent);
  1536. pen = new Pen(Color.Transparent);
  1537. }
  1538. switch (MarkpointStyle)
  1539. {
  1540. case 0:
  1541. g.FillRectangle(brush, GetHandleRectangle(i));
  1542. g.DrawRectangle(pen, GetHandleRectangle(i));
  1543. break;
  1544. case 1:
  1545. g.FillEllipse(brush, GetHandleRectangle(i));
  1546. g.DrawEllipse(pen, GetHandleRectangle(i));
  1547. break;
  1548. case 2:
  1549. g.FillPolygon(brush, GetHandlePoint(i));
  1550. g.DrawPolygon(pen, GetHandlePoint(i));
  1551. break;
  1552. }
  1553. }
  1554. pen.Dispose();
  1555. brush.Dispose();
  1556. RectangleF r = GetBoundingBox();
  1557. //g.DrawRectangle(new Pen(Color.White), r.X, r.Y, r.Width, r.Height);
  1558. }
  1559. }
  1560. public override List<PointF> GetPoints()
  1561. {
  1562. return pointArray;
  1563. }
  1564. public override ParentStyleModel GetStyle()
  1565. {
  1566. return measurePointArcSize;
  1567. }
  1568. }
  1569. }