MeasurePropertyControl.xaml.cs 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. using ComPDFKit.PDFAnnotation;
  2. using ComPDFKit.Tool;
  3. using ComPDFKit.Controls.Measure.Property;
  4. using ComPDFKit.Controls.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.Controls.Measure
  20. {
  21. public partial class MeasurePropertyControl : UserControl
  22. {
  23. private UIElement currentPanel = null;
  24. public MeasurePropertyControl()
  25. {
  26. InitializeComponent();
  27. }
  28. public void SetPropertyForMeasureCreate(AnnotParam param, CPDFAnnotation annot, PDFViewControl viewControl)
  29. {
  30. if (param == null)
  31. {
  32. ClearMeasurePanel();
  33. return;
  34. }
  35. switch (param.CurrentType)
  36. {
  37. case C_ANNOTATION_TYPE.C_ANNOTATION_LINE:
  38. StraightnessProperty straightnessProperty = new StraightnessProperty();
  39. if(param is LineMeasureParam lineMeasureParam)
  40. {
  41. straightnessProperty.SetAnnotParam(lineMeasureParam, annot, viewControl);
  42. }
  43. currentPanel = straightnessProperty;
  44. break;
  45. case C_ANNOTATION_TYPE.C_ANNOTATION_POLYLINE:
  46. MultilineProperty multilineProperty = new MultilineProperty();
  47. if (param is PolyLineMeasureParam polyLineMeasureParam)
  48. {
  49. multilineProperty.SetAnnotParam(polyLineMeasureParam, annot, viewControl);
  50. }
  51. currentPanel = multilineProperty;
  52. break;
  53. case C_ANNOTATION_TYPE.C_ANNOTATION_POLYGON:
  54. PolygonalProperty polygonProperty = new PolygonalProperty();
  55. if (param is PolygonMeasureParam polygonMeasureParam)
  56. {
  57. polygonProperty.SetAnnotParam(polygonMeasureParam, annot, viewControl);
  58. }
  59. currentPanel = polygonProperty;
  60. break;
  61. default:
  62. break;
  63. }
  64. SetMeasurePanel(currentPanel);
  65. }
  66. private void SetMeasurePanel(UIElement newChild)
  67. {
  68. MeasurePropertyPanel.Child = newChild;
  69. }
  70. public void ClearMeasurePanel()
  71. {
  72. currentPanel = null;
  73. MeasurePropertyPanel.Child = null;
  74. }
  75. //public void SetPorpertyForMeasureModify(AnnotAttribEvent annotEvent)
  76. //{
  77. //}
  78. }
  79. }