MeasureControl.xaml.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  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. measurePropertyControl.InitWithPDFViewer(pdfViewControl);
  44. PDFMeasureTool.InitWithPDFViewer(pdfViewControl, measurePropertyControl, this);
  45. FloatPageTool.InitWithPDFViewer(pdfViewControl);
  46. PDFGrid.Child = PdfViewControl;
  47. panelState.PropertyChanged -= PanelState_PropertyChanged;
  48. PdfViewControl.MouseLeftButtonDownHandler -= PDFToolManager_MouseLeftButtonDownHandler;
  49. PdfViewControl.MouseLeftButtonUpHandler -= PDFToolManager_MouseLeftButtonUpHandler;
  50. PdfViewControl.MouseMoveHandler -= PDFToolManager_MouseMoveHandler;
  51. pdfViewControl.MouseRightButtonDownHandler -= PDFToolManager_MouseRightButtonDownHandler;
  52. PdfViewControl.PDFViewTool.MeasureChanged -= MeasureSetting_MeasureChanged;
  53. PdfViewControl.PDFViewTool.MeasureChanged += MeasureSetting_MeasureChanged;
  54. PdfViewControl.MouseLeftButtonDownHandler += PDFToolManager_MouseLeftButtonDownHandler;
  55. PdfViewControl.MouseLeftButtonUpHandler += PDFToolManager_MouseLeftButtonUpHandler;
  56. PdfViewControl.MouseMoveHandler += PDFToolManager_MouseMoveHandler;
  57. pdfViewControl.MouseRightButtonDownHandler += PDFToolManager_MouseRightButtonDownHandler;
  58. panelState.PropertyChanged += PanelState_PropertyChanged;
  59. SetInfoPanelVisble(false, false);
  60. SettingPanel.PdfViewControl = pdfViewControl;
  61. }
  62. private void MeasureSetting_MeasureChanged(object sender, MeasureEventArgs e)
  63. {
  64. InfoPanel.SetMeasureType(e.Type);
  65. InfoPanel.SetMeasureInfo(e);
  66. }
  67. private void PDFToolManager_MouseRightButtonDownHandler(object sender, MouseEventObject e)
  68. {
  69. ContextMenu ContextMenu = PdfViewControl.GetRightMenu();
  70. if (ContextMenu == null)
  71. {
  72. ContextMenu = new ContextMenu();
  73. }
  74. switch (e.hitTestType)
  75. {
  76. case MouseHitTestType.Annot:
  77. case MouseHitTestType.SelectRect:
  78. CreateAnnotContextMenu(sender, ref ContextMenu, e.annotType);
  79. break;
  80. case MouseHitTestType.Text:
  81. CreateSelectTextContextMenu(sender, ref ContextMenu);
  82. break;
  83. case MouseHitTestType.ImageSelect:
  84. CreateSelectImageContextMenu(sender, ref ContextMenu);
  85. break;
  86. default:
  87. ContextMenu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Paste"), Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
  88. PdfViewControl.CreateViewerMenu(sender, ref ContextMenu);
  89. break;
  90. }
  91. PdfViewControl.SetRightMenu(ContextMenu);
  92. }
  93. private void CreateAnnotContextMenu(object sender, ref ContextMenu menu, C_ANNOTATION_TYPE annotType)
  94. {
  95. switch (annotType)
  96. {
  97. case C_ANNOTATION_TYPE.C_ANNOTATION_LINE:
  98. case C_ANNOTATION_TYPE.C_ANNOTATION_POLYLINE:
  99. case C_ANNOTATION_TYPE.C_ANNOTATION_POLYGON:
  100. CreateMeasureContextMenu(sender, ref menu);
  101. break;
  102. case C_ANNOTATION_TYPE.C_ANNOTATION_WIDGET:
  103. break;
  104. case C_ANNOTATION_TYPE.C_ANNOTATION_SOUND:
  105. case C_ANNOTATION_TYPE.C_ANNOTATION_MOVIE:
  106. case C_ANNOTATION_TYPE.C_ANNOTATION_RICHMEDIA:
  107. menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Delete"), Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
  108. menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Play"), Command = MediaCommands.Play, CommandTarget = (UIElement)sender, CommandParameter = (sender as CPDFViewerTool).GetCacheHitTestAnnot() });
  109. menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Cut"), Command = ApplicationCommands.Cut, CommandTarget = (UIElement)sender });
  110. menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Paste"), Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
  111. break;
  112. default:
  113. menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Delete"), Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
  114. menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Copy"), Command = ApplicationCommands.Copy, CommandTarget = (UIElement)sender });
  115. menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Cut"), Command = ApplicationCommands.Cut, CommandTarget = (UIElement)sender });
  116. menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Paste"), Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
  117. break;
  118. }
  119. }
  120. private void CreateMeasureContextMenu(object sender, ref ContextMenu menu)
  121. {
  122. menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Delete"), Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
  123. MenuItem menuItem = new MenuItem();
  124. menuItem.Header = "Measurement Settings";
  125. menuItem.Click += (item, param) =>
  126. {
  127. if (currentAnnot is CPDFLineAnnotation annotation)
  128. {
  129. SettingPanel.BindMeasureSetting(annotation.GetDistanceMeasure().MeasureInfo);
  130. }
  131. SetInfoPanelVisble(false, true);
  132. };
  133. menu.Items.Add(menuItem);
  134. MenuItem propertyItem = new MenuItem();
  135. propertyItem.Header = "Properties";
  136. propertyItem.Click += (item, param) =>
  137. {
  138. panelState.RightPanel = PanelState.RightPanelState.PropertyPanel;
  139. };
  140. menu.Items.Add(propertyItem);
  141. }
  142. private void CreateSelectTextContextMenu(object sender, ref ContextMenu menu)
  143. {
  144. menu.Items.Add(new MenuItem() { Header = LanguageHelper.CommonManager.GetString("Menu_Copy"), Command = ApplicationCommands.Copy, CommandTarget = (UIElement)sender });
  145. }
  146. private void CreateSelectImageContextMenu(object sender, ref ContextMenu menu)
  147. {
  148. if (menu == null)
  149. {
  150. menu = new ContextMenu();
  151. }
  152. MenuItem copyImage = new MenuItem();
  153. copyImage.Header = "Copy Image";
  154. copyImage.Click += CopyImage_Click;
  155. menu.Items.Add(copyImage);
  156. MenuItem extractImage = new MenuItem();
  157. extractImage.Header = "Extract Image";
  158. extractImage.Click += ExtractImage_Click;
  159. menu.Items.Add(extractImage);
  160. }
  161. private void ExtractImage_Click(object sender, RoutedEventArgs e)
  162. {
  163. System.Windows.Forms.FolderBrowserDialog folderDialog = new System.Windows.Forms.FolderBrowserDialog();
  164. if (folderDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  165. {
  166. PageImageItem image = null;
  167. Dictionary<int, List<PageImageItem>> pageImageDict = PdfViewControl.FocusPDFViewTool.GetSelectImageItems();
  168. if (pageImageDict != null && pageImageDict.Count > 0)
  169. {
  170. foreach (int pageIndex in pageImageDict.Keys)
  171. {
  172. List<PageImageItem> imageItemList = pageImageDict[pageIndex];
  173. image = imageItemList[0];
  174. break;
  175. }
  176. }
  177. if (image == null)
  178. {
  179. return;
  180. }
  181. CPDFPage page = PdfViewControl.PDFToolManager.GetDocument().PageAtIndex(image.PageIndex);
  182. string savePath = System.IO.Path.Combine(folderDialog.SelectedPath, Guid.NewGuid() + ".jpg");
  183. string tempPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), Guid.NewGuid() + ".jpg");
  184. page.GetImgSelection().GetImgBitmap(image.ImageIndex, tempPath);
  185. Bitmap bitmap = new Bitmap(tempPath);
  186. bitmap.Save(savePath, System.Drawing.Imaging.ImageFormat.Jpeg);
  187. Process.Start("explorer", "/select,\"" + savePath + "\"");
  188. }
  189. }
  190. private void CopyImage_Click(object sender, RoutedEventArgs e)
  191. {
  192. PageImageItem image = null;
  193. Dictionary<int, List<PageImageItem>> pageImageDict = PdfViewControl.FocusPDFViewTool.GetSelectImageItems();
  194. if (pageImageDict != null && pageImageDict.Count > 0)
  195. {
  196. foreach (int pageIndex in pageImageDict.Keys)
  197. {
  198. List<PageImageItem> imageItemList = pageImageDict[pageIndex];
  199. image = imageItemList[0];
  200. break;
  201. }
  202. }
  203. if (image == null)
  204. {
  205. return;
  206. }
  207. CPDFPage page = PdfViewControl.PDFToolManager.GetDocument().PageAtIndex(image.PageIndex);
  208. string tempPath = System.IO.Path.Combine(Path.GetTempPath(), Guid.NewGuid() + ".jpg");
  209. page.GetImgSelection().GetImgBitmap(image.ImageIndex, tempPath);
  210. Bitmap bitmap = new Bitmap(tempPath);
  211. BitmapImage imageData;
  212. using (MemoryStream ms = new MemoryStream())
  213. {
  214. bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
  215. imageData = new BitmapImage();
  216. imageData.BeginInit();
  217. imageData.StreamSource = ms;
  218. imageData.CacheOption = BitmapCacheOption.OnLoad;
  219. imageData.EndInit();
  220. imageData.Freeze();
  221. Clipboard.SetImage(imageData);
  222. bitmap.Dispose();
  223. File.Delete(tempPath);
  224. }
  225. }
  226. private void PDFToolManager_MouseMoveHandler(object sender, MouseEventObject e)
  227. {
  228. }
  229. private void PDFToolManager_MouseLeftButtonUpHandler(object sender, MouseEventObject e)
  230. {
  231. if (e.IsCreate)
  232. {
  233. OnAnnotEditHandler?.Invoke(this, EventArgs.Empty);
  234. }
  235. }
  236. private void PDFToolManager_MouseLeftButtonDownHandler(object sender, MouseEventObject e)
  237. {
  238. BaseAnnot baseAnnot = PdfViewControl.GetCacheHitTestAnnot();
  239. if (baseAnnot != null)
  240. {
  241. AnnotData annotData = baseAnnot.GetAnnotData();
  242. AnnotParam annotParam = ParamConverter.CPDFDataConverterToAnnotParam(
  243. PdfViewControl.GetCPDFViewer().GetDocument(), annotData.PageIndex, annotData.Annot);
  244. measurePropertyControl.SetPropertyForMeasureCreate(annotParam, annotData.Annot, PdfViewControl);
  245. SetMeasureInfoPanel(annotData.Annot, annotParam);
  246. currentAnnot = annotData.Annot;
  247. }
  248. panelState.RightPanel = PanelState.RightPanelState.PropertyPanel;
  249. SetInfoPanelVisble(true, false);
  250. }
  251. private void SetMeasureInfoPanel(CPDFAnnotation annot, AnnotParam param = null)
  252. {
  253. if (annot == null || !annot.IsValid())
  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. }