프로젝트

일반

사용자정보

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

markus / KCOM / Controls / AdornerFinal.xaml.cs @ 992a98b4

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

1
using KCOM.Common;
2
using MarkupToPDF.Common;
3
using MarkupToPDF.Controls.Common;
4
using MarkupToPDF.Controls.Etc;
5
using MarkupToPDF.Controls.Line;
6
using MarkupToPDF.Controls.Polygon;
7
using MarkupToPDF.Controls.Shape;
8
using MarkupToPDF.Controls.Text;
9
using System;
10
using System.Collections.Generic;
11
using System.Linq;
12
using System.Reactive.Linq;
13
using System.Text;
14
using System.Windows;
15
using System.Windows.Controls;
16
using System.Windows.Controls.Primitives;
17
using System.Windows.Input;
18
using System.Windows.Media;
19
using Telerik.Windows.Controls;
20

    
21
namespace KCOM.Controls
22
{
23
    /// <summary>
24
    /// Interaction logic for AdornerFinal.xaml
25
    /// </summary>
26
    public class AdornerMember
27
    {
28
        public UIElement DrawingData { get; set; }
29
        public ControlType Drawingtype { get; set; }
30
        public double DrawingAngle { get; set; }
31
        public List<Thumb> ThumbList { get; set; }
32

    
33
    }
34
    public partial class AdornerFinal : UserControl
35
    {
36
        public TextBox editTextBox { get; set; }
37
        #region 공용 인스턴스
38
        public List<AdornerMember> MemberSet { get; set; }
39
        public Dictionary<Thumb, DragData> _dragData = new Dictionary<Thumb, DragData>();
40
        public double AngleValue = 0;
41
        public bool IsTextAngle = false;
42
        public Rect BorderSize { get; set; }
43
        public bool TextCompensation = false;
44
        public bool isDragging { get; set; }
45
        public Thumb DraggerThumb { get; set; }
46
        public RadDropDownButton dropData;
47
        public RadCalendar dropCalendar;
48
        public Thumb mainDragThumb { get; set; }
49

    
50
        public Point reSizePoint { get; set; }
51
        private Point rotatePoint { get; set; } /// 2018.05.09 added by humkyung
52
        #endregion
53
        #region 생성자
54
        private void RadDropDownButton_Loaded(object sender, RoutedEventArgs e)
55
        {
56
            dropData = sender as RadDropDownButton;
57
        }
58
        private void Date_Calendar_Loaded(object sender, RoutedEventArgs e)
59
        {
60
            dropCalendar = sender as RadCalendar;
61
            dropCalendar.SelectionChanged += (sen, ea) =>
62
            {
63
                dropData.IsOpen = false;
64
                if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "DateControl")
65
                {
66
                    DateControl data = (MemberSet.First() as AdornerMember).DrawingData as DateControl;
67
                    data.Text = dropCalendar.SelectedDate.Value.ToShortDateString();
68
                }
69
            };
70
        }
71
        public AdornerFinal()
72
        {
73
            InitializeComponent();
74
            MemberSet = new List<AdornerMember>();
75
            BorderSize = new Rect();
76
            _dragData.Add(rotateTop, new DragData() { CursorAngle = 0, DragType = DragType.Rotate, RotateIsLeft = true, RotateIsTop = true });
77
            //_dragData.Add(rotateCenter, new DragData() { CursorAngle = 0, DragType = DragType.Rotate, RotateIsLeft = true, RotateIsTop = true });
78
        }
79

    
80
        void DragThumb_Loaded(object sender, RoutedEventArgs e)
81
        {
82
            mainDragThumb = DragThumb;
83
        }
84

    
85
        public AdornerFinal(CommentUserInfo objectData) : this()
86
        {
87
            InitializeComponent();
88
            objectData.IsHitTestVisible = false;
89
            if ((objectData as ArrowTextControl) != null)
90
            {
91
                (objectData as ArrowTextControl).Base_TextBox.Focusable = true;
92
            }
93
            Canvas.SetZIndex(objectData, 84);
94
            try
95
            {
96
                this.ContainerContent.Children.Add(objectData);
97
            }
98
            catch (Exception ex)
99
            {
100

    
101
            }
102
            SetAdornerMember(objectData as CommentUserInfo);
103
            this.Focus();
104
        }
105
        public AdornerFinal(List<CommentUserInfo> objectData) : this()
106
        {
107
            InitializeComponent();
108
            foreach (var item in objectData)
109
            {
110
                //item.IsHitTestVisible = false;
111
                if ((item as ArrowTextControl) != null)
112
                {
113
                    (item as ArrowTextControl).Base_TextBox.Focusable = true;
114
                }
115
                try
116
                {
117
                    Canvas.SetZIndex(item, 80);
118
                    this.ContainerContent.Children.Add(item);
119
                }
120
                catch (Exception ex)
121
                {
122

    
123
                }
124
            }
125
            SetAdornerMember(objectData);
126
            this.Focus();
127
        }
128

    
129
        #endregion
130
        #region 메서드
131
        public Rect getAdornerSize()
132
        {
133
            return BorderSize;
134
        }
135
        public void addMemberControl(UIElement objectData)
136
        {
137
            this.ContainerContent.Children.Add(objectData);
138
            SetAdornerMember(objectData as CommentUserInfo);
139
            this.Focus();
140
        }
141
        /// <summary>
142
        /// UIElement를 종류에 맞게 등록시킴
143
        /// </summary>
144
        /// <param name="member">UIElement 타입으로 BaseLayer에 있는 것들이 들어옵니다.</param>
145
        public void SetAdornerMember(MarkupToPDF.Common.CommentUserInfo member)
146
        {
147

    
148
            switch (member.GetType().Name)
149
            {
150
                #region 컨트롤 조건
151
                case "LineControl": //Angle추가 안했음
152
                    MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.SingleLine, ThumbList = new List<Thumb>() });
153
                    break;
154
                case "ImgControl": //Angle추가 안했음
155
                    MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ImgControl, ThumbList = new List<Thumb>() });
156
                    //AdornerBorder.RenderTransformOrigin = new Point(0.5, 0.5);            
157
                    //DragThumb.RenderTransformOrigin = new Point(0.5, 0.5);
158
                    AngleValue = (member as ImgControl).Angle;
159
                    break;
160
                //case "SymControl": //Angle추가 안했음
161
                //    MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = MarkupType.Viewbox, ThumbList = new List<Thumb>() });
162
                //    AngleValue = (member as SymControl).Angle;
163
                //    //ViewBoxRotate(member);
164
                //    break;
165
                //case "SymControlN": //Angle추가 안했음
166
                //    MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = MarkupType.Viewbox, ThumbList = new List<Thumb>() });
167
                //    AngleValue = (member as SymControlN).Angle;
168
                //    //ViewBoxRotate(member);
169
                //    break;
170
                case "PolygonControl": //Angle추가 안했음
171
                    MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.PolygonControl, ThumbList = new List<Thumb>() });
172
                    break;
173
                case "ArrowControl":
174
                    MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowLine, ThumbList = new List<Thumb>() });
175
                    break;
176
                case "ArrowTextControl":
177
                    MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowTextControl, ThumbList = new List<Thumb>() });
178
                    (member as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
179

    
180
                    Observable.FromEventPattern(((ArrowTextControl)member).Base_TextBox, "LostFocus").Subscribe(a =>
181
                    {
182
                        TextCompensation = false;
183
                        BorderUpdate();
184
                        if ((a.Sender as TextBox).Text == "") //보류
185
                        {
186
                            this.ContainerContent.Children.Remove(member);
187
                            this.Visibility = Visibility.Collapsed;
188
                        }
189
                    });
190
                    break;
191
                case "ArcControl":
192
                    MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArcLine, ThumbList = new List<Thumb>() });
193
                    break;
194
                case "ArrowControl_Multi":
195
                    MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowMultiLine, ThumbList = new List<Thumb>() });
196
                    break;
197
                case "RectangleControl":
198
                    MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Rectangle, ThumbList = new List<Thumb>() });
199
                    break;
200
                case "DateControl":
201
                    MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Date, ThumbList = new List<Thumb>() });
202
                    AngleValue = (member as DateControl).Angle;
203
                    break;
204
                case "TriControl":
205
                    MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Triangle, ThumbList = new List<Thumb>() });
206
                    break;
207
                case "CircleControl":
208
                    MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Circle, ThumbList = new List<Thumb>() });
209
                    break;
210
                case "CloudControl":
211
                    MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.PolygonCloud, ThumbList = new List<Thumb>() });
212
                    break;
213
                case "RectCloudControl":
214
                    MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.RectCloud, ThumbList = new List<Thumb>() });
215
                    break;
216
                //강인구 추가
217
                case "SignControl":
218
                    MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Sign, ThumbList = new List<Thumb>() });
219
                    AngleValue = (member as SignControl).Angle;
220
                    break;
221
                //강인구 추가
222
                case "SymControl":
223
                    MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Symbol, ThumbList = new List<Thumb>() });
224
                    AngleValue = (member as SymControl).Angle;
225
                    break;
226
                //강인구 추가
227
                case "SymControlN":
228
                    MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Stamp, ThumbList = new List<Thumb>() });
229
                    AngleValue = (member as SymControlN).Angle;
230
                    break;
231
                case "InkControl": //Angle추가 안했음
232
                    MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Ink, ThumbList = new List<Thumb>() });
233
                    break;
234
                case "TextControl":
235
                    MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.TextControl, ThumbList = new List<Thumb>() });
236
                    RectangleGeometry Data = new RectangleGeometry
237
                    {
238
                        Rect = new Rect()
239
                        {
240
                            X = Canvas.GetLeft((member as TextControl)),
241
                            Y = Canvas.GetTop((member as TextControl)),
242
                            Width = (member as TextControl).Base_TextBlock.ActualWidth / 2,
243
                            Height = (member as TextControl).Base_TextBlock.ActualHeight / 2,
244
                            //Width = (member as TextControl).BoxWidth / 2,
245
                            //Height = (member as TextControl).BoxHeight / 2,
246
                        }
247
                    };
248
                    Point endPointV = new Point(Data.Bounds.Right, Data.Bounds.Bottom);
249
                    Point middle = MathSet.getMiddlePoint((member as TextControl).StartPoint, endPointV);
250

    
251

    
252
                    DragThumb.RenderTransformOrigin = new Point(0.0, 0.0);
253
                    DragThumb.RenderTransform = new RotateTransform()
254
                    {
255
                        Angle = (member as TextControl).Angle,
256
                        //CenterX = middle.X,
257
                        //CenterY = middle.Y,
258
                    };
259

    
260
                    AdornerBorder.RenderTransformOrigin = new Point(0.0, 0.0);
261
                    AdornerBorder.RenderTransform = new RotateTransform()
262
                    {
263
                        Angle = (member as TextControl).Angle,
264
                        //CenterX = middle.X,
265
                        //CenterY = middle.Y,
266
                    };
267
                    Observable.FromEventPattern(((TextControl)member), "PropertyChanged").Subscribe(a =>
268
                    {
269
                        TextCompensation = true;
270
                        BorderUpdate();
271
                        ((TextControl)member).Base_TextBlock.TextDecorations = ((TextControl)member).UnderLine;
272
                    });
273
                    Observable.FromEventPattern(((TextControl)member).Base_TextBox, "LostFocus").Subscribe(a =>
274
                    {
275
                        TextCompensation = false;
276
                        BorderUpdate();
277
                        if ((a.Sender as TextBox).Text == "") //보류
278
                        {
279
                            this.ContainerContent.Children.Remove(member);
280
                            this.Visibility = Visibility.Collapsed;
281
                        }
282

    
283
                        //((TextControl)member).UnEditingMode();
284
                        //((TextControl)member).Base_TextBlock.Visibility = Visibility.Collapsed;
285
                        //((TextControl)member).Base_Border.Visibility = Visibility.Collapsed;
286
                        //((TextControl)member).Base_TextPath.Visibility = Visibility.Collapsed;
287
                    });
288
                    break;
289
                default:
290
                    break;
291
                    #endregion
292
            }
293
            if (member.GetType().Name == "TextControl")
294
            {
295
                TextControl content = ((TextControl)member);
296
                content.StartPoint = new Point(Canvas.GetLeft(content), Canvas.GetTop(content));
297
                content.EndPoint = content.StartPoint;
298

    
299
                //RegistryPoint(AllControl.PointSet);
300
            }
301
            else
302
            {
303
                RegistryPoint(member);
304
            }
305
            BorderUpdate();
306
        }
307

    
308
        private void ViewBoxRotate(UIElement member)
309
        {
310
            AdornerBorder.RenderTransformOrigin = new Point(0.5, 0.5);
311
            DragThumb.RenderTransformOrigin = new Point(0.5, 0.5);
312
            AdornerBorder.RenderTransform = new RotateTransform() { Angle = (member as IViewBox).Angle };
313
            DragThumb.RenderTransform = new RotateTransform() { Angle = (member as IViewBox).Angle };
314
        }
315
        public void SetAdornerMember(List<CommentUserInfo> members)
316
        {
317
            foreach (var member in members)
318
            {
319
                switch (member.GetType().Name)
320
                {
321
                    #region 컨트롤 조건
322
                    case "LineControl": //Angle추가 안했음
323
                        MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.SingleLine, ThumbList = new List<Thumb>() });
324
                        break;
325
                    case "ImgControl": //Angle추가 안했음
326
                        MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ImgControl, ThumbList = new List<Thumb>() });
327
                        break;
328
                    //case "SymControl": //Angle추가 안했음
329
                    //    MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = MarkupType.Viewbox, ThumbList = new List<Thumb>() });
330
                    //    break;
331
                    //case "SymControlN": //Angle추가 안했음
332
                    //    MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = MarkupType.Viewbox, ThumbList = new List<Thumb>() });
333
                    //    ViewBoxRotate(member);
334
                    //    break;
335
                    case "ArrowControl":
336
                        MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowLine, ThumbList = new List<Thumb>() });
337
                        break;
338
                    case "PolygonControl": //Angle추가 안했음
339
                        MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.PolygonControl, ThumbList = new List<Thumb>() });
340
                        break;
341
                    case "ArrowTextControl":
342
                        MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowTextControl, ThumbList = new List<Thumb>() });
343
                        (member as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
344
                        break;
345
                    case "ArcControl":
346
                        MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArcLine, ThumbList = new List<Thumb>() });
347
                        break;
348
                    case "DateControl":
349
                        MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Date, ThumbList = new List<Thumb>() });
350
                        break;
351
                    case "ArrowControl_Multi":
352
                        MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowMultiLine, ThumbList = new List<Thumb>() });
353
                        break;
354
                    case "RectangleControl":
355
                        MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Rectangle, ThumbList = new List<Thumb>() });
356
                        break;
357
                    case "TriControl":
358
                        MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Triangle, ThumbList = new List<Thumb>() });
359
                        break;
360
                    case "CircleControl":
361
                        MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Circle, ThumbList = new List<Thumb>() });
362
                        break;
363
                    case "CloudControl":
364
                        MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.PolygonCloud, ThumbList = new List<Thumb>() });
365
                        break;
366
                    case "RectCloudControl":
367
                        MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.RectCloud, ThumbList = new List<Thumb>() });
368
                        break;
369
                    //강인구 추가
370
                    case "SignControl":
371
                        MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Sign, ThumbList = new List<Thumb>() });
372
                        break;
373
                    case "SymControl":
374
                        MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Symbol, ThumbList = new List<Thumb>() });
375
                        break;
376
                    case "SymControlN":
377
                        MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Stamp, ThumbList = new List<Thumb>() });
378
                        break;
379
                    case "InkControl": //Angle추가 안했음
380
                        MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Ink, ThumbList = new List<Thumb>() });
381
                        break;
382
                    case "TextControl":
383
                        MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.TextControl, ThumbList = new List<Thumb>() });
384
                        Observable.FromEventPattern(((TextControl)member), "PropertyChanged").Subscribe(a =>
385
                        {
386
                            BorderUpdate();
387
                            try
388
                            {
389
                                ((TextControl)member).Base_TextBlock.TextDecorations = ((TextControl)member).UnderLine; //확인 0403
390
                            }
391
                            catch (Exception)
392
                            {
393

    
394
                            }
395

    
396
                        });
397
                        Observable.FromEventPattern(((TextControl)member).Base_TextBox, "SelectionChanged").Subscribe(a =>
398
                        {
399
                            BorderUpdate();
400
                        });
401
                        break;
402
                    default:
403
                        break;
404
                        #endregion
405
                }
406
                if (member.GetType().Name == "TextControl")
407
                {
408
                    //강인구 추가
409
                    TextControl content = ((TextControl)member);
410
                    content.StartPoint = new Point(Canvas.GetLeft(content), Canvas.GetTop(content));
411
                    content.EndPoint = content.StartPoint;
412
                    //RegistryPoint(AllControl.PointSet);
413
                }
414
                else
415
                {
416
                    RegistryPoint(member, members.Count);
417
                }
418
            }
419

    
420
            BorderUpdate();
421
        }
422

    
423
        /// <summary>
424
        /// Border 를 갱신
425
        /// </summary>
426
        public void BorderUpdate()
427
        {
428
            AdornerBorder.MinWidth = 10;
429
            AdornerBorder.MinHeight = 10;
430

    
431
            double minX = double.MaxValue;
432
            double minY = double.MaxValue;
433
            double maxX = double.MinValue;
434
            double maxY = double.MinValue;
435

    
436
            if (MemberSet.Count == 1)
437
            {
438
                if (MemberSet.First().DrawingData.GetType().Name == "TextControl")
439
                {
440
                    if ((MemberSet.First().DrawingData as TextControl).Angle != 0)
441
                    {
442
                        trRotate.Angle = (MemberSet.First().DrawingData as TextControl).Angle;
443
                        trRotateThumb.Angle = (MemberSet.First().DrawingData as TextControl).Angle;
444
                    }
445
                    else
446
                    {
447
                        trRotate.Angle = 0;
448
                        trRotateThumb.Angle = 0;
449
                    }
450
                }
451
            }
452
            foreach (var item in MemberSet)
453
            {
454
                UIElement currentControl = (item as AdornerMember).DrawingData;
455
                if (item.DrawingData.GetType().Name == "TextControl")
456
                {
457
                    double textControlWidth;
458
                    double textControlHeight;
459
                    if (((currentControl as TextControl).Base_TextBox.ActualWidth) == 0)
460
                    {
461
                        textControlWidth = ((currentControl as TextControl).Base_TextBlock.ActualWidth);
462
                        textControlHeight = ((currentControl as TextControl).Base_TextBlock.ActualHeight);
463
                    }
464
                    else
465
                    {
466
                        textControlWidth = ((currentControl as TextControl).Base_TextBox.ActualWidth);
467
                        textControlHeight = ((currentControl as TextControl).Base_TextBox.ActualHeight);
468
                    }
469

    
470
                    //Border 사이즈 불필요
471

    
472
                    //if ((currentControl as TextControl).LineSize.Left == 0)
473
                    //{
474
                    //    if (TextCompensation)
475
                    //    {
476

    
477
                    //        textControlWidth += 1;
478
                    //        textControlHeight += 1;
479
                    //    }
480
                    //    else
481
                    //    {
482
                    //        textControlWidth += 3;
483
                    //        textControlHeight += 3;
484
                    //    }
485
                    //}
486
                    //else
487
                    //{
488
                    //    if (TextCompensation)
489
                    //    {
490

    
491
                    //        textControlWidth += 1;
492
                    //        textControlHeight += 1;
493
                    //    }
494
                    //    else
495
                    //    {
496
                    //        textControlWidth += 8;
497
                    //        textControlHeight += 8;
498
                    //    }
499
                    //}
500

    
501
                    if ((currentControl as TextControl).EndPoint.X < minX)
502
                    {
503
                        minX = (currentControl as TextControl).EndPoint.X;
504
                    }
505
                    if ((currentControl as TextControl).EndPoint.Y < minY)
506
                    {
507
                        minY = (currentControl as TextControl).EndPoint.Y;
508
                    }
509
                    if (textControlWidth + (currentControl as TextControl).EndPoint.X > maxX)
510
                    {
511
                        maxX = textControlWidth + (currentControl as TextControl).EndPoint.X;
512
                    }
513
                    if (textControlHeight + (currentControl as TextControl).EndPoint.Y > maxY)
514
                    {
515
                        maxY = textControlHeight + (currentControl as TextControl).EndPoint.Y;
516
                    }
517
                }
518
                else if ((currentControl as IViewBox) != null)
519
                {
520
                    IViewBox instance = currentControl as IViewBox;
521
                    List<Point> am = (currentControl as IPath).PointSet;
522
                    List<double> xSet = am.Select(p => p.X).ToList();
523
                    List<double> ySet = am.Select(p => p.Y).ToList();
524
                    if (xSet.Min() < minX) minX = xSet.Min();
525
                    if (ySet.Min() < minY) minY = ySet.Min();
526
                    if (xSet.Max() > maxX) maxX = xSet.Max();
527
                    if (ySet.Max() > maxY) maxY = ySet.Max();
528
                }
529
                else if ((currentControl as IPath).PathData == null)
530
                {
531
                    Rect rt = new Rect
532
                    {
533
                        X = (currentControl as IPath).StartPoint.X,
534
                        Y = (currentControl as IPath).StartPoint.Y,
535
                        //Width = (currentControl as IPath).EndPoint.X - (currentControl as IPath).StartPoint.X,
536
                        //Height = (currentControl as IPath).EndPoint.Y - (currentControl as IPath).StartPoint.Y
537
                        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),
538
                        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),
539
                    };
540
                    if (rt.Left < minX) minX = rt.Left;
541
                    if (rt.Top < minY) minY = rt.Top;
542
                    if (rt.Right > maxX) maxX = rt.Right;
543
                    if (rt.Bottom > maxY) maxY = rt.Bottom;
544
                }
545
                else if ((currentControl as IPath) == null)
546
                {
547
                    Rect rt = new Rect
548
                    {
549
                        X = (currentControl as IPath).StartPoint.X,
550
                        Y = (currentControl as IPath).StartPoint.Y,
551
                        Width = (currentControl as IPath).EndPoint.X - (currentControl as IPath).StartPoint.X,
552
                        Height = (currentControl as IPath).EndPoint.Y - (currentControl as IPath).StartPoint.Y
553
                    };
554
                    if (rt.Left < minX) minX = rt.Left;
555
                    if (rt.Top < minY) minY = rt.Top;
556
                    if (rt.Right > maxX) maxX = rt.Right;
557
                    if (rt.Bottom > maxY) maxY = rt.Bottom;
558
                }
559
                else if ((currentControl as CircleControl) != null)
560
                {
561
                    //Rect rt = new Rect
562
                    //{
563
                    //    X = (currentControl as IPath).StartPoint.X,
564
                    //    Y = (currentControl as IPath).StartPoint.Y,
565
                    //    Width = (currentControl as IPath).EndPoint.X - (currentControl as IPath).StartPoint.X,
566
                    //    Height = (currentControl as IPath).EndPoint.Y - (currentControl as IPath).StartPoint.Y
567
                    //};
568

    
569
                    //Rect rt = new Rect((currentControl as IPath).StartPoint, (currentControl as IPath).EndPoint);
570
                    //if (rt.Left < minX) minX = rt.Left;
571
                    //if (rt.Top < minY) minY = rt.Top;
572
                    //if (rt.Right > maxX) maxX = rt.Right;
573
                    //if (rt.Bottom > maxY) maxY = rt.Bottom;
574

    
575
                    List<Point> am = (currentControl as IPath).PointSet;
576
                    List<double> xSet = am.Select(p => p.X).ToList();
577
                    List<double> ySet = am.Select(p => p.Y).ToList();
578
                    if (xSet.Min() < minX) minX = xSet.Min();
579
                    if (ySet.Min() < minY) minY = ySet.Min();
580
                    if (xSet.Max() > maxX) maxX = xSet.Max();
581
                    if (ySet.Max() > maxY) maxY = ySet.Max();
582
                }
583
                else
584
                {
585
                    if ((currentControl as IPath).PathData.Bounds.Left < minX) minX = (currentControl as IPath).PathData.Bounds.Left;
586
                    if ((currentControl as IPath).PathData.Bounds.Top < minY) minY = (currentControl as IPath).PathData.Bounds.Top;
587
                    if ((currentControl as IPath).PathData.Bounds.Right > maxX) maxX = (currentControl as IPath).PathData.Bounds.Right;
588
                    if ((currentControl as IPath).PathData.Bounds.Bottom > maxY) maxY = (currentControl as IPath).PathData.Bounds.Bottom;
589
                }
590
            }
591

    
592
            Rect ac = new Rect(minX, minY, maxX - minX, maxY - minY);
593
            bool addWidthSize = false;
594
            bool addHeightSize = false;
595
            if (ac.Width <= 10)
596
            {
597
                ac.Width += 10;
598
                addWidthSize = true;
599
            }
600
            if (ac.Height <= 10)
601
            {
602
                ac.Height += 10;
603
                addHeightSize = true;
604
            }
605
            BorderSize = ac;
606
            AdornerBorder.MinWidth = 10;
607
            AdornerBorder.MinHeight = 10;
608
            AdornerBorder.Width = ac.Width;
609
            AdornerBorder.Height = ac.Height;
610
            Canvas.SetLeft(AdornerBorder, minX);
611
            Canvas.SetTop(AdornerBorder, minY);
612

    
613
            DragThumb.Width = ac.Width;
614
            DragThumb.Height = ac.Height;
615

    
616
            DragThumb.MinWidth = 10;
617
            DragThumb.MinHeight = 10;
618
            if (addWidthSize)
619
            {
620
                Canvas.SetLeft(DragThumb, minX - 5);
621
            }
622
            else
623
            {
624
                Canvas.SetLeft(DragThumb, minX);
625
            }
626

    
627
            if (addHeightSize)
628
            {
629
                Canvas.SetTop(DragThumb, minY - 5);
630
            }
631
            else
632
            {
633
                Canvas.SetTop(DragThumb, minY);
634
            }
635
        }
636
        /// <summary>
637
        /// UIElement 해제
638
        /// </summary>
639
        public void unRegister()
640
        {
641
            foreach (var item in this.ContainerContent.Children)
642
            {
643
                if (item is MarkupToPDF.Common.CommentUserInfo)
644
                {
645
                    (item as MarkupToPDF.Common.CommentUserInfo).IsHitTestVisible = true;
646
                }
647
            }
648
            this.ContainerContent.Children.Clear();
649
        }
650
        /// <summary>
651
        /// 각 포인트들을 등록합니다.
652
        /// </summary>
653
        /// <param name="pointset">Drawing Point</param>
654
        public void RegistryPoint(CommentUserInfo member, int cnt = 1)
655
        {
656
            int count = 0;
657
            double Minx = 100000000;
658
            double Miny = 100000000;
659
            List<Point> list = (member as IPath).PointSet;
660
            if (member.GetType().Name == "InkControl")
661
            {
662
                list.Clear();
663
                list.Add(new Point((member as IPath).PathData.Bounds.X, (member as IPath).PathData.Bounds.Y));
664
                list.Add(new Point((member as IPath).PathData.Bounds.Left, (member as IPath).PathData.Bounds.Bottom));
665
                list.Add(new Point((member as IPath).PathData.Bounds.Right, (member as IPath).PathData.Bounds.Bottom));
666
                list.Add(new Point((member as IPath).PathData.Bounds.Right, (member as IPath).PathData.Bounds.Top));
667
            }
668
            ControlType markT = MemberSet.Where(p => p.DrawingData == member).First().Drawingtype;
669
            foreach (var ax in list)
670
            {
671
                Minx = (ax.X < Minx) ? ax.X : Minx;
672
                Miny = (ax.Y < Miny) ? ax.Y : Miny;
673
            }
674
            for (int i = 0; i < list.Count(); i++)
675
            {
676
                Thumb tm = new Thumb
677
                {
678
                    //Name = String.Format("thumb{0}_{1}", count, member.GetType().Name.ToString()),
679
                    Style = (Style)this.LayoutRoot.Resources["ThumbResizeStyle"],
680
                };
681

    
682
                MemberSet.Last().ThumbList.Add(tm);
683

    
684
                if (markT == ControlType.ArcLine && list[i] == (member as ArcControl).MidPoint)
685
                {
686
                    tm.Style = (Style)this.LayoutRoot.Resources["ThumbArcControlStyle"];
687
                }
688
                if (member.GetType().Name == "ArrowTextControl" && i == 1)
689
                {
690
                    //if (MemberSet.Count()<=1)
691
                    //{
692
                    tm.Style = (Style)this.LayoutRoot.Resources["ThumbArcControlStyle"];
693
                    List<Point> ps = new List<Point>();
694

    
695
                    if ((MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl != null)
696
                    {
697
                        var temp = (MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl;
698

    
699

    
700
                        switch (Math.Abs(temp.Angle).ToString())
701
                        {
702
                            case "90":
703
                                {
704
                                    ps.Clear();
705
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽
706
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); // 위 중간
707
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); // 위 오른쪽
708

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

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

    
715
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 중간
716
                                }
717
                                break;
718
                            case "270":
719
                                {
720
                                    ps.Clear();
721
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽
722
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); // 위 중간
723
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); // 위 오른쪽
724

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

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

    
731
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 중간
732
                                }
733
                                break;
734
                            default:
735
                                {
736
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단
737
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단
738
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단
739
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2));  //우단
740
                                }
741
                                break;
742
                        }
743

    
744
                        ArrowTextControl instance = (member as ArrowTextControl);
745
                        if (instance.isTrans)
746
                        {
747
                            //var endP = MathSet.getNearPoint(ps, temp.MidPoint);
748
                            //var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP);
749
                            //list[count] = tempP;
750
                            list[count] = temp.MidPoint;
751
                        }
752
                        else
753
                        {
754
                            if (temp.isFixed)
755
                            {
756
                                var endP = MathSet.getNearPoint(ps, temp.MidPoint);
757
                                var testP = endP;
758
                                if (ps[0] == endP) //상단
759
                                {
760
                                    testP = new Point(endP.X, endP.Y - 50);
761
                                }
762
                                else if (ps[1] == endP) //하단
763
                                {
764
                                    testP = new Point(endP.X, endP.Y + 50);
765
                                }
766
                                else if (ps[2] == endP) //좌단
767
                                {
768
                                    testP = new Point(endP.X - 50, endP.Y);
769
                                }
770
                                else if (ps[3] == endP) //우단
771
                                {
772
                                    testP = new Point(endP.X + 50, endP.Y);
773
                                }
774
                                list[count] = testP;
775
                            }
776
                            else
777
                            {
778
                                var endP = MathSet.getNearPoint(ps, instance.MidPoint);
779
                                list[count] = MathSet.getMiddlePoint(instance.StartPoint, endP);
780
                            }
781
                        }
782
                    }
783
                }
784
                if (member.GetType().Name == "ArrowTextControl" && list[i] == list.Last())
785
                {
786
                    tm.Style = (Style)this.LayoutRoot.Resources["ThumbTextStyle"];
787
                    tm.Width = (member as ArrowTextControl).BoxWidth;
788
                    tm.Height = (member as ArrowTextControl).BoxHeight;
789
                    var angle = (member as ArrowTextControl).Angle;
790
                    if (Math.Abs(angle).ToString() == "90")
791
                    {
792
                        tm.RenderTransformOrigin = new Point(0, 0);
793
                        tm.RenderTransform = new RotateTransform { Angle = 270 };
794
                    }
795
                    else if (Math.Abs(angle).ToString() == "270")
796
                    {
797
                        tm.RenderTransformOrigin = new Point(0, 0);
798
                        tm.RenderTransform = new RotateTransform { Angle = 90 };
799

    
800
                    }
801
                    else
802
                    {
803
                        tm.RenderTransformOrigin = new Point(0.5, 0.5);
804
                        tm.RenderTransform = new RotateTransform()
805
                        {
806
                            Angle = angle,
807
                        };
808
                    }
809
                }
810
                //if (markT == MarkupType.Polygon || markT == MarkupType.Cloud)
811
                //{
812
                //    tm.MouseMove += new MouseEventHandler(resize_MouseMove);
813
                //    tm.DragStarted += new DragStartedEventHandler(tm_DragStarted);
814
                //    tm.DragCompleted += new DragCompletedEventHandler(tm_DragCompleted);
815
                //}
816
                //else
817
                //{
818
                //    tm.MouseMove += new MouseEventHandler(resize_MouseMove);
819
                //    tm.DragStarted += new DragStartedEventHandler(tm_DragStarted);
820
                //    tm.DragCompleted += new DragCompletedEventHandler(tm_DragCompleted);
821
                //}
822

    
823
                if (member.GetType().Name == "CloudControl")
824
                {
825
                    if (i == list.Count() - 1)
826
                    {
827
                        tm.Visibility = System.Windows.Visibility.Collapsed;
828
                    }
829
                }
830
                if (member.GetType().Name == "PolygonControl")
831
                {
832
                    if (i == list.Count() - 1)
833
                    {
834
                        if ((member as PolygonControl).ControlType == ControlType.ChainLine)
835
                        {
836

    
837
                        }
838
                        else
839
                        {
840
                            tm.Visibility = System.Windows.Visibility.Collapsed;
841
                        }
842
                    }
843
                    if ((member as PolygonControl).ControlType == ControlType.Ink)
844
                    {
845
                        tm.Visibility = System.Windows.Visibility.Collapsed;
846
                    }
847
                }
848

    
849
                //강인구 텀브 없애기 보류
850
                //if(cnt > 1)
851
                //{
852
                //    tm.Visibility = System.Windows.Visibility.Collapsed;
853
                //}
854

    
855

    
856

    
857
                //if (member.GetType().Name == "InkControl")
858
                //{
859
                //    tm.Visibility = System.Windows.Visibility.Collapsed;
860
                //}
861

    
862
                this.ContainerContent.Children.Add(tm);
863
                Canvas.SetLeft(tm, list[count].X);
864
                Canvas.SetTop(tm, list[count].Y);
865
                if (member.GetType().Name == "ArrowTextControl" && list[i] == (member as ArrowTextControl).MidPoint)
866
                {
867
                    Canvas.SetZIndex(tm, 95);
868
                }
869
                else
870
                {
871
                    Canvas.SetZIndex(tm, 99);
872
                }
873

    
874
                tm.DragStarted += new DragStartedEventHandler(tm_DragStarted);
875
                tm.DragCompleted += new DragCompletedEventHandler(tm_DragCompleted);
876
                tm.DragDelta += ResizeTm_DragDelta;
877
                tm.MouseMove += new MouseEventHandler(resize_MouseMove);
878
                count++;
879
            }
880
        }
881

    
882
        private void ResizeTm_DragDelta(object sender, DragDeltaEventArgs e)
883
        {
884
            //한개 이상 선택 시 Resize 금지
885
            if (MemberSet.Count > 1)
886
                return;
887
            if (reSizePoint != new Point(0, 0))
888
            {
889
                Thumb thumb = sender as Thumb;
890

    
891
                Canvas.SetLeft(thumb, Canvas.GetLeft(thumb) +
892
                              e.HorizontalChange);
893
                Canvas.SetTop(thumb, Canvas.GetTop(thumb) +
894
                                        e.VerticalChange);
895

    
896
                Point setPoint = new Point(Canvas.GetLeft(thumb), Canvas.GetTop(thumb));
897

    
898

    
899
                //if (this.isDragging && MemberSet.Count <= 1)
900
                //if (thumb.IsDragging && MemberSet.Count <= 1 && DraggerThumb == thumb)
901
                //if (DraggerThumb == thumb)
902
                //{
903
                //Point setPoint = reSizePoint;
904
                //Canvas.SetLeft(thumb, setPoint.X);
905
                //Canvas.SetTop(thumb, setPoint.Y);
906
                AdornerMember control = (from userThumb in MemberSet
907
                                         where userThumb.ThumbList.Contains(thumb)
908
                                         select userThumb).FirstOrDefault();
909
                Point nearPoint = new Point(0, 0);
910
                IPath AllControl = control.DrawingData as IPath;
911
                if (ControlType.TextControl != control.Drawingtype)
912
                {
913

    
914
                    var temp = (MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl;
915
                    List<Point> ps = new List<Point>();
916

    
917
                    nearPoint = MathSet.getNearPoint((control.DrawingData as IPath).PointSet, setPoint);
918
                    //switch (Math.Abs(temp.Angle).ToString())
919
                    //{
920

    
921
                    //    case "90":
922
                    //        {
923
                    //            nearPoint = MathSet.getNearPoint((control.DrawingData as IPath).PointSet, setPoint);
924
                    //        }
925
                    //        break;
926
                    //    case "270":
927
                    //        {
928
                    //            nearPoint = MathSet.getNearPoint((control.DrawingData as IPath).PointSet, setPoint);
929
                    //        }
930
                    //        break;
931
                    //    default:
932
                    //        {
933
                    //            nearPoint = MathSet.getNearPoint((control.DrawingData as IPath).PointSet, setPoint);
934
                    //        }
935
                    //        break;
936
                    //}
937

    
938
                }
939
                for (int i = 0; i < (control.DrawingData as IPath).PointSet.Count; i++)
940
                {
941
                    switch (control.Drawingtype)
942
                    {
943
                        #region Arc + Line
944
                        case ControlType.ArrowMultiLine:
945
                        case ControlType.ArcLine:
946
                        case ControlType.SingleLine:
947
                        case ControlType.Triangle:
948
                            if (nearPoint.Equals(AllControl.PointSet[i]))
949
                            {
950
                                AllControl.PointSet[i] = setPoint;
951
                                AllControl.updateControl();
952
                                DynamicThumbUpdate(control);
953
                                BorderUpdate();
954

    
955
                                //if (control.DrawingData.GetType().Name == "ArrowTextControl")
956
                                //{
957
                                //    Thumb tm = control.ThumbList.Last();
958
                                //    //Canvas.SetLeft(tm, (AllControl.EndPoint.X - tm.Width / 2));
959
                                //    //Canvas.SetTop(tm, (AllControl.EndPoint.Y - tm.Height / 2));
960
                                //    Canvas.SetLeft(tm, (AllControl.EndPoint.X - tm.Width));
961
                                //    Canvas.SetTop(tm, (AllControl.EndPoint.Y - tm.Height));
962
                                //}
963
                            }
964
                            break;
965
                        #endregion
966
                        #region Shape
967
                        //case ControlType.PolygonCloud:
968
                        case ControlType.RectCloud:
969
                        case ControlType.Rectangle:
970
                            if (nearPoint.Equals(AllControl.PointSet[i]))
971
                            {
972
                                AllControl.PointSet[i] = setPoint;
973
                                var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count();
974
                                var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count();
975
                                var NextP = (i + 1) % AllControl.PointSet.Count();
976

    
977
                                var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]);
978

    
979
                                var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]);
980
                                var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X,
981
                                    AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y);
982
                                AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet
983
                                    [ReverseP].Y
984
                                    + PreviousV.Y * l);
985

    
986
                                var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]);
987
                                l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet
988
                                    [i].Y - AllControl.PointSet[ReverseP].Y);
989
                                AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y +
990
                                    NextV.Y * l);
991
                                AllControl.updateControl();
992
                                DynamicThumbUpdate(control);
993
                                BorderUpdate();
994
                            }
995
                            break;
996
                        #endregion
997
                        #region Polygon
998
                        case ControlType.PolygonControl:
999
                            if (nearPoint.Equals(AllControl.PointSet[i]))
1000
                            {
1001
                                AllControl.PointSet[i] = setPoint;
1002
                                AllControl.updateControl();
1003
                                BorderUpdate();
1004
                            }
1005
                            break;
1006
                        #endregion
1007
                        #region Cicle
1008
                        case ControlType.Circle:
1009
                            if (nearPoint.Equals(AllControl.PointSet[i]))
1010
                            {
1011
                                AllControl.PointSet[i] = setPoint;
1012
                                List<Point> newPointSet = new List<Point> { };
1013
                                Point middle = new Point(AllControl.PathData.Bounds.X + AllControl.PathData.Bounds.Width * 0.5,
1014
                                    AllControl.PathData.Bounds.Y +
1015
                                    AllControl.PathData.Bounds.Height * 0.5);
1016
                                foreach (Point pt in AllControl.PointSet)
1017
                                {
1018
                                    newPointSet.Add(pt);
1019
                                }
1020
                                var ReverseP = (i + newPointSet.Count() / 2) % newPointSet.Count();
1021
                                var PreviousP = (i + (newPointSet.Count() - 1)) % newPointSet.Count();
1022
                                var NextP = (i + 1) % newPointSet.Count();
1023
                                var distance = MathSet.DistanceTo(newPointSet[ReverseP], newPointSet[i]);
1024
                                var PreviousV = MathSet.GetNormVectorBetween(newPointSet[ReverseP], newPointSet[PreviousP]);
1025
                                var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, newPointSet[i].X - newPointSet[ReverseP].X,
1026
                                    newPointSet[i].Y - newPointSet[ReverseP].Y);
1027
                                newPointSet[PreviousP] = new Point(newPointSet[ReverseP].X + PreviousV.X * l, newPointSet[ReverseP].Y
1028
                                    + PreviousV.Y * l);
1029

    
1030
                                var NextV = MathSet.GetNormVectorBetween(newPointSet[ReverseP], newPointSet[NextP]);
1031
                                l = MathSet.DotProduct(NextV.X, NextV.Y, newPointSet[i].X - newPointSet[ReverseP].X, newPointSet[i].Y
1032
                                    - newPointSet[ReverseP].Y);
1033
                                newPointSet[NextP] = new Point(newPointSet[ReverseP].X + NextV.X * l, newPointSet[ReverseP].Y + NextV.Y * l);
1034

    
1035
                                AllControl.PointSet = newPointSet;
1036
                                DynamicThumbUpdate(control);
1037
                                AllControl.updateControl();
1038
                                BorderUpdate();
1039
                            }
1040
                            break;
1041
                        #endregion
1042
                        #region ArrowText
1043
                        case ControlType.ArrowTextControl:
1044
                            if (nearPoint.Equals(AllControl.PointSet[i]))
1045
                            {
1046
                                AllControl.PointSet[i] = setPoint;
1047
                                AllControl.updateControl();
1048

    
1049
                                DynamicThumbUpdate(control);
1050
                                BorderUpdate();
1051

    
1052
                                //if (control.DrawingData.GetType().Name == "ArrowTextControl")
1053
                                //{
1054
                                //    Thumb tm = control.ThumbList.Last();
1055
                                //    //Canvas.SetLeft(tm, (AllControl.EndPoint.X - tm.Width / 2));
1056
                                //    //Canvas.SetTop(tm, (AllControl.EndPoint.Y - tm.Height / 2));
1057
                                //    Canvas.SetLeft(tm, (AllControl.EndPoint.X - tm.Width));
1058
                                //    Canvas.SetTop(tm, (AllControl.EndPoint.Y - tm.Height));
1059
                                //}
1060
                            }
1061
                            break;
1062
                        #endregion
1063
                        #region Text
1064
                        case ControlType.TextControl:
1065
                            break;
1066
                        #endregion
1067
                        #region Image
1068
                        case ControlType.ImgControl:
1069
                            if (nearPoint.Equals(AllControl.PointSet[i]))
1070
                            {
1071
                                AllControl.PointSet[i] = setPoint;
1072
                                var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count();
1073
                                var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count();
1074
                                var NextP = (i + 1) % AllControl.PointSet.Count();
1075

    
1076
                                var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]);
1077

    
1078
                                var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]);
1079
                                var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X,
1080
                                    AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y);
1081
                                AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet
1082
                                    [ReverseP].Y
1083
                                    + PreviousV.Y * l);
1084

    
1085
                                var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]);
1086
                                l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet
1087
                                    [i].Y - AllControl.PointSet[ReverseP].Y);
1088
                                AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y +
1089
                                    NextV.Y * l);
1090
                                AllControl.updateControl();
1091
                                DynamicThumbUpdate(control);
1092
                                BorderUpdate();
1093
                            }
1094
                            break;
1095
                        #endregion
1096
                        //강인구 추가
1097
                        #region Sign
1098
                        case ControlType.Sign:
1099
                            if (nearPoint.Equals(AllControl.PointSet[i]))
1100
                            {
1101
                                AllControl.PointSet[i] = setPoint;
1102
                                var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count();
1103
                                var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count();
1104
                                var NextP = (i + 1) % AllControl.PointSet.Count();
1105

    
1106
                                var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]);
1107

    
1108
                                var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]);
1109
                                var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X,
1110
                                    AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y);
1111
                                AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet
1112
                                    [ReverseP].Y
1113
                                    + PreviousV.Y * l);
1114

    
1115
                                var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]);
1116
                                l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet
1117
                                    [i].Y - AllControl.PointSet[ReverseP].Y);
1118
                                AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y +
1119
                                    NextV.Y * l);
1120
                                AllControl.updateControl();
1121
                                DynamicThumbUpdate(control);
1122
                                BorderUpdate();
1123
                            }
1124
                            break;
1125
                        #endregion
1126
                        #region Cloud
1127
                        case ControlType.PolygonCloud:
1128
                            if (nearPoint.Equals(AllControl.PointSet[i]))
1129
                            {
1130
                                AllControl.PointSet[i] = setPoint;
1131
                                AllControl.updateControl();
1132
                                ((ICloudControl)AllControl).DrawingCloud();
1133
                                BorderUpdate();
1134
                            }
1135
                            break;
1136
                        #endregion
1137
                        #region SymBol
1138
                        case ControlType.Symbol:
1139
                            if (nearPoint.Equals(AllControl.PointSet[i]))
1140
                            {
1141
                                AllControl.PointSet[i] = setPoint;
1142
                                var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count();
1143
                                var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count();
1144
                                var NextP = (i + 1) % AllControl.PointSet.Count();
1145

    
1146
                                var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]);
1147

    
1148
                                var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]);
1149
                                var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X,
1150
                                    AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y);
1151
                                AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet
1152
                                    [ReverseP].Y
1153
                                    + PreviousV.Y * l);
1154

    
1155
                                var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]);
1156
                                l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet
1157
                                    [i].Y - AllControl.PointSet[ReverseP].Y);
1158
                                AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y +
1159
                                    NextV.Y * l);
1160
                                AllControl.updateControl();
1161
                                DynamicThumbUpdate(control);
1162
                                BorderUpdate();
1163
                            }
1164
                            break;
1165
                        case ControlType.Stamp:
1166
                            if (nearPoint.Equals(AllControl.PointSet[i]))
1167
                            {
1168
                                AllControl.PointSet[i] = setPoint;
1169
                                var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count();
1170
                                var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count();
1171
                                var NextP = (i + 1) % AllControl.PointSet.Count();
1172

    
1173
                                var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]);
1174

    
1175
                                var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]);
1176
                                var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X,
1177
                                    AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y);
1178
                                AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet
1179
                                    [ReverseP].Y
1180
                                    + PreviousV.Y * l);
1181

    
1182
                                var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]);
1183
                                l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet
1184
                                    [i].Y - AllControl.PointSet[ReverseP].Y);
1185
                                AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y +
1186
                                    NextV.Y * l);
1187
                                AllControl.updateControl();
1188
                                DynamicThumbUpdate(control);
1189
                                BorderUpdate();
1190
                            }
1191
                            break;
1192
                        case ControlType.Date:
1193
                            if (nearPoint.Equals(AllControl.PointSet[i]))
1194
                            {
1195
                                AllControl.PointSet[i] = setPoint;
1196
                                var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count();
1197
                                var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count();
1198
                                var NextP = (i + 1) % AllControl.PointSet.Count();
1199

    
1200
                                var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]);
1201

    
1202
                                var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]);
1203
                                var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X,
1204
                                    AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y);
1205
                                AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet
1206
                                    [ReverseP].Y
1207
                                    + PreviousV.Y * l);
1208

    
1209
                                var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]);
1210
                                l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet
1211
                                    [i].Y - AllControl.PointSet[ReverseP].Y);
1212
                                AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y +
1213
                                    NextV.Y * l);
1214
                                AllControl.updateControl();
1215
                                DynamicThumbUpdate(control);
1216
                                BorderUpdate();
1217
                            }
1218
                            break;
1219
                        //case MarkupType.Viewbox:
1220
                        //    if (nearPoint.Equals(AllControl.PointSet[i]))
1221
                        //    {
1222
                        //        AllControl.PointSet[i] = setPoint;
1223
                        //        var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count();
1224
                        //        var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count();
1225
                        //        var NextP = (i + 1) % AllControl.PointSet.Count();
1226

    
1227
                        //        var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]);
1228

    
1229
                        //        var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]);
1230
                        //        var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X,
1231
                        //            AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y);
1232
                        //        AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet
1233
                        //            [ReverseP].Y
1234
                        //            + PreviousV.Y * l);
1235

    
1236
                        //        var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]);
1237
                        //        l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet
1238
                        //            [i].Y - AllControl.PointSet[ReverseP].Y);
1239
                        //        AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y +
1240
                        //            NextV.Y * l);
1241
                        //        AllControl.updateControl();
1242
                        //        DynamicThumbUpdate(control);
1243
                        //        BorderUpdate();
1244
                        //    }
1245
                        //    break;
1246
                        #endregion
1247
                        #region Ink
1248
                        case ControlType.Ink:
1249
                            if (nearPoint.Equals(AllControl.PointSet[i]))
1250
                            {
1251
                                AllControl.PointSet[i] = setPoint;
1252
                                AllControl.updateControl();
1253
                                BorderUpdate();
1254
                            }
1255
                            break;
1256
                        #endregion
1257
                        default:
1258
                            break;
1259
                    }
1260
                }
1261
            }
1262
            //}
1263
        }
1264

    
1265

    
1266

    
1267
        #endregion
1268
        #region 이벤트
1269

    
1270
        void tm_DragCompleted(object sender, DragCompletedEventArgs e)
1271
        {
1272
            this.isDragging = false;
1273
            DraggerThumb = null;
1274

    
1275
            Undo_Event();
1276
        }
1277

    
1278
        void tm_DragStarted(object sender, DragStartedEventArgs e)
1279
        {
1280
            this.DraggerThumb = sender as Thumb;
1281
            this.isDragging = true;
1282

    
1283
            if (ViewerDataModel.Instance.UndoDataList == null)
1284
            {
1285
                return;
1286
            }
1287

    
1288
            if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Event == Event_Type.Thumb)
1289
            {
1290
                return;
1291
            }
1292

    
1293
            if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List != null)
1294
            {
1295
                if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.Count > 0)
1296
                {
1297
                    if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.FirstOrDefault().PointSet != null)
1298
                    {
1299
                        return;
1300
                    }
1301
                }
1302
            }
1303

    
1304
            Undo_Event();
1305
        }
1306

    
1307
        private void rotate_MouseMove(object sender, MouseEventArgs e)
1308
        {
1309

    
1310
            //double LastRotateHorizontalValue = 0;
1311
            //double LastRotateVerticalValue = 0;
1312
            //double LastWidthValue = 0;
1313
            //double SetWidth = 0;
1314

    
1315

    
1316
            if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "TextControl")
1317
            {
1318
                if (LastRotateVerticalValue < e.GetPosition(this).X)
1319
                    IsTextAngle = true;
1320
                else
1321
                    IsTextAngle = false;
1322

    
1323
                //System.Diagnostics.Debug.WriteLine("X축 : " + e.GetPosition(this).X + "LastRotateVerticalValue : " + LastRotateVerticalValue);
1324
                LastRotateVerticalValue = e.GetPosition(this).X;
1325
            }
1326
            else
1327
            {
1328
                //System.Diagnostics.Debug.WriteLine("e.GetPosition(this).X : " + e.GetPosition(this).X);
1329
                //System.Diagnostics.Debug.WriteLine("LastRotateHorizontalValue: " + LastRotateHorizontalValue);
1330

    
1331
                if (e.GetPosition(this).X > LastRotateHorizontalValue)
1332
                {
1333
                    RotateFlag = true;
1334
                }
1335
                else
1336
                {
1337
                    RotateFlag = false;
1338
                }
1339
                LastRotateHorizontalValue = e.GetPosition(this).X;
1340
            }
1341
        }
1342

    
1343
        private void DragThumb_DragDelta(object sender, DragDeltaEventArgs e)
1344
        {
1345
            DragThumb.Cursor = Cursors.SizeAll;
1346
            Thumb thumb = sender as Thumb;
1347
            MoveAdorner(e);
1348
        }
1349

    
1350
        public void MoveAdorner(DragDeltaEventArgs e)
1351
        {
1352
            Point dragDelta = new Point(e.HorizontalChange, e.VerticalChange);
1353

    
1354
            Dispatcher.BeginInvoke((Action)(() =>
1355
            {
1356
                foreach (var item in MemberSet)
1357
                {
1358
                    #region 라인  & 아크
1359
                    if (item.Drawingtype == ControlType.SingleLine || item.Drawingtype == ControlType.ArcLine || item.Drawingtype == ControlType.ArrowMultiLine)
1360
                    {
1361
                        DynamicThumbUpdate(e, item);
1362
                    }
1363
                    #endregion
1364
                    #region 지시선화살표
1365
                    if (item.Drawingtype == ControlType.ArrowTextControl)
1366
                    {
1367
                        DynamicThumbUpdate(e, item);
1368
                    }
1369
                    #endregion
1370
                    //강인구 추가 Sign, check, Stamp
1371
                    #region 써클
1372
                    if (item.Drawingtype == ControlType.Circle || item.Drawingtype == ControlType.Sign || item.Drawingtype == ControlType.Symbol || item.Drawingtype == ControlType.Stamp)
1373
                    {
1374
                        DynamicThumbUpdate(e, item);
1375
                    }
1376
                    #endregion
1377
                    #region 쉐이프
1378
                    if (item.Drawingtype == ControlType.Rectangle || item.Drawingtype == ControlType.ImgControl || item.Drawingtype == ControlType.RectCloud || item.Drawingtype == ControlType.Triangle)
1379
                    {
1380
                        DynamicThumbUpdate(e, item);
1381
                    }
1382
                    #endregion
1383
                    #region 텍스트
1384
                    if (item.Drawingtype == ControlType.TextControl)
1385
                    {
1386
                        //Canvas.SetLeft((item.DrawingData as TextControl), Canvas.GetLeft((item.DrawingData as TextControl)) + e.HorizontalChange / 5);
1387
                        //Canvas.SetTop((item.DrawingData as TextControl), Canvas.GetTop((item.DrawingData as TextControl)) + e.VerticalChange / 5);
1388
                        //(item.DrawingData as TextControl).StartPoint = 
1389
                        //new Point(Canvas.GetLeft((item.DrawingData as TextControl)) + e.HorizontalChange / 5, Canvas.GetTop((item.DrawingData as TextControl)) + e.VerticalChange / 5);
1390
                        //(item.DrawingData as TextControl).EndPoint = (item.DrawingData as TextControl).StartPoint;
1391

    
1392
                        Point dx = MathSet.RotateAbout(new Point(0, 0), new Point(e.HorizontalChange, e.VerticalChange), trRotate.Angle);
1393
                        Canvas.SetLeft((item.DrawingData as TextControl), Canvas.GetLeft((item.DrawingData as TextControl)) + dx.X);
1394
                        Canvas.SetTop((item.DrawingData as TextControl), Canvas.GetTop((item.DrawingData as TextControl)) + dx.Y);
1395
                        (item.DrawingData as TextControl).StartPoint =
1396
                        new Point(Canvas.GetLeft((item.DrawingData as TextControl)) + e.HorizontalChange / 5, Canvas.GetTop((item.DrawingData as TextControl)) + e.VerticalChange / 5);
1397
                        (item.DrawingData as TextControl).EndPoint = (item.DrawingData as TextControl).StartPoint;
1398

    
1399
                        (item.DrawingData as TextControl).CanvasX = (item.DrawingData as TextControl).StartPoint.X;
1400
                        (item.DrawingData as TextControl).CanvasY = (item.DrawingData as TextControl).StartPoint.Y;
1401
                    }
1402
                    #endregion
1403
                    #region 날짜
1404
                    if (item.Drawingtype == ControlType.Date)
1405
                    {
1406
                        DynamicThumbUpdate(e, item);
1407
                        //Canvas.SetLeft((item.DrawingData as DateControl), Canvas.GetLeft((item.DrawingData as DateControl)) + e.HorizontalChange);
1408
                        //Canvas.SetTop((item.DrawingData as DateControl), Canvas.GetTop((item.DrawingData as DateControl)) + e.VerticalChange);
1409
                        //(item.DrawingData as DateControl).StartPoint = new Point(Canvas.GetLeft((item.DrawingData as DateControl))
1410
                        //                                         + e.HorizontalChange, Canvas.GetTop((item.DrawingData as DateControl)) + e.VerticalChange);
1411
                        //(item.DrawingData as DateControl).EndPoint = (item.DrawingData as DateControl).StartPoint;
1412
                        //MessageBox.Show("잠시 정확도를 위해 막아두었습니다!");
1413

    
1414

    
1415
                    }
1416
                    #endregion
1417
                    #region 클라우드
1418
                    if (item.Drawingtype == ControlType.PolygonCloud)
1419
                    {
1420
                        ICloudControl temp = ((ICloudControl)item.DrawingData);
1421
                        DynamicThumbUpdate(e, item);
1422
                        temp.DrawingCloud();
1423
                    }
1424
                    #endregion
1425
                    #region 심볼
1426
                    //if (item.Drawingtype == MarkupType.Viewbox)
1427
                    //{
1428
                    //    DynamicThumbUpdate(e, item);
1429
                    //    BorderUpdate();
1430
                    //}
1431
                    #endregion
1432
                    #region 폴리곤확장
1433
                    //if (item.Drawingtype == MarkupType.PolygonEx)
1434
                    //{
1435
                    //    Point px = new Point(e.HorizontalChange, e.VerticalChange);
1436
                    //    List<StylusPointSet> StylusPointSet = (item.DrawingData as PolyControl).PointC;
1437
                    //    for (int i = 0; i < StylusPointSet.Count; i++)
1438
                    //    {
1439
                    //        List<Point> lstPoint = StylusPointSet[i].pointSet;
1440
                    //        for (int j = 0; j < lstPoint.Count; j++)
1441
                    //        {
1442
                    //            lstPoint[j] = new Point(lstPoint[j].X + px.X, lstPoint[j].Y + px.Y);
1443
                    //        }
1444
                    //    }
1445

    
1446
                    //    for (int i = 0; i < item.ThumbList.Count; i++)
1447
                    //    {
1448
                    //        Canvas.SetLeft(item.ThumbList[i], Canvas.GetLeft(item.ThumbList[i]) + px.X);
1449
                    //        Canvas.SetTop(item.ThumbList[i], Canvas.GetTop(item.ThumbList[i]) + px.Y);
1450
                    //    }
1451
                    //    (item.DrawingData as IPath).updateControl();
1452
                    //    BorderUpdate();
1453
                    //    //for (int i = 0; i < (item.DrawingData as PolyControl).PointC.Count(); i++)
1454
                    //    //{
1455
                    //    //    //(item.DrawingData as PolyControl).PointC[i] = MathSet.RotateAbout(CenterPoint, (item.DrawingData as PolyControl).PointC[i]., dDeltaAngle);
1456
                    //    //    for (int j = 0; j < (item.DrawingData as PolyControl).PointC[i].pointSet.Count; j++)
1457
                    //    //    {
1458
                    //    //        (item.DrawingData as PolyControl).PointC[i].pointSet[j] = new Point { X = (item.DrawingData as PolyControl).PointC[i].pointSet[j].X + dx.X, Y = (item.DrawingData as PolyControl).PointC[i].pointSet[j].Y + dx.Y };
1459
                    //    //        Canvas.SetLeft(item.ThumbList[i], Canvas.GetLeft(item.ThumbList[i]) + dx.X);
1460
                    //    //        Canvas.SetTop(item.ThumbList[i], Canvas.GetTop(item.ThumbList[i]) + dx.Y);
1461
                    //    //    }
1462
                    //    //}
1463
                    //    //(item.DrawingData as IPath).updateControl();
1464
                    //}
1465
                    #endregion
1466
                    #region 폴리곤
1467
                    if (item.Drawingtype == ControlType.PolygonControl)
1468
                    {
1469
                        DynamicThumbUpdate(e, item);
1470
                        BorderUpdate();
1471
                    }
1472
                    #endregion
1473
                    #region 잉크
1474
                    if (item.Drawingtype == ControlType.Ink)
1475
                    {
1476
                        //DynamicThumbUpdate(e, item);
1477
                        //BorderUpdate();
1478

    
1479
                        Point px = new Point(e.HorizontalChange, e.VerticalChange);
1480
                        List<StylusPointSet> StylusPointSet = (item.DrawingData as InkControl).PointC;
1481
                        for (int i = 0; i < StylusPointSet.Count; i++)
1482
                        {
1483
                            List<Point> lstPoint = StylusPointSet[i].pointSet;
1484
                            for (int j = 0; j < lstPoint.Count; j++)
1485
                            {
1486
                                lstPoint[j] = new Point(lstPoint[j].X + px.X, lstPoint[j].Y + px.Y);
1487
                            }
1488
                        }
1489

    
1490
                        for (int i = 0; i < item.ThumbList.Count; i++)
1491
                        {
1492
                            Canvas.SetLeft(item.ThumbList[i], Canvas.GetLeft(item.ThumbList[i]) + px.X);
1493
                            Canvas.SetTop(item.ThumbList[i], Canvas.GetTop(item.ThumbList[i]) + px.Y);
1494
                        }
1495
                        (item.DrawingData as IPath).updateControl();
1496
                        BorderUpdate();
1497

    
1498
                    }
1499
                    #endregion
1500
                    BorderUpdate();
1501
                }
1502
            }));
1503
        }
1504

    
1505
        public void DynamicThumbUpdate(DragDeltaEventArgs e, AdornerMember item)
1506
        {
1507
            var AllControl = item.DrawingData as IPath;
1508
            List<Point> point = AllControl.PointSet;
1509
            //for (int i = 0; i < AllControl.PointSet.Count(); i++)
1510
            for (int i = 0; i < item.ThumbList.Count(); i++)
1511
            {
1512

    
1513
                if (item.DrawingData.GetType().Name == "ArrowTextControl")
1514
                {
1515
                    Point dx = MathSet.RotateAbout(new Point(0, 0), new Point(e.HorizontalChange, e.VerticalChange), trRotate.Angle);
1516
                    AllControl.PointSet[i] = new Point { X = point[i].X + dx.X, Y = point[i].Y + dx.Y };
1517
                    AllControl.updateControl();
1518
                    Canvas.SetLeft(item.ThumbList[i], Canvas.GetLeft(item.ThumbList[i]) + dx.X);
1519
                    Canvas.SetTop(item.ThumbList[i], Canvas.GetTop(item.ThumbList[i]) + dx.Y);
1520

    
1521
                    Canvas.SetLeft(item.ThumbList.Last(), Canvas.GetLeft((item.DrawingData as ArrowTextControl).Base_TextBox));
1522
                    Canvas.SetTop(item.ThumbList.Last(), Canvas.GetTop((item.DrawingData as ArrowTextControl).Base_TextBox));
1523
                }
1524
                else
1525
                {
1526
                    Point dx = MathSet.RotateAbout(new Point(0, 0), new Point(e.HorizontalChange, e.VerticalChange), trRotate.Angle);
1527
                    AllControl.PointSet[i] = new Point { X = point[i].X + dx.X, Y = point[i].Y + dx.Y };
1528
                    AllControl.updateControl();
1529
                    Canvas.SetLeft(item.ThumbList[i], Canvas.GetLeft(item.ThumbList[i]) + dx.X);
1530
                    Canvas.SetTop(item.ThumbList[i], Canvas.GetTop(item.ThumbList[i]) + dx.Y);
1531
                }
1532
            }
1533
        }
1534

    
1535
        public void DynamicThumbUpdate(AdornerMember item)
1536
        {
1537
            var AllControl = item.DrawingData as IPath;
1538
            List<Point> point = AllControl.PointSet;
1539

    
1540
            //if (item.DrawingData as ArrowTextControl !=null)
1541
            //{
1542
            //    for (int i = 0; i < AllControl.PointSet.Count(); i++)
1543
            //    {
1544
            //        if ((MemberSet.First() as AdornerMember).ThumbList[1]d)
1545
            //        {
1546

    
1547
            //        }
1548
            //    }
1549
            //    List<Point> ps = new List<Point>();
1550
            //    var temp = (MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl;
1551
            //    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단
1552
            //    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단
1553
            //    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단
1554
            //    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2));  //우단
1555

    
1556
            //    var endP = MathSet.getNearPoint(ps, temp.MidPoint);
1557
            //    var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP);
1558
            //    Canvas.SetLeft((MemberSet.First() as AdornerMember).ThumbList[1], tempP.X);
1559
            //    Canvas.SetTop((MemberSet.First() as AdornerMember).ThumbList[1], tempP.Y);    
1560
            //}
1561
            //else
1562
            //{
1563
            for (int i = 0; i < AllControl.PointSet.Count(); i++)
1564
            {
1565

    
1566
                Canvas.SetLeft(item.ThumbList[i], AllControl.PointSet[i].X);
1567
                Canvas.SetTop(item.ThumbList[i], AllControl.PointSet[i].Y);
1568
            }
1569

    
1570

    
1571
            if (item.DrawingData as ArrowTextControl != null)
1572
            {
1573
                if (!(item.DrawingData as ArrowTextControl).isTrans) //trans가 True인경우
1574
                {
1575
                    List<Point> ps = new List<Point>();
1576
                    //강인구 수정
1577
                    //var temp = (MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl;
1578
                    var temp = item.DrawingData as ArrowTextControl;
1579
                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단
1580
                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단
1581
                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단
1582
                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2));  //우단
1583

    
1584

    
1585

    
1586
                    if (temp.isFixed)
1587
                    {
1588
                        var endP = MathSet.getNearPoint(ps, temp.MidPoint);
1589
                        var testP = endP;
1590
                        if (ps[0] == endP) //상단
1591
                        {
1592
                            testP = new Point(endP.X, endP.Y - 50);
1593
                            System.Diagnostics.Debug.WriteLine("상단");
1594
                        }
1595
                        else if (ps[1] == endP) //하단
1596
                        {
1597
                            testP = new Point(endP.X, endP.Y + 50);
1598
                            System.Diagnostics.Debug.WriteLine("하단");
1599
                        }
1600
                        else if (ps[2] == endP) //좌단
1601
                        {
1602
                            testP = new Point(endP.X - 50, endP.Y);
1603
                            System.Diagnostics.Debug.WriteLine("좌단");
1604
                        }
1605
                        else if (ps[3] == endP) //우단
1606
                        {
1607
                            testP = new Point(endP.X + 50, endP.Y);
1608
                            System.Diagnostics.Debug.WriteLine("우단");
1609
                        }
1610
                        Canvas.SetLeft((MemberSet.First() as AdornerMember).ThumbList[1], testP.X);
1611
                        Canvas.SetTop((MemberSet.First() as AdornerMember).ThumbList[1], testP.Y);
1612
                    }
1613
                    else
1614
                    {
1615
                        var endP = MathSet.getNearPoint(ps, temp.MidPoint);
1616
                        var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP);
1617
                        Canvas.SetLeft((MemberSet.First() as AdornerMember).ThumbList[1], tempP.X);
1618
                        Canvas.SetTop((MemberSet.First() as AdornerMember).ThumbList[1], tempP.Y);
1619
                    }
1620
                }
1621
            }
1622
            //}
1623
        }
1624

    
1625
        public void Set_Rotate()
1626
        {
1627

    
1628
            double dDeltaAngle = 0;
1629
            List<Point> AllPointSet = new List<Point>();
1630
            Point CenterPoint = new Point();
1631

    
1632

    
1633
            if (AngleValue >= 360)
1634
            {
1635
                AngleValue -= 360;
1636
            }
1637
            else if (AngleValue <= -360)
1638
            {
1639
                AngleValue += 360;
1640
            }
1641

    
1642
            #region 센터 포인트 구하기 (그룹핑)
1643
            foreach (var item in MemberSet)
1644
            {
1645
                if (item.DrawingData.GetType().Name == "TextControl")
1646
                {
1647
                }
1648
                else
1649
                {
1650
                    foreach (Point itemP in (item.DrawingData as IPath).PointSet)
1651
                    {
1652
                        AllPointSet.Add(itemP);
1653
                    }
1654
                }
1655
            }
1656
            #endregion
1657

    
1658
            CenterPoint = MathSet.FindCentroid(AllPointSet);
1659

    
1660
            Dispatcher.BeginInvoke((Action)(() =>
1661
            {
1662
                foreach (var item in MemberSet)
1663
                {
1664
                    foreach (var thumb in item.ThumbList)
1665
                    {
1666
                        double x = Canvas.GetLeft(thumb);
1667
                        double y = Canvas.GetTop(thumb);
1668

    
1669
                        Point value = MathSet.RotateAbout(CenterPoint, new Point(x, y), dDeltaAngle);
1670
                        Canvas.SetLeft(thumb, value.X);
1671
                        Canvas.SetTop(thumb, value.Y);
1672

    
1673
                        if (item.DrawingData.GetType().Name == "ArrowTextControl" && thumb == item.ThumbList.Last())
1674
                        {
1675

    
1676
                            Canvas.SetLeft(thumb, Canvas.GetLeft((item.DrawingData as ArrowTextControl).Base_TextBox));
1677
                            Canvas.SetTop(thumb, Canvas.GetTop((item.DrawingData as ArrowTextControl).Base_TextBox));
1678
                            if (!(item.DrawingData as ArrowTextControl).isTrans)
1679
                            {
1680
                                List<Point> ps = new List<Point>();
1681
                                var temp = (MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl;
1682
                                switch (Math.Abs(temp.Angle).ToString())
1683
                                {
1684
                                    case "90":
1685
                                        {
1686
                                            ps.Clear();
1687
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽
1688
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); // 위 중간
1689
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); // 위 오른쪽
1690

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

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

    
1697
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 중간
1698
                                        }
1699
                                        break;
1700
                                    case "270":
1701
                                        {
1702
                                            ps.Clear();
1703
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽
1704
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); // 위 중간
1705
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); // 위 오른쪽
1706

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

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

    
1713
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 중간
1714
                                        }
1715
                                        break;
1716
                                    default:
1717
                                        {
1718
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단
1719
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단
1720
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단
1721
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2));  //우단
1722
                                        }
1723
                                        break;
1724
                                }
1725

    
1726
                                var endP = MathSet.getNearPoint(ps, temp.MidPoint);
1727
                                var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP);
1728
                                Canvas.SetLeft((MemberSet.First() as AdornerMember).ThumbList[1], tempP.X);
1729
                                Canvas.SetTop((MemberSet.First() as AdornerMember).ThumbList[1], tempP.Y);
1730
                            }
1731
                        }
1732
                    }
1733

    
1734
                    for (int i = 0; i < (item.DrawingData as IPath).PointSet.Count(); i++)
1735
                    {
1736
                        (item.DrawingData as IPath).PointSet[i] = MathSet.RotateAbout(CenterPoint, (item.DrawingData as IPath).PointSet[i], dDeltaAngle);
1737
                    }
1738
                }
1739
                #region 컨트롤 업데이트
1740
                foreach (var item in MemberSet)
1741
                {
1742
                    switch (item.Drawingtype)
1743
                    {
1744
                        case ControlType.TextControl:
1745
                            ((TextControl)item.DrawingData).Angle = AngleValue;
1746
                            //trRotate.Angle = AngleValue;
1747

    
1748
                            RectangleGeometry Data = new RectangleGeometry
1749
                            {
1750
                                Rect = new Rect()
1751
                                {
1752
                                    X = Canvas.GetLeft((item.DrawingData as TextControl)),
1753
                                    Y = Canvas.GetTop((item.DrawingData as TextControl)),
1754
                                    Width = (item.DrawingData as TextControl).Base_TextBlock.ActualWidth / 2,
1755
                                    Height = (item.DrawingData as TextControl).Base_TextBlock.ActualHeight / 2,
1756
                                }
1757
                            };
1758
                            //if ((firstCondition as TextControl).Angle != 0)
1759
                            //{
1760
                            Point endPointV = new Point(Data.Bounds.Right, Data.Bounds.Bottom);
1761
                            Point middle = MathSet.getMiddlePoint((item.DrawingData as TextControl).StartPoint, endPointV);
1762

    
1763

    
1764
                            //AdornerBorder.RenderTransformOrigin = new Point(1, 1);
1765
                            //AdornerBorder.RenderTransform = new RotateTransform()
1766
                            //{
1767
                            //    Angle = (member as TextControl).Angle * -1,
1768
                            //    CenterX = middle.X + ((member as TextControl) as FrameworkElement).ActualWidth /2,
1769
                            //    CenterY = middle.Y + ((member as TextControl) as FrameworkElement).ActualHeight /2,
1770
                            //};
1771

    
1772
                            DragThumb.RenderTransformOrigin = new Point(0.0, 0.0);
1773
                            DragThumb.RenderTransform = new RotateTransform()
1774
                            {
1775
                                Angle = (item.DrawingData as TextControl).Angle,
1776
                                //CenterX = middle.X,
1777
                                //CenterY = middle.Y,
1778
                            };
1779

    
1780
                            AdornerBorder.RenderTransformOrigin = new Point(0.0, 0.0);
1781
                            AdornerBorder.RenderTransform = new RotateTransform()
1782
                            {
1783
                                Angle = (item.DrawingData as TextControl).Angle,
1784
                                //CenterX = middle.X,
1785
                                //CenterY = middle.Y,
1786
                            };
1787

    
1788
                            (item.DrawingData as TextControl).Base_Grid.RenderTransform = new RotateTransform()
1789
                            {
1790
                                Angle = (item.DrawingData as TextControl).Angle,
1791
                            };
1792

    
1793
                            BorderUpdate();
1794
                            break;
1795
                        //case ControlType.Viewbox:
1796
                        //    (item.DrawingData as IPath).updateControl();
1797
                        //    ((IViewBox)item.DrawingData).Angle = AngleValue;
1798
                        //    BorderUpdate();
1799
                        //    break;
1800
                        case ControlType.Date:
1801
                            //강인구 추가(2018.02.22)
1802
                            ((DateControl)item.DrawingData).Angle = AngleValue;
1803
                            (item.DrawingData as IPath).updateControl();
1804
                            BorderUpdate();
1805
                            //MessageBox.Show("잠시 정확도를 위해 막아두었습니다!");
1806
                            break;
1807
                        case ControlType.ArrowMultiLine:
1808
                        case ControlType.ArcLine:
1809
                        case ControlType.SingleLine:
1810
                        case ControlType.Triangle:
1811
                            (item.DrawingData as IPath).updateControl();
1812
                            BorderUpdate();
1813
                            break;
1814
                        case ControlType.ArrowTextControl:
1815
                            (item.DrawingData as IPath).updateControl();
1816
                            BorderUpdate();
1817
                            break;
1818
                        case ControlType.RectCloud:
1819
                            ((RectCloudControl)item.DrawingData).Angle = AngleValue;
1820
                            (item.DrawingData as IPath).updateControl();
1821
                            BorderUpdate();
1822
                            break;
1823
                        case ControlType.Rectangle:
1824
                            ((RectangleControl)item.DrawingData).Angle = AngleValue;
1825
                            (item.DrawingData as IPath).updateControl();
1826
                            BorderUpdate();
1827
                            break;
1828
                        case ControlType.ImgControl:
1829
                            ((ImgControl)item.DrawingData).Angle = AngleValue;
1830
                            (item.DrawingData as IPath).updateControl();
1831
                            BorderUpdate();
1832
                            break;
1833
                        //강인구 추가
1834
                        case ControlType.Sign:
1835
                            ((SignControl)item.DrawingData).Angle = AngleValue;
1836
                            (item.DrawingData as IPath).updateControl();
1837
                            BorderUpdate();
1838
                            break;
1839
                        //강인구 추가
1840
                        case ControlType.Symbol:
1841
                            ((SymControl)item.DrawingData).Angle = AngleValue;
1842
                            (item.DrawingData as IPath).updateControl();
1843
                            BorderUpdate();
1844
                            break;
1845
                        //강인구 추가
1846
                        case ControlType.Stamp:
1847
                            ((SymControlN)item.DrawingData).Angle = AngleValue;
1848
                            (item.DrawingData as IPath).updateControl();
1849
                            BorderUpdate();
1850
                            break;
1851
                        case ControlType.PolygonControl:
1852
                            //((IShapeControl)AllControl).Angle = AngleValue;
1853
                            (item.DrawingData as IPath).updateControl();
1854
                            BorderUpdate();
1855
                            break;
1856
                        case ControlType.PolygonCloud:
1857
                            //((IShapeControl)AllControl).Angle = AngleValue;
1858
                            ((ICloudControl)item.DrawingData).DrawingCloud();
1859
                            (item.DrawingData as IPath).updateControl();
1860
                            BorderUpdate();
1861
                            break;
1862
                        case ControlType.Circle:
1863
                            ((IShapeControl)item.DrawingData).Angle = AngleValue;
1864
                            (item.DrawingData as IPath).updateControl();
1865
                            ((CircleControl)item.DrawingData).SetCenterXY();
1866
                            BorderUpdate();
1867
                            break;
1868
                        case ControlType.Ink:
1869
                            //((IShapeControl)AllControl).Angle = AngleValue;
1870
                            (item.DrawingData as IPath).updateControl();
1871
                            BorderUpdate();
1872
                            break;
1873
                        default:
1874
                            break;
1875
                    }
1876
                }
1877
                #endregion
1878
            }));
1879
            //BorderUpdate();
1880
        }
1881

    
1882
        private void resize_MouseMove(object sender, MouseEventArgs e)
1883
        {
1884
            reSizePoint = e.GetPosition(this);
1885
            //Thumb thumb = sender as Thumb;
1886
            //if (this.isDragging && MemberSet.Count <= 1 && DraggerThumb == thumb)
1887
            ////if (thumb.IsDragging && MemberSet.Count <= 1 && DraggerThumb == thumb)
1888
            ////if (DraggerThumb == thumb)
1889
            //{
1890
            //    Point setPoint = e.GetPosition(this);
1891
            //    Canvas.SetLeft(thumb, setPoint.X);
1892
            //    Canvas.SetTop(thumb, setPoint.Y);
1893
            //    AdornerMember control = (from userThumb in MemberSet
1894
            //                             where userThumb.ThumbList.Contains(thumb)
1895
            //                             select userThumb).FirstOrDefault();
1896
            //    Point nearPoint = new Point(0, 0);
1897
            //    IPath AllControl = control.DrawingData as IPath;
1898
            //    if (ControlType.TextControl != control.Drawingtype)
1899
            //    {
1900

    
1901
            //        var temp = (MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl;
1902
            //        List<Point> ps = new List<Point>();
1903

    
1904
            //        nearPoint = MathSet.getNearPoint((control.DrawingData as IPath).PointSet, setPoint);
1905
            //        //switch (Math.Abs(temp.Angle).ToString())
1906
            //        //{
1907

    
1908
            //        //    case "90":
1909
            //        //        {
1910
            //        //            nearPoint = MathSet.getNearPoint((control.DrawingData as IPath).PointSet, setPoint);
1911
            //        //        }
1912
            //        //        break;
1913
            //        //    case "270":
1914
            //        //        {
1915
            //        //            nearPoint = MathSet.getNearPoint((control.DrawingData as IPath).PointSet, setPoint);
1916
            //        //        }
1917
            //        //        break;
1918
            //        //    default:
1919
            //        //        {
1920
            //        //            nearPoint = MathSet.getNearPoint((control.DrawingData as IPath).PointSet, setPoint);
1921
            //        //        }
1922
            //        //        break;
1923
            //        //}
1924

    
1925
            //    }
1926
            //    for (int i = 0; i < (control.DrawingData as IPath).PointSet.Count; i++)
1927
            //    {
1928
            //        switch (control.Drawingtype)
1929
            //        {
1930
            //            #region Arc + Line
1931
            //            case ControlType.ArcLine:
1932
            //            case ControlType.SingleLine:
1933
            //                if (nearPoint.Equals(AllControl.PointSet[i]))
1934
            //                {
1935
            //                    AllControl.PointSet[i] = setPoint;
1936
            //                    AllControl.updateControl();
1937
            //                    DynamicThumbUpdate(control);
1938
            //                    BorderUpdate();
1939

    
1940
            //                    //if (control.DrawingData.GetType().Name == "ArrowTextControl")
1941
            //                    //{
1942
            //                    //    Thumb tm = control.ThumbList.Last();
1943
            //                    //    //Canvas.SetLeft(tm, (AllControl.EndPoint.X - tm.Width / 2));
1944
            //                    //    //Canvas.SetTop(tm, (AllControl.EndPoint.Y - tm.Height / 2));
1945
            //                    //    Canvas.SetLeft(tm, (AllControl.EndPoint.X - tm.Width));
1946
            //                    //    Canvas.SetTop(tm, (AllControl.EndPoint.Y - tm.Height));
1947
            //                    //}
1948
            //                }
1949
            //                break;
1950
            //            #endregion
1951
            //            #region Shape
1952
            //            case ControlType.Rectangle:
1953
            //                if (nearPoint.Equals(AllControl.PointSet[i]))
1954
            //                {
1955
            //                    AllControl.PointSet[i] = setPoint;
1956
            //                    var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count();
1957
            //                    var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count();
1958
            //                    var NextP = (i + 1) % AllControl.PointSet.Count();
1959

    
1960
            //                    var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]);
1961

    
1962
            //                    var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]);
1963
            //                    var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X,
1964
            //                        AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y);
1965
            //                    AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet
1966
            //                        [ReverseP].Y
1967
            //                        + PreviousV.Y * l);
1968

    
1969
            //                    var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]);
1970
            //                    l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet
1971
            //                        [i].Y - AllControl.PointSet[ReverseP].Y);
1972
            //                    AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y +
1973
            //                        NextV.Y * l);
1974
            //                    AllControl.updateControl();
1975
            //                    DynamicThumbUpdate(control);
1976
            //                    BorderUpdate();
1977
            //                }
1978
            //                break;
1979
            //            #endregion
1980
            //            #region Polygon
1981
            //            case ControlType.PolygonControl:
1982
            //                if (nearPoint.Equals(AllControl.PointSet[i]))
1983
            //                {
1984
            //                    AllControl.PointSet[i] = setPoint;
1985
            //                    AllControl.updateControl();
1986
            //                    BorderUpdate();
1987
            //                }
1988
            //                break;
1989
            //            #endregion
1990
            //            #region Cicle
1991
            //            case ControlType.Circle:
1992
            //                if (nearPoint.Equals(AllControl.PointSet[i]))
1993
            //                {
1994
            //                    AllControl.PointSet[i] = setPoint;
1995
            //                    List<Point> newPointSet = new List<Point> { };
1996
            //                    Point middle = new Point(AllControl.PathData.Bounds.X + AllControl.PathData.Bounds.Width * 0.5,
1997
            //                        AllControl.PathData.Bounds.Y +
1998
            //                        AllControl.PathData.Bounds.Height * 0.5);
1999
            //                    foreach (Point pt in AllControl.PointSet)
2000
            //                    {
2001
            //                        newPointSet.Add(pt);
2002
            //                    }
2003
            //                    var ReverseP = (i + newPointSet.Count() / 2) % newPointSet.Count();
2004
            //                    var PreviousP = (i + (newPointSet.Count() - 1)) % newPointSet.Count();
2005
            //                    var NextP = (i + 1) % newPointSet.Count();
2006
            //                    var distance = MathSet.DistanceTo(newPointSet[ReverseP], newPointSet[i]);
2007
            //                    var PreviousV = MathSet.GetNormVectorBetween(newPointSet[ReverseP], newPointSet[PreviousP]);
2008
            //                    var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, newPointSet[i].X - newPointSet[ReverseP].X,
2009
            //                        newPointSet[i].Y - newPointSet[ReverseP].Y);
2010
            //                    newPointSet[PreviousP] = new Point(newPointSet[ReverseP].X + PreviousV.X * l, newPointSet[ReverseP].Y
2011
            //                        + PreviousV.Y * l);
2012

    
2013
            //                    var NextV = MathSet.GetNormVectorBetween(newPointSet[ReverseP], newPointSet[NextP]);
2014
            //                    l = MathSet.DotProduct(NextV.X, NextV.Y, newPointSet[i].X - newPointSet[ReverseP].X, newPointSet[i].Y
2015
            //                        - newPointSet[ReverseP].Y);
2016
            //                    newPointSet[NextP] = new Point(newPointSet[ReverseP].X + NextV.X * l, newPointSet[ReverseP].Y + NextV.Y * l);
2017

    
2018
            //                    AllControl.PointSet = newPointSet;
2019
            //                    DynamicThumbUpdate(control);
2020
            //                    AllControl.updateControl();
2021
            //                    BorderUpdate();
2022
            //                }
2023
            //                break;
2024
            //            #endregion
2025
            //            #region ArrowText
2026
            //            case ControlType.ArrowTextControl:
2027
            //                if (nearPoint.Equals(AllControl.PointSet[i]))
2028
            //                {
2029
            //                    AllControl.PointSet[i] = setPoint;
2030
            //                    AllControl.updateControl();
2031

    
2032
            //                    DynamicThumbUpdate(control);
2033
            //                    BorderUpdate();
2034

    
2035
            //                    //if (control.DrawingData.GetType().Name == "ArrowTextControl")
2036
            //                    //{
2037
            //                    //    Thumb tm = control.ThumbList.Last();
2038
            //                    //    //Canvas.SetLeft(tm, (AllControl.EndPoint.X - tm.Width / 2));
2039
            //                    //    //Canvas.SetTop(tm, (AllControl.EndPoint.Y - tm.Height / 2));
2040
            //                    //    Canvas.SetLeft(tm, (AllControl.EndPoint.X - tm.Width));
2041
            //                    //    Canvas.SetTop(tm, (AllControl.EndPoint.Y - tm.Height));
2042
            //                    //}
2043
            //                }
2044
            //                break;
2045
            //            #endregion
2046
            //            #region Text
2047
            //            case ControlType.TextControl:
2048
            //                break;
2049
            //            #endregion
2050
            //            #region Image
2051
            //            case ControlType.ImgControl:
2052
            //                if (nearPoint.Equals(AllControl.PointSet[i]))
2053
            //                {
2054
            //                    AllControl.PointSet[i] = setPoint;
2055
            //                    var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count();
2056
            //                    var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count();
2057
            //                    var NextP = (i + 1) % AllControl.PointSet.Count();
2058

    
2059
            //                    var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]);
2060

    
2061
            //                    var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]);
2062
            //                    var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X,
2063
            //                        AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y);
2064
            //                    AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet
2065
            //                        [ReverseP].Y
2066
            //                        + PreviousV.Y * l);
2067

    
2068
            //                    var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]);
2069
            //                    l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet
2070
            //                        [i].Y - AllControl.PointSet[ReverseP].Y);
2071
            //                    AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y +
2072
            //                        NextV.Y * l);
2073
            //                    AllControl.updateControl();
2074
            //                    DynamicThumbUpdate(control);
2075
            //                    BorderUpdate();
2076
            //                }
2077
            //                break;
2078
            //            #endregion
2079
            //            #region Cloud
2080
            //            case ControlType.PolygonCloud:
2081
            //                if (nearPoint.Equals(AllControl.PointSet[i]))
2082
            //                {
2083
            //                    AllControl.PointSet[i] = setPoint;
2084
            //                    AllControl.updateControl();
2085
            //                    ((ICloudControl)AllControl).DrawingCloud();
2086
            //                    BorderUpdate();
2087
            //                }
2088
            //                break;
2089
            //            #endregion
2090
            //            #region SymBol
2091
            //            //case MarkupType.Viewbox:
2092
            //            //    if (nearPoint.Equals(AllControl.PointSet[i]))
2093
            //            //    {
2094
            //            //        AllControl.PointSet[i] = setPoint;
2095
            //            //        var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count();
2096
            //            //        var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count();
2097
            //            //        var NextP = (i + 1) % AllControl.PointSet.Count();
2098

    
2099
            //            //        var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]);
2100

    
2101
            //            //        var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]);
2102
            //            //        var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X,
2103
            //            //            AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y);
2104
            //            //        AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet
2105
            //            //            [ReverseP].Y
2106
            //            //            + PreviousV.Y * l);
2107

    
2108
            //            //        var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]);
2109
            //            //        l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet
2110
            //            //            [i].Y - AllControl.PointSet[ReverseP].Y);
2111
            //            //        AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y +
2112
            //            //            NextV.Y * l);
2113
            //            //        AllControl.updateControl();
2114
            //            //        DynamicThumbUpdate(control);
2115
            //            //        BorderUpdate();
2116
            //            //    }
2117
            //            //    break;
2118
            //            #endregion
2119
            //            default:
2120
            //                break;
2121
            //        }
2122
            //    }
2123
            //}
2124
        }
2125
        /// <summary>
2126
        /// 회전
2127
        /// </summary>
2128
        /// <param name="sender"></param>
2129
        /// <param name="e"></param>
2130
        public void rotate_DragDelta(object sender, DragDeltaEventArgs e)
2131
        {
2132

    
2133
            MoveRotate(e);
2134
        }
2135

    
2136
        double LastRotateHorizontalValue = 0;
2137
        double LastRotateVerticalValue = 0;
2138
        double LastWidthValue = 0;
2139
        double SetWidth = 0;
2140
        bool RotateFlag = false;
2141

    
2142
        /// <summary>
2143
        /// <history>humkyung 2018.05.09 upgrade rotate shape peformance</history>
2144
        /// </summary>
2145
        /// <param name="e"></param>
2146
        public void MoveRotate(DragDeltaEventArgs e)
2147
        {
2148
            double dDeltaAngle = 0;
2149

    
2150
            List<Point> AllPointSet = new List<Point>();
2151
            Point CenterPoint = new Point();
2152
            #region 회전율에 따른 DragDelta 값
2153

    
2154
            #region 원본소스
2155
            ////if (Math.Abs(e.HorizontalChange) > Math.Abs(e.VerticalChange))
2156
            ////{
2157
            //    //dDeltaAngle = +2;
2158
            //    //dDeltaAngle = (e.HorizontalChange / 20);
2159
            //    AngleValue = AngleValue + dDeltaAngle;
2160
            //    if (Math.Abs(e.HorizontalChange) > Math.Abs(e.VerticalChange))
2161
            //    {
2162
            //        if (LastRotateHorizontalValue < e.HorizontalChange)
2163
            //        {
2164
            //            dDeltaAngle = 2;
2165
            //            AngleValue = AngleValue + dDeltaAngle;
2166
            //        }
2167
            //        else
2168
            //        {
2169
            //            dDeltaAngle = -2;
2170
            //            AngleValue = AngleValue + dDeltaAngle;
2171
            //        }
2172
            //    }
2173
            //    //else
2174
            //    //{
2175
            //    //    if (LastRotateVerticalValue < e.VerticalChange)
2176
            //    //    {
2177
            //    //        dDeltaAngle = -2;
2178
            //    //        AngleValue = AngleValue + dDeltaAngle;
2179

    
2180
            //    //    }
2181
            //    //    else
2182
            //    //    {
2183
            //    //        dDeltaAngle = 2;
2184
            //    //        AngleValue = AngleValue + dDeltaAngle;
2185
            //    //    }
2186
            //    //}
2187
            ////}
2188
            ////else if (Math.Abs(e.HorizontalChange) < Math.Abs(e.VerticalChange))
2189
            ////{
2190
            ////    //dDeltaAngle = (e.VerticalChange / 20);
2191
            ////    dDeltaAngle = -2;
2192
            ////    AngleValue = AngleValue + dDeltaAngle;
2193
            ////} 
2194
            #endregion
2195

    
2196
            //강인구 수정
2197
            //AngleValue = AngleValue + dDeltaAngle;
2198
            #endregion
2199

    
2200
            #region 센터 포인트 구하기 (그룹핑)
2201
            foreach (var item in MemberSet)
2202
            {
2203
                if (item.DrawingData.GetType().Name == "TextControl")
2204
                {
2205
                    //if (AngleValue == 0)
2206
                    //{
2207
                    //    AngleValue = (item.DrawingData as TextControl).Angle;
2208
                    //}
2209
                    //double X = Canvas.GetLeft((item.DrawingData as TextControl));
2210
                    //double Y = Canvas.GetTop((item.DrawingData as TextControl));
2211
                    //AllPointSet.Add(new Point(X,Y));
2212
                    if (AngleValue == 0)
2213
                    {
2214
                        AngleValue = (item.DrawingData as TextControl).Angle;
2215
                    }
2216
                    double X = Canvas.GetLeft((item.DrawingData as TextControl));
2217
                    double Y = Canvas.GetTop((item.DrawingData as TextControl));
2218
                    AllPointSet.Add(new Point(X, Y));
2219
                }
2220
                else
2221
                {
2222
                    foreach (Point itemP in (item.DrawingData as IPath).PointSet)
2223
                    {
2224
                        AllPointSet.Add(itemP);
2225
                    }
2226
                }
2227
            }
2228
            #endregion
2229
            CenterPoint = MathSet.FindCentroid(AllPointSet);
2230
            Point pt = Mouse.GetPosition(this);
2231

    
2232

    
2233

    
2234

    
2235
            //if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name != "TextControl")
2236
            //{
2237
            Point vec1 = new Point(this.rotatePoint.X - CenterPoint.X, this.rotatePoint.Y - CenterPoint.Y);
2238
            Point vec2 = new Point(pt.X - CenterPoint.X, pt.Y - CenterPoint.Y);
2239
            dDeltaAngle = (MathSet.getAngleBetweenVectors(vec1, vec2));
2240

    
2241
            System.Diagnostics.Debug.WriteLine("vec1 : " + vec1.X + "/" + vec1.Y);
2242
            System.Diagnostics.Debug.WriteLine("vec2 : " + vec2.X + "/" + vec2.Y);
2243
            System.Diagnostics.Debug.WriteLine("dDeltaAngle : " + dDeltaAngle);
2244

    
2245
            //}
2246
            //else
2247
            //{
2248
            //if (IsTextAngle || RotateFlag)
2249
            //{
2250
            //    AngleValue = ((MemberSet.First() as AdornerMember).DrawingData as TextControl).Angle + 5;
2251
            //}
2252
            //else
2253
            //{
2254
            //    AngleValue = ((MemberSet.First() as AdornerMember).DrawingData as TextControl).Angle - 5;
2255
            //}
2256
            //}
2257

    
2258
            AngleValue += dDeltaAngle;
2259
            if (AngleValue > 360) AngleValue -= 360;
2260
            if (AngleValue < 0) AngleValue += 360;
2261
            this.rotatePoint = pt;  /// save rotatePoint
2262

    
2263
            Dispatcher.BeginInvoke((Action)(() =>
2264
            {
2265
                foreach (var item in MemberSet)
2266
                {
2267
                    foreach (var thumb in item.ThumbList)
2268
                    {
2269
                        double x = Canvas.GetLeft(thumb);
2270
                        double y = Canvas.GetTop(thumb);
2271

    
2272
                        Point value = MathSet.RotateAbout(CenterPoint, new Point(x, y), dDeltaAngle);
2273
                        Canvas.SetLeft(thumb, value.X);
2274
                        Canvas.SetTop(thumb, value.Y);
2275

    
2276
                        /*if (item.DrawingData.GetType().Name == "ArrowTextControl" && thumb == item.ThumbList.Last())
2277
                        {
2278
                            Canvas.SetLeft(thumb, Canvas.GetLeft((item.DrawingData as ArrowTextControl).Base_TextBox));
2279
                            Canvas.SetTop(thumb, Canvas.GetTop((item.DrawingData as ArrowTextControl).Base_TextBox));
2280
                            if (!(item.DrawingData as ArrowTextControl).isTrans)
2281
                            {
2282
                                List<Point> ps = new List<Point>();
2283
                                
2284
                                //강인구 추가
2285
                                //var temp = (MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl;
2286
                                var temp = item.DrawingData as ArrowTextControl;
2287
                                switch (Math.Abs(temp.Angle).ToString())
2288
                                {
2289
                                    case "90":
2290
                                        {
2291
                                            ps.Clear();
2292
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽
2293
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); // 위 중간
2294
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); // 위 오른쪽
2295

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

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

    
2302
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 중간
2303
                                        }
2304
                                        break;
2305
                                    case "270":
2306
                                        {
2307
                                            ps.Clear();
2308
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽
2309
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); // 위 중간
2310
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); // 위 오른쪽
2311

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

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

    
2318
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 중간
2319
                                        }
2320
                                        break;
2321
                                    default:
2322
                                        {
2323
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단
2324
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단
2325
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단
2326
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2));  //우단
2327
                                        }
2328
                                        break;
2329
                                }
2330

    
2331
                                var endP = MathSet.getNearPoint(ps, temp.MidPoint);
2332
                                var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP);
2333

    
2334
                                Canvas.SetLeft((MemberSet.Where(data => data.DrawingData.GetType().Name == "ArrowTextControl")).FirstOrDefault().ThumbList[1], tempP.X);
2335
                                Canvas.SetTop((MemberSet.Where(data => data.DrawingData.GetType().Name == "ArrowTextControl")).FirstOrDefault().ThumbList[1], tempP.Y);
2336
                                //Canvas.SetLeft((MemberSet.First() as AdornerMember).ThumbList[1], tempP.X);
2337
                                //Canvas.SetTop((MemberSet.First() as AdornerMember).ThumbList[1], tempP.Y);
2338
                            }
2339
                        }*/
2340
                    }
2341

    
2342
                    for (int i = 0; i < (item.DrawingData as IPath).PointSet.Count(); i++)
2343
                    {
2344
                        (item.DrawingData as IPath).PointSet[i] = MathSet.RotateAbout(CenterPoint, (item.DrawingData as IPath).PointSet[i], dDeltaAngle);
2345
                    }
2346
                }
2347
                #region 보더 업데이트
2348
                foreach (var item in MemberSet)
2349
                {
2350
                    switch (item.Drawingtype)
2351
                    {
2352
                        case ControlType.TextControl:
2353
                            ((TextControl)item.DrawingData).Angle = AngleValue;
2354
                            //trRotate.Angle = AngleValue;
2355

    
2356
                            RectangleGeometry Data = new RectangleGeometry
2357
                            {
2358
                                Rect = new Rect()
2359
                                {
2360
                                    X = Canvas.GetLeft((item.DrawingData as TextControl)),
2361
                                    Y = Canvas.GetTop((item.DrawingData as TextControl)),
2362
                                    Width = (item.DrawingData as TextControl).Base_TextBlock.ActualWidth / 2,
2363
                                    Height = (item.DrawingData as TextControl).Base_TextBlock.ActualHeight / 2,
2364
                                }
2365
                            };
2366
                            //if ((firstCondition as TextControl).Angle != 0)
2367
                            //{
2368
                            Point endPointV = new Point(Data.Bounds.Right, Data.Bounds.Bottom);
2369
                            Point middle = MathSet.getMiddlePoint((item.DrawingData as TextControl).StartPoint, endPointV);
2370

    
2371

    
2372
                            //AdornerBorder.RenderTransformOrigin = new Point(1, 1);
2373
                            //AdornerBorder.RenderTransform = new RotateTransform()
2374
                            //{
2375
                            //    Angle = (member as TextControl).Angle * -1,
2376
                            //    CenterX = middle.X + ((member as TextControl) as FrameworkElement).ActualWidth /2,
2377
                            //    CenterY = middle.Y + ((member as TextControl) as FrameworkElement).ActualHeight /2,
2378
                            //};
2379

    
2380

    
2381
                            DragThumb.RenderTransformOrigin = new Point(0, 0);
2382
                            DragThumb.RenderTransform = new RotateTransform()
2383
                            {
2384
                                Angle = (item.DrawingData as TextControl).Angle,
2385
                                //CenterX = middle.X,
2386
                                //CenterY = middle.Y,
2387
                            };
2388

    
2389
                            AdornerBorder.RenderTransformOrigin = new Point(0, 0);
2390
                            AdornerBorder.RenderTransform = new RotateTransform()
2391
                            {
2392
                                Angle = (item.DrawingData as TextControl).Angle,
2393
                                //CenterX = middle.X,
2394
                                //CenterY = middle.Y,
2395
                            };
2396

    
2397
                            (item.DrawingData as TextControl).Base_Grid.RenderTransform = new RotateTransform()
2398
                            {
2399
                                Angle = (item.DrawingData as TextControl).Angle,
2400
                            };
2401

    
2402
                            BorderUpdate();
2403
                            break;
2404
                        //case ControlType.Viewbox:
2405
                        //    (item.DrawingData as IPath).updateControl();
2406
                        //    ((IViewBox)item.DrawingData).Angle = AngleValue;
2407
                        //    BorderUpdate();
2408
                        //    break;
2409
                        case ControlType.Date:
2410

    
2411
                            //강인구 추가(2018.02.22)
2412
                            ((DateControl)item.DrawingData).Angle = AngleValue;
2413
                            (item.DrawingData as IPath).updateControl();
2414

    
2415
                            BorderUpdate();
2416
                            //MessageBox.Show("잠시 정확도를 위해 막아두었습니다!");
2417
                            break;
2418
                        case ControlType.ArrowMultiLine:
2419
                        case ControlType.ArcLine:
2420
                        case ControlType.SingleLine:
2421
                        case ControlType.Triangle:
2422
                            (item.DrawingData as IPath).updateControl();
2423
                            BorderUpdate();
2424
                            break;
2425
                        case ControlType.ArrowTextControl:
2426
                            (item.DrawingData as IPath).updateControl();
2427
                            BorderUpdate();
2428
                            break;
2429
                        case ControlType.RectCloud:
2430
                            ((RectCloudControl)item.DrawingData).Angle = AngleValue;
2431
                            (item.DrawingData as IPath).updateControl();
2432
                            BorderUpdate();
2433
                            break;
2434
                        case ControlType.Rectangle:
2435
                            ((RectangleControl)item.DrawingData).Angle = AngleValue;
2436
                            (item.DrawingData as IPath).updateControl();
2437
                            BorderUpdate();
2438
                            break;
2439
                        case ControlType.ImgControl:
2440
                            ((ImgControl)item.DrawingData).Angle = AngleValue;
2441
                            (item.DrawingData as IPath).updateControl();
2442
                            BorderUpdate();
2443
                            break;
2444
                        //강인구 추가
2445
                        case ControlType.Sign:
2446
                            ((SignControl)item.DrawingData).Angle = AngleValue;
2447
                            (item.DrawingData as IPath).updateControl();
2448
                            BorderUpdate();
2449
                            break;
2450
                        //강인구 추가
2451
                        case ControlType.Symbol:
2452
                            ((SymControl)item.DrawingData).Angle = AngleValue;
2453
                            (item.DrawingData as IPath).updateControl();
2454
                            BorderUpdate();
2455
                            break;
2456
                        //강인구 추가
2457
                        case ControlType.Stamp:
2458
                            ((SymControlN)item.DrawingData).Angle = AngleValue;
2459
                            (item.DrawingData as IPath).updateControl();
2460
                            BorderUpdate();
2461
                            break;
2462
                        case ControlType.PolygonControl:
2463
                            //((IShapeControl)AllControl).Angle = AngleValue;
2464
                            (item.DrawingData as IPath).updateControl();
2465
                            BorderUpdate();
2466
                            break;
2467
                        case ControlType.PolygonCloud:
2468
                            //((IShapeControl)AllControl).Angle = AngleValue;
2469
                            ((ICloudControl)item.DrawingData).DrawingCloud();
2470
                            (item.DrawingData as IPath).updateControl();
2471
                            BorderUpdate();
2472
                            break;
2473
                        case ControlType.Circle:
2474
                            ((IShapeControl)item.DrawingData).Angle = AngleValue;
2475
                            (item.DrawingData as IPath).updateControl();
2476
                            ((CircleControl)item.DrawingData).SetCenterXY();
2477
                            BorderUpdate();
2478
                            break;
2479
                        case ControlType.Ink:
2480
                            for (int i = 0; i < (item.DrawingData as InkControl).PointC.Count(); i++)
2481
                            {
2482
                                for (int j = 0; j < (item.DrawingData as InkControl).PointC[i].pointSet.Count; j++)
2483
                                {
2484
                                    (item.DrawingData as InkControl).PointC[i].pointSet[j] = MathSet.RotateAbout(CenterPoint, (item.DrawingData as InkControl).PointC[i].pointSet[j], dDeltaAngle);
2485
                                }
2486
                            }
2487
                            (item.DrawingData as IPath).updateControl();
2488
                            BorderUpdate();
2489
                            break;
2490
                        //case MarkupType.PolygonEx:
2491
                        //    //trRotate.Angle = AngleValue;
2492
                        //    for (int i = 0; i < (item.DrawingData as PolyControl).PointC.Count(); i++)
2493
                        //    {
2494
                        //        //(item.DrawingData as PolyControl).PointC[i] = MathSet.RotateAbout(CenterPoint, (item.DrawingData as PolyControl).PointC[i]., dDeltaAngle);
2495
                        //        for (int j = 0; j < (item.DrawingData as PolyControl).PointC[i].pointSet.Count; j++)
2496
                        //        {
2497
                        //            (item.DrawingData as PolyControl).PointC[i].pointSet[j] = MathSet.RotateAbout(CenterPoint, (item.DrawingData as PolyControl).PointC[i].pointSet[j], dDeltaAngle);
2498
                        //        }
2499
                        //    }
2500
                        //    (item.DrawingData as IPath).updateControl();
2501
                        //    BorderUpdate();
2502
                        //    break;
2503
                        default:
2504
                            break;
2505
                    }
2506
                }
2507
                #endregion
2508
            }));
2509
            BorderUpdate();
2510
        }
2511

    
2512
        private void rotate_DragStarted(object sender, DragStartedEventArgs e)
2513
        {
2514
            ////System.Windows.Forms.Cursor.Position = new System.Drawing.Point(System.Windows.Forms.Cursor.Position.X - 150, System.Windows.Forms.Cursor.Position.Y - 150);
2515
            //this.rotatePoint = Mouse.GetPosition(this); /// 2018.05.09 added by humkyung
2516
            //rotateTop.Cursor = Cursors.SizeAll;
2517

    
2518
            ////CustomCursor.SetCursorTemplate(rotateTop, this.Resources["AnimatedCursor"] as DataTemplate);
2519
            ////rotateTop.Cursor = Cursors.None;
2520

    
2521
            ////if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().PointSet != null)
2522
            ////{
2523
            ////    return;
2524
            ////}
2525

    
2526
            this.rotatePoint = Mouse.GetPosition(this); /// 2018.05.09 added by humkyung
2527
            rotateTop.Cursor = Cursors.SizeAll;
2528

    
2529
            /// get angle from text controls' angle if only text control exists - 2018.05.10 added by humkyung
2530
            if ((1 == MemberSet.Count) && (MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "TextControl")
2531
            {
2532
                this.AngleValue = ((MemberSet.First() as AdornerMember).DrawingData as TextControl).Angle;
2533
            }
2534
            /// up to here
2535

    
2536

    
2537

    
2538
            if (ViewerDataModel.Instance.UndoDataList == null)
2539
            {
2540
                return;
2541
            }
2542

    
2543
            if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Event == Event_Type.Thumb)
2544
            {
2545
                return;
2546
            }
2547
            if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List != null)
2548
            {
2549
                if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.Count > 0)
2550
                {
2551
                    if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.FirstOrDefault().PointSet != null)
2552
                    {
2553
                        return;
2554
                    }
2555
                }
2556
            }
2557

    
2558
            Undo_Event();
2559
        }
2560

    
2561
        private void rotate_DragCompleted(object sender, DragCompletedEventArgs e)
2562
        {
2563
            //CustomCursor.SetCursorTemplate(rotateTop, null);
2564
            rotateTop.Cursor = Cursors.Arrow;
2565

    
2566
            Undo_Event();
2567
        }
2568

    
2569
        private void drag_DragStarted(object sender, DragStartedEventArgs e)
2570
        {
2571
            //CustomCursor.SetCursorTemplate(DragThumb, this.Resources["MoveCursor"] as DataTemplate);
2572
            //DragThumb.Cursor = Cursors.None;
2573
            //DragThumb.Cursor = Cursors.SizeAll;
2574

    
2575
            if (ViewerDataModel.Instance.UndoDataList == null)
2576
            {
2577
                return;
2578
            }
2579
            if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Event == Event_Type.Thumb)
2580
            {
2581
                return;
2582
            }
2583
            if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List != null)
2584
            {
2585
                if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.Count > 0)
2586
                {
2587
                    if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.FirstOrDefault().PointSet != null)
2588
                    {
2589
                        return;
2590
                    }
2591
                }
2592
            }
2593

    
2594
            Undo_Event();
2595
        }
2596

    
2597
        private void Undo_Event()
2598
        {
2599
            List<Point> p_set = new List<Point>();
2600

    
2601
            Undo_data UndoData = new Undo_data()
2602
            {
2603
                IsUndo = false,
2604
                Event = Event_Type.Thumb,
2605
                EventTime = DateTime.Now,
2606
                Markup_List = new List<Multi_Undo_data>(),
2607
            };
2608

    
2609
            Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2610

    
2611
            foreach (var control in MemberSet)
2612
            {
2613
                multi_Undo_Data.PointSet = new List<Point>();
2614
                p_set = new List<Point>();
2615

    
2616
                if (control.DrawingData as TextControl != null)
2617
                {
2618
                    multi_Undo_Data.PointSet.Add((control.DrawingData as TextControl).StartPoint);
2619
                    multi_Undo_Data.PointSet.Add((control.DrawingData as TextControl).EndPoint);
2620
                }
2621

    
2622
                foreach (var point in ((control.DrawingData as CommentUserInfo) as IPath).PointSet)
2623
                {
2624
                    multi_Undo_Data.PointSet.Add(point);
2625
                }
2626

    
2627
                multi_Undo_Data.Angle = AngleValue;
2628

    
2629
                multi_Undo_Data.Markup = control.DrawingData as CommentUserInfo;
2630
                UndoData.Markup_List.Add(multi_Undo_Data);
2631
                multi_Undo_Data = new Multi_Undo_data();
2632
            }
2633
            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
2634
            {
2635
                ViewerDataModel.Instance.UndoDataList.Remove(i);
2636
            });
2637

    
2638
            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2639

    
2640
        }
2641

    
2642
        private void drag_DragCompleted(object sender, DragCompletedEventArgs e)
2643
        {
2644
            //CustomCursor.SetCursorTemplate(DragThumb, null);
2645
            DragThumb.Cursor = Cursors.Arrow;
2646

    
2647
            Undo_Event();
2648
        }
2649

    
2650
        public void ControlPointMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
2651
        {
2652
            AdornerMember control = MemberSet.FirstOrDefault();
2653

    
2654
            if ((control.DrawingData as ArrowTextControl) != null && DraggerThumb == null)
2655
            {
2656
                if ((control.DrawingData as ArrowTextControl).isTrans == false && (control.DrawingData as ArrowTextControl).isFixed == false)
2657
                {
2658
                    (control.DrawingData as ArrowTextControl).isTrans = true;
2659
                }
2660
            }
2661

    
2662
        }
2663

    
2664
        public void TextControlChanger()
2665
        {
2666
            if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "TextControl")
2667
            {
2668
                TextControl AllControl = (MemberSet.First() as AdornerMember).DrawingData as TextControl;
2669
                AllControl.Base_TextBox.Focus();
2670
                AllControl.Base_TextBox.Visibility = Visibility.Visible;
2671
                AllControl.Base_TextBlock.Visibility = Visibility.Collapsed;
2672
                AllControl.Base_TextBox.Focus();
2673
                AllControl.SizeChanged += (sen, ea) =>
2674
                {
2675
                    if (AllControl.Base_TextBox != null)
2676
                    {
2677
                        RectangleGeometry Data = new RectangleGeometry
2678
                        {
2679
                            Rect = new Rect()
2680
                            {
2681
                                X = AllControl.StartPoint.X,
2682
                                Y = AllControl.StartPoint.Y,
2683
                                Width = AllControl.Base_TextBox.Width,
2684
                                Height = AllControl.Base_TextBox.Height,
2685
                            }
2686
                        };
2687

    
2688
                        Point endPointV = new Point(Data.Bounds.Right, Data.Bounds.Bottom);
2689
                        Point middle = MathSet.getMiddlePoint(AllControl.StartPoint, endPointV);
2690
                        AllControl.Base_Grid.RenderTransform = new RotateTransform()
2691
                        {
2692
                            Angle = AllControl.Angle,
2693
                            CenterX = middle.X,
2694
                            CenterY = middle.Y,
2695
                        };
2696
                    }
2697
                    BorderUpdate();
2698
                };
2699
            }
2700
        }
2701

    
2702
        private void RectThumb_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) //더블클릭
2703
        {
2704
            if (e.ClickCount == 2 && MemberSet.Count == 1)
2705
            {
2706

    
2707
                if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "TextControl")
2708
                {
2709
                    TextControlChanger();
2710
                    //    TextControl AllControl = (MemberSet.First() as AdornerMember).DrawingData as TextControl;
2711
                    //    AllControl.Base_TextBox.Focus();
2712
                    //    AllControl.Base_TextBox.Visibility = Visibility.Visible;
2713
                    //    AllControl.Base_TextBlock.Visibility = Visibility.Collapsed;
2714
                    //    AllControl.Base_TextBox.Focus();
2715
                    //    AllControl.SizeChanged += (sen, ea) =>
2716
                    //    {
2717
                    //        if (AllControl.Base_TextBox != null)
2718
                    //        {   
2719
                    //            RectangleGeometry Data = new RectangleGeometry
2720
                    //            {
2721
                    //                Rect = new Rect()
2722
                    //                {
2723
                    //                    X = AllControl.StartPoint.X,
2724
                    //                    Y = AllControl.StartPoint.Y,
2725
                    //                    Width = AllControl.Base_TextBox.Width,
2726
                    //                    Height = AllControl.Base_TextBox.Height,
2727
                    //                }
2728
                    //            };
2729

    
2730
                    //            Point endPointV = new Point(Data.Bounds.Right, Data.Bounds.Bottom);
2731
                    //            Point middle = MathSet.getMiddlePoint(AllControl.StartPoint, endPointV);
2732
                    //            AllControl.Base_Grid.RenderTransform = new RotateTransform()
2733
                    //            {
2734
                    //                Angle = AllControl.Angle,
2735
                    //                CenterX = middle.X,
2736
                    //                CenterY = middle.Y,
2737
                    //            };
2738
                    //        }
2739
                    //        BorderUpdate();
2740
                    //    };
2741
                }
2742

    
2743
                else if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "ArrowTextControl")
2744
                {
2745
                    ArrowTextControl AllControl = (MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl;
2746
                    Thumb tm = (MemberSet.First() as AdornerMember).ThumbList.Last();
2747
                    ((ArrowTextControl)AllControl).Base_TextBox.Focus();
2748

    
2749
                    //강인구 추가(ArrowControl TextBox Thumb없애기
2750
                    tm.Visibility = Visibility.Collapsed;
2751

    
2752
                    ((MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl).Base_TextBox.IsHitTestVisible = true;
2753

    
2754
                    //(sender as System.Windows.Shapes.Rectangle).IsHitTestVisible = false;
2755
                    //(sender as System.Windows.Shapes.Rectangle).Visibility = Visibility.Hidden;
2756
                    //Canvas.SetZIndex(((ArrowTextControl)AllControl).Base_TextBox,9999);
2757
                    //editTextBox = ((ArrowTextControl)AllControl).Base_TextBox;
2758
                    //editTextBox.Style = ((ArrowTextControl)AllControl).Base_TextBox.Style;
2759
                    //editTextBox.Text = (AllControl as ArrowTextControl).ArrowText;
2760
                    //editTextBox.FontSize = (AllControl as ArrowTextControl).FontSize;
2761
                    //editTextBox.Foreground = (AllControl as ArrowTextControl).Foreground;
2762
                    //editTextBox.FontWeight = (AllControl as ArrowTextControl).FontWeight;
2763

    
2764
                    //(AllControl as ArrowTextControl).Base_TextBox.Visibility = Visibility.Collapsed;
2765
                    //editTextBox = (AllControl as ArrowTextControl).Base_TextBox;
2766
                    //editTextBox.TextChanged += (sen, ea) =>
2767
                    //  {
2768
                    //      ((ArrowTextControl)AllControl).ArrowText = editTextBox.Text;
2769
                    //  };
2770

    
2771

    
2772
                    //(sender as System.Windows.Shapes.Rectangle).Visibility = Visibility.Hidden;
2773
                    //((ArrowTextControl)AllControl).Base_TextBox.Background = new SolidColorBrush(Colors.Blue);
2774
                    //((ArrowTextControl)AllControl).Base_TextBox.Opacity = 1;
2775
                    //((ArrowTextControl)AllControl).Base_TextBox.Focus();
2776

    
2777
                    ((ArrowTextControl)AllControl).Base_TextBox.SizeChanged += (sen, ea) =>
2778

    
2779
                    {
2780
                        tm.Width = (AllControl as ArrowTextControl).BoxWidth;
2781
                        tm.Height = (AllControl as ArrowTextControl).BoxHeight;
2782

    
2783
                        List<Point> ps = new List<Point>();
2784
                        //RotateTransform myRotateTransform = new RotateTransform();
2785

    
2786

    
2787
                        //if (control.Angle == -270)
2788
                        //{
2789
                        //    myRotateTransform.Angle = 90;
2790
                        //    myRotateTransform.CenterX = Canvas.GetLeft(control.Base_TextBox);
2791
                        //    myRotateTransform.CenterY = Canvas.GetTop(control.Base_TextBox);
2792
                        //}
2793
                        //else if (control.Angle == -90)
2794
                        //{
2795
                        //    myRotateTransform.Angle = 270;
2796
                        //    myRotateTransform.CenterX = Canvas.GetLeft(control.Base_TextBox);
2797
                        //    myRotateTransform.CenterY = Canvas.GetTop(control.Base_TextBox);
2798
                        //}
2799
                        //TransformGroup myTransformGroup = new TransformGroup();
2800
                        //myTransformGroup.Children.Add(myRotateTransform);
2801

    
2802
                        ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth / 2, Canvas.GetTop(AllControl.Base_TextBox))); //상단
2803
                        ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth / 2, Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight)); // 하단
2804
                        ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox), Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight / 2)); //좌단
2805
                        ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth, Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight / 2));  //우단
2806

    
2807

    
2808

    
2809

    
2810
                        var endP = MathSet.getNearPoint(ps, AllControl.MidPoint);
2811
                        var tempP = MathSet.getMiddlePoint(AllControl.StartPoint, endP);
2812
                        if (AllControl.isTrans)
2813
                        {
2814
                            Canvas.SetLeft((MemberSet.First() as AdornerMember).ThumbList[1], AllControl.MidPoint.X);
2815
                            Canvas.SetTop((MemberSet.First() as AdornerMember).ThumbList[1], AllControl.MidPoint.Y);
2816
                        }
2817
                        else
2818
                        {
2819
                            Canvas.SetLeft((MemberSet.First() as AdornerMember).ThumbList[1], tempP.X);
2820
                            Canvas.SetTop((MemberSet.First() as AdornerMember).ThumbList[1], tempP.Y);
2821
                        }
2822

    
2823

    
2824
                        BorderUpdate();
2825

    
2826
                    };
2827
                }
2828
                else if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "DateControl")
2829
                {
2830
                    DateControl data = (MemberSet.First() as AdornerMember).DrawingData as DateControl;
2831
                    CalendarControl instanceCal = new CalendarControl(data.Text);
2832
                    //dropData.IsOpen = true;
2833
                    RadWindow rc = new RadWindow();
2834
                    rc.Width = 300;
2835
                    rc.Height = 300;
2836
                    rc.Header = "Change Date";
2837
                    rc.Content = instanceCal;
2838
                    rc.BorderThickness = new Thickness(3);
2839
                    rc.ResizeMode = ResizeMode.NoResize;
2840
                    rc.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2841
                    rc.ModalBackground = new SolidColorBrush(Colors.Black);
2842
                    rc.ModalBackground.Opacity = 0.6;
2843
                    Telerik.Windows.Controls.StyleManager.SetTheme(rc, new Telerik.Windows.Controls.Windows8Theme());
2844
                    instanceCal.changeDateCal.SelectionChanged += (sen, ea) =>
2845
                    {
2846
                        data.Text = instanceCal.changeDateCal.SelectedDate.Value.ToShortDateString();
2847
                        rc.Close();
2848
                    };
2849
                    rc.ShowDialog();
2850
                    //CalendarControl.xaml
2851
                }
2852
                else if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "ArcControl")
2853
                {
2854
                    ArcControl instance = ((MemberSet.First() as AdornerMember).DrawingData as ArcControl);
2855
                    if (instance.isTransOn)
2856
                    {
2857
                        instance.isTransOn = false;
2858
                    }
2859
                    else
2860
                    {
2861
                        instance.isTransOn = true;
2862
                    }
2863
                    instance.SetArcPath();
2864
                    BorderUpdate();
2865
                }
2866
                //else if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "CloudControl")
2867
                //{
2868
                //    CloudControl instance = ((MemberSet.First() as AdornerMember).DrawingData as CloudControl);
2869
                //    if (!instance.isChain)
2870
                //    {
2871
                //        if (instance.isTransOn)
2872
                //        {
2873
                //            instance.isTransOn = false;
2874
                //        }
2875
                //        else
2876
                //        {
2877
                //            instance.isTransOn = true;
2878
                //        }
2879

    
2880
                //        instance.SetCloud();
2881
                //        BorderUpdate();
2882
                //    }
2883
                //}
2884
                //else if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "LineControl")
2885
                //{
2886
                //    LineControl instance = ((MemberSet.First() as AdornerMember).DrawingData as LineControl);
2887
                //    if (instance.LineStyle == LineControl.LineStyleSet.MultiLine)
2888
                //    {
2889
                //        instance.Interval += 1;
2890
                //        instance.SetLinePath();
2891
                //        BorderUpdate();
2892
                //    }
2893

    
2894
                //    //instance.SetCloud();
2895
                //    //BorderUpdate();
2896
                //}
2897

    
2898
            }
2899
            //if (e.ClickCount == 2 && AllControl.GetType().Name == "TextControl") // Edit Mode
2900
            //{
2901
            //    ((TextControl)AllControl).Base_TextBox.Focus();
2902
            //    ((TextControl)AllControl).Base_TextBox.Visibility = Visibility.Visible;
2903
            //    ((TextControl)AllControl).Base_TextBlock.Visibility = Visibility.Collapsed;
2904
            //}
2905
            //if (e.ClickCount == 2 && AllControl.GetType().Name == "ArrowTextControl") // Edit Mode
2906
            //{
2907
            //    Thumb tm = (from kkk in this.ContainerContent.Children
2908
            //                where (kkk as FrameworkElement).Name == "LastThumb"
2909
            //                select kkk).FirstOrDefault() as Thumb;
2910
            //    ((ArrowTextControl)AllControl).Base_TextBox.Focus();
2911
            //    ((ArrowTextControl)AllControl).Base_TextBox.SizeChanged += (sen, ea) =>
2912
            //    {
2913
            //        tm.Width = (AllControl as ArrowTextControl).BoxWidth;
2914
            //        tm.Height = (AllControl as ArrowTextControl).BoxHeight;
2915
            //        Canvas.SetLeft(tm, (AllControl.EndPoint.X - tm.Width / 2));
2916
            //        Canvas.SetTop(tm, (AllControl.EndPoint.Y - tm.Height / 2));
2917
            //        Canvas.SetLeft((AllControl as ArrowTextControl).Base_TextBox, (AllControl.EndPoint.X - tm.Width / 2));
2918
            //        Canvas.SetTop((AllControl as ArrowTextControl).Base_TextBox, (AllControl.EndPoint.Y - tm.Height / 2));
2919
            //    };
2920
            //}
2921
        }
2922
        #endregion
2923

    
2924
        private void DragThumb_MouseDoubleClick(object sender, MouseButtonEventArgs e)
2925
        {
2926
            if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "TextControl" || (MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "ArrowTextControl")
2927
            {
2928
                DragThumb.Visibility = Visibility.Collapsed;
2929
            }
2930
        }
2931

    
2932
        //private void testText_Loaded(object sender, RoutedEventArgs e)
2933
        //{
2934
        //    editTextBox = sender as TextBox;
2935
        //}
2936
    }
2937
}
클립보드 이미지 추가 (최대 크기: 500 MB)