PolygonMeasureParam.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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 C_BORDER_STYLE BorderStyle { get; set; }
  36. public CPDFMeasureInfo measureInfo { get; set; }
  37. public override bool CopyTo(AnnotParam transfer)
  38. {
  39. PolygonMeasureParam polygonTransfer = transfer as PolygonMeasureParam;
  40. if (polygonTransfer == null)
  41. {
  42. return false;
  43. }
  44. if (!base.CopyTo(polygonTransfer))
  45. {
  46. return false;
  47. }
  48. if (FillColor != null)
  49. {
  50. polygonTransfer.FillColor = (byte[])FillColor.Clone();
  51. }
  52. if (SavePoints != null)
  53. {
  54. polygonTransfer.SavePoints.CopyTo(SavePoints.ToArray());
  55. }
  56. if (LineColor != null)
  57. {
  58. polygonTransfer.LineColor = (byte[])LineColor.Clone();
  59. }
  60. if (LineDash != null)
  61. {
  62. polygonTransfer.LineDash = (float[])LineDash.Clone();
  63. }
  64. if (EndLineColor != null)
  65. {
  66. polygonTransfer.EndLineColor = (byte[])EndLineColor.Clone();
  67. }
  68. if (EndLineDash != null)
  69. {
  70. polygonTransfer.EndLineDash = EndLineDash.Clone();
  71. }
  72. if (FontColor != null)
  73. {
  74. polygonTransfer.FontColor = (byte[])FontColor.Clone();
  75. }
  76. if (measureInfo != null)
  77. {
  78. CPDFMeasureInfo cPDFMeasureInfo =new CPDFMeasureInfo()
  79. {
  80. Factor=measureInfo.Factor,
  81. Unit=measureInfo.Unit,
  82. DecimalSymbol=measureInfo.DecimalSymbol,
  83. ThousandSymbol=measureInfo.ThousandSymbol,
  84. Display=measureInfo.Display,
  85. Precision=measureInfo.Precision,
  86. UnitPrefix=measureInfo.UnitPrefix,
  87. UnitSuffix=measureInfo.UnitSuffix,
  88. UnitPosition=measureInfo.UnitPosition,
  89. RulerBase=measureInfo.RulerBase,
  90. RulerBaseUnit=measureInfo.RulerBaseUnit,
  91. RulerTranslateUnit=measureInfo.RulerTranslateUnit,
  92. CaptionType=measureInfo.CaptionType,
  93. RulerTranslate=measureInfo.RulerTranslate,
  94. };
  95. polygonTransfer.measureInfo = cPDFMeasureInfo;
  96. }
  97. polygonTransfer.HasFillColor = HasFillColor;
  98. polygonTransfer.LineWidth = LineWidth;
  99. polygonTransfer.EndLineWidth = EndLineWidth;
  100. polygonTransfer.EndTransparency = EndTransparency;
  101. polygonTransfer.FontName = FontName;
  102. polygonTransfer.FontSize = FontSize;
  103. polygonTransfer.IsBold = IsBold;
  104. polygonTransfer.IsItalic = IsItalic;
  105. polygonTransfer.BorderStyle = BorderStyle;
  106. return true;
  107. }
  108. }
  109. }