markus / KCOM / Controls / AdornerFinal.xaml.cs @ e2d3d2dc
이력 | 보기 | 이력해설 | 다운로드 (80.8 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 | 105359ce | ljiyeon | using MarkupToPDF.Controls.Parsing; |
9 | 787a4489 | KangIngu | using MarkupToPDF.Controls.Polygon; |
10 | using MarkupToPDF.Controls.Shape; |
||
11 | using MarkupToPDF.Controls.Text; |
||
12 | using System; |
||
13 | using System.Collections.Generic; |
||
14 | 53880c83 | ljiyeon | using System.Diagnostics; |
15 | 787a4489 | KangIngu | using System.Linq; |
16 | using System.Text; |
||
17 | 8e5a4a6a | taeseongkim | using System.Threading.Tasks; |
18 | 787a4489 | KangIngu | using System.Windows; |
19 | using System.Windows.Controls; |
||
20 | using System.Windows.Controls.Primitives; |
||
21 | using System.Windows.Input; |
||
22 | using System.Windows.Media; |
||
23 | using Telerik.Windows.Controls; |
||
24 | |||
25 | namespace KCOM.Controls |
||
26 | { |
||
27 | f513c215 | humkyung | public class MyThumb : Thumb |
28 | { |
||
29 | public MyThumb() |
||
30 | { |
||
31 | this.Opacity = 0.6; |
||
32 | this.MouseEnter += MyThumb_MouseEnter; |
||
33 | this.MouseLeave += MyThumb_MouseLeave; |
||
34 | } |
||
35 | |||
36 | /// <summary> |
||
37 | d2114d3b | humkyung | /// translate thumb with given delta and angle |
38 | /// </summary> |
||
39 | /// <param name="e"></param> |
||
40 | /// <param name="angle"></param> |
||
41 | 3dbace4e | taeseongkim | public void Translate_old(double dx, double dy, double angle) |
42 | d2114d3b | humkyung | { |
43 | double radian = angle * Math.PI / 180; |
||
44 | double cos = Math.Cos(radian); |
||
45 | double sin = Math.Sin(radian); |
||
46 | |||
47 | 0d00f9c8 | humkyung | double _dx = dx * cos - dy * sin; |
48 | double _dy = dx * sin + dy * cos; |
||
49 | 3dbace4e | taeseongkim | |
50 | 0d00f9c8 | humkyung | Canvas.SetLeft(this, Canvas.GetLeft(this) + _dx); |
51 | Canvas.SetTop(this, Canvas.GetTop(this) + _dy); |
||
52 | d2114d3b | humkyung | } |
53 | |||
54 | 3dbace4e | taeseongkim | public void Translate(double dx, double dy, double angle) |
55 | { |
||
56 | var ratotePoint = MathHelper.RotatePoint(new Point(dx, dy), new Point(), angle); |
||
57 | |||
58 | Canvas.SetLeft(this, Canvas.GetLeft(this) + ratotePoint.X); |
||
59 | Canvas.SetTop(this, Canvas.GetTop(this) + ratotePoint.Y); |
||
60 | } |
||
61 | |||
62 | |||
63 | d2114d3b | humkyung | /// <summary> |
64 | f513c215 | humkyung | /// </summary> |
65 | /// <param name="sender"></param> |
||
66 | /// <param name="e"></param> |
||
67 | private void MyThumb_MouseLeave(object sender, MouseEventArgs e) |
||
68 | { |
||
69 | this.Opacity = 0.6; |
||
70 | } |
||
71 | |||
72 | /// <summary> |
||
73 | /// |
||
74 | /// </summary> |
||
75 | /// <param name="sender"></param> |
||
76 | /// <param name="e"></param> |
||
77 | private void MyThumb_MouseEnter(object sender, MouseEventArgs e) |
||
78 | { |
||
79 | this.Opacity = 1.0; |
||
80 | } |
||
81 | } |
||
82 | |||
83 | 787a4489 | KangIngu | /// <summary> |
84 | /// Interaction logic for AdornerFinal.xaml |
||
85 | /// </summary> |
||
86 | public class AdornerMember |
||
87 | { |
||
88 | public UIElement DrawingData { get; set; } |
||
89 | public ControlType Drawingtype { get; set; } |
||
90 | public double DrawingAngle { get; set; } |
||
91 | f513c215 | humkyung | public List<MyThumb> ThumbList { get; set; } |
92 | c8e9b3e4 | ljiyeon | public string Symbol_ID { get; set; } |
93 | 53880c83 | ljiyeon | public long Group_ID { get; set; } |
94 | 508c3ac5 | humkyung | |
95 | /// <summary> |
||
96 | /// update thumb |
||
97 | /// </summary> |
||
98 | public void UpdateThumb() |
||
99 | { |
||
100 | var path = this.DrawingData as IPath; |
||
101 | for (int i = 0; i < path.PointSet.Count; ++i) |
||
102 | { |
||
103 | Canvas.SetLeft(this.ThumbList[i], path.PointSet[i].X); |
||
104 | Canvas.SetTop(this.ThumbList[i], path.PointSet[i].Y); |
||
105 | } |
||
106 | |||
107 | if (this.DrawingData as ArrowTextControl != null) |
||
108 | { |
||
109 | if (!(this.DrawingData as ArrowTextControl).isTrans) //trans가 True인경우 |
||
110 | { |
||
111 | List<Point> ps = new List<Point>(); |
||
112 | |||
113 | var temp = this.DrawingData as ArrowTextControl; |
||
114 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단 |
||
115 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단 |
||
116 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단 |
||
117 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //우단 |
||
118 | |||
119 | if (temp.isFixed) |
||
120 | { |
||
121 | var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
||
122 | var testP = endP; |
||
123 | if (ps[0] == endP) //상단 |
||
124 | { |
||
125 | testP = new Point(endP.X, endP.Y - 50); |
||
126 | } |
||
127 | else if (ps[1] == endP) //하단 |
||
128 | { |
||
129 | testP = new Point(endP.X, endP.Y + 50); |
||
130 | } |
||
131 | else if (ps[2] == endP) //좌단 |
||
132 | { |
||
133 | testP = new Point(endP.X - 50, endP.Y); |
||
134 | } |
||
135 | else if (ps[3] == endP) //우단 |
||
136 | { |
||
137 | testP = new Point(endP.X + 50, endP.Y); |
||
138 | } |
||
139 | Canvas.SetLeft(this.ThumbList[1], testP.X); |
||
140 | Canvas.SetTop(this.ThumbList[1], testP.Y); |
||
141 | } |
||
142 | else |
||
143 | { |
||
144 | var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
||
145 | var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP); |
||
146 | Canvas.SetLeft(this.ThumbList[1], tempP.X); |
||
147 | Canvas.SetTop(this.ThumbList[1], tempP.Y); |
||
148 | } |
||
149 | } |
||
150 | } |
||
151 | } |
||
152 | 554aae3b | humkyung | |
153 | /// <summary> |
||
154 | /// rotate members about given position and angle |
||
155 | /// </summary> |
||
156 | /// <param name="at"></param> |
||
157 | /// <param name="angle">in degree</param> |
||
158 | public void RotateAbout(Point at, double angle) |
||
159 | { |
||
160 | for (int i = 0; i < (this.DrawingData as IPath).PointSet.Count; i++) |
||
161 | { |
||
162 | (this.DrawingData as IPath).PointSet[i] = MathSet.RotateAbout(at, (this.DrawingData as IPath).PointSet[i], angle); |
||
163 | } |
||
164 | (this.DrawingData as CommentUserInfo).UpdateControl(); |
||
165 | |||
166 | this.UpdateThumb(); |
||
167 | } |
||
168 | 787a4489 | KangIngu | } |
169 | 4913851c | humkyung | |
170 | 787a4489 | KangIngu | public partial class AdornerFinal : UserControl |
171 | { |
||
172 | public TextBox editTextBox { get; set; } |
||
173 | #region 공용 인스턴스 |
||
174 | 4913851c | humkyung | public List<AdornerMember> Members { get; } = new List<AdornerMember>(); |
175 | 787a4489 | KangIngu | public Dictionary<Thumb, DragData> _dragData = new Dictionary<Thumb, DragData>(); |
176 | b643fcca | taeseongkim | |
177 | edef7af2 | humkyung | private List<double> AlignedAngles {get;} = new List<double>() { 0, 30, 45, 60, 90, 120, 135, 150, 180, 210, 225, 240, 270, 300, 315, 330, 360 }; |
178 | |||
179 | b643fcca | taeseongkim | private double angleValue; |
180 | |||
181 | public double AngleValue { get => angleValue; |
||
182 | set |
||
183 | { |
||
184 | if(angleValue != value) |
||
185 | { |
||
186 | angleValue = value; |
||
187 | } |
||
188 | } |
||
189 | } |
||
190 | |||
191 | |||
192 | 787a4489 | KangIngu | public bool IsTextAngle = false; |
193 | public Rect BorderSize { get; set; } |
||
194 | public bool TextCompensation = false; |
||
195 | public bool isDragging { get; set; } |
||
196 | public Thumb DraggerThumb { get; set; } |
||
197 | public RadDropDownButton dropData; |
||
198 | public RadCalendar dropCalendar; |
||
199 | public Thumb mainDragThumb { get; set; } |
||
200 | |||
201 | 4913851c | humkyung | private bool disposed; |
202 | |||
203 | 787a4489 | KangIngu | public Point reSizePoint { get; set; } |
204 | 992a98b4 | KangIngu | private Point rotatePoint { get; set; } /// 2018.05.09 added by humkyung |
205 | 0d00f9c8 | humkyung | private Point MouseDownPoint = new Point(); |
206 | private Point CurrentMousePoint = new Point(); |
||
207 | 787a4489 | KangIngu | #endregion |
208 | #region 생성자 |
||
209 | private void RadDropDownButton_Loaded(object sender, RoutedEventArgs e) |
||
210 | { |
||
211 | dropData = sender as RadDropDownButton; |
||
212 | } |
||
213 | 4913851c | humkyung | |
214 | 787a4489 | KangIngu | private void Date_Calendar_Loaded(object sender, RoutedEventArgs e) |
215 | { |
||
216 | dropCalendar = sender as RadCalendar; |
||
217 | dropCalendar.SelectionChanged += (sen, ea) => |
||
218 | { |
||
219 | dropData.IsOpen = false; |
||
220 | 4913851c | humkyung | if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "DateControl") |
221 | 787a4489 | KangIngu | { |
222 | 4913851c | humkyung | DateControl data = (this.Members.First() as AdornerMember).DrawingData as DateControl; |
223 | 787a4489 | KangIngu | data.Text = dropCalendar.SelectedDate.Value.ToShortDateString(); |
224 | } |
||
225 | }; |
||
226 | } |
||
227 | 4913851c | humkyung | |
228 | 787a4489 | KangIngu | public AdornerFinal() |
229 | { |
||
230 | InitializeComponent(); |
||
231 | BorderSize = new Rect(); |
||
232 | _dragData.Add(rotateTop, new DragData() { CursorAngle = 0, DragType = DragType.Rotate, RotateIsLeft = true, RotateIsTop = true }); |
||
233 | 4913851c | humkyung | } |
234 | |||
235 | ~AdornerFinal() |
||
236 | { |
||
237 | this.Dispose(false); |
||
238 | } |
||
239 | |||
240 | public void Dispose() |
||
241 | { |
||
242 | this.Dispose(true); |
||
243 | GC.SuppressFinalize(this); |
||
244 | } |
||
245 | |||
246 | protected virtual void Dispose(bool disposing) |
||
247 | { |
||
248 | if (this.disposed) return; |
||
249 | if (disposing) |
||
250 | { |
||
251 | foreach (var member in this.Members) |
||
252 | { |
||
253 | if(!Common.ViewerDataModel.Instance.MarkupControls_USER.Contains(member.DrawingData)) |
||
254 | Common.ViewerDataModel.Instance.MarkupControls_USER.Add(member.DrawingData as CommentUserInfo); |
||
255 | } |
||
256 | // IDisposable 인터페이스를 구현하는 멤버들을 여기서 정리합니다. |
||
257 | } |
||
258 | // .NET Framework에 의하여 관리되지 않는 외부 리소스들을 여기서 정리합니다. |
||
259 | this.disposed = true; |
||
260 | 787a4489 | KangIngu | } |
261 | |||
262 | void DragThumb_Loaded(object sender, RoutedEventArgs e) |
||
263 | { |
||
264 | mainDragThumb = DragThumb; |
||
265 | } |
||
266 | |||
267 | public AdornerFinal(CommentUserInfo objectData) : this() |
||
268 | { |
||
269 | InitializeComponent(); |
||
270 | objectData.IsHitTestVisible = false; |
||
271 | 1305c420 | taeseongkim | |
272 | 787a4489 | KangIngu | if ((objectData as ArrowTextControl) != null) |
273 | { |
||
274 | (objectData as ArrowTextControl).Base_TextBox.Focusable = true; |
||
275 | } |
||
276 | 1305c420 | taeseongkim | |
277 | 787a4489 | KangIngu | Canvas.SetZIndex(objectData, 84); |
278 | try |
||
279 | { |
||
280 | 05009a0e | ljiyeon | ViewerDataModel.Instance.MarkupControls_USER.Remove(objectData); |
281 | 787a4489 | KangIngu | this.ContainerContent.Children.Add(objectData); |
282 | } |
||
283 | 1066bae3 | ljiyeon | catch (Exception ex) |
284 | 787a4489 | KangIngu | { |
285 | |||
286 | } |
||
287 | 1066bae3 | ljiyeon | |
288 | 787a4489 | KangIngu | SetAdornerMember(objectData as CommentUserInfo); |
289 | this.Focus(); |
||
290 | } |
||
291 | 4913851c | humkyung | |
292 | 9b7cda70 | KangIngu | public AdornerFinal(List<CommentUserInfo> objectData) : this() |
293 | 787a4489 | KangIngu | { |
294 | InitializeComponent(); |
||
295 | foreach (var item in objectData) |
||
296 | { |
||
297 | //item.IsHitTestVisible = false; |
||
298 | if ((item as ArrowTextControl) != null) |
||
299 | { |
||
300 | (item as ArrowTextControl).Base_TextBox.Focusable = true; |
||
301 | } |
||
302 | try |
||
303 | { |
||
304 | a0bab669 | KangIngu | Canvas.SetZIndex(item, 80); |
305 | 05009a0e | ljiyeon | ViewerDataModel.Instance.MarkupControls_USER.Remove(item); |
306 | 787a4489 | KangIngu | this.ContainerContent.Children.Add(item); |
307 | } |
||
308 | 53880c83 | ljiyeon | catch //(Exception ex) |
309 | 787a4489 | KangIngu | { |
310 | } |
||
311 | 1066bae3 | ljiyeon | finally |
312 | { |
||
313 | |||
314 | } |
||
315 | 787a4489 | KangIngu | } |
316 | 4913851c | humkyung | this.SetAdornerMember(objectData); |
317 | 787a4489 | KangIngu | this.Focus(); |
318 | } |
||
319 | |||
320 | 62b6bcde | humkyung | public Point Centeroid |
321 | { |
||
322 | get |
||
323 | { |
||
324 | List<Point> pts = new List<Point>(); |
||
325 | |||
326 | #region 센터 포인트 구하기 (그룹핑) |
||
327 | foreach (var item in this.Members) |
||
328 | { |
||
329 | if (item.DrawingData.GetType().Name == "TextControl") |
||
330 | { |
||
331 | if (AngleValue == 0) |
||
332 | { |
||
333 | fa48eb85 | taeseongkim | AngleValue = (item.DrawingData as TextControl).CommentAngle; |
334 | 62b6bcde | humkyung | } |
335 | double X = Canvas.GetLeft((item.DrawingData as TextControl)); |
||
336 | double Y = Canvas.GetTop((item.DrawingData as TextControl)); |
||
337 | pts.Add(new Point(X, Y)); |
||
338 | } |
||
339 | else |
||
340 | { |
||
341 | pts.AddRange((item.DrawingData as IPath).PointSet); |
||
342 | } |
||
343 | } |
||
344 | #endregion |
||
345 | |||
346 | return MathSet.FindCentroid(pts); |
||
347 | } |
||
348 | } |
||
349 | |||
350 | b643fcca | taeseongkim | #endregion |
351 | #region 메서드 |
||
352 | public Rect getAdornerSize() |
||
353 | 787a4489 | KangIngu | { |
354 | return BorderSize; |
||
355 | } |
||
356 | public void addMemberControl(UIElement objectData) |
||
357 | { |
||
358 | this.ContainerContent.Children.Add(objectData); |
||
359 | SetAdornerMember(objectData as CommentUserInfo); |
||
360 | this.Focus(); |
||
361 | } |
||
362 | 902faaea | taeseongkim | |
363 | private void TextControlLostFocus(object sender,RoutedEventArgs e) |
||
364 | { |
||
365 | TextCompensation = false; |
||
366 | BorderUpdate(); |
||
367 | |||
368 | if (sender is TextBox) |
||
369 | { |
||
370 | if ((sender as TextBox).Text == "") //보류 |
||
371 | { |
||
372 | this.ContainerContent.Children.Remove((sender as TextBox).Parent as MarkupToPDF.Common.CommentUserInfo); |
||
373 | this.Visibility = Visibility.Collapsed; |
||
374 | } |
||
375 | } |
||
376 | } |
||
377 | |||
378 | private void TextControlPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) |
||
379 | { |
||
380 | 24c5e56c | taeseongkim | if (sender is TextControl) |
381 | 902faaea | taeseongkim | { |
382 | TextCompensation = true; |
||
383 | BorderUpdate(); |
||
384 | } |
||
385 | } |
||
386 | |||
387 | private void TextControlSelectionChanged(object sender, RoutedEventArgs e) |
||
388 | { |
||
389 | BorderUpdate(); |
||
390 | } |
||
391 | |||
392 | 787a4489 | KangIngu | /// <summary> |
393 | /// UIElement를 종류에 맞게 등록시킴 |
||
394 | /// </summary> |
||
395 | /// <param name="member">UIElement 타입으로 BaseLayer에 있는 것들이 들어옵니다.</param> |
||
396 | public void SetAdornerMember(MarkupToPDF.Common.CommentUserInfo member) |
||
397 | 53880c83 | ljiyeon | { |
398 | 787a4489 | KangIngu | switch (member.GetType().Name) |
399 | { |
||
400 | #region 컨트롤 조건 |
||
401 | 554aae3b | humkyung | case "LineControl": |
402 | case "PolygonControl": |
||
403 | 787a4489 | KangIngu | case "ArrowControl": |
404 | 554aae3b | humkyung | case "ArcControl": |
405 | case "ArrowArcControl": |
||
406 | case "ArrowControl_Multi": |
||
407 | case "RectangleControl": |
||
408 | case "TriControl": |
||
409 | case "CircleControl": |
||
410 | case "CloudControl": |
||
411 | case "RectCloudControl": |
||
412 | case "InkControl": |
||
413 | case "InsideWhiteControl": |
||
414 | case "OverlapWhiteControl": |
||
415 | case "ClipWhiteControl": |
||
416 | case "CoordinateControl": |
||
417 | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
||
418 | 787a4489 | KangIngu | break; |
419 | case "ArrowTextControl": |
||
420 | 4913851c | humkyung | this.Members.Add(new AdornerMember |
421 | 53880c83 | ljiyeon | { |
422 | DrawingData = member, |
||
423 | Drawingtype = ControlType.ArrowTextControl, |
||
424 | f513c215 | humkyung | ThumbList = new List<MyThumb>(), |
425 | 53880c83 | ljiyeon | Symbol_ID = member.SymbolID, |
426 | Group_ID = member.GroupID, |
||
427 | }); |
||
428 | 787a4489 | KangIngu | (member as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
429 | fa48eb85 | taeseongkim | AngleValue = (member as ArrowTextControl).CommentAngle; |
430 | 902faaea | taeseongkim | |
431 | ((ArrowTextControl)member).Base_TextBox.LostFocus += TextControlLostFocus; |
||
432 | |||
433 | //Observable.FromEventPattern(((ArrowTextControl)member).Base_TextBox, "LostFocus").Subscribe(a => |
||
434 | //{ |
||
435 | // TextCompensation = false; |
||
436 | // BorderUpdate(); |
||
437 | // if ((a.Sender as TextBox).Text == "") //보류 |
||
438 | // { |
||
439 | // this.ContainerContent.Children.Remove(member); |
||
440 | // this.Visibility = Visibility.Collapsed; |
||
441 | // } |
||
442 | //}); |
||
443 | 787a4489 | KangIngu | break; |
444 | 554aae3b | humkyung | case "ImgControl": |
445 | 2d2252ba | ljiyeon | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
446 | fa48eb85 | taeseongkim | AngleValue = (member as ImgControl).CommentAngle; |
447 | 2d2252ba | ljiyeon | break; |
448 | 787a4489 | KangIngu | case "DateControl": |
449 | 2d2252ba | ljiyeon | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
450 | fa48eb85 | taeseongkim | AngleValue = (member as DateControl).CommentAngle; |
451 | 2d2252ba | ljiyeon | break; |
452 | 787a4489 | KangIngu | case "SignControl": |
453 | 2d2252ba | ljiyeon | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
454 | fa48eb85 | taeseongkim | AngleValue = (member as SignControl).CommentAngle; |
455 | 2d2252ba | ljiyeon | break; |
456 | 787a4489 | KangIngu | case "SymControl": |
457 | 2d2252ba | ljiyeon | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
458 | fa48eb85 | taeseongkim | AngleValue = (member as SymControl).CommentAngle; |
459 | 2d2252ba | ljiyeon | break; |
460 | 787a4489 | KangIngu | case "SymControlN": |
461 | 554aae3b | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
462 | fa48eb85 | taeseongkim | AngleValue = (member as SymControlN).CommentAngle; |
463 | 787a4489 | KangIngu | break; |
464 | case "TextControl": |
||
465 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.TextControl, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
466 | 787a4489 | KangIngu | RectangleGeometry Data = new RectangleGeometry |
467 | { |
||
468 | Rect = new Rect() |
||
469 | { |
||
470 | X = Canvas.GetLeft((member as TextControl)), |
||
471 | Y = Canvas.GetTop((member as TextControl)), |
||
472 | Width = (member as TextControl).Base_TextBlock.ActualWidth / 2, |
||
473 | Height = (member as TextControl).Base_TextBlock.ActualHeight / 2, |
||
474 | //Width = (member as TextControl).BoxWidth / 2, |
||
475 | //Height = (member as TextControl).BoxHeight / 2, |
||
476 | } |
||
477 | }; |
||
478 | Point endPointV = new Point(Data.Bounds.Right, Data.Bounds.Bottom); |
||
479 | Point middle = MathSet.getMiddlePoint((member as TextControl).StartPoint, endPointV); |
||
480 | |||
481 | |||
482 | DragThumb.RenderTransformOrigin = new Point(0.0, 0.0); |
||
483 | DragThumb.RenderTransform = new RotateTransform() |
||
484 | { |
||
485 | fa48eb85 | taeseongkim | Angle = (member as TextControl).CommentAngle, |
486 | 9b7cda70 | KangIngu | //CenterX = middle.X, |
487 | //CenterY = middle.Y, |
||
488 | 787a4489 | KangIngu | }; |
489 | |||
490 | AdornerBorder.RenderTransformOrigin = new Point(0.0, 0.0); |
||
491 | AdornerBorder.RenderTransform = new RotateTransform() |
||
492 | { |
||
493 | fa48eb85 | taeseongkim | Angle = (member as TextControl).CommentAngle, |
494 | 9b7cda70 | KangIngu | //CenterX = middle.X, |
495 | //CenterY = middle.Y, |
||
496 | 787a4489 | KangIngu | }; |
497 | 902faaea | taeseongkim | //Observable.FromEventPattern(((TextControl)member), "PropertyChanged").Subscribe(a => |
498 | //{ |
||
499 | // TextCompensation = true; |
||
500 | // BorderUpdate(); |
||
501 | // ((TextControl)member).Base_TextBlock.TextDecorations = ((TextControl)member).UnderLine; |
||
502 | //}); |
||
503 | 9b7cda70 | KangIngu | |
504 | 902faaea | taeseongkim | //Observable.FromEventPattern(((TextControl)member), "PropertyChanged").Subscribe(a => |
505 | //{ |
||
506 | // TextCompensation = true; |
||
507 | // BorderUpdate(); |
||
508 | // ((TextControl)member).Base_TextBlock.TextDecorations = ((TextControl)member).UnderLine; |
||
509 | //}); |
||
510 | |||
511 | ((TextControl)member).PropertyChanged += TextControlPropertyChanged; |
||
512 | ((TextControl)member).Base_TextBox.LostFocus += TextControlLostFocus; |
||
513 | |||
514 | //Observable.FromEventPattern(((TextControl)member).Base_TextBox, "LostFocus").Subscribe(a => |
||
515 | //{ |
||
516 | // TextCompensation = false; |
||
517 | // BorderUpdate(); |
||
518 | // if ((a.Sender as TextBox).Text == "") //보류 |
||
519 | // { |
||
520 | // this.ContainerContent.Children.Remove(member); |
||
521 | // this.Visibility = Visibility.Collapsed; |
||
522 | // } |
||
523 | |||
524 | // //((TextControl)member).UnEditingMode(); |
||
525 | // //((TextControl)member).Base_TextBlock.Visibility = Visibility.Collapsed; |
||
526 | // //((TextControl)member).Base_Border.Visibility = Visibility.Collapsed; |
||
527 | // //((TextControl)member).Base_TextPath.Visibility = Visibility.Collapsed; |
||
528 | //}); |
||
529 | 787a4489 | KangIngu | break; |
530 | default: |
||
531 | break; |
||
532 | #endregion |
||
533 | } |
||
534 | 554aae3b | humkyung | |
535 | 787a4489 | KangIngu | if (member.GetType().Name == "TextControl") |
536 | { |
||
537 | TextControl content = ((TextControl)member); |
||
538 | content.StartPoint = new Point(Canvas.GetLeft(content), Canvas.GetTop(content)); |
||
539 | content.EndPoint = content.StartPoint; |
||
540 | } |
||
541 | else |
||
542 | { |
||
543 | RegistryPoint(member); |
||
544 | } |
||
545 | BorderUpdate(); |
||
546 | 4913851c | humkyung | |
547 | if (Common.ViewerDataModel.Instance.MarkupControls_USER.Contains(member)) Common.ViewerDataModel.Instance.MarkupControls_USER.Remove(member); |
||
548 | 787a4489 | KangIngu | } |
549 | |||
550 | private void ViewBoxRotate(UIElement member) |
||
551 | { |
||
552 | AdornerBorder.RenderTransformOrigin = new Point(0.5, 0.5); |
||
553 | DragThumb.RenderTransformOrigin = new Point(0.5, 0.5); |
||
554 | fa48eb85 | taeseongkim | AdornerBorder.RenderTransform = new RotateTransform() { Angle = (member as IViewBox).CommentAngle }; |
555 | DragThumb.RenderTransform = new RotateTransform() { Angle = (member as IViewBox).CommentAngle }; |
||
556 | 787a4489 | KangIngu | } |
557 | 4913851c | humkyung | |
558 | 787a4489 | KangIngu | public void SetAdornerMember(List<CommentUserInfo> members) |
559 | { |
||
560 | foreach (var member in members) |
||
561 | { |
||
562 | switch (member.GetType().Name) |
||
563 | { |
||
564 | #region 컨트롤 조건 |
||
565 | 53880c83 | ljiyeon | case "LineControl": |
566 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.SingleLine, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
567 | 53880c83 | ljiyeon | break; |
568 | case "ImgControl": |
||
569 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ImgControl, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
570 | 787a4489 | KangIngu | break; |
571 | case "ArrowControl": |
||
572 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowLine, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
573 | 787a4489 | KangIngu | break; |
574 | 53880c83 | ljiyeon | case "PolygonControl": |
575 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.PolygonControl, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
576 | 787a4489 | KangIngu | break; |
577 | case "ArrowTextControl": |
||
578 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowTextControl, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
579 | 787a4489 | KangIngu | (member as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
580 | break; |
||
581 | case "ArcControl": |
||
582 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArcLine, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
583 | 787a4489 | KangIngu | break; |
584 | 40b3ce25 | ljiyeon | case "ArrowArcControl": |
585 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArcArrow, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
586 | 40b3ce25 | ljiyeon | break; |
587 | 787a4489 | KangIngu | case "DateControl": |
588 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Date, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
589 | 787a4489 | KangIngu | break; |
590 | case "ArrowControl_Multi": |
||
591 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowMultiLine, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
592 | 787a4489 | KangIngu | break; |
593 | case "RectangleControl": |
||
594 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Rectangle, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
595 | 787a4489 | KangIngu | break; |
596 | case "TriControl": |
||
597 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Triangle, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
598 | 787a4489 | KangIngu | break; |
599 | case "CircleControl": |
||
600 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Circle, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
601 | 787a4489 | KangIngu | break; |
602 | case "CloudControl": |
||
603 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.PolygonCloud, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
604 | 787a4489 | KangIngu | break; |
605 | case "RectCloudControl": |
||
606 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.RectCloud, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
607 | 787a4489 | KangIngu | break; |
608 | case "SignControl": |
||
609 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Sign, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
610 | 787a4489 | KangIngu | break; |
611 | case "SymControl": |
||
612 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Symbol, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
613 | 787a4489 | KangIngu | break; |
614 | case "SymControlN": |
||
615 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Stamp, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
616 | 787a4489 | KangIngu | break; |
617 | 53880c83 | ljiyeon | case "InkControl": |
618 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Ink, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
619 | 787a4489 | KangIngu | break; |
620 | case "TextControl": |
||
621 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.TextControl, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
622 | 787a4489 | KangIngu | |
623 | 902faaea | taeseongkim | (member as TextControl).PropertyChanged += TextControlPropertyChanged; |
624 | (member as TextControl).Base_TextBox.SelectionChanged += TextControlSelectionChanged; |
||
625 | |||
626 | //Observable.FromEventPattern(((TextControl)member).Base_TextBox, "SelectionChanged").Subscribe(a => |
||
627 | //{ |
||
628 | // BorderUpdate(); |
||
629 | //}); |
||
630 | //Observable.FromEventPattern(((TextControl)member), "PropertyChanged").Subscribe(a => |
||
631 | //{ |
||
632 | // BorderUpdate(); |
||
633 | // try |
||
634 | // { |
||
635 | // ((TextControl)member).Base_TextBlock.TextDecorations = ((TextControl)member).UnderLine; |
||
636 | // } |
||
637 | // catch (Exception) |
||
638 | // { |
||
639 | |||
640 | // } |
||
641 | |||
642 | //}); |
||
643 | //Observable.FromEventPattern(((TextControl)member).Base_TextBox, "SelectionChanged").Subscribe(a => |
||
644 | //{ |
||
645 | // BorderUpdate(); |
||
646 | //}); |
||
647 | 787a4489 | KangIngu | break; |
648 | 684ef11c | ljiyeon | case "InsideWhiteControl": |
649 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.InsideWhite, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
650 | 684ef11c | ljiyeon | break; |
651 | case "OverlapWhiteControl": |
||
652 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.OverlapWhite, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
653 | 684ef11c | ljiyeon | break; |
654 | case "ClipWhiteControl": |
||
655 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ClipWhite, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
656 | 684ef11c | ljiyeon | break; |
657 | case "CoordinateControl": |
||
658 | f513c215 | humkyung | this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Coordinate, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
659 | 684ef11c | ljiyeon | break; |
660 | 787a4489 | KangIngu | default: |
661 | break; |
||
662 | #endregion |
||
663 | } |
||
664 | if (member.GetType().Name == "TextControl") |
||
665 | { |
||
666 | TextControl content = ((TextControl)member); |
||
667 | content.StartPoint = new Point(Canvas.GetLeft(content), Canvas.GetTop(content)); |
||
668 | content.EndPoint = content.StartPoint; |
||
669 | } |
||
670 | else |
||
671 | { |
||
672 | RegistryPoint(member, members.Count); |
||
673 | } |
||
674 | 4913851c | humkyung | |
675 | if (Common.ViewerDataModel.Instance.MarkupControls_USER.Contains(member)) Common.ViewerDataModel.Instance.MarkupControls_USER.Remove(member); /// remove commment from mycontrols |
||
676 | 787a4489 | KangIngu | } |
677 | |||
678 | BorderUpdate(); |
||
679 | } |
||
680 | |||
681 | 902faaea | taeseongkim | |
682 | 787a4489 | KangIngu | /// <summary> |
683 | /// Border 를 갱신 |
||
684 | /// </summary> |
||
685 | public void BorderUpdate() |
||
686 | { |
||
687 | AdornerBorder.MinWidth = 10; |
||
688 | AdornerBorder.MinHeight = 10; |
||
689 | |||
690 | 992a98b4 | KangIngu | double minX = double.MaxValue; |
691 | double minY = double.MaxValue; |
||
692 | double maxX = double.MinValue; |
||
693 | double maxY = double.MinValue; |
||
694 | 787a4489 | KangIngu | |
695 | 4913851c | humkyung | if (this.Members.Count == 1) |
696 | 787a4489 | KangIngu | { |
697 | 4913851c | humkyung | if (this.Members.First().DrawingData.GetType().Name == "TextControl") |
698 | 787a4489 | KangIngu | { |
699 | fa48eb85 | taeseongkim | if ((this.Members.First().DrawingData as TextControl).CommentAngle != 0) |
700 | 787a4489 | KangIngu | { |
701 | fa48eb85 | taeseongkim | trRotate.Angle = (this.Members.First().DrawingData as TextControl).CommentAngle; |
702 | trRotateThumb.Angle = (this.Members.First().DrawingData as TextControl).CommentAngle; |
||
703 | 787a4489 | KangIngu | } |
704 | else |
||
705 | { |
||
706 | trRotate.Angle = 0; |
||
707 | trRotateThumb.Angle = 0; |
||
708 | } |
||
709 | } |
||
710 | } |
||
711 | 4913851c | humkyung | foreach (var item in this.Members) |
712 | 787a4489 | KangIngu | { |
713 | UIElement currentControl = (item as AdornerMember).DrawingData; |
||
714 | b643fcca | taeseongkim | |
715 | Point startP = (currentControl as IPath).StartPoint; |
||
716 | Point endP = (currentControl as IPath).EndPoint; |
||
717 | |||
718 | 902faaea | taeseongkim | // ViewerDataModel.Instance.Angle = MathSet.returnAngle(startP, ref endP, ViewerDataModel.Instance.IsPressShift); |
719 | |||
720 | // 컨트롤의 angle변환시 상단 anglecontrol에 출력 |
||
721 | 4f017ed3 | taeseongkim | ViewerDataModel.Instance.MarkupAngle = (currentControl as CommentUserInfo).CommentAngle; |
722 | b643fcca | taeseongkim | |
723 | 787a4489 | KangIngu | if (item.DrawingData.GetType().Name == "TextControl") |
724 | { |
||
725 | double textControlWidth; |
||
726 | double textControlHeight; |
||
727 | fa48eb85 | taeseongkim | |
728 | 787a4489 | KangIngu | if (((currentControl as TextControl).Base_TextBox.ActualWidth) == 0) |
729 | { |
||
730 | textControlWidth = ((currentControl as TextControl).Base_TextBlock.ActualWidth); |
||
731 | textControlHeight = ((currentControl as TextControl).Base_TextBlock.ActualHeight); |
||
732 | } |
||
733 | else |
||
734 | { |
||
735 | textControlWidth = ((currentControl as TextControl).Base_TextBox.ActualWidth); |
||
736 | textControlHeight = ((currentControl as TextControl).Base_TextBox.ActualHeight); |
||
737 | } |
||
738 | 29010418 | ljiyeon | |
739 | 787a4489 | KangIngu | if ((currentControl as TextControl).EndPoint.X < minX) |
740 | { |
||
741 | minX = (currentControl as TextControl).EndPoint.X; |
||
742 | } |
||
743 | fa48eb85 | taeseongkim | |
744 | 787a4489 | KangIngu | if ((currentControl as TextControl).EndPoint.Y < minY) |
745 | { |
||
746 | minY = (currentControl as TextControl).EndPoint.Y; |
||
747 | } |
||
748 | fa48eb85 | taeseongkim | |
749 | 787a4489 | KangIngu | if (textControlWidth + (currentControl as TextControl).EndPoint.X > maxX) |
750 | { |
||
751 | maxX = textControlWidth + (currentControl as TextControl).EndPoint.X; |
||
752 | } |
||
753 | fa48eb85 | taeseongkim | |
754 | 787a4489 | KangIngu | if (textControlHeight + (currentControl as TextControl).EndPoint.Y > maxY) |
755 | { |
||
756 | maxY = textControlHeight + (currentControl as TextControl).EndPoint.Y; |
||
757 | } |
||
758 | } |
||
759 | else if ((currentControl as IViewBox) != null) |
||
760 | { |
||
761 | IViewBox instance = currentControl as IViewBox; |
||
762 | List<Point> am = (currentControl as IPath).PointSet; |
||
763 | List<double> xSet = am.Select(p => p.X).ToList(); |
||
764 | List<double> ySet = am.Select(p => p.Y).ToList(); |
||
765 | if (xSet.Min() < minX) minX = xSet.Min(); |
||
766 | if (ySet.Min() < minY) minY = ySet.Min(); |
||
767 | if (xSet.Max() > maxX) maxX = xSet.Max(); |
||
768 | if (ySet.Max() > maxY) maxY = ySet.Max(); |
||
769 | } |
||
770 | else if ((currentControl as IPath).PathData == null) |
||
771 | { |
||
772 | Rect rt = new Rect |
||
773 | { |
||
774 | X = (currentControl as IPath).StartPoint.X, |
||
775 | Y = (currentControl as IPath).StartPoint.Y, |
||
776 | 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), |
||
777 | 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), |
||
778 | }; |
||
779 | if (rt.Left < minX) minX = rt.Left; |
||
780 | if (rt.Top < minY) minY = rt.Top; |
||
781 | if (rt.Right > maxX) maxX = rt.Right; |
||
782 | if (rt.Bottom > maxY) maxY = rt.Bottom; |
||
783 | } |
||
784 | else if ((currentControl as IPath) == null) |
||
785 | { |
||
786 | Rect rt = new Rect |
||
787 | { |
||
788 | X = (currentControl as IPath).StartPoint.X, |
||
789 | Y = (currentControl as IPath).StartPoint.Y, |
||
790 | Width = (currentControl as IPath).EndPoint.X - (currentControl as IPath).StartPoint.X, |
||
791 | Height = (currentControl as IPath).EndPoint.Y - (currentControl as IPath).StartPoint.Y |
||
792 | }; |
||
793 | if (rt.Left < minX) minX = rt.Left; |
||
794 | if (rt.Top < minY) minY = rt.Top; |
||
795 | if (rt.Right > maxX) maxX = rt.Right; |
||
796 | if (rt.Bottom > maxY) maxY = rt.Bottom; |
||
797 | } |
||
798 | else if ((currentControl as CircleControl) != null) |
||
799 | 29010418 | ljiyeon | { |
800 | 787a4489 | KangIngu | List<Point> am = (currentControl as IPath).PointSet; |
801 | List<double> xSet = am.Select(p => p.X).ToList(); |
||
802 | List<double> ySet = am.Select(p => p.Y).ToList(); |
||
803 | if (xSet.Min() < minX) minX = xSet.Min(); |
||
804 | if (ySet.Min() < minY) minY = ySet.Min(); |
||
805 | if (xSet.Max() > maxX) maxX = xSet.Max(); |
||
806 | if (ySet.Max() > maxY) maxY = ySet.Max(); |
||
807 | } |
||
808 | else |
||
809 | { |
||
810 | if ((currentControl as IPath).PathData.Bounds.Left < minX) minX = (currentControl as IPath).PathData.Bounds.Left; |
||
811 | if ((currentControl as IPath).PathData.Bounds.Top < minY) minY = (currentControl as IPath).PathData.Bounds.Top; |
||
812 | if ((currentControl as IPath).PathData.Bounds.Right > maxX) maxX = (currentControl as IPath).PathData.Bounds.Right; |
||
813 | if ((currentControl as IPath).PathData.Bounds.Bottom > maxY) maxY = (currentControl as IPath).PathData.Bounds.Bottom; |
||
814 | } |
||
815 | } |
||
816 | |||
817 | Rect ac = new Rect(minX, minY, maxX - minX, maxY - minY); |
||
818 | bool addWidthSize = false; |
||
819 | bool addHeightSize = false; |
||
820 | if (ac.Width <= 10) |
||
821 | { |
||
822 | ac.Width += 10; |
||
823 | addWidthSize = true; |
||
824 | } |
||
825 | if (ac.Height <= 10) |
||
826 | { |
||
827 | ac.Height += 10; |
||
828 | addHeightSize = true; |
||
829 | } |
||
830 | BorderSize = ac; |
||
831 | AdornerBorder.MinWidth = 10; |
||
832 | AdornerBorder.MinHeight = 10; |
||
833 | AdornerBorder.Width = ac.Width; |
||
834 | AdornerBorder.Height = ac.Height; |
||
835 | Canvas.SetLeft(AdornerBorder, minX); |
||
836 | Canvas.SetTop(AdornerBorder, minY); |
||
837 | |||
838 | DragThumb.Width = ac.Width; |
||
839 | DragThumb.Height = ac.Height; |
||
840 | |||
841 | DragThumb.MinWidth = 10; |
||
842 | DragThumb.MinHeight = 10; |
||
843 | if (addWidthSize) |
||
844 | { |
||
845 | Canvas.SetLeft(DragThumb, minX - 5); |
||
846 | } |
||
847 | else |
||
848 | { |
||
849 | Canvas.SetLeft(DragThumb, minX); |
||
850 | } |
||
851 | |||
852 | if (addHeightSize) |
||
853 | { |
||
854 | Canvas.SetTop(DragThumb, minY - 5); |
||
855 | } |
||
856 | else |
||
857 | { |
||
858 | Canvas.SetTop(DragThumb, minY); |
||
859 | } |
||
860 | } |
||
861 | /// <summary> |
||
862 | /// UIElement 해제 |
||
863 | /// </summary> |
||
864 | public void unRegister() |
||
865 | { |
||
866 | foreach (var item in this.ContainerContent.Children) |
||
867 | { |
||
868 | if (item is MarkupToPDF.Common.CommentUserInfo) |
||
869 | { |
||
870 | (item as MarkupToPDF.Common.CommentUserInfo).IsHitTestVisible = true; |
||
871 | } |
||
872 | } |
||
873 | this.ContainerContent.Children.Clear(); |
||
874 | } |
||
875 | f513c215 | humkyung | |
876 | 787a4489 | KangIngu | /// <summary> |
877 | /// 각 포인트들을 등록합니다. |
||
878 | /// </summary> |
||
879 | /// <param name="pointset">Drawing Point</param> |
||
880 | public void RegistryPoint(CommentUserInfo member, int cnt = 1) |
||
881 | 53880c83 | ljiyeon | { |
882 | 787a4489 | KangIngu | int count = 0; |
883 | double Minx = 100000000; |
||
884 | double Miny = 100000000; |
||
885 | List<Point> list = (member as IPath).PointSet; |
||
886 | if (member.GetType().Name == "InkControl") |
||
887 | { |
||
888 | list.Clear(); |
||
889 | list.Add(new Point((member as IPath).PathData.Bounds.X, (member as IPath).PathData.Bounds.Y)); |
||
890 | list.Add(new Point((member as IPath).PathData.Bounds.Left, (member as IPath).PathData.Bounds.Bottom)); |
||
891 | list.Add(new Point((member as IPath).PathData.Bounds.Right, (member as IPath).PathData.Bounds.Bottom)); |
||
892 | list.Add(new Point((member as IPath).PathData.Bounds.Right, (member as IPath).PathData.Bounds.Top)); |
||
893 | } |
||
894 | 4913851c | humkyung | ControlType markT = this.Members.Where(p => p.DrawingData == member).First().Drawingtype; |
895 | 787a4489 | KangIngu | foreach (var ax in list) |
896 | { |
||
897 | Minx = (ax.X < Minx) ? ax.X : Minx; |
||
898 | Miny = (ax.Y < Miny) ? ax.Y : Miny; |
||
899 | } |
||
900 | for (int i = 0; i < list.Count(); i++) |
||
901 | { |
||
902 | f513c215 | humkyung | MyThumb tm = new MyThumb |
903 | 787a4489 | KangIngu | { |
904 | Style = (Style)this.LayoutRoot.Resources["ThumbResizeStyle"], |
||
905 | }; |
||
906 | |||
907 | 4913851c | humkyung | this.Members.Last().ThumbList.Add(tm); |
908 | 29010418 | ljiyeon | |
909 | 24c5e56c | taeseongkim | if ((markT == ControlType.ArcLine && list[i] == (member as ArcControl).MidPoint) || (markT == ControlType.ArcArrow && list[i] == (member as ArrowArcControl).MiddlePoint)) |
910 | 787a4489 | KangIngu | { |
911 | tm.Style = (Style)this.LayoutRoot.Resources["ThumbArcControlStyle"]; |
||
912 | } |
||
913 | if (member.GetType().Name == "ArrowTextControl" && i == 1) |
||
914 | { |
||
915 | 4913851c | humkyung | //if (this.Members.Count()<=1) |
916 | 787a4489 | KangIngu | //{ |
917 | tm.Style = (Style)this.LayoutRoot.Resources["ThumbArcControlStyle"]; |
||
918 | List<Point> ps = new List<Point>(); |
||
919 | |||
920 | 4913851c | humkyung | if ((this.Members.First() as AdornerMember).DrawingData as ArrowTextControl != null) |
921 | 787a4489 | KangIngu | { |
922 | 4913851c | humkyung | var temp = (this.Members.First() as AdornerMember).DrawingData as ArrowTextControl; |
923 | 787a4489 | KangIngu | |
924 | 9b7cda70 | KangIngu | |
925 | fa48eb85 | taeseongkim | switch (Math.Abs(temp.CommentAngle).ToString()) |
926 | 787a4489 | KangIngu | { |
927 | case "90": |
||
928 | { |
||
929 | ps.Clear(); |
||
930 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽 |
||
931 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); // 위 중간 |
||
932 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); // 위 오른쪽 |
||
933 | |||
934 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 중간 |
||
935 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 하단 |
||
936 | |||
937 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); //중간 하단 |
||
938 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 하단 |
||
939 | |||
940 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 중간 |
||
941 | } |
||
942 | break; |
||
943 | case "270": |
||
944 | { |
||
945 | ps.Clear(); |
||
946 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽 |
||
947 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); // 위 중간 |
||
948 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); // 위 오른쪽 |
||
949 | |||
950 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 중간 |
||
951 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 하단 |
||
952 | |||
953 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); //중간 하단 |
||
954 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 하단 |
||
955 | |||
956 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 중간 |
||
957 | } |
||
958 | break; |
||
959 | default: |
||
960 | { |
||
961 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단 |
||
962 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단 |
||
963 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단 |
||
964 | ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //우단 |
||
965 | } |
||
966 | break; |
||
967 | } |
||
968 | |||
969 | ArrowTextControl instance = (member as ArrowTextControl); |
||
970 | if (instance.isTrans) |
||
971 | { |
||
972 | //var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
||
973 | //var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP); |
||
974 | //list[count] = tempP; |
||
975 | list[count] = temp.MidPoint; |
||
976 | } |
||
977 | else |
||
978 | { |
||
979 | if (temp.isFixed) |
||
980 | { |
||
981 | var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
||
982 | var testP = endP; |
||
983 | if (ps[0] == endP) //상단 |
||
984 | { |
||
985 | testP = new Point(endP.X, endP.Y - 50); |
||
986 | } |
||
987 | else if (ps[1] == endP) //하단 |
||
988 | { |
||
989 | testP = new Point(endP.X, endP.Y + 50); |
||
990 | } |
||
991 | else if (ps[2] == endP) //좌단 |
||
992 | { |
||
993 | testP = new Point(endP.X - 50, endP.Y); |
||
994 | } |
||
995 | else if (ps[3] == endP) //우단 |
||
996 | { |
||
997 | testP = new Point(endP.X + 50, endP.Y); |
||
998 | } |
||
999 | list[count] = testP; |
||
1000 | } |
||
1001 | else |
||
1002 | { |
||
1003 | var endP = MathSet.getNearPoint(ps, instance.MidPoint); |
||
1004 | list[count] = MathSet.getMiddlePoint(instance.StartPoint, endP); |
||
1005 | } |
||
1006 | } |
||
1007 | } |
||
1008 | } |
||
1009 | 39f208de | taeseongkim | |
1010 | /// ArrowTextControl text box 화면 출력 |
||
1011 | 787a4489 | KangIngu | if (member.GetType().Name == "ArrowTextControl" && list[i] == list.Last()) |
1012 | { |
||
1013 | tm.Style = (Style)this.LayoutRoot.Resources["ThumbTextStyle"]; |
||
1014 | tm.Width = (member as ArrowTextControl).BoxWidth; |
||
1015 | tm.Height = (member as ArrowTextControl).BoxHeight; |
||
1016 | fa48eb85 | taeseongkim | var angle = (member as ArrowTextControl).PageAngle; |
1017 | 787a4489 | KangIngu | if (Math.Abs(angle).ToString() == "90") |
1018 | { |
||
1019 | tm.RenderTransformOrigin = new Point(0, 0); |
||
1020 | tm.RenderTransform = new RotateTransform { Angle = 270 }; |
||
1021 | } |
||
1022 | else if (Math.Abs(angle).ToString() == "270") |
||
1023 | { |
||
1024 | tm.RenderTransformOrigin = new Point(0, 0); |
||
1025 | tm.RenderTransform = new RotateTransform { Angle = 90 }; |
||
1026 | } |
||
1027 | else |
||
1028 | { |
||
1029 | tm.RenderTransformOrigin = new Point(0.5, 0.5); |
||
1030 | tm.RenderTransform = new RotateTransform() |
||
1031 | { |
||
1032 | fa48eb85 | taeseongkim | Angle = angle |
1033 | 787a4489 | KangIngu | }; |
1034 | } |
||
1035 | } |
||
1036 | 29010418 | ljiyeon | |
1037 | 787a4489 | KangIngu | if (member.GetType().Name == "CloudControl") |
1038 | { |
||
1039 | if (i == list.Count() - 1) |
||
1040 | { |
||
1041 | tm.Visibility = System.Windows.Visibility.Collapsed; |
||
1042 | } |
||
1043 | } |
||
1044 | if (member.GetType().Name == "PolygonControl") |
||
1045 | { |
||
1046 | if (i == list.Count() - 1) |
||
1047 | { |
||
1048 | if ((member as PolygonControl).ControlType == ControlType.ChainLine) |
||
1049 | { |
||
1050 | |||
1051 | } |
||
1052 | else |
||
1053 | { |
||
1054 | tm.Visibility = System.Windows.Visibility.Collapsed; |
||
1055 | } |
||
1056 | } |
||
1057 | if ((member as PolygonControl).ControlType == ControlType.Ink) |
||
1058 | { |
||
1059 | tm.Visibility = System.Windows.Visibility.Collapsed; |
||
1060 | } |
||
1061 | } |
||
1062 | 29010418 | ljiyeon | |
1063 | 787a4489 | KangIngu | this.ContainerContent.Children.Add(tm); |
1064 | Canvas.SetLeft(tm, list[count].X); |
||
1065 | Canvas.SetTop(tm, list[count].Y); |
||
1066 | if (member.GetType().Name == "ArrowTextControl" && list[i] == (member as ArrowTextControl).MidPoint) |
||
1067 | { |
||
1068 | Canvas.SetZIndex(tm, 95); |
||
1069 | 1b2cf911 | taeseongkim | //tm.Opacity = 0; |
1070 | 3dbace4e | taeseongkim | tm.DragDelta += MidPoint_DragDelta; |
1071 | 787a4489 | KangIngu | } |
1072 | else |
||
1073 | { |
||
1074 | 3dbace4e | taeseongkim | tm.DragDelta += ResizeTm_DragDelta; |
1075 | 787a4489 | KangIngu | Canvas.SetZIndex(tm, 99); |
1076 | } |
||
1077 | |||
1078 | tm.DragStarted += new DragStartedEventHandler(tm_DragStarted); |
||
1079 | tm.DragCompleted += new DragCompletedEventHandler(tm_DragCompleted); |
||
1080 | 3dbace4e | taeseongkim | |
1081 | 787a4489 | KangIngu | tm.MouseMove += new MouseEventHandler(resize_MouseMove); |
1082 | count++; |
||
1083 | } |
||
1084 | } |
||
1085 | |||
1086 | 3dbace4e | taeseongkim | private void MidPoint_DragDelta(object sender, DragDeltaEventArgs e) |
1087 | { |
||
1088 | MyThumb thumb = sender as MyThumb; |
||
1089 | double newHorizontalChange = e.HorizontalChange; |
||
1090 | double newVerticalChange = e.VerticalChange; |
||
1091 | |||
1092 | 41c4405e | taeseongkim | var newpoint = MathHelper.RotatePoint(new Point(newHorizontalChange, newVerticalChange), new Point(), 0);// commentInfo.VisualPageAngle); |
1093 | 3dbace4e | taeseongkim | |
1094 | var direction = VisualHelper.GetPointDirection(newpoint, ViewerDataModel.Instance.PageAngle); |
||
1095 | |||
1096 | System.Diagnostics.Debug.WriteLine("뱡향 : " + direction.ToString()); |
||
1097 | |||
1098 | AdornerMember control = CurrentAdornerMember(thumb); |
||
1099 | var commentInfo = (control.DrawingData) as CommentUserInfo; |
||
1100 | |||
1101 | if (commentInfo is ArrowTextControl) |
||
1102 | { |
||
1103 | Point getThumbPoint = GetPosition(thumb); |
||
1104 | |||
1105 | var arrowText = commentInfo as ArrowTextControl; |
||
1106 | |||
1107 | //var midPoint = MathSet.getMiddlePoint(arrowText.StartPoint, arrowText.EndPoint); |
||
1108 | //arrowText.MidPoint = newpoint; |
||
1109 | thumb.Translate(newpoint.X, newpoint.Y, this.AngleValue); |
||
1110 | 41c4405e | taeseongkim | |
1111 | 3dbace4e | taeseongkim | commentInfo.OnMoveCtrlPoint(getThumbPoint, newpoint.X, newpoint.Y, ViewerDataModel.Instance.IsAxisLock || ViewerDataModel.Instance.IsPressShift); |
1112 | |||
1113 | control.UpdateThumb(); |
||
1114 | |||
1115 | System.Diagnostics.Debug.WriteLine($"text {Canvas.GetLeft(arrowText.Base_TextBox)},{Canvas.GetTop(arrowText.Base_TextBox)}"); |
||
1116 | |||
1117 | System.Diagnostics.Debug.WriteLine($"Page Angle : {ViewerDataModel.Instance.PageAngle} GetPoint : {getThumbPoint.X},{getThumbPoint.Y} Change Value : {newpoint.X},{newpoint.Y}"); |
||
1118 | } |
||
1119 | |||
1120 | } |
||
1121 | |||
1122 | |||
1123 | 787a4489 | KangIngu | private void ResizeTm_DragDelta(object sender, DragDeltaEventArgs e) |
1124 | { |
||
1125 | 7bb40d38 | taeseongkim | if (sender.GetType() != typeof(MyThumb)) return; |
1126 | |||
1127 | MyThumb thumb = sender as MyThumb; |
||
1128 | |||
1129 | d2114d3b | humkyung | if (this.Members.Count > 1) return; |
1130 | 7bb40d38 | taeseongkim | |
1131 | System.Diagnostics.Debug.WriteLine($"Value {e.HorizontalChange},{e.VerticalChange}"); |
||
1132 | |||
1133 | double newHorizontalChange = e.HorizontalChange; |
||
1134 | double newVerticalChange = e.VerticalChange; |
||
1135 | |||
1136 | 39f208de | taeseongkim | //if (reSizePoint != new Point(0, 0)) |
1137 | //{ |
||
1138 | 15bbef90 | taeseongkim | //Point setPoint = Mouse.GetPosition(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanCanvas); |
1139 | |||
1140 | 39f208de | taeseongkim | Point setPoint = GetPosition(thumb); |
1141 | 8de55603 | taeseongkim | |
1142 | //System.Diagnostics.Debug.WriteLine($"1. GetPoint : {GetPosition(thumb).X},{GetPosition(thumb).Y} Change Value : {newHorizontalChange},{newVerticalChange}"); |
||
1143 | 15bbef90 | taeseongkim | |
1144 | 8de55603 | taeseongkim | AdornerMember control = CurrentAdornerMember(thumb); |
1145 | var commentInfo = (control.DrawingData) as CommentUserInfo; |
||
1146 | 15bbef90 | taeseongkim | |
1147 | 39f208de | taeseongkim | double ratatePointAngle = 0; |
1148 | 233ef333 | taeseongkim | |
1149 | 39f208de | taeseongkim | if (commentInfo is ArrowTextControl) |
1150 | 8de55603 | taeseongkim | { |
1151 | 39f208de | taeseongkim | var textControl = (commentInfo as ArrowTextControl); |
1152 | 233ef333 | taeseongkim | |
1153 | 39f208de | taeseongkim | if (textControl.EndPoint == MathSet.getNearPoint(textControl.PointSet, setPoint)) //(textControl.MidPoint == MathSet.getNearPoint(textControl.PointSet,setPoint) || |
1154 | |||
1155 | { |
||
1156 | 3dbace4e | taeseongkim | textControl.CommentAngle = 0; |
1157 | this.AngleValue = 0; |
||
1158 | ratatePointAngle = commentInfo.VisualPageAngle; |
||
1159 | 39f208de | taeseongkim | } |
1160 | else |
||
1161 | 41c4405e | taeseongkim | { |
1162 | 39f208de | taeseongkim | //textControl.CommentAngle = commentInfo.VisualPageAngle + MathSet.returnAngle(textControl.StartPoint, ref tempPoint, ViewerDataModel.Instance.IsPressShift); |
1163 | 41c4405e | taeseongkim | textControl.OnCreatingMouseMove(textControl.EndPoint, ViewerDataModel.Instance.IsPressShift); |
1164 | 39f208de | taeseongkim | this.AngleValue = textControl.CommentAngle; |
1165 | commentInfo.CommentAngle = this.AngleValue; |
||
1166 | } |
||
1167 | //CommentAngle = MathSet.returnAngle(this.StartPoint, ref tempPoint, bAxisLocked); |
||
1168 | 8de55603 | taeseongkim | } |
1169 | 39f208de | taeseongkim | System.Diagnostics.Debug.WriteLine("## Angle : " + this.AngleValue + " ##"); |
1170 | thumb.Translate(newHorizontalChange, newVerticalChange, this.AngleValue); |
||
1171 | |||
1172 | // 페이지회전에 따른 화살표텍스트 박스의 이동 수정 |
||
1173 | 43e1d368 | taeseongkim | |
1174 | 39f208de | taeseongkim | var newpoint = MathHelper.RotatePoint(new Point(newHorizontalChange, newVerticalChange), new Point(), ratatePointAngle);// commentInfo.VisualPageAngle); |
1175 | |||
1176 | Point thumbPoint = MathHelper.RotatePoint(setPoint, new Point(), ratatePointAngle);// commentInfo.VisualPageAngle); |
||
1177 | |||
1178 | //thumbPoint.X = Math.Abs(thumbPoint.X); |
||
1179 | //thumbPoint.Y = Math.Abs(thumbPoint.Y); |
||
1180 | |||
1181 | //if ((setPoint.X + newpoint.X) < 0 || (Math.Abs(thumbPoint.X) + newpoint.X) - ViewerDataModel.Instance.ImageViewWidth > 0) |
||
1182 | //{ |
||
1183 | // newpoint.X = 0; |
||
1184 | //} |
||
1185 | |||
1186 | //if (setPoint.Y + newpoint.Y < 0 || (Math.Abs(thumbPoint.Y) + newpoint.Y) - ViewerDataModel.Instance.ImageViewHeight > 0) |
||
1187 | //{ |
||
1188 | // newpoint.Y = 0; |
||
1189 | //} |
||
1190 | 8de55603 | taeseongkim | |
1191 | commentInfo.OnMoveCtrlPoint(setPoint, newpoint.X, newpoint.Y, ViewerDataModel.Instance.IsAxisLock || ViewerDataModel.Instance.IsPressShift); |
||
1192 | |||
1193 | //System.Diagnostics.Debug.WriteLine($"3. GetPoint : {GetPosition(thumb).X},{GetPosition(thumb).Y}"); |
||
1194 | 508c3ac5 | humkyung | control.UpdateThumb(); |
1195 | 15bbef90 | taeseongkim | |
1196 | 8de55603 | taeseongkim | //System.Diagnostics.Debug.WriteLine($"4. GetPoint : {GetPosition(thumb).X},{GetPosition(thumb).Y}"); |
1197 | 508c3ac5 | humkyung | this.BorderUpdate(); |
1198 | 15bbef90 | taeseongkim | |
1199 | 8de55603 | taeseongkim | //System.Diagnostics.Debug.WriteLine($"5. GetPoint : {GetPosition(thumb).X},{GetPosition(thumb).Y}"); |
1200 | 39f208de | taeseongkim | //} |
1201 | 8de55603 | taeseongkim | } |
1202 | |||
1203 | private AdornerMember CurrentAdornerMember(MyThumb thumb) |
||
1204 | { |
||
1205 | AdornerMember result = null; |
||
1206 | |||
1207 | try |
||
1208 | { |
||
1209 | result = (from userThumb in this.Members |
||
1210 | where userThumb.ThumbList.Contains(thumb) |
||
1211 | select userThumb).FirstOrDefault(); |
||
1212 | } |
||
1213 | catch (Exception ex) |
||
1214 | { |
||
1215 | App.FileLogger.Error(ex); |
||
1216 | 787a4489 | KangIngu | } |
1217 | 8de55603 | taeseongkim | |
1218 | return result; |
||
1219 | 787a4489 | KangIngu | } |
1220 | |||
1221 | 15bbef90 | taeseongkim | private Point GetPosition(Thumb thumb) |
1222 | { |
||
1223 | return new Point(Canvas.GetLeft(thumb), Canvas.GetTop(thumb)); |
||
1224 | } |
||
1225 | |||
1226 | 787a4489 | KangIngu | #endregion |
1227 | #region 이벤트 |
||
1228 | |||
1229 | void tm_DragCompleted(object sender, DragCompletedEventArgs e) |
||
1230 | { |
||
1231 | this.isDragging = false; |
||
1232 | DraggerThumb = null; |
||
1233 | |||
1234 | 4913851c | humkyung | var comments = (from drawing in this.Members |
1235 | d128ceb2 | humkyung | select drawing.DrawingData as CommentUserInfo).ToList(); |
1236 | f816dd63 | humkyung | UndoCommand.Instance.Push(comments, this.AngleValue); |
1237 | 26ec6226 | taeseongkim | ViewerDataModel.Instance.IsMarkupUpdate = true; |
1238 | 787a4489 | KangIngu | } |
1239 | |||
1240 | ec052e41 | humkyung | /// <summary> |
1241 | /// start drag |
||
1242 | /// </summary> |
||
1243 | /// <param name="sender"></param> |
||
1244 | /// <param name="e"></param> |
||
1245 | 787a4489 | KangIngu | void tm_DragStarted(object sender, DragStartedEventArgs e) |
1246 | { |
||
1247 | this.DraggerThumb = sender as Thumb; |
||
1248 | this.isDragging = true; |
||
1249 | |||
1250 | if (ViewerDataModel.Instance.UndoDataList == null) |
||
1251 | { |
||
1252 | return; |
||
1253 | } |
||
1254 | |||
1255 | ec052e41 | humkyung | if ((null != ViewerDataModel.Instance.UndoDataList.LastOrDefault()) && (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Event == Event_Type.Thumb)) |
1256 | 787a4489 | KangIngu | { |
1257 | return; |
||
1258 | } |
||
1259 | |||
1260 | ec052e41 | humkyung | if ((null != ViewerDataModel.Instance.UndoDataList.LastOrDefault()) && (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List != null)) |
1261 | 787a4489 | KangIngu | { |
1262 | if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.Count > 0) |
||
1263 | { |
||
1264 | if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.FirstOrDefault().PointSet != null) |
||
1265 | { |
||
1266 | return; |
||
1267 | } |
||
1268 | } |
||
1269 | } |
||
1270 | |||
1271 | 4913851c | humkyung | var comments = (from drawing in this.Members |
1272 | d128ceb2 | humkyung | select drawing.DrawingData as CommentUserInfo).ToList(); |
1273 | f816dd63 | humkyung | UndoCommand.Instance.Push(comments, this.AngleValue); |
1274 | 787a4489 | KangIngu | } |
1275 | |||
1276 | private void rotate_MouseMove(object sender, MouseEventArgs e) |
||
1277 | { |
||
1278 | 4913851c | humkyung | if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "TextControl") |
1279 | 787a4489 | KangIngu | { |
1280 | if (LastRotateVerticalValue < e.GetPosition(this).X) |
||
1281 | IsTextAngle = true; |
||
1282 | else |
||
1283 | IsTextAngle = false; |
||
1284 | LastRotateVerticalValue = e.GetPosition(this).X; |
||
1285 | } |
||
1286 | 9f473fb7 | KangIngu | else |
1287 | 53880c83 | ljiyeon | { |
1288 | 9f473fb7 | KangIngu | if (e.GetPosition(this).X > LastRotateHorizontalValue) |
1289 | { |
||
1290 | RotateFlag = true; |
||
1291 | } |
||
1292 | else |
||
1293 | { |
||
1294 | RotateFlag = false; |
||
1295 | } |
||
1296 | LastRotateHorizontalValue = e.GetPosition(this).X; |
||
1297 | } |
||
1298 | 787a4489 | KangIngu | } |
1299 | |||
1300 | 8771edc4 | humkyung | private void drag_DragStarted(object sender, DragStartedEventArgs e) |
1301 | { |
||
1302 | /// save mouse down and current mouse point |
||
1303 | this.MouseDownPoint = Mouse.GetPosition(Window.GetWindow((DependencyObject)sender)); |
||
1304 | this.CurrentMousePoint = Mouse.GetPosition(Window.GetWindow((DependencyObject)sender)); |
||
1305 | /// up to here |
||
1306 | |||
1307 | if (ViewerDataModel.Instance.UndoDataList == null) |
||
1308 | { |
||
1309 | return; |
||
1310 | } |
||
1311 | if ((null != ViewerDataModel.Instance.UndoDataList.LastOrDefault()) && (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Event == Event_Type.Thumb)) |
||
1312 | { |
||
1313 | return; |
||
1314 | } |
||
1315 | if ((null != ViewerDataModel.Instance.UndoDataList.LastOrDefault()) && (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List != null)) |
||
1316 | { |
||
1317 | if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.Count > 0) |
||
1318 | { |
||
1319 | if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.FirstOrDefault().PointSet != null) |
||
1320 | { |
||
1321 | return; |
||
1322 | } |
||
1323 | } |
||
1324 | } |
||
1325 | |||
1326 | var comments = (from drawing in this.Members |
||
1327 | select drawing.DrawingData as CommentUserInfo).ToList(); |
||
1328 | UndoCommand.Instance.Push(comments, this.AngleValue); |
||
1329 | } |
||
1330 | |||
1331 | private void drag_DragCompleted(object sender, DragCompletedEventArgs e) |
||
1332 | { |
||
1333 | 902faaea | taeseongkim | DragThumb.Cursor = new Cursor(App.DefaultArrowCursorStream); |
1334 | 8771edc4 | humkyung | |
1335 | var comments = (from drawing in this.Members |
||
1336 | select drawing.DrawingData as CommentUserInfo).ToList(); |
||
1337 | UndoCommand.Instance.Push(comments, this.AngleValue); |
||
1338 | } |
||
1339 | |||
1340 | 6b6e937c | taeseongkim | private void DragThumb_DragDelta(object sender, DragDeltaEventArgs e) |
1341 | 787a4489 | KangIngu | { |
1342 | 508c3ac5 | humkyung | double scale = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.ContentScale; |
1343 | 025ebf74 | humkyung | |
1344 | f3ab410f | taeseongkim | var newMousePoint = Mouse.GetPosition(Window.GetWindow((DependencyObject)sender)); |
1345 | |||
1346 | var horzChange = (newMousePoint.X - this.CurrentMousePoint.X) / scale;/// Math.Round(tmp.X - this.CurrentMousePoint.X) / scale; |
||
1347 | var vertChange = (newMousePoint.Y - this.CurrentMousePoint.Y) / scale;///Math.Round(tmp.Y - this.CurrentMousePoint.Y) / scale; |
||
1348 | |||
1349 | 0d00f9c8 | humkyung | try |
1350 | { |
||
1351 | DragThumb.Cursor = Cursors.SizeAll; |
||
1352 | 39f208de | taeseongkim | System.Diagnostics.Debug.WriteLine($"TransItem : {horzChange}, {vertChange}"); |
1353 | System.Diagnostics.Debug.WriteLine($"DragDeltaEventArgs : {e.HorizontalChange}, {e.VerticalChange}"); |
||
1354 | 8e5a4a6a | taeseongkim | |
1355 | |||
1356 | 39f208de | taeseongkim | var mainRect = ViewerDataModel.Instance.SystemMain.dzMainMenu.mainPanel.Rect(); |
1357 | f3ab410f | taeseongkim | |
1358 | 39f208de | taeseongkim | //if (ViewerDataModel.Instance.PageAngle == 270 || ViewerDataModel.Instance.PageAngle == 90) |
1359 | f3ab410f | taeseongkim | //{ |
1360 | 39f208de | taeseongkim | // mainRect = new Rect(0, 0, mainRect.Height, mainRect.Width); |
1361 | f3ab410f | taeseongkim | //} |
1362 | |||
1363 | 39f208de | taeseongkim | mainRect = MathHelper.RotateRect(ViewerDataModel.Instance.SystemMain.dzMainMenu.mainPanel.Rect(), new Point(mainRect.Width / 2, mainRect.Height / 2), ViewerDataModel.Instance.PageAngle); |
1364 | |||
1365 | var rect = (this.ContainerContent.FindChildByType<CommentUserInfo>() as CommentUserInfo).ItemRect; //this.AdornerBorder.Bounds(ViewerDataModel.Instance.SystemMain.dzMainMenu.mainPanel); |
||
1366 | |||
1367 | var rotationRect = MathHelper.RotateRect(rect, new Point(mainRect.Width / 2, mainRect.Height / 2), ViewerDataModel.Instance.PageAngle); |
||
1368 | |||
1369 | var moveDirection = mainRect.Movement(rotationRect); |
||
1370 | f3ab410f | taeseongkim | |
1371 | 39f208de | taeseongkim | System.Diagnostics.Debug.WriteLine($"horzChange: {horzChange} , vertChange:{vertChange}"); |
1372 | //System.Diagnostics.Debug.WriteLine($"DragDeltaEventArgs : Top:{rect.Top}, Left:{rect.Left}, Right:{rect.Right}, Bottom:{rect.Bottom} ,BottomLeft : {rect.BottomLeft} BottomRight : {rect.BottomRight}"); |
||
1373 | f3ab410f | taeseongkim | |
1374 | 39f208de | taeseongkim | //if (Math.Abs(horzChange) > 0) |
1375 | f3ab410f | taeseongkim | //{ |
1376 | // if ((horzChange < 0 && !moveDirection.Left) || (horzChange > 0 && !moveDirection.Right)) |
||
1377 | // { |
||
1378 | // //this.TranslateItems(horzChange * -1, 0); |
||
1379 | // //e.Handled = true; |
||
1380 | // horzChange = 0; |
||
1381 | // newMousePoint.X = this.CurrentMousePoint.X; |
||
1382 | // } |
||
1383 | //} |
||
1384 | |||
1385 | 39f208de | taeseongkim | //if (Math.Abs(vertChange) > 0) |
1386 | f3ab410f | taeseongkim | //{ |
1387 | // if ((vertChange < 0 && !moveDirection.Up) || (vertChange > 0 && !moveDirection.Down)) |
||
1388 | // { |
||
1389 | // //this.TranslateItems(0, vertChange * -1); |
||
1390 | // //e.Handled = true; |
||
1391 | // vertChange = 0; |
||
1392 | // newMousePoint.Y = this.CurrentMousePoint.Y; |
||
1393 | // } |
||
1394 | //} |
||
1395 | 8de55603 | taeseongkim | |
1396 | this.TranslateItems(horzChange, vertChange); |
||
1397 | 0d00f9c8 | humkyung | } |
1398 | finally |
||
1399 | { |
||
1400 | /// update CurrentMousePoint |
||
1401 | f3ab410f | taeseongkim | this.CurrentMousePoint = newMousePoint; |
1402 | 0d00f9c8 | humkyung | } |
1403 | 787a4489 | KangIngu | } |
1404 | eb2b9248 | KangIngu | |
1405 | 0d00f9c8 | humkyung | /// <summary> |
1406 | /// translate all members |
||
1407 | /// </summary> |
||
1408 | /// <param name="e"></param> |
||
1409 | public void TranslateItems(double dx, double dy) |
||
1410 | 787a4489 | KangIngu | { |
1411 | Dispatcher.BeginInvoke((Action)(() => |
||
1412 | { |
||
1413 | 4913851c | humkyung | foreach (var item in this.Members) |
1414 | 787a4489 | KangIngu | { |
1415 | 0d00f9c8 | humkyung | this.TranslateItem(dx, dy, item); |
1416 | 787a4489 | KangIngu | } |
1417 | c7fde400 | taeseongkim | |
1418 | this.BorderUpdate(); |
||
1419 | 787a4489 | KangIngu | })); |
1420 | } |
||
1421 | eb2b9248 | KangIngu | |
1422 | 0d00f9c8 | humkyung | /// <summary> |
1423 | /// translate a item |
||
1424 | /// </summary> |
||
1425 | /// <param name="e"></param> |
||
1426 | /// <param name="item"></param> |
||
1427 | private void TranslateItem(double dx, double dy, AdornerMember item) |
||
1428 | 787a4489 | KangIngu | { |
1429 | 554aae3b | humkyung | /// rotate point with page rotation |
1430 | var rotation = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.rotate.Angle; |
||
1431 | Point delta = MathSet.RotateAbout(new Point(0, 0), new Point(dx, dy), -rotation); |
||
1432 | /// up to here |
||
1433 | 0d00f9c8 | humkyung | (item.DrawingData as CommentUserInfo).OnTranslate(delta.X, delta.Y); |
1434 | 105359ce | ljiyeon | |
1435 | ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate( |
||
1436 | MarkupParser.MarkupToString((item.DrawingData as CommentUserInfo), App.ViewInfo.UserID), Event_Type.Thumb, null, null); |
||
1437 | |||
1438 | 508c3ac5 | humkyung | item.UpdateThumb(); |
1439 | 787a4489 | KangIngu | } |
1440 | |||
1441 | private void resize_MouseMove(object sender, MouseEventArgs e) |
||
1442 | { |
||
1443 | 39f208de | taeseongkim | //reSizePoint = e.GetPosition(this); |
1444 | 787a4489 | KangIngu | } |
1445 | 0d00f9c8 | humkyung | |
1446 | 787a4489 | KangIngu | /// <summary> |
1447 | /// 회전 |
||
1448 | /// </summary> |
||
1449 | /// <param name="sender"></param> |
||
1450 | /// <param name="e"></param> |
||
1451 | public void rotate_DragDelta(object sender, DragDeltaEventArgs e) |
||
1452 | { |
||
1453 | MoveRotate(e); |
||
1454 | } |
||
1455 | |||
1456 | double LastRotateHorizontalValue = 0; |
||
1457 | double LastRotateVerticalValue = 0; |
||
1458 | 9f473fb7 | KangIngu | bool RotateFlag = false; |
1459 | |||
1460 | 992a98b4 | KangIngu | /// <summary> |
1461 | /// <history>humkyung 2018.05.09 upgrade rotate shape peformance</history> |
||
1462 | /// </summary> |
||
1463 | /// <param name="e"></param> |
||
1464 | 787a4489 | KangIngu | public void MoveRotate(DragDeltaEventArgs e) |
1465 | { |
||
1466 | 62b6bcde | humkyung | Point CenterPoint = this.Centeroid; |
1467 | 992a98b4 | KangIngu | Point pt = Mouse.GetPosition(this); |
1468 | |||
1469 | edef7af2 | humkyung | #region X축 기준으로 회전 각도를 구한다. |
1470 | Point vec1 = new Point(1, 0); |
||
1471 | 992a98b4 | KangIngu | Point vec2 = new Point(pt.X - CenterPoint.X, pt.Y - CenterPoint.Y); |
1472 | edef7af2 | humkyung | double angle = (MathSet.getAngleBetweenVectors(vec1, vec2)); |
1473 | if (angle > 360) angle -= 360; |
||
1474 | if (angle < 0) angle += 360; |
||
1475 | #endregion |
||
1476 | |||
1477 | #region AxisLock이 설정되어 있는 경우 Angle을 특정 값으로 정렬한다. |
||
1478 | if (ViewerDataModel.Instance.IsAxisLock) |
||
1479 | { |
||
1480 | angle = AlignedAngles.OrderBy(x => Math.Abs(angle - x)).First(); |
||
1481 | } |
||
1482 | #endregion |
||
1483 | |||
1484 | double dDeltaAngle = angle - AngleValue; |
||
1485 | AngleValue = angle; |
||
1486 | 992a98b4 | KangIngu | |
1487 | edef7af2 | humkyung | /// save rotatePoint |
1488 | this.rotatePoint = pt; |
||
1489 | 787a4489 | KangIngu | |
1490 | Dispatcher.BeginInvoke((Action)(() => |
||
1491 | { |
||
1492 | 554aae3b | humkyung | foreach (var member in this.Members) |
1493 | 787a4489 | KangIngu | { |
1494 | 554aae3b | humkyung | member.RotateAbout(CenterPoint, dDeltaAngle); |
1495 | #region 보더 업데이트 |
||
1496 | switch (member.Drawingtype) |
||
1497 | 787a4489 | KangIngu | { |
1498 | case ControlType.TextControl: |
||
1499 | fa48eb85 | taeseongkim | (member.DrawingData as CommentUserInfo).CommentAngle = AngleValue; |
1500 | 53880c83 | ljiyeon | |
1501 | 9b7cda70 | KangIngu | DragThumb.RenderTransformOrigin = new Point(0, 0); |
1502 | 787a4489 | KangIngu | DragThumb.RenderTransform = new RotateTransform() |
1503 | { |
||
1504 | 6e035f10 | 송근호 | |
1505 | fa48eb85 | taeseongkim | Angle = (member.DrawingData as CommentUserInfo).CommentAngle |
1506 | 787a4489 | KangIngu | }; |
1507 | |||
1508 | 9b7cda70 | KangIngu | AdornerBorder.RenderTransformOrigin = new Point(0, 0); |
1509 | 787a4489 | KangIngu | AdornerBorder.RenderTransform = new RotateTransform() |
1510 | { |
||
1511 | fa48eb85 | taeseongkim | Angle = (member.DrawingData as CommentUserInfo).CommentAngle |
1512 | 54e35b39 | 송근호 | }; |
1513 | 6e035f10 | 송근호 | |
1514 | 62b6bcde | humkyung | (member.DrawingData as CommentUserInfo).UpdateControl(); |
1515 | 787a4489 | KangIngu | BorderUpdate(); |
1516 | break; |
||
1517 | 53880c83 | ljiyeon | |
1518 | 787a4489 | KangIngu | case ControlType.ArrowMultiLine: |
1519 | case ControlType.ArcLine: |
||
1520 | 40b3ce25 | ljiyeon | case ControlType.ArcArrow: |
1521 | 787a4489 | KangIngu | case ControlType.SingleLine: |
1522 | case ControlType.Triangle: |
||
1523 | case ControlType.ArrowTextControl: |
||
1524 | 554aae3b | humkyung | case ControlType.PolygonControl: |
1525 | case ControlType.Ink: |
||
1526 | 787a4489 | KangIngu | BorderUpdate(); |
1527 | break; |
||
1528 | 554aae3b | humkyung | case ControlType.Date: |
1529 | 787a4489 | KangIngu | case ControlType.RectCloud: |
1530 | case ControlType.Rectangle: |
||
1531 | case ControlType.ImgControl: |
||
1532 | case ControlType.Sign: |
||
1533 | case ControlType.Symbol: |
||
1534 | case ControlType.Stamp: |
||
1535 | fa48eb85 | taeseongkim | (member.DrawingData as CommentUserInfo).CommentAngle = AngleValue; |
1536 | 787a4489 | KangIngu | BorderUpdate(); |
1537 | break; |
||
1538 | case ControlType.PolygonCloud: |
||
1539 | 554aae3b | humkyung | ((ICloudControl)member.DrawingData).DrawingCloud(); |
1540 | 787a4489 | KangIngu | BorderUpdate(); |
1541 | break; |
||
1542 | case ControlType.Circle: |
||
1543 | fa48eb85 | taeseongkim | (member.DrawingData as CommentUserInfo).CommentAngle = AngleValue; |
1544 | 554aae3b | humkyung | ((CircleControl)member.DrawingData).SetCenterXY(); |
1545 | 787a4489 | KangIngu | BorderUpdate(); |
1546 | break; |
||
1547 | default: |
||
1548 | break; |
||
1549 | } |
||
1550 | } |
||
1551 | #endregion |
||
1552 | })); |
||
1553 | } |
||
1554 | eb2b9248 | KangIngu | |
1555 | 787a4489 | KangIngu | private void rotate_DragStarted(object sender, DragStartedEventArgs e) |
1556 | 29010418 | ljiyeon | { |
1557 | 992a98b4 | KangIngu | this.rotatePoint = Mouse.GetPosition(this); /// 2018.05.09 added by humkyung |
1558 | eb2b9248 | KangIngu | rotateTop.Cursor = Cursors.SizeAll; |
1559 | |||
1560 | 992a98b4 | KangIngu | /// get angle from text controls' angle if only text control exists - 2018.05.10 added by humkyung |
1561 | 4913851c | humkyung | if ((1 == this.Members.Count) && (this.Members.First() as AdornerMember).DrawingData.GetType().Name == "TextControl") |
1562 | 992a98b4 | KangIngu | { |
1563 | fa48eb85 | taeseongkim | this.AngleValue = ((this.Members.First() as AdornerMember).DrawingData as TextControl).CommentAngle; |
1564 | 992a98b4 | KangIngu | } |
1565 | /// up to here |
||
1566 | |||
1567 | 01cbc243 | KangIngu | if (ViewerDataModel.Instance.UndoDataList == null) |
1568 | 787a4489 | KangIngu | { |
1569 | return; |
||
1570 | } |
||
1571 | |||
1572 | d128ceb2 | humkyung | if ((ViewerDataModel.Instance.UndoDataList.Count > 0) && ViewerDataModel.Instance.UndoDataList.LastOrDefault().Event == Event_Type.Thumb) |
1573 | 787a4489 | KangIngu | { |
1574 | return; |
||
1575 | } |
||
1576 | d128ceb2 | humkyung | |
1577 | if ((ViewerDataModel.Instance.UndoDataList.Count > 0) && ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List != null) |
||
1578 | 787a4489 | KangIngu | { |
1579 | if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.Count > 0) |
||
1580 | { |
||
1581 | if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.FirstOrDefault().PointSet != null) |
||
1582 | { |
||
1583 | return; |
||
1584 | } |
||
1585 | } |
||
1586 | } |
||
1587 | |||
1588 | 4913851c | humkyung | var comments = (from drawing in this.Members |
1589 | d128ceb2 | humkyung | select drawing.DrawingData as CommentUserInfo).ToList(); |
1590 | f816dd63 | humkyung | UndoCommand.Instance.Push(comments, this.AngleValue); |
1591 | 787a4489 | KangIngu | } |
1592 | 29010418 | ljiyeon | |
1593 | 787a4489 | KangIngu | private void rotate_DragCompleted(object sender, DragCompletedEventArgs e) |
1594 | { |
||
1595 | 902faaea | taeseongkim | rotateTop.Cursor = new Cursor(App.DefaultArrowCursorStream); |
1596 | d128ceb2 | humkyung | |
1597 | 4913851c | humkyung | var comments = (from drawing in this.Members |
1598 | d128ceb2 | humkyung | select drawing.DrawingData as CommentUserInfo).ToList(); |
1599 | f816dd63 | humkyung | UndoCommand.Instance.Push(comments, this.AngleValue); |
1600 | 787a4489 | KangIngu | } |
1601 | |||
1602 | public void ControlPointMouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
||
1603 | { |
||
1604 | 4913851c | humkyung | AdornerMember control = this.Members.FirstOrDefault(); |
1605 | 787a4489 | KangIngu | |
1606 | 3dbace4e | taeseongkim | if ((control.DrawingData as ArrowTextControl) != null) |
1607 | 787a4489 | KangIngu | { |
1608 | if ((control.DrawingData as ArrowTextControl).isTrans == false && (control.DrawingData as ArrowTextControl).isFixed == false) |
||
1609 | { |
||
1610 | (control.DrawingData as ArrowTextControl).isTrans = true; |
||
1611 | } |
||
1612 | } |
||
1613 | |||
1614 | } |
||
1615 | eb2b9248 | KangIngu | |
1616 | 787a4489 | KangIngu | public void TextControlChanger() |
1617 | { |
||
1618 | 4913851c | humkyung | if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "TextControl") |
1619 | 787a4489 | KangIngu | { |
1620 | 4913851c | humkyung | TextControl AllControl = (this.Members.First() as AdornerMember).DrawingData as TextControl; |
1621 | 787a4489 | KangIngu | AllControl.Base_TextBox.Focus(); |
1622 | AllControl.Base_TextBox.Visibility = Visibility.Visible; |
||
1623 | AllControl.Base_TextBlock.Visibility = Visibility.Collapsed; |
||
1624 | fa48eb85 | taeseongkim | AllControl.Base_TextBox.IsHitTestVisible = true; |
1625 | 1305c420 | taeseongkim | AllControl.IsEditingMode = true; |
1626 | 787a4489 | KangIngu | AllControl.Base_TextBox.Focus(); |
1627 | fa48eb85 | taeseongkim | |
1628 | 787a4489 | KangIngu | AllControl.SizeChanged += (sen, ea) => |
1629 | { |
||
1630 | if (AllControl.Base_TextBox != null) |
||
1631 | { |
||
1632 | RectangleGeometry Data = new RectangleGeometry |
||
1633 | { |
||
1634 | Rect = new Rect() |
||
1635 | { |
||
1636 | X = AllControl.StartPoint.X, |
||
1637 | Y = AllControl.StartPoint.Y, |
||
1638 | Width = AllControl.Base_TextBox.Width, |
||
1639 | Height = AllControl.Base_TextBox.Height, |
||
1640 | } |
||
1641 | }; |
||
1642 | |||
1643 | Point endPointV = new Point(Data.Bounds.Right, Data.Bounds.Bottom); |
||
1644 | Point middle = MathSet.getMiddlePoint(AllControl.StartPoint, endPointV); |
||
1645 | AllControl.Base_Grid.RenderTransform = new RotateTransform() |
||
1646 | { |
||
1647 | fa48eb85 | taeseongkim | Angle = AllControl.CommentAngle, |
1648 | 787a4489 | KangIngu | CenterX = middle.X, |
1649 | CenterY = middle.Y, |
||
1650 | }; |
||
1651 | } |
||
1652 | BorderUpdate(); |
||
1653 | }; |
||
1654 | } |
||
1655 | } |
||
1656 | eb2b9248 | KangIngu | |
1657 | 787a4489 | KangIngu | private void RectThumb_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) //더블클릭 |
1658 | { |
||
1659 | 4913851c | humkyung | if (e.ClickCount == 2 && this.Members.Count == 1) |
1660 | 787a4489 | KangIngu | { |
1661 | |||
1662 | 4913851c | humkyung | if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "TextControl") |
1663 | 787a4489 | KangIngu | { |
1664 | 1305c420 | taeseongkim | SelectionSet.Instance.UnSelect(ViewerDataModel.Instance.SystemMain.dzMainMenu); |
1665 | 29010418 | ljiyeon | TextControlChanger(); |
1666 | 787a4489 | KangIngu | } |
1667 | |||
1668 | 4913851c | humkyung | else if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "ArrowTextControl") |
1669 | 787a4489 | KangIngu | { |
1670 | 4913851c | humkyung | ArrowTextControl AllControl = (this.Members.First() as AdornerMember).DrawingData as ArrowTextControl; |
1671 | Thumb tm = (this.Members.First() as AdornerMember).ThumbList.Last(); |
||
1672 | 1305c420 | taeseongkim | |
1673 | 3797ff05 | djkim | //ArrowControl TextBox Thumb없애기 |
1674 | 787a4489 | KangIngu | tm.Visibility = Visibility.Collapsed; |
1675 | |||
1676 | 4913851c | humkyung | ((this.Members.First() as AdornerMember).DrawingData as ArrowTextControl).Base_TextBox.IsHitTestVisible = true; |
1677 | 1305c420 | taeseongkim | SelectionSet.Instance.UnSelect(ViewerDataModel.Instance.SystemMain.dzMainMenu); |
1678 | |||
1679 | ((ArrowTextControl)AllControl).Base_TextBox.Focus(); |
||
1680 | 29010418 | ljiyeon | |
1681 | 1305c420 | taeseongkim | |
1682 | 787a4489 | KangIngu | ((ArrowTextControl)AllControl).Base_TextBox.SizeChanged += (sen, ea) => |
1683 | |||
1684 | { |
||
1685 | tm.Width = (AllControl as ArrowTextControl).BoxWidth; |
||
1686 | tm.Height = (AllControl as ArrowTextControl).BoxHeight; |
||
1687 | |||
1688 | List<Point> ps = new List<Point>(); |
||
1689 | 29010418 | ljiyeon | |
1690 | 787a4489 | KangIngu | ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth / 2, Canvas.GetTop(AllControl.Base_TextBox))); //상단 |
1691 | ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth / 2, Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight)); // 하단 |
||
1692 | ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox), Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight / 2)); //좌단 |
||
1693 | ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth, Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight / 2)); //우단 |
||
1694 | |||
1695 | |||
1696 | |||
1697 | |||
1698 | var endP = MathSet.getNearPoint(ps, AllControl.MidPoint); |
||
1699 | var tempP = MathSet.getMiddlePoint(AllControl.StartPoint, endP); |
||
1700 | if (AllControl.isTrans) |
||
1701 | { |
||
1702 | 4913851c | humkyung | Canvas.SetLeft((this.Members.First() as AdornerMember).ThumbList[1], AllControl.MidPoint.X); |
1703 | Canvas.SetTop((this.Members.First() as AdornerMember).ThumbList[1], AllControl.MidPoint.Y); |
||
1704 | 787a4489 | KangIngu | } |
1705 | else |
||
1706 | { |
||
1707 | 4913851c | humkyung | Canvas.SetLeft((this.Members.First() as AdornerMember).ThumbList[1], tempP.X); |
1708 | Canvas.SetTop((this.Members.First() as AdornerMember).ThumbList[1], tempP.Y); |
||
1709 | 787a4489 | KangIngu | } |
1710 | |||
1711 | 9b7cda70 | KangIngu | |
1712 | 787a4489 | KangIngu | BorderUpdate(); |
1713 | 9b7cda70 | KangIngu | |
1714 | 787a4489 | KangIngu | }; |
1715 | } |
||
1716 | 4913851c | humkyung | else if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "DateControl") |
1717 | 787a4489 | KangIngu | { |
1718 | 4913851c | humkyung | DateControl data = (this.Members.First() as AdornerMember).DrawingData as DateControl; |
1719 | 787a4489 | KangIngu | CalendarControl instanceCal = new CalendarControl(data.Text); |
1720 | //dropData.IsOpen = true; |
||
1721 | RadWindow rc = new RadWindow(); |
||
1722 | rc.Width = 300; |
||
1723 | rc.Height = 300; |
||
1724 | rc.Header = "Change Date"; |
||
1725 | rc.Content = instanceCal; |
||
1726 | rc.BorderThickness = new Thickness(3); |
||
1727 | rc.ResizeMode = ResizeMode.NoResize; |
||
1728 | rc.WindowStartupLocation = WindowStartupLocation.CenterScreen; |
||
1729 | rc.ModalBackground = new SolidColorBrush(Colors.Black); |
||
1730 | rc.ModalBackground.Opacity = 0.6; |
||
1731 | Telerik.Windows.Controls.StyleManager.SetTheme(rc, new Telerik.Windows.Controls.Windows8Theme()); |
||
1732 | instanceCal.changeDateCal.SelectionChanged += (sen, ea) => |
||
1733 | { |
||
1734 | data.Text = instanceCal.changeDateCal.SelectedDate.Value.ToShortDateString(); |
||
1735 | rc.Close(); |
||
1736 | }; |
||
1737 | rc.ShowDialog(); |
||
1738 | //CalendarControl.xaml |
||
1739 | } |
||
1740 | 4913851c | humkyung | else if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "ArcControl") |
1741 | 787a4489 | KangIngu | { |
1742 | 4913851c | humkyung | ArcControl instance = ((this.Members.First() as AdornerMember).DrawingData as ArcControl); |
1743 | 787a4489 | KangIngu | if (instance.isTransOn) |
1744 | { |
||
1745 | instance.isTransOn = false; |
||
1746 | } |
||
1747 | else |
||
1748 | { |
||
1749 | instance.isTransOn = true; |
||
1750 | } |
||
1751 | 661b7416 | humkyung | ///instance.SetArcPath(); |
1752 | 787a4489 | KangIngu | BorderUpdate(); |
1753 | } |
||
1754 | 4913851c | humkyung | else if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "ArrowArcControl") |
1755 | 40b3ce25 | ljiyeon | { |
1756 | 4913851c | humkyung | ArrowArcControl instance = ((this.Members.First() as AdornerMember).DrawingData as ArrowArcControl); |
1757 | 40b3ce25 | ljiyeon | if (instance.isTransOn) |
1758 | { |
||
1759 | instance.isTransOn = false; |
||
1760 | } |
||
1761 | else |
||
1762 | { |
||
1763 | instance.isTransOn = true; |
||
1764 | } |
||
1765 | instance.SetArcPath(); |
||
1766 | BorderUpdate(); |
||
1767 | } |
||
1768 | 787a4489 | KangIngu | |
1769 | } |
||
1770 | 29010418 | ljiyeon | |
1771 | 787a4489 | KangIngu | } |
1772 | #endregion |
||
1773 | |||
1774 | private void DragThumb_MouseDoubleClick(object sender, MouseButtonEventArgs e) |
||
1775 | { |
||
1776 | 4913851c | humkyung | if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "TextControl" || (this.Members.First() as AdornerMember).DrawingData.GetType().Name == "ArrowTextControl") |
1777 | 787a4489 | KangIngu | { |
1778 | DragThumb.Visibility = Visibility.Collapsed; |
||
1779 | 9b7cda70 | KangIngu | } |
1780 | 787a4489 | KangIngu | } |
1781 | 6b6e937c | taeseongkim | |
1782 | 787a4489 | KangIngu | } |
1783 | } |