MeasurePropertyControl.xaml.cs 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. using ComPDFKit.PDFAnnotation;
  2. using ComPDFKit.Tool;
  3. using Compdfkit_Tools.Measure.Property;
  4. using Compdfkit_Tools.PDFControl;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows;
  11. using System.Windows.Controls;
  12. using System.Windows.Data;
  13. using System.Windows.Documents;
  14. using System.Windows.Input;
  15. using System.Windows.Media;
  16. using System.Windows.Media.Imaging;
  17. using System.Windows.Navigation;
  18. using System.Windows.Shapes;
  19. namespace Compdfkit_Tools.Measure
  20. {
  21. /// <summary>
  22. /// MeasurePropertyControl.xaml 的交互逻辑
  23. /// </summary>
  24. public partial class MeasurePropertyControl : UserControl
  25. {
  26. private UIElement currentPanel = null;
  27. public MeasurePropertyControl()
  28. {
  29. InitializeComponent();
  30. }
  31. public void SetPropertyForMeasureCreate(AnnotParam param, CPDFAnnotation annot, PDFViewControl viewControl)
  32. {
  33. if (param == null)
  34. {
  35. ClearMeasurePanel();
  36. return;
  37. }
  38. switch (param.CurrentType)
  39. {
  40. case C_ANNOTATION_TYPE.C_ANNOTATION_LINE:
  41. StraightnessProperty straightnessProperty = new StraightnessProperty();
  42. if(param is LineMeasureParam lineMeasureParam)
  43. {
  44. straightnessProperty.SetAnnotParam(lineMeasureParam, annot, viewControl);
  45. }
  46. currentPanel = straightnessProperty;
  47. break;
  48. case C_ANNOTATION_TYPE.C_ANNOTATION_POLYLINE:
  49. MultilineProperty multilineProperty = new MultilineProperty();
  50. if (param is PolyLineMeasureParam polyLineMeasureParam)
  51. {
  52. multilineProperty.SetAnnotParam(polyLineMeasureParam, annot, viewControl);
  53. }
  54. currentPanel = multilineProperty;
  55. break;
  56. case C_ANNOTATION_TYPE.C_ANNOTATION_POLYGON:
  57. PolygonalProperty polygonProperty = new PolygonalProperty();
  58. if (param is PolygonMeasureParam polygonMeasureParam)
  59. {
  60. polygonProperty.SetAnnotParam(polygonMeasureParam, annot, viewControl);
  61. }
  62. currentPanel = polygonProperty;
  63. break;
  64. default:
  65. break;
  66. }
  67. SetMeasurePanel(currentPanel);
  68. }
  69. private void SetMeasurePanel(UIElement newChild)
  70. {
  71. MeasurePropertyPanel.Child = newChild;
  72. }
  73. public void ClearMeasurePanel()
  74. {
  75. currentPanel = null;
  76. MeasurePropertyPanel.Child = null;
  77. }
  78. //public void SetPorpertyForMeasureModify(AnnotAttribEvent annotEvent)
  79. //{
  80. //}
  81. }
  82. }