MeasureControl.xaml.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  1. using ComPDFKit.Measure;
  2. using ComPDFKit.PDFAnnotation;
  3. using ComPDFKit.Tool;
  4. using ComPDFKit.Controls.Helper;
  5. using ComPDFKit.Controls.PDFControl;
  6. using ComPDFKitViewer;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.ComponentModel;
  10. using System.Diagnostics;
  11. using System.Drawing;
  12. using System.IO;
  13. using System.Linq;
  14. using System.Windows;
  15. using System.Windows.Controls;
  16. using System.Windows.Input;
  17. using System.Windows.Media.Imaging;
  18. using ComPDFKit.PDFPage;
  19. using ComPDFKit.Tool.Help;
  20. using ComPDFKitViewer.BaseObject;
  21. using Path = System.IO.Path;
  22. using ComPDFKit.Tool.DrawTool;
  23. namespace ComPDFKit.Controls.Measure
  24. {
  25. public partial class MeasureControl : UserControl
  26. {
  27. public MeasurePropertyControl measurePropertyControl = new MeasurePropertyControl();
  28. private CPDFDisplaySettingsControl displaySettingsControl;
  29. private PDFViewControl PdfViewControl = new PDFViewControl();
  30. private PanelState panelState = PanelState.GetInstance();
  31. private CPDFAnnotation currentAnnot = null;
  32. public event EventHandler ExpandEvent;
  33. public event EventHandler OnAnnotEditHandler;
  34. public MeasureControl()
  35. {
  36. InitializeComponent();
  37. }
  38. #region Init PDFViewer
  39. public void InitWithPDFViewer(PDFViewControl pdfViewControl)
  40. {
  41. PdfViewControl = pdfViewControl;
  42. //PdfViewControl.PDFView = pdfViewer;
  43. PDFMeasureTool.InitWithPDFViewer(pdfViewControl, measurePropertyControl, this);
  44. FloatPageTool.InitWithPDFViewer(pdfViewControl);
  45. PDFGrid.Child = PdfViewControl;
  46. panelState.PropertyChanged -= PanelState_PropertyChanged;
  47. PdfViewControl.MouseLeftButtonDownHandler -= PDFToolManager_MouseLeftButtonDownHandler;
  48. PdfViewControl.MouseLeftButtonUpHandler -= PDFToolManager_MouseLeftButtonUpHandler;
  49. PdfViewControl.MouseMoveHandler -= PDFToolManager_MouseMoveHandler;
  50. pdfViewControl.MouseRightButtonDownHandler -= PDFToolManager_MouseRightButtonDownHandler;
  51. PdfViewControl.PDFViewTool.MeasureChanged -= MeasureSetting_MeasureChanged;
  52. PdfViewControl.PDFViewTool.MeasureChanged += MeasureSetting_MeasureChanged;
  53. PdfViewControl.MouseLeftButtonDownHandler += PDFToolManager_MouseLeftButtonDownHandler;
  54. PdfViewControl.MouseLeftButtonUpHandler += PDFToolManager_MouseLeftButtonUpHandler;
  55. PdfViewControl.MouseMoveHandler += PDFToolManager_MouseMoveHandler;
  56. pdfViewControl.MouseRightButtonDownHandler += PDFToolManager_MouseRightButtonDownHandler;
  57. panelState.PropertyChanged += PanelState_PropertyChanged;
  58. SetInfoPanelVisble(false, false);
  59. SettingPanel.PdfViewControl= pdfViewControl;
  60. }
  61. private void MeasureSetting_MeasureChanged(object sender, MeasureEventArgs e)
  62. {
  63. InfoPanel.SetMeasureType(e.Type);
  64. InfoPanel.SetMeasureInfo(e);
  65. }
  66. private void PDFToolManager_MouseRightButtonDownHandler(object sender, MouseEventObject e)
  67. {
  68. ContextMenu ContextMenu = PdfViewControl.GetRightMenu();
  69. if (ContextMenu == null)
  70. {
  71. ContextMenu = new ContextMenu();
  72. }
  73. switch (e.hitTestType)
  74. {
  75. case MouseHitTestType.Annot:
  76. case MouseHitTestType.SelectRect:
  77. CreateAnnotContextMenu(sender, ref ContextMenu, e.annotType);
  78. break;
  79. case MouseHitTestType.Text:
  80. CreateSelectTextContextMenu(sender, ref ContextMenu);
  81. break;
  82. case MouseHitTestType.ImageSelect:
  83. CreateSelectImageContextMenu(sender, ref ContextMenu);
  84. break;
  85. default:
  86. ContextMenu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Paste"), Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
  87. PdfViewControl.CreateViewerMenu(sender, ref ContextMenu);
  88. break;
  89. }
  90. PdfViewControl.SetRightMenu(ContextMenu);
  91. }
  92. private void CreateAnnotContextMenu(object sender, ref ContextMenu menu, C_ANNOTATION_TYPE annotType)
  93. {
  94. switch (annotType)
  95. {
  96. case C_ANNOTATION_TYPE.C_ANNOTATION_LINE:
  97. case C_ANNOTATION_TYPE.C_ANNOTATION_POLYLINE:
  98. case C_ANNOTATION_TYPE.C_ANNOTATION_POLYGON:
  99. CreateMeasureContextMenu(sender, ref menu);
  100. break;
  101. case C_ANNOTATION_TYPE.C_ANNOTATION_WIDGET:
  102. break;
  103. case C_ANNOTATION_TYPE.C_ANNOTATION_SOUND:
  104. case C_ANNOTATION_TYPE.C_ANNOTATION_MOVIE:
  105. case C_ANNOTATION_TYPE.C_ANNOTATION_RICHMEDIA:
  106. menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Delete"), Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
  107. menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Play"), Command = MediaCommands.Play, CommandTarget = (UIElement)sender, CommandParameter = (sender as CPDFViewerTool).GetCacheHitTestAnnot() });
  108. menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Cut"), Command = ApplicationCommands.Cut, CommandTarget = (UIElement)sender });
  109. menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Paste"), Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
  110. break;
  111. default:
  112. menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Delete"), Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
  113. menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Copy"), Command = ApplicationCommands.Copy, CommandTarget = (UIElement)sender });
  114. menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Cut"), Command = ApplicationCommands.Cut, CommandTarget = (UIElement)sender });
  115. menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Paste"), Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
  116. break;
  117. }
  118. }
  119. private void CreateMeasureContextMenu(object sender, ref ContextMenu menu)
  120. {
  121. menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Delete"), Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
  122. MenuItem menuItem = new MenuItem();
  123. menuItem.Header = "Measurement Settings";
  124. menuItem.Click += (item, param) =>
  125. {
  126. if (currentAnnot is CPDFLineAnnotation annotation)
  127. {
  128. SettingPanel.BindMeasureSetting(annotation.GetDistanceMeasure().MeasureInfo);
  129. }
  130. SetInfoPanelVisble(false, true);
  131. };
  132. menu.Items.Add(menuItem);
  133. MenuItem propertyItem = new MenuItem();
  134. propertyItem.Header = "Properties";
  135. propertyItem.Click += (item, param) =>
  136. {
  137. panelState.RightPanel = PanelState.RightPanelState.PropertyPanel;
  138. };
  139. menu.Items.Add(propertyItem);
  140. }
  141. private void CreateSelectTextContextMenu(object sender, ref ContextMenu menu)
  142. {
  143. menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Copy"), Command = ApplicationCommands.Copy, CommandTarget = (UIElement)sender });
  144. }
  145. private void CreateSelectImageContextMenu(object sender, ref ContextMenu menu)
  146. {
  147. if (menu == null)
  148. {
  149. menu = new ContextMenu();
  150. }
  151. MenuItem copyImage = new MenuItem();
  152. copyImage.Header = "Copy Image";
  153. copyImage.Click += CopyImage_Click;
  154. menu.Items.Add(copyImage);
  155. MenuItem extractImage = new MenuItem();
  156. extractImage.Header = "Extract Image";
  157. extractImage.Click += ExtractImage_Click;
  158. menu.Items.Add(extractImage);
  159. }
  160. private void ExtractImage_Click(object sender, RoutedEventArgs e)
  161. {
  162. System.Windows.Forms.FolderBrowserDialog folderDialog = new System.Windows.Forms.FolderBrowserDialog();
  163. if (folderDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  164. {
  165. PageImageItem image = null;
  166. Dictionary<int, List<PageImageItem>> pageImageDict = PdfViewControl.FocusPDFViewTool.GetSelectImageItems();
  167. if (pageImageDict != null && pageImageDict.Count > 0)
  168. {
  169. foreach (int pageIndex in pageImageDict.Keys)
  170. {
  171. List<PageImageItem> imageItemList = pageImageDict[pageIndex];
  172. image = imageItemList[0];
  173. break;
  174. }
  175. }
  176. if (image == null)
  177. {
  178. return;
  179. }
  180. CPDFPage page = PdfViewControl.PDFToolManager.GetDocument().PageAtIndex(image.PageIndex);
  181. string savePath = System.IO.Path.Combine(folderDialog.SelectedPath, Guid.NewGuid() + ".jpg");
  182. string tempPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), Guid.NewGuid() + ".jpg");
  183. page.GetImgSelection().GetImgBitmap(image.ImageIndex, tempPath);
  184. Bitmap bitmap = new Bitmap(tempPath);
  185. bitmap.Save(savePath, System.Drawing.Imaging.ImageFormat.Jpeg);
  186. Process.Start("explorer", "/select,\"" + savePath + "\"");
  187. }
  188. }
  189. private void CopyImage_Click(object sender, RoutedEventArgs e)
  190. {
  191. PageImageItem image = null;
  192. Dictionary<int, List<PageImageItem>> pageImageDict = PdfViewControl.FocusPDFViewTool.GetSelectImageItems();
  193. if (pageImageDict != null && pageImageDict.Count > 0)
  194. {
  195. foreach (int pageIndex in pageImageDict.Keys)
  196. {
  197. List<PageImageItem> imageItemList = pageImageDict[pageIndex];
  198. image = imageItemList[0];
  199. break;
  200. }
  201. }
  202. if (image == null)
  203. {
  204. return;
  205. }
  206. CPDFPage page = PdfViewControl.PDFToolManager.GetDocument().PageAtIndex(image.PageIndex);
  207. string tempPath = System.IO.Path.Combine(Path.GetTempPath(), Guid.NewGuid() + ".jpg");
  208. page.GetImgSelection().GetImgBitmap(image.ImageIndex, tempPath);
  209. Bitmap bitmap = new Bitmap(tempPath);
  210. BitmapImage imageData;
  211. using (MemoryStream ms = new MemoryStream())
  212. {
  213. bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
  214. imageData = new BitmapImage();
  215. imageData.BeginInit();
  216. imageData.StreamSource = ms;
  217. imageData.CacheOption = BitmapCacheOption.OnLoad;
  218. imageData.EndInit();
  219. imageData.Freeze();
  220. Clipboard.SetImage(imageData);
  221. bitmap.Dispose();
  222. File.Delete(tempPath);
  223. }
  224. }
  225. private void PDFToolManager_MouseMoveHandler(object sender, MouseEventObject e)
  226. {
  227. }
  228. private void PDFToolManager_MouseLeftButtonUpHandler(object sender, MouseEventObject e)
  229. {
  230. if (e.IsCreate)
  231. {
  232. OnAnnotEditHandler?.Invoke(this, EventArgs.Empty);
  233. }
  234. }
  235. private void PDFToolManager_MouseLeftButtonDownHandler(object sender, MouseEventObject e)
  236. {
  237. BaseAnnot baseAnnot = PdfViewControl.GetCacheHitTestAnnot();
  238. if (baseAnnot != null)
  239. {
  240. AnnotData annotData = baseAnnot.GetAnnotData();
  241. AnnotParam annotParam = ParamConverter.CPDFDataConverterToAnnotParam(
  242. PdfViewControl.GetCPDFViewer().GetDocument(), annotData.PageIndex, annotData.Annot);
  243. measurePropertyControl.SetPropertyForMeasureCreate(annotParam, annotData.Annot, PdfViewControl);
  244. SetMeasureInfoPanel(annotData.Annot, annotParam);
  245. currentAnnot = annotData.Annot;
  246. }
  247. panelState.RightPanel = PanelState.RightPanelState.PropertyPanel;
  248. SetInfoPanelVisble(true, false);
  249. }
  250. private void SetMeasureInfoPanel(CPDFAnnotation annot,AnnotParam param = null)
  251. {
  252. if (annot == null || !annot.IsValid())
  253. {
  254. return;
  255. }
  256. try
  257. {
  258. if (annot.Type == C_ANNOTATION_TYPE.C_ANNOTATION_LINE)
  259. {
  260. CPDFLineAnnotation lineAnnot = annot as CPDFLineAnnotation;
  261. if (lineAnnot.IsMeasured() && lineAnnot.Points != null && lineAnnot.Points.Count() == 2)
  262. {
  263. InfoPanel.SetMeasureInfo(lineAnnot);
  264. SetMeasureInfoType(CPDFMeasureType.CPDF_DISTANCE_MEASURE);
  265. }
  266. }
  267. if (annot.Type == C_ANNOTATION_TYPE.C_ANNOTATION_POLYLINE)
  268. {
  269. CPDFPolylineAnnotation polylineAnnot = annot as CPDFPolylineAnnotation;
  270. if (polylineAnnot.IsMeasured() && polylineAnnot.Points != null && polylineAnnot.Points.Count() >= 2)
  271. {
  272. InfoPanel.SetMeasureInfo(polylineAnnot);
  273. SetMeasureInfoType(CPDFMeasureType.CPDF_PERIMETER_MEASURE);
  274. }
  275. }
  276. if(annot.Type== C_ANNOTATION_TYPE.C_ANNOTATION_POLYGON)
  277. {
  278. CPDFPolygonAnnotation Annot = annot as CPDFPolygonAnnotation;
  279. CPDFAreaMeasure polygonMeasure = Annot.GetAreaMeasure();
  280. CPDFMeasureInfo measureInfo = polygonMeasure.MeasureInfo;
  281. CPDFCaptionType CaptionType = measureInfo.CaptionType;
  282. bool IsArea = false;
  283. bool IsLength = false;
  284. if ((CaptionType& CPDFCaptionType.CPDF_CAPTION_AREA)== CPDFCaptionType.CPDF_CAPTION_AREA)
  285. {
  286. IsArea = true;
  287. }
  288. if ((CaptionType & CPDFCaptionType.CPDF_CAPTION_LENGTH) == CPDFCaptionType.CPDF_CAPTION_LENGTH)
  289. {
  290. IsLength = true;
  291. }
  292. SettingPanel.ChangedCheckBoxIsChecked(IsArea, IsLength);
  293. InfoPanel.SetMeasureInfo(Annot);
  294. SetMeasureInfoType(CPDFMeasureType.CPDF_AREA_MEASURE);
  295. }
  296. }
  297. catch (Exception e)
  298. {
  299. }
  300. }
  301. private double GetMeasureRatio(string baseUnit)
  302. {
  303. if (baseUnit == CPDFMeasure.CPDF_PT)
  304. {
  305. return 1 / 72;
  306. }
  307. if (baseUnit == CPDFMeasure.CPDF_IN)
  308. {
  309. return 1;
  310. }
  311. if (baseUnit == CPDFMeasure.CPDF_MM)
  312. {
  313. return 1 / 25.4;
  314. }
  315. if (baseUnit == CPDFMeasure.CPDF_CM)
  316. {
  317. return 1 / 2.54;
  318. }
  319. if (baseUnit == CPDFMeasure.CPDF_M)
  320. {
  321. return 1 / 0.0254;
  322. }
  323. if (baseUnit == CPDFMeasure.CPDFO_KM)
  324. {
  325. return 1 / 0.0254 / 1000;
  326. }
  327. if (baseUnit == CPDFMeasure.CPDF_FT)
  328. {
  329. return 12;
  330. }
  331. if (baseUnit == CPDFMeasure.CPDF_YD)
  332. {
  333. return 36;
  334. }
  335. if (baseUnit == CPDFMeasure.CPDF_MI)
  336. {
  337. return 63360;
  338. }
  339. return 0;
  340. }
  341. public void SetSettingsControl(CPDFDisplaySettingsControl cPDFDisplaySettingsControl)
  342. {
  343. displaySettingsControl = cPDFDisplaySettingsControl;
  344. }
  345. public void ClearAllToolState()
  346. {
  347. PDFMeasureTool.ClearAllToolState();
  348. InfoPanel.ClearMeasureInfo();
  349. }
  350. public void ClearViewerControl()
  351. {
  352. PDFGrid.Child = null;
  353. BotaContainer.Child = null;
  354. PropertyContainer.Child = null;
  355. displaySettingsControl = null;
  356. }
  357. public void UnloadEvent()
  358. {
  359. PdfViewControl.MouseLeftButtonDownHandler -= PDFToolManager_MouseLeftButtonDownHandler;
  360. PdfViewControl.MouseLeftButtonUpHandler -= PDFToolManager_MouseLeftButtonUpHandler;
  361. PdfViewControl.MouseMoveHandler -= PDFToolManager_MouseMoveHandler;
  362. panelState.PropertyChanged -= PanelState_PropertyChanged;
  363. }
  364. private void PanelState_PropertyChanged(object sender, PropertyChangedEventArgs e)
  365. {
  366. if (e.PropertyName == nameof(PanelState.IsLeftPanelExpand))
  367. {
  368. ExpandLeftPanel(panelState.IsLeftPanelExpand);
  369. }
  370. else if (e.PropertyName == nameof(PanelState.RightPanel))
  371. {
  372. if (panelState.RightPanel == PanelState.RightPanelState.PropertyPanel)
  373. {
  374. ExpandRightPropertyPanel(measurePropertyControl, Visibility.Visible);
  375. }
  376. else if (panelState.RightPanel == PanelState.RightPanelState.ViewSettings)
  377. {
  378. ExpandRightPropertyPanel(displaySettingsControl, Visibility.Visible);
  379. }
  380. else
  381. {
  382. ExpandRightPropertyPanel(null, Visibility.Collapsed);
  383. }
  384. }
  385. }
  386. #endregion
  387. #region Expand and collapse Panel
  388. public void ExpandRightPropertyPanel(Visibility visible)
  389. {
  390. ExpandRightPropertyPanel(measurePropertyControl, visible);
  391. }
  392. public void ExpandNullRightPropertyPanel(Visibility visible)
  393. {
  394. ExpandRightPropertyPanel(null, visible);
  395. }
  396. public void ExpandViewSettings(Visibility visible)
  397. {
  398. SetViewSettings(displaySettingsControl, visible);
  399. }
  400. private void ExpandRightPropertyPanel(UIElement propertytPanel, Visibility visible)
  401. {
  402. PropertyContainer.Width = 260;
  403. PropertyContainer.Child = propertytPanel;
  404. PropertyContainer.Visibility = visible;
  405. }
  406. private void SetViewSettings(CPDFDisplaySettingsControl displaySettingsControl, Visibility visibility)
  407. {
  408. PropertyContainer.Child = displaySettingsControl;
  409. PropertyContainer.Visibility = visibility;
  410. }
  411. public void ExpandLeftPanel(bool isExpand)
  412. {
  413. BotaContainer.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
  414. Splitter.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
  415. if (isExpand)
  416. {
  417. BodyGrid.ColumnDefinitions[0].Width = new GridLength(320);
  418. BodyGrid.ColumnDefinitions[1].Width = new GridLength(15);
  419. }
  420. else
  421. {
  422. BodyGrid.ColumnDefinitions[0].Width = new GridLength(0);
  423. BodyGrid.ColumnDefinitions[1].Width = new GridLength(0);
  424. }
  425. }
  426. #endregion
  427. private void UserControl_Loaded(object sender, RoutedEventArgs e)
  428. {
  429. }
  430. private void MeasureInfoPanel_SettingClick(object sender, EventArgs e)
  431. {
  432. if (sender is MeasureInfoPanel)
  433. {
  434. switch ((sender as MeasureInfoPanel).MeasureType)
  435. {
  436. case CPDFMeasureType.CPDF_DISTANCE_MEASURE:
  437. case CPDFMeasureType.CPDF_PERIMETER_MEASURE:
  438. SettingPanel.ShowAreaAndLength(Visibility.Collapsed);
  439. break;
  440. case CPDFMeasureType.CPDF_AREA_MEASURE:
  441. SettingPanel.ShowAreaAndLength(Visibility.Visible);
  442. break;
  443. default:
  444. break;
  445. }
  446. }
  447. SettingPanel.ReturnToInfoPanel = true;
  448. SetInfoPanelVisble(false, true);
  449. if(currentAnnot != null)
  450. {
  451. AnnotParam annotParam = ParamConverter.CPDFDataConverterToAnnotParam(
  452. PdfViewControl.GetCPDFViewer().GetDocument(), currentAnnot.Page.PageIndex, currentAnnot);
  453. SettingPanel.BindMeasureSetting(GetMeasureInfoFromParam(annotParam));
  454. }
  455. }
  456. private CPDFMeasureInfo GetMeasureInfoFromParam(AnnotParam param)
  457. {
  458. if(param is LineMeasureParam lineParam)
  459. {
  460. return lineParam.measureInfo;
  461. }
  462. if (param is PolyLineMeasureParam polyLineParam)
  463. {
  464. return polyLineParam.measureInfo;
  465. }
  466. if (param is PolygonMeasureParam polygonParam)
  467. {
  468. return polygonParam.measureInfo;
  469. }
  470. return null;
  471. }
  472. private void SettingPanel_CancelEvent(object sender, EventArgs e)
  473. {
  474. SetInfoPanelVisble(SettingPanel.ReturnToInfoPanel, false);
  475. }
  476. private void SettingPanel_DoneEvent(object sender, EventArgs e)
  477. {
  478. SetInfoPanelVisble(SettingPanel.ReturnToInfoPanel, false);
  479. SettingPanel.SaveMeasureSetting(currentAnnot);
  480. InfoPanel.SetMeasureInfo(currentAnnot);
  481. }
  482. public void SetInfoPanelVisble(bool measureInfo, bool measureSetting)
  483. {
  484. InfoPanel.Visibility = measureInfo ? Visibility.Visible : Visibility.Collapsed;
  485. SettingPanel.Visibility = measureSetting ? Visibility.Visible : Visibility.Collapsed;
  486. }
  487. public void SetMeasureInfoType(CPDFMeasureType measureType)
  488. {
  489. InfoPanel?.SetMeasureType(measureType);
  490. }
  491. public void SetBOTAContainer(CPDFBOTABarControl botaControl)
  492. {
  493. this.BotaContainer.Child = botaControl;
  494. }
  495. public void SetMeasureScale(CPDFMeasureType measureType, string scale)
  496. {
  497. InfoPanel?.SetMeasureScale(measureType,scale);
  498. }
  499. }
  500. }