markus / KCOM / Controls / AdornerFinal.xaml.cs @ 1066bae3
이력 | 보기 | 이력해설 | 다운로드 (114 KB)
1 | 787a4489 | KangIngu | using KCOM.Common; |
---|---|---|---|
2 | d128ceb2 | humkyung | using KCOM.Events; |
3 | 787a4489 | KangIngu | using MarkupToPDF.Common; |
4 | 684ef11c | ljiyeon | using MarkupToPDF.Controls.Cad; |
5 | 787a4489 | KangIngu | using MarkupToPDF.Controls.Common; |
6 | using MarkupToPDF.Controls.Etc; |
||
7 | using MarkupToPDF.Controls.Line; |
||
8 | using MarkupToPDF.Controls.Polygon; |
||
9 | using MarkupToPDF.Controls.Shape; |
||
10 | using MarkupToPDF.Controls.Text; |
||
11 | using System; |
||
12 | using System.Collections.Generic; |
||
13 | 53880c83 | ljiyeon | using System.Diagnostics; |
14 | 787a4489 | KangIngu | using System.Linq; |
15 | using System.Reactive.Linq; |
||
16 | using System.Text; |
||
17 | using System.Windows; |
||
18 | using System.Windows.Controls; |
||
19 | using System.Windows.Controls.Primitives; |
||
20 | using System.Windows.Input; |
||
21 | using System.Windows.Media; |
||
22 | using Telerik.Windows.Controls; |
||
23 | |||
24 | namespace KCOM.Controls |
||
25 | { |
||
26 | /// <summary> |
||
27 | /// Interaction logic for AdornerFinal.xaml |
||
28 | /// </summary> |
||
29 | public class AdornerMember |
||
30 | { |
||
31 | public UIElement DrawingData { get; set; } |
||
32 | public ControlType Drawingtype { get; set; } |
||
33 | public double DrawingAngle { get; set; } |
||
34 | public List<Thumb> ThumbList { get; set; } |
||
35 | c8e9b3e4 | ljiyeon | public string Symbol_ID { get; set; } |
36 | 53880c83 | ljiyeon | public long Group_ID { get; set; } |
37 | 787a4489 | KangIngu | } |
38 | public partial class AdornerFinal : UserControl |
||
39 | { |
||
40 | public TextBox editTextBox { get; set; } |
||
41 | #region 공용 인스턴스 |
||
42 | public List<AdornerMember> MemberSet { get; set; } |
||
43 | public Dictionary<Thumb, DragData> _dragData = new Dictionary<Thumb, DragData>(); |
||
44 | public double AngleValue = 0; |
||
45 | public bool IsTextAngle = false; |
||
46 | public Rect BorderSize { get; set; } |
||
47 | public bool TextCompensation = false; |
||
48 | public bool isDragging { get; set; } |
||
49 | public Thumb DraggerThumb { get; set; } |
||
50 | public RadDropDownButton dropData; |
||
51 | public RadCalendar dropCalendar; |
||
52 | public Thumb mainDragThumb { get; set; } |
||
53 | |||
54 | public Point reSizePoint { get; set; } |
||
55 | 992a98b4 | KangIngu | private Point rotatePoint { get; set; } /// 2018.05.09 added by humkyung |
56 | 787a4489 | KangIngu | #endregion |
57 | #region 생성자 |
||
58 | private void RadDropDownButton_Loaded(object sender, RoutedEventArgs e) |
||
59 | { |
||
60 | dropData = sender as RadDropDownButton; |
||
61 | } |
||
62 | private void Date_Calendar_Loaded(object sender, RoutedEventArgs e) |
||
63 | { |
||
64 | dropCalendar = sender as RadCalendar; |
||
65 | dropCalendar.SelectionChanged += (sen, ea) => |
||
66 | { |
||
67 | dropData.IsOpen = false; |
||
68 | if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "DateControl") |
||
69 | { |
||
70 | DateControl data = (MemberSet.First() as AdornerMember).DrawingData as DateControl; |
||
71 | data.Text = dropCalendar.SelectedDate.Value.ToShortDateString(); |
||
72 | } |
||
73 | }; |
||
74 | } |
||
75 | public AdornerFinal() |
||
76 | { |
||
77 | InitializeComponent(); |
||
78 | MemberSet = new List<AdornerMember>(); |
||
79 | BorderSize = new Rect(); |
||
80 | _dragData.Add(rotateTop, new DragData() { CursorAngle = 0, DragType = DragType.Rotate, RotateIsLeft = true, RotateIsTop = true }); |
||
81 | //_dragData.Add(rotateCenter, new DragData() { CursorAngle = 0, DragType = DragType.Rotate, RotateIsLeft = true, RotateIsTop = true }); |
||
82 | } |
||
83 | |||
84 | void DragThumb_Loaded(object sender, RoutedEventArgs e) |
||
85 | { |
||
86 | mainDragThumb = DragThumb; |
||
87 | } |
||
88 | |||
89 | public AdornerFinal(CommentUserInfo objectData) : this() |
||
90 | { |
||
91 | InitializeComponent(); |
||
92 | objectData.IsHitTestVisible = false; |
||
93 | if ((objectData as ArrowTextControl) != null) |
||
94 | { |
||
95 | (objectData as ArrowTextControl).Base_TextBox.Focusable = true; |
||
96 | } |
||
97 | Canvas.SetZIndex(objectData, 84); |
||
98 | try |
||
99 | { |
||
100 | 1066bae3 | ljiyeon | //ViewerDataModel.Instance.MarkupControls_USER.Remove(objectData); |
101 | 787a4489 | KangIngu | this.ContainerContent.Children.Add(objectData); |
102 | } |
||
103 | 1066bae3 | ljiyeon | catch (Exception ex) |
104 | 787a4489 | KangIngu | { |
105 | |||
106 | } |
||
107 | 1066bae3 | ljiyeon | |
108 | 787a4489 | KangIngu | SetAdornerMember(objectData as CommentUserInfo); |
109 | this.Focus(); |
||
110 | } |
||
111 | 9b7cda70 | KangIngu | public AdornerFinal(List<CommentUserInfo> objectData) : this() |
112 | 787a4489 | KangIngu | { |
113 | InitializeComponent(); |
||
114 | foreach (var item in objectData) |
||
115 | { |
||
116 | //item.IsHitTestVisible = false; |
||
117 | if ((item as ArrowTextControl) != null) |
||
118 | { |
||
119 | (item as ArrowTextControl).Base_TextBox.Focusable = true; |
||
120 | } |
||
121 | try |
||
122 | { |
||
123 | a0bab669 | KangIngu | Canvas.SetZIndex(item, 80); |
124 | 1066bae3 | ljiyeon | //ViewerDataModel.Instance.MarkupControls_USER.Remove(item); |
125 | 787a4489 | KangIngu | this.ContainerContent.Children.Add(item); |
126 | } |
||
127 | 53880c83 | ljiyeon | catch //(Exception ex) |
128 | 787a4489 | KangIngu | { |
129 | |||
130 | } |
||
131 | 1066bae3 | ljiyeon | finally |
132 | { |
||
133 | |||
134 | } |
||
135 | 787a4489 | KangIngu | } |
136 | SetAdornerMember(objectData); |
||
137 | this.Focus(); |
||
138 | } |
||
139 | |||
140 | #endregion |
||
141 | #region 메서드 |
||
142 | public Rect getAdornerSize() |
||
143 | { |
||
144 | return BorderSize; |
||
145 | } |
||
146 | public void addMemberControl(UIElement objectData) |
||
147 | { |
||
148 | this.ContainerContent.Children.Add(objectData); |
||
149 | SetAdornerMember(objectData as CommentUserInfo); |
||
150 | this.Focus(); |
||
151 | } |
||
152 | /// <summary> |
||
153 | /// UIElement를 종류에 맞게 등록시킴 |
||
154 | /// </summary> |
||
155 | /// <param name="member">UIElement 타입으로 BaseLayer에 있는 것들이 들어옵니다.</param> |
||
156 | public void SetAdornerMember(MarkupToPDF.Common.CommentUserInfo member) |
||
157 | 53880c83 | ljiyeon | { |
158 | 29010418 | ljiyeon | |
159 | 787a4489 | KangIngu | switch (member.GetType().Name) |
160 | { |
||
161 | #region 컨트롤 조건 |
||
162 | case "LineControl": //Angle추가 안했음 |
||
163 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.SingleLine, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
164 | 787a4489 | KangIngu | break; |
165 | case "ImgControl": //Angle추가 안했음 |
||
166 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ImgControl, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
167 | 787a4489 | KangIngu | //AdornerBorder.RenderTransformOrigin = new Point(0.5, 0.5); |
168 | //DragThumb.RenderTransformOrigin = new Point(0.5, 0.5); |
||
169 | AngleValue = (member as ImgControl).Angle; |
||
170 | break; |
||
171 | 29010418 | ljiyeon | //case "SymControl": //Angle추가 안했음 |
172 | // MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = MarkupType.Viewbox, ThumbList = new List<Thumb>() }); |
||
173 | // AngleValue = (member as SymControl).Angle; |
||
174 | // //ViewBoxRotate(member); |
||
175 | // break; |
||
176 | //case "SymControlN": //Angle추가 안했음 |
||
177 | // MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = MarkupType.Viewbox, ThumbList = new List<Thumb>() }); |
||
178 | // AngleValue = (member as SymControlN).Angle; |
||
179 | // //ViewBoxRotate(member); |
||
180 | // break; |
||
181 | 787a4489 | KangIngu | case "PolygonControl": //Angle추가 안했음 |
182 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.PolygonControl, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
183 | 787a4489 | KangIngu | break; |
184 | case "ArrowControl": |
||
185 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowLine, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
186 | 787a4489 | KangIngu | break; |
187 | case "ArrowTextControl": |
||
188 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember |
189 | { |
||
190 | DrawingData = member, |
||
191 | Drawingtype = ControlType.ArrowTextControl, |
||
192 | ThumbList = new List<Thumb>(), |
||
193 | Symbol_ID = member.SymbolID, |
||
194 | Group_ID = member.GroupID, |
||
195 | }); |
||
196 | 787a4489 | KangIngu | (member as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
197 | 190248a5 | ljiyeon | AngleValue = (member as ArrowTextControl).Angle; |
198 | 787a4489 | KangIngu | Observable.FromEventPattern(((ArrowTextControl)member).Base_TextBox, "LostFocus").Subscribe(a => |
199 | { |
||
200 | TextCompensation = false; |
||
201 | BorderUpdate(); |
||
202 | if ((a.Sender as TextBox).Text == "") //보류 |
||
203 | { |
||
204 | this.ContainerContent.Children.Remove(member); |
||
205 | this.Visibility = Visibility.Collapsed; |
||
206 | } |
||
207 | }); |
||
208 | break; |
||
209 | case "ArcControl": |
||
210 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArcLine, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
211 | 787a4489 | KangIngu | break; |
212 | 40b3ce25 | ljiyeon | case "ArrowArcControl": |
213 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArcArrow, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
214 | 40b3ce25 | ljiyeon | break; |
215 | 787a4489 | KangIngu | case "ArrowControl_Multi": |
216 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowMultiLine, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
217 | 787a4489 | KangIngu | break; |
218 | case "RectangleControl": |
||
219 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Rectangle, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
220 | 787a4489 | KangIngu | break; |
221 | case "DateControl": |
||
222 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Date, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
223 | 787a4489 | KangIngu | AngleValue = (member as DateControl).Angle; |
224 | break; |
||
225 | case "TriControl": |
||
226 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Triangle, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
227 | 9b7cda70 | KangIngu | break; |
228 | 787a4489 | KangIngu | case "CircleControl": |
229 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Circle, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
230 | 787a4489 | KangIngu | break; |
231 | case "CloudControl": |
||
232 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.PolygonCloud, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
233 | 787a4489 | KangIngu | break; |
234 | case "RectCloudControl": |
||
235 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.RectCloud, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
236 | 787a4489 | KangIngu | break; |
237 | case "SignControl": |
||
238 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Sign, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
239 | 787a4489 | KangIngu | AngleValue = (member as SignControl).Angle; |
240 | break; |
||
241 | 53880c83 | ljiyeon | |
242 | 787a4489 | KangIngu | case "SymControl": |
243 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Symbol, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
244 | 787a4489 | KangIngu | AngleValue = (member as SymControl).Angle; |
245 | break; |
||
246 | case "SymControlN": |
||
247 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Stamp, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
248 | 787a4489 | KangIngu | AngleValue = (member as SymControlN).Angle; |
249 | break; |
||
250 | case "InkControl": //Angle추가 안했음 |
||
251 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Ink, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
252 | 787a4489 | KangIngu | break; |
253 | case "TextControl": |
||
254 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.TextControl, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
255 | 787a4489 | KangIngu | RectangleGeometry Data = new RectangleGeometry |
256 | { |
||
257 | Rect = new Rect() |
||
258 | { |
||
259 | X = Canvas.GetLeft((member as TextControl)), |
||
260 | Y = Canvas.GetTop((member as TextControl)), |
||
261 | Width = (member as TextControl).Base_TextBlock.ActualWidth / 2, |
||
262 | Height = (member as TextControl).Base_TextBlock.ActualHeight / 2, |
||
263 | //Width = (member as TextControl).BoxWidth / 2, |
||
264 | //Height = (member as TextControl).BoxHeight / 2, |
||
265 | } |
||
266 | }; |
||
267 | Point endPointV = new Point(Data.Bounds.Right, Data.Bounds.Bottom); |
||
268 | Point middle = MathSet.getMiddlePoint((member as TextControl).StartPoint, endPointV); |
||
269 | |||
270 | |||
271 | DragThumb.RenderTransformOrigin = new Point(0.0, 0.0); |
||
272 | DragThumb.RenderTransform = new RotateTransform() |
||
273 | { |
||
274 | Angle = (member as TextControl).Angle, |
||
275 | 9b7cda70 | KangIngu | //CenterX = middle.X, |
276 | //CenterY = middle.Y, |
||
277 | 787a4489 | KangIngu | }; |
278 | |||
279 | AdornerBorder.RenderTransformOrigin = new Point(0.0, 0.0); |
||
280 | AdornerBorder.RenderTransform = new RotateTransform() |
||
281 | { |
||
282 | Angle = (member as TextControl).Angle, |
||
283 | 9b7cda70 | KangIngu | //CenterX = middle.X, |
284 | //CenterY = middle.Y, |
||
285 | 787a4489 | KangIngu | }; |
286 | Observable.FromEventPattern(((TextControl)member), "PropertyChanged").Subscribe(a => |
||
287 | { |
||
288 | TextCompensation = true; |
||
289 | BorderUpdate(); |
||
290 | ((TextControl)member).Base_TextBlock.TextDecorations = ((TextControl)member).UnderLine; |
||
291 | }); |
||
292 | Observable.FromEventPattern(((TextControl)member).Base_TextBox, "LostFocus").Subscribe(a => |
||
293 | { |
||
294 | TextCompensation = false; |
||
295 | BorderUpdate(); |
||
296 | if ((a.Sender as TextBox).Text == "") //보류 |
||
297 | { |
||
298 | this.ContainerContent.Children.Remove(member); |
||
299 | this.Visibility = Visibility.Collapsed; |
||
300 | } |
||
301 | 9b7cda70 | KangIngu | |
302 | //((TextControl)member).UnEditingMode(); |
||
303 | //((TextControl)member).Base_TextBlock.Visibility = Visibility.Collapsed; |
||
304 | //((TextControl)member).Base_Border.Visibility = Visibility.Collapsed; |
||
305 | //((TextControl)member).Base_TextPath.Visibility = Visibility.Collapsed; |
||
306 | 787a4489 | KangIngu | }); |
307 | break; |
||
308 | 684ef11c | ljiyeon | case "InsideWhiteControl": |
309 | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.InsideWhite, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
||
310 | break; |
||
311 | case "OverlapWhiteControl": |
||
312 | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.OverlapWhite, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
||
313 | break; |
||
314 | case "ClipWhiteControl": |
||
315 | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ClipWhite, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
||
316 | break; |
||
317 | case "CoordinateControl": |
||
318 | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Coordinate, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
||
319 | break; |
||
320 | 787a4489 | KangIngu | default: |
321 | break; |
||
322 | #endregion |
||
323 | } |
||
324 | if (member.GetType().Name == "TextControl") |
||
325 | { |
||
326 | TextControl content = ((TextControl)member); |
||
327 | content.StartPoint = new Point(Canvas.GetLeft(content), Canvas.GetTop(content)); |
||
328 | content.EndPoint = content.StartPoint; |
||
329 | |||
330 | } |
||
331 | else |
||
332 | { |
||
333 | RegistryPoint(member); |
||
334 | } |
||
335 | BorderUpdate(); |
||
336 | } |
||
337 | |||
338 | private void ViewBoxRotate(UIElement member) |
||
339 | { |
||
340 | AdornerBorder.RenderTransformOrigin = new Point(0.5, 0.5); |
||
341 | DragThumb.RenderTransformOrigin = new Point(0.5, 0.5); |
||
342 | AdornerBorder.RenderTransform = new RotateTransform() { Angle = (member as IViewBox).Angle }; |
||
343 | DragThumb.RenderTransform = new RotateTransform() { Angle = (member as IViewBox).Angle }; |
||
344 | } |
||
345 | public void SetAdornerMember(List<CommentUserInfo> members) |
||
346 | { |
||
347 | foreach (var member in members) |
||
348 | { |
||
349 | switch (member.GetType().Name) |
||
350 | { |
||
351 | #region 컨트롤 조건 |
||
352 | 53880c83 | ljiyeon | case "LineControl": |
353 | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.SingleLine, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
||
354 | break; |
||
355 | case "ImgControl": |
||
356 | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ImgControl, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
||
357 | 787a4489 | KangIngu | break; |
358 | case "ArrowControl": |
||
359 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowLine, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
360 | 787a4489 | KangIngu | break; |
361 | 53880c83 | ljiyeon | case "PolygonControl": |
362 | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.PolygonControl, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
||
363 | 787a4489 | KangIngu | break; |
364 | case "ArrowTextControl": |
||
365 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowTextControl, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
366 | 787a4489 | KangIngu | (member as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
367 | break; |
||
368 | case "ArcControl": |
||
369 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArcLine, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
370 | 787a4489 | KangIngu | break; |
371 | 40b3ce25 | ljiyeon | case "ArrowArcControl": |
372 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArcArrow, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
373 | 40b3ce25 | ljiyeon | break; |
374 | 787a4489 | KangIngu | case "DateControl": |
375 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Date, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
376 | 787a4489 | KangIngu | break; |
377 | case "ArrowControl_Multi": |
||
378 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowMultiLine, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
379 | 787a4489 | KangIngu | break; |
380 | case "RectangleControl": |
||
381 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Rectangle, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
382 | 787a4489 | KangIngu | break; |
383 | case "TriControl": |
||
384 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Triangle, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
385 | 787a4489 | KangIngu | break; |
386 | case "CircleControl": |
||
387 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Circle, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
388 | 787a4489 | KangIngu | break; |
389 | case "CloudControl": |
||
390 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.PolygonCloud, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
391 | 787a4489 | KangIngu | break; |
392 | case "RectCloudControl": |
||
393 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.RectCloud, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
394 | 787a4489 | KangIngu | break; |
395 | case "SignControl": |
||
396 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Sign, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
397 | 787a4489 | KangIngu | break; |
398 | case "SymControl": |
||
399 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Symbol, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
400 | 787a4489 | KangIngu | break; |
401 | case "SymControlN": |
||
402 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Stamp, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
403 | 787a4489 | KangIngu | break; |
404 | 53880c83 | ljiyeon | case "InkControl": |
405 | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Ink, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
||
406 | 787a4489 | KangIngu | break; |
407 | case "TextControl": |
||
408 | 53880c83 | ljiyeon | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.TextControl, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
409 | 787a4489 | KangIngu | Observable.FromEventPattern(((TextControl)member), "PropertyChanged").Subscribe(a => |
410 | { |
||
411 | BorderUpdate(); |
||
412 | try |
||
413 | { |
||
414 | 29010418 | ljiyeon | ((TextControl)member).Base_TextBlock.TextDecorations = ((TextControl)member).UnderLine; |
415 | 787a4489 | KangIngu | } |
416 | catch (Exception) |
||
417 | { |
||
418 | |||
419 | } |
||
420 | |||
421 | }); |
||
422 | Observable.FromEventPattern(((TextControl)member).Base_TextBox, "SelectionChanged").Subscribe(a => |
||
423 | { |
||
424 | BorderUpdate(); |
||
425 | }); |
||
426 | break; |
||
427 | 684ef11c | ljiyeon | case "InsideWhiteControl": |
428 | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.InsideWhite, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
||
429 | break; |
||
430 | case "OverlapWhiteControl": |
||
431 | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.OverlapWhite, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
||
432 | break; |
||
433 | case "ClipWhiteControl": |
||
434 | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ClipWhite, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
||
435 | break; |
||
436 | case "CoordinateControl": |
||
437 | MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Coordinate, ThumbList = new List<Thumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
||
438 | break; |
||
439 | 787a4489 | KangIngu | default: |
440 | break; |
||
441 | #endregion |
||
442 | } |
||
443 | if (member.GetType().Name == "TextControl") |
||
444 | { |
||
445 | TextControl content = ((TextControl)member); |
||
446 | content.StartPoint = new Point(Canvas.GetLeft(content), Canvas.GetTop(content)); |
||
447 | content.EndPoint = content.StartPoint; |
||
448 | } |
||
449 | else |
||
450 | { |
||
451 | RegistryPoint(member, members.Count); |
||
452 | } |
||
453 | } |
||
454 | |||
455 | BorderUpdate(); |
||
456 | } |
||
457 | |||
458 | /// <summary> |
||
459 | /// Border 를 갱신 |
||
460 | /// </summary> |
||
461 | public void BorderUpdate() |
||
462 | { |
||
463 | AdornerBorder.MinWidth = 10; |
||
464 | AdornerBorder.MinHeight = 10; |
||
465 | |||
466 | 992a98b4 | KangIngu | double minX = double.MaxValue; |
467 | double minY = double.MaxValue; |
||
468 | double maxX = double.MinValue; |
||
469 | double maxY = double.MinValue; |
||
470 | 787a4489 | KangIngu | |
471 | if (MemberSet.Count == 1) |
||
472 | { |
||
473 | if (MemberSet.First().DrawingData.GetType().Name == "TextControl") |
||
474 | { |
||
475 | if ((MemberSet.First().DrawingData as TextControl).Angle != 0) |
||
476 | { |
||
477 | trRotate.Angle = (MemberSet.First().DrawingData as TextControl).Angle; |
||
478 | trRotateThumb.Angle = (MemberSet.First().DrawingData as TextControl).Angle; |
||
479 | } |
||
480 | else |
||
481 | { |
||
482 | trRotate.Angle = 0; |
||
483 | trRotateThumb.Angle = 0; |
||
484 | } |
||
485 | } |
||
486 | } |
||
487 | foreach (var item in MemberSet) |
||
488 | { |
||
489 | UIElement currentControl = (item as AdornerMember).DrawingData; |
||
490 | if (item.DrawingData.GetType().Name == "TextControl") |
||
491 | { |
||
492 | double textControlWidth; |
||
493 | double textControlHeight; |
||
494 | if (((currentControl as TextControl).Base_TextBox.ActualWidth) == 0) |
||
495 | { |
||
496 | textControlWidth = ((currentControl as TextControl).Base_TextBlock.ActualWidth); |
||
497 | textControlHeight = ((currentControl as TextControl).Base_TextBlock.ActualHeight); |
||
498 | } |
||
499 | else |
||
500 | { |
||
501 | textControlWidth = ((currentControl as TextControl).Base_TextBox.ActualWidth); |
||
502 | textControlHeight = ((currentControl as TextControl).Base_TextBox.ActualHeight); |
||
503 | } |
||
504 | 29010418 | ljiyeon | |
505 | 787a4489 | KangIngu | if ((currentControl as TextControl).EndPoint.X < minX) |
506 | { |
||
507 | minX = (currentControl as TextControl).EndPoint.X; |
||
508 | } |
||
509 | if ((currentControl as TextControl).EndPoint.Y < minY) |
||
510 | { |
||
511 | minY = (currentControl as TextControl).EndPoint.Y; |
||
512 | } |
||
513 | if (textControlWidth + (currentControl as TextControl).EndPoint.X > maxX) |
||
514 | { |
||
515 | maxX = textControlWidth + (currentControl as TextControl).EndPoint.X; |
||
516 | } |
||
517 | if (textControlHeight + (currentControl as TextControl).EndPoint.Y > maxY) |
||
518 | { |
||
519 | maxY = textControlHeight + (currentControl as TextControl).EndPoint.Y; |
||
520 | } |
||
521 | } |
||
522 | else if ((currentControl as IViewBox) != null) |
||
523 | { |
||
524 | IViewBox instance = currentControl as IViewBox; |
||
525 | List<Point> am = (currentControl as IPath).PointSet; |
||
526 | List<double> xSet = am.Select(p => p.X).ToList(); |
||
527 | List<double> ySet = am.Select(p => p.Y).ToList(); |
||
528 | if (xSet.Min() < minX) minX = xSet.Min(); |
||
529 | if (ySet.Min() < minY) minY = ySet.Min(); |
||
530 | if (xSet.Max() > maxX) maxX = xSet.Max(); |
||
531 | if (ySet.Max() > maxY) maxY = ySet.Max(); |
||
532 | } |
||
533 | else if ((currentControl as IPath).PathData == null) |
||
534 | { |
||
535 | Rect rt = new Rect |
||
536 | { |
||
537 | X = (currentControl as IPath).StartPoint.X, |
||
538 | Y = (currentControl as IPath).StartPoint.Y, |
||
539 | Width = Math.Max((currentControl as IPath).EndPoint.X, (currentControl as IPath).StartPoint.X) - Math.Min((currentControl as IPath).EndPoint.X, (currentControl as IPath).StartPoint.X), |
||
540 | Height = Math.Max((currentControl as IPath).EndPoint.Y, (currentControl as IPath).StartPoint.Y) - Math.Min((currentControl as IPath).EndPoint.Y, (currentControl as IPath).StartPoint.Y), |
||
541 | }; |
||
542 | if (rt.Left < minX) minX = rt.Left; |
||
543 | if (rt.Top < minY) minY = rt.Top; |
||
544 | if (rt.Right > maxX) maxX = rt.Right; |
||
545 | if (rt.Bottom > maxY) maxY = rt.Bottom; |
||
546 | } |
||
547 | else if ((currentControl as IPath) == null) |
||
548 | { |
||
549 | Rect rt = new Rect |
||
550 | { |
||
551 | X = (currentControl as IPath).StartPoint.X, |
||
552 | Y = (currentControl as IPath).StartPoint.Y, |
||
553 | Width = (currentControl as IPath).EndPoint.X - (currentControl as IPath).StartPoint.X, |
||
554 | Height = (currentControl as IPath).EndPoint.Y - (currentControl as IPath).StartPoint.Y |
||
555 | }; |
||
556 | if (rt.Left < minX) minX = rt.Left; |
||
557 | if (rt.Top < minY) minY = rt.Top; |
||
558 | if (rt.Right > maxX) maxX = rt.Right; |
||
559 | if (rt.Bottom > maxY) maxY = rt.Bottom; |
||
560 | } |
||
561 | else if ((currentControl as CircleControl) != null) |
||
562 | 29010418 | ljiyeon | { |
563 | 787a4489 | KangIngu | List<Point> am = (currentControl as IPath).PointSet; |
564 | List<double> xSet = am.Select(p => p.X).ToList(); |
||
565 | List<double> ySet = am.Select(p => p.Y).ToList(); |
||
566 | if (xSet.Min() < minX) minX = xSet.Min(); |
||
567 | if (ySet.Min() < minY) minY = ySet.Min(); |
||
568 | if (xSet.Max() > maxX) maxX = xSet.Max(); |
||
569 | if (ySet.Max() > maxY) maxY = ySet.Max(); |
||
570 | } |
||
571 | else |
||
572 | { |
||
573 | if ((currentControl as IPath).PathData.Bounds.Left < minX) minX = (currentControl as IPath).PathData.Bounds.Left; |
||
574 | if ((currentControl as IPath).PathData.Bounds.Top < minY) minY = (currentControl as IPath).PathData.Bounds.Top; |
||
575 | if ((currentControl as IPath).PathData.Bounds.Right > maxX) maxX = (currentControl as IPath).PathData.Bounds.Right; |
||
576 | if ((currentControl as IPath).PathData.Bounds.Bottom > maxY) maxY = (currentControl as IPath).PathData.Bounds.Bottom; |
||
577 | } |
||
578 | } |
||
579 | |||
580 | Rect ac = new Rect(minX, minY, maxX - minX, maxY - minY); |
||
581 | bool addWidthSize = false; |
||
582 | bool addHeightSize = false; |
||
583 | if (ac.Width <= 10) |
||
584 | { |
||
585 | ac.Width += 10; |
||
586 | addWidthSize = true; |
||
587 | } |
||
588 | if (ac.Height <= 10) |
||
589 | { |
||
590 | ac.Height += 10; |
||
591 | addHeightSize = true; |
||
592 | } |
||
593 | BorderSize = ac; |
||
594 | AdornerBorder.MinWidth = 10; |
||
595 | AdornerBorder.MinHeight = 10; |
||
596 | AdornerBorder.Width = ac.Width; |
||
597 | AdornerBorder.Height = ac.Height; |
||
598 | Canvas.SetLeft(AdornerBorder, minX); |
||
599 | Canvas.SetTop(AdornerBorder, minY); |
||
600 | |||
601 | DragThumb.Width = ac.Width; |
||
602 | DragThumb.Height = ac.Height; |
||
603 | |||
604 | DragThumb.MinWidth = 10; |
||
605 | DragThumb.MinHeight = 10; |
||
606 | if (addWidthSize) |
||
607 | { |
||
608 | Canvas.SetLeft(DragThumb, minX - 5); |
||
609 | } |
||
610 | else |
||
611 | { |
||
612 | Canvas.SetLeft(DragThumb, minX); |
||
613 | } |
||
614 | |||
615 | if (addHeightSize) |
||
616 | { |
||
617 | Canvas.SetTop(DragThumb, minY - 5); |
||
618 | } |
||
619 | else |
||
620 | { |
||
621 | Canvas.SetTop(DragThumb, minY); |
||
622 | } |
||
623 | } |
||
624 | /// <summary> |
||
625 | /// UIElement 해제 |
||
626 | /// </summary> |
||
627 | public void unRegister() |
||
628 | { |
||
629 | foreach (var item in this.ContainerContent.Children) |
||
630 | { |
||
631 | if (item is MarkupToPDF.Common.CommentUserInfo) |
||
632 | { |
||
633 | (item as MarkupToPDF.Common.CommentUserInfo).IsHitTestVisible = true; |
||
634 | } |
||
635 | } |
||
636 | this.ContainerContent.Children.Clear(); |
||
637 | } |
||
638 | /// <summary> |
||
639 | /// 각 포인트들을 등록합니다. |
||
640 | /// </summary> |
||
641 | /// <param name="pointset">Drawing Point</param> |
||
642 | public void RegistryPoint(CommentUserInfo member, int cnt = 1) |
||
643 | 53880c83 | ljiyeon | { |
644 | 787a4489 | KangIngu | int count = 0; |
645 | double Minx = 100000000; |
||
646 | double Miny = 100000000; |
||
647 | List<Point> list = (member as IPath).PointSet; |
||
648 | if (member.GetType().Name == "InkControl") |
||
649 | { |
||
650 | list.Clear(); |
||
651 | list.Add(new Point((member as IPath).PathData.Bounds.X, (member as IPath).PathData.Bounds.Y)); |
||
652 | list.Add(new Point((member as IPath).PathData.Bounds.Left, (member as IPath).PathData.Bounds.Bottom)); |
||
653 | list.Add(new Point((member as IPath).PathData.Bounds.Right, (member as IPath).PathData.Bounds.Bottom)); |
||
654 | list.Add(new Point((member as IPath).PathData.Bounds.Right, (member as IPath).PathData.Bounds.Top)); |
||
655 | } |
||
656 | ControlType markT = MemberSet.Where(p => p.DrawingData == member).First().Drawingtype; |
||
657 | foreach (var ax in list) |
||
658 | { |
||
659 | Minx = (ax.X < Minx) ? ax.X : Minx; |
||
660 | Miny = (ax.Y < Miny) ? ax.Y : Miny; |
||
661 | } |
||
662 | for (int i = 0; i < list.Count(); i++) |
||
663 | { |
||
664 | Thumb tm = new Thumb |
||
665 | { |
||
666 | Style = (Style)this.LayoutRoot.Resources["ThumbResizeStyle"], |
||
667 | }; |
||
668 | |||
669 | MemberSet.Last().ThumbList.Add(tm); |
||
670 | 29010418 | ljiyeon | |
671 | 40b3ce25 | ljiyeon | if ((markT == ControlType.ArcLine && list[i] == (member as ArcControl).MidPoint) || (markT == ControlType.ArcArrow && list[i] == (member as ArrowArcControl).MidPoint)) |
672 | 787a4489 | KangIngu | { |
673 | tm.Style = (Style)this.LayoutRoot.Resources["ThumbArcControlStyle"]; |
||
674 | } |
||
675 | if (member.GetType().Name == "ArrowTextControl" && i == 1) |
||
676 | { |
||
677 | //if (MemberSet.Count()<=1) |
||
678 | //{ |
||
679 | tm.Style = (Style)this.LayoutRoot.Resources["ThumbArcControlStyle"]; |
||
680 | List<Point> ps = new List<Point>(); |
||
681 | |||
682 | if ((MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl != null) |
||
683 | { |
||
684 | var temp = (MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl; |
||
685 | |||
686 | 9b7cda70 | KangIngu | |
687 | 787a4489 | KangIngu | switch (Math.Abs(temp.Angle).ToString()) |
688 | { |
||
689 | case "90": |
||
690 | { |
||
691 | ps.Clear(); |
||
692 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽 |
||
693 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); // 위 중간 |
||
694 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); // 위 오른쪽 |
||
695 | |||
696 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 중간 |
||
697 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 하단 |
||
698 | |||
699 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); //중간 하단 |
||
700 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 하단 |
||
701 | |||
702 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 중간 |
||
703 | } |
||
704 | break; |
||
705 | case "270": |
||
706 | { |
||
707 | ps.Clear(); |
||
708 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽 |
||
709 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); // 위 중간 |
||
710 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); // 위 오른쪽 |
||
711 | |||
712 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 중간 |
||
713 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 하단 |
||
714 | |||
715 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); //중간 하단 |
||
716 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 하단 |
||
717 | |||
718 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 중간 |
||
719 | } |
||
720 | break; |
||
721 | default: |
||
722 | { |
||
723 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단 |
||
724 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단 |
||
725 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단 |
||
726 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //우단 |
||
727 | } |
||
728 | break; |
||
729 | } |
||
730 | |||
731 | ArrowTextControl instance = (member as ArrowTextControl); |
||
732 | if (instance.isTrans) |
||
733 | { |
||
734 | //var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
||
735 | //var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP); |
||
736 | //list[count] = tempP; |
||
737 | list[count] = temp.MidPoint; |
||
738 | } |
||
739 | else |
||
740 | { |
||
741 | if (temp.isFixed) |
||
742 | { |
||
743 | var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
||
744 | var testP = endP; |
||
745 | if (ps[0] == endP) //상단 |
||
746 | { |
||
747 | testP = new Point(endP.X, endP.Y - 50); |
||
748 | } |
||
749 | else if (ps[1] == endP) //하단 |
||
750 | { |
||
751 | testP = new Point(endP.X, endP.Y + 50); |
||
752 | } |
||
753 | else if (ps[2] == endP) //좌단 |
||
754 | { |
||
755 | testP = new Point(endP.X - 50, endP.Y); |
||
756 | } |
||
757 | else if (ps[3] == endP) //우단 |
||
758 | { |
||
759 | testP = new Point(endP.X + 50, endP.Y); |
||
760 | } |
||
761 | list[count] = testP; |
||
762 | } |
||
763 | else |
||
764 | { |
||
765 | var endP = MathSet.getNearPoint(ps, instance.MidPoint); |
||
766 | list[count] = MathSet.getMiddlePoint(instance.StartPoint, endP); |
||
767 | } |
||
768 | } |
||
769 | } |
||
770 | } |
||
771 | if (member.GetType().Name == "ArrowTextControl" && list[i] == list.Last()) |
||
772 | { |
||
773 | tm.Style = (Style)this.LayoutRoot.Resources["ThumbTextStyle"]; |
||
774 | tm.Width = (member as ArrowTextControl).BoxWidth; |
||
775 | tm.Height = (member as ArrowTextControl).BoxHeight; |
||
776 | var angle = (member as ArrowTextControl).Angle; |
||
777 | if (Math.Abs(angle).ToString() == "90") |
||
778 | { |
||
779 | tm.RenderTransformOrigin = new Point(0, 0); |
||
780 | tm.RenderTransform = new RotateTransform { Angle = 270 }; |
||
781 | } |
||
782 | else if (Math.Abs(angle).ToString() == "270") |
||
783 | { |
||
784 | tm.RenderTransformOrigin = new Point(0, 0); |
||
785 | tm.RenderTransform = new RotateTransform { Angle = 90 }; |
||
786 | |||
787 | } |
||
788 | else |
||
789 | { |
||
790 | tm.RenderTransformOrigin = new Point(0.5, 0.5); |
||
791 | tm.RenderTransform = new RotateTransform() |
||
792 | { |
||
793 | Angle = angle, |
||
794 | }; |
||
795 | } |
||
796 | } |
||
797 | 29010418 | ljiyeon | |
798 | 787a4489 | KangIngu | if (member.GetType().Name == "CloudControl") |
799 | { |
||
800 | if (i == list.Count() - 1) |
||
801 | { |
||
802 | tm.Visibility = System.Windows.Visibility.Collapsed; |
||
803 | } |
||
804 | } |
||
805 | if (member.GetType().Name == "PolygonControl") |
||
806 | { |
||
807 | if (i == list.Count() - 1) |
||
808 | { |
||
809 | if ((member as PolygonControl).ControlType == ControlType.ChainLine) |
||
810 | { |
||
811 | |||
812 | } |
||
813 | else |
||
814 | { |
||
815 | tm.Visibility = System.Windows.Visibility.Collapsed; |
||
816 | } |
||
817 | } |
||
818 | if ((member as PolygonControl).ControlType == ControlType.Ink) |
||
819 | { |
||
820 | tm.Visibility = System.Windows.Visibility.Collapsed; |
||
821 | } |
||
822 | } |
||
823 | 29010418 | ljiyeon | |
824 | 787a4489 | KangIngu | this.ContainerContent.Children.Add(tm); |
825 | Canvas.SetLeft(tm, list[count].X); |
||
826 | Canvas.SetTop(tm, list[count].Y); |
||
827 | if (member.GetType().Name == "ArrowTextControl" && list[i] == (member as ArrowTextControl).MidPoint) |
||
828 | { |
||
829 | Canvas.SetZIndex(tm, 95); |
||
830 | } |
||
831 | else |
||
832 | { |
||
833 | Canvas.SetZIndex(tm, 99); |
||
834 | } |
||
835 | |||
836 | tm.DragStarted += new DragStartedEventHandler(tm_DragStarted); |
||
837 | tm.DragCompleted += new DragCompletedEventHandler(tm_DragCompleted); |
||
838 | tm.DragDelta += ResizeTm_DragDelta; |
||
839 | tm.MouseMove += new MouseEventHandler(resize_MouseMove); |
||
840 | count++; |
||
841 | } |
||
842 | } |
||
843 | |||
844 | private void ResizeTm_DragDelta(object sender, DragDeltaEventArgs e) |
||
845 | { |
||
846 | if (MemberSet.Count > 1) |
||
847 | return; |
||
848 | if (reSizePoint != new Point(0, 0)) |
||
849 | { |
||
850 | Thumb thumb = sender as Thumb; |
||
851 | |||
852 | 190248a5 | ljiyeon | if (AngleValue == -90) |
853 | { |
||
854 | Canvas.SetLeft(thumb, Canvas.GetLeft(thumb) + e.VerticalChange); |
||
855 | Canvas.SetTop(thumb, Canvas.GetTop(thumb) + (-e.HorizontalChange)); |
||
856 | } |
||
857 | else if (AngleValue == -180) |
||
858 | { |
||
859 | Canvas.SetLeft(thumb, Canvas.GetLeft(thumb) + (-e.HorizontalChange)); |
||
860 | Canvas.SetTop(thumb, Canvas.GetTop(thumb) + (-e.VerticalChange)); |
||
861 | } |
||
862 | else if (AngleValue == -270) |
||
863 | { |
||
864 | Canvas.SetLeft(thumb, Canvas.GetLeft(thumb) + (-e.VerticalChange)); |
||
865 | Canvas.SetTop(thumb, Canvas.GetTop(thumb) + e.HorizontalChange); |
||
866 | } |
||
867 | else //(AngleValue == 0) |
||
868 | { |
||
869 | Canvas.SetLeft(thumb, Canvas.GetLeft(thumb) + e.HorizontalChange); |
||
870 | Canvas.SetTop(thumb, Canvas.GetTop(thumb) + e.VerticalChange); |
||
871 | } |
||
872 | 53880c83 | ljiyeon | |
873 | 787a4489 | KangIngu | |
874 | Point setPoint = new Point(Canvas.GetLeft(thumb), Canvas.GetTop(thumb)); |
||
875 | 29010418 | ljiyeon | |
876 | 787a4489 | KangIngu | AdornerMember control = (from userThumb in MemberSet |
877 | where userThumb.ThumbList.Contains(thumb) |
||
878 | select userThumb).FirstOrDefault(); |
||
879 | Point nearPoint = new Point(0, 0); |
||
880 | IPath AllControl = control.DrawingData as IPath; |
||
881 | if (ControlType.TextControl != control.Drawingtype) |
||
882 | { |
||
883 | |||
884 | var temp = (MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl; |
||
885 | List<Point> ps = new List<Point>(); |
||
886 | |||
887 | nearPoint = MathSet.getNearPoint((control.DrawingData as IPath).PointSet, setPoint); |
||
888 | 29010418 | ljiyeon | |
889 | 787a4489 | KangIngu | |
890 | } |
||
891 | for (int i = 0; i < (control.DrawingData as IPath).PointSet.Count; i++) |
||
892 | { |
||
893 | switch (control.Drawingtype) |
||
894 | { |
||
895 | #region Arc + Line |
||
896 | case ControlType.ArrowMultiLine: |
||
897 | case ControlType.ArcLine: |
||
898 | 40b3ce25 | ljiyeon | case ControlType.ArcArrow: |
899 | 787a4489 | KangIngu | case ControlType.SingleLine: |
900 | case ControlType.Triangle: |
||
901 | if (nearPoint.Equals(AllControl.PointSet[i])) |
||
902 | { |
||
903 | AllControl.PointSet[i] = setPoint; |
||
904 | AllControl.updateControl(); |
||
905 | DynamicThumbUpdate(control); |
||
906 | BorderUpdate(); |
||
907 | 29010418 | ljiyeon | |
908 | 787a4489 | KangIngu | } |
909 | break; |
||
910 | #endregion |
||
911 | 3797ff05 | djkim | #region Shape |
912 | 787a4489 | KangIngu | case ControlType.RectCloud: |
913 | case ControlType.Rectangle: |
||
914 | if (nearPoint.Equals(AllControl.PointSet[i])) |
||
915 | { |
||
916 | AllControl.PointSet[i] = setPoint; |
||
917 | var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count(); |
||
918 | var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count(); |
||
919 | var NextP = (i + 1) % AllControl.PointSet.Count(); |
||
920 | |||
921 | var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]); |
||
922 | |||
923 | var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]); |
||
924 | var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, |
||
925 | AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y); |
||
926 | AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet |
||
927 | [ReverseP].Y |
||
928 | + PreviousV.Y * l); |
||
929 | |||
930 | var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]); |
||
931 | l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet |
||
932 | [i].Y - AllControl.PointSet[ReverseP].Y); |
||
933 | AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y + |
||
934 | NextV.Y * l); |
||
935 | AllControl.updateControl(); |
||
936 | DynamicThumbUpdate(control); |
||
937 | BorderUpdate(); |
||
938 | } |
||
939 | break; |
||
940 | #endregion |
||
941 | #region Polygon |
||
942 | case ControlType.PolygonControl: |
||
943 | if (nearPoint.Equals(AllControl.PointSet[i])) |
||
944 | { |
||
945 | AllControl.PointSet[i] = setPoint; |
||
946 | AllControl.updateControl(); |
||
947 | BorderUpdate(); |
||
948 | } |
||
949 | break; |
||
950 | #endregion |
||
951 | #region Cicle |
||
952 | case ControlType.Circle: |
||
953 | if (nearPoint.Equals(AllControl.PointSet[i])) |
||
954 | { |
||
955 | AllControl.PointSet[i] = setPoint; |
||
956 | List<Point> newPointSet = new List<Point> { }; |
||
957 | Point middle = new Point(AllControl.PathData.Bounds.X + AllControl.PathData.Bounds.Width * 0.5, |
||
958 | AllControl.PathData.Bounds.Y + |
||
959 | AllControl.PathData.Bounds.Height * 0.5); |
||
960 | foreach (Point pt in AllControl.PointSet) |
||
961 | { |
||
962 | newPointSet.Add(pt); |
||
963 | } |
||
964 | var ReverseP = (i + newPointSet.Count() / 2) % newPointSet.Count(); |
||
965 | var PreviousP = (i + (newPointSet.Count() - 1)) % newPointSet.Count(); |
||
966 | var NextP = (i + 1) % newPointSet.Count(); |
||
967 | var distance = MathSet.DistanceTo(newPointSet[ReverseP], newPointSet[i]); |
||
968 | var PreviousV = MathSet.GetNormVectorBetween(newPointSet[ReverseP], newPointSet[PreviousP]); |
||
969 | var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, newPointSet[i].X - newPointSet[ReverseP].X, |
||
970 | newPointSet[i].Y - newPointSet[ReverseP].Y); |
||
971 | newPointSet[PreviousP] = new Point(newPointSet[ReverseP].X + PreviousV.X * l, newPointSet[ReverseP].Y |
||
972 | + PreviousV.Y * l); |
||
973 | |||
974 | var NextV = MathSet.GetNormVectorBetween(newPointSet[ReverseP], newPointSet[NextP]); |
||
975 | l = MathSet.DotProduct(NextV.X, NextV.Y, newPointSet[i].X - newPointSet[ReverseP].X, newPointSet[i].Y |
||
976 | - newPointSet[ReverseP].Y); |
||
977 | newPointSet[NextP] = new Point(newPointSet[ReverseP].X + NextV.X * l, newPointSet[ReverseP].Y + NextV.Y * l); |
||
978 | |||
979 | AllControl.PointSet = newPointSet; |
||
980 | DynamicThumbUpdate(control); |
||
981 | AllControl.updateControl(); |
||
982 | BorderUpdate(); |
||
983 | } |
||
984 | break; |
||
985 | #endregion |
||
986 | #region ArrowText |
||
987 | case ControlType.ArrowTextControl: |
||
988 | if (nearPoint.Equals(AllControl.PointSet[i])) |
||
989 | { |
||
990 | 9b7cda70 | KangIngu | |
991 | List<Point> GetPointSet = (control.DrawingData as ArrowTextControl).PointSet; |
||
992 | |||
993 | if ((GetPointSet[0].X > GetPointSet[1].X && e.HorizontalChange > 0) || (GetPointSet[0].X < GetPointSet[1].X && e.HorizontalChange < 0)) |
||
994 | { |
||
995 | GetPointSet[1] = new Point(GetPointSet[1].X + e.HorizontalChange, GetPointSet[1].Y); |
||
996 | } |
||
997 | if ((GetPointSet[0].Y > GetPointSet[1].Y && e.VerticalChange > 0) || (GetPointSet[0].Y < GetPointSet[1].Y && e.VerticalChange < 0)) |
||
998 | { |
||
999 | GetPointSet[1] = new Point(GetPointSet[1].X, GetPointSet[1].Y + e.VerticalChange); |
||
1000 | } |
||
1001 | (control.DrawingData as ArrowTextControl).PointSet[1] = GetPointSet[1]; |
||
1002 | |||
1003 | |||
1004 | 29010418 | ljiyeon | //System.Diagnostics.Debug.WriteLine("MidPoint : " + (control.DrawingData as ArrowTextControl).MidPoint); |
1005 | //System.Diagnostics.Debug.WriteLine("HorizontalChange : " + e.HorizontalChange); |
||
1006 | //System.Diagnostics.Debug.WriteLine("VerticalChange : " + e.VerticalChange); |
||
1007 | 9b7cda70 | KangIngu | |
1008 | 787a4489 | KangIngu | AllControl.PointSet[i] = setPoint; |
1009 | 29010418 | ljiyeon | //System.Diagnostics.Debug.WriteLine("PointSet : " + AllControl.PointSet[i]); |
1010 | 53880c83 | ljiyeon | |
1011 | 787a4489 | KangIngu | AllControl.updateControl(); |
1012 | |||
1013 | DynamicThumbUpdate(control); |
||
1014 | BorderUpdate(); |
||
1015 | 29010418 | ljiyeon | |
1016 | 787a4489 | KangIngu | } |
1017 | break; |
||
1018 | #endregion |
||
1019 | #region Text |
||
1020 | case ControlType.TextControl: |
||
1021 | break; |
||
1022 | #endregion |
||
1023 | #region Image |
||
1024 | case ControlType.ImgControl: |
||
1025 | if (nearPoint.Equals(AllControl.PointSet[i])) |
||
1026 | { |
||
1027 | AllControl.PointSet[i] = setPoint; |
||
1028 | var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count(); |
||
1029 | var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count(); |
||
1030 | var NextP = (i + 1) % AllControl.PointSet.Count(); |
||
1031 | |||
1032 | var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]); |
||
1033 | |||
1034 | var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]); |
||
1035 | var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, |
||
1036 | AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y); |
||
1037 | AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet |
||
1038 | [ReverseP].Y |
||
1039 | + PreviousV.Y * l); |
||
1040 | |||
1041 | var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]); |
||
1042 | l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet |
||
1043 | [i].Y - AllControl.PointSet[ReverseP].Y); |
||
1044 | AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y + |
||
1045 | NextV.Y * l); |
||
1046 | AllControl.updateControl(); |
||
1047 | DynamicThumbUpdate(control); |
||
1048 | BorderUpdate(); |
||
1049 | } |
||
1050 | break; |
||
1051 | #endregion |
||
1052 | #region Sign |
||
1053 | case ControlType.Sign: |
||
1054 | if (nearPoint.Equals(AllControl.PointSet[i])) |
||
1055 | { |
||
1056 | AllControl.PointSet[i] = setPoint; |
||
1057 | var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count(); |
||
1058 | var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count(); |
||
1059 | var NextP = (i + 1) % AllControl.PointSet.Count(); |
||
1060 | |||
1061 | var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]); |
||
1062 | |||
1063 | var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]); |
||
1064 | var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, |
||
1065 | AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y); |
||
1066 | AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet |
||
1067 | [ReverseP].Y |
||
1068 | + PreviousV.Y * l); |
||
1069 | |||
1070 | var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]); |
||
1071 | l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet |
||
1072 | [i].Y - AllControl.PointSet[ReverseP].Y); |
||
1073 | AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y + |
||
1074 | NextV.Y * l); |
||
1075 | AllControl.updateControl(); |
||
1076 | DynamicThumbUpdate(control); |
||
1077 | BorderUpdate(); |
||
1078 | } |
||
1079 | break; |
||
1080 | #endregion |
||
1081 | #region Cloud |
||
1082 | case ControlType.PolygonCloud: |
||
1083 | if (nearPoint.Equals(AllControl.PointSet[i])) |
||
1084 | { |
||
1085 | AllControl.PointSet[i] = setPoint; |
||
1086 | AllControl.updateControl(); |
||
1087 | ((ICloudControl)AllControl).DrawingCloud(); |
||
1088 | BorderUpdate(); |
||
1089 | } |
||
1090 | break; |
||
1091 | #endregion |
||
1092 | #region SymBol |
||
1093 | case ControlType.Symbol: |
||
1094 | if (nearPoint.Equals(AllControl.PointSet[i])) |
||
1095 | { |
||
1096 | AllControl.PointSet[i] = setPoint; |
||
1097 | var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count(); |
||
1098 | var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count(); |
||
1099 | var NextP = (i + 1) % AllControl.PointSet.Count(); |
||
1100 | |||
1101 | var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]); |
||
1102 | |||
1103 | var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]); |
||
1104 | var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, |
||
1105 | AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y); |
||
1106 | AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet |
||
1107 | [ReverseP].Y |
||
1108 | + PreviousV.Y * l); |
||
1109 | |||
1110 | var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]); |
||
1111 | l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet |
||
1112 | [i].Y - AllControl.PointSet[ReverseP].Y); |
||
1113 | AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y + |
||
1114 | NextV.Y * l); |
||
1115 | AllControl.updateControl(); |
||
1116 | DynamicThumbUpdate(control); |
||
1117 | BorderUpdate(); |
||
1118 | } |
||
1119 | break; |
||
1120 | case ControlType.Stamp: |
||
1121 | if (nearPoint.Equals(AllControl.PointSet[i])) |
||
1122 | { |
||
1123 | AllControl.PointSet[i] = setPoint; |
||
1124 | var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count(); |
||
1125 | var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count(); |
||
1126 | var NextP = (i + 1) % AllControl.PointSet.Count(); |
||
1127 | |||
1128 | var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]); |
||
1129 | |||
1130 | var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]); |
||
1131 | var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, |
||
1132 | AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y); |
||
1133 | AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet |
||
1134 | [ReverseP].Y |
||
1135 | + PreviousV.Y * l); |
||
1136 | |||
1137 | var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]); |
||
1138 | l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet |
||
1139 | [i].Y - AllControl.PointSet[ReverseP].Y); |
||
1140 | AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y + |
||
1141 | NextV.Y * l); |
||
1142 | AllControl.updateControl(); |
||
1143 | DynamicThumbUpdate(control); |
||
1144 | BorderUpdate(); |
||
1145 | } |
||
1146 | break; |
||
1147 | case ControlType.Date: |
||
1148 | if (nearPoint.Equals(AllControl.PointSet[i])) |
||
1149 | { |
||
1150 | AllControl.PointSet[i] = setPoint; |
||
1151 | var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count(); |
||
1152 | var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count(); |
||
1153 | var NextP = (i + 1) % AllControl.PointSet.Count(); |
||
1154 | |||
1155 | var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]); |
||
1156 | |||
1157 | var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]); |
||
1158 | var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, |
||
1159 | AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y); |
||
1160 | AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet |
||
1161 | [ReverseP].Y |
||
1162 | + PreviousV.Y * l); |
||
1163 | |||
1164 | var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]); |
||
1165 | l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet |
||
1166 | [i].Y - AllControl.PointSet[ReverseP].Y); |
||
1167 | AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y + |
||
1168 | NextV.Y * l); |
||
1169 | AllControl.updateControl(); |
||
1170 | DynamicThumbUpdate(control); |
||
1171 | BorderUpdate(); |
||
1172 | } |
||
1173 | 53880c83 | ljiyeon | break; |
1174 | 787a4489 | KangIngu | #endregion |
1175 | #region Ink |
||
1176 | case ControlType.Ink: |
||
1177 | if (nearPoint.Equals(AllControl.PointSet[i])) |
||
1178 | { |
||
1179 | AllControl.PointSet[i] = setPoint; |
||
1180 | AllControl.updateControl(); |
||
1181 | BorderUpdate(); |
||
1182 | } |
||
1183 | break; |
||
1184 | #endregion |
||
1185 | default: |
||
1186 | break; |
||
1187 | } |
||
1188 | } |
||
1189 | } |
||
1190 | //} |
||
1191 | } |
||
1192 | |||
1193 | |||
1194 | |||
1195 | #endregion |
||
1196 | #region 이벤트 |
||
1197 | |||
1198 | void tm_DragCompleted(object sender, DragCompletedEventArgs e) |
||
1199 | { |
||
1200 | this.isDragging = false; |
||
1201 | DraggerThumb = null; |
||
1202 | |||
1203 | d128ceb2 | humkyung | var comments = (from drawing in this.MemberSet |
1204 | select drawing.DrawingData as CommentUserInfo).ToList(); |
||
1205 | f816dd63 | humkyung | UndoCommand.Instance.Push(comments, this.AngleValue); |
1206 | 787a4489 | KangIngu | } |
1207 | |||
1208 | ec052e41 | humkyung | /// <summary> |
1209 | /// start drag |
||
1210 | /// </summary> |
||
1211 | /// <param name="sender"></param> |
||
1212 | /// <param name="e"></param> |
||
1213 | 787a4489 | KangIngu | void tm_DragStarted(object sender, DragStartedEventArgs e) |
1214 | { |
||
1215 | this.DraggerThumb = sender as Thumb; |
||
1216 | this.isDragging = true; |
||
1217 | |||
1218 | if (ViewerDataModel.Instance.UndoDataList == null) |
||
1219 | { |
||
1220 | return; |
||
1221 | } |
||
1222 | |||
1223 | ec052e41 | humkyung | if ((null != ViewerDataModel.Instance.UndoDataList.LastOrDefault()) && (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Event == Event_Type.Thumb)) |
1224 | 787a4489 | KangIngu | { |
1225 | return; |
||
1226 | } |
||
1227 | |||
1228 | ec052e41 | humkyung | if ((null != ViewerDataModel.Instance.UndoDataList.LastOrDefault()) && (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List != null)) |
1229 | 787a4489 | KangIngu | { |
1230 | if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.Count > 0) |
||
1231 | { |
||
1232 | if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.FirstOrDefault().PointSet != null) |
||
1233 | { |
||
1234 | return; |
||
1235 | } |
||
1236 | } |
||
1237 | } |
||
1238 | |||
1239 | d128ceb2 | humkyung | var comments = (from drawing in this.MemberSet |
1240 | select drawing.DrawingData as CommentUserInfo).ToList(); |
||
1241 | f816dd63 | humkyung | UndoCommand.Instance.Push(comments, this.AngleValue); |
1242 | 787a4489 | KangIngu | } |
1243 | |||
1244 | private void rotate_MouseMove(object sender, MouseEventArgs e) |
||
1245 | { |
||
1246 | if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "TextControl") |
||
1247 | { |
||
1248 | if (LastRotateVerticalValue < e.GetPosition(this).X) |
||
1249 | IsTextAngle = true; |
||
1250 | else |
||
1251 | IsTextAngle = false; |
||
1252 | LastRotateVerticalValue = e.GetPosition(this).X; |
||
1253 | } |
||
1254 | 9f473fb7 | KangIngu | else |
1255 | 53880c83 | ljiyeon | { |
1256 | 9f473fb7 | KangIngu | if (e.GetPosition(this).X > LastRotateHorizontalValue) |
1257 | { |
||
1258 | RotateFlag = true; |
||
1259 | } |
||
1260 | else |
||
1261 | { |
||
1262 | RotateFlag = false; |
||
1263 | } |
||
1264 | LastRotateHorizontalValue = e.GetPosition(this).X; |
||
1265 | } |
||
1266 | 787a4489 | KangIngu | } |
1267 | |||
1268 | private void DragThumb_DragDelta(object sender, DragDeltaEventArgs e) |
||
1269 | { |
||
1270 | eb2b9248 | KangIngu | DragThumb.Cursor = Cursors.SizeAll; |
1271 | 787a4489 | KangIngu | Thumb thumb = sender as Thumb; |
1272 | MoveAdorner(e); |
||
1273 | } |
||
1274 | eb2b9248 | KangIngu | |
1275 | 787a4489 | KangIngu | public void MoveAdorner(DragDeltaEventArgs e) |
1276 | { |
||
1277 | Point dragDelta = new Point(e.HorizontalChange, e.VerticalChange); |
||
1278 | |||
1279 | Dispatcher.BeginInvoke((Action)(() => |
||
1280 | { |
||
1281 | foreach (var item in MemberSet) |
||
1282 | { |
||
1283 | #region 라인 & 아크 |
||
1284 | 40b3ce25 | ljiyeon | if (item.Drawingtype == ControlType.SingleLine || item.Drawingtype == ControlType.ArcLine || item.Drawingtype == ControlType.ArrowMultiLine || item.Drawingtype == ControlType.ArcArrow) |
1285 | 787a4489 | KangIngu | { |
1286 | DynamicThumbUpdate(e, item); |
||
1287 | } |
||
1288 | #endregion |
||
1289 | #region 지시선화살표 |
||
1290 | if (item.Drawingtype == ControlType.ArrowTextControl) |
||
1291 | { |
||
1292 | DynamicThumbUpdate(e, item); |
||
1293 | } |
||
1294 | #endregion |
||
1295 | 53880c83 | ljiyeon | |
1296 | 787a4489 | KangIngu | #region 써클 |
1297 | if (item.Drawingtype == ControlType.Circle || item.Drawingtype == ControlType.Sign || item.Drawingtype == ControlType.Symbol || item.Drawingtype == ControlType.Stamp) |
||
1298 | { |
||
1299 | DynamicThumbUpdate(e, item); |
||
1300 | } |
||
1301 | #endregion |
||
1302 | #region 쉐이프 |
||
1303 | if (item.Drawingtype == ControlType.Rectangle || item.Drawingtype == ControlType.ImgControl || item.Drawingtype == ControlType.RectCloud || item.Drawingtype == ControlType.Triangle) |
||
1304 | { |
||
1305 | DynamicThumbUpdate(e, item); |
||
1306 | } |
||
1307 | #endregion |
||
1308 | #region 텍스트 |
||
1309 | if (item.Drawingtype == ControlType.TextControl) |
||
1310 | 6707a5c7 | ljiyeon | { |
1311 | 1066bae3 | ljiyeon | //DynamicThumbUpdate(e, item); |
1312 | e6a9ddaf | humkyung | (item.DrawingData as TextControl).Move(e.HorizontalChange, e.VerticalChange); |
1313 | 787a4489 | KangIngu | } |
1314 | #endregion |
||
1315 | #region 날짜 |
||
1316 | if (item.Drawingtype == ControlType.Date) |
||
1317 | { |
||
1318 | 53880c83 | ljiyeon | DynamicThumbUpdate(e, item); |
1319 | 787a4489 | KangIngu | } |
1320 | #endregion |
||
1321 | #region 클라우드 |
||
1322 | if (item.Drawingtype == ControlType.PolygonCloud) |
||
1323 | { |
||
1324 | ICloudControl temp = ((ICloudControl)item.DrawingData); |
||
1325 | DynamicThumbUpdate(e, item); |
||
1326 | temp.DrawingCloud(); |
||
1327 | } |
||
1328 | #endregion |
||
1329 | 9b7cda70 | KangIngu | #region 심볼 |
1330 | 53880c83 | ljiyeon | |
1331 | 9b7cda70 | KangIngu | #endregion |
1332 | 53880c83 | ljiyeon | |
1333 | 787a4489 | KangIngu | #region 폴리곤 |
1334 | if (item.Drawingtype == ControlType.PolygonControl) |
||
1335 | { |
||
1336 | DynamicThumbUpdate(e, item); |
||
1337 | BorderUpdate(); |
||
1338 | } |
||
1339 | #endregion |
||
1340 | #region 잉크 |
||
1341 | if (item.Drawingtype == ControlType.Ink) |
||
1342 | { |
||
1343 | Point px = new Point(e.HorizontalChange, e.VerticalChange); |
||
1344 | List<StylusPointSet> StylusPointSet = (item.DrawingData as InkControl).PointC; |
||
1345 | for (int i = 0; i < StylusPointSet.Count; i++) |
||
1346 | { |
||
1347 | List<Point> lstPoint = StylusPointSet[i].pointSet; |
||
1348 | for (int j = 0; j < lstPoint.Count; j++) |
||
1349 | { |
||
1350 | lstPoint[j] = new Point(lstPoint[j].X + px.X, lstPoint[j].Y + px.Y); |
||
1351 | } |
||
1352 | } |
||
1353 | |||
1354 | for (int i = 0; i < item.ThumbList.Count; i++) |
||
1355 | { |
||
1356 | Canvas.SetLeft(item.ThumbList[i], Canvas.GetLeft(item.ThumbList[i]) + px.X); |
||
1357 | Canvas.SetTop(item.ThumbList[i], Canvas.GetTop(item.ThumbList[i]) + px.Y); |
||
1358 | } |
||
1359 | (item.DrawingData as IPath).updateControl(); |
||
1360 | BorderUpdate(); |
||
1361 | |||
1362 | } |
||
1363 | #endregion |
||
1364 | BorderUpdate(); |
||
1365 | } |
||
1366 | })); |
||
1367 | } |
||
1368 | eb2b9248 | KangIngu | |
1369 | 787a4489 | KangIngu | public void DynamicThumbUpdate(DragDeltaEventArgs e, AdornerMember item) |
1370 | { |
||
1371 | var AllControl = item.DrawingData as IPath; |
||
1372 | List<Point> point = AllControl.PointSet; |
||
1373 | for (int i = 0; i < item.ThumbList.Count(); i++) |
||
1374 | { |
||
1375 | if (item.DrawingData.GetType().Name == "ArrowTextControl") |
||
1376 | { |
||
1377 | Point dx = MathSet.RotateAbout(new Point(0, 0), new Point(e.HorizontalChange, e.VerticalChange), trRotate.Angle); |
||
1378 | AllControl.PointSet[i] = new Point { X = point[i].X + dx.X, Y = point[i].Y + dx.Y }; |
||
1379 | AllControl.updateControl(); |
||
1380 | Canvas.SetLeft(item.ThumbList[i], Canvas.GetLeft(item.ThumbList[i]) + dx.X); |
||
1381 | Canvas.SetTop(item.ThumbList[i], Canvas.GetTop(item.ThumbList[i]) + dx.Y); |
||
1382 | |||
1383 | Canvas.SetLeft(item.ThumbList.Last(), Canvas.GetLeft((item.DrawingData as ArrowTextControl).Base_TextBox)); |
||
1384 | Canvas.SetTop(item.ThumbList.Last(), Canvas.GetTop((item.DrawingData as ArrowTextControl).Base_TextBox)); |
||
1385 | } |
||
1386 | else |
||
1387 | { |
||
1388 | Point dx = MathSet.RotateAbout(new Point(0, 0), new Point(e.HorizontalChange, e.VerticalChange), trRotate.Angle); |
||
1389 | AllControl.PointSet[i] = new Point { X = point[i].X + dx.X, Y = point[i].Y + dx.Y }; |
||
1390 | AllControl.updateControl(); |
||
1391 | Canvas.SetLeft(item.ThumbList[i], Canvas.GetLeft(item.ThumbList[i]) + dx.X); |
||
1392 | Canvas.SetTop(item.ThumbList[i], Canvas.GetTop(item.ThumbList[i]) + dx.Y); |
||
1393 | } |
||
1394 | } |
||
1395 | } |
||
1396 | eb2b9248 | KangIngu | |
1397 | 787a4489 | KangIngu | public void DynamicThumbUpdate(AdornerMember item) |
1398 | { |
||
1399 | var AllControl = item.DrawingData as IPath; |
||
1400 | List<Point> point = AllControl.PointSet; |
||
1401 | |||
1402 | for (int i = 0; i < AllControl.PointSet.Count(); i++) |
||
1403 | { |
||
1404 | |||
1405 | Canvas.SetLeft(item.ThumbList[i], AllControl.PointSet[i].X); |
||
1406 | Canvas.SetTop(item.ThumbList[i], AllControl.PointSet[i].Y); |
||
1407 | } |
||
1408 | |||
1409 | |||
1410 | if (item.DrawingData as ArrowTextControl != null) |
||
1411 | { |
||
1412 | if (!(item.DrawingData as ArrowTextControl).isTrans) //trans가 True인경우 |
||
1413 | { |
||
1414 | List<Point> ps = new List<Point>(); |
||
1415 | 53880c83 | ljiyeon | |
1416 | 787a4489 | KangIngu | var temp = item.DrawingData as ArrowTextControl; |
1417 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단 |
||
1418 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단 |
||
1419 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단 |
||
1420 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //우단 |
||
1421 | |||
1422 | |||
1423 | |||
1424 | if (temp.isFixed) |
||
1425 | { |
||
1426 | var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
||
1427 | var testP = endP; |
||
1428 | if (ps[0] == endP) //상단 |
||
1429 | { |
||
1430 | testP = new Point(endP.X, endP.Y - 50); |
||
1431 | 6c781c0c | djkim | //System.Diagnostics.Debug.WriteLine("상단"); |
1432 | 787a4489 | KangIngu | } |
1433 | else if (ps[1] == endP) //하단 |
||
1434 | { |
||
1435 | testP = new Point(endP.X, endP.Y + 50); |
||
1436 | 6c781c0c | djkim | //System.Diagnostics.Debug.WriteLine("하단"); |
1437 | 787a4489 | KangIngu | } |
1438 | else if (ps[2] == endP) //좌단 |
||
1439 | { |
||
1440 | testP = new Point(endP.X - 50, endP.Y); |
||
1441 | 6c781c0c | djkim | //System.Diagnostics.Debug.WriteLine("좌단"); |
1442 | 787a4489 | KangIngu | } |
1443 | else if (ps[3] == endP) //우단 |
||
1444 | { |
||
1445 | testP = new Point(endP.X + 50, endP.Y); |
||
1446 | 6c781c0c | djkim | //System.Diagnostics.Debug.WriteLine("우단"); |
1447 | 787a4489 | KangIngu | } |
1448 | Canvas.SetLeft((MemberSet.First() as AdornerMember).ThumbList[1], testP.X); |
||
1449 | Canvas.SetTop((MemberSet.First() as AdornerMember).ThumbList[1], testP.Y); |
||
1450 | } |
||
1451 | else |
||
1452 | { |
||
1453 | var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
||
1454 | var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP); |
||
1455 | Canvas.SetLeft((MemberSet.First() as AdornerMember).ThumbList[1], tempP.X); |
||
1456 | Canvas.SetTop((MemberSet.First() as AdornerMember).ThumbList[1], tempP.Y); |
||
1457 | } |
||
1458 | } |
||
1459 | } |
||
1460 | //} |
||
1461 | } |
||
1462 | |||
1463 | public void Set_Rotate() |
||
1464 | { |
||
1465 | |||
1466 | double dDeltaAngle = 0; |
||
1467 | List<Point> AllPointSet = new List<Point>(); |
||
1468 | Point CenterPoint = new Point(); |
||
1469 | |||
1470 | |||
1471 | if (AngleValue >= 360) |
||
1472 | { |
||
1473 | AngleValue -= 360; |
||
1474 | } |
||
1475 | else if (AngleValue <= -360) |
||
1476 | { |
||
1477 | AngleValue += 360; |
||
1478 | } |
||
1479 | |||
1480 | #region 센터 포인트 구하기 (그룹핑) |
||
1481 | foreach (var item in MemberSet) |
||
1482 | { |
||
1483 | if (item.DrawingData.GetType().Name == "TextControl") |
||
1484 | { |
||
1485 | } |
||
1486 | else |
||
1487 | { |
||
1488 | foreach (Point itemP in (item.DrawingData as IPath).PointSet) |
||
1489 | { |
||
1490 | AllPointSet.Add(itemP); |
||
1491 | } |
||
1492 | } |
||
1493 | } |
||
1494 | #endregion |
||
1495 | |||
1496 | CenterPoint = MathSet.FindCentroid(AllPointSet); |
||
1497 | |||
1498 | Dispatcher.BeginInvoke((Action)(() => |
||
1499 | { |
||
1500 | foreach (var item in MemberSet) |
||
1501 | { |
||
1502 | foreach (var thumb in item.ThumbList) |
||
1503 | { |
||
1504 | double x = Canvas.GetLeft(thumb); |
||
1505 | double y = Canvas.GetTop(thumb); |
||
1506 | |||
1507 | Point value = MathSet.RotateAbout(CenterPoint, new Point(x, y), dDeltaAngle); |
||
1508 | Canvas.SetLeft(thumb, value.X); |
||
1509 | Canvas.SetTop(thumb, value.Y); |
||
1510 | |||
1511 | if (item.DrawingData.GetType().Name == "ArrowTextControl" && thumb == item.ThumbList.Last()) |
||
1512 | { |
||
1513 | |||
1514 | Canvas.SetLeft(thumb, Canvas.GetLeft((item.DrawingData as ArrowTextControl).Base_TextBox)); |
||
1515 | Canvas.SetTop(thumb, Canvas.GetTop((item.DrawingData as ArrowTextControl).Base_TextBox)); |
||
1516 | if (!(item.DrawingData as ArrowTextControl).isTrans) |
||
1517 | { |
||
1518 | List<Point> ps = new List<Point>(); |
||
1519 | var temp = (MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl; |
||
1520 | switch (Math.Abs(temp.Angle).ToString()) |
||
1521 | { |
||
1522 | case "90": |
||
1523 | { |
||
1524 | ps.Clear(); |
||
1525 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽 |
||
1526 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); // 위 중간 |
||
1527 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); // 위 오른쪽 |
||
1528 | |||
1529 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 중간 |
||
1530 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 하단 |
||
1531 | |||
1532 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); //중간 하단 |
||
1533 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 하단 |
||
1534 | |||
1535 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 중간 |
||
1536 | } |
||
1537 | break; |
||
1538 | case "270": |
||
1539 | { |
||
1540 | ps.Clear(); |
||
1541 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽 |
||
1542 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); // 위 중간 |
||
1543 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); // 위 오른쪽 |
||
1544 | |||
1545 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 중간 |
||
1546 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 하단 |
||
1547 | |||
1548 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); //중간 하단 |
||
1549 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 하단 |
||
1550 | |||
1551 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 중간 |
||
1552 | } |
||
1553 | break; |
||
1554 | default: |
||
1555 | { |
||
1556 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단 |
||
1557 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단 |
||
1558 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단 |
||
1559 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //우단 |
||
1560 | } |
||
1561 | break; |
||
1562 | } |
||
1563 | |||
1564 | var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
||
1565 | var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP); |
||
1566 | Canvas.SetLeft((MemberSet.First() as AdornerMember).ThumbList[1], tempP.X); |
||
1567 | Canvas.SetTop((MemberSet.First() as AdornerMember).ThumbList[1], tempP.Y); |
||
1568 | } |
||
1569 | } |
||
1570 | } |
||
1571 | |||
1572 | for (int i = 0; i < (item.DrawingData as IPath).PointSet.Count(); i++) |
||
1573 | { |
||
1574 | (item.DrawingData as IPath).PointSet[i] = MathSet.RotateAbout(CenterPoint, (item.DrawingData as IPath).PointSet[i], dDeltaAngle); |
||
1575 | } |
||
1576 | } |
||
1577 | #region 컨트롤 업데이트 |
||
1578 | foreach (var item in MemberSet) |
||
1579 | { |
||
1580 | switch (item.Drawingtype) |
||
1581 | { |
||
1582 | case ControlType.TextControl: |
||
1583 | ((TextControl)item.DrawingData).Angle = AngleValue; |
||
1584 | 53880c83 | ljiyeon | |
1585 | 787a4489 | KangIngu | RectangleGeometry Data = new RectangleGeometry |
1586 | { |
||
1587 | Rect = new Rect() |
||
1588 | { |
||
1589 | X = Canvas.GetLeft((item.DrawingData as TextControl)), |
||
1590 | Y = Canvas.GetTop((item.DrawingData as TextControl)), |
||
1591 | Width = (item.DrawingData as TextControl).Base_TextBlock.ActualWidth / 2, |
||
1592 | Height = (item.DrawingData as TextControl).Base_TextBlock.ActualHeight / 2, |
||
1593 | } |
||
1594 | }; |
||
1595 | 53880c83 | ljiyeon | |
1596 | 787a4489 | KangIngu | Point endPointV = new Point(Data.Bounds.Right, Data.Bounds.Bottom); |
1597 | 29010418 | ljiyeon | Point middle = MathSet.getMiddlePoint((item.DrawingData as TextControl).StartPoint, endPointV); |
1598 | 787a4489 | KangIngu | |
1599 | DragThumb.RenderTransformOrigin = new Point(0.0, 0.0); |
||
1600 | DragThumb.RenderTransform = new RotateTransform() |
||
1601 | { |
||
1602 | Angle = (item.DrawingData as TextControl).Angle, |
||
1603 | 53880c83 | ljiyeon | |
1604 | 787a4489 | KangIngu | }; |
1605 | |||
1606 | AdornerBorder.RenderTransformOrigin = new Point(0.0, 0.0); |
||
1607 | AdornerBorder.RenderTransform = new RotateTransform() |
||
1608 | { |
||
1609 | Angle = (item.DrawingData as TextControl).Angle, |
||
1610 | 53880c83 | ljiyeon | |
1611 | 787a4489 | KangIngu | }; |
1612 | |||
1613 | (item.DrawingData as TextControl).Base_Grid.RenderTransform = new RotateTransform() |
||
1614 | { |
||
1615 | Angle = (item.DrawingData as TextControl).Angle, |
||
1616 | }; |
||
1617 | BorderUpdate(); |
||
1618 | break; |
||
1619 | 53880c83 | ljiyeon | |
1620 | case ControlType.Date: |
||
1621 | 787a4489 | KangIngu | ((DateControl)item.DrawingData).Angle = AngleValue; |
1622 | (item.DrawingData as IPath).updateControl(); |
||
1623 | 53880c83 | ljiyeon | BorderUpdate(); |
1624 | 787a4489 | KangIngu | break; |
1625 | case ControlType.ArrowMultiLine: |
||
1626 | case ControlType.ArcLine: |
||
1627 | 40b3ce25 | ljiyeon | case ControlType.ArcArrow: |
1628 | 787a4489 | KangIngu | case ControlType.SingleLine: |
1629 | case ControlType.Triangle: |
||
1630 | (item.DrawingData as IPath).updateControl(); |
||
1631 | BorderUpdate(); |
||
1632 | break; |
||
1633 | case ControlType.ArrowTextControl: |
||
1634 | (item.DrawingData as IPath).updateControl(); |
||
1635 | BorderUpdate(); |
||
1636 | break; |
||
1637 | case ControlType.RectCloud: |
||
1638 | ((RectCloudControl)item.DrawingData).Angle = AngleValue; |
||
1639 | (item.DrawingData as IPath).updateControl(); |
||
1640 | BorderUpdate(); |
||
1641 | break; |
||
1642 | case ControlType.Rectangle: |
||
1643 | ((RectangleControl)item.DrawingData).Angle = AngleValue; |
||
1644 | (item.DrawingData as IPath).updateControl(); |
||
1645 | BorderUpdate(); |
||
1646 | break; |
||
1647 | case ControlType.ImgControl: |
||
1648 | ((ImgControl)item.DrawingData).Angle = AngleValue; |
||
1649 | (item.DrawingData as IPath).updateControl(); |
||
1650 | BorderUpdate(); |
||
1651 | 53880c83 | ljiyeon | break; |
1652 | 787a4489 | KangIngu | case ControlType.Sign: |
1653 | ((SignControl)item.DrawingData).Angle = AngleValue; |
||
1654 | (item.DrawingData as IPath).updateControl(); |
||
1655 | BorderUpdate(); |
||
1656 | break; |
||
1657 | case ControlType.Symbol: |
||
1658 | ((SymControl)item.DrawingData).Angle = AngleValue; |
||
1659 | (item.DrawingData as IPath).updateControl(); |
||
1660 | BorderUpdate(); |
||
1661 | break; |
||
1662 | case ControlType.Stamp: |
||
1663 | ((SymControlN)item.DrawingData).Angle = AngleValue; |
||
1664 | (item.DrawingData as IPath).updateControl(); |
||
1665 | BorderUpdate(); |
||
1666 | break; |
||
1667 | case ControlType.PolygonControl: |
||
1668 | (item.DrawingData as IPath).updateControl(); |
||
1669 | BorderUpdate(); |
||
1670 | break; |
||
1671 | case ControlType.PolygonCloud: |
||
1672 | ((ICloudControl)item.DrawingData).DrawingCloud(); |
||
1673 | (item.DrawingData as IPath).updateControl(); |
||
1674 | BorderUpdate(); |
||
1675 | break; |
||
1676 | case ControlType.Circle: |
||
1677 | ((IShapeControl)item.DrawingData).Angle = AngleValue; |
||
1678 | (item.DrawingData as IPath).updateControl(); |
||
1679 | ((CircleControl)item.DrawingData).SetCenterXY(); |
||
1680 | BorderUpdate(); |
||
1681 | break; |
||
1682 | case ControlType.Ink: |
||
1683 | (item.DrawingData as IPath).updateControl(); |
||
1684 | BorderUpdate(); |
||
1685 | break; |
||
1686 | 684ef11c | ljiyeon | case ControlType.InsideWhite: |
1687 | ((InsideWhiteControl)item.DrawingData).Angle = AngleValue; |
||
1688 | (item.DrawingData as IPath).updateControl(); |
||
1689 | BorderUpdate(); |
||
1690 | break; |
||
1691 | case ControlType.OverlapWhite: |
||
1692 | ((OverlapWhiteControl)item.DrawingData).Angle = AngleValue; |
||
1693 | (item.DrawingData as IPath).updateControl(); |
||
1694 | BorderUpdate(); |
||
1695 | break; |
||
1696 | case ControlType.ClipWhite: |
||
1697 | ((ClipWhiteControl)item.DrawingData).Angle = AngleValue; |
||
1698 | (item.DrawingData as IPath).updateControl(); |
||
1699 | BorderUpdate(); |
||
1700 | break; |
||
1701 | case ControlType.Coordinate: |
||
1702 | ((CoordinateControl)item.DrawingData).Angle = AngleValue; |
||
1703 | (item.DrawingData as IPath).updateControl(); |
||
1704 | BorderUpdate(); |
||
1705 | break; |
||
1706 | 787a4489 | KangIngu | default: |
1707 | break; |
||
1708 | } |
||
1709 | } |
||
1710 | #endregion |
||
1711 | })); |
||
1712 | } |
||
1713 | |||
1714 | private void resize_MouseMove(object sender, MouseEventArgs e) |
||
1715 | { |
||
1716 | 53880c83 | ljiyeon | reSizePoint = e.GetPosition(this); |
1717 | 787a4489 | KangIngu | } |
1718 | /// <summary> |
||
1719 | /// 회전 |
||
1720 | /// </summary> |
||
1721 | /// <param name="sender"></param> |
||
1722 | /// <param name="e"></param> |
||
1723 | public void rotate_DragDelta(object sender, DragDeltaEventArgs e) |
||
1724 | { |
||
1725 | 9b7cda70 | KangIngu | |
1726 | 787a4489 | KangIngu | MoveRotate(e); |
1727 | } |
||
1728 | |||
1729 | double LastRotateHorizontalValue = 0; |
||
1730 | double LastRotateVerticalValue = 0; |
||
1731 | 53880c83 | ljiyeon | //double LastWidthValue = 0; |
1732 | //double SetWidth = 0; |
||
1733 | 9f473fb7 | KangIngu | bool RotateFlag = false; |
1734 | |||
1735 | 992a98b4 | KangIngu | /// <summary> |
1736 | /// <history>humkyung 2018.05.09 upgrade rotate shape peformance</history> |
||
1737 | /// </summary> |
||
1738 | /// <param name="e"></param> |
||
1739 | 787a4489 | KangIngu | public void MoveRotate(DragDeltaEventArgs e) |
1740 | { |
||
1741 | double dDeltaAngle = 0; |
||
1742 | |||
1743 | List<Point> AllPointSet = new List<Point>(); |
||
1744 | Point CenterPoint = new Point(); |
||
1745 | 29010418 | ljiyeon | |
1746 | 787a4489 | KangIngu | #region 센터 포인트 구하기 (그룹핑) |
1747 | foreach (var item in MemberSet) |
||
1748 | { |
||
1749 | if (item.DrawingData.GetType().Name == "TextControl") |
||
1750 | 29010418 | ljiyeon | { |
1751 | 9b7cda70 | KangIngu | if (AngleValue == 0) |
1752 | { |
||
1753 | AngleValue = (item.DrawingData as TextControl).Angle; |
||
1754 | } |
||
1755 | double X = Canvas.GetLeft((item.DrawingData as TextControl)); |
||
1756 | double Y = Canvas.GetTop((item.DrawingData as TextControl)); |
||
1757 | AllPointSet.Add(new Point(X, Y)); |
||
1758 | 787a4489 | KangIngu | } |
1759 | else |
||
1760 | { |
||
1761 | foreach (Point itemP in (item.DrawingData as IPath).PointSet) |
||
1762 | { |
||
1763 | AllPointSet.Add(itemP); |
||
1764 | } |
||
1765 | } |
||
1766 | } |
||
1767 | #endregion |
||
1768 | CenterPoint = MathSet.FindCentroid(AllPointSet); |
||
1769 | 992a98b4 | KangIngu | Point pt = Mouse.GetPosition(this); |
1770 | |||
1771 | Point vec1 = new Point(this.rotatePoint.X - CenterPoint.X, this.rotatePoint.Y - CenterPoint.Y); |
||
1772 | Point vec2 = new Point(pt.X - CenterPoint.X, pt.Y - CenterPoint.Y); |
||
1773 | dDeltaAngle = (MathSet.getAngleBetweenVectors(vec1, vec2)); |
||
1774 | |||
1775 | 3797ff05 | djkim | //System.Diagnostics.Debug.WriteLine("vec1 : " + vec1.X + "/" + vec1.Y); |
1776 | //System.Diagnostics.Debug.WriteLine("vec2 : " + vec2.X + "/" + vec2.Y); |
||
1777 | //System.Diagnostics.Debug.WriteLine("dDeltaAngle : " + dDeltaAngle); |
||
1778 | 9b7cda70 | KangIngu | |
1779 | 992a98b4 | KangIngu | AngleValue += dDeltaAngle; |
1780 | if (AngleValue > 360) AngleValue -= 360; |
||
1781 | if (AngleValue < 0) AngleValue += 360; |
||
1782 | this.rotatePoint = pt; /// save rotatePoint |
||
1783 | 787a4489 | KangIngu | |
1784 | Dispatcher.BeginInvoke((Action)(() => |
||
1785 | { |
||
1786 | foreach (var item in MemberSet) |
||
1787 | { |
||
1788 | foreach (var thumb in item.ThumbList) |
||
1789 | { |
||
1790 | double x = Canvas.GetLeft(thumb); |
||
1791 | double y = Canvas.GetTop(thumb); |
||
1792 | |||
1793 | Point value = MathSet.RotateAbout(CenterPoint, new Point(x, y), dDeltaAngle); |
||
1794 | Canvas.SetLeft(thumb, value.X); |
||
1795 | 53880c83 | ljiyeon | Canvas.SetTop(thumb, value.Y); |
1796 | 787a4489 | KangIngu | } |
1797 | |||
1798 | for (int i = 0; i < (item.DrawingData as IPath).PointSet.Count(); i++) |
||
1799 | { |
||
1800 | (item.DrawingData as IPath).PointSet[i] = MathSet.RotateAbout(CenterPoint, (item.DrawingData as IPath).PointSet[i], dDeltaAngle); |
||
1801 | } |
||
1802 | } |
||
1803 | 992a98b4 | KangIngu | #region 보더 업데이트 |
1804 | 787a4489 | KangIngu | foreach (var item in MemberSet) |
1805 | { |
||
1806 | switch (item.Drawingtype) |
||
1807 | { |
||
1808 | case ControlType.TextControl: |
||
1809 | ((TextControl)item.DrawingData).Angle = AngleValue; |
||
1810 | 53880c83 | ljiyeon | |
1811 | 787a4489 | KangIngu | RectangleGeometry Data = new RectangleGeometry |
1812 | { |
||
1813 | Rect = new Rect() |
||
1814 | { |
||
1815 | X = Canvas.GetLeft((item.DrawingData as TextControl)), |
||
1816 | Y = Canvas.GetTop((item.DrawingData as TextControl)), |
||
1817 | Width = (item.DrawingData as TextControl).Base_TextBlock.ActualWidth / 2, |
||
1818 | Height = (item.DrawingData as TextControl).Base_TextBlock.ActualHeight / 2, |
||
1819 | } |
||
1820 | }; |
||
1821 | 53880c83 | ljiyeon | |
1822 | 787a4489 | KangIngu | Point endPointV = new Point(Data.Bounds.Right, Data.Bounds.Bottom); |
1823 | Point middle = MathSet.getMiddlePoint((item.DrawingData as TextControl).StartPoint, endPointV); |
||
1824 | 53880c83 | ljiyeon | |
1825 | 9b7cda70 | KangIngu | DragThumb.RenderTransformOrigin = new Point(0, 0); |
1826 | 787a4489 | KangIngu | DragThumb.RenderTransform = new RotateTransform() |
1827 | { |
||
1828 | Angle = (item.DrawingData as TextControl).Angle, |
||
1829 | //CenterX = middle.X, |
||
1830 | //CenterY = middle.Y, |
||
1831 | }; |
||
1832 | |||
1833 | 9b7cda70 | KangIngu | AdornerBorder.RenderTransformOrigin = new Point(0, 0); |
1834 | 787a4489 | KangIngu | AdornerBorder.RenderTransform = new RotateTransform() |
1835 | { |
||
1836 | Angle = (item.DrawingData as TextControl).Angle, |
||
1837 | //CenterX = middle.X, |
||
1838 | //CenterY = middle.Y, |
||
1839 | }; |
||
1840 | |||
1841 | (item.DrawingData as TextControl).Base_Grid.RenderTransform = new RotateTransform() |
||
1842 | { |
||
1843 | Angle = (item.DrawingData as TextControl).Angle, |
||
1844 | }; |
||
1845 | |||
1846 | BorderUpdate(); |
||
1847 | break; |
||
1848 | 53880c83 | ljiyeon | |
1849 | 787a4489 | KangIngu | case ControlType.Date: |
1850 | ((DateControl)item.DrawingData).Angle = AngleValue; |
||
1851 | (item.DrawingData as IPath).updateControl(); |
||
1852 | 29010418 | ljiyeon | BorderUpdate(); |
1853 | 787a4489 | KangIngu | break; |
1854 | case ControlType.ArrowMultiLine: |
||
1855 | case ControlType.ArcLine: |
||
1856 | 40b3ce25 | ljiyeon | case ControlType.ArcArrow: |
1857 | 787a4489 | KangIngu | case ControlType.SingleLine: |
1858 | case ControlType.Triangle: |
||
1859 | (item.DrawingData as IPath).updateControl(); |
||
1860 | BorderUpdate(); |
||
1861 | break; |
||
1862 | case ControlType.ArrowTextControl: |
||
1863 | (item.DrawingData as IPath).updateControl(); |
||
1864 | BorderUpdate(); |
||
1865 | break; |
||
1866 | case ControlType.RectCloud: |
||
1867 | ((RectCloudControl)item.DrawingData).Angle = AngleValue; |
||
1868 | (item.DrawingData as IPath).updateControl(); |
||
1869 | BorderUpdate(); |
||
1870 | break; |
||
1871 | case ControlType.Rectangle: |
||
1872 | ((RectangleControl)item.DrawingData).Angle = AngleValue; |
||
1873 | (item.DrawingData as IPath).updateControl(); |
||
1874 | BorderUpdate(); |
||
1875 | break; |
||
1876 | case ControlType.ImgControl: |
||
1877 | ((ImgControl)item.DrawingData).Angle = AngleValue; |
||
1878 | (item.DrawingData as IPath).updateControl(); |
||
1879 | BorderUpdate(); |
||
1880 | 29010418 | ljiyeon | break; |
1881 | 787a4489 | KangIngu | case ControlType.Sign: |
1882 | ((SignControl)item.DrawingData).Angle = AngleValue; |
||
1883 | (item.DrawingData as IPath).updateControl(); |
||
1884 | BorderUpdate(); |
||
1885 | 29010418 | ljiyeon | break; |
1886 | 787a4489 | KangIngu | case ControlType.Symbol: |
1887 | ((SymControl)item.DrawingData).Angle = AngleValue; |
||
1888 | (item.DrawingData as IPath).updateControl(); |
||
1889 | BorderUpdate(); |
||
1890 | break; |
||
1891 | case ControlType.Stamp: |
||
1892 | ((SymControlN)item.DrawingData).Angle = AngleValue; |
||
1893 | (item.DrawingData as IPath).updateControl(); |
||
1894 | BorderUpdate(); |
||
1895 | break; |
||
1896 | case ControlType.PolygonControl: |
||
1897 | (item.DrawingData as IPath).updateControl(); |
||
1898 | BorderUpdate(); |
||
1899 | break; |
||
1900 | case ControlType.PolygonCloud: |
||
1901 | ((ICloudControl)item.DrawingData).DrawingCloud(); |
||
1902 | (item.DrawingData as IPath).updateControl(); |
||
1903 | BorderUpdate(); |
||
1904 | break; |
||
1905 | case ControlType.Circle: |
||
1906 | ((IShapeControl)item.DrawingData).Angle = AngleValue; |
||
1907 | (item.DrawingData as IPath).updateControl(); |
||
1908 | ((CircleControl)item.DrawingData).SetCenterXY(); |
||
1909 | BorderUpdate(); |
||
1910 | break; |
||
1911 | case ControlType.Ink: |
||
1912 | for (int i = 0; i < (item.DrawingData as InkControl).PointC.Count(); i++) |
||
1913 | { |
||
1914 | for (int j = 0; j < (item.DrawingData as InkControl).PointC[i].pointSet.Count; j++) |
||
1915 | { |
||
1916 | (item.DrawingData as InkControl).PointC[i].pointSet[j] = MathSet.RotateAbout(CenterPoint, (item.DrawingData as InkControl).PointC[i].pointSet[j], dDeltaAngle); |
||
1917 | } |
||
1918 | } |
||
1919 | (item.DrawingData as IPath).updateControl(); |
||
1920 | BorderUpdate(); |
||
1921 | break; |
||
1922 | 29010418 | ljiyeon | |
1923 | 787a4489 | KangIngu | default: |
1924 | break; |
||
1925 | } |
||
1926 | } |
||
1927 | #endregion |
||
1928 | })); |
||
1929 | BorderUpdate(); |
||
1930 | } |
||
1931 | eb2b9248 | KangIngu | |
1932 | 787a4489 | KangIngu | private void rotate_DragStarted(object sender, DragStartedEventArgs e) |
1933 | 29010418 | ljiyeon | { |
1934 | 9b7cda70 | KangIngu | |
1935 | 992a98b4 | KangIngu | this.rotatePoint = Mouse.GetPosition(this); /// 2018.05.09 added by humkyung |
1936 | eb2b9248 | KangIngu | rotateTop.Cursor = Cursors.SizeAll; |
1937 | |||
1938 | 992a98b4 | KangIngu | /// get angle from text controls' angle if only text control exists - 2018.05.10 added by humkyung |
1939 | if ((1 == MemberSet.Count) && (MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "TextControl") |
||
1940 | { |
||
1941 | this.AngleValue = ((MemberSet.First() as AdornerMember).DrawingData as TextControl).Angle; |
||
1942 | } |
||
1943 | /// up to here |
||
1944 | |||
1945 | 9b7cda70 | KangIngu | |
1946 | |||
1947 | 01cbc243 | KangIngu | if (ViewerDataModel.Instance.UndoDataList == null) |
1948 | 787a4489 | KangIngu | { |
1949 | return; |
||
1950 | } |
||
1951 | |||
1952 | d128ceb2 | humkyung | if ((ViewerDataModel.Instance.UndoDataList.Count > 0) && ViewerDataModel.Instance.UndoDataList.LastOrDefault().Event == Event_Type.Thumb) |
1953 | 787a4489 | KangIngu | { |
1954 | return; |
||
1955 | } |
||
1956 | d128ceb2 | humkyung | |
1957 | if ((ViewerDataModel.Instance.UndoDataList.Count > 0) && ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List != null) |
||
1958 | 787a4489 | KangIngu | { |
1959 | if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.Count > 0) |
||
1960 | { |
||
1961 | if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.FirstOrDefault().PointSet != null) |
||
1962 | { |
||
1963 | return; |
||
1964 | } |
||
1965 | } |
||
1966 | } |
||
1967 | |||
1968 | d128ceb2 | humkyung | var comments = (from drawing in this.MemberSet |
1969 | select drawing.DrawingData as CommentUserInfo).ToList(); |
||
1970 | f816dd63 | humkyung | UndoCommand.Instance.Push(comments, this.AngleValue); |
1971 | 787a4489 | KangIngu | } |
1972 | 29010418 | ljiyeon | |
1973 | 787a4489 | KangIngu | private void rotate_DragCompleted(object sender, DragCompletedEventArgs e) |
1974 | { |
||
1975 | ca16abb2 | ljiyeon | rotateTop.Cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
1976 | d128ceb2 | humkyung | |
1977 | var comments = (from drawing in this.MemberSet |
||
1978 | select drawing.DrawingData as CommentUserInfo).ToList(); |
||
1979 | f816dd63 | humkyung | UndoCommand.Instance.Push(comments, this.AngleValue); |
1980 | 787a4489 | KangIngu | } |
1981 | |||
1982 | private void drag_DragStarted(object sender, DragStartedEventArgs e) |
||
1983 | { |
||
1984 | if (ViewerDataModel.Instance.UndoDataList == null) |
||
1985 | { |
||
1986 | return; |
||
1987 | } |
||
1988 | 5bffa106 | humkyung | if ((null != ViewerDataModel.Instance.UndoDataList.LastOrDefault()) && (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Event == Event_Type.Thumb)) |
1989 | 787a4489 | KangIngu | { |
1990 | return; |
||
1991 | } |
||
1992 | 5bffa106 | humkyung | if ((null != ViewerDataModel.Instance.UndoDataList.LastOrDefault()) && (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List != null)) |
1993 | 787a4489 | KangIngu | { |
1994 | if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.Count > 0) |
||
1995 | { |
||
1996 | if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.FirstOrDefault().PointSet != null) |
||
1997 | { |
||
1998 | return; |
||
1999 | } |
||
2000 | } |
||
2001 | } |
||
2002 | |||
2003 | d128ceb2 | humkyung | var comments = (from drawing in this.MemberSet |
2004 | select drawing.DrawingData as CommentUserInfo).ToList(); |
||
2005 | f816dd63 | humkyung | UndoCommand.Instance.Push(comments, this.AngleValue); |
2006 | 787a4489 | KangIngu | } |
2007 | |||
2008 | private void drag_DragCompleted(object sender, DragCompletedEventArgs e) |
||
2009 | 29010418 | ljiyeon | { |
2010 | ca16abb2 | ljiyeon | DragThumb.Cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
2011 | eb2b9248 | KangIngu | |
2012 | d128ceb2 | humkyung | var comments = (from drawing in this.MemberSet |
2013 | select drawing.DrawingData as CommentUserInfo).ToList(); |
||
2014 | f816dd63 | humkyung | UndoCommand.Instance.Push(comments, this.AngleValue); |
2015 | 787a4489 | KangIngu | } |
2016 | |||
2017 | public void ControlPointMouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
||
2018 | { |
||
2019 | AdornerMember control = MemberSet.FirstOrDefault(); |
||
2020 | |||
2021 | if ((control.DrawingData as ArrowTextControl) != null && DraggerThumb == null) |
||
2022 | { |
||
2023 | if ((control.DrawingData as ArrowTextControl).isTrans == false && (control.DrawingData as ArrowTextControl).isFixed == false) |
||
2024 | { |
||
2025 | (control.DrawingData as ArrowTextControl).isTrans = true; |
||
2026 | } |
||
2027 | } |
||
2028 | |||
2029 | } |
||
2030 | eb2b9248 | KangIngu | |
2031 | 787a4489 | KangIngu | public void TextControlChanger() |
2032 | { |
||
2033 | if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "TextControl") |
||
2034 | { |
||
2035 | TextControl AllControl = (MemberSet.First() as AdornerMember).DrawingData as TextControl; |
||
2036 | AllControl.Base_TextBox.Focus(); |
||
2037 | AllControl.Base_TextBox.Visibility = Visibility.Visible; |
||
2038 | AllControl.Base_TextBlock.Visibility = Visibility.Collapsed; |
||
2039 | AllControl.Base_TextBox.Focus(); |
||
2040 | AllControl.SizeChanged += (sen, ea) => |
||
2041 | { |
||
2042 | if (AllControl.Base_TextBox != null) |
||
2043 | { |
||
2044 | RectangleGeometry Data = new RectangleGeometry |
||
2045 | { |
||
2046 | Rect = new Rect() |
||
2047 | { |
||
2048 | X = AllControl.StartPoint.X, |
||
2049 | Y = AllControl.StartPoint.Y, |
||
2050 | Width = AllControl.Base_TextBox.Width, |
||
2051 | Height = AllControl.Base_TextBox.Height, |
||
2052 | } |
||
2053 | }; |
||
2054 | |||
2055 | Point endPointV = new Point(Data.Bounds.Right, Data.Bounds.Bottom); |
||
2056 | Point middle = MathSet.getMiddlePoint(AllControl.StartPoint, endPointV); |
||
2057 | AllControl.Base_Grid.RenderTransform = new RotateTransform() |
||
2058 | { |
||
2059 | Angle = AllControl.Angle, |
||
2060 | CenterX = middle.X, |
||
2061 | CenterY = middle.Y, |
||
2062 | }; |
||
2063 | } |
||
2064 | BorderUpdate(); |
||
2065 | }; |
||
2066 | } |
||
2067 | } |
||
2068 | eb2b9248 | KangIngu | |
2069 | 787a4489 | KangIngu | private void RectThumb_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) //더블클릭 |
2070 | { |
||
2071 | if (e.ClickCount == 2 && MemberSet.Count == 1) |
||
2072 | { |
||
2073 | |||
2074 | if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "TextControl") |
||
2075 | { |
||
2076 | 29010418 | ljiyeon | TextControlChanger(); |
2077 | 787a4489 | KangIngu | } |
2078 | |||
2079 | else if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "ArrowTextControl") |
||
2080 | { |
||
2081 | ArrowTextControl AllControl = (MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl; |
||
2082 | Thumb tm = (MemberSet.First() as AdornerMember).ThumbList.Last(); |
||
2083 | ((ArrowTextControl)AllControl).Base_TextBox.Focus(); |
||
2084 | |||
2085 | 3797ff05 | djkim | //ArrowControl TextBox Thumb없애기 |
2086 | 787a4489 | KangIngu | tm.Visibility = Visibility.Collapsed; |
2087 | |||
2088 | ((MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl).Base_TextBox.IsHitTestVisible = true; |
||
2089 | 29010418 | ljiyeon | |
2090 | 787a4489 | KangIngu | ((ArrowTextControl)AllControl).Base_TextBox.SizeChanged += (sen, ea) => |
2091 | |||
2092 | { |
||
2093 | tm.Width = (AllControl as ArrowTextControl).BoxWidth; |
||
2094 | tm.Height = (AllControl as ArrowTextControl).BoxHeight; |
||
2095 | |||
2096 | List<Point> ps = new List<Point>(); |
||
2097 | 29010418 | ljiyeon | |
2098 | 787a4489 | KangIngu | ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth / 2, Canvas.GetTop(AllControl.Base_TextBox))); //상단 |
2099 | ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth / 2, Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight)); // 하단 |
||
2100 | ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox), Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight / 2)); //좌단 |
||
2101 | ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth, Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight / 2)); //우단 |
||
2102 | |||
2103 | |||
2104 | |||
2105 | |||
2106 | var endP = MathSet.getNearPoint(ps, AllControl.MidPoint); |
||
2107 | var tempP = MathSet.getMiddlePoint(AllControl.StartPoint, endP); |
||
2108 | if (AllControl.isTrans) |
||
2109 | { |
||
2110 | Canvas.SetLeft((MemberSet.First() as AdornerMember).ThumbList[1], AllControl.MidPoint.X); |
||
2111 | Canvas.SetTop((MemberSet.First() as AdornerMember).ThumbList[1], AllControl.MidPoint.Y); |
||
2112 | } |
||
2113 | else |
||
2114 | { |
||
2115 | Canvas.SetLeft((MemberSet.First() as AdornerMember).ThumbList[1], tempP.X); |
||
2116 | Canvas.SetTop((MemberSet.First() as AdornerMember).ThumbList[1], tempP.Y); |
||
2117 | } |
||
2118 | |||
2119 | 9b7cda70 | KangIngu | |
2120 | 787a4489 | KangIngu | BorderUpdate(); |
2121 | 9b7cda70 | KangIngu | |
2122 | 787a4489 | KangIngu | }; |
2123 | } |
||
2124 | else if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "DateControl") |
||
2125 | { |
||
2126 | DateControl data = (MemberSet.First() as AdornerMember).DrawingData as DateControl; |
||
2127 | CalendarControl instanceCal = new CalendarControl(data.Text); |
||
2128 | //dropData.IsOpen = true; |
||
2129 | RadWindow rc = new RadWindow(); |
||
2130 | rc.Width = 300; |
||
2131 | rc.Height = 300; |
||
2132 | rc.Header = "Change Date"; |
||
2133 | rc.Content = instanceCal; |
||
2134 | rc.BorderThickness = new Thickness(3); |
||
2135 | rc.ResizeMode = ResizeMode.NoResize; |
||
2136 | rc.WindowStartupLocation = WindowStartupLocation.CenterScreen; |
||
2137 | rc.ModalBackground = new SolidColorBrush(Colors.Black); |
||
2138 | rc.ModalBackground.Opacity = 0.6; |
||
2139 | Telerik.Windows.Controls.StyleManager.SetTheme(rc, new Telerik.Windows.Controls.Windows8Theme()); |
||
2140 | instanceCal.changeDateCal.SelectionChanged += (sen, ea) => |
||
2141 | { |
||
2142 | data.Text = instanceCal.changeDateCal.SelectedDate.Value.ToShortDateString(); |
||
2143 | rc.Close(); |
||
2144 | }; |
||
2145 | rc.ShowDialog(); |
||
2146 | //CalendarControl.xaml |
||
2147 | } |
||
2148 | else if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "ArcControl") |
||
2149 | { |
||
2150 | ArcControl instance = ((MemberSet.First() as AdornerMember).DrawingData as ArcControl); |
||
2151 | if (instance.isTransOn) |
||
2152 | { |
||
2153 | instance.isTransOn = false; |
||
2154 | } |
||
2155 | else |
||
2156 | { |
||
2157 | instance.isTransOn = true; |
||
2158 | } |
||
2159 | 661b7416 | humkyung | ///instance.SetArcPath(); |
2160 | 787a4489 | KangIngu | BorderUpdate(); |
2161 | } |
||
2162 | 40b3ce25 | ljiyeon | else if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "ArrowArcControl") |
2163 | { |
||
2164 | ArrowArcControl instance = ((MemberSet.First() as AdornerMember).DrawingData as ArrowArcControl); |
||
2165 | if (instance.isTransOn) |
||
2166 | { |
||
2167 | instance.isTransOn = false; |
||
2168 | } |
||
2169 | else |
||
2170 | { |
||
2171 | instance.isTransOn = true; |
||
2172 | } |
||
2173 | instance.SetArcPath(); |
||
2174 | BorderUpdate(); |
||
2175 | } |
||
2176 | 787a4489 | KangIngu | |
2177 | } |
||
2178 | 29010418 | ljiyeon | |
2179 | 787a4489 | KangIngu | } |
2180 | #endregion |
||
2181 | |||
2182 | private void DragThumb_MouseDoubleClick(object sender, MouseButtonEventArgs e) |
||
2183 | { |
||
2184 | if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "TextControl" || (MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "ArrowTextControl") |
||
2185 | { |
||
2186 | DragThumb.Visibility = Visibility.Collapsed; |
||
2187 | 9b7cda70 | KangIngu | } |
2188 | 787a4489 | KangIngu | } |
2189 | |||
2190 | } |
||
2191 | } |