개정판 e1b36bc0
Feature: Grouping 기능 추가(Ctrl+G : Group, Ctrl+Shift+G : Ungroup)
Change-Id: I99a3309acd55799ff7101522feaa035225b80e48
KCOM/Common/SelectionSet.cs | ||
---|---|---|
49 | 49 |
} |
50 | 50 |
} |
51 | 51 |
|
52 |
/// <summary> |
|
53 |
/// 현재 선택된 아이템들을 리턴한다. |
|
54 |
/// </summary> |
|
52 | 55 |
public List<CommentUserInfo> SelectedItems |
53 | 56 |
{ |
54 | 57 |
get |
... | ... | |
58 | 61 |
{ |
59 | 62 |
if (item.GetType().Name == "AdornerFinal") |
60 | 63 |
{ |
61 |
foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
|
|
64 |
foreach (var InnerItem in (item as Controls.AdornerFinal).Members) |
|
62 | 65 |
{ |
63 | 66 |
res.Add(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo); |
64 | 67 |
} |
... | ... | |
70 | 73 |
} |
71 | 74 |
|
72 | 75 |
/// <summary> |
76 |
/// select given item |
|
77 |
/// </summary> |
|
78 |
/// <param name="Clear">이전 SelectionSet을 제거할지 여부</param> |
|
79 |
/// <author>humkyung</author> |
|
80 |
public Controls.AdornerFinal SelectItem(CommentUserInfo comment, MainMenu mainMenu, bool Clear=true) |
|
81 |
{ |
|
82 |
List<CommentUserInfo> AlreadySelected = !Clear ? SelectionSet.Instance.SelectedItems : new List<CommentUserInfo>(); |
|
83 |
this.UnSelect(mainMenu); /// unselect alreay selected items |
|
84 |
|
|
85 |
List<CommentUserInfo> selected = new List<CommentUserInfo>() { comment }; |
|
86 |
if (!string.IsNullOrEmpty(comment.GroupID)) |
|
87 |
{ |
|
88 |
var group = ViewerDataModel.Instance.MarkupControls_USER.Where(x => !string.IsNullOrEmpty(x.GroupID) && x.GroupID.Equals(comment.GroupID) && !x.Equals(comment)); |
|
89 |
selected.AddRange(group); |
|
90 |
} |
|
91 |
selected.ForEach(x => mainMenu.Control_Style(x)); |
|
92 |
|
|
93 |
selected.InsertRange(0, AlreadySelected); |
|
94 |
return new Controls.AdornerFinal(selected); |
|
95 |
} |
|
96 |
|
|
97 |
/// <summary> |
|
73 | 98 |
/// select all controls |
74 | 99 |
/// - unselect selected items |
75 | 100 |
/// - adornerset을 생성하고 SelectLayer에 추가한다 |
... | ... | |
85 | 110 |
|
86 | 111 |
foreach (var item in controls) adornerSet.Add(item); |
87 | 112 |
|
88 |
if (adornerSet.Count > 0)
|
|
113 |
if (adornerSet.Any())
|
|
89 | 114 |
{ |
90 | 115 |
Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet); |
91 | 116 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Add(final); |
... | ... | |
98 | 123 |
/// <author>humkyung</author> |
99 | 124 |
/// <date>2018.06.14</date> |
100 | 125 |
/// <param name="rect"></param> |
101 |
public void SelectItemByRect(Rect rect, MainMenu mainMenu)
|
|
126 |
public Controls.AdornerFinal SelectItemByRect(Rect rect, MainMenu mainMenu, bool Clear=true)
|
|
102 | 127 |
{ |
103 |
var selected = |
|
104 |
from comment in ViewerDataModel.Instance.MarkupControls_USER |
|
105 |
where comment.Visibility != Visibility.Hidden && rect.Contains(comment.ItemRect) |
|
106 |
select comment; |
|
128 |
Controls.AdornerFinal selection = null; |
|
129 |
|
|
130 |
var selected = ViewerDataModel.Instance.MarkupControls_USER.Where(x => x.Visibility != Visibility.Hidden && rect.Contains(x.ItemRect)).ToList(); |
|
107 | 131 |
if (selected.Any()) |
108 | 132 |
{ |
133 |
List<CommentUserInfo> AlreadySelected = !Clear ? SelectionSet.Instance.SelectedItems : new List<CommentUserInfo>(); |
|
109 | 134 |
this.UnSelect(mainMenu); /// unselect alreay selected items |
110 | 135 |
|
111 |
foreach(var comment in selected) mainMenu.Control_Style(comment); |
|
136 |
List<CommentUserInfo> groups = new List<CommentUserInfo>(); |
|
137 |
foreach (var comment in selected) |
|
138 |
{ |
|
139 |
if(!string.IsNullOrEmpty(comment.GroupID)) |
|
140 |
{ |
|
141 |
var group = ViewerDataModel.Instance.MarkupControls_USER.Where(x => !string.IsNullOrEmpty(x.GroupID) && x.GroupID.Equals(comment.GroupID) && !selected.Contains(x)); |
|
142 |
if(group.Any()) groups.AddRange(group); |
|
143 |
} |
|
144 |
} |
|
145 |
if(groups.Any()) selected.AddRange(groups); |
|
146 |
selected.ForEach(x => mainMenu.Control_Style(x)); |
|
147 |
selected.InsertRange(0, AlreadySelected); |
|
112 | 148 |
|
113 |
List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
|
114 |
adornerSet.AddRange(selected); |
|
115 |
Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet); |
|
116 |
mainMenu.SelectLayer.Children.Add(final); |
|
149 |
selection = new Controls.AdornerFinal(selected); |
|
150 |
mainMenu.SelectLayer.Children.Add(selection); |
|
117 | 151 |
} |
152 |
|
|
153 |
return selection; |
|
118 | 154 |
} |
119 | 155 |
|
120 | 156 |
/// <summary> |
... | ... | |
149 | 185 |
#region ZIndex 설정 |
150 | 186 |
System.Windows.Controls.Canvas.SetZIndex(control, control.ZIndex); |
151 | 187 |
#endregion |
152 |
if (control.Index >= 0) |
|
188 |
|
|
189 |
#region User 리스트에 기존 인덱스에 맞게 추가 |
|
190 |
if (control.Index >= 0 && control.Index <= ViewerDataModel.Instance.MarkupControls_USER.Count) |
|
153 | 191 |
{ |
154 | 192 |
ViewerDataModel.Instance.MarkupControls_USER.Insert(control.Index, control); |
155 | 193 |
} |
... | ... | |
157 | 195 |
{ |
158 | 196 |
ViewerDataModel.Instance.MarkupControls_USER.Add(control); |
159 | 197 |
} |
198 |
#endregion |
|
160 | 199 |
} |
161 | 200 |
} |
162 | 201 |
} |
내보내기 Unified diff