MeasureControl.xaml.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563
  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. // measurePropertyControl.SetPropertyForMeasureCreate(LineArgs, e);
  249. SetInfoPanelVisble(true, false);
  250. }
  251. private void SetMeasureInfoPanel(CPDFAnnotation annot,AnnotParam param = null)
  252. {
  253. if (annot == null)
  254. {
  255. return;
  256. }
  257. try
  258. {
  259. if (annot.Type == C_ANNOTATION_TYPE.C_ANNOTATION_LINE)
  260. {
  261. CPDFLineAnnotation lineAnnot = annot as CPDFLineAnnotation;
  262. if (lineAnnot.IsMeasured() && lineAnnot.Points != null && lineAnnot.Points.Count() == 2)
  263. {
  264. InfoPanel.SetMeasureInfo(lineAnnot);
  265. SetMeasureInfoType(CPDFMeasureType.CPDF_DISTANCE_MEASURE);
  266. }
  267. }
  268. if (annot.Type == C_ANNOTATION_TYPE.C_ANNOTATION_POLYLINE)
  269. {
  270. CPDFPolylineAnnotation polylineAnnot = annot as CPDFPolylineAnnotation;
  271. if (polylineAnnot.IsMeasured() && polylineAnnot.Points != null && polylineAnnot.Points.Count() >= 2)
  272. {
  273. InfoPanel.SetMeasureInfo(polylineAnnot);
  274. SetMeasureInfoType(CPDFMeasureType.CPDF_PERIMETER_MEASURE);
  275. }
  276. }
  277. if(annot.Type== C_ANNOTATION_TYPE.C_ANNOTATION_POLYGON)
  278. {
  279. CPDFPolygonAnnotation Annot = annot as CPDFPolygonAnnotation;
  280. CPDFAreaMeasure polygonMeasure = Annot.GetAreaMeasure();
  281. CPDFMeasureInfo measureInfo = polygonMeasure.MeasureInfo;
  282. CPDFCaptionType CaptionType = measureInfo.CaptionType;
  283. bool IsArea = false;
  284. bool IsLength = false;
  285. if ((CaptionType& CPDFCaptionType.CPDF_CAPTION_AREA)== CPDFCaptionType.CPDF_CAPTION_AREA)
  286. {
  287. IsArea = true;
  288. }
  289. if ((CaptionType & CPDFCaptionType.CPDF_CAPTION_LENGTH) == CPDFCaptionType.CPDF_CAPTION_LENGTH)
  290. {
  291. IsLength = true;
  292. }
  293. SettingPanel.ChangedCheckBoxIsChecked(IsArea, IsLength);
  294. InfoPanel.SetMeasureInfo(Annot);
  295. SetMeasureInfoType(CPDFMeasureType.CPDF_AREA_MEASURE);
  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. public void SetSettingsControl(CPDFDisplaySettingsControl cPDFDisplaySettingsControl)
  343. {
  344. displaySettingsControl = cPDFDisplaySettingsControl;
  345. }
  346. public void ClearAllToolState()
  347. {
  348. PDFMeasureTool.ClearAllToolState();
  349. InfoPanel.ClearMeasureInfo();
  350. }
  351. public void ClearViewerControl()
  352. {
  353. PDFGrid.Child = null;
  354. BotaContainer.Child = null;
  355. PropertyContainer.Child = null;
  356. displaySettingsControl = null;
  357. }
  358. public void UnloadEvent()
  359. {
  360. PdfViewControl.MouseLeftButtonDownHandler -= PDFToolManager_MouseLeftButtonDownHandler;
  361. PdfViewControl.MouseLeftButtonUpHandler -= PDFToolManager_MouseLeftButtonUpHandler;
  362. PdfViewControl.MouseMoveHandler -= PDFToolManager_MouseMoveHandler;
  363. panelState.PropertyChanged -= PanelState_PropertyChanged;
  364. }
  365. private void PanelState_PropertyChanged(object sender, PropertyChangedEventArgs e)
  366. {
  367. if (e.PropertyName == nameof(PanelState.IsLeftPanelExpand))
  368. {
  369. ExpandLeftPanel(panelState.IsLeftPanelExpand);
  370. }
  371. else if (e.PropertyName == nameof(PanelState.RightPanel))
  372. {
  373. if (panelState.RightPanel == PanelState.RightPanelState.PropertyPanel)
  374. {
  375. ExpandRightPropertyPanel(measurePropertyControl, Visibility.Visible);
  376. }
  377. else if (panelState.RightPanel == PanelState.RightPanelState.ViewSettings)
  378. {
  379. ExpandRightPropertyPanel(displaySettingsControl, Visibility.Visible);
  380. }
  381. else
  382. {
  383. ExpandRightPropertyPanel(null, Visibility.Collapsed);
  384. }
  385. }
  386. }
  387. #endregion
  388. #region Expand and collapse Panel
  389. public void ExpandRightPropertyPanel(Visibility visible)
  390. {
  391. ExpandRightPropertyPanel(measurePropertyControl, visible);
  392. }
  393. public void ExpandNullRightPropertyPanel(Visibility visible)
  394. {
  395. ExpandRightPropertyPanel(null, visible);
  396. }
  397. public void ExpandViewSettings(Visibility visible)
  398. {
  399. SetViewSettings(displaySettingsControl, visible);
  400. }
  401. private void ExpandRightPropertyPanel(UIElement propertytPanel, Visibility visible)
  402. {
  403. PropertyContainer.Width = 260;
  404. PropertyContainer.Child = propertytPanel;
  405. PropertyContainer.Visibility = visible;
  406. }
  407. private void SetViewSettings(CPDFDisplaySettingsControl displaySettingsControl, Visibility visibility)
  408. {
  409. PropertyContainer.Child = displaySettingsControl;
  410. PropertyContainer.Visibility = visibility;
  411. }
  412. public void ExpandLeftPanel(bool isExpand)
  413. {
  414. BotaContainer.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
  415. Splitter.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
  416. if (isExpand)
  417. {
  418. BodyGrid.ColumnDefinitions[0].Width = new GridLength(320);
  419. BodyGrid.ColumnDefinitions[1].Width = new GridLength(15);
  420. }
  421. else
  422. {
  423. BodyGrid.ColumnDefinitions[0].Width = new GridLength(0);
  424. BodyGrid.ColumnDefinitions[1].Width = new GridLength(0);
  425. }
  426. }
  427. #endregion
  428. private void UserControl_Loaded(object sender, RoutedEventArgs e)
  429. {
  430. }
  431. private void MeasureInfoPanel_SettingClick(object sender, EventArgs e)
  432. {
  433. if (sender is MeasureInfoPanel)
  434. {
  435. switch ((sender as MeasureInfoPanel).MeasureType)
  436. {
  437. case CPDFMeasureType.CPDF_DISTANCE_MEASURE:
  438. case CPDFMeasureType.CPDF_PERIMETER_MEASURE:
  439. SettingPanel.ShowAreaAndLength(Visibility.Collapsed);
  440. break;
  441. case CPDFMeasureType.CPDF_AREA_MEASURE:
  442. SettingPanel.ShowAreaAndLength(Visibility.Visible);
  443. break;
  444. default:
  445. break;
  446. }
  447. }
  448. SettingPanel.ReturnToInfoPanel = true;
  449. SetInfoPanelVisble(false, true);
  450. if(currentAnnot != null)
  451. {
  452. AnnotParam annotParam = ParamConverter.CPDFDataConverterToAnnotParam(
  453. PdfViewControl.GetCPDFViewer().GetDocument(), currentAnnot.Page.PageIndex, currentAnnot);
  454. SettingPanel.BindMeasureSetting(GetMeasureInfoFromParam(annotParam));
  455. }
  456. }
  457. private CPDFMeasureInfo GetMeasureInfoFromParam(AnnotParam param)
  458. {
  459. if(param is LineMeasureParam lineParam)
  460. {
  461. return lineParam.measureInfo;
  462. }
  463. if (param is PolyLineMeasureParam polyLineParam)
  464. {
  465. return polyLineParam.measureInfo;
  466. }
  467. if (param is PolygonMeasureParam polygonParam)
  468. {
  469. return polygonParam.measureInfo;
  470. }
  471. return null;
  472. }
  473. private void SettingPanel_CancelEvent(object sender, EventArgs e)
  474. {
  475. SetInfoPanelVisble(SettingPanel.ReturnToInfoPanel, false);
  476. }
  477. private void SettingPanel_DoneEvent(object sender, EventArgs e)
  478. {
  479. SetInfoPanelVisble(SettingPanel.ReturnToInfoPanel, false);
  480. SettingPanel.SaveMeasureSetting(currentAnnot);
  481. InfoPanel.SetMeasureInfo(currentAnnot);
  482. }
  483. public void SetInfoPanelVisble(bool measureInfo, bool measureSetting)
  484. {
  485. InfoPanel.Visibility = measureInfo ? Visibility.Visible : Visibility.Collapsed;
  486. SettingPanel.Visibility = measureSetting ? Visibility.Visible : Visibility.Collapsed;
  487. }
  488. public void SetMeasureInfoType(CPDFMeasureType measureType)
  489. {
  490. InfoPanel?.SetMeasureType(measureType);
  491. }
  492. public void SetBOTAContainer(CPDFBOTABarControl botaControl)
  493. {
  494. this.BotaContainer.Child = botaControl;
  495. }
  496. public void SetMeasureScale(CPDFMeasureType measureType, string scale)
  497. {
  498. InfoPanel?.SetMeasureScale(measureType,scale);
  499. }
  500. }
  501. }