MeasureMulHVLine.cs 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099
  1. using PaintDotNet.Annotation.Enum;
  2. using PaintDotNet.Base.SettingModel;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Drawing;
  6. using System.Drawing.Drawing2D;
  7. using System.Globalization;
  8. using System.Windows.Forms;
  9. using PaintDotNet.Base.CommTool;
  10. using System.Net.NetworkInformation;
  11. using System.Linq;
  12. namespace PaintDotNet.Annotation.Measure
  13. {
  14. using PointList = List<PointF>;
  15. /// <summary>
  16. /// 测量->多点线段->多点水平线
  17. /// </summary>
  18. public class MeasureMulHVLine : MeasureDrawObject
  19. {
  20. public PointList pointArray;
  21. private const string entryLength = "Length";
  22. private const string entryPoint = "Point";
  23. /// <summary>
  24. /// Graphic objects for hit test
  25. /// </summary>
  26. private GraphicsPath areaPath = null;
  27. private Pen areaPen = null;
  28. private Region areaRegion = null;
  29. /// <summary>
  30. /// 长度
  31. /// </summary>
  32. private double allLength = 0.0;
  33. /// <summary>
  34. /// 测量信息矩形定义
  35. /// </summary>
  36. private RectangleF rectangleF1 = new RectangleF();
  37. private RectangleF rectangleF2 = new RectangleF();
  38. private RectangleF rectangleF3 = new RectangleF();
  39. private RectangleF rectangleF4 = new RectangleF();
  40. private RectangleF rectangleF5 = new RectangleF();
  41. /// <summary>
  42. /// 文本上用于拖动的点
  43. /// </summary>
  44. private Point pointL = new Point();
  45. /// <summary>
  46. /// 绘制限制(第一次绘制时)
  47. /// </summary>
  48. public bool pointChange = true;
  49. /// <summary>
  50. /// 区分移动文本
  51. /// </summary>
  52. private int moveKb;
  53. /// <summary>
  54. /// 绘制限制(从配置文件加载)
  55. /// </summary>
  56. public bool configurationFile = false;
  57. /// <summary>
  58. /// 绘制限制(更改属性时)
  59. /// </summary>
  60. private bool SavePointChange;
  61. /// <summary>
  62. /// 多点绘制时的文本矩形集合
  63. /// </summary>
  64. public List<RectangleF> RectangleFList = new List<RectangleF>();
  65. /// <summary>
  66. /// 绘制属性
  67. /// </summary>
  68. private string[] drawingPropertiesList;
  69. /// <summary>
  70. /// 绘制属性(克隆)
  71. /// </summary>
  72. private string[] drawingPropertiesListClone;
  73. private bool drawing;
  74. /// <summary>
  75. /// 属性绘制点
  76. /// </summary>
  77. private PointF rotationPoint;
  78. private PointF rotationPoint1;
  79. /// <summary>
  80. /// 限制绘制(绘制中)
  81. /// </summary>
  82. public bool mouseUpPointChange = false;
  83. /// <summary>
  84. /// 测量样式信息model
  85. /// </summary>
  86. private MeasureStyleModel.MeasureMulHVLine measureStyleModel;
  87. public MeasureStyleModel.MeasureMulHVLine MeasureStyleModel
  88. {
  89. set
  90. {
  91. this.measureStyleModel = value;
  92. }
  93. }
  94. public MeasureMulHVLine(ISurfaceBox surfaceBox, int x1, int y1, bool clone) : base(surfaceBox)
  95. {
  96. this.objectType = DrawClass.Measure;
  97. this.drawToolType = DrawToolType.MeasureMulHVLine;
  98. measureStyleModel = surfaceBox.GetMeasureStyleModel().measureMulHVLine;
  99. pointArray = new PointList();
  100. startPoint.X = x1;
  101. startPoint.Y = y1;
  102. if (clone)
  103. {
  104. drawing = true;
  105. pointArray.Add(new Point(x1, y1));
  106. }
  107. this.measurementUnit = (MeasurementUnit)System.Enum.Parse(typeof(MeasurementUnit), surfaceBox.GetPxPerUnit()[0]);
  108. this.unitString = surfaceBox.GetPxPerUnit()[1];
  109. this.unit = surfaceBox.GetPxPerUnit()[2];
  110. surfaceBox.getMeasureInfo().TryGetValue(measurementUnit, out unitLength);
  111. Initialize();
  112. }
  113. public MeasureMulHVLine(ISurfaceBox surfaceBox, List<PointF> points, ParentStyleModel parentStyleModel, Object content) : base()
  114. {
  115. this.objectType = DrawClass.Measure;
  116. this.drawToolType = DrawToolType.MeasureMulHVLine;
  117. this.ISurfaceBox = surfaceBox;
  118. measureStyleModel = (MeasureStyleModel.MeasureMulHVLine)parentStyleModel;
  119. pointArray = DrawRulerHelper.DeepCopyListByReflect(points);
  120. startPoint = points[0];
  121. this.measurementUnit = (MeasurementUnit)System.Enum.Parse(typeof(MeasurementUnit), surfaceBox.GetPxPerUnit()[0]);
  122. this.unitString = surfaceBox.GetPxPerUnit()[1];
  123. this.unit = surfaceBox.GetPxPerUnit()[2];
  124. surfaceBox.getMeasureInfo().TryGetValue(measurementUnit, out unitLength);
  125. for (int i = 0; i < (points.Count - 1) * 6; i++)
  126. {
  127. this.RectangleFList.Add(new RectangleF());
  128. }
  129. this.configurationFile = true;
  130. }
  131. /// <summary>
  132. /// Clone this instance
  133. /// </summary>
  134. public override DrawObject Clone()
  135. {
  136. MeasureMulHVLine drawPolygon = new MeasureMulHVLine(ISurfaceBox, (int)pointArray[0].X, (int)pointArray[0].Y, false);
  137. drawPolygon.ISurfaceBox = ISurfaceBox;
  138. foreach (PointF p in this.pointArray)
  139. {
  140. drawPolygon.pointArray.Add(p);
  141. }
  142. if (drawingPropertiesList != null)
  143. drawPolygon.drawingPropertiesListClone = drawingPropertiesList;
  144. foreach (var rectangleF in RectangleFList)
  145. {
  146. drawPolygon.RectangleFList.Add(rectangleF);
  147. }
  148. FillDrawObjectFields(drawPolygon);
  149. return drawPolygon;
  150. }
  151. public override DrawObject Clone(ISurfaceBox surfaceBox)
  152. {
  153. MeasureMulHVLine drawPolygon = new MeasureMulHVLine(surfaceBox, this.GetPoints(), this.measureStyleModel, null);
  154. if (drawingPropertiesList != null)
  155. drawPolygon.drawingPropertiesListClone = drawingPropertiesList;
  156. foreach (var rectangleF in RectangleFList)
  157. {
  158. drawPolygon.RectangleFList.Add(rectangleF);
  159. }
  160. FillDrawObjectFields(drawPolygon);
  161. return drawPolygon;
  162. }
  163. /// <summary>
  164. /// 测量属性
  165. /// </summary>
  166. /// <returns></returns>
  167. public override Dictionary<System.Enum, object> GetData()
  168. {
  169. if (data.ContainsKey(MeasureAttributes.MeasureMethod))
  170. data[MeasureAttributes.MeasureMethod] = PdnResources.GetString("Menu.MeasureAction.MeasureMulSegment.Text");
  171. else
  172. data.Add(MeasureAttributes.MeasureMethod, PdnResources.GetString("Menu.MeasureAction.MeasureMulSegment.Text"));
  173. if (data.ContainsKey(MeasureAttributes.MeasureUnitCN))
  174. data[MeasureAttributes.MeasureUnitCN] = this.unitString;
  175. else
  176. data.Add(MeasureAttributes.MeasureUnitCN, this.unitString);
  177. if (data.ContainsKey(MeasureAttributes.MeasureUnitEN))
  178. data[MeasureAttributes.MeasureUnitEN] = this.unit;
  179. else
  180. data.Add(MeasureAttributes.MeasureUnitEN, this.unit);
  181. if (data.ContainsKey(MeasureAttributes.PixelStartX))
  182. data[MeasureAttributes.PixelStartX] = startPoint.X;
  183. else
  184. data.Add(MeasureAttributes.PixelStartX, startPoint.X);
  185. if (data.ContainsKey(MeasureAttributes.PixelStartY))
  186. data[MeasureAttributes.PixelStartY] = startPoint.Y;
  187. else
  188. data.Add(MeasureAttributes.PixelStartY, startPoint.Y);
  189. if (data.ContainsKey(MeasureAttributes.PhysicalStartX))
  190. data[MeasureAttributes.PhysicalStartX] = Math.Round(startPoint.X * unitLength, decimalPlaces);
  191. else
  192. data.Add(MeasureAttributes.PhysicalStartX, Math.Round(startPoint.X * unitLength, decimalPlaces));
  193. if (data.ContainsKey(MeasureAttributes.PhysicalStartY))
  194. data[MeasureAttributes.PhysicalStartY] = Math.Round(startPoint.Y * unitLength, decimalPlaces);
  195. else
  196. data.Add(MeasureAttributes.PhysicalStartY, Math.Round(startPoint.Y * unitLength, decimalPlaces));
  197. if (data.ContainsKey(MeasureAttributes.PixelLength))
  198. data[MeasureAttributes.PixelLength] = Math.Round(allLength, decimalPlaces);
  199. else
  200. data.Add(MeasureAttributes.PixelLength, Math.Round(allLength, decimalPlaces));
  201. string s = Math.Round(allLength * unitLength, decimalPlaces).ToString();
  202. if (s.IndexOf(".") == -1)
  203. {
  204. for (int c = 0; c < decimalPlaces; c++)
  205. {
  206. if (c == 0)
  207. s += ".";
  208. s += "0";
  209. }
  210. }
  211. else
  212. {
  213. int a = s.Length - s.IndexOf(".") - 1;
  214. if (a < decimalPlaces)
  215. {
  216. for (int c = 0; c < decimalPlaces - a; c++)
  217. {
  218. s += "0";
  219. }
  220. }
  221. }
  222. if (data.ContainsKey(MeasureAttributes.PhysicalLength))
  223. data[MeasureAttributes.PhysicalLength] = s;
  224. else
  225. data.Add(MeasureAttributes.PhysicalLength, s);
  226. if (data.ContainsKey(MeasureAttributes.PixelAverageIntercept))
  227. data[MeasureAttributes.PixelAverageIntercept] = Math.Round(allLength / (pointArray.Count - 1), decimalPlaces);
  228. else
  229. data.Add(MeasureAttributes.PixelAverageIntercept, Math.Round(allLength / (pointArray.Count - 1), decimalPlaces));
  230. s = Math.Round(allLength * unitLength / (pointArray.Count - 1), decimalPlaces).ToString();
  231. if (s.IndexOf(".") == -1)
  232. {
  233. for (int i = 0; i < decimalPlaces; i++)
  234. {
  235. if (i == 0)
  236. s += ".";
  237. s += "0";
  238. }
  239. }
  240. else
  241. {
  242. int a = s.Length - s.IndexOf(".") - 1;
  243. if (a < decimalPlaces)
  244. {
  245. for (int i = 0; i < decimalPlaces - a; i++)
  246. {
  247. s += "0";
  248. }
  249. }
  250. }
  251. if (data.ContainsKey(MeasureAttributes.PhysicalAverage))
  252. data[MeasureAttributes.PhysicalAverage] = s;
  253. else
  254. data.Add(MeasureAttributes.PhysicalAverage, s);
  255. return data;
  256. }
  257. public override void Draw(Graphics g)
  258. {
  259. lengthParagraphs = new List<string>();
  260. drawingProperties.TryGetValue(this.drawToolType, out drawingPropertiesList);
  261. if (drawingPropertiesList == null)
  262. {
  263. drawingPropertiesList = drawingPropertiesListClone;
  264. if (!this.drawing)
  265. this.configurationFile = true;
  266. }
  267. pointChangeObject.TryGetValue(this.drawToolType, out SavePointChange);
  268. Font textfont1 = new Font(measureStyleModel.font, measureStyleModel.fontSize);
  269. Brush textbrush1 = new SolidBrush(Color.FromArgb(measureStyleModel.textColor));
  270. // 总长度
  271. double alllength = 0.0;
  272. // 段长度
  273. double length = 0.0;
  274. SizeF sizeF = new SizeF();
  275. int a1 = 0;
  276. int a2 = 1;
  277. int a3 = 2;
  278. int a4 = 3;
  279. int a5 = 4;
  280. int a6 = 5;
  281. RectangleF rectangleF;
  282. for (int i = 1; i <= pointArray.Count - 1; i++)
  283. {
  284. Font textfont = new Font(measureStyleModel.font, measureStyleModel.fontSize);
  285. Brush textbrush = new SolidBrush(Color.FromArgb(measureStyleModel.textColor));
  286. Pen linePen = new Pen(Color.FromArgb(measureStyleModel.lineColor), measureStyleModel.lineWidth);
  287. linePen.DashStyle = (DashStyle)measureStyleModel.lineStyle;
  288. g.SmoothingMode = SmoothingMode.AntiAlias;
  289. //length = BasicCalculationHelper.GetDistance(pointArray[i - 1], pointArray[i], 10) / pxPerUnit;
  290. length = BasicCalculationHelper.GetDistance(pointArray[i - 1], pointArray[i], 10);
  291. PointF point = BasicCalculationHelper.GetAnglePoint(new PointF(pointArray[i - 1].X, pointArray[i - 1].Y + measureStyleModel.vLineLength), pointArray[i - 1], 0);
  292. PointF point1 = BasicCalculationHelper.GetAnglePoint(new PointF(pointArray[i - 1].X, pointArray[i - 1].Y - measureStyleModel.vLineLength), pointArray[i - 1], 0);
  293. PointF point2 = BasicCalculationHelper.GetAnglePoint(new PointF(pointArray[i].X, pointArray[i].Y + measureStyleModel.vLineLength), pointArray[i], 180);
  294. PointF point3 = BasicCalculationHelper.GetAnglePoint(new PointF(pointArray[i].X, pointArray[i].Y - measureStyleModel.vLineLength), pointArray[i], 180);
  295. g.DrawLine(linePen, point.X, point.Y, point1.X, point1.Y);
  296. g.DrawLine(linePen, point2.X, point2.Y, point3.X, point3.Y);
  297. g.DrawLine(linePen, pointArray[i - 1], pointArray[i]);
  298. alllength = alllength + length;
  299. int offsetValuePoint = measureStyleModel.fontSize + measureStyleModel.fontSize / 2;
  300. int offsetValue1Point = measureStyleModel.lineWidth * 2 / 3;
  301. int offsetPoint = offsetValue1Point;
  302. if (drawingPropertiesList != null)
  303. {
  304. // 像素长度
  305. if (drawingPropertiesList.Contains(MeasureAttributes.PixelLength.ToString()))
  306. {
  307. offsetPoint += offsetValuePoint;
  308. }
  309. // 物理长度
  310. if (drawingPropertiesList.Contains(MeasureAttributes.PhysicalLength.ToString()))
  311. {
  312. offsetPoint += offsetValuePoint;
  313. }
  314. // 像素起始点X
  315. if (drawingPropertiesList.Contains(MeasureAttributes.PixelStartX.ToString()))
  316. {
  317. offsetPoint += offsetValuePoint;
  318. }
  319. // 像素起始点Y
  320. if (drawingPropertiesList.Contains(MeasureAttributes.PixelStartY.ToString()))
  321. {
  322. offsetPoint += offsetValuePoint;
  323. }
  324. // 物理起始点X
  325. if (drawingPropertiesList.Contains(MeasureAttributes.PhysicalStartX.ToString()))
  326. {
  327. offsetPoint += offsetValuePoint;
  328. }
  329. // 物理起始点Y
  330. if (drawingPropertiesList.Contains(MeasureAttributes.PhysicalStartY.ToString()))
  331. {
  332. offsetPoint += offsetValuePoint;
  333. }
  334. }
  335. if (measureStyleModel.linePositionP == 0)
  336. this.rotationPoint1 = new PointF(pointArray[i - 1].X, pointArray[i - 1].Y - offsetPoint - offsetValue1Point);
  337. else if (measureStyleModel.linePositionP == 1)
  338. this.rotationPoint1 = new PointF((pointArray[i - 1].X + pointArray[i].X) / 2, pointArray[i - 1].Y - offsetPoint - offsetValue1Point);
  339. else if (measureStyleModel.linePositionP == 2)
  340. this.rotationPoint1 = new PointF(pointArray[i].X, pointArray[i].Y - offsetPoint - offsetValue1Point);
  341. else if (measureStyleModel.linePositionP == 3)
  342. this.rotationPoint1 = pointArray[i - 1];
  343. else if (measureStyleModel.linePositionP == 4)
  344. this.rotationPoint1 = new PointF((pointArray[i - 1].X + pointArray[i].X) / 2, (pointArray[i - 1].Y + pointArray[i].Y) / 2);
  345. else if (measureStyleModel.linePositionP == 5)
  346. this.rotationPoint1 = pointArray[i];
  347. int offsetValue = measureStyleModel.fontSize + measureStyleModel.fontSize / 2;
  348. int offsetValue1 = measureStyleModel.lineWidth * 2 / 3;
  349. int offset = offsetValue1;
  350. if (drawingPropertiesList != null)
  351. {
  352. // 像素长度
  353. if (drawingPropertiesList.Contains(MeasureAttributes.PixelLength.ToString()))
  354. {
  355. rectangleF = this.RectangleFList[a1];
  356. sizeF = g.MeasureString("" + Math.Round(length, decimalPlaces) + "px", textfont1);
  357. rectangleF.Width = sizeF.Width;
  358. rectangleF.Height = sizeF.Height;
  359. if (this.pointChange || this.SavePointChange || this.mouseUpPointChange || this.mouseUpAttribute)
  360. {
  361. rectangleF.Location = new PointF((int)this.rotationPoint1.X + offsetValue1 - (int)sizeF.Width / 2, (int)this.rotationPoint1.Y + offset);
  362. offset += offsetValue;
  363. this.RectangleFList[a1] = rectangleF;
  364. }
  365. g.DrawString("" + Math.Round(length, decimalPlaces) + "px", textfont1, textbrush1, this.RectangleFList[a1]);
  366. a1 += 6;
  367. }
  368. else
  369. {
  370. this.RectangleFList[a1] = new RectangleF();
  371. a1 += 6;
  372. }
  373. string s = Math.Round(length * unitLength, decimalPlaces).ToString();
  374. if (s.IndexOf(".") == -1)
  375. {
  376. for (int c = 0; c < decimalPlaces; c++)
  377. {
  378. if (c == 0)
  379. s += ".";
  380. s += "0";
  381. }
  382. }
  383. else
  384. {
  385. int a = s.Length - s.IndexOf(".") - 1;
  386. if (a < decimalPlaces)
  387. {
  388. for (int c = 0; c < decimalPlaces - a; c++)
  389. {
  390. s += "0";
  391. }
  392. }
  393. }
  394. lengthParagraphs.Add(s);
  395. // 物理长度
  396. if (drawingPropertiesList.Contains(MeasureAttributes.PhysicalLength.ToString()))
  397. {
  398. rectangleF = this.RectangleFList[a2];
  399. sizeF = g.MeasureString(s + this.unit, textfont1);
  400. rectangleF.Width = sizeF.Width;
  401. rectangleF.Height = sizeF.Height;
  402. if (this.pointChange || this.SavePointChange || this.mouseUpPointChange || this.mouseUpAttribute)
  403. {
  404. rectangleF.Location = new PointF((int)this.rotationPoint1.X + offsetValue1 - (int)sizeF.Width / 2, (int)this.rotationPoint1.Y + offset);
  405. offset += offsetValue;
  406. this.RectangleFList[a2] = rectangleF;
  407. }
  408. g.DrawString(s + this.unit, textfont1, textbrush1, this.RectangleFList[a2]);
  409. a2 += 6;
  410. }
  411. else
  412. {
  413. this.RectangleFList[a2] = new RectangleF();
  414. a2 += 6;
  415. }
  416. // 像素起始点X
  417. if (drawingPropertiesList.Contains(MeasureAttributes.PixelStartX.ToString()))
  418. {
  419. rectangleF = this.RectangleFList[a3];
  420. sizeF = g.MeasureString("" + pointArray[i].X, textfont1);
  421. rectangleF.Width = sizeF.Width;
  422. rectangleF.Height = sizeF.Height;
  423. if (this.pointChange || this.SavePointChange || this.mouseUpPointChange || this.mouseUpAttribute)
  424. {
  425. rectangleF.Location = new PointF((int)this.rotationPoint1.X + offsetValue1 - (int)sizeF.Width / 2, (int)this.rotationPoint1.Y + offset);
  426. offset += offsetValue;
  427. this.RectangleFList[a3] = rectangleF;
  428. }
  429. g.DrawString("" + pointArray[i].X, textfont1, textbrush1, this.RectangleFList[a3]);
  430. a3 += 6;
  431. }
  432. else
  433. {
  434. this.RectangleFList[a3] = new RectangleF();
  435. a3 += 6;
  436. }
  437. // 像素起始点Y
  438. if (drawingPropertiesList.Contains(MeasureAttributes.PixelStartY.ToString()))
  439. {
  440. rectangleF = this.RectangleFList[a4];
  441. sizeF = g.MeasureString("" + pointArray[i].Y, textfont1);
  442. rectangleF.Width = sizeF.Width;
  443. rectangleF.Height = sizeF.Height;
  444. if (this.pointChange || this.SavePointChange || this.mouseUpPointChange || this.mouseUpAttribute)
  445. {
  446. rectangleF.Location = new PointF((int)this.rotationPoint1.X + offsetValue1 - (int)sizeF.Width / 2, (int)this.rotationPoint1.Y + offset);
  447. offset += offsetValue;
  448. this.RectangleFList[a4] = rectangleF;
  449. }
  450. g.DrawString("" + pointArray[i].Y, textfont1, textbrush1, this.RectangleFList[a4]);
  451. a4 += 6;
  452. }
  453. else
  454. {
  455. this.RectangleFList[a4] = new RectangleF();
  456. a4 += 6;
  457. }
  458. // 物理起始点X
  459. if (drawingPropertiesList.Contains(MeasureAttributes.PhysicalStartX.ToString()))
  460. {
  461. rectangleF = this.RectangleFList[a5];
  462. sizeF = g.MeasureString("" + Math.Round(pointArray[i].X * unitLength, decimalPlaces), textfont1);
  463. rectangleF.Width = sizeF.Width;
  464. rectangleF.Height = sizeF.Height;
  465. if (this.pointChange || this.SavePointChange || this.mouseUpPointChange || this.mouseUpAttribute)
  466. {
  467. rectangleF.Location = new PointF((int)this.rotationPoint1.X + offsetValue1 - (int)sizeF.Width / 2, (int)this.rotationPoint1.Y + offset);
  468. offset += offsetValue;
  469. this.RectangleFList[a5] = rectangleF;
  470. }
  471. g.DrawString("" + Math.Round(pointArray[i].X * unitLength, decimalPlaces), textfont1, textbrush1, this.RectangleFList[a5]);
  472. a5 += 6;
  473. }
  474. else
  475. {
  476. this.RectangleFList[a5] = new RectangleF();
  477. a5 += 6;
  478. }
  479. // 物理起始点Y
  480. if (drawingPropertiesList.Contains(MeasureAttributes.PhysicalStartY.ToString()))
  481. {
  482. rectangleF = this.RectangleFList[a6];
  483. sizeF = g.MeasureString("" + Math.Round(pointArray[i].Y * unitLength, decimalPlaces), textfont1);
  484. rectangleF.Width = sizeF.Width;
  485. rectangleF.Height = sizeF.Height;
  486. if (this.pointChange || this.SavePointChange || this.mouseUpPointChange || this.mouseUpAttribute)
  487. {
  488. rectangleF.Location = new PointF((int)this.rotationPoint1.X + offsetValue1 - (int)sizeF.Width / 2, (int)this.rotationPoint1.Y + offset);
  489. offset += offsetValue;
  490. this.RectangleFList[a6] = rectangleF;
  491. }
  492. g.DrawString("" + Math.Round(pointArray[i].Y * unitLength, decimalPlaces), textfont1, textbrush1, this.RectangleFList[a6]);
  493. a6 += 6;
  494. }
  495. else
  496. {
  497. this.RectangleFList[a6] = new RectangleF();
  498. a6 += 6;
  499. }
  500. }
  501. linePen.Dispose();
  502. }
  503. this.allLength = alllength;
  504. if(pointArray.Count > 1)
  505. {
  506. // 是否绘制
  507. if (this.pointChange || this.SavePointChange || this.mouseUpPointChange || this.mouseUpAttribute)
  508. {
  509. int offsetValuePoint = measureStyleModel.fontSize + measureStyleModel.fontSize / 2;
  510. int offsetValue1Point = measureStyleModel.lineWidth * 2 / 3;
  511. int offsetPoint = offsetValue1Point;
  512. if (drawingPropertiesList != null)
  513. {
  514. // 像素平均截距
  515. if (drawingPropertiesList.Contains(MeasureAttributes.PixelAverageIntercept.ToString()))
  516. {
  517. offsetPoint += offsetValuePoint;
  518. }
  519. // 物理平均截距
  520. if (drawingPropertiesList.Contains(MeasureAttributes.PhysicalAverage.ToString()))
  521. {
  522. offsetPoint += offsetValuePoint;
  523. }
  524. // 测量方式
  525. if (drawingPropertiesList.Contains(MeasureAttributes.MeasureMethod.ToString()))
  526. {
  527. offsetPoint += offsetValuePoint;
  528. }
  529. // 测量单位(中文)
  530. if (drawingPropertiesList.Contains(MeasureAttributes.MeasureUnitCN.ToString()))
  531. {
  532. }
  533. // 测量单位(英文)
  534. if (drawingPropertiesList.Contains(MeasureAttributes.MeasureUnitEN.ToString()))
  535. {
  536. offsetPoint += offsetValuePoint;
  537. }
  538. }
  539. if (measureStyleModel.linePositionL == 0)
  540. this.rotationPoint = new PointF(pointArray[0].X, pointArray[0].Y - offsetPoint - offsetValue1Point - offsetValuePoint);
  541. else if (measureStyleModel.linePositionL == 1)
  542. this.rotationPoint = new PointF((pointArray[0].X + pointArray[1].X) / 2, pointArray[0].Y - offsetPoint - offsetValue1Point - offsetValuePoint);
  543. else if (measureStyleModel.linePositionL == 2)
  544. this.rotationPoint = new PointF(pointArray[1].X, pointArray[1].Y - offsetPoint - offsetValue1Point - offsetValuePoint);
  545. else if (measureStyleModel.linePositionL == 3)
  546. this.rotationPoint = pointArray[0];
  547. else if (measureStyleModel.linePositionL == 4)
  548. this.rotationPoint = new PointF((pointArray[0].X + pointArray[1].X) / 2, (pointArray[0].Y + pointArray[1].Y) / 2);
  549. else if (measureStyleModel.linePositionL == 5)
  550. this.rotationPoint = pointArray[1];
  551. // 文本间隔定义
  552. int offsetValue = measureStyleModel.fontSize + measureStyleModel.fontSize / 2;
  553. int offsetValue1 = measureStyleModel.lineWidth * 2 / 3;
  554. int offset = offsetValue1;
  555. this.pointL = new Point((int)this.rotationPoint.X, (int)this.rotationPoint.Y);
  556. if (drawingPropertiesList != null)
  557. {
  558. // 像素平均截距
  559. if (drawingPropertiesList.Contains(MeasureAttributes.PixelAverageIntercept.ToString()))
  560. {
  561. sizeF = g.MeasureString("" + Math.Round(allLength / (pointArray.Count - 1), decimalPlaces) + "px", textfont1);
  562. rectangleF4.Location = new Point((int)this.rotationPoint.X + offsetValue1 - (int)sizeF.Width / 2, (int)this.rotationPoint.Y + offset);
  563. offset += offsetValue;
  564. }
  565. // 物理平均截距
  566. if (drawingPropertiesList.Contains(MeasureAttributes.PhysicalAverage.ToString()))
  567. {
  568. string s = Math.Round(allLength * unitLength / (pointArray.Count - 1), decimalPlaces).ToString();
  569. if (s.IndexOf(".") == -1)
  570. {
  571. for (int i = 0; i < decimalPlaces; i++)
  572. {
  573. if (i == 0)
  574. s += ".";
  575. s += "0";
  576. }
  577. }
  578. else
  579. {
  580. int a = s.Length - s.IndexOf(".") - 1;
  581. if (a < decimalPlaces)
  582. {
  583. for (int i = 0; i < decimalPlaces - a; i++)
  584. {
  585. s += "0";
  586. }
  587. }
  588. }
  589. sizeF = g.MeasureString(s + this.unit, textfont1);
  590. rectangleF5.Location = new Point((int)this.rotationPoint.X + offsetValue1 - (int)sizeF.Width / 2, (int)this.rotationPoint.Y + offset);
  591. offset += offsetValue;
  592. }
  593. // 测量方式
  594. if (drawingPropertiesList.Contains(MeasureAttributes.MeasureMethod.ToString()))
  595. {
  596. sizeF = g.MeasureString("" + PdnResources.GetString("Menu.MeasureAction.MeasureMulSegment.Text"), textfont1);
  597. rectangleF1.Location = new Point((int)this.rotationPoint.X + offsetValue1 - (int)sizeF.Width / 2, (int)this.rotationPoint.Y + offset);
  598. offset += offsetValue;
  599. }
  600. // 测量单位(中文)
  601. if (drawingPropertiesList.Contains(MeasureAttributes.MeasureUnitCN.ToString()))
  602. {
  603. sizeF = g.MeasureString("" + this.unitString, textfont1);
  604. rectangleF2.Location = new Point((int)this.rotationPoint.X + offsetValue1 - (int)sizeF.Width / 2, (int)this.rotationPoint.Y + offset);
  605. offset += offsetValue;
  606. }
  607. // 测量单位(英文)
  608. if (drawingPropertiesList.Contains(MeasureAttributes.MeasureUnitEN.ToString()))
  609. {
  610. sizeF = g.MeasureString("" + this.unit, textfont1);
  611. rectangleF3.Location = new Point((int)this.rotationPoint.X + offsetValue1 - (int)sizeF.Width / 2, (int)this.rotationPoint.Y + offset);
  612. offset += offsetValue;
  613. }
  614. }
  615. }
  616. if (drawingPropertiesList != null)
  617. {
  618. // 测量方式
  619. if (drawingPropertiesList.Contains(MeasureAttributes.MeasureMethod.ToString()))
  620. {
  621. sizeF = g.MeasureString("" + PdnResources.GetString("Menu.MeasureAction.MeasureMulSegment.Text"), textfont1);
  622. rectangleF1.Width = sizeF.Width;
  623. rectangleF1.Height = sizeF.Height;
  624. g.DrawString("" + PdnResources.GetString("Menu.MeasureAction.MeasureMulSegment.Text"), textfont1, textbrush1, rectangleF1);
  625. }
  626. else
  627. {
  628. rectangleF1 = new RectangleF();
  629. }
  630. // 测量单位(中文)
  631. if (drawingPropertiesList.Contains(MeasureAttributes.MeasureUnitCN.ToString()))
  632. {
  633. sizeF = g.MeasureString("" + this.unitString, textfont1);
  634. rectangleF2.Width = sizeF.Width;
  635. rectangleF2.Height = sizeF.Height;
  636. g.DrawString("" + this.unitString, textfont1, textbrush1, rectangleF2);
  637. }
  638. else
  639. {
  640. rectangleF2 = new RectangleF();
  641. }
  642. // 测量单位(英文)
  643. if (drawingPropertiesList.Contains(MeasureAttributes.MeasureUnitEN.ToString()))
  644. {
  645. sizeF = g.MeasureString("" + this.unit, textfont1);
  646. rectangleF3.Width = sizeF.Width;
  647. rectangleF3.Height = sizeF.Height;
  648. g.DrawString("" + this.unit, textfont1, textbrush1, rectangleF3);
  649. }
  650. else
  651. {
  652. rectangleF3 = new RectangleF();
  653. }
  654. // 像素平均截距
  655. if (drawingPropertiesList.Contains(MeasureAttributes.PixelAverageIntercept.ToString()))
  656. {
  657. sizeF = g.MeasureString("" + Math.Round(allLength / (pointArray.Count - 1), decimalPlaces) + "px", textfont1);
  658. rectangleF4.Width = sizeF.Width;
  659. rectangleF4.Height = sizeF.Height;
  660. g.DrawString("" + Math.Round(allLength / (pointArray.Count - 1), decimalPlaces) + "px", textfont1, textbrush1, rectangleF4);
  661. }
  662. else
  663. {
  664. rectangleF4 = new RectangleF();
  665. }
  666. // 物理平均截距
  667. if (drawingPropertiesList.Contains(MeasureAttributes.PhysicalAverage.ToString()))
  668. {
  669. string s = Math.Round(allLength * unitLength / (pointArray.Count - 1), decimalPlaces).ToString();
  670. if (s.IndexOf(".") == -1)
  671. {
  672. for (int i = 0; i < decimalPlaces; i++)
  673. {
  674. if (i == 0)
  675. s += ".";
  676. s += "0";
  677. }
  678. }
  679. else
  680. {
  681. int a = s.Length - s.IndexOf(".") - 1;
  682. if (a < decimalPlaces)
  683. {
  684. for (int i = 0; i < decimalPlaces - a; i++)
  685. {
  686. s += "0";
  687. }
  688. }
  689. }
  690. sizeF = g.MeasureString(s + this.unit, textfont1);
  691. rectangleF5.Width = sizeF.Width;
  692. rectangleF5.Height = sizeF.Height;
  693. g.DrawString(s + this.unit, textfont1, textbrush1, rectangleF5);
  694. }
  695. else
  696. {
  697. rectangleF5 = new RectangleF();
  698. }
  699. }
  700. if (this.configurationFile)
  701. this.pointChange = false;
  702. this.mouseUpAttribute = false;
  703. pointChangeObject.Remove(this.drawToolType);
  704. }
  705. }
  706. /// 停止绘制时
  707. /// </summary>
  708. /// <param name="up"></param>
  709. public override void MouseUp(bool up)
  710. {
  711. mouseUpPointChange = up;
  712. }
  713. public void AddPoint(Point point)
  714. {
  715. pointArray.Add(point);
  716. }
  717. public override int HandleCount
  718. {
  719. get
  720. {
  721. return pointArray.Count + 1;
  722. }
  723. }
  724. /// <summary>
  725. /// Get handle pointscroll by 1-based number
  726. /// </summary>
  727. /// <param name="handleNumber"></param>
  728. /// <returns></returns>
  729. public override PointF GetHandle(int handleNumber)
  730. {
  731. if (handleNumber < 1)
  732. handleNumber = 1;
  733. if (handleNumber > pointArray.Count && handleNumber != pointArray.Count + 1)
  734. handleNumber = pointArray.Count;
  735. if (handleNumber == pointArray.Count + 1)
  736. return this.pointL;
  737. else
  738. return pointArray[handleNumber - 1];
  739. }
  740. public override Cursor GetHandleCursor(int handleNumber)
  741. {
  742. return handleCursor;
  743. }
  744. public override void MoveHandleTo(Point point, int handleNumber)
  745. {
  746. if (handleNumber < 1)
  747. handleNumber = 1;
  748. if (handleNumber > pointArray.Count && handleNumber != pointArray.Count + 1)
  749. handleNumber = pointArray.Count;
  750. if (handleNumber == pointArray.Count + 1)
  751. {
  752. if (this.moveKb == 1)
  753. this.rectangleF1.Offset(point.X - this.pointL.X, point.Y - this.pointL.Y);
  754. else if (this.moveKb == 2)
  755. this.rectangleF2.Offset(point.X - this.pointL.X, point.Y - this.pointL.Y);
  756. else if (this.moveKb == 3)
  757. this.rectangleF3.Offset(point.X - this.pointL.X, point.Y - this.pointL.Y);
  758. else if (this.moveKb == 4)
  759. this.rectangleF4.Offset(point.X - this.pointL.X, point.Y - this.pointL.Y);
  760. else if (this.moveKb == 5)
  761. this.rectangleF5.Offset(point.X - this.pointL.X, point.Y - this.pointL.Y);
  762. else
  763. {
  764. for (int i = 0; i < this.RectangleFList.Count; i++)
  765. {
  766. RectangleF rectangleF = this.RectangleFList[i];
  767. if (this.moveKb == -i)
  768. rectangleF.Offset(point.X - this.pointL.X, point.Y - this.pointL.Y);
  769. this.RectangleFList[i] = rectangleF;
  770. }
  771. }
  772. this.pointL = point;
  773. }
  774. else
  775. {
  776. this.mouseUpPointChange = true;
  777. if (handleNumber != 1)
  778. {
  779. for (int i = 1; i <= this.RectangleFList.Count; i++)
  780. {
  781. if (i == handleNumber)
  782. {
  783. RectangleF rectangleF = this.RectangleFList[i * 6 - 12];
  784. rectangleF.Offset(point.X - this.pointArray[i - 1].X, pointArray[handleNumber - 2].Y - this.pointArray[i - 1].Y);
  785. this.RectangleFList[i * 6 - 12] = rectangleF;
  786. rectangleF = this.RectangleFList[i * 6 - 11];
  787. rectangleF.Offset(point.X - this.pointArray[i - 1].X, pointArray[handleNumber - 2].Y - this.pointArray[i - 1].Y);
  788. this.RectangleFList[i * 6 - 11] = rectangleF;
  789. rectangleF = this.RectangleFList[i * 6 - 10];
  790. rectangleF.Offset(point.X - this.pointArray[i - 1].X, pointArray[handleNumber - 2].Y - this.pointArray[i - 1].Y);
  791. this.RectangleFList[i * 6 - 10] = rectangleF;
  792. rectangleF = this.RectangleFList[i * 6 - 9];
  793. rectangleF.Offset(point.X - this.pointArray[i - 1].X, pointArray[handleNumber - 2].Y - this.pointArray[i - 1].Y);
  794. this.RectangleFList[i * 6 - 9] = rectangleF;
  795. rectangleF = this.RectangleFList[i * 6 - 8];
  796. rectangleF.Offset(point.X - this.pointArray[i - 1].X, pointArray[handleNumber - 2].Y - this.pointArray[i - 1].Y);
  797. this.RectangleFList[i * 6 - 8] = rectangleF;
  798. rectangleF = this.RectangleFList[i * 6 - 7];
  799. rectangleF.Offset(point.X - this.pointArray[i - 1].X, pointArray[handleNumber - 2].Y - this.pointArray[i - 1].Y);
  800. this.RectangleFList[i * 6 - 7] = rectangleF;
  801. }
  802. }
  803. pointArray[handleNumber - 1] = new PointF(point.X, pointArray[handleNumber - 2].Y);
  804. }
  805. else
  806. {
  807. this.rectangleF1.Offset(point.X - this.pointArray[0].X, pointArray[0].Y - this.pointArray[0].Y);
  808. this.rectangleF2.Offset(point.X - this.pointArray[0].X, pointArray[0].Y - this.pointArray[0].Y);
  809. this.rectangleF3.Offset(point.X - this.pointArray[0].X, pointArray[0].Y - this.pointArray[0].Y);
  810. this.rectangleF4.Offset(point.X - this.pointArray[0].X, pointArray[0].Y - this.pointArray[0].Y);
  811. this.rectangleF5.Offset(point.X - this.pointArray[0].X, pointArray[0].Y - this.pointArray[0].Y);
  812. pointArray[0] = new PointF(point.X, pointArray[0].Y);
  813. }
  814. }
  815. this.startPoint = pointArray[0];
  816. Invalidate();
  817. }
  818. public override void Move(int deltaX, int deltaY)
  819. {
  820. int n = pointArray.Count;
  821. for (int i = 0; i < n; i++)
  822. {
  823. PointF point = new PointF(pointArray[i].X + ISurfaceBox.UnscaleScalar(deltaX), pointArray[i].Y + ISurfaceBox.UnscaleScalar(deltaY));
  824. pointArray[i] = point;
  825. }
  826. this.startPoint = pointArray[0];
  827. int x = ISurfaceBox.UnscaleScalar(deltaX);
  828. int y = ISurfaceBox.UnscaleScalar(deltaY);
  829. pointL.X += x;
  830. pointL.Y += y;
  831. this.rectangleF1.Offset(x, y);
  832. this.rectangleF2.Offset(x, y);
  833. this.rectangleF3.Offset(x, y);
  834. this.rectangleF4.Offset(x, y);
  835. this.rectangleF5.Offset(x, y);
  836. for (int i = 0; i < this.RectangleFList.Count; i++)
  837. {
  838. RectangleF rectangleF = this.RectangleFList[i];
  839. rectangleF.Offset(x, y);
  840. this.RectangleFList[i] = rectangleF;
  841. }
  842. Invalidate();
  843. }
  844. /// <summary>
  845. /// 用于创建一个路径或者是闭合的范围
  846. /// 用于响应点击选中
  847. /// 需要咨询用户是仅点击线还是矩形选择
  848. /// </summary>
  849. protected virtual void CreateObjects()
  850. {
  851. if (AreaPath != null)
  852. return;
  853. // Create path which contains wide line
  854. // for easy mouse selection
  855. AreaPath = new GraphicsPath();
  856. AreaPen = new Pen(Color.Black, 7);
  857. AreaPath.AddLines(pointArray.ToArray());
  858. AreaPath.Widen(AreaPen);
  859. // Create region from the path
  860. AreaRegion = new Region(AreaPath);
  861. }
  862. /// <summary>
  863. /// Invalidate object.
  864. /// When object is invalidated, path used for hit test
  865. /// is released and should be created again.
  866. /// </summary>
  867. protected void Invalidate()
  868. {
  869. if (AreaPath != null)
  870. {
  871. AreaPath.Dispose();
  872. AreaPath = null;
  873. }
  874. if (AreaPen != null)
  875. {
  876. AreaPen.Dispose();
  877. AreaPen = null;
  878. }
  879. if (AreaRegion != null)
  880. {
  881. AreaRegion.Dispose();
  882. AreaRegion = null;
  883. }
  884. }
  885. protected GraphicsPath AreaPath
  886. {
  887. get
  888. {
  889. return areaPath;
  890. }
  891. set
  892. {
  893. areaPath = value;
  894. }
  895. }
  896. protected Pen AreaPen
  897. {
  898. get
  899. {
  900. return areaPen;
  901. }
  902. set
  903. {
  904. areaPen = value;
  905. }
  906. }
  907. protected Region AreaRegion
  908. {
  909. get
  910. {
  911. return areaRegion;
  912. }
  913. set
  914. {
  915. areaRegion = value;
  916. }
  917. }
  918. /// <summary>
  919. /// Draw tracker for selected object
  920. /// </summary>
  921. /// <param name="g"></param>
  922. public override void DrawTracker(Graphics g)
  923. {
  924. if (!Selected)
  925. return;
  926. SolidBrush brush = new SolidBrush(Color.Black);
  927. for (int i = 1; i <= HandleCount; i++)
  928. {
  929. if (i == HandleCount)
  930. brush = new SolidBrush(Color.Transparent);
  931. g.FillRectangle(brush, GetHandleRectangle(i));
  932. }
  933. brush.Dispose();
  934. RectangleF r = GetBoundingBox();
  935. //g.DrawRectangle(new Pen(Color.White), r.X, r.Y, r.Width, r.Height);
  936. }
  937. /// <summary>
  938. /// Hit test.
  939. /// Return value: -1 - no hit
  940. /// 0 - hit anywhere
  941. /// > 1 - handle number
  942. /// </summary>
  943. /// <param name="pointscroll"></param>
  944. /// <returns></returns>
  945. public override int HitTest(Point point)
  946. {
  947. if (Selected)
  948. {
  949. for (int i = 1; i <= HandleCount; i++)
  950. {
  951. if (GetHandleRectangle(i).Contains(point))
  952. return i;
  953. }
  954. if (this.rectangleF1.Contains(point))
  955. {
  956. this.pointL = point;
  957. moveKb = 1;
  958. return this.pointArray.Count;
  959. }
  960. else if (this.rectangleF2.Contains(point))
  961. {
  962. this.pointL = point;
  963. moveKb = 2;
  964. return this.pointArray.Count;
  965. }
  966. else if (this.rectangleF3.Contains(point))
  967. {
  968. this.pointL = point;
  969. moveKb = 3;
  970. return this.pointArray.Count;
  971. }
  972. else if (this.rectangleF4.Contains(point))
  973. {
  974. this.pointL = point;
  975. moveKb = 4;
  976. return this.pointArray.Count;
  977. }
  978. else if (this.rectangleF5.Contains(point))
  979. {
  980. this.pointL = point;
  981. moveKb = 5;
  982. return this.pointArray.Count;
  983. }
  984. for (int i = 0; i < this.RectangleFList.Count; i++)
  985. {
  986. RectangleF rectangleF = this.RectangleFList[i];
  987. if (rectangleF.Contains(point))
  988. {
  989. this.pointL = point;
  990. moveKb = -i;
  991. return this.pointArray.Count;
  992. }
  993. }
  994. }
  995. if (PointInObject(point))
  996. return 0;
  997. return -1;
  998. }
  999. protected override bool PointInObject(Point point)
  1000. {
  1001. CreateObjects();
  1002. return AreaRegion.IsVisible(point);
  1003. }
  1004. public override bool IntersectsWith(Rectangle rectangle)
  1005. {
  1006. CreateObjects();
  1007. return AreaRegion.IsVisible(rectangle);
  1008. }
  1009. public override RectangleF GetBoundingBox()
  1010. {
  1011. float minx = 0, maxx = 0, miny = 0, maxy = 0;
  1012. for (int i = 0; i < pointArray.Count; i++)
  1013. {
  1014. if (i == 0)
  1015. {
  1016. minx = maxx = pointArray[i].X;
  1017. miny = maxy = pointArray[i].Y;
  1018. }
  1019. else
  1020. {
  1021. if (pointArray[i].X >= maxx) maxx = pointArray[i].X;
  1022. if (pointArray[i].X <= minx) minx = pointArray[i].X;
  1023. if (pointArray[i].Y >= maxy) maxy = pointArray[i].Y;
  1024. if (pointArray[i].Y <= miny) miny = pointArray[i].Y;
  1025. }
  1026. }
  1027. return new RectangleF(minx, miny, maxx - minx, maxy - miny);
  1028. }
  1029. internal void setNextPoint(Point p)
  1030. {
  1031. AddPoint(p);
  1032. //startPoint = endPoint;
  1033. //endPoint = p;
  1034. }
  1035. internal void setEndPoint(Point p)
  1036. {
  1037. endPoint = p;
  1038. }
  1039. public override List<PointF> GetPoints()
  1040. {
  1041. return pointArray;
  1042. }
  1043. public override ParentStyleModel GetStyle()
  1044. {
  1045. return measureStyleModel;
  1046. }
  1047. }
  1048. }