LineMeasureParam.cs 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Media;
  10. namespace ComPDFKit.Tool
  11. {
  12. public class LineMeasureParam : AnnotParam
  13. {
  14. public LineMeasureParam()
  15. {
  16. CurrentType = C_ANNOTATION_TYPE.C_ANNOTATION_LINE;
  17. }
  18. public byte[] LineColor { get; set; }
  19. public float LineWidth { get; set; }
  20. public float[] LineDash { get; set; }
  21. public CPoint HeadPoint { get; set; }
  22. public CPoint TailPoint { get; set; }
  23. public C_LINE_TYPE HeadLineType { get; set; }
  24. public C_LINE_TYPE TailLineType { get; set; }
  25. public string FontName { get; set; }
  26. public double FontSize { get; set; }
  27. public byte[] FontColor { get; set; }
  28. public bool IsBold { get; set; }
  29. public bool IsItalic { get; set; }
  30. public C_BORDER_STYLE BorderStyle { get; set; }
  31. public CPDFMeasureInfo measureInfo { get; set; }
  32. public override bool CopyTo(AnnotParam transfer)
  33. {
  34. LineMeasureParam polygonTransfer = transfer as LineMeasureParam;
  35. if (polygonTransfer == null)
  36. {
  37. return false;
  38. }
  39. if (!base.CopyTo(polygonTransfer))
  40. {
  41. return false;
  42. }
  43. if (LineColor != null)
  44. {
  45. polygonTransfer.LineColor = (byte[])LineColor.Clone();
  46. }
  47. if (LineDash != null)
  48. {
  49. polygonTransfer.LineDash = (float[])LineDash.Clone();
  50. }
  51. if (FontColor != null)
  52. {
  53. polygonTransfer.FontColor = (byte[])FontColor.Clone();
  54. }
  55. if (measureInfo != null)
  56. {
  57. CPDFMeasureInfo cPDFMeasureInfo = new CPDFMeasureInfo()
  58. {
  59. Factor = measureInfo.Factor,
  60. Unit = measureInfo.Unit,
  61. DecimalSymbol = measureInfo.DecimalSymbol,
  62. ThousandSymbol = measureInfo.ThousandSymbol,
  63. Display = measureInfo.Display,
  64. Precision = measureInfo.Precision,
  65. UnitPrefix = measureInfo.UnitPrefix,
  66. UnitSuffix = measureInfo.UnitSuffix,
  67. UnitPosition = measureInfo.UnitPosition,
  68. RulerBase = measureInfo.RulerBase,
  69. RulerBaseUnit = measureInfo.RulerBaseUnit,
  70. RulerTranslateUnit = measureInfo.RulerTranslateUnit,
  71. RulerTranslate= measureInfo.RulerTranslate,
  72. CaptionType = measureInfo.CaptionType,
  73. };
  74. polygonTransfer.measureInfo = cPDFMeasureInfo;
  75. }
  76. polygonTransfer.LineWidth = LineWidth;
  77. polygonTransfer.HeadLineType = HeadLineType;
  78. polygonTransfer.TailLineType = TailLineType;
  79. polygonTransfer.FontName = FontName;
  80. polygonTransfer.FontSize = FontSize;
  81. polygonTransfer.IsBold = IsBold;
  82. polygonTransfer.IsItalic = IsItalic;
  83. polygonTransfer.HeadPoint = HeadPoint;
  84. polygonTransfer.TailPoint = TailPoint;
  85. polygonTransfer.BorderStyle = BorderStyle;
  86. return true;
  87. }
  88. }
  89. }