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