MeasureControl.xaml.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  1. using ComPDFKit.Measure;
  2. using ComPDFKit.PDFAnnotation;
  3. using ComPDFKit.Tool;
  4. using Compdfkit_Tools.Helper;
  5. using Compdfkit_Tools.PDFControl;
  6. using ComPDFKitViewer;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.ComponentModel;
  10. using System.Globalization;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Threading.Tasks;
  14. using System.Windows;
  15. using System.Windows.Controls;
  16. using System.Windows.Data;
  17. using System.Windows.Documents;
  18. using System.Windows.Input;
  19. using System.Windows.Media;
  20. using System.Windows.Media.Imaging;
  21. using System.Windows.Navigation;
  22. using System.Windows.Shapes;
  23. using ComPDFKitViewer.BaseObject;
  24. namespace Compdfkit_Tools.Measure
  25. {
  26. /// <summary>
  27. /// MeasureControl.xaml 的交互逻辑
  28. /// </summary>
  29. public partial class MeasureControl : UserControl
  30. {
  31. public MeasurePropertyControl measurePropertyControl = new MeasurePropertyControl();
  32. private CPDFDisplaySettingsControl displaySettingsControl;
  33. private PDFViewControl PdfViewControl = new PDFViewControl();
  34. private PanelState panelState = PanelState.GetInstance();
  35. public event EventHandler ExpandEvent;
  36. public MeasureControl()
  37. {
  38. InitializeComponent();
  39. //MeasureSetting.MeasureChanged += MeasureSetting_MeasureChanged;
  40. }
  41. //private void MeasureSetting_MeasureChanged(object sender, MeasureEventArgs e)
  42. //{
  43. // InfoPanel.SetMeasureType(e.Type);
  44. // InfoPanel.SetMeasureInfo(e);
  45. // switch (e.Type)
  46. // {
  47. // case CPDFMeasureType.CPDF_DISTANCE_MEASURE:
  48. // case CPDFMeasureType.CPDF_PERIMETER_MEASURE:
  49. // SettingPanel.ShowAreaAndLength(Visibility.Collapsed);
  50. // break;
  51. // case CPDFMeasureType.CPDF_AREA_MEASURE:
  52. // SettingPanel.ShowAreaAndLength(Visibility.Visible);
  53. // break;
  54. // default:
  55. // break;
  56. // }
  57. // SettingPanel.BindMeasureSetting(e);
  58. //}
  59. #region Init PDFViewer
  60. public void InitWithPDFViewer(PDFViewControl pdfViewControl)
  61. {
  62. PdfViewControl = pdfViewControl;
  63. //PdfViewControl.PDFView = pdfViewer;
  64. PDFMeasureTool.InitWithPDFViewer(pdfViewControl, measurePropertyControl, this);
  65. FloatPageTool.InitWithPDFViewer(pdfViewControl);
  66. PDFGrid.Child = PdfViewControl;
  67. panelState.PropertyChanged -= PanelState_PropertyChanged;
  68. panelState.PropertyChanged += PanelState_PropertyChanged;
  69. PdfViewControl.MouseLeftButtonDownHandler -= PDFToolManager_MouseLeftButtonDownHandler;
  70. PdfViewControl.MouseLeftButtonUpHandler -= PDFToolManager_MouseLeftButtonUpHandler;
  71. PdfViewControl.MouseMoveHandler -= PDFToolManager_MouseMoveHandler;
  72. PdfViewControl.MouseLeftButtonDownHandler += PDFToolManager_MouseLeftButtonDownHandler;
  73. PdfViewControl.MouseLeftButtonUpHandler += PDFToolManager_MouseLeftButtonUpHandler;
  74. PdfViewControl.MouseMoveHandler += PDFToolManager_MouseMoveHandler;
  75. //pdfViewControl.PDFView.AnnotActiveHandler -= PDFView_AnnotActiveHandler;
  76. //pdfViewControl.PDFView.AnnotActiveHandler += PDFView_AnnotActiveHandler;
  77. //pdfViewControl.PDFView.AnnotCommandHandler -= PDFView_AnnotCommandHandler;
  78. //pdfViewControl.PDFView.AnnotCommandHandler += PDFView_AnnotCommandHandler;
  79. SetInfoPanelVisble(false, false);
  80. SettingPanel.PdfViewControl= pdfViewControl;
  81. }
  82. private void PDFToolManager_MouseMoveHandler(object sender, MouseEventObject e)
  83. {
  84. }
  85. private void PDFToolManager_MouseLeftButtonUpHandler(object sender, MouseEventObject e)
  86. {
  87. }
  88. private void PDFToolManager_MouseLeftButtonDownHandler(object sender, MouseEventObject e)
  89. {
  90. if (e.annotType == C_ANNOTATION_TYPE.C_ANNOTATION_LINE)
  91. {
  92. BaseAnnot baseAnnot = PdfViewControl.GetCacheHitTestAnnot();
  93. if (baseAnnot != null)
  94. {
  95. }
  96. // panelState.RightPanel = PanelState.RightPanelState.PropertyPanel;
  97. // measurePropertyControl.SetPropertyForMeasureCreate(LineArgs, e);
  98. // SetInfoPanelVisble(true, false);
  99. // SetMeasureInfoPanel(LineArgs.GetPDFAnnot(), LineArgs);
  100. }
  101. }
  102. //private void PDFView_AnnotCommandHandler(object sender, AnnotCommandArgs e)
  103. //{
  104. // switch (e.CommandType)
  105. // {
  106. // case CommandType.Context:
  107. // if (e.CommandTarget == TargetType.Annot && e.PressOnAnnot)
  108. // {
  109. // e.Handle = true;
  110. // e.PopupMenu = new ContextMenu();
  111. // e.PopupMenu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Delete"), Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
  112. // MenuItem menuItem = new MenuItem();
  113. // menuItem.Header = "Measurement Settings";
  114. // menuItem.Click += (item, param) =>
  115. // {
  116. // SettingPanel.UpdateArgsList = e.AnnotEventArgsList;
  117. // SettingPanel.BindMeasureSetting();
  118. // SetInfoPanelVisble(false, true);
  119. // };
  120. // MenuItem propertyItem = new MenuItem();
  121. // propertyItem.Header = "Properties";
  122. // propertyItem.Click += (item, param) =>
  123. // {
  124. // ExpandEvent?.Invoke(this, new EventArgs());
  125. // };
  126. // e.PopupMenu.Items.Add(menuItem);
  127. // e.PopupMenu.Items.Add(propertyItem);
  128. // }
  129. // break;
  130. // case CommandType.Delete:
  131. // e.DoCommand();
  132. // break;
  133. // default:
  134. // break;
  135. // }
  136. //}
  137. //private void PDFView_AnnotActiveHandler(object sender, AnnotAttribEvent e)
  138. //{
  139. // if (e == null || e.IsAnnotCreateReset)
  140. // {
  141. // if (e == null)
  142. // {
  143. // measurePropertyControl?.ClearMeasurePanel();
  144. // if(PDFMeasureTool.ToolChecked()==false)
  145. // {
  146. // SetInfoPanelVisble(false, false);
  147. // }
  148. // }
  149. // return;
  150. // }
  151. // else
  152. // {
  153. // switch (e.GetAnnotTypes())
  154. // {
  155. // case AnnotArgsType.LineMeasure:
  156. // LineMeasureArgs LineArgs = e.GetAnnotHandlerEventArgs(AnnotArgsType.LineMeasure).First() as LineMeasureArgs;
  157. // panelState.RightPanel = PanelState.RightPanelState.PropertyPanel;
  158. // measurePropertyControl.SetPropertyForMeasureCreate(LineArgs, e);
  159. // SetInfoPanelVisble(true, false);
  160. // SetMeasureInfoPanel(LineArgs.GetPDFAnnot(), LineArgs);
  161. // break;
  162. // case AnnotArgsType.PolygonMeasure:
  163. // PolygonMeasureArgs polygonArgs = e.GetAnnotHandlerEventArgs(AnnotArgsType.PolygonMeasure).First() as PolygonMeasureArgs;
  164. // panelState.RightPanel = PanelState.RightPanelState.PropertyPanel;
  165. // measurePropertyControl.SetPropertyForMeasureCreate(polygonArgs, e);
  166. // SetInfoPanelVisble(true, false);
  167. // SetMeasureInfoPanel(polygonArgs.GetPDFAnnot(),polygonArgs);
  168. // break;
  169. // case AnnotArgsType.PolyLineMeasure:
  170. // PolyLineMeasureArgs polyLineArgs = e.GetAnnotHandlerEventArgs(AnnotArgsType.PolyLineMeasure).First() as PolyLineMeasureArgs;
  171. // panelState.RightPanel = PanelState.RightPanelState.PropertyPanel;
  172. // measurePropertyControl.SetPropertyForMeasureCreate(polyLineArgs, e);
  173. // SetInfoPanelVisble(true, false);
  174. // SetMeasureInfoPanel(polyLineArgs.GetPDFAnnot(),polyLineArgs);
  175. // break;
  176. // }
  177. // }
  178. //}
  179. //private void SetMeasureInfoPanel(CPDFAnnotation rawAnnot,AnnotHandlerEventArgs annotArgs=null)
  180. //{
  181. // if (rawAnnot == null)
  182. // {
  183. // return;
  184. // }
  185. // try
  186. // {
  187. // if (rawAnnot.Type == C_ANNOTATION_TYPE.C_ANNOTATION_LINE)
  188. // {
  189. // CPDFLineAnnotation lineAnnot = rawAnnot as CPDFLineAnnotation;
  190. // if (lineAnnot.IsMersured() && lineAnnot.Points != null && lineAnnot.Points.Count() == 2)
  191. // {
  192. // CPDFDistanceMeasure lineMeasure = lineAnnot.GetDistanceMeasure();
  193. // CPDFMeasureInfo measureInfo = lineMeasure.MeasureInfo;
  194. // Vector standVector = new Vector(1, 0);
  195. // Point startPoint = new Point(lineAnnot.Points[0].x, lineAnnot.Points[0].y);
  196. // Point endPoint = new Point(lineAnnot.Points[1].x, lineAnnot.Points[1].y);
  197. // Vector movevector = endPoint - startPoint;
  198. // double showLenght=lineMeasure.GetMeasurementResults(CPDFCaptionType.CPDF_CAPTION_LENGTH);
  199. // MeasureEventArgs measureEvent = new MeasureEventArgs();
  200. // measureEvent.Angle = (int)Math.Abs(Vector.AngleBetween(movevector, standVector));
  201. // measureEvent.RulerTranslateUnit = measureInfo.RulerTranslateUnit;
  202. // measureEvent.RulerTranslate = measureInfo.RulerTranslate;
  203. // measureEvent.RulerBase = measureInfo.RulerBase;
  204. // measureEvent.RulerBaseUnit = measureInfo.RulerBaseUnit;
  205. // measureEvent.MousePos = new Point(
  206. // (int)Math.Abs(movevector.X),
  207. // (int)Math.Abs(movevector.Y));
  208. // measureEvent.Type = CPDFMeasureType.CPDF_DISTANCE_MEASURE;
  209. // NumberFormatInfo formatInfo = new NumberFormatInfo();
  210. // formatInfo.NumberDecimalDigits = Math.Abs(measureInfo.Precision).ToString().Length - 1;
  211. // measureEvent.Distance = showLenght.ToString("N", formatInfo) + " " + measureInfo.RulerTranslateUnit;
  212. // measureEvent.Precision = GetMeasureShowPrecision(measureInfo.Precision);
  213. // MeasureSetting.InvokeMeasureChangeEvent(this, measureEvent);
  214. // if(annotArgs!=null)
  215. // {
  216. // SettingPanel.UpdateArgsList =new List<AnnotHandlerEventArgs> { annotArgs};
  217. // }
  218. // }
  219. // }
  220. // if (rawAnnot.Type == C_ANNOTATION_TYPE.C_ANNOTATION_POLYLINE)
  221. // {
  222. // CPDFPolylineAnnotation polylineAnnot = rawAnnot as CPDFPolylineAnnotation;
  223. // if (polylineAnnot.IsMersured() && polylineAnnot.Points != null && polylineAnnot.Points.Count() >= 2)
  224. // {
  225. // double totalInch = 0;
  226. // for (int i = 0; i < polylineAnnot.Points.Count - 1; i++)
  227. // {
  228. // Point endLinePoint = new Point(
  229. // polylineAnnot.Points[i + 1].x,
  230. // polylineAnnot.Points[i + 1].y
  231. // );
  232. // Point startLinePoint = new Point(
  233. // polylineAnnot.Points[i].x,
  234. // polylineAnnot.Points[i].y
  235. // );
  236. // Vector subVector = endLinePoint - startLinePoint;
  237. // totalInch += subVector.Length;
  238. // }
  239. // totalInch = totalInch / 72D;
  240. // CPDFPerimeterMeasure lineMeasure = polylineAnnot.GetPerimeterMeasure();
  241. // CPDFMeasureInfo measureInfo = lineMeasure.MeasureInfo;
  242. // double showLenght = lineMeasure.GetMeasurementResults(CPDFCaptionType.CPDF_CAPTION_LENGTH);
  243. // MeasureEventArgs measureEvent = new MeasureEventArgs();
  244. // measureEvent.Angle = 0;
  245. // measureEvent.RulerTranslateUnit = measureInfo.RulerTranslateUnit;
  246. // measureEvent.RulerTranslate = measureInfo.RulerTranslate;
  247. // measureEvent.RulerBase = measureInfo.RulerBase;
  248. // measureEvent.RulerBaseUnit = measureInfo.RulerBaseUnit;
  249. // measureEvent.Precision = GetMeasureShowPrecision(measureInfo.Precision);
  250. // measureEvent.Type = CPDFMeasureType.CPDF_PERIMETER_MEASURE;
  251. // NumberFormatInfo formatInfo = new NumberFormatInfo();
  252. // formatInfo.NumberDecimalDigits = Math.Abs(measureInfo.Precision).ToString().Length - 1;
  253. // measureEvent.Distance = showLenght.ToString("N", formatInfo) +" "+ measureInfo.RulerTranslateUnit;
  254. // MeasureSetting.InvokeMeasureChangeEvent(this, measureEvent);
  255. // if (annotArgs != null)
  256. // {
  257. // SettingPanel.UpdateArgsList = new List<AnnotHandlerEventArgs> { annotArgs };
  258. // }
  259. // }
  260. // }
  261. // if(rawAnnot.Type== C_ANNOTATION_TYPE.C_ANNOTATION_POLYGON)
  262. // {
  263. // CPDFPolygonAnnotation Annot = rawAnnot as CPDFPolygonAnnotation;
  264. // CPDFAreaMeasure polygonMeasure = Annot.GetAreaMeasure();
  265. // CPDFMeasureInfo measureInfo = polygonMeasure.MeasureInfo;
  266. // CPDFCaptionType CaptionType = measureInfo.CaptionType;
  267. // bool IsArea = false;
  268. // bool IsLength = false;
  269. // if ((CaptionType& CPDFCaptionType.CPDF_CAPTION_AREA)== CPDFCaptionType.CPDF_CAPTION_AREA)
  270. // {
  271. // IsArea = true;
  272. // }
  273. // if ((CaptionType & CPDFCaptionType.CPDF_CAPTION_LENGTH) == CPDFCaptionType.CPDF_CAPTION_LENGTH)
  274. // {
  275. // IsLength = true;
  276. // }
  277. // SettingPanel.ChangedCheckBoxIsChecked(IsArea, IsLength);
  278. // double inch = polygonMeasure.GetMeasurementResults(CPDFCaptionType.CPDF_CAPTION_AREA);
  279. // double currentInch = polygonMeasure.GetMeasurementResults(CPDFCaptionType.CPDF_CAPTION_LENGTH);
  280. // MeasureEventArgs measureEvent = new MeasureEventArgs();
  281. // measureEvent.RulerTranslateUnit = measureInfo.RulerTranslateUnit;
  282. // measureEvent.RulerTranslate = measureInfo.RulerTranslate;
  283. // measureEvent.RulerBase = measureInfo.RulerBase;
  284. // measureEvent.RulerBaseUnit = measureInfo.RulerBaseUnit;
  285. // measureEvent.Precision = GetMeasureShowPrecision(measureInfo.Precision);
  286. // measureEvent.Type = CPDFMeasureType.CPDF_AREA_MEASURE;
  287. // NumberFormatInfo formatInfo = new NumberFormatInfo();
  288. // formatInfo.NumberDecimalDigits = Math.Abs(measureInfo.Precision).ToString().Length - 1;
  289. // measureEvent.Distance = currentInch.ToString("N", formatInfo) + " " + measureInfo.RulerTranslateUnit;
  290. // measureEvent.Area = inch.ToString("N", formatInfo) + " sq " + measureInfo.RulerTranslateUnit;
  291. // MeasureSetting.InvokeMeasureChangeEvent(this, measureEvent);
  292. // if (annotArgs != null)
  293. // {
  294. // SettingPanel.UpdateArgsList = new List<AnnotHandlerEventArgs> { annotArgs };
  295. // }
  296. // }
  297. // }
  298. // catch (Exception e)
  299. // {
  300. // }
  301. //}
  302. private double GetMeasureRatio(string baseUnit)
  303. {
  304. if (baseUnit == CPDFMeasure.CPDF_PT)
  305. {
  306. return 1 / 72;
  307. }
  308. if (baseUnit == CPDFMeasure.CPDF_IN)
  309. {
  310. return 1;
  311. }
  312. if (baseUnit == CPDFMeasure.CPDF_MM)
  313. {
  314. return 1 / 25.4;
  315. }
  316. if (baseUnit == CPDFMeasure.CPDF_CM)
  317. {
  318. return 1 / 2.54;
  319. }
  320. if (baseUnit == CPDFMeasure.CPDF_M)
  321. {
  322. return 1 / 0.0254;
  323. }
  324. if (baseUnit == CPDFMeasure.CPDFO_KM)
  325. {
  326. return 1 / 0.0254 / 1000;
  327. }
  328. if (baseUnit == CPDFMeasure.CPDF_FT)
  329. {
  330. return 12;
  331. }
  332. if (baseUnit == CPDFMeasure.CPDF_YD)
  333. {
  334. return 36;
  335. }
  336. if (baseUnit == CPDFMeasure.CPDF_MI)
  337. {
  338. return 63360;
  339. }
  340. return 0;
  341. }
  342. private double GetMeasureShowPrecision(int precision)
  343. {
  344. if (precision == CPDFMeasure.PRECISION_VALUE_ZERO)
  345. {
  346. return 1;
  347. }
  348. if (CPDFMeasure.PRECISION_VALUE_ONE == precision)
  349. {
  350. return 0.1;
  351. }
  352. if (CPDFMeasure.PRECISION_VALUE_TWO == precision)
  353. {
  354. return 0.01;
  355. }
  356. if (CPDFMeasure.PRECISION_VALUE_THREE == precision)
  357. {
  358. return 0.001;
  359. }
  360. if (CPDFMeasure.PRECISION_VALUE_FOUR == precision)
  361. {
  362. return 0.0001;
  363. }
  364. return 0;
  365. }
  366. public void SetSettingsControl(CPDFDisplaySettingsControl cPDFDisplaySettingsControl)
  367. {
  368. displaySettingsControl = cPDFDisplaySettingsControl;
  369. }
  370. public void ClearAllToolState()
  371. {
  372. PDFMeasureTool.ClearAllToolState();
  373. }
  374. public void ClearViewerControl()
  375. {
  376. PDFGrid.Child = null;
  377. BotaContainer.Child = null;
  378. PropertyContainer.Child = null;
  379. displaySettingsControl = null;
  380. }
  381. private void PanelState_PropertyChanged(object sender, PropertyChangedEventArgs e)
  382. {
  383. if (e.PropertyName == nameof(PanelState.IsLeftPanelExpand))
  384. {
  385. ExpandLeftPanel(panelState.IsLeftPanelExpand);
  386. }
  387. else if (e.PropertyName == nameof(PanelState.RightPanel))
  388. {
  389. if (panelState.RightPanel == PanelState.RightPanelState.PropertyPanel)
  390. {
  391. ExpandRightPropertyPanel(measurePropertyControl, Visibility.Visible);
  392. }
  393. else if (panelState.RightPanel == PanelState.RightPanelState.ViewSettings)
  394. {
  395. ExpandRightPropertyPanel(displaySettingsControl, Visibility.Visible);
  396. }
  397. else
  398. {
  399. ExpandRightPropertyPanel(null, Visibility.Collapsed);
  400. }
  401. }
  402. }
  403. #endregion
  404. #region Expand and collapse Panel
  405. public void ExpandRightPropertyPanel(Visibility visible)
  406. {
  407. ExpandRightPropertyPanel(measurePropertyControl, visible);
  408. }
  409. public void ExpandNullRightPropertyPanel(Visibility visible)
  410. {
  411. ExpandRightPropertyPanel(null, visible);
  412. }
  413. public void ExpandViewSettings(Visibility visible)
  414. {
  415. SetViewSettings(displaySettingsControl, visible);
  416. }
  417. private void ExpandRightPropertyPanel(UIElement propertytPanel, Visibility visible)
  418. {
  419. PropertyContainer.Width = 260;
  420. PropertyContainer.Child = propertytPanel;
  421. PropertyContainer.Visibility = visible;
  422. }
  423. private void SetViewSettings(CPDFDisplaySettingsControl displaySettingsControl, Visibility visibility)
  424. {
  425. PropertyContainer.Child = displaySettingsControl;
  426. PropertyContainer.Visibility = visibility;
  427. }
  428. public void ExpandLeftPanel(bool isExpand)
  429. {
  430. BotaContainer.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
  431. Splitter.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
  432. if (isExpand)
  433. {
  434. BodyGrid.ColumnDefinitions[0].Width = new GridLength(320);
  435. BodyGrid.ColumnDefinitions[1].Width = new GridLength(15);
  436. }
  437. else
  438. {
  439. BodyGrid.ColumnDefinitions[0].Width = new GridLength(0);
  440. BodyGrid.ColumnDefinitions[1].Width = new GridLength(0);
  441. }
  442. }
  443. #endregion
  444. private void UserControl_Loaded(object sender, RoutedEventArgs e)
  445. {
  446. }
  447. private void MeasureInfoPanel_SettingClick(object sender, EventArgs e)
  448. {
  449. if (sender is MeasureInfoPanel)
  450. {
  451. switch ((sender as MeasureInfoPanel).MeasureType)
  452. {
  453. case CPDFMeasureType.CPDF_DISTANCE_MEASURE:
  454. case CPDFMeasureType.CPDF_PERIMETER_MEASURE:
  455. SettingPanel.ShowAreaAndLength(Visibility.Collapsed);
  456. break;
  457. case CPDFMeasureType.CPDF_AREA_MEASURE:
  458. SettingPanel.ShowAreaAndLength(Visibility.Visible);
  459. break;
  460. default:
  461. break;
  462. }
  463. }
  464. SettingPanel.ReturnToInfoPanel = true;
  465. SetInfoPanelVisble(false, true);
  466. SettingPanel.BindMeasureSetting();
  467. }
  468. private void SettingPanel_CancelEvent(object sender, EventArgs e)
  469. {
  470. SetInfoPanelVisble(SettingPanel.ReturnToInfoPanel, false);
  471. }
  472. private void SettingPanel_DoneEvent(object sender, EventArgs e)
  473. {
  474. SetInfoPanelVisble(SettingPanel.ReturnToInfoPanel, false);
  475. }
  476. public void SetInfoPanelVisble(bool measureInfo, bool measureSetting)
  477. {
  478. if (measureInfo)
  479. {
  480. InfoPanel.ClearMeasureInfo();
  481. }
  482. InfoPanel.Visibility = measureInfo ? Visibility.Visible : Visibility.Collapsed;
  483. SettingPanel.Visibility = measureSetting ? Visibility.Visible : Visibility.Collapsed;
  484. }
  485. public void SetMeasureInfoType(CPDFMeasureType measureType)
  486. {
  487. InfoPanel?.SetMeasureType(measureType);
  488. }
  489. public void SetMeasureScale(CPDFMeasureType measureType, string scale)
  490. {
  491. InfoPanel?.SetMeasureScale(measureType,scale);
  492. }
  493. }
  494. }