프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

markus / KCOM / Controls / AdornerFinal.xaml.cs @ b643fcca

이력 | 보기 | 이력해설 | 다운로드 (71.9 KB)

1
using KCOM.Common;
2
using KCOM.Events;
3
using MarkupToPDF.Common;
4
using MarkupToPDF.Controls.Cad;
5
using MarkupToPDF.Controls.Common;
6
using MarkupToPDF.Controls.Etc;
7
using MarkupToPDF.Controls.Line;
8
using MarkupToPDF.Controls.Parsing;
9
using MarkupToPDF.Controls.Polygon;
10
using MarkupToPDF.Controls.Shape;
11
using MarkupToPDF.Controls.Text;
12
using System;
13
using System.Collections.Generic;
14
using System.Diagnostics;
15
using System.Linq;
16
using System.Reactive.Linq;
17
using System.Text;
18
using System.Threading.Tasks;
19
using System.Windows;
20
using System.Windows.Controls;
21
using System.Windows.Controls.Primitives;
22
using System.Windows.Input;
23
using System.Windows.Media;
24
using Telerik.Windows.Controls;
25

    
26
namespace KCOM.Controls
27
{
28
    public class MyThumb : Thumb
29
    {
30
        public MyThumb()
31
        {
32
            this.Opacity = 0.6;
33
            this.MouseEnter += MyThumb_MouseEnter;
34
            this.MouseLeave += MyThumb_MouseLeave;
35
        }
36

    
37
        /// <summary>
38
        /// translate thumb with given delta and angle
39
        /// </summary>
40
        /// <param name="e"></param>
41
        /// <param name="angle"></param>
42
        public void Translate(double dx, double dy, double angle)
43
        {
44
            double radian = angle * Math.PI / 180;
45
            double cos = Math.Cos(radian);
46
            double sin = Math.Sin(radian);
47

    
48
            double _dx = dx * cos - dy * sin;
49
            double _dy = dx * sin + dy * cos;
50
            Canvas.SetLeft(this, Canvas.GetLeft(this) + _dx);
51
            Canvas.SetTop(this, Canvas.GetTop(this) + _dy);
52
        }
53

    
54
        /// <summary>
55
        /// </summary>
56
        /// <param name="sender"></param>
57
        /// <param name="e"></param>
58
        private void MyThumb_MouseLeave(object sender, MouseEventArgs e)
59
        {
60
            this.Opacity = 0.6;
61
        }
62

    
63
        /// <summary>
64
        /// 
65
        /// </summary>
66
        /// <param name="sender"></param>
67
        /// <param name="e"></param>
68
        private void MyThumb_MouseEnter(object sender, MouseEventArgs e)
69
        {
70
            this.Opacity = 1.0;
71
        }
72
    }
73

    
74
    /// <summary>
75
    /// Interaction logic for AdornerFinal.xaml
76
    /// </summary>
77
    public class AdornerMember
78
    {
79
        public UIElement DrawingData { get; set; }
80
        public ControlType Drawingtype { get; set; }
81
        public double DrawingAngle { get; set; }
82
        public List<MyThumb> ThumbList { get; set; }
83
        public string Symbol_ID { get; set; }
84
        public long Group_ID { get; set; }
85

    
86
        /// <summary>
87
        /// update thumb
88
        /// </summary>
89
        public void UpdateThumb()
90
        {
91
            var path = this.DrawingData as IPath;
92
            for (int i = 0; i < path.PointSet.Count; ++i)
93
            {
94
                Canvas.SetLeft(this.ThumbList[i], path.PointSet[i].X);
95
                Canvas.SetTop(this.ThumbList[i], path.PointSet[i].Y);
96
            }
97

    
98
            if (this.DrawingData as ArrowTextControl != null)
99
            {
100
                if (!(this.DrawingData as ArrowTextControl).isTrans) //trans가 True인경우
101
                {
102
                    List<Point> ps = new List<Point>();
103

    
104
                    var temp = this.DrawingData as ArrowTextControl;
105
                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단
106
                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단
107
                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단
108
                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2));  //우단
109

    
110
                    if (temp.isFixed)
111
                    {
112
                        var endP = MathSet.getNearPoint(ps, temp.MidPoint);
113
                        var testP = endP;
114
                        if (ps[0] == endP) //상단
115
                        {
116
                            testP = new Point(endP.X, endP.Y - 50);
117
                        }
118
                        else if (ps[1] == endP) //하단
119
                        {
120
                            testP = new Point(endP.X, endP.Y + 50);
121
                        }
122
                        else if (ps[2] == endP) //좌단
123
                        {
124
                            testP = new Point(endP.X - 50, endP.Y);
125
                        }
126
                        else if (ps[3] == endP) //우단
127
                        {
128
                            testP = new Point(endP.X + 50, endP.Y);
129
                        }
130
                        Canvas.SetLeft(this.ThumbList[1], testP.X);
131
                        Canvas.SetTop(this.ThumbList[1], testP.Y);
132
                    }
133
                    else
134
                    {
135
                        var endP = MathSet.getNearPoint(ps, temp.MidPoint);
136
                        var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP);
137
                        Canvas.SetLeft(this.ThumbList[1], tempP.X);
138
                        Canvas.SetTop(this.ThumbList[1], tempP.Y);
139
                    }
140
                }
141
            }
142
        }
143

    
144
        /// <summary>
145
        /// rotate members about given position and angle
146
        /// </summary>
147
        /// <param name="at"></param>
148
        /// <param name="angle">in degree</param>
149
        public void RotateAbout(Point at, double angle)
150
        {
151
            for (int i = 0; i < (this.DrawingData as IPath).PointSet.Count; i++)
152
            {
153
                (this.DrawingData as IPath).PointSet[i] = MathSet.RotateAbout(at, (this.DrawingData as IPath).PointSet[i], angle);
154
            }
155
            (this.DrawingData as CommentUserInfo).UpdateControl();
156

    
157
            this.UpdateThumb();
158
        }
159
    }
160

    
161
    public partial class AdornerFinal : UserControl
162
    {
163
        public TextBox editTextBox { get; set; }
164
        #region 공용 인스턴스
165
        public List<AdornerMember> Members { get; } = new List<AdornerMember>();
166
        public Dictionary<Thumb, DragData> _dragData = new Dictionary<Thumb, DragData>();
167

    
168
        private double angleValue;
169

    
170
        public double AngleValue { get => angleValue;
171
            set
172
            {
173
                if(angleValue != value)
174
                {
175
                    angleValue = value;
176
                }
177
            }
178
        }
179

    
180

    
181
        public bool IsTextAngle = false;
182
        public Rect BorderSize { get; set; }
183
        public bool TextCompensation = false;
184
        public bool isDragging { get; set; }
185
        public Thumb DraggerThumb { get; set; }
186
        public RadDropDownButton dropData;
187
        public RadCalendar dropCalendar;
188
        public Thumb mainDragThumb { get; set; }
189

    
190
        private bool disposed;
191

    
192
        public Point reSizePoint { get; set; }
193
        private Point rotatePoint { get; set; } /// 2018.05.09 added by humkyung
194
        private Point MouseDownPoint = new Point();
195
        private Point CurrentMousePoint = new Point();
196
        #endregion
197
        #region 생성자
198
        private void RadDropDownButton_Loaded(object sender, RoutedEventArgs e)
199
        {
200
            dropData = sender as RadDropDownButton;
201
        }
202

    
203
        private void Date_Calendar_Loaded(object sender, RoutedEventArgs e)
204
        {
205
            dropCalendar = sender as RadCalendar;
206
            dropCalendar.SelectionChanged += (sen, ea) =>
207
            {
208
                dropData.IsOpen = false;
209
                if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "DateControl")
210
                {
211
                    DateControl data = (this.Members.First() as AdornerMember).DrawingData as DateControl;
212
                    data.Text = dropCalendar.SelectedDate.Value.ToShortDateString();
213
                }
214
            };
215
        }
216

    
217
        public AdornerFinal()
218
        {
219
            InitializeComponent();
220
            BorderSize = new Rect();
221
            _dragData.Add(rotateTop, new DragData() { CursorAngle = 0, DragType = DragType.Rotate, RotateIsLeft = true, RotateIsTop = true });
222
        }
223

    
224
        ~AdornerFinal()
225
        {
226
            this.Dispose(false);
227
        }
228

    
229
        public void Dispose()
230
        {
231
            this.Dispose(true);
232
            GC.SuppressFinalize(this);
233
        }
234

    
235
        protected virtual void Dispose(bool disposing)
236
        {
237
            if (this.disposed) return;
238
            if (disposing)
239
            {
240
                foreach (var member in this.Members)
241
                {
242
                    if(!Common.ViewerDataModel.Instance.MarkupControls_USER.Contains(member.DrawingData))
243
                        Common.ViewerDataModel.Instance.MarkupControls_USER.Add(member.DrawingData as CommentUserInfo);
244
                }
245
                // IDisposable 인터페이스를 구현하는 멤버들을 여기서 정리합니다.
246
            }
247
            // .NET Framework에 의하여 관리되지 않는 외부 리소스들을 여기서 정리합니다.
248
            this.disposed = true;
249
        }
250

    
251
        void DragThumb_Loaded(object sender, RoutedEventArgs e)
252
        {
253
            mainDragThumb = DragThumb;
254
        }
255

    
256
        public AdornerFinal(CommentUserInfo objectData) : this()
257
        {
258
            InitializeComponent();
259
            objectData.IsHitTestVisible = false;
260
            if ((objectData as ArrowTextControl) != null)
261
            {
262
                (objectData as ArrowTextControl).Base_TextBox.Focusable = true;
263
            }
264
            Canvas.SetZIndex(objectData, 84);
265
            try
266
            {
267
                ViewerDataModel.Instance.MarkupControls_USER.Remove(objectData);
268
                this.ContainerContent.Children.Add(objectData);
269
            }
270
            catch (Exception ex)
271
            {
272

    
273
            }
274
           
275
            SetAdornerMember(objectData as CommentUserInfo);
276
            this.Focus();
277
        }
278

    
279
        public AdornerFinal(List<CommentUserInfo> objectData) : this()
280
        {
281
            InitializeComponent();
282
            foreach (var item in objectData)
283
            {
284
                //item.IsHitTestVisible = false;
285
                if ((item as ArrowTextControl) != null)
286
                {
287
                    (item as ArrowTextControl).Base_TextBox.Focusable = true;
288
                }
289
                try
290
                {
291
                    Canvas.SetZIndex(item, 80);
292
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(item);
293
                    this.ContainerContent.Children.Add(item);
294
                }
295
                catch //(Exception ex)
296
                {
297
                }
298
                finally
299
                {
300
                    
301
                }
302
            }
303
            this.SetAdornerMember(objectData);
304
            this.Focus();
305
        }
306

    
307
        public Point Centeroid
308
        {
309
            get
310
            {
311
                List<Point> pts = new List<Point>();
312

    
313
                #region 센터 포인트 구하기 (그룹핑)
314
                foreach (var item in this.Members)
315
                {
316
                    if (item.DrawingData.GetType().Name == "TextControl")
317
                    {
318
                        if (AngleValue == 0)
319
                        {
320
                            AngleValue = (item.DrawingData as TextControl).CommentAngle;
321
                        }
322
                        double X = Canvas.GetLeft((item.DrawingData as TextControl));
323
                        double Y = Canvas.GetTop((item.DrawingData as TextControl));
324
                        pts.Add(new Point(X, Y));
325
                    }
326
                    else
327
                    {
328
                        pts.AddRange((item.DrawingData as IPath).PointSet);
329
                    }
330
                }
331
                #endregion
332

    
333
                return MathSet.FindCentroid(pts);
334
            }
335
        }
336

    
337
        #endregion
338
        #region 메서드
339
        public Rect getAdornerSize()
340
        {
341
            return BorderSize;
342
        }
343
        public void addMemberControl(UIElement objectData)
344
        {
345
            this.ContainerContent.Children.Add(objectData);
346
            SetAdornerMember(objectData as CommentUserInfo);
347
            this.Focus();
348
        }
349
        /// <summary>
350
        /// UIElement를 종류에 맞게 등록시킴
351
        /// </summary>
352
        /// <param name="member">UIElement 타입으로 BaseLayer에 있는 것들이 들어옵니다.</param>
353
        public void SetAdornerMember(MarkupToPDF.Common.CommentUserInfo member)
354
        {
355
            switch (member.GetType().Name)
356
            {
357
                #region 컨트롤 조건
358
                case "LineControl":
359
                case "PolygonControl":
360
                case "ArrowControl":
361
                case "ArcControl":
362
                case "ArrowArcControl":
363
                case "ArrowControl_Multi":
364
                case "RectangleControl":
365
                case "TriControl":
366
                case "CircleControl":
367
                case "CloudControl":
368
                case "RectCloudControl":
369
                case "InkControl":
370
                case "InsideWhiteControl":
371
                case "OverlapWhiteControl":
372
                case "ClipWhiteControl":
373
                case "CoordinateControl":
374
                    this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID });
375
                    break;
376
                case "ArrowTextControl":
377
                    this.Members.Add(new AdornerMember
378
                    {
379
                        DrawingData = member,
380
                        Drawingtype = ControlType.ArrowTextControl,
381
                        ThumbList = new List<MyThumb>(),
382
                        Symbol_ID = member.SymbolID,
383
                        Group_ID = member.GroupID,
384
                    });
385
                    (member as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
386
                    AngleValue = (member as ArrowTextControl).CommentAngle;
387
                    Observable.FromEventPattern(((ArrowTextControl)member).Base_TextBox, "LostFocus").Subscribe(a =>
388
                    {
389
                        TextCompensation = false;
390
                        BorderUpdate();
391
                        if ((a.Sender as TextBox).Text == "") //보류
392
                        {
393
                            this.ContainerContent.Children.Remove(member);
394
                            this.Visibility = Visibility.Collapsed;
395
                        }
396
                    });
397
                    break;
398
                case "ImgControl":
399
                    this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID });
400
                    AngleValue = (member as ImgControl).CommentAngle;
401
                    break;
402
                case "DateControl":
403
                    this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID });
404
                    AngleValue = (member as DateControl).CommentAngle;
405
                    break;
406
                case "SignControl":
407
                    this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID });
408
                    AngleValue = (member as SignControl).CommentAngle;
409
                    break;
410
                case "SymControl":
411
                    this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID });
412
                    AngleValue = (member as SymControl).CommentAngle;
413
                    break;
414
                case "SymControlN":
415
                    this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID });
416
                    AngleValue = (member as SymControlN).CommentAngle;
417
                    break;
418
                case "TextControl":
419
                    this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.TextControl, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID });
420
                    RectangleGeometry Data = new RectangleGeometry
421
                    {
422
                        Rect = new Rect()
423
                        {
424
                            X = Canvas.GetLeft((member as TextControl)),
425
                            Y = Canvas.GetTop((member as TextControl)),
426
                            Width = (member as TextControl).Base_TextBlock.ActualWidth / 2,
427
                            Height = (member as TextControl).Base_TextBlock.ActualHeight / 2,
428
                            //Width = (member as TextControl).BoxWidth / 2,
429
                            //Height = (member as TextControl).BoxHeight / 2,
430
                        }
431
                    };
432
                    Point endPointV = new Point(Data.Bounds.Right, Data.Bounds.Bottom);
433
                    Point middle = MathSet.getMiddlePoint((member as TextControl).StartPoint, endPointV);
434

    
435

    
436
                    DragThumb.RenderTransformOrigin = new Point(0.0, 0.0);
437
                    DragThumb.RenderTransform = new RotateTransform()
438
                    {
439
                        Angle = (member as TextControl).CommentAngle,
440
                        //CenterX = middle.X,
441
                        //CenterY = middle.Y,
442
                    };
443

    
444
                    AdornerBorder.RenderTransformOrigin = new Point(0.0, 0.0);
445
                    AdornerBorder.RenderTransform = new RotateTransform()
446
                    {
447
                        Angle = (member as TextControl).CommentAngle,
448
                        //CenterX = middle.X,
449
                        //CenterY = middle.Y,
450
                    };
451
                    Observable.FromEventPattern(((TextControl)member), "PropertyChanged").Subscribe(a =>
452
                    {
453
                        TextCompensation = true;
454
                        BorderUpdate();
455
                        ((TextControl)member).Base_TextBlock.TextDecorations = ((TextControl)member).UnderLine;
456
                    });
457
                    Observable.FromEventPattern(((TextControl)member).Base_TextBox, "LostFocus").Subscribe(a =>
458
                    {
459
                        TextCompensation = false;
460
                        BorderUpdate();
461
                        if ((a.Sender as TextBox).Text == "") //보류
462
                        {
463
                            this.ContainerContent.Children.Remove(member);
464
                            this.Visibility = Visibility.Collapsed;
465
                        }
466

    
467
                        //((TextControl)member).UnEditingMode();
468
                        //((TextControl)member).Base_TextBlock.Visibility = Visibility.Collapsed;
469
                        //((TextControl)member).Base_Border.Visibility = Visibility.Collapsed;
470
                        //((TextControl)member).Base_TextPath.Visibility = Visibility.Collapsed;
471
                    });
472
                    break;
473
                default:
474
                    break;
475
                    #endregion
476
            }
477

    
478
            if (member.GetType().Name == "TextControl")
479
            {
480
                TextControl content = ((TextControl)member);
481
                content.StartPoint = new Point(Canvas.GetLeft(content), Canvas.GetTop(content));
482
                content.EndPoint = content.StartPoint;
483
            }
484
            else
485
            {
486
                RegistryPoint(member);
487
            }
488
            BorderUpdate();
489

    
490
            if (Common.ViewerDataModel.Instance.MarkupControls_USER.Contains(member)) Common.ViewerDataModel.Instance.MarkupControls_USER.Remove(member);
491
        }
492

    
493
        private void ViewBoxRotate(UIElement member)
494
        {
495
            AdornerBorder.RenderTransformOrigin = new Point(0.5, 0.5);
496
            DragThumb.RenderTransformOrigin = new Point(0.5, 0.5);
497
            AdornerBorder.RenderTransform = new RotateTransform() { Angle = (member as IViewBox).CommentAngle };
498
            DragThumb.RenderTransform = new RotateTransform() { Angle = (member as IViewBox).CommentAngle };
499
        }
500

    
501
        public void SetAdornerMember(List<CommentUserInfo> members)
502
        {
503
            foreach (var member in members)
504
            {
505
                switch (member.GetType().Name)
506
                {
507
                    #region 컨트롤 조건
508
                    case "LineControl":
509
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.SingleLine, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID });
510
                        break;
511
                    case "ImgControl":
512
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ImgControl, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID });
513
                        break;
514
                    case "ArrowControl":
515
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowLine, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID });
516
                        break;
517
                    case "PolygonControl":
518
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.PolygonControl, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID });
519
                        break;
520
                    case "ArrowTextControl":
521
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowTextControl, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID });
522
                        (member as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
523
                        break;
524
                    case "ArcControl":
525
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArcLine, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID });
526
                        break;
527
                    case "ArrowArcControl":
528
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArcArrow, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID });
529
                        break;
530
                    case "DateControl":
531
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Date, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID });
532
                        break;
533
                    case "ArrowControl_Multi":
534
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowMultiLine, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID });
535
                        break;
536
                    case "RectangleControl":
537
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Rectangle, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID });
538
                        break;
539
                    case "TriControl":
540
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Triangle, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID });
541
                        break;
542
                    case "CircleControl":
543
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Circle, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID });
544
                        break;
545
                    case "CloudControl":
546
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.PolygonCloud, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID });
547
                        break;
548
                    case "RectCloudControl":
549
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.RectCloud, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID });
550
                        break;
551
                    case "SignControl":
552
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Sign, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID });
553
                        break;
554
                    case "SymControl":
555
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Symbol, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID });
556
                        break;
557
                    case "SymControlN":
558
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Stamp, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID });
559
                        break;
560
                    case "InkControl":
561
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Ink, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID });
562
                        break;
563
                    case "TextControl":
564
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.TextControl, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID });
565
                        Observable.FromEventPattern(((TextControl)member), "PropertyChanged").Subscribe(a =>
566
                        {
567
                            BorderUpdate();
568
                            try
569
                            {
570
                                ((TextControl)member).Base_TextBlock.TextDecorations = ((TextControl)member).UnderLine; 
571
                            }
572
                            catch (Exception)
573
                            {
574

    
575
                            }
576

    
577
                        });
578
                        Observable.FromEventPattern(((TextControl)member).Base_TextBox, "SelectionChanged").Subscribe(a =>
579
                        {
580
                            BorderUpdate();
581
                        });
582
                        break;
583
                    case "InsideWhiteControl":
584
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.InsideWhite, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID });
585
                        break;
586
                    case "OverlapWhiteControl":
587
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.OverlapWhite, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID });
588
                        break;
589
                    case "ClipWhiteControl":
590
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ClipWhite, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID });
591
                        break;
592
                    case "CoordinateControl":
593
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Coordinate, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID });
594
                        break;
595
                    default:
596
                        break;
597
                        #endregion
598
                }
599
                if (member.GetType().Name == "TextControl")
600
                {
601
                    TextControl content = ((TextControl)member);
602
                    content.StartPoint = new Point(Canvas.GetLeft(content), Canvas.GetTop(content));
603
                    content.EndPoint = content.StartPoint;
604
                }
605
                else
606
                {
607
                    RegistryPoint(member, members.Count);
608
                }
609

    
610
                if (Common.ViewerDataModel.Instance.MarkupControls_USER.Contains(member))  Common.ViewerDataModel.Instance.MarkupControls_USER.Remove(member); /// remove commment from mycontrols
611
            }
612

    
613
            BorderUpdate();
614
        }
615

    
616
        /// <summary>
617
        /// Border 를 갱신
618
        /// </summary>
619
        public void BorderUpdate()
620
        {
621
            AdornerBorder.MinWidth = 10;
622
            AdornerBorder.MinHeight = 10;
623

    
624
            double minX = double.MaxValue;
625
            double minY = double.MaxValue;
626
            double maxX = double.MinValue;
627
            double maxY = double.MinValue;
628

    
629
            if (this.Members.Count == 1)
630
            {
631
                if (this.Members.First().DrawingData.GetType().Name == "TextControl")
632
                {
633
                    if ((this.Members.First().DrawingData as TextControl).CommentAngle != 0)
634
                    {
635
                        trRotate.Angle = (this.Members.First().DrawingData as TextControl).CommentAngle;
636
                        trRotateThumb.Angle = (this.Members.First().DrawingData as TextControl).CommentAngle;
637
                    }
638
                    else
639
                    {
640
                        trRotate.Angle = 0;
641
                        trRotateThumb.Angle = 0;
642
                    }
643
                }
644
            }
645
            foreach (var item in this.Members)
646
            {
647
                UIElement currentControl = (item as AdornerMember).DrawingData;
648

    
649
                Point startP = (currentControl as IPath).StartPoint;
650
                Point endP = (currentControl as IPath).EndPoint;
651

    
652
                ViewerDataModel.Instance.Angle = MathSet.returnAngle(startP, ref endP, ViewerDataModel.Instance.IsPressShift);
653

    
654
                if (item.DrawingData.GetType().Name == "TextControl")
655
                {
656
                    double textControlWidth;
657
                    double textControlHeight;
658

    
659
                    if (((currentControl as TextControl).Base_TextBox.ActualWidth) == 0)
660
                    {
661
                        textControlWidth = ((currentControl as TextControl).Base_TextBlock.ActualWidth);
662
                        textControlHeight = ((currentControl as TextControl).Base_TextBlock.ActualHeight);
663
                    }
664
                    else
665
                    {
666
                        textControlWidth = ((currentControl as TextControl).Base_TextBox.ActualWidth);
667
                        textControlHeight = ((currentControl as TextControl).Base_TextBox.ActualHeight);
668
                    }
669
                    
670
                    if ((currentControl as TextControl).EndPoint.X < minX)
671
                    {
672
                        minX = (currentControl as TextControl).EndPoint.X;
673
                    }
674

    
675
                    if ((currentControl as TextControl).EndPoint.Y < minY)
676
                    {
677
                        minY = (currentControl as TextControl).EndPoint.Y;
678
                    }
679

    
680
                    if (textControlWidth + (currentControl as TextControl).EndPoint.X > maxX)
681
                    {
682
                        maxX = textControlWidth + (currentControl as TextControl).EndPoint.X;
683
                    }
684

    
685
                    if (textControlHeight + (currentControl as TextControl).EndPoint.Y > maxY)
686
                    {
687
                        maxY = textControlHeight + (currentControl as TextControl).EndPoint.Y;
688
                    }
689
                }
690
                else if ((currentControl as IViewBox) != null)
691
                {
692
                    IViewBox instance = currentControl as IViewBox;
693
                    List<Point> am = (currentControl as IPath).PointSet;
694
                    List<double> xSet = am.Select(p => p.X).ToList();
695
                    List<double> ySet = am.Select(p => p.Y).ToList();
696
                    if (xSet.Min() < minX) minX = xSet.Min();
697
                    if (ySet.Min() < minY) minY = ySet.Min();
698
                    if (xSet.Max() > maxX) maxX = xSet.Max();
699
                    if (ySet.Max() > maxY) maxY = ySet.Max();
700
                }
701
                else if ((currentControl as IPath).PathData == null)
702
                {
703
                    Rect rt = new Rect
704
                    {
705
                        X = (currentControl as IPath).StartPoint.X,
706
                        Y = (currentControl as IPath).StartPoint.Y,
707
                        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),
708
                        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),
709
                    };
710
                    if (rt.Left < minX) minX = rt.Left;
711
                    if (rt.Top < minY) minY = rt.Top;
712
                    if (rt.Right > maxX) maxX = rt.Right;
713
                    if (rt.Bottom > maxY) maxY = rt.Bottom;
714
                }
715
                else if ((currentControl as IPath) == null)
716
                {
717
                    Rect rt = new Rect
718
                    {
719
                        X = (currentControl as IPath).StartPoint.X,
720
                        Y = (currentControl as IPath).StartPoint.Y,
721
                        Width = (currentControl as IPath).EndPoint.X - (currentControl as IPath).StartPoint.X,
722
                        Height = (currentControl as IPath).EndPoint.Y - (currentControl as IPath).StartPoint.Y
723
                    };
724
                    if (rt.Left < minX) minX = rt.Left;
725
                    if (rt.Top < minY) minY = rt.Top;
726
                    if (rt.Right > maxX) maxX = rt.Right;
727
                    if (rt.Bottom > maxY) maxY = rt.Bottom;
728
                }
729
                else if ((currentControl as CircleControl) != null)
730
                {                    
731
                    List<Point> am = (currentControl as IPath).PointSet;
732
                    List<double> xSet = am.Select(p => p.X).ToList();
733
                    List<double> ySet = am.Select(p => p.Y).ToList();
734
                    if (xSet.Min() < minX) minX = xSet.Min();
735
                    if (ySet.Min() < minY) minY = ySet.Min();
736
                    if (xSet.Max() > maxX) maxX = xSet.Max();
737
                    if (ySet.Max() > maxY) maxY = ySet.Max();
738
                }
739
                else
740
                {
741
                    if ((currentControl as IPath).PathData.Bounds.Left < minX) minX = (currentControl as IPath).PathData.Bounds.Left;
742
                    if ((currentControl as IPath).PathData.Bounds.Top < minY) minY = (currentControl as IPath).PathData.Bounds.Top;
743
                    if ((currentControl as IPath).PathData.Bounds.Right > maxX) maxX = (currentControl as IPath).PathData.Bounds.Right;
744
                    if ((currentControl as IPath).PathData.Bounds.Bottom > maxY) maxY = (currentControl as IPath).PathData.Bounds.Bottom;
745
                }
746
            }
747

    
748
            Rect ac = new Rect(minX, minY, maxX - minX, maxY - minY);
749
            bool addWidthSize = false;
750
            bool addHeightSize = false;
751
            if (ac.Width <= 10)
752
            {
753
                ac.Width += 10;
754
                addWidthSize = true;
755
            }
756
            if (ac.Height <= 10)
757
            {
758
                ac.Height += 10;
759
                addHeightSize = true;
760
            }
761
            BorderSize = ac;
762
            AdornerBorder.MinWidth = 10;
763
            AdornerBorder.MinHeight = 10;
764
            AdornerBorder.Width = ac.Width;
765
            AdornerBorder.Height = ac.Height;
766
            Canvas.SetLeft(AdornerBorder, minX);
767
            Canvas.SetTop(AdornerBorder, minY);
768

    
769
            DragThumb.Width = ac.Width;
770
            DragThumb.Height = ac.Height;
771

    
772
            DragThumb.MinWidth = 10;
773
            DragThumb.MinHeight = 10;
774
            if (addWidthSize)
775
            {
776
                Canvas.SetLeft(DragThumb, minX - 5);
777
            }
778
            else
779
            {
780
                Canvas.SetLeft(DragThumb, minX);
781
            }
782

    
783
            if (addHeightSize)
784
            {
785
                Canvas.SetTop(DragThumb, minY - 5);
786
            }
787
            else
788
            {
789
                Canvas.SetTop(DragThumb, minY);
790
            }
791
        }
792
        /// <summary>
793
        /// UIElement 해제
794
        /// </summary>
795
        public void unRegister()
796
        {
797
            foreach (var item in this.ContainerContent.Children)
798
            {
799
                if (item is MarkupToPDF.Common.CommentUserInfo)
800
                {
801
                    (item as MarkupToPDF.Common.CommentUserInfo).IsHitTestVisible = true;
802
                }
803
            }
804
            this.ContainerContent.Children.Clear();
805
        }
806

    
807
        /// <summary>
808
        /// 각 포인트들을 등록합니다.
809
        /// </summary>
810
        /// <param name="pointset">Drawing Point</param>
811
        public void RegistryPoint(CommentUserInfo member, int cnt = 1)
812
        {
813
            int count = 0;
814
            double Minx = 100000000;
815
            double Miny = 100000000;
816
            List<Point> list = (member as IPath).PointSet;
817
            if (member.GetType().Name == "InkControl")
818
            {
819
                list.Clear();
820
                list.Add(new Point((member as IPath).PathData.Bounds.X, (member as IPath).PathData.Bounds.Y));
821
                list.Add(new Point((member as IPath).PathData.Bounds.Left, (member as IPath).PathData.Bounds.Bottom));
822
                list.Add(new Point((member as IPath).PathData.Bounds.Right, (member as IPath).PathData.Bounds.Bottom));
823
                list.Add(new Point((member as IPath).PathData.Bounds.Right, (member as IPath).PathData.Bounds.Top));
824
            }
825
            ControlType markT = this.Members.Where(p => p.DrawingData == member).First().Drawingtype;
826
            foreach (var ax in list)
827
            {
828
                Minx = (ax.X < Minx) ? ax.X : Minx;
829
                Miny = (ax.Y < Miny) ? ax.Y : Miny;
830
            }
831
            for (int i = 0; i < list.Count(); i++)
832
            {
833
                MyThumb tm = new MyThumb
834
                {
835
                    Style = (Style)this.LayoutRoot.Resources["ThumbResizeStyle"],
836
                };
837

    
838
                this.Members.Last().ThumbList.Add(tm);
839

    
840
                if ((markT == ControlType.ArcLine && list[i] == (member as ArcControl).MidPoint) || (markT == ControlType.ArcArrow && list[i] == (member as ArrowArcControl).MidPoint))
841
                {
842
                    tm.Style = (Style)this.LayoutRoot.Resources["ThumbArcControlStyle"];
843
                }
844
                if (member.GetType().Name == "ArrowTextControl" && i == 1)
845
                {
846
                    //if (this.Members.Count()<=1)
847
                    //{
848
                    tm.Style = (Style)this.LayoutRoot.Resources["ThumbArcControlStyle"];
849
                    List<Point> ps = new List<Point>();
850

    
851
                    if ((this.Members.First() as AdornerMember).DrawingData as ArrowTextControl != null)
852
                    {
853
                        var temp = (this.Members.First() as AdornerMember).DrawingData as ArrowTextControl;
854

    
855

    
856
                        switch (Math.Abs(temp.CommentAngle).ToString())
857
                        {
858
                            case "90":
859
                                {
860
                                    ps.Clear();
861
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽
862
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); // 위 중간
863
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); // 위 오른쪽
864

    
865
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 중간
866
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 하단
867

    
868
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); //중간 하단
869
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 하단
870

    
871
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 중간
872
                                }
873
                                break;
874
                            case "270":
875
                                {
876
                                    ps.Clear();
877
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽
878
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); // 위 중간
879
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); // 위 오른쪽
880

    
881
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 중간
882
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 하단
883

    
884
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); //중간 하단
885
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 하단
886

    
887
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 중간
888
                                }
889
                                break;
890
                            default:
891
                                {
892
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단
893
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단
894
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단
895
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2));  //우단
896
                                }
897
                                break;
898
                        }
899

    
900
                        ArrowTextControl instance = (member as ArrowTextControl);
901
                        if (instance.isTrans)
902
                        {
903
                            //var endP = MathSet.getNearPoint(ps, temp.MidPoint);
904
                            //var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP);
905
                            //list[count] = tempP;
906
                            list[count] = temp.MidPoint;
907
                        }
908
                        else
909
                        {
910
                            if (temp.isFixed)
911
                            {
912
                                var endP = MathSet.getNearPoint(ps, temp.MidPoint);
913
                                var testP = endP;
914
                                if (ps[0] == endP) //상단
915
                                {
916
                                    testP = new Point(endP.X, endP.Y - 50);
917
                                }
918
                                else if (ps[1] == endP) //하단
919
                                {
920
                                    testP = new Point(endP.X, endP.Y + 50);
921
                                }
922
                                else if (ps[2] == endP) //좌단
923
                                {
924
                                    testP = new Point(endP.X - 50, endP.Y);
925
                                }
926
                                else if (ps[3] == endP) //우단
927
                                {
928
                                    testP = new Point(endP.X + 50, endP.Y);
929
                                }
930
                                list[count] = testP;
931
                            }
932
                            else
933
                            {
934
                                var endP = MathSet.getNearPoint(ps, instance.MidPoint);
935
                                list[count] = MathSet.getMiddlePoint(instance.StartPoint, endP);
936
                            }
937
                        }
938
                    }
939
                }
940
                if (member.GetType().Name == "ArrowTextControl" && list[i] == list.Last())
941
                {
942
                    tm.Style = (Style)this.LayoutRoot.Resources["ThumbTextStyle"];
943
                    tm.Width = (member as ArrowTextControl).BoxWidth;
944
                    tm.Height = (member as ArrowTextControl).BoxHeight;
945
                    var angle = (member as ArrowTextControl).PageAngle;
946
                    if (Math.Abs(angle).ToString() == "90")
947
                    {
948
                        tm.RenderTransformOrigin = new Point(0, 0);
949
                        tm.RenderTransform = new RotateTransform { Angle = 270 };
950
                    }
951
                    else if (Math.Abs(angle).ToString() == "270")
952
                    {
953
                        tm.RenderTransformOrigin = new Point(0, 0);
954
                        tm.RenderTransform = new RotateTransform { Angle = 90 };
955
                    }
956
                    else
957
                    {
958
                        tm.RenderTransformOrigin = new Point(0.5, 0.5);
959
                        tm.RenderTransform = new RotateTransform()
960
                        {
961
                            Angle = angle
962
                        };
963
                    }
964
                }
965
                
966
                if (member.GetType().Name == "CloudControl")
967
                {
968
                    if (i == list.Count() - 1)
969
                    {
970
                        tm.Visibility = System.Windows.Visibility.Collapsed;
971
                    }
972
                }
973
                if (member.GetType().Name == "PolygonControl")
974
                {
975
                    if (i == list.Count() - 1)
976
                    {
977
                        if ((member as PolygonControl).ControlType == ControlType.ChainLine)
978
                        {
979

    
980
                        }
981
                        else
982
                        {
983
                            tm.Visibility = System.Windows.Visibility.Collapsed;
984
                        }
985
                    }
986
                    if ((member as PolygonControl).ControlType == ControlType.Ink)
987
                    {
988
                        tm.Visibility = System.Windows.Visibility.Collapsed;
989
                    }
990
                }
991
                
992
                this.ContainerContent.Children.Add(tm);
993
                Canvas.SetLeft(tm, list[count].X);
994
                Canvas.SetTop(tm, list[count].Y);
995
                if (member.GetType().Name == "ArrowTextControl" && list[i] == (member as ArrowTextControl).MidPoint)
996
                {
997
                    Canvas.SetZIndex(tm, 95);
998
                }
999
                else
1000
                {
1001
                    Canvas.SetZIndex(tm, 99);
1002
                }
1003

    
1004
                tm.DragStarted += new DragStartedEventHandler(tm_DragStarted);
1005
                tm.DragCompleted += new DragCompletedEventHandler(tm_DragCompleted);
1006
                tm.DragDelta += ResizeTm_DragDelta;
1007
                tm.MouseMove += new MouseEventHandler(resize_MouseMove);
1008
                count++;
1009
            }
1010
        }
1011

    
1012
        private void ResizeTm_DragDelta(object sender, DragDeltaEventArgs e)
1013
        {
1014
            if (this.Members.Count > 1) return;
1015
            if (reSizePoint != new Point(0, 0))
1016
            {
1017
                MyThumb thumb = sender as MyThumb;
1018

    
1019
                //Point setPoint = Mouse.GetPosition(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanCanvas);
1020

    
1021
                Point setPoint = new Point(Canvas.GetLeft(thumb), Canvas.GetTop(thumb));
1022
                
1023
                System.Diagnostics.Debug.WriteLine($"1. GetPoint : {GetPosition(thumb).X},{GetPosition(thumb).Y}");
1024

    
1025
                thumb.Translate(e.HorizontalChange, e.VerticalChange, this.AngleValue);
1026
                
1027
                AdornerMember control = (from userThumb in this.Members
1028
                                         where userThumb.ThumbList.Contains(thumb)
1029
                                         select userThumb).FirstOrDefault();
1030

    
1031
                IPath AllControl = control.DrawingData as IPath;
1032

    
1033
                System.Diagnostics.Debug.WriteLine($"2. GetPoint : {GetPosition(thumb).X},{GetPosition(thumb).Y}");
1034

    
1035
                //System.Diagnostics.Debug.WriteLine($"ResizeTm_DragDelta setPoint : {setPoint.X},{setPoint.Y} - {e.HorizontalChange},{e.VerticalChange}");
1036
                ((control.DrawingData) as CommentUserInfo).OnMoveCtrlPoint(setPoint, e.HorizontalChange, e.VerticalChange);
1037
                System.Diagnostics.Debug.WriteLine($"3. GetPoint : {GetPosition(thumb).X},{GetPosition(thumb).Y}");
1038
                control.UpdateThumb();
1039

    
1040
                System.Diagnostics.Debug.WriteLine($"4. GetPoint : {GetPosition(thumb).X},{GetPosition(thumb).Y}");
1041
                this.BorderUpdate();
1042

    
1043
                System.Diagnostics.Debug.WriteLine($"5. GetPoint : {GetPosition(thumb).X},{GetPosition(thumb).Y}");
1044
            }
1045
        }
1046

    
1047
        private Point GetPosition(Thumb thumb)
1048
        {
1049
            return new Point(Canvas.GetLeft(thumb), Canvas.GetTop(thumb));
1050
        }
1051

    
1052
        #endregion
1053
        #region 이벤트
1054

    
1055
        void tm_DragCompleted(object sender, DragCompletedEventArgs e)
1056
        {
1057
            this.isDragging = false;
1058
            DraggerThumb = null;
1059

    
1060
            var comments = (from drawing in this.Members
1061
                            select drawing.DrawingData as CommentUserInfo).ToList();
1062
            UndoCommand.Instance.Push(comments, this.AngleValue);
1063
        }
1064

    
1065
        /// <summary>
1066
        /// start drag
1067
        /// </summary>
1068
        /// <param name="sender"></param>
1069
        /// <param name="e"></param>
1070
        void tm_DragStarted(object sender, DragStartedEventArgs e)
1071
        {
1072
            this.DraggerThumb = sender as Thumb;
1073
            this.isDragging = true;
1074

    
1075
            if (ViewerDataModel.Instance.UndoDataList == null)
1076
            {
1077
                return;
1078
            }
1079

    
1080
            if ((null != ViewerDataModel.Instance.UndoDataList.LastOrDefault()) && (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Event == Event_Type.Thumb))
1081
            {
1082
                return;
1083
            }
1084

    
1085
            if ((null != ViewerDataModel.Instance.UndoDataList.LastOrDefault()) && (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List != null))
1086
            {
1087
                if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.Count > 0)
1088
                {
1089
                    if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.FirstOrDefault().PointSet != null)
1090
                    {
1091
                        return;
1092
                    }
1093
                }
1094
            }
1095

    
1096
            var comments = (from drawing in this.Members
1097
                            select drawing.DrawingData as CommentUserInfo).ToList();
1098
            UndoCommand.Instance.Push(comments, this.AngleValue);
1099
        }
1100

    
1101
        private void rotate_MouseMove(object sender, MouseEventArgs e)
1102
        {
1103
            if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "TextControl")
1104
            {
1105
                if (LastRotateVerticalValue < e.GetPosition(this).X)
1106
                    IsTextAngle = true;
1107
                else
1108
                    IsTextAngle = false;
1109
                LastRotateVerticalValue = e.GetPosition(this).X;
1110
            }
1111
            else
1112
            {
1113
                if (e.GetPosition(this).X > LastRotateHorizontalValue)
1114
                {
1115
                    RotateFlag = true;
1116
                }
1117
                else
1118
                {
1119
                    RotateFlag = false;
1120
                }
1121
                LastRotateHorizontalValue = e.GetPosition(this).X;
1122
            }
1123
        }
1124

    
1125
        private void drag_DragStarted(object sender, DragStartedEventArgs e)
1126
        {
1127
            /// save mouse down and current mouse point
1128
            this.MouseDownPoint = Mouse.GetPosition(Window.GetWindow((DependencyObject)sender));
1129
            this.CurrentMousePoint = Mouse.GetPosition(Window.GetWindow((DependencyObject)sender));
1130
            /// up to here
1131

    
1132
            if (ViewerDataModel.Instance.UndoDataList == null)
1133
            {
1134
                return;
1135
            }
1136
            if ((null != ViewerDataModel.Instance.UndoDataList.LastOrDefault()) && (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Event == Event_Type.Thumb))
1137
            {
1138
                return;
1139
            }
1140
            if ((null != ViewerDataModel.Instance.UndoDataList.LastOrDefault()) && (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List != null))
1141
            {
1142
                if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.Count > 0)
1143
                {
1144
                    if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.FirstOrDefault().PointSet != null)
1145
                    {
1146
                        return;
1147
                    }
1148
                }
1149
            }
1150

    
1151
            var comments = (from drawing in this.Members
1152
                            select drawing.DrawingData as CommentUserInfo).ToList();
1153
            UndoCommand.Instance.Push(comments, this.AngleValue);
1154
        }
1155

    
1156
        private void drag_DragCompleted(object sender, DragCompletedEventArgs e)
1157
        {
1158
            DragThumb.Cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1159

    
1160
            var comments = (from drawing in this.Members
1161
                            select drawing.DrawingData as CommentUserInfo).ToList();
1162
            UndoCommand.Instance.Push(comments, this.AngleValue);
1163
        }
1164

    
1165
        private void DragThumb_DragDelta(object sender, DragDeltaEventArgs e)
1166
        {
1167
            double scale = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.ContentScale;
1168
            var tmp = Mouse.GetPosition(Window.GetWindow((DependencyObject)sender));
1169

    
1170
            var horzChange = (tmp.X - this.CurrentMousePoint.X) / scale;/// Math.Round(tmp.X - this.CurrentMousePoint.X) / scale;
1171
            var vertChange = (tmp.Y - this.CurrentMousePoint.Y) / scale;///Math.Round(tmp.Y - this.CurrentMousePoint.Y) / scale;
1172
            try
1173
            {
1174
                DragThumb.Cursor = Cursors.SizeAll;
1175
                //System.Diagnostics.Debug.WriteLine($"TransItem : {horzChange}, {vertChange}");
1176
                //System.Diagnostics.Debug.WriteLine($"DragDeltaEventArgs : {e.HorizontalChange}, {e.VerticalChange}");
1177

    
1178
                this.TranslateItems(horzChange, vertChange);
1179

    
1180
                var rect = this.AdornerBorder.Bounds(ViewerDataModel.Instance.SystemMain.dzMainMenu.mainPanel);
1181
                var mainRect = ViewerDataModel.Instance.SystemMain.dzMainMenu.mainPanel.Rect();
1182

    
1183
                var moveDirection = mainRect.Movement(rect);
1184

    
1185
                System.Diagnostics.Debug.WriteLine($"horzChange: {horzChange} , vertChange:{vertChange}");
1186
                System.Diagnostics.Debug.WriteLine($"DragDeltaEventArgs : Top:{rect.Top}, Left:{rect.Left}, Right:{rect.Right}, Bottom:{rect.Bottom} ,BottomLeft : {rect.BottomLeft} BottomRight : {rect.BottomRight}");
1187

    
1188
                if ((horzChange < 0 && !moveDirection.Left) || (horzChange > 0 && !moveDirection.Right))
1189
                {
1190
                    this.TranslateItems(horzChange * -1, 0);
1191
                    e.Handled = true;
1192
                }
1193

    
1194
                if ((vertChange < 0 && !moveDirection.Up) || (vertChange > 0 && !moveDirection.Down))
1195
                {
1196
                    this.TranslateItems( 0, vertChange * -1);
1197
                    e.Handled = true;
1198
                }
1199
            }
1200
            finally
1201
            {
1202
                /// update CurrentMousePoint
1203
                this.CurrentMousePoint = tmp;
1204
            }
1205
        }
1206

    
1207
        /// <summary>
1208
        /// translate all members
1209
        /// </summary>
1210
        /// <param name="e"></param>
1211
        public void TranslateItems(double dx, double dy)
1212
        {
1213
            Dispatcher.BeginInvoke((Action)(() =>
1214
            {
1215
                foreach (var item in this.Members)
1216
                {
1217
                    this.TranslateItem(dx, dy, item);
1218
                }
1219

    
1220
                this.BorderUpdate();
1221
            }));
1222
        }
1223

    
1224
        /// <summary>
1225
        /// translate a item
1226
        /// </summary>
1227
        /// <param name="e"></param>
1228
        /// <param name="item"></param>
1229
        private void TranslateItem(double dx, double dy, AdornerMember item)
1230
        {
1231
            /// rotate point with page rotation
1232
            var rotation = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.rotate.Angle;
1233
            Point delta = MathSet.RotateAbout(new Point(0, 0), new Point(dx, dy), -rotation);
1234
            /// up to here
1235
            (item.DrawingData as CommentUserInfo).OnTranslate(delta.X, delta.Y);
1236

    
1237
                ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate(
1238
                        MarkupParser.MarkupToString((item.DrawingData as CommentUserInfo), App.ViewInfo.UserID), Event_Type.Thumb, null, null);            
1239

    
1240
            item.UpdateThumb();
1241
        }
1242

    
1243
        private void resize_MouseMove(object sender, MouseEventArgs e)
1244
        {
1245
            reSizePoint = e.GetPosition(this);
1246
        }
1247

    
1248
        /// <summary>
1249
        /// 회전
1250
        /// </summary>
1251
        /// <param name="sender"></param>
1252
        /// <param name="e"></param>
1253
        public void rotate_DragDelta(object sender, DragDeltaEventArgs e)
1254
        {
1255
            MoveRotate(e);
1256
        }
1257

    
1258
        double LastRotateHorizontalValue = 0;
1259
        double LastRotateVerticalValue = 0;
1260
        bool RotateFlag = false;
1261

    
1262
        /// <summary>
1263
        /// <history>humkyung 2018.05.09 upgrade rotate shape peformance</history>
1264
        /// </summary>
1265
        /// <param name="e"></param>
1266
        public void MoveRotate(DragDeltaEventArgs e)
1267
        {
1268
            Point CenterPoint = this.Centeroid;
1269
            Point pt = Mouse.GetPosition(this);
1270

    
1271
            Point vec1 = new Point(this.rotatePoint.X - CenterPoint.X, this.rotatePoint.Y - CenterPoint.Y);
1272
            Point vec2 = new Point(pt.X - CenterPoint.X, pt.Y - CenterPoint.Y);
1273
            double dDeltaAngle = (MathSet.getAngleBetweenVectors(vec1, vec2));
1274

    
1275
            AngleValue += dDeltaAngle;
1276
            if (AngleValue > 360) AngleValue -= 360;
1277
            if (AngleValue < 0) AngleValue += 360;
1278
            this.rotatePoint = pt;  /// save rotatePoint
1279

    
1280
            Dispatcher.BeginInvoke((Action)(() =>
1281
            {
1282
                foreach (var member in this.Members)
1283
                {
1284
                    member.RotateAbout(CenterPoint, dDeltaAngle); 
1285
                    #region 보더 업데이트
1286
                    switch (member.Drawingtype)
1287
                    {
1288
                        case ControlType.TextControl:
1289
                            (member.DrawingData as CommentUserInfo).CommentAngle = AngleValue;
1290

    
1291
                            DragThumb.RenderTransformOrigin = new Point(0, 0);
1292
                            DragThumb.RenderTransform = new RotateTransform()
1293
                            {
1294

    
1295
                                Angle = (member.DrawingData as CommentUserInfo).CommentAngle
1296
                            };
1297

    
1298
                            AdornerBorder.RenderTransformOrigin = new Point(0, 0);
1299
                            AdornerBorder.RenderTransform = new RotateTransform()
1300
                            {
1301
                                Angle = (member.DrawingData as CommentUserInfo).CommentAngle
1302
                            };
1303

    
1304
                            //(member.DrawingData as TextControl).Angle = AngleValue;
1305

    
1306
                            (member.DrawingData as CommentUserInfo).UpdateControl();
1307
                            BorderUpdate();
1308
                            break;
1309

    
1310
                        case ControlType.ArrowMultiLine:
1311
                        case ControlType.ArcLine:
1312
                        case ControlType.ArcArrow:
1313
                        case ControlType.SingleLine:
1314
                        case ControlType.Triangle:
1315
                        case ControlType.ArrowTextControl:
1316
                        case ControlType.PolygonControl:
1317
                        case ControlType.Ink:
1318
                            BorderUpdate();
1319
                            break;
1320
                        case ControlType.Date:
1321
                        case ControlType.RectCloud:
1322
                        case ControlType.Rectangle:
1323
                        case ControlType.ImgControl:
1324
                        case ControlType.Sign:
1325
                        case ControlType.Symbol:
1326
                        case ControlType.Stamp:
1327
                            (member.DrawingData as CommentUserInfo).CommentAngle = AngleValue;
1328
                            BorderUpdate();
1329
                            break;
1330
                        case ControlType.PolygonCloud:
1331
                            ((ICloudControl)member.DrawingData).DrawingCloud();
1332
                            BorderUpdate();
1333
                            break;
1334
                        case ControlType.Circle:
1335
                            (member.DrawingData as CommentUserInfo).CommentAngle = AngleValue;
1336
                            ((CircleControl)member.DrawingData).SetCenterXY();
1337
                            BorderUpdate();
1338
                            break;
1339
                        default:
1340
                            break;
1341
                    }
1342
                }
1343
                #endregion
1344
            }));
1345
        }
1346

    
1347
        private void rotate_DragStarted(object sender, DragStartedEventArgs e)
1348
        {            
1349
            this.rotatePoint = Mouse.GetPosition(this); /// 2018.05.09 added by humkyung
1350
            rotateTop.Cursor = Cursors.SizeAll;
1351

    
1352
            /// get angle from text controls' angle if only text control exists - 2018.05.10 added by humkyung
1353
            if ((1 == this.Members.Count) && (this.Members.First() as AdornerMember).DrawingData.GetType().Name == "TextControl")
1354
            {
1355
                this.AngleValue = ((this.Members.First() as AdornerMember).DrawingData as TextControl).CommentAngle;
1356
            }
1357
            /// up to here
1358

    
1359
            if (ViewerDataModel.Instance.UndoDataList == null)
1360
            {
1361
                return;
1362
            }
1363

    
1364
            if ((ViewerDataModel.Instance.UndoDataList.Count > 0) && ViewerDataModel.Instance.UndoDataList.LastOrDefault().Event == Event_Type.Thumb)
1365
            {
1366
                return;
1367
            }
1368

    
1369
            if ((ViewerDataModel.Instance.UndoDataList.Count > 0) && ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List != null)
1370
            {
1371
                if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.Count > 0)
1372
                {
1373
                    if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.FirstOrDefault().PointSet != null)
1374
                    {
1375
                        return;
1376
                    }
1377
                }
1378
            }
1379

    
1380
            var comments = (from drawing in this.Members
1381
                            select drawing.DrawingData as CommentUserInfo).ToList();
1382
            UndoCommand.Instance.Push(comments, this.AngleValue);
1383
        }
1384
        
1385
        private void rotate_DragCompleted(object sender, DragCompletedEventArgs e)
1386
        {
1387
            rotateTop.Cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1388

    
1389
            var comments = (from drawing in this.Members
1390
                            select drawing.DrawingData as CommentUserInfo).ToList();
1391
            UndoCommand.Instance.Push(comments, this.AngleValue);
1392
        }
1393

    
1394
        public void ControlPointMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
1395
        {
1396
            AdornerMember control = this.Members.FirstOrDefault();
1397

    
1398
            if ((control.DrawingData as ArrowTextControl) != null && DraggerThumb == null)
1399
            {
1400
                if ((control.DrawingData as ArrowTextControl).isTrans == false && (control.DrawingData as ArrowTextControl).isFixed == false)
1401
                {
1402
                    (control.DrawingData as ArrowTextControl).isTrans = true;
1403
                }
1404
            }
1405

    
1406
        }
1407

    
1408
        public void TextControlChanger()
1409
        {
1410
            if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "TextControl")
1411
            {
1412
                TextControl AllControl = (this.Members.First() as AdornerMember).DrawingData as TextControl;
1413
                AllControl.Base_TextBox.Focus();
1414
                AllControl.Base_TextBox.Visibility = Visibility.Visible;
1415
                AllControl.Base_TextBlock.Visibility = Visibility.Collapsed;
1416
                AllControl.Base_TextBox.IsHitTestVisible = true;
1417
                AllControl.Base_TextBox.Focus();
1418

    
1419
                AllControl.SizeChanged += (sen, ea) =>
1420
                {
1421
                    if (AllControl.Base_TextBox != null)
1422
                    {
1423
                        RectangleGeometry Data = new RectangleGeometry
1424
                        {
1425
                            Rect = new Rect()
1426
                            {
1427
                                X = AllControl.StartPoint.X,
1428
                                Y = AllControl.StartPoint.Y,
1429
                                Width = AllControl.Base_TextBox.Width,
1430
                                Height = AllControl.Base_TextBox.Height,
1431
                            }
1432
                        };
1433

    
1434
                        Point endPointV = new Point(Data.Bounds.Right, Data.Bounds.Bottom);
1435
                        Point middle = MathSet.getMiddlePoint(AllControl.StartPoint, endPointV);
1436
                        AllControl.Base_Grid.RenderTransform = new RotateTransform()
1437
                        {
1438
                            Angle = AllControl.CommentAngle,
1439
                            CenterX = middle.X,
1440
                            CenterY = middle.Y,
1441
                        };
1442
                    }
1443
                    BorderUpdate();
1444
                };
1445
            }
1446
        }
1447

    
1448
        private void RectThumb_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) //더블클릭
1449
        {
1450
            if (e.ClickCount == 2 && this.Members.Count == 1)
1451
            {
1452

    
1453
                if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "TextControl")
1454
                {
1455
                    TextControlChanger();                    
1456
                }
1457

    
1458
                else if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "ArrowTextControl")
1459
                {
1460
                    ArrowTextControl AllControl = (this.Members.First() as AdornerMember).DrawingData as ArrowTextControl;
1461
                    Thumb tm = (this.Members.First() as AdornerMember).ThumbList.Last();
1462
                    ((ArrowTextControl)AllControl).Base_TextBox.Focus();
1463

    
1464
                    //ArrowControl TextBox Thumb없애기
1465
                    tm.Visibility = Visibility.Collapsed;
1466

    
1467
                    ((this.Members.First() as AdornerMember).DrawingData as ArrowTextControl).Base_TextBox.IsHitTestVisible = true;
1468
                    
1469
                    ((ArrowTextControl)AllControl).Base_TextBox.SizeChanged += (sen, ea) =>
1470

    
1471
                    {
1472
                        tm.Width = (AllControl as ArrowTextControl).BoxWidth;
1473
                        tm.Height = (AllControl as ArrowTextControl).BoxHeight;
1474

    
1475
                        List<Point> ps = new List<Point>();
1476
                        
1477
                        ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth / 2, Canvas.GetTop(AllControl.Base_TextBox))); //상단
1478
                        ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth / 2, Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight)); // 하단
1479
                        ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox), Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight / 2)); //좌단
1480
                        ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth, Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight / 2));  //우단
1481

    
1482

    
1483

    
1484

    
1485
                        var endP = MathSet.getNearPoint(ps, AllControl.MidPoint);
1486
                        var tempP = MathSet.getMiddlePoint(AllControl.StartPoint, endP);
1487
                        if (AllControl.isTrans)
1488
                        {
1489
                            Canvas.SetLeft((this.Members.First() as AdornerMember).ThumbList[1], AllControl.MidPoint.X);
1490
                            Canvas.SetTop((this.Members.First() as AdornerMember).ThumbList[1], AllControl.MidPoint.Y);
1491
                        }
1492
                        else
1493
                        {
1494
                            Canvas.SetLeft((this.Members.First() as AdornerMember).ThumbList[1], tempP.X);
1495
                            Canvas.SetTop((this.Members.First() as AdornerMember).ThumbList[1], tempP.Y);
1496
                        }
1497

    
1498

    
1499
                        BorderUpdate();
1500

    
1501
                    };
1502
                }
1503
                else if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "DateControl")
1504
                {
1505
                    DateControl data = (this.Members.First() as AdornerMember).DrawingData as DateControl;
1506
                    CalendarControl instanceCal = new CalendarControl(data.Text);
1507
                    //dropData.IsOpen = true;
1508
                    RadWindow rc = new RadWindow();
1509
                    rc.Width = 300;
1510
                    rc.Height = 300;
1511
                    rc.Header = "Change Date";
1512
                    rc.Content = instanceCal;
1513
                    rc.BorderThickness = new Thickness(3);
1514
                    rc.ResizeMode = ResizeMode.NoResize;
1515
                    rc.WindowStartupLocation = WindowStartupLocation.CenterScreen;
1516
                    rc.ModalBackground = new SolidColorBrush(Colors.Black);
1517
                    rc.ModalBackground.Opacity = 0.6;
1518
                    Telerik.Windows.Controls.StyleManager.SetTheme(rc, new Telerik.Windows.Controls.Windows8Theme());
1519
                    instanceCal.changeDateCal.SelectionChanged += (sen, ea) =>
1520
                    {
1521
                        data.Text = instanceCal.changeDateCal.SelectedDate.Value.ToShortDateString();
1522
                        rc.Close();
1523
                    };
1524
                    rc.ShowDialog();
1525
                    //CalendarControl.xaml
1526
                }
1527
                else if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "ArcControl")
1528
                {
1529
                    ArcControl instance = ((this.Members.First() as AdornerMember).DrawingData as ArcControl);
1530
                    if (instance.isTransOn)
1531
                    {
1532
                        instance.isTransOn = false;
1533
                    }
1534
                    else
1535
                    {
1536
                        instance.isTransOn = true;
1537
                    }
1538
                    ///instance.SetArcPath();
1539
                    BorderUpdate();
1540
                }
1541
                else if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "ArrowArcControl")
1542
                {
1543
                    ArrowArcControl instance = ((this.Members.First() as AdornerMember).DrawingData as ArrowArcControl);
1544
                    if (instance.isTransOn)
1545
                    {
1546
                        instance.isTransOn = false;
1547
                    }
1548
                    else
1549
                    {
1550
                        instance.isTransOn = true;
1551
                    }
1552
                    instance.SetArcPath();
1553
                    BorderUpdate();
1554
                }
1555

    
1556
            }
1557
            
1558
        }
1559
        #endregion
1560

    
1561
        private void DragThumb_MouseDoubleClick(object sender, MouseButtonEventArgs e)
1562
        {
1563
            if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "TextControl" || (this.Members.First() as AdornerMember).DrawingData.GetType().Name == "ArrowTextControl")
1564
            {
1565
                DragThumb.Visibility = Visibility.Collapsed;
1566
            }
1567
        }
1568

    
1569
    }
1570
}
클립보드 이미지 추가 (최대 크기: 500 MB)