SharpsAnnotPropertyViewModel.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695
  1. using ComPDFKit.PDFAnnotation;
  2. using ComPDFKitViewer;
  3. using ComPDFKitViewer.AnnotEvent;
  4. using ComPDFKitViewer.PdfViewer;
  5. using ImTools;
  6. using PDF_Master.CustomControl.CompositeControl;
  7. using PDF_Master.Helper;
  8. using PDF_Master.Model;
  9. using PDF_Master.Model.AnnotPanel;
  10. using PDF_Master.Properties;
  11. using PDF_Master.ViewModels.Tools;
  12. using PDF_Master.ViewModels.Tools.AnnotManager;
  13. using PDF_Master.Views.Tools;
  14. using PDFSettings;
  15. using Prism.Commands;
  16. using Prism.Mvvm;
  17. using Prism.Regions;
  18. using System;
  19. using System.Collections.Generic;
  20. using System.Drawing;
  21. using System.Globalization;
  22. using System.Linq;
  23. using System.Text;
  24. using System.Threading.Tasks;
  25. using System.Windows;
  26. using System.Windows.Controls;
  27. using System.Windows.Data;
  28. using System.Windows.Media;
  29. using Color = System.Windows.Media.Color;
  30. using Point = System.Windows.Point;
  31. namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
  32. {
  33. public class DashStyleConverter : IValueConverter
  34. {
  35. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  36. {
  37. if (value is DashStyle)
  38. {
  39. var dash = value as DashStyle;
  40. if (dash.Dashes == null || dash.Dashes.Count == 0 || dash.Dashes[0] == 0)
  41. {
  42. return DashStyles.Solid.Dashes;
  43. }
  44. else
  45. {
  46. DashStyle dashx = new DashStyle();
  47. dashx.Dashes.Add(1);
  48. dashx.Dashes.Add(1);
  49. return dashx.Dashes;
  50. }
  51. }
  52. return value;
  53. }
  54. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  55. {
  56. throw new NotImplementedException();
  57. }
  58. }
  59. public class SharpsAnnotPropertyViewModel : BindableBase, INavigationAware
  60. {
  61. #region 属性
  62. private bool isRect = false;
  63. public bool IsRect
  64. {
  65. get { return isRect; }
  66. set => SetProperty(ref isRect, value);
  67. }
  68. private bool isCircle = false;
  69. public bool IsCircle
  70. {
  71. get { return isCircle; }
  72. set => SetProperty(ref isCircle, value);
  73. }
  74. private bool isArrow = false;
  75. public bool IsArrow
  76. {
  77. get { return isArrow; }
  78. set => SetProperty(ref isArrow, value);
  79. }
  80. private bool isLine = false;
  81. public bool IsLine
  82. {
  83. get { return isLine; }
  84. set => SetProperty(ref isLine, value);
  85. }
  86. private string _strShapeChecked = "";
  87. public string StrShapeChecked
  88. {
  89. get { return _strShapeChecked; }
  90. set
  91. {
  92. SetProperty(ref _strShapeChecked, value);
  93. }
  94. }
  95. public List<ComboDataItem> ThicknessItems { get; protected set; }
  96. private AnnotCommon _basicVm = new AnnotCommon();
  97. public AnnotCommon BasicVm
  98. {
  99. get { return _basicVm; }
  100. set => SetProperty(ref _basicVm, value);
  101. }
  102. private Geometry dataPath = null;
  103. public Geometry DataPath
  104. {
  105. get { return dataPath; }
  106. set
  107. {
  108. SetProperty(ref dataPath, value);
  109. }
  110. }
  111. private DashStyle dash = new DashStyle();
  112. public DashStyle Dash
  113. {
  114. get { return dash; }
  115. set
  116. {
  117. SetProperty(ref dash, value);
  118. }
  119. }
  120. private bool _isLineAnnot = false;
  121. public bool IsLineAnnot
  122. {
  123. get { return _isLineAnnot; }
  124. set
  125. {
  126. SetProperty(ref _isLineAnnot, value);
  127. }
  128. }
  129. #endregion 属性
  130. public DelegateCommand<object> SelectedThickCommand { get; set; }
  131. public DelegateCommand<object> SelectedBorderColorCommand { get; set; }
  132. public DelegateCommand<object> SelectedFillOpacityCommand { get; set; }
  133. public DelegateCommand<object> SelectedFillColorCommand { get; set; }
  134. public DelegateCommand<object> LineStyleCommand { get; set; }
  135. public DelegateCommand<object> SharpsTypeCommand { get; set; }
  136. public DelegateCommand<object> ThicknessChangedCommand { get; set; }
  137. public DelegateCommand<object> SelectedOpacityValueCommand { get; set; }
  138. public event EventHandler<object> LoadPropertyHandler;
  139. public IRegionManager region;
  140. public SharpsAnnotPropertyViewModel(IRegionManager regionManager)
  141. {
  142. region = regionManager;
  143. InitColorItems();
  144. InitFillColorItems();
  145. InitThicknessItems();
  146. SharpsTypeCommand = new DelegateCommand<object>(SharpsType_Command);
  147. SelectedFillOpacityCommand = new DelegateCommand<object>(SelectedFillOpacity_Command);
  148. SelectedFillColorCommand = new DelegateCommand<object>(SelectedFillColor_Command);
  149. SelectedThickCommand = new DelegateCommand<object>(SelectedThick_Command);
  150. SelectedBorderColorCommand = new DelegateCommand<object>(SelectedBorderColor);
  151. SelectedOpacityValueCommand = new DelegateCommand<object>(SelectedOpacityValue);
  152. ThicknessChangedCommand = new DelegateCommand<object>(ThicknessChanged_Command);
  153. LineStyleCommand = new DelegateCommand<object>(LineStyle_Command);
  154. }
  155. private void InitThicknessItems()
  156. {
  157. ThicknessItems = new List<ComboDataItem>();
  158. ComboDataItem item = new ComboDataItem(1, "pt");
  159. ThicknessItems.Add(item);
  160. item = new ComboDataItem(2, "pt");
  161. ThicknessItems.Add(item);
  162. item = new ComboDataItem(4, "pt");
  163. ThicknessItems.Add(item);
  164. item = new ComboDataItem(6, "pt");
  165. ThicknessItems.Add(item);
  166. item = new ComboDataItem(8, "pt");
  167. ThicknessItems.Add(item);
  168. }
  169. private void InitColorItems()
  170. {
  171. BasicVm.ColorItems = AnnotColorList.GetColorList(ColorSelectorType.Border);
  172. }
  173. private void InitFillColorItems()
  174. {
  175. BasicVm.FillColorItems = AnnotColorList.GetColorList(ColorSelectorType.Fill);
  176. }
  177. private void ThicknessChanged_Command(object obj)
  178. {
  179. if (obj != null)
  180. {
  181. var item = (ComboBoxItem)obj;
  182. var content = (string)item.Content;
  183. if (content != null)
  184. {
  185. var intData = int.Parse(content);
  186. BasicVm.AnnotThickness = intData;
  187. }
  188. }
  189. }
  190. private void SharpsType_Command(object obj)
  191. {
  192. if (obj != null)
  193. {
  194. var tag = (string)obj;
  195. SharpsType(tag, true);
  196. }
  197. }
  198. private void SharpsType(string tag, bool isFromToolsBtn = false)
  199. {
  200. Dictionary<AnnotArgsType, object> changeData = new Dictionary<AnnotArgsType, object>();
  201. switch (tag)
  202. {
  203. case "Rect":
  204. RectangleGeometry rectPath = new RectangleGeometry();
  205. rectPath.Rect = new Rect(0, 5, 28, 22);
  206. DataPath = rectPath;
  207. changeData[AnnotArgsType.AnnotSquare] = tag;
  208. IsLineAnnot = false;
  209. break;
  210. case "Circle":
  211. EllipseGeometry circlePath = new EllipseGeometry();
  212. circlePath.RadiusX = 14;
  213. circlePath.RadiusY = 14;
  214. circlePath.Center = new Point(14, 14);
  215. DataPath = circlePath;
  216. changeData[AnnotArgsType.AnnotCircle] = tag;
  217. IsLineAnnot = false;
  218. break;
  219. case "Arrow":
  220. {
  221. ArrowHelper arrowLine = new ArrowHelper();
  222. arrowLine.ArrowLength = 8;
  223. arrowLine.LineStart = new Point(8, 24);
  224. arrowLine.LineEnd = new Point(24, 8);
  225. arrowLine.StartSharp = C_LINE_TYPE.LINETYPE_NONE;
  226. arrowLine.EndSharp = C_LINE_TYPE.LINETYPE_ARROW;
  227. DataPath = arrowLine.BuildArrowBody();
  228. changeData[AnnotArgsType.AnnotLine] = tag;
  229. if (IsLineAnnot == false)
  230. IsLineAnnot = true;
  231. }
  232. break;
  233. case "Line":
  234. {
  235. ArrowHelper arrowLine = new ArrowHelper();
  236. arrowLine.LineStart = new Point(0, 32);
  237. arrowLine.LineEnd = new Point(32, 0);
  238. DataPath = arrowLine.BuildArrowBody();
  239. changeData[AnnotArgsType.AnnotLine] = tag;
  240. if (IsLineAnnot == false)
  241. IsLineAnnot = true;
  242. }
  243. break;
  244. }
  245. if (isFromToolsBtn)
  246. PropertyPanel.AnnotTypeChangedInvoke(this, changeData);
  247. StrShapeChecked = tag;
  248. PropertyPanel.SharpsAnnot = tag;
  249. BasicVm.SetOtherTag(tag);
  250. }
  251. private void LineStyle_Command(object obj)
  252. {
  253. if (obj != null)
  254. {
  255. var tag = obj as string;
  256. if (tag == "Solid")
  257. {
  258. DashStyle dashAnnot = new DashStyle();
  259. dashAnnot.Dashes.Add(0);
  260. dashAnnot.Dashes.Add(0);
  261. Dash = dashAnnot;
  262. PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.LineStyle, DashStyles.Solid);
  263. }
  264. else
  265. {
  266. DashStyle dashAnnot = new DashStyle();
  267. dashAnnot.Dashes.Add(1);
  268. dashAnnot.Dashes.Add(1);
  269. Dash = dashAnnot;
  270. PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.LineStyle, dash);
  271. }
  272. if (BasicVm.IsMultiSelected == false)
  273. PropertyPanel.InvokeToMyTools(BasicVm.AnnotType, Annot);
  274. }
  275. }
  276. private void SelectedFillColor_Command(object obj)
  277. {
  278. if (obj != null && PropertyPanel != null)
  279. {
  280. var colorValue = (Color)obj;
  281. if (colorValue != null)
  282. {
  283. BasicVm.FillColor = new SolidColorBrush(colorValue);
  284. BasicVm.FillColor.Opacity = BasicVm.FillOpacity;
  285. PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.FillColor, colorValue);
  286. if (BasicVm.IsMultiSelected == false)
  287. PropertyPanel.InvokeToMyTools(BasicVm.AnnotType, Annot);
  288. }
  289. }
  290. }
  291. private void SelectedFillOpacity_Command(object obj)
  292. {
  293. if (obj != null)
  294. {
  295. BasicVm.FillOpacity = (double)obj;
  296. BasicVm.FillColor.Opacity = BasicVm.FillOpacity;
  297. PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Transparency, BasicVm.FillOpacity);
  298. PropertyPanel.InvokeToMyTools(BasicVm.AnnotType, BasicVm.FillOpacity);
  299. }
  300. }
  301. private void SelectedOpacityValue(object obj)
  302. {
  303. if (obj != null)
  304. {
  305. BasicVm.FillOpacity = (double)obj;
  306. BasicVm.FillColor.Opacity = BasicVm.FillOpacity;
  307. PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Transparency, BasicVm.FillOpacity);
  308. PropertyPanel.InvokeToMyTools(BasicVm.AnnotType, BasicVm.FillOpacity);
  309. }
  310. }
  311. private void SelectedBorderColor(object obj)
  312. {
  313. if (obj != null && PropertyPanel != null)
  314. {
  315. var colorValue = (Color)obj;
  316. if (colorValue != null)
  317. {
  318. BasicVm.BorderColor = new SolidColorBrush(colorValue);
  319. BasicVm.BorderColor.Opacity = BasicVm.BorderOpacity;
  320. PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Color, colorValue);
  321. if (BasicVm.IsMultiSelected == false)
  322. PropertyPanel.InvokeToMyTools(BasicVm.AnnotType, Annot);
  323. }
  324. }
  325. }
  326. private void SelectedThick_Command(object obj)
  327. {
  328. if (obj is double)
  329. {
  330. var tran = (double)obj;
  331. AnnotArgsType argsType = AnnotArgsType.AnnotSquare;
  332. bool isLine = false;
  333. switch (BasicVm.strOtherTag)
  334. {
  335. case "Rect":
  336. argsType = AnnotArgsType.AnnotSquare;
  337. break;
  338. case "Circle":
  339. argsType = AnnotArgsType.AnnotCircle;
  340. break;
  341. case "Line":
  342. argsType = AnnotArgsType.AnnotLine;
  343. isLine = true;
  344. break;
  345. case "Arrow":
  346. argsType = AnnotArgsType.AnnotLine;
  347. isLine = false;
  348. break;
  349. }
  350. if (argsType == BasicVm.AnnotType)
  351. {
  352. //if(argsType== AnnotArgsType.AnnotLine && isLine)
  353. BasicVm.AnnotThickness = tran;
  354. PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, tran);
  355. }
  356. if (BasicVm.IsMultiSelected == false)
  357. PropertyPanel.InvokeToMyTools(BasicVm.AnnotType, Annot);
  358. }
  359. }
  360. public bool IsNavigationTarget(NavigationContext navigationContext)
  361. {
  362. return true;
  363. }
  364. public void OnNavigatedFrom(NavigationContext navigationContext)
  365. {
  366. BasicVm.IsMultiSelected = false;
  367. //PropertyPanel.annot = null;
  368. //PropertyPanel.AnnotEvents = null;
  369. //PropertyPanel.AnnotEvent = null;
  370. //PropertyPanel.annotlists = null;
  371. //AnnotEvent = null;
  372. //Annot = null;
  373. }
  374. private void SetAnnotType()
  375. {
  376. switch (BasicVm.AnnotType)
  377. {
  378. case AnnotArgsType.AnnotCircle:
  379. BasicVm.AnnotTypeTitle = "圆";
  380. break;
  381. case AnnotArgsType.AnnotSquare:
  382. BasicVm.AnnotTypeTitle = "矩形";
  383. break;
  384. case AnnotArgsType.AnnotLine:
  385. var annotLine = Annot as LineAnnotArgs;
  386. if (annotLine != null)
  387. {
  388. if (annotLine.TailLineType == C_LINE_TYPE.LINETYPE_ARROW && annotLine.HeadLineType == C_LINE_TYPE.LINETYPE_NONE)
  389. BasicVm.AnnotTypeTitle = "箭头";
  390. else
  391. BasicVm.AnnotTypeTitle = "线";
  392. }
  393. break;
  394. }
  395. }
  396. public AnnotAttribEvent AnnotEvent { get; set; }
  397. public AnnotHandlerEventArgs Annot;
  398. public AnnotTransfer PropertyPanel;
  399. public ViewContentViewModel ViewContentViewModel;
  400. public void OnNavigatedTo(NavigationContext navigationContext)
  401. {
  402. navigationContext.Parameters.TryGetValue<AnnotTransfer>(ParameterNames.PropertyPanelContentViewModel, out PropertyPanel);
  403. navigationContext.Parameters.TryGetValue<ViewContentViewModel>(ParameterNames.ViewContentViewModel, out ViewContentViewModel);
  404. if (PropertyPanel != null)
  405. {
  406. AnnotEvent = PropertyPanel.AnnotEvent;
  407. BasicVm.AnnotType = PropertyPanel.annot.EventType;
  408. Annot = PropertyPanel.annot;
  409. BasicVm.IsMultiSelected = PropertyPanel.IsMultiSelected;
  410. if (BasicVm.IsMultiSelected)
  411. {
  412. IsAttributeEquals();
  413. }
  414. else
  415. {
  416. GetAnnotProperty();
  417. }
  418. LoadPropertyHandler?.Invoke(null, Annot);
  419. }
  420. }
  421. private List<SquareAnnotArgs> ConvertLists()
  422. {
  423. List<SquareAnnotArgs> FreeTextLists = new List<SquareAnnotArgs>();
  424. foreach (var item in PropertyPanel.annotlists)
  425. {
  426. var itemFreeText = item as SquareAnnotArgs;
  427. if (itemFreeText != null)
  428. {
  429. FreeTextLists.Add(itemFreeText);
  430. }
  431. }
  432. if (FreeTextLists.Count != PropertyPanel.annotlists.Count)
  433. return null;
  434. else
  435. return FreeTextLists;
  436. }
  437. private void IsAttributeEquals()
  438. {
  439. var list = ConvertLists();
  440. if (list != null)
  441. {
  442. var temp = list[0];
  443. Dictionary<string, bool> isNoEqualsDir = new Dictionary<string, bool>();
  444. isNoEqualsDir.Add("FillColor", false);
  445. isNoEqualsDir.Add("LineColor", false);
  446. isNoEqualsDir.Add("Thickness", false);
  447. isNoEqualsDir.Add("ThickSolidDashStyle", false);
  448. foreach (var item in list)
  449. {
  450. if (item == list[0])
  451. continue;
  452. if (isNoEqualsDir["FillColor"] == false)
  453. {
  454. if (temp.BgColor.A != item.BgColor.A || temp.BgColor.R != item.BgColor.R || temp.BgColor.G != item.BgColor.G || temp.BgColor.B != item.BgColor.B)
  455. {
  456. BasicVm.FillColor = new SolidColorBrush(Color.FromArgb(0x01, 0xff, 0xff, 0xff));
  457. isNoEqualsDir["FillColor"] = true;
  458. }
  459. }
  460. if (isNoEqualsDir["LineColor"] == false)
  461. {
  462. if (temp.LineColor.A != item.LineColor.A || temp.LineColor.R != item.LineColor.R || temp.LineColor.G != item.LineColor.G || temp.LineColor.B != item.LineColor.B)
  463. {
  464. BasicVm.BorderColor = new SolidColorBrush(Color.FromArgb(0x01, 0xff, 0xff, 0xff));
  465. isNoEqualsDir["LineColor"] = true;
  466. }
  467. }
  468. if (isNoEqualsDir["Thickness"] == false)
  469. {
  470. isNoEqualsDir["Thickness"] = true;
  471. if (temp.LineWidth > item.LineWidth)
  472. {
  473. BasicVm.AnnotThickness = temp.LineWidth;
  474. }
  475. else
  476. {
  477. BasicVm.AnnotThickness = item.LineWidth;
  478. }
  479. }
  480. if (isNoEqualsDir["ThickSolidDashStyle"] == false)
  481. {
  482. if (AnnotTransfer.IsSolidStyle(temp.LineDash) != AnnotTransfer.IsSolidStyle(item.LineDash))
  483. {
  484. isNoEqualsDir["ThickSolidDashStyle"] = true;
  485. }
  486. }
  487. }
  488. ////以下是多选注释的属性相等时
  489. if (isNoEqualsDir["FillColor"] == false)
  490. {
  491. BasicVm.FillColor = new SolidColorBrush(temp.BgColor);
  492. }
  493. if (isNoEqualsDir["LineColor"] == false)
  494. {
  495. BasicVm.BorderColor = new SolidColorBrush(temp.LineColor);
  496. }
  497. if (isNoEqualsDir["Thickness"] == false)
  498. {
  499. BasicVm.AnnotThickness = temp.LineWidth;
  500. }
  501. if (isNoEqualsDir["ThickSolidDashStyle"] == true)
  502. {
  503. BasicVm.IsSolidLine = BasicVm.IsDashLine = false;
  504. }
  505. else
  506. {
  507. var isSolid = AnnotTransfer.IsSolidStyle(temp.LineDash);
  508. BasicVm.IsSolidLine = isSolid;
  509. BasicVm.IsDashLine = !isSolid;
  510. }
  511. }
  512. }
  513. private bool IsSolidStyle(AnnotHandlerEventArgs annot)
  514. {
  515. bool isSolid = true;
  516. if (annot is SquareAnnotArgs)
  517. {
  518. var Square = Annot as SquareAnnotArgs;
  519. isSolid = AnnotTransfer.IsSolidStyle(Square.LineDash);
  520. }
  521. else if (annot is CircleAnnotArgs)
  522. {
  523. var Circle = Annot as CircleAnnotArgs;
  524. isSolid = AnnotTransfer.IsSolidStyle(Circle.LineDash);
  525. }
  526. else if (annot is LineAnnotArgs)
  527. {
  528. var line = Annot as LineAnnotArgs;
  529. isSolid = AnnotTransfer.IsSolidStyle(line.LineDash);
  530. }
  531. return isSolid;
  532. }
  533. private void GetAnnotProperty()
  534. {
  535. if (Annot != null)
  536. {
  537. bool isSolid = true;
  538. switch (Annot.EventType)
  539. {
  540. case AnnotArgsType.AnnotSquare:
  541. if (Annot is SquareAnnotArgs)
  542. {
  543. var Square = Annot as SquareAnnotArgs;
  544. BasicVm.BorderColor = new SolidColorBrush(Square.LineColor);
  545. BasicVm.FillColor = new SolidColorBrush(Square.BgColor);
  546. BasicVm.BorderOpacity = Square.Transparency;
  547. BasicVm.FillOpacity = Square.Transparency;
  548. BasicVm.AnnotThickness = Square.LineWidth;
  549. Dash = Square.LineDash;
  550. SharpsType("Rect", false);
  551. BasicVm.AnnotTypeTitle = "矩形";
  552. IsLineAnnot = false;
  553. IsRect = true;
  554. }
  555. break;
  556. case AnnotArgsType.AnnotCircle:
  557. if (Annot is CircleAnnotArgs)
  558. {
  559. var Circle = Annot as CircleAnnotArgs;
  560. BasicVm.BorderColor = new SolidColorBrush(Circle.LineColor);
  561. BasicVm.FillColor = new SolidColorBrush(Circle.BgColor);
  562. BasicVm.BorderOpacity = Circle.Transparency;
  563. BasicVm.FillOpacity = Circle.Transparency;
  564. BasicVm.AnnotThickness = Circle.LineWidth;
  565. Dash = Circle.LineDash;
  566. SharpsType("Circle", false);
  567. BasicVm.AnnotTypeTitle = "圆";
  568. IsLineAnnot = false;
  569. IsCircle = true;
  570. }
  571. break;
  572. case AnnotArgsType.AnnotLine:
  573. if (Annot is LineAnnotArgs)
  574. {
  575. var line = Annot as LineAnnotArgs;
  576. BasicVm.BorderColor = new SolidColorBrush(line.LineColor);
  577. BasicVm.FillColor = new SolidColorBrush(line.LineColor);
  578. BasicVm.BorderOpacity = line.Transparency;
  579. BasicVm.FillOpacity = line.Transparency;
  580. BasicVm.AnnotThickness = line.LineWidth;
  581. Dash = line.LineDash;
  582. if (line.TailLineType == C_LINE_TYPE.LINETYPE_ARROW && line.HeadLineType == C_LINE_TYPE.LINETYPE_NONE)
  583. {
  584. SharpsType("Arrow", false);
  585. BasicVm.AnnotTypeTitle = "箭头";
  586. IsArrow = true;
  587. }
  588. else
  589. {
  590. SharpsType("Line", false);
  591. BasicVm.AnnotTypeTitle = "线条";
  592. IsLine = true;
  593. }
  594. IsLineAnnot = true;
  595. }
  596. break;
  597. }
  598. isSolid = IsSolidStyle(Annot);
  599. BasicVm.IsSolidLine = isSolid;
  600. BasicVm.IsDashLine = !isSolid;
  601. }
  602. }
  603. }
  604. }