개정판 ea6f99ec
issue #534: Add UnSelect and SelectItemByRect method to SelectionSet
Change-Id: If006b652c6e29b07dab7db68213424a0ac2721dd
KCOM/Common/SelectionSet.cs | ||
---|---|---|
3 | 3 |
using KCOM.Views; |
4 | 4 |
using MarkupToPDF.Common; |
5 | 5 |
using MarkupToPDF.Controls.Parsing; |
6 |
using MarkupToPDF.Controls.Polygon; |
|
6 | 7 |
using Newtonsoft.Json; |
7 | 8 |
using Newtonsoft.Json.Converters; |
8 | 9 |
using Newtonsoft.Json.Linq; |
... | ... | |
49 | 50 |
} |
50 | 51 |
|
51 | 52 |
/// <summary> |
53 |
/// select item which's bouding rectangle is inside of given rect |
|
54 |
/// </summary> |
|
55 |
/// <author>humkyung</author> |
|
56 |
/// <date>2018.06.14</date> |
|
57 |
/// <param name="rect"></param> |
|
58 |
public void SelectItemByRect(Rect rect, MainMenu mainMenu) |
|
59 |
{ |
|
60 |
var selected = |
|
61 |
from comment in ViewerDataModel.Instance.MarkupControls_USER |
|
62 |
where comment.Visibility != Visibility.Hidden && rect.Contains(comment.ItemRect) |
|
63 |
select comment; |
|
64 |
if (selected.Count() > 0) |
|
65 |
{ |
|
66 |
this.UnSelect(mainMenu); /// unselect alreay selected items |
|
67 |
|
|
68 |
foreach(var comment in selected) mainMenu.Control_Style(comment); |
|
69 |
|
|
70 |
List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
|
71 |
adornerSet.AddRange(selected); |
|
72 |
Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet); |
|
73 |
mainMenu.SelectLayer.Children.Add(final); |
|
74 |
} |
|
75 |
} |
|
76 |
|
|
77 |
/// <summary> |
|
78 |
/// unselect selected items |
|
79 |
/// </summary> |
|
80 |
/// <param name="mainMenu"></param> |
|
81 |
public void UnSelect(MainMenu mainMenu) |
|
82 |
{ |
|
83 |
try |
|
84 |
{ |
|
85 |
Logger.sendCheckLog("pageNavigator_PageChanging_ReleaseAdorner", 1); |
|
86 |
if (mainMenu.SelectLayer.Children.Count > 0) |
|
87 |
{ |
|
88 |
foreach (var item in mainMenu.SelectLayer.Children) |
|
89 |
{ |
|
90 |
if (item.GetType().Name == "AdornerFinal") |
|
91 |
{ |
|
92 |
(item as AdornerFinal).unRegister(); |
|
93 |
|
|
94 |
foreach (var InnerItem in (item as AdornerFinal).MemberSet.Cast<AdornerMember>()) |
|
95 |
{ |
|
96 |
if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData)) |
|
97 |
{ |
|
98 |
if (InnerItem.DrawingData.GetType().Name == "PolygonControl") |
|
99 |
{ |
|
100 |
if ((InnerItem.DrawingData as PolygonControl).CommentID == null) |
|
101 |
{ |
|
102 |
(InnerItem.DrawingData as PolygonControl).CommentID = Commons.shortGuid(); |
|
103 |
} |
|
104 |
} |
|
105 |
|
|
106 |
ViewerDataModel.Instance.MarkupControls_USER.Add(InnerItem.DrawingData as CommentUserInfo); |
|
107 |
} |
|
108 |
} |
|
109 |
} |
|
110 |
} |
|
111 |
mainMenu.SelectLayer.Children.Clear(); |
|
112 |
} |
|
113 |
} |
|
114 |
catch (Exception ex) |
|
115 |
{ |
|
116 |
Logger.sendResLog("ReleaseAdorner", ex.ToString(), 0); |
|
117 |
} |
|
118 |
} |
|
119 |
|
|
120 |
/// <summary> |
|
52 | 121 |
/// Control Select |
53 | 122 |
/// </summary> |
54 | 123 |
/// <author>humkyung</author> |
내보내기 Unified diff