PolygonMeasureParam.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. using ComPDFKit.Import;
  2. using ComPDFKit.Measure;
  3. using ComPDFKit.PDFAnnotation;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Net;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows;
  11. using System.Windows.Media;
  12. namespace ComPDFKit.Tool
  13. {
  14. public class PolygonMeasureParam : AnnotParam
  15. {
  16. public PolygonMeasureParam()
  17. {
  18. CurrentType = C_ANNOTATION_TYPE.C_ANNOTATION_POLYGON;
  19. }
  20. public byte[] FillColor { get; set; }
  21. public bool HasFillColor { get; set; }
  22. public byte[] LineColor { get; set; }
  23. public float LineWidth { get; set; }
  24. public float[] LineDash { get; set; }
  25. public List<CPoint> SavePoints { get; set; }
  26. public byte[] EndLineColor { get; set; }
  27. public double EndLineWidth { get; set; }
  28. public double EndTransparency { get; set; }
  29. public DashStyle EndLineDash { get; set; }
  30. public string FontName { get; set; }
  31. public double FontSize { get; set; }
  32. public byte[] FontColor { get; set; }
  33. public bool IsBold { get; set; }
  34. public bool IsItalic { get; set; }
  35. public bool IsMeasure { get; set; } = true;
  36. public C_BORDER_STYLE BorderStyle { get; set; }
  37. public CPDFMeasureInfo measureInfo { get; set; }
  38. public override bool CopyTo(AnnotParam transfer)
  39. {
  40. PolygonMeasureParam polygonTransfer = transfer as PolygonMeasureParam;
  41. if (polygonTransfer == null)
  42. {
  43. return false;
  44. }
  45. if (!base.CopyTo(polygonTransfer))
  46. {
  47. return false;
  48. }
  49. if (FillColor != null)
  50. {
  51. polygonTransfer.FillColor = (byte[])FillColor.Clone();
  52. }
  53. if (SavePoints != null)
  54. {
  55. polygonTransfer.SavePoints.CopyTo(SavePoints.ToArray());
  56. }
  57. if (LineColor != null)
  58. {
  59. polygonTransfer.LineColor = (byte[])LineColor.Clone();
  60. }
  61. if (LineDash != null)
  62. {
  63. polygonTransfer.LineDash = (float[])LineDash.Clone();
  64. }
  65. if (EndLineColor != null)
  66. {
  67. polygonTransfer.EndLineColor = (byte[])EndLineColor.Clone();
  68. }
  69. if (EndLineDash != null)
  70. {
  71. polygonTransfer.EndLineDash = EndLineDash.Clone();
  72. }
  73. if (FontColor != null)
  74. {
  75. polygonTransfer.FontColor = (byte[])FontColor.Clone();
  76. }
  77. if (measureInfo != null)
  78. {
  79. CPDFMeasureInfo cPDFMeasureInfo =new CPDFMeasureInfo()
  80. {
  81. Factor=measureInfo.Factor,
  82. Unit=measureInfo.Unit,
  83. DecimalSymbol=measureInfo.DecimalSymbol,
  84. ThousandSymbol=measureInfo.ThousandSymbol,
  85. Display=measureInfo.Display,
  86. Precision=measureInfo.Precision,
  87. UnitPrefix=measureInfo.UnitPrefix,
  88. UnitSuffix=measureInfo.UnitSuffix,
  89. UnitPosition=measureInfo.UnitPosition,
  90. RulerBase=measureInfo.RulerBase,
  91. RulerBaseUnit=measureInfo.RulerBaseUnit,
  92. RulerTranslateUnit=measureInfo.RulerTranslateUnit,
  93. CaptionType=measureInfo.CaptionType,
  94. RulerTranslate=measureInfo.RulerTranslate,
  95. };
  96. polygonTransfer.measureInfo = cPDFMeasureInfo;
  97. }
  98. polygonTransfer.HasFillColor = HasFillColor;
  99. polygonTransfer.LineWidth = LineWidth;
  100. polygonTransfer.EndLineWidth = EndLineWidth;
  101. polygonTransfer.EndTransparency = EndTransparency;
  102. polygonTransfer.FontName = FontName;
  103. polygonTransfer.FontSize = FontSize;
  104. polygonTransfer.IsBold = IsBold;
  105. polygonTransfer.IsItalic = IsItalic;
  106. polygonTransfer.BorderStyle = BorderStyle;
  107. return true;
  108. }
  109. }
  110. }