DrawHandModeRuler.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. using PaintDotNet.Base.SettingModel;
  2. using System;
  3. using System.Drawing;
  4. using System.Drawing.Drawing2D;
  5. using System.Windows.Forms;
  6. using PaintDotNet.Annotation.Enum;
  7. using System.Collections.Generic;
  8. using PaintDotNet.Annotation.Measure;
  9. namespace PaintDotNet.Annotation.Label
  10. {
  11. /// <summary>
  12. /// 标注->手动标尺
  13. /// </summary>
  14. public class DrawHandModeRuler : DrawObject
  15. {
  16. private static Cursor handleCursor = new Cursor(PdnResources.GetResourceStream("Cursors.AnnotationPolyHandle.cur"));
  17. /// <summary>
  18. /// 标注样式信息model
  19. /// </summary>
  20. public RulerModel rulerModel;
  21. double micronRatio = 1;
  22. double oldmicronRatio;
  23. /// <summary>
  24. /// 标尺长度集合
  25. /// </summary>
  26. private int[] lengthEnum = new int[] { 1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 50000, 1000000};
  27. private bool isMoveForward = true;
  28. public DrawHandModeRuler(ISurfaceBox surfaceBox, int x1, int y1, int x2, int y2) : base()
  29. {
  30. this.objectType = DrawClass.Label;
  31. this.drawToolType = DrawToolType.DrawHandModeRuler;
  32. //Dictionary<MeasurementUnit, double> measurementUnitDictionary = surfaceBox.getMeasureInfo();
  33. //micronRatio = measurementUnitDictionary[MeasurementUnit.Micron];//每像素多少微米长度
  34. Dictionary<MeasurementUnit, double> measurementUnitDictionary = surfaceBox.getMeasureInfo();
  35. MeasurementUnit unit = surfaceBox.GetMeasurementUnit();
  36. micronRatio = measurementUnitDictionary[unit];//每像素多少微米长度
  37. oldmicronRatio = micronRatio;
  38. rulerModel = surfaceBox.GetRulerStyleModel();
  39. startPoint.X = x1;
  40. startPoint.Y = y1;
  41. endPoint.X = x2;
  42. endPoint.Y = y2;
  43. //change = false;
  44. int pixelLength = Math.Abs(Convert.ToInt32(endPoint.X - startPoint.X));//根据两点获取的标尺像素长度
  45. length = pixelLength * micronRatio;
  46. }
  47. public DrawHandModeRuler(ISurfaceBox surfaceBox, List<PointF> points, ParentStyleModel parentStyleModel, Object content) : base()
  48. {
  49. this.objectType = DrawClass.Label;
  50. this.drawToolType = DrawToolType.DrawHandModeRuler;
  51. this.ISurfaceBox = surfaceBox;
  52. rulerModel = (RulerModel)parentStyleModel;
  53. startPoint = points[0];
  54. endPoint = points[1];
  55. }
  56. /// <summary>
  57. /// Clone this instance
  58. /// </summary>
  59. public override DrawObject Clone()
  60. {
  61. DrawHandModeRuler handModeRulerDraw = new DrawHandModeRuler(ISurfaceBox, 0, 0, 1, 0);
  62. handModeRulerDraw.objectType = DrawClass.Label;
  63. handModeRulerDraw.drawToolType = DrawToolType.DrawHandModeRuler;
  64. handModeRulerDraw.ISurfaceBox = this.ISurfaceBox;
  65. handModeRulerDraw.startPoint = this.startPoint;
  66. handModeRulerDraw.endPoint = this.endPoint;
  67. handModeRulerDraw.length = this.length;
  68. //handModeRulerDraw.pixelLength = pixelLength;
  69. FillDrawObjectFields(handModeRulerDraw);
  70. return handModeRulerDraw;
  71. }
  72. public override DrawObject Clone(ISurfaceBox surfaceBox)
  73. {
  74. DrawHandModeRuler handModeRulerDraw = new DrawHandModeRuler(surfaceBox, 0, 0, 1, 0);
  75. handModeRulerDraw.objectType = DrawClass.Label;
  76. handModeRulerDraw.drawToolType = DrawToolType.DrawHandModeRuler;
  77. handModeRulerDraw.ISurfaceBox = surfaceBox;
  78. handModeRulerDraw.startPoint = this.startPoint;
  79. handModeRulerDraw.endPoint = this.endPoint;
  80. handModeRulerDraw.length = this.length;
  81. //handModeRulerDraw.pixelLength = pixelLength;
  82. FillDrawObjectFields(handModeRulerDraw);
  83. return handModeRulerDraw;
  84. }
  85. public override void Draw(Graphics g)
  86. {
  87. g.SmoothingMode = SmoothingMode.AntiAlias;
  88. Dictionary<MeasurementUnit, double> measurementUnitDictionary = ISurfaceBox.getMeasureInfo();
  89. MeasurementUnit unit = ISurfaceBox.GetMeasurementUnit();
  90. double micron = measurementUnitDictionary[MeasurementUnit.Micron];//每像素多少微米长度
  91. micronRatio = measurementUnitDictionary[MeasurementUnit.Micron];//每像素多少微米长度
  92. int pixelLength = Math.Abs(Convert.ToInt32(endPoint.X - startPoint.X));//根据两点获取的标尺像素长度
  93. length = pixelLength * micronRatio;
  94. //length = pixelLength * micronRatio;
  95. //判断像素长度所属区间并重新赋值
  96. if (length <= lengthEnum[0])
  97. {
  98. length = lengthEnum[0];
  99. if (startPoint.X <= endPoint.X)
  100. endPoint.X = startPoint.X + (int)(length / micronRatio);
  101. else
  102. endPoint.X = startPoint.X - (int)(length / micronRatio);
  103. }
  104. else if (length > lengthEnum[0] && length <= lengthEnum[1])
  105. {
  106. length = lengthEnum[1];
  107. if (startPoint.X <= endPoint.X)
  108. endPoint.X = startPoint.X + (int)(length / micronRatio);
  109. else
  110. endPoint.X = startPoint.X - (int)(length / micronRatio);
  111. }
  112. else if (length > lengthEnum[1] && length <= lengthEnum[2])
  113. {
  114. length = lengthEnum[2];
  115. if (startPoint.X <= endPoint.X)
  116. endPoint.X = startPoint.X + (int)(length / micronRatio);
  117. else
  118. endPoint.X = startPoint.X - (int)(length / micronRatio);
  119. }
  120. else if (length > lengthEnum[2] && length <= lengthEnum[3])
  121. {
  122. length = lengthEnum[3];
  123. if (startPoint.X <= endPoint.X)
  124. endPoint.X = startPoint.X + (int)(length / micronRatio);
  125. else
  126. endPoint.X = startPoint.X - (int)(length / micronRatio);
  127. }
  128. else if (length > lengthEnum[3] && length <= lengthEnum[4])
  129. {
  130. length = lengthEnum[4];
  131. if (startPoint.X <= endPoint.X)
  132. endPoint.X = startPoint.X + (int)(length / micronRatio);
  133. else
  134. endPoint.X = startPoint.X - (int)(length / micronRatio);
  135. }
  136. else if (length > lengthEnum[4] && length <= lengthEnum[5])
  137. {
  138. length = lengthEnum[5];
  139. if (startPoint.X <= endPoint.X)
  140. endPoint.X = startPoint.X + (int)(length / micronRatio);
  141. else
  142. endPoint.X = startPoint.X - (int)(length / micronRatio);
  143. }
  144. else if (length > lengthEnum[5] && length <= lengthEnum[6])
  145. {
  146. length = lengthEnum[6];
  147. if (startPoint.X <= endPoint.X)
  148. endPoint.X = startPoint.X + (int)(length / micronRatio);
  149. else
  150. endPoint.X = startPoint.X - (int)(length / micronRatio);
  151. }
  152. else if (length > lengthEnum[6] && length <= lengthEnum[7])
  153. {
  154. length = lengthEnum[7];
  155. if (startPoint.X <= endPoint.X)
  156. endPoint.X = startPoint.X + (int)(length / micronRatio);
  157. else
  158. endPoint.X = startPoint.X - (int)(length / micronRatio);
  159. }
  160. else if (length > lengthEnum[7] && length <= lengthEnum[8])
  161. {
  162. length = lengthEnum[8];
  163. if (startPoint.X <= endPoint.X)
  164. endPoint.X = startPoint.X + (int)(length / micronRatio);
  165. else
  166. endPoint.X = startPoint.X - (int)(length / micronRatio);
  167. }
  168. else if (length > lengthEnum[8] && length <= lengthEnum[9])
  169. {
  170. length = lengthEnum[9];
  171. if (startPoint.X <= endPoint.X)
  172. endPoint.X = startPoint.X + (int)(length / micronRatio);
  173. else
  174. endPoint.X = startPoint.X - (int)(length / micronRatio);
  175. }
  176. else if (length > lengthEnum[9] && length <= lengthEnum[10])
  177. {
  178. length = lengthEnum[10];
  179. if (startPoint.X <= endPoint.X)
  180. endPoint.X = startPoint.X + (int)(length / micronRatio);
  181. else
  182. endPoint.X = startPoint.X - (int)(length / micronRatio);
  183. }
  184. else if (length > lengthEnum[10] && length <= lengthEnum[11])
  185. {
  186. length = lengthEnum[11];
  187. if (startPoint.X <= endPoint.X)
  188. endPoint.X = startPoint.X + (int)(length / micronRatio);
  189. else
  190. endPoint.X = startPoint.X - (int)(length / micronRatio);
  191. }
  192. else if (length > lengthEnum[11] && length <= lengthEnum[12])
  193. {
  194. length = lengthEnum[12];
  195. if (startPoint.X <= endPoint.X)
  196. endPoint.X = startPoint.X + (int)(length / micronRatio);
  197. else
  198. endPoint.X = startPoint.X - (int)(length / micronRatio);
  199. }
  200. else if (length > lengthEnum[12] && length <= lengthEnum[13])
  201. {
  202. length = lengthEnum[13];
  203. if (startPoint.X <= endPoint.X)
  204. endPoint.X = startPoint.X + (int)(length / micronRatio);
  205. else
  206. endPoint.X = startPoint.X - (int)(length / micronRatio);
  207. }
  208. else
  209. {
  210. length = lengthEnum[14];
  211. }
  212. #region [单位缩写]
  213. string unitAbbreviation = string.Empty;
  214. micronRatio = measurementUnitDictionary[unit];//每像素多少微米长度
  215. switch (unit)
  216. {
  217. case MeasurementUnit.Inch:
  218. length = length * micronRatio / micron;
  219. unitAbbreviation = "in";
  220. break;
  221. case MeasurementUnit.Centimeter:
  222. length = length * micronRatio / micron;
  223. unitAbbreviation = "cm";
  224. break;
  225. case MeasurementUnit.Millimeter:
  226. length = length * micronRatio / micron;
  227. unitAbbreviation = "mm";
  228. break;
  229. case MeasurementUnit.Micron:
  230. unitAbbreviation = "µm";
  231. break;
  232. case MeasurementUnit.Nano:
  233. length = length * micronRatio / micron;
  234. unitAbbreviation = "nm";
  235. break;
  236. case MeasurementUnit.Pixel:
  237. unitAbbreviation = "PX";
  238. break;
  239. case MeasurementUnit.Mil:
  240. length = length * micronRatio / micron;
  241. unitAbbreviation = "mil";
  242. break;
  243. }
  244. #endregion
  245. //else if (pixelLength > lengthEnum[7] / micronRatio && pixelLength <= lengthEnum[8] / micronRatio)
  246. // pixelLength = (int)(lengthEnum[8] / micronRatio);
  247. //else if (pixelLength > lengthEnum[8] / micronRatio && pixelLength <= lengthEnum[9] / micronRatio)
  248. // pixelLength = (int)(lengthEnum[9] / micronRatio);
  249. //else if (pixelLength > lengthEnum[9] / micronRatio && pixelLength <= lengthEnum[10] / micronRatio)
  250. // pixelLength = (int)(lengthEnum[10] / micronRatio);
  251. //else
  252. // pixelLength = lengthEnum[11];
  253. ////判断像素长度所属区间并重新赋值
  254. //if (pixelLength <= lengthEnum[0]/ micronRatio)
  255. // pixelLength = (int)(lengthEnum[0]/ micronRatio);
  256. //else if (pixelLength > lengthEnum[0]/ micronRatio && pixelLength <= lengthEnum[1]/ micronRatio)
  257. // pixelLength = (int)(lengthEnum[1] / micronRatio);
  258. //else if (pixelLength > lengthEnum[1]/ micronRatio && pixelLength <= lengthEnum[2]/ micronRatio)
  259. // pixelLength = (int)(lengthEnum[2] / micronRatio);
  260. //else if (pixelLength > lengthEnum[2] / micronRatio && pixelLength <= lengthEnum[3] / micronRatio)
  261. // pixelLength = (int)(lengthEnum[3] / micronRatio);
  262. //else if (pixelLength > lengthEnum[3] / micronRatio && pixelLength <= lengthEnum[4] / micronRatio)
  263. // pixelLength = (int)(lengthEnum[4] / micronRatio);
  264. //else if (pixelLength > lengthEnum[4] / micronRatio && pixelLength <= lengthEnum[5] / micronRatio)
  265. // pixelLength = (int)(lengthEnum[5] / micronRatio);
  266. //else if (pixelLength > lengthEnum[5] / micronRatio && pixelLength <= lengthEnum[6] / micronRatio)
  267. // pixelLength = (int)(lengthEnum[6] / micronRatio);
  268. //else if (pixelLength > lengthEnum[6] / micronRatio && pixelLength <= lengthEnum[7] / micronRatio)
  269. // pixelLength = (int)(lengthEnum[7] / micronRatio);
  270. //else if (pixelLength > lengthEnum[7] / micronRatio && pixelLength <= lengthEnum[8] / micronRatio)
  271. // pixelLength = (int)(lengthEnum[8] / micronRatio);
  272. //else if (pixelLength > lengthEnum[8] / micronRatio && pixelLength <= lengthEnum[9] / micronRatio)
  273. // pixelLength = (int)(lengthEnum[9] / micronRatio);
  274. //else if (pixelLength > lengthEnum[9] / micronRatio && pixelLength <= lengthEnum[10] / micronRatio)
  275. // pixelLength = (int)(lengthEnum[10] / micronRatio);
  276. //else
  277. // pixelLength = lengthEnum[11];
  278. //if (isMoveForward)
  279. //{
  280. // if (startPoint.X <= endPoint.X)
  281. // endPoint.X = startPoint.X + pixelLength;
  282. // else
  283. // endPoint.X = startPoint.X - pixelLength;
  284. //}
  285. //else
  286. //{
  287. // if (startPoint.X <= endPoint.X)
  288. // startPoint.X = endPoint.X - pixelLength;
  289. // else
  290. // startPoint.X = endPoint.X + pixelLength;
  291. //}
  292. //int pixelLength = Math.Abs(Convert.ToInt32(endPoint.X - startPoint.X));
  293. //length = pixelLength * micronRatio;
  294. //double lineLength = length/* Math.Round(length)*/;//物理长度
  295. string text = length + unitAbbreviation;//文字
  296. //string text = Math.Round(length, MeasureDrawObject.decimalPlaces).ToString() + unitAbbreviation;//小数保留
  297. if (text != null && text != "")
  298. {
  299. Pen linePen = new Pen(Color.FromArgb(this.rulerModel.lineColor));
  300. linePen.Width = (int)this.rulerModel.lineWidth;
  301. Pen borderPen = new Pen(Color.FromArgb(this.rulerModel.borderColor));
  302. borderPen.Width = (int)this.rulerModel.borderWidth;
  303. PointF lineL = new PointF(0, 0);
  304. PointF lineR = new PointF(0, 0);
  305. if (isMoveForward)
  306. {
  307. if (startPoint.X <= endPoint.X)
  308. {
  309. lineL.X = startPoint.X;
  310. lineL.Y = startPoint.Y;
  311. lineR.X = startPoint.X + (int)(length / micronRatio);
  312. lineR.Y = startPoint.Y;
  313. }
  314. else
  315. {
  316. lineL.X = startPoint.X - (int)(length / micronRatio);
  317. lineL.Y = startPoint.Y;
  318. lineR.X = startPoint.X;
  319. lineR.Y = startPoint.Y;
  320. }
  321. }
  322. else
  323. {
  324. if (startPoint.X <= endPoint.X)
  325. {
  326. lineL.X = endPoint.X - (int)(length / micronRatio);
  327. lineL.Y = endPoint.Y;
  328. lineR.X = endPoint.X;
  329. lineR.Y = endPoint.Y;
  330. }
  331. else
  332. {
  333. lineL.X = endPoint.X;
  334. lineL.Y = endPoint.Y;
  335. lineR.X = endPoint.X + (int)(length / micronRatio);
  336. lineR.Y = endPoint.Y;
  337. }
  338. }
  339. int lineWidthOffset = (int)rulerModel.lineWidth / 2 - 1;
  340. //垂线
  341. decimal verticalLength = (int)(length / micronRatio) * this.rulerModel.verticalLineLength / 100;
  342. PointF verticalLT = new PointF(lineL.X, lineL.Y - (int)(verticalLength / 2));
  343. PointF verticalLB = new PointF(lineL.X, lineL.Y + (int)(verticalLength / 2));
  344. PointF verticalRT = new PointF(lineR.X, lineR.Y - (int)(verticalLength / 2));
  345. PointF verticalRB = new PointF(lineR.X, lineR.Y + (int)(verticalLength / 2));
  346. // 文字
  347. decimal textHeight = (int)(length / micronRatio) * this.rulerModel.textHeight / 100;
  348. Font textFont;
  349. if (this.rulerModel.textBold == 0)
  350. textFont = new Font(this.rulerModel.textFont, (float)this.rulerModel.textFontSize,FontStyle.Regular);
  351. else
  352. textFont = new Font(this.rulerModel.textFont, (float)this.rulerModel.textFontSize, FontStyle.Bold);
  353. float textSizes = textFont.SizeInPoints * text.Length;
  354. float textX = lineL.X;
  355. if (rulerModel.textPosition == 1)
  356. {
  357. textX = (lineR.X - lineL.X) / 2 - (int)(textSizes / 2) + lineL.X;
  358. }
  359. else if (rulerModel.textPosition == 2)
  360. {
  361. textX = lineR.X - (int)(textSizes);
  362. }
  363. PointF textLT = new PointF(textX, lineL.Y - lineWidthOffset - (int)(textHeight + new Decimal(textFont.Height)));
  364. // 背景参照Y坐标,垂线高,使用垂线Y值,文字高使用文字Y值。
  365. float backRectangleReferY = textLT.Y < verticalLT.Y - 2 ? textLT.Y : verticalLT.Y - 2;
  366. // 背景大小
  367. decimal backLength = (int)(length / micronRatio) * this.rulerModel.backgroundSize / 100;
  368. float backRectangleX = verticalLT.X - (int)backLength - (int)linePen.Width;
  369. float backRectangleY = backRectangleReferY - (int)(backLength);
  370. float backRectangleW = (verticalRT.X - verticalLT.X) + (int)(backLength * 2) + (int)(linePen.Width * 2);
  371. float backRectangleH = (verticalLB.Y - backRectangleReferY) + (int)(backLength * 2) + lineWidthOffset + 2;
  372. RectangleF backRectangle = new RectangleF(backRectangleX, backRectangleY, backRectangleW, backRectangleH);
  373. // 边框
  374. int offset = borderPen.Width > 0 ? (int)(borderPen.Width / 2) - 2 : 0;
  375. RectangleF borderPenRectangle = new RectangleF(backRectangle.X - offset, backRectangle.Y - offset, backRectangle.Width + offset * 2, backRectangle.Height + offset * 2);
  376. // 绘制
  377. g.FillRectangle(new SolidBrush(Color.FromArgb(this.rulerModel.backColor)), backRectangle);
  378. g.DrawRectangle(borderPen, borderPenRectangle.X, borderPenRectangle.Y, borderPenRectangle.Width, borderPenRectangle.Height);
  379. g.DrawLine(linePen, lineL, lineR);
  380. g.DrawLine(linePen, verticalLT, verticalLB);
  381. g.DrawLine(linePen, verticalRT, verticalRB);
  382. g.DrawString(text, textFont, new SolidBrush(Color.FromArgb(this.rulerModel.textColor)), textLT.X, textLT.Y);
  383. rectangle = borderPenRectangle;
  384. linePen.Dispose();
  385. borderPen.Dispose();
  386. }
  387. }
  388. public override int HandleCount
  389. {
  390. get
  391. {
  392. return 2;
  393. }
  394. }
  395. /// <summary>
  396. /// Get handle pointscroll by 1-based number
  397. /// </summary>
  398. /// <param name="handleNumber"></param>
  399. /// <returns></returns>
  400. public override PointF GetHandle(int handleNumber)
  401. {
  402. float x = 0, y = 0;
  403. switch (handleNumber)
  404. {
  405. case 1:
  406. x = startPoint.X;
  407. y = startPoint.Y;
  408. break;
  409. case 2:
  410. x = endPoint.X;
  411. y = endPoint.Y;
  412. break;
  413. }
  414. return new PointF(x, y);
  415. }
  416. /// <summary>
  417. /// Hit test.
  418. /// Return value: -1 - no hit
  419. /// 0 - hit anywhere
  420. /// > 1 - handle number
  421. /// </summary>
  422. /// <param name="pointscroll"></param>
  423. /// <returns></returns>
  424. public override int HitTest(Point point)
  425. {
  426. if (Selected)
  427. {
  428. for (int i = 1; i <= HandleCount; i++)
  429. {
  430. if (GetHandleRectangle(i).Contains(point))
  431. return i;
  432. }
  433. }
  434. if (PointInObject(point))
  435. return 0;
  436. return -1;
  437. }
  438. protected override bool PointInObject(Point point)
  439. {
  440. return rectangle.Contains(point);
  441. }
  442. public override bool IntersectsWith(Rectangle rectangle)
  443. {
  444. return Rectangle.IntersectsWith(rectangle);
  445. }
  446. public override Cursor GetHandleCursor(int handleNumber)
  447. {
  448. switch (handleNumber)
  449. {
  450. case 1:
  451. return Cursors.SizeWE;
  452. case 2:
  453. return Cursors.SizeWE;
  454. default:
  455. return Cursors.Default;
  456. }
  457. }
  458. public override void MoveHandleTo(Point point, int handleNumber)
  459. {
  460. switch (handleNumber)
  461. {
  462. case 1:
  463. isMoveForward = false;
  464. startPoint.X = point.X;
  465. break;
  466. case 2:
  467. isMoveForward = true;
  468. endPoint.X = point.X;
  469. break;
  470. }
  471. int pixelLength = Math.Abs(Convert.ToInt32(endPoint.X - startPoint.X));//根据两点获取的标尺像素长度
  472. length = pixelLength * micronRatio;
  473. }
  474. public override void Move(int deltaX, int deltaY)
  475. {
  476. int x = ISurfaceBox.UnscaleScalar(deltaX);
  477. int y = ISurfaceBox.UnscaleScalar(deltaY);
  478. startPoint.X += x;
  479. startPoint.Y += y;
  480. endPoint.X += x;
  481. endPoint.Y += y;
  482. rectangle.X += x;
  483. rectangle.Y += y;
  484. int pixelLength = Math.Abs(Convert.ToInt32(endPoint.X - startPoint.X));//根据两点获取的标尺像素长度
  485. length = pixelLength * micronRatio;
  486. }
  487. public override RectangleF GetBoundingBox()
  488. {
  489. return rectangle;
  490. }
  491. public override List<PointF> GetPoints()
  492. {
  493. List<PointF> points = new List<PointF>();
  494. points.Add(startPoint);
  495. points.Add(endPoint);
  496. return points;
  497. }
  498. public override ParentStyleModel GetStyle()
  499. {
  500. return rulerModel;
  501. }
  502. }
  503. }