프로젝트

일반

사용자정보

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

markus / KCOM / Controls / AdornerFinal.xaml.cs @ 5a9353a9

이력 | 보기 | 이력해설 | 다운로드 (153 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
                    };
257

    
258
                    AdornerBorder.RenderTransformOrigin = new Point(0.0, 0.0);
259
                    AdornerBorder.RenderTransform = new RotateTransform()
260
                    {
261
                        Angle = (member as TextControl).Angle,
262
                    };
263
                    Observable.FromEventPattern(((TextControl)member), "PropertyChanged").Subscribe(a =>
264
                    {
265
                        TextCompensation = true;
266
                        BorderUpdate();
267
                        ((TextControl)member).Base_TextBlock.TextDecorations = ((TextControl)member).UnderLine;
268
                    });
269
                    Observable.FromEventPattern(((TextControl)member).Base_TextBox, "LostFocus").Subscribe(a =>
270
                    {
271
                        TextCompensation = false;
272
                        BorderUpdate();
273
                        if ((a.Sender as TextBox).Text == "") //보류
274
                        {
275
                            this.ContainerContent.Children.Remove(member);
276
                            this.Visibility = Visibility.Collapsed;
277
                        }
278
                    });
279
                    break;
280
                default:
281
                    break;
282
                    #endregion
283
            }
284
            if (member.GetType().Name == "TextControl")
285
            {
286
                TextControl content = ((TextControl)member);
287
                content.StartPoint = new Point(Canvas.GetLeft(content), Canvas.GetTop(content));
288
                content.EndPoint = content.StartPoint;
289

    
290
                //RegistryPoint(AllControl.PointSet);
291
            }
292
            else
293
            {
294
                RegistryPoint(member);
295
            }
296
            BorderUpdate();
297
        }
298

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

    
385
                            }
386

    
387
                        });
388
                        Observable.FromEventPattern(((TextControl)member).Base_TextBox, "SelectionChanged").Subscribe(a =>
389
                        {
390
                            BorderUpdate();
391
                        });
392
                        break;
393
                    default:
394
                        break;
395
                        #endregion
396
                }
397
                if (member.GetType().Name == "TextControl")
398
                {
399
                    //강인구 추가
400
                    TextControl content = ((TextControl)member);
401
                    content.StartPoint = new Point(Canvas.GetLeft(content), Canvas.GetTop(content));
402
                    content.EndPoint = content.StartPoint;
403
                    //RegistryPoint(AllControl.PointSet);
404
                }
405
                else
406
                {
407
                    RegistryPoint(member, members.Count);
408
                }
409
            }
410

    
411
            BorderUpdate();
412
        }
413

    
414
        /// <summary>
415
        /// Border 를 갱신
416
        /// </summary>
417
        public void BorderUpdate()
418
        {
419
            AdornerBorder.MinWidth = 10;
420
            AdornerBorder.MinHeight = 10;
421

    
422
            double minX = double.MaxValue;
423
            double minY = double.MaxValue;
424
            double maxX = double.MinValue;
425
            double maxY = double.MinValue;
426

    
427
            if (MemberSet.Count == 1)
428
            {
429
                if (MemberSet.First().DrawingData.GetType().Name == "TextControl")
430
                {
431
                    if ((MemberSet.First().DrawingData as TextControl).Angle != 0)
432
                    {
433
                        ///TODO: 원점 설정
434
                        trRotate.Angle = (MemberSet.First().DrawingData as TextControl).Angle;
435
                        trRotateThumb.Angle = (MemberSet.First().DrawingData as TextControl).Angle;
436
                    }
437
                    else
438
                    {
439
                        trRotate.Angle = 0;
440
                        trRotateThumb.Angle = 0;
441
                    }
442
                }
443
            }
444
            foreach (var item in MemberSet)
445
            {
446
                UIElement currentControl = (item as AdornerMember).DrawingData;
447
                if (item.DrawingData.GetType().Name == "TextControl")
448
                {
449
                    double textControlWidth;
450
                    double textControlHeight;
451
                    if (((currentControl as TextControl).Base_TextBox.ActualWidth) == 0)
452
                    {
453
                        textControlWidth = ((currentControl as TextControl).Base_TextBlock.ActualWidth);
454
                        textControlHeight = ((currentControl as TextControl).Base_TextBlock.ActualHeight);
455
                    }
456
                    else
457
                    {
458
                        textControlWidth = ((currentControl as TextControl).Base_TextBox.ActualWidth);
459
                        textControlHeight = ((currentControl as TextControl).Base_TextBox.ActualHeight);
460
                    }
461
                    if ((currentControl as TextControl).LineSize.Left == 0)
462
                    {
463
                        if (TextCompensation)
464
                        {
465

    
466
                            textControlWidth += 1;
467
                            textControlHeight += 1;
468
                        }
469
                        else
470
                        {
471
                            textControlWidth += 3;
472
                            textControlHeight += 3;
473
                        }
474
                    }
475
                    else
476
                    {
477
                        if (TextCompensation)
478
                        {
479

    
480
                            textControlWidth += 1;
481
                            textControlHeight += 1;
482
                        }
483
                        else
484
                        {
485
                            textControlWidth += 8;
486
                            textControlHeight += 8;
487
                        }
488

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

    
558
                    //Rect rt = new Rect((currentControl as IPath).StartPoint, (currentControl as IPath).EndPoint);
559
                    //if (rt.Left < minX) minX = rt.Left;
560
                    //if (rt.Top < minY) minY = rt.Top;
561
                    //if (rt.Right > maxX) maxX = rt.Right;
562
                    //if (rt.Bottom > maxY) maxY = rt.Bottom;
563

    
564
                    List<Point> am = (currentControl as IPath).PointSet;
565
                    List<double> xSet = am.Select(p => p.X).ToList();
566
                    List<double> ySet = am.Select(p => p.Y).ToList();
567
                    if (xSet.Min() < minX) minX = xSet.Min();
568
                    if (ySet.Min() < minY) minY = ySet.Min();
569
                    if (xSet.Max() > maxX) maxX = xSet.Max();
570
                    if (ySet.Max() > maxY) maxY = ySet.Max();
571
                }
572
                else
573
                {
574
                    if ((currentControl as IPath).PathData.Bounds.Left < minX) minX = (currentControl as IPath).PathData.Bounds.Left;
575
                    if ((currentControl as IPath).PathData.Bounds.Top < minY) minY = (currentControl as IPath).PathData.Bounds.Top;
576
                    if ((currentControl as IPath).PathData.Bounds.Right > maxX) maxX = (currentControl as IPath).PathData.Bounds.Right;
577
                    if ((currentControl as IPath).PathData.Bounds.Bottom > maxY) maxY = (currentControl as IPath).PathData.Bounds.Bottom;
578
                }
579
            }
580

    
581
            Rect ac = new Rect(minX, minY, maxX - minX, maxY - minY);
582
            bool addWidthSize = false;
583
            bool addHeightSize = false;
584
            if (ac.Width <= 10)
585
            {
586
                ac.Width += 10;
587
                addWidthSize = true;
588
            }
589
            if (ac.Height <= 10)
590
            {
591
                ac.Height += 10;
592
                addHeightSize = true;
593
            }
594
            BorderSize = ac;
595
            AdornerBorder.MinWidth = 10;
596
            AdornerBorder.MinHeight = 10;
597
            AdornerBorder.Width = ac.Width;
598
            AdornerBorder.Height = ac.Height;
599
            Canvas.SetLeft(AdornerBorder, minX);
600
            Canvas.SetTop(AdornerBorder, minY);
601

    
602
            DragThumb.Width = ac.Width;
603
            DragThumb.Height = ac.Height;
604

    
605
            DragThumb.MinWidth = 10;
606
            DragThumb.MinHeight = 10;
607
            if (addWidthSize)
608
            {
609
                Canvas.SetLeft(DragThumb, minX - 5);
610
            }
611
            else
612
            {
613
                Canvas.SetLeft(DragThumb, minX);
614
            }
615

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

    
671
                MemberSet.Last().ThumbList.Add(tm);
672

    
673
                if (markT == ControlType.ArcLine && list[i] == (member as ArcControl).MidPoint)
674
                {
675
                    tm.Style = (Style)this.LayoutRoot.Resources["ThumbArcControlStyle"];
676
                }
677
                if (member.GetType().Name == "ArrowTextControl" && i == 1)
678
                {
679
                    //if (MemberSet.Count()<=1)
680
                    //{
681
                    tm.Style = (Style)this.LayoutRoot.Resources["ThumbArcControlStyle"];
682
                    List<Point> ps = new List<Point>();
683

    
684
                    if ((MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl != null)
685
                    {
686
                        var temp = (MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl;
687

    
688
                      
689
                        switch (Math.Abs(temp.Angle).ToString())
690
                        {
691
                            case "90":
692
                                {
693
                                    ps.Clear();
694
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽
695
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); // 위 중간
696
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); // 위 오른쪽
697

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

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

    
704
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 중간
705
                                }
706
                                break;
707
                            case "270":
708
                                {
709
                                    ps.Clear();
710
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽
711
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); // 위 중간
712
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); // 위 오른쪽
713

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

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

    
720
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 중간
721
                                }
722
                                break;
723
                            default:
724
                                {
725
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단
726
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단
727
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단
728
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2));  //우단
729
                                }
730
                                break;
731
                        }
732

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

    
789
                    }
790
                    else
791
                    {
792
                        tm.RenderTransformOrigin = new Point(0.5, 0.5);
793
                        tm.RenderTransform = new RotateTransform()
794
                        {
795
                            Angle = angle,
796
                        };
797
                    }
798
                }
799
                //if (markT == MarkupType.Polygon || markT == MarkupType.Cloud)
800
                //{
801
                //    tm.MouseMove += new MouseEventHandler(resize_MouseMove);
802
                //    tm.DragStarted += new DragStartedEventHandler(tm_DragStarted);
803
                //    tm.DragCompleted += new DragCompletedEventHandler(tm_DragCompleted);
804
                //}
805
                //else
806
                //{
807
                //    tm.MouseMove += new MouseEventHandler(resize_MouseMove);
808
                //    tm.DragStarted += new DragStartedEventHandler(tm_DragStarted);
809
                //    tm.DragCompleted += new DragCompletedEventHandler(tm_DragCompleted);
810
                //}
811

    
812
                if (member.GetType().Name == "CloudControl")
813
                {
814
                    if (i == list.Count() - 1)
815
                    {
816
                        tm.Visibility = System.Windows.Visibility.Collapsed;
817
                    }
818
                }
819
                if (member.GetType().Name == "PolygonControl")
820
                {
821
                    if (i == list.Count() - 1)
822
                    {
823
                        if ((member as PolygonControl).ControlType == ControlType.ChainLine)
824
                        {
825

    
826
                        }
827
                        else
828
                        {
829
                            tm.Visibility = System.Windows.Visibility.Collapsed;
830
                        }
831
                    }
832
                    if ((member as PolygonControl).ControlType == ControlType.Ink)
833
                    {
834
                        tm.Visibility = System.Windows.Visibility.Collapsed;
835
                    }
836
                }
837

    
838
                //강인구 텀브 없애기 보류
839
                //if(cnt > 1)
840
                //{
841
                //    tm.Visibility = System.Windows.Visibility.Collapsed;
842
                //}
843

    
844

    
845

    
846
                //if (member.GetType().Name == "InkControl")
847
                //{
848
                //    tm.Visibility = System.Windows.Visibility.Collapsed;
849
                //}
850

    
851
                this.ContainerContent.Children.Add(tm);
852
                Canvas.SetLeft(tm, list[count].X);
853
                Canvas.SetTop(tm, list[count].Y);
854
                if (member.GetType().Name == "ArrowTextControl" && list[i] == (member as ArrowTextControl).MidPoint)
855
                {
856
                    Canvas.SetZIndex(tm, 95);
857
                }
858
                else
859
                {
860
                    Canvas.SetZIndex(tm, 99);
861
                }
862

    
863
                tm.DragStarted += new DragStartedEventHandler(tm_DragStarted);
864
                tm.DragCompleted += new DragCompletedEventHandler(tm_DragCompleted);
865
                tm.DragDelta += ResizeTm_DragDelta;
866
                tm.MouseMove += new MouseEventHandler(resize_MouseMove);
867
                count++;
868
            }
869
        }
870

    
871
        private void ResizeTm_DragDelta(object sender, DragDeltaEventArgs e)
872
        {
873
            //한개 이상 선택 시 Resize 금지
874
            if (MemberSet.Count > 1)
875
                return;
876
            if (reSizePoint != new Point(0, 0))
877
            {
878
                Thumb thumb = sender as Thumb;
879

    
880
                Canvas.SetLeft(thumb, Canvas.GetLeft(thumb) +
881
                              e.HorizontalChange);
882
                Canvas.SetTop(thumb, Canvas.GetTop(thumb) +
883
                                        e.VerticalChange);
884

    
885
                Point setPoint = new Point(Canvas.GetLeft(thumb), Canvas.GetTop(thumb));
886

    
887

    
888
                //if (this.isDragging && MemberSet.Count <= 1)
889
                //if (thumb.IsDragging && MemberSet.Count <= 1 && DraggerThumb == thumb)
890
                //if (DraggerThumb == thumb)
891
                //{
892
                //Point setPoint = reSizePoint;
893
                //Canvas.SetLeft(thumb, setPoint.X);
894
                //Canvas.SetTop(thumb, setPoint.Y);
895
                AdornerMember control = (from userThumb in MemberSet
896
                                         where userThumb.ThumbList.Contains(thumb)
897
                                         select userThumb).FirstOrDefault();
898
                Point nearPoint = new Point(0, 0);
899
                IPath AllControl = control.DrawingData as IPath;
900
                if (ControlType.TextControl != control.Drawingtype)
901
                {
902

    
903
                    var temp = (MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl;
904
                    List<Point> ps = new List<Point>();
905

    
906
                    nearPoint = MathSet.getNearPoint((control.DrawingData as IPath).PointSet, setPoint);
907
                    //switch (Math.Abs(temp.Angle).ToString())
908
                    //{
909

    
910
                    //    case "90":
911
                    //        {
912
                    //            nearPoint = MathSet.getNearPoint((control.DrawingData as IPath).PointSet, setPoint);
913
                    //        }
914
                    //        break;
915
                    //    case "270":
916
                    //        {
917
                    //            nearPoint = MathSet.getNearPoint((control.DrawingData as IPath).PointSet, setPoint);
918
                    //        }
919
                    //        break;
920
                    //    default:
921
                    //        {
922
                    //            nearPoint = MathSet.getNearPoint((control.DrawingData as IPath).PointSet, setPoint);
923
                    //        }
924
                    //        break;
925
                    //}
926

    
927
                }
928
                for (int i = 0; i < (control.DrawingData as IPath).PointSet.Count; i++)
929
                {
930
                    switch (control.Drawingtype)
931
                    {
932
                        #region Arc + Line
933
                        case ControlType.ArrowMultiLine:
934
                        case ControlType.ArcLine:
935
                        case ControlType.SingleLine:
936
                        case ControlType.Triangle:
937
                            if (nearPoint.Equals(AllControl.PointSet[i]))
938
                            {
939
                                AllControl.PointSet[i] = setPoint;
940
                                AllControl.updateControl();
941
                                DynamicThumbUpdate(control);
942
                                BorderUpdate();
943

    
944
                                //if (control.DrawingData.GetType().Name == "ArrowTextControl")
945
                                //{
946
                                //    Thumb tm = control.ThumbList.Last();
947
                                //    //Canvas.SetLeft(tm, (AllControl.EndPoint.X - tm.Width / 2));
948
                                //    //Canvas.SetTop(tm, (AllControl.EndPoint.Y - tm.Height / 2));
949
                                //    Canvas.SetLeft(tm, (AllControl.EndPoint.X - tm.Width));
950
                                //    Canvas.SetTop(tm, (AllControl.EndPoint.Y - tm.Height));
951
                                //}
952
                            }
953
                            break;
954
                        #endregion
955
                        #region Shape
956
                        //case ControlType.PolygonCloud:
957
                        case ControlType.RectCloud:
958
                        case ControlType.Rectangle:
959
                            if (nearPoint.Equals(AllControl.PointSet[i]))
960
                            {
961
                                AllControl.PointSet[i] = setPoint;
962
                                var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count();
963
                                var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count();
964
                                var NextP = (i + 1) % AllControl.PointSet.Count();
965

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

    
968
                                var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]);
969
                                var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X,
970
                                    AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y);
971
                                AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet
972
                                    [ReverseP].Y
973
                                    + PreviousV.Y * l);
974

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

    
1019
                                var NextV = MathSet.GetNormVectorBetween(newPointSet[ReverseP], newPointSet[NextP]);
1020
                                l = MathSet.DotProduct(NextV.X, NextV.Y, newPointSet[i].X - newPointSet[ReverseP].X, newPointSet[i].Y
1021
                                    - newPointSet[ReverseP].Y);
1022
                                newPointSet[NextP] = new Point(newPointSet[ReverseP].X + NextV.X * l, newPointSet[ReverseP].Y + NextV.Y * l);
1023

    
1024
                                AllControl.PointSet = newPointSet;
1025
                                DynamicThumbUpdate(control);
1026
                                AllControl.updateControl();
1027
                                BorderUpdate();
1028
                            }
1029
                            break;
1030
                        #endregion
1031
                        #region ArrowText
1032
                        case ControlType.ArrowTextControl:
1033
                            if (nearPoint.Equals(AllControl.PointSet[i]))
1034
                            {
1035
                                AllControl.PointSet[i] = setPoint;
1036
                                AllControl.updateControl();
1037

    
1038
                                DynamicThumbUpdate(control);
1039
                                BorderUpdate();
1040
                                
1041
                                //if (control.DrawingData.GetType().Name == "ArrowTextControl")
1042
                                //{
1043
                                //    Thumb tm = control.ThumbList.Last();
1044
                                //    //Canvas.SetLeft(tm, (AllControl.EndPoint.X - tm.Width / 2));
1045
                                //    //Canvas.SetTop(tm, (AllControl.EndPoint.Y - tm.Height / 2));
1046
                                //    Canvas.SetLeft(tm, (AllControl.EndPoint.X - tm.Width));
1047
                                //    Canvas.SetTop(tm, (AllControl.EndPoint.Y - tm.Height));
1048
                                //}
1049
                            }
1050
                            break;
1051
                        #endregion
1052
                        #region Text
1053
                        case ControlType.TextControl:
1054
                            break;
1055
                        #endregion
1056
                        #region Image
1057
                        case ControlType.ImgControl:
1058
                            if (nearPoint.Equals(AllControl.PointSet[i]))
1059
                            {
1060
                                AllControl.PointSet[i] = setPoint;
1061
                                var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count();
1062
                                var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count();
1063
                                var NextP = (i + 1) % AllControl.PointSet.Count();
1064

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

    
1067
                                var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]);
1068
                                var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X,
1069
                                    AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y);
1070
                                AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet
1071
                                    [ReverseP].Y
1072
                                    + PreviousV.Y * l);
1073

    
1074
                                var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]);
1075
                                l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet
1076
                                    [i].Y - AllControl.PointSet[ReverseP].Y);
1077
                                AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y +
1078
                                    NextV.Y * l);
1079
                                AllControl.updateControl();
1080
                                DynamicThumbUpdate(control);
1081
                                BorderUpdate();
1082
                            }
1083
                            break;
1084
                        #endregion
1085
						//강인구 추가
1086
                        #region Sign
1087
                        case ControlType.Sign:
1088
                            if (nearPoint.Equals(AllControl.PointSet[i]))
1089
                            {
1090
                                AllControl.PointSet[i] = setPoint;
1091
                                var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count();
1092
                                var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count();
1093
                                var NextP = (i + 1) % AllControl.PointSet.Count();
1094

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

    
1097
                                var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]);
1098
                                var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X,
1099
                                    AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y);
1100
                                AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet
1101
                                    [ReverseP].Y
1102
                                    + PreviousV.Y * l);
1103

    
1104
                                var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]);
1105
                                l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet
1106
                                    [i].Y - AllControl.PointSet[ReverseP].Y);
1107
                                AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y +
1108
                                    NextV.Y * l);
1109
                                AllControl.updateControl();
1110
                                DynamicThumbUpdate(control);
1111
                                BorderUpdate();
1112
                            }
1113
                            break;
1114
                        #endregion
1115
                        #region Cloud
1116
                        case ControlType.PolygonCloud:
1117
                            if (nearPoint.Equals(AllControl.PointSet[i]))
1118
                            {
1119
                                AllControl.PointSet[i] = setPoint;
1120
                                AllControl.updateControl();
1121
                                ((ICloudControl)AllControl).DrawingCloud();
1122
                                BorderUpdate();
1123
                            }
1124
                            break;
1125
                        #endregion
1126
                        #region SymBol
1127
                        case ControlType.Symbol:
1128
                            if (nearPoint.Equals(AllControl.PointSet[i]))
1129
                            {
1130
                                AllControl.PointSet[i] = setPoint;
1131
                                var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count();
1132
                                var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count();
1133
                                var NextP = (i + 1) % AllControl.PointSet.Count();
1134

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

    
1137
                                var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]);
1138
                                var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X,
1139
                                    AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y);
1140
                                AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet
1141
                                    [ReverseP].Y
1142
                                    + PreviousV.Y * l);
1143

    
1144
                                var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]);
1145
                                l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet
1146
                                    [i].Y - AllControl.PointSet[ReverseP].Y);
1147
                                AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y +
1148
                                    NextV.Y * l);
1149
                                AllControl.updateControl();
1150
                                DynamicThumbUpdate(control);
1151
                                BorderUpdate();
1152
                            }
1153
                            break;
1154
                        case ControlType.Stamp:
1155
                            if (nearPoint.Equals(AllControl.PointSet[i]))
1156
                            {
1157
                                AllControl.PointSet[i] = setPoint;
1158
                                var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count();
1159
                                var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count();
1160
                                var NextP = (i + 1) % AllControl.PointSet.Count();
1161

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

    
1164
                                var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]);
1165
                                var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X,
1166
                                    AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y);
1167
                                AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet
1168
                                    [ReverseP].Y
1169
                                    + PreviousV.Y * l);
1170

    
1171
                                var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]);
1172
                                l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet
1173
                                    [i].Y - AllControl.PointSet[ReverseP].Y);
1174
                                AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y +
1175
                                    NextV.Y * l);
1176
                                AllControl.updateControl();
1177
                                DynamicThumbUpdate(control);
1178
                                BorderUpdate();
1179
                            }
1180
                            break;
1181
                        case ControlType.Date:
1182
                            if (nearPoint.Equals(AllControl.PointSet[i]))
1183
                            {
1184
                                AllControl.PointSet[i] = setPoint;
1185
                                var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count();
1186
                                var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count();
1187
                                var NextP = (i + 1) % AllControl.PointSet.Count();
1188

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

    
1191
                                var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]);
1192
                                var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X,
1193
                                    AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y);
1194
                                AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet
1195
                                    [ReverseP].Y
1196
                                    + PreviousV.Y * l);
1197

    
1198
                                var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]);
1199
                                l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet
1200
                                    [i].Y - AllControl.PointSet[ReverseP].Y);
1201
                                AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y +
1202
                                    NextV.Y * l);
1203
                                AllControl.updateControl();
1204
                                DynamicThumbUpdate(control);
1205
                                BorderUpdate();
1206
                            }
1207
                            break;
1208
                        //case MarkupType.Viewbox:
1209
                        //    if (nearPoint.Equals(AllControl.PointSet[i]))
1210
                        //    {
1211
                        //        AllControl.PointSet[i] = setPoint;
1212
                        //        var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count();
1213
                        //        var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count();
1214
                        //        var NextP = (i + 1) % AllControl.PointSet.Count();
1215

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

    
1218
                        //        var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]);
1219
                        //        var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X,
1220
                        //            AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y);
1221
                        //        AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet
1222
                        //            [ReverseP].Y
1223
                        //            + PreviousV.Y * l);
1224

    
1225
                        //        var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]);
1226
                        //        l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet
1227
                        //            [i].Y - AllControl.PointSet[ReverseP].Y);
1228
                        //        AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y +
1229
                        //            NextV.Y * l);
1230
                        //        AllControl.updateControl();
1231
                        //        DynamicThumbUpdate(control);
1232
                        //        BorderUpdate();
1233
                        //    }
1234
                        //    break;
1235
                        #endregion
1236
                        #region Ink
1237
                        case ControlType.Ink:
1238
                            if (nearPoint.Equals(AllControl.PointSet[i]))
1239
                            {
1240
                                AllControl.PointSet[i] = setPoint;
1241
                                AllControl.updateControl();
1242
                                BorderUpdate();
1243
                            }
1244
                            break;
1245
                        #endregion
1246
                        default:
1247
                            break;
1248
                    }
1249
                }
1250
            }
1251
            //}
1252
        }
1253

    
1254

    
1255

    
1256
        #endregion
1257
        #region 이벤트
1258

    
1259
        void tm_DragCompleted(object sender, DragCompletedEventArgs e)
1260
        {
1261
            this.isDragging = false;
1262
            DraggerThumb = null;
1263

    
1264
            Undo_Event();
1265
        }
1266

    
1267
        void tm_DragStarted(object sender, DragStartedEventArgs e)
1268
        {
1269
            this.DraggerThumb = sender as Thumb;
1270
            this.isDragging = true;
1271

    
1272
            if (ViewerDataModel.Instance.UndoDataList == null)
1273
            {
1274
                return;
1275
            }
1276

    
1277
            if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Event == Event_Type.Thumb)
1278
            {
1279
                return;
1280
            }
1281

    
1282
            if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List != null)
1283
            {
1284
                if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.Count > 0)
1285
                {
1286
                    if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.FirstOrDefault().PointSet != null)
1287
                    {
1288
                        return;
1289
                    }
1290
                }
1291
            }
1292

    
1293
            Undo_Event();
1294
        }
1295

    
1296
        private void rotate_MouseMove(object sender, MouseEventArgs e)
1297
        {
1298

    
1299
            //double LastRotateHorizontalValue = 0;
1300
            //double LastRotateVerticalValue = 0;
1301
            //double LastWidthValue = 0;
1302
            //double SetWidth = 0;
1303

    
1304

    
1305
            if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "TextControl")
1306
            {
1307
                if (LastRotateVerticalValue < e.GetPosition(this).X)
1308
                    IsTextAngle = true;
1309
                else
1310
                    IsTextAngle = false;
1311

    
1312
                System.Diagnostics.Debug.WriteLine("X축 : " + e.GetPosition(this).X + "LastRotateVerticalValue : " + LastRotateVerticalValue);
1313
                LastRotateVerticalValue = e.GetPosition(this).X;
1314
            }
1315
            else
1316
            {
1317
                System.Diagnostics.Debug.WriteLine("e.GetPosition(this).X : " + e.GetPosition(this).X);
1318
                System.Diagnostics.Debug.WriteLine("LastRotateHorizontalValue: " + LastRotateHorizontalValue);
1319

    
1320
                if (e.GetPosition(this).X > LastRotateHorizontalValue)
1321
                {
1322
                    RotateFlag = true;
1323
                }
1324
                else
1325
                {
1326
                    RotateFlag = false;
1327
                }
1328
                LastRotateHorizontalValue = e.GetPosition(this).X;
1329
            }
1330
        }
1331

    
1332
        private void DragThumb_DragDelta(object sender, DragDeltaEventArgs e)
1333
        {
1334
            DragThumb.Cursor = Cursors.SizeAll;
1335
            Thumb thumb = sender as Thumb;
1336
            MoveAdorner(e);
1337
        }
1338

    
1339
        public void MoveAdorner(DragDeltaEventArgs e)
1340
        {
1341
            Point dragDelta = new Point(e.HorizontalChange, e.VerticalChange);
1342

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

    
1381
                        Point dx = MathSet.RotateAbout(new Point(0, 0), new Point(e.HorizontalChange, e.VerticalChange), trRotate.Angle);
1382
                        Canvas.SetLeft((item.DrawingData as TextControl), Canvas.GetLeft((item.DrawingData as TextControl)) + dx.X);
1383
                        Canvas.SetTop((item.DrawingData as TextControl), Canvas.GetTop((item.DrawingData as TextControl)) + dx.Y);
1384
                        (item.DrawingData as TextControl).StartPoint =
1385
                        new Point(Canvas.GetLeft((item.DrawingData as TextControl)) + e.HorizontalChange / 5, Canvas.GetTop((item.DrawingData as TextControl)) + e.VerticalChange / 5);
1386
                        (item.DrawingData as TextControl).EndPoint = (item.DrawingData as TextControl).StartPoint;
1387
                    }
1388
                    #endregion
1389
                    #region 날짜
1390
                    if (item.Drawingtype == ControlType.Date)
1391
                    {
1392
                        DynamicThumbUpdate(e, item);
1393
                        //Canvas.SetLeft((item.DrawingData as DateControl), Canvas.GetLeft((item.DrawingData as DateControl)) + e.HorizontalChange);
1394
                        //Canvas.SetTop((item.DrawingData as DateControl), Canvas.GetTop((item.DrawingData as DateControl)) + e.VerticalChange);
1395
                        //(item.DrawingData as DateControl).StartPoint = new Point(Canvas.GetLeft((item.DrawingData as DateControl))
1396
                        //                                         + e.HorizontalChange, Canvas.GetTop((item.DrawingData as DateControl)) + e.VerticalChange);
1397
                        //(item.DrawingData as DateControl).EndPoint = (item.DrawingData as DateControl).StartPoint;
1398
                        //MessageBox.Show("잠시 정확도를 위해 막아두었습니다!");
1399

    
1400

    
1401
                    }
1402
                    #endregion
1403
                    #region 클라우드
1404
                    if (item.Drawingtype == ControlType.PolygonCloud)
1405
                    {
1406
                        ICloudControl temp = ((ICloudControl)item.DrawingData);
1407
                        DynamicThumbUpdate(e, item);
1408
                        temp.DrawingCloud();
1409
                    }
1410
                    #endregion
1411
                    //#region 심볼
1412
                    //if (item.Drawingtype == MarkupType.Viewbox)
1413
                    //{
1414
                    //    DynamicThumbUpdate(e, item);
1415
                    //    BorderUpdate();
1416
                    //}
1417
                    //#endregion
1418
                    //#region 폴리곤확장
1419
                    //if (item.Drawingtype == MarkupType.PolygonEx)
1420
                    //{
1421
                    //    Point px = new Point(e.HorizontalChange, e.VerticalChange);
1422
                    //    List<StylusPointSet> StylusPointSet = (item.DrawingData as PolyControl).PointC;
1423
                    //    for (int i = 0; i < StylusPointSet.Count; i++)
1424
                    //    {
1425
                    //        List<Point> lstPoint = StylusPointSet[i].pointSet;
1426
                    //        for (int j = 0; j < lstPoint.Count; j++)
1427
                    //        {
1428
                    //            lstPoint[j] = new Point(lstPoint[j].X + px.X, lstPoint[j].Y + px.Y);
1429
                    //        }
1430
                    //    }
1431

    
1432
                    //    for (int i = 0; i < item.ThumbList.Count; i++)
1433
                    //    {
1434
                    //        Canvas.SetLeft(item.ThumbList[i], Canvas.GetLeft(item.ThumbList[i]) + px.X);
1435
                    //        Canvas.SetTop(item.ThumbList[i], Canvas.GetTop(item.ThumbList[i]) + px.Y);
1436
                    //    }
1437
                    //    (item.DrawingData as IPath).updateControl();
1438
                    //    BorderUpdate();
1439
                    //    //for (int i = 0; i < (item.DrawingData as PolyControl).PointC.Count(); i++)
1440
                    //    //{
1441
                    //    //    //(item.DrawingData as PolyControl).PointC[i] = MathSet.RotateAbout(CenterPoint, (item.DrawingData as PolyControl).PointC[i]., dDeltaAngle);
1442
                    //    //    for (int j = 0; j < (item.DrawingData as PolyControl).PointC[i].pointSet.Count; j++)
1443
                    //    //    {
1444
                    //    //        (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 };
1445
                    //    //        Canvas.SetLeft(item.ThumbList[i], Canvas.GetLeft(item.ThumbList[i]) + dx.X);
1446
                    //    //        Canvas.SetTop(item.ThumbList[i], Canvas.GetTop(item.ThumbList[i]) + dx.Y);
1447
                    //    //    }
1448
                    //    //}
1449
                    //    //(item.DrawingData as IPath).updateControl();
1450
                    //}
1451
                    //#endregion
1452
                    #region 폴리곤
1453
                    if (item.Drawingtype == ControlType.PolygonControl)
1454
                    {
1455
                        DynamicThumbUpdate(e, item);
1456
                        BorderUpdate();
1457
                    }
1458
                    #endregion
1459
                    #region 잉크
1460
                    if (item.Drawingtype == ControlType.Ink)
1461
                    {
1462
                        //DynamicThumbUpdate(e, item);
1463
                        //BorderUpdate();
1464

    
1465
                        Point px = new Point(e.HorizontalChange, e.VerticalChange);
1466
                        List<StylusPointSet> StylusPointSet = (item.DrawingData as InkControl).PointC;
1467
                        for (int i = 0; i < StylusPointSet.Count; i++)
1468
                        {
1469
                            List<Point> lstPoint = StylusPointSet[i].pointSet;
1470
                            for (int j = 0; j < lstPoint.Count; j++)
1471
                            {
1472
                                lstPoint[j] = new Point(lstPoint[j].X + px.X, lstPoint[j].Y + px.Y);
1473
                            }
1474
                        }
1475

    
1476
                        for (int i = 0; i < item.ThumbList.Count; i++)
1477
                        {
1478
                            Canvas.SetLeft(item.ThumbList[i], Canvas.GetLeft(item.ThumbList[i]) + px.X);
1479
                            Canvas.SetTop(item.ThumbList[i], Canvas.GetTop(item.ThumbList[i]) + px.Y);
1480
                        }
1481
                        (item.DrawingData as IPath).updateControl();
1482
                        BorderUpdate();
1483

    
1484
                    }
1485
                    #endregion
1486
                    BorderUpdate();
1487
                }
1488
            }));
1489
        }
1490

    
1491
        public void DynamicThumbUpdate(DragDeltaEventArgs e, AdornerMember item)
1492
        {
1493
            var AllControl = item.DrawingData as IPath;
1494
            List<Point> point = AllControl.PointSet;
1495
            //for (int i = 0; i < AllControl.PointSet.Count(); i++)
1496
            for (int i = 0; i < item.ThumbList.Count(); i++)
1497
            {
1498

    
1499
                if (item.DrawingData.GetType().Name == "ArrowTextControl")
1500
                {
1501
                    Point dx = MathSet.RotateAbout(new Point(0, 0), new Point(e.HorizontalChange, e.VerticalChange), trRotate.Angle);
1502
                    AllControl.PointSet[i] = new Point { X = point[i].X + dx.X, Y = point[i].Y + dx.Y };
1503
                    AllControl.updateControl();
1504
                    Canvas.SetLeft(item.ThumbList[i], Canvas.GetLeft(item.ThumbList[i]) + dx.X);
1505
                    Canvas.SetTop(item.ThumbList[i], Canvas.GetTop(item.ThumbList[i]) + dx.Y);
1506

    
1507
                    Canvas.SetLeft(item.ThumbList.Last(), Canvas.GetLeft((item.DrawingData as ArrowTextControl).Base_TextBox));
1508
                    Canvas.SetTop(item.ThumbList.Last(), Canvas.GetTop((item.DrawingData as ArrowTextControl).Base_TextBox));
1509
                }
1510
                else
1511
                {
1512
                    Point dx = MathSet.RotateAbout(new Point(0, 0), new Point(e.HorizontalChange, e.VerticalChange), trRotate.Angle);
1513
                    AllControl.PointSet[i] = new Point { X = point[i].X + dx.X, Y = point[i].Y + dx.Y };
1514
                    AllControl.updateControl();
1515
                    Canvas.SetLeft(item.ThumbList[i], Canvas.GetLeft(item.ThumbList[i]) + dx.X);
1516
                    Canvas.SetTop(item.ThumbList[i], Canvas.GetTop(item.ThumbList[i]) + dx.Y);
1517
                }
1518
            }
1519
        }
1520

    
1521
        public void DynamicThumbUpdate(AdornerMember item)
1522
        {
1523
            var AllControl = item.DrawingData as IPath;
1524
            List<Point> point = AllControl.PointSet;
1525

    
1526
            //if (item.DrawingData as ArrowTextControl !=null)
1527
            //{
1528
            //    for (int i = 0; i < AllControl.PointSet.Count(); i++)
1529
            //    {
1530
            //        if ((MemberSet.First() as AdornerMember).ThumbList[1]d)
1531
            //        {
1532

    
1533
            //        }
1534
            //    }
1535
            //    List<Point> ps = new List<Point>();
1536
            //    var temp = (MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl;
1537
            //    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단
1538
            //    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단
1539
            //    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단
1540
            //    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2));  //우단
1541

    
1542
            //    var endP = MathSet.getNearPoint(ps, temp.MidPoint);
1543
            //    var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP);
1544
            //    Canvas.SetLeft((MemberSet.First() as AdornerMember).ThumbList[1], tempP.X);
1545
            //    Canvas.SetTop((MemberSet.First() as AdornerMember).ThumbList[1], tempP.Y);    
1546
            //}
1547
            //else
1548
            //{
1549
            for (int i = 0; i < AllControl.PointSet.Count(); i++)
1550
            {
1551

    
1552
                Canvas.SetLeft(item.ThumbList[i], AllControl.PointSet[i].X);
1553
                Canvas.SetTop(item.ThumbList[i], AllControl.PointSet[i].Y);
1554
            }
1555

    
1556

    
1557
            if (item.DrawingData as ArrowTextControl != null)
1558
            {
1559
                if (!(item.DrawingData as ArrowTextControl).isTrans) //trans가 True인경우
1560
                {
1561
                    List<Point> ps = new List<Point>();
1562
                    //강인구 수정
1563
                    //var temp = (MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl;
1564
                    var temp = item.DrawingData as ArrowTextControl;
1565
                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단
1566
                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단
1567
                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단
1568
                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2));  //우단
1569

    
1570

    
1571

    
1572
                    if (temp.isFixed)
1573
                    {
1574
                        var endP = MathSet.getNearPoint(ps, temp.MidPoint);
1575
                        var testP = endP;
1576
                        if (ps[0] == endP) //상단
1577
                        {
1578
                            testP = new Point(endP.X, endP.Y - 50);
1579
                            System.Diagnostics.Debug.WriteLine("상단");
1580
                        }
1581
                        else if (ps[1] == endP) //하단
1582
                        {
1583
                            testP = new Point(endP.X, endP.Y + 50);
1584
                            System.Diagnostics.Debug.WriteLine("하단");
1585
                        }
1586
                        else if (ps[2] == endP) //좌단
1587
                        {
1588
                            testP = new Point(endP.X - 50, endP.Y);
1589
                            System.Diagnostics.Debug.WriteLine("좌단");
1590
                        }
1591
                        else if (ps[3] == endP) //우단
1592
                        {
1593
                            testP = new Point(endP.X + 50, endP.Y);
1594
                            System.Diagnostics.Debug.WriteLine("우단");
1595
                        }
1596
                        Canvas.SetLeft((MemberSet.First() as AdornerMember).ThumbList[1], testP.X);
1597
                        Canvas.SetTop((MemberSet.First() as AdornerMember).ThumbList[1], testP.Y);
1598
                    }
1599
                    else
1600
                    {
1601
                        var endP = MathSet.getNearPoint(ps, temp.MidPoint);
1602
                        var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP);
1603
                        Canvas.SetLeft((MemberSet.First() as AdornerMember).ThumbList[1], tempP.X);
1604
                        Canvas.SetTop((MemberSet.First() as AdornerMember).ThumbList[1], tempP.Y);
1605
                    }
1606
                }
1607
            }
1608
            //}
1609
        }
1610

    
1611
        public void Set_Rotate()
1612
        {
1613

    
1614
            double dDeltaAngle = 0;
1615
            List<Point> AllPointSet = new List<Point>();
1616
            Point CenterPoint = new Point();
1617

    
1618

    
1619
            if (AngleValue >= 360)
1620
            {
1621
                AngleValue -= 360;
1622
            }
1623
            else if (AngleValue <= -360)
1624
            {
1625
                AngleValue += 360;
1626
            }
1627

    
1628
            #region 센터 포인트 구하기 (그룹핑)
1629
            foreach (var item in MemberSet)
1630
            {
1631
                if (item.DrawingData.GetType().Name == "TextControl")
1632
                {
1633
                }
1634
                else
1635
                {
1636
                    foreach (Point itemP in (item.DrawingData as IPath).PointSet)
1637
                    {
1638
                        AllPointSet.Add(itemP);
1639
                    }
1640
                }
1641
            }
1642
            #endregion
1643

    
1644
            CenterPoint = MathSet.FindCentroid(AllPointSet);
1645

    
1646
            Dispatcher.BeginInvoke((Action)(() =>
1647
            {
1648
                foreach (var item in MemberSet)
1649
                {
1650
                    foreach (var thumb in item.ThumbList)
1651
                    {
1652
                        double x = Canvas.GetLeft(thumb);
1653
                        double y = Canvas.GetTop(thumb);
1654

    
1655
                        Point value = MathSet.RotateAbout(CenterPoint, new Point(x, y), dDeltaAngle);
1656
                        Canvas.SetLeft(thumb, value.X);
1657
                        Canvas.SetTop(thumb, value.Y);
1658

    
1659
                        if (item.DrawingData.GetType().Name == "ArrowTextControl" && thumb == item.ThumbList.Last())
1660
                        {
1661

    
1662
                            Canvas.SetLeft(thumb, Canvas.GetLeft((item.DrawingData as ArrowTextControl).Base_TextBox));
1663
                            Canvas.SetTop(thumb, Canvas.GetTop((item.DrawingData as ArrowTextControl).Base_TextBox));
1664
                            if (!(item.DrawingData as ArrowTextControl).isTrans)
1665
                            {
1666
                                List<Point> ps = new List<Point>();
1667
                                var temp = (MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl;
1668
                                switch (Math.Abs(temp.Angle).ToString())
1669
                                {
1670
                                    case "90":
1671
                                        {
1672
                                            ps.Clear();
1673
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽
1674
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); // 위 중간
1675
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); // 위 오른쪽
1676

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

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

    
1683
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 중간
1684
                                        }
1685
                                        break;
1686
                                    case "270":
1687
                                        {
1688
                                            ps.Clear();
1689
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽
1690
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); // 위 중간
1691
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); // 위 오른쪽
1692

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

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

    
1699
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 중간
1700
                                        }
1701
                                        break;
1702
                                    default:
1703
                                        {
1704
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단
1705
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단
1706
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단
1707
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2));  //우단
1708
                                        }
1709
                                        break;
1710
                                }
1711

    
1712
                                var endP = MathSet.getNearPoint(ps, temp.MidPoint);
1713
                                var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP);
1714
                                Canvas.SetLeft((MemberSet.First() as AdornerMember).ThumbList[1], tempP.X);
1715
                                Canvas.SetTop((MemberSet.First() as AdornerMember).ThumbList[1], tempP.Y);
1716
                            }
1717
                        }
1718
                    }
1719

    
1720
                    for (int i = 0; i < (item.DrawingData as IPath).PointSet.Count(); i++)
1721
                    {
1722
                        (item.DrawingData as IPath).PointSet[i] = MathSet.RotateAbout(CenterPoint, (item.DrawingData as IPath).PointSet[i], dDeltaAngle);
1723
                    }
1724
                }
1725
                #region 컨트롤 업데이트
1726
                foreach (var item in MemberSet)
1727
                {
1728
                    switch (item.Drawingtype)
1729
                    {
1730
                        case ControlType.TextControl:
1731
                            ((TextControl)item.DrawingData).Angle = AngleValue;
1732
                            //trRotate.Angle = AngleValue;
1733

    
1734
                            RectangleGeometry Data = new RectangleGeometry
1735
                            {
1736
                                Rect = new Rect()
1737
                                {
1738
                                    X = Canvas.GetLeft((item.DrawingData as TextControl)),
1739
                                    Y = Canvas.GetTop((item.DrawingData as TextControl)),
1740
                                    Width = (item.DrawingData as TextControl).Base_TextBlock.ActualWidth / 2,
1741
                                    Height = (item.DrawingData as TextControl).Base_TextBlock.ActualHeight / 2,
1742
                                }
1743
                            };
1744
                            //if ((firstCondition as TextControl).Angle != 0)
1745
                            //{
1746
                            Point endPointV = new Point(Data.Bounds.Right, Data.Bounds.Bottom);
1747
                            Point middle = MathSet.getMiddlePoint((item.DrawingData as TextControl).StartPoint, endPointV);
1748

    
1749

    
1750
                            //AdornerBorder.RenderTransformOrigin = new Point(1, 1);
1751
                            //AdornerBorder.RenderTransform = new RotateTransform()
1752
                            //{
1753
                            //    Angle = (member as TextControl).Angle * -1,
1754
                            //    CenterX = middle.X + ((member as TextControl) as FrameworkElement).ActualWidth /2,
1755
                            //    CenterY = middle.Y + ((member as TextControl) as FrameworkElement).ActualHeight /2,
1756
                            //};
1757

    
1758
                            DragThumb.RenderTransformOrigin = new Point(0.0, 0.0);
1759
                            DragThumb.RenderTransform = new RotateTransform()
1760
                            {
1761
                                Angle = (item.DrawingData as TextControl).Angle,
1762
                                //CenterX = middle.X,
1763
                                //CenterY = middle.Y,
1764
                            };
1765

    
1766
                            AdornerBorder.RenderTransformOrigin = new Point(0.0, 0.0);
1767
                            AdornerBorder.RenderTransform = new RotateTransform()
1768
                            {
1769
                                Angle = (item.DrawingData as TextControl).Angle,
1770
                                //CenterX = middle.X,
1771
                                //CenterY = middle.Y,
1772
                            };
1773

    
1774
                            (item.DrawingData as TextControl).Base_Grid.RenderTransform = new RotateTransform()
1775
                            {
1776
                                Angle = (item.DrawingData as TextControl).Angle,
1777
                            };
1778

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

    
1868
        private void resize_MouseMove(object sender, MouseEventArgs e)
1869
        {
1870
            reSizePoint = e.GetPosition(this);
1871
            //Thumb thumb = sender as Thumb;
1872
            //if (this.isDragging && MemberSet.Count <= 1 && DraggerThumb == thumb)
1873
            ////if (thumb.IsDragging && MemberSet.Count <= 1 && DraggerThumb == thumb)
1874
            ////if (DraggerThumb == thumb)
1875
            //{
1876
            //    Point setPoint = e.GetPosition(this);
1877
            //    Canvas.SetLeft(thumb, setPoint.X);
1878
            //    Canvas.SetTop(thumb, setPoint.Y);
1879
            //    AdornerMember control = (from userThumb in MemberSet
1880
            //                             where userThumb.ThumbList.Contains(thumb)
1881
            //                             select userThumb).FirstOrDefault();
1882
            //    Point nearPoint = new Point(0, 0);
1883
            //    IPath AllControl = control.DrawingData as IPath;
1884
            //    if (ControlType.TextControl != control.Drawingtype)
1885
            //    {
1886

    
1887
            //        var temp = (MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl;
1888
            //        List<Point> ps = new List<Point>();
1889

    
1890
            //        nearPoint = MathSet.getNearPoint((control.DrawingData as IPath).PointSet, setPoint);
1891
            //        //switch (Math.Abs(temp.Angle).ToString())
1892
            //        //{
1893

    
1894
            //        //    case "90":
1895
            //        //        {
1896
            //        //            nearPoint = MathSet.getNearPoint((control.DrawingData as IPath).PointSet, setPoint);
1897
            //        //        }
1898
            //        //        break;
1899
            //        //    case "270":
1900
            //        //        {
1901
            //        //            nearPoint = MathSet.getNearPoint((control.DrawingData as IPath).PointSet, setPoint);
1902
            //        //        }
1903
            //        //        break;
1904
            //        //    default:
1905
            //        //        {
1906
            //        //            nearPoint = MathSet.getNearPoint((control.DrawingData as IPath).PointSet, setPoint);
1907
            //        //        }
1908
            //        //        break;
1909
            //        //}
1910

    
1911
            //    }
1912
            //    for (int i = 0; i < (control.DrawingData as IPath).PointSet.Count; i++)
1913
            //    {
1914
            //        switch (control.Drawingtype)
1915
            //        {
1916
            //            #region Arc + Line
1917
            //            case ControlType.ArcLine:
1918
            //            case ControlType.SingleLine:
1919
            //                if (nearPoint.Equals(AllControl.PointSet[i]))
1920
            //                {
1921
            //                    AllControl.PointSet[i] = setPoint;
1922
            //                    AllControl.updateControl();
1923
            //                    DynamicThumbUpdate(control);
1924
            //                    BorderUpdate();
1925

    
1926
            //                    //if (control.DrawingData.GetType().Name == "ArrowTextControl")
1927
            //                    //{
1928
            //                    //    Thumb tm = control.ThumbList.Last();
1929
            //                    //    //Canvas.SetLeft(tm, (AllControl.EndPoint.X - tm.Width / 2));
1930
            //                    //    //Canvas.SetTop(tm, (AllControl.EndPoint.Y - tm.Height / 2));
1931
            //                    //    Canvas.SetLeft(tm, (AllControl.EndPoint.X - tm.Width));
1932
            //                    //    Canvas.SetTop(tm, (AllControl.EndPoint.Y - tm.Height));
1933
            //                    //}
1934
            //                }
1935
            //                break;
1936
            //            #endregion
1937
            //            #region Shape
1938
            //            case ControlType.Rectangle:
1939
            //                if (nearPoint.Equals(AllControl.PointSet[i]))
1940
            //                {
1941
            //                    AllControl.PointSet[i] = setPoint;
1942
            //                    var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count();
1943
            //                    var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count();
1944
            //                    var NextP = (i + 1) % AllControl.PointSet.Count();
1945

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

    
1948
            //                    var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]);
1949
            //                    var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X,
1950
            //                        AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y);
1951
            //                    AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet
1952
            //                        [ReverseP].Y
1953
            //                        + PreviousV.Y * l);
1954

    
1955
            //                    var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]);
1956
            //                    l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet
1957
            //                        [i].Y - AllControl.PointSet[ReverseP].Y);
1958
            //                    AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y +
1959
            //                        NextV.Y * l);
1960
            //                    AllControl.updateControl();
1961
            //                    DynamicThumbUpdate(control);
1962
            //                    BorderUpdate();
1963
            //                }
1964
            //                break;
1965
            //            #endregion
1966
            //            #region Polygon
1967
            //            case ControlType.PolygonControl:
1968
            //                if (nearPoint.Equals(AllControl.PointSet[i]))
1969
            //                {
1970
            //                    AllControl.PointSet[i] = setPoint;
1971
            //                    AllControl.updateControl();
1972
            //                    BorderUpdate();
1973
            //                }
1974
            //                break;
1975
            //            #endregion
1976
            //            #region Cicle
1977
            //            case ControlType.Circle:
1978
            //                if (nearPoint.Equals(AllControl.PointSet[i]))
1979
            //                {
1980
            //                    AllControl.PointSet[i] = setPoint;
1981
            //                    List<Point> newPointSet = new List<Point> { };
1982
            //                    Point middle = new Point(AllControl.PathData.Bounds.X + AllControl.PathData.Bounds.Width * 0.5,
1983
            //                        AllControl.PathData.Bounds.Y +
1984
            //                        AllControl.PathData.Bounds.Height * 0.5);
1985
            //                    foreach (Point pt in AllControl.PointSet)
1986
            //                    {
1987
            //                        newPointSet.Add(pt);
1988
            //                    }
1989
            //                    var ReverseP = (i + newPointSet.Count() / 2) % newPointSet.Count();
1990
            //                    var PreviousP = (i + (newPointSet.Count() - 1)) % newPointSet.Count();
1991
            //                    var NextP = (i + 1) % newPointSet.Count();
1992
            //                    var distance = MathSet.DistanceTo(newPointSet[ReverseP], newPointSet[i]);
1993
            //                    var PreviousV = MathSet.GetNormVectorBetween(newPointSet[ReverseP], newPointSet[PreviousP]);
1994
            //                    var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, newPointSet[i].X - newPointSet[ReverseP].X,
1995
            //                        newPointSet[i].Y - newPointSet[ReverseP].Y);
1996
            //                    newPointSet[PreviousP] = new Point(newPointSet[ReverseP].X + PreviousV.X * l, newPointSet[ReverseP].Y
1997
            //                        + PreviousV.Y * l);
1998

    
1999
            //                    var NextV = MathSet.GetNormVectorBetween(newPointSet[ReverseP], newPointSet[NextP]);
2000
            //                    l = MathSet.DotProduct(NextV.X, NextV.Y, newPointSet[i].X - newPointSet[ReverseP].X, newPointSet[i].Y
2001
            //                        - newPointSet[ReverseP].Y);
2002
            //                    newPointSet[NextP] = new Point(newPointSet[ReverseP].X + NextV.X * l, newPointSet[ReverseP].Y + NextV.Y * l);
2003

    
2004
            //                    AllControl.PointSet = newPointSet;
2005
            //                    DynamicThumbUpdate(control);
2006
            //                    AllControl.updateControl();
2007
            //                    BorderUpdate();
2008
            //                }
2009
            //                break;
2010
            //            #endregion
2011
            //            #region ArrowText
2012
            //            case ControlType.ArrowTextControl:
2013
            //                if (nearPoint.Equals(AllControl.PointSet[i]))
2014
            //                {
2015
            //                    AllControl.PointSet[i] = setPoint;
2016
            //                    AllControl.updateControl();
2017

    
2018
            //                    DynamicThumbUpdate(control);
2019
            //                    BorderUpdate();
2020

    
2021
            //                    //if (control.DrawingData.GetType().Name == "ArrowTextControl")
2022
            //                    //{
2023
            //                    //    Thumb tm = control.ThumbList.Last();
2024
            //                    //    //Canvas.SetLeft(tm, (AllControl.EndPoint.X - tm.Width / 2));
2025
            //                    //    //Canvas.SetTop(tm, (AllControl.EndPoint.Y - tm.Height / 2));
2026
            //                    //    Canvas.SetLeft(tm, (AllControl.EndPoint.X - tm.Width));
2027
            //                    //    Canvas.SetTop(tm, (AllControl.EndPoint.Y - tm.Height));
2028
            //                    //}
2029
            //                }
2030
            //                break;
2031
            //            #endregion
2032
            //            #region Text
2033
            //            case ControlType.TextControl:
2034
            //                break;
2035
            //            #endregion
2036
            //            #region Image
2037
            //            case ControlType.ImgControl:
2038
            //                if (nearPoint.Equals(AllControl.PointSet[i]))
2039
            //                {
2040
            //                    AllControl.PointSet[i] = setPoint;
2041
            //                    var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count();
2042
            //                    var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count();
2043
            //                    var NextP = (i + 1) % AllControl.PointSet.Count();
2044

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

    
2047
            //                    var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]);
2048
            //                    var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X,
2049
            //                        AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y);
2050
            //                    AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet
2051
            //                        [ReverseP].Y
2052
            //                        + PreviousV.Y * l);
2053

    
2054
            //                    var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]);
2055
            //                    l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet
2056
            //                        [i].Y - AllControl.PointSet[ReverseP].Y);
2057
            //                    AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y +
2058
            //                        NextV.Y * l);
2059
            //                    AllControl.updateControl();
2060
            //                    DynamicThumbUpdate(control);
2061
            //                    BorderUpdate();
2062
            //                }
2063
            //                break;
2064
            //            #endregion
2065
            //            #region Cloud
2066
            //            case ControlType.PolygonCloud:
2067
            //                if (nearPoint.Equals(AllControl.PointSet[i]))
2068
            //                {
2069
            //                    AllControl.PointSet[i] = setPoint;
2070
            //                    AllControl.updateControl();
2071
            //                    ((ICloudControl)AllControl).DrawingCloud();
2072
            //                    BorderUpdate();
2073
            //                }
2074
            //                break;
2075
            //            #endregion
2076
            //            #region SymBol
2077
            //            //case MarkupType.Viewbox:
2078
            //            //    if (nearPoint.Equals(AllControl.PointSet[i]))
2079
            //            //    {
2080
            //            //        AllControl.PointSet[i] = setPoint;
2081
            //            //        var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count();
2082
            //            //        var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count();
2083
            //            //        var NextP = (i + 1) % AllControl.PointSet.Count();
2084

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

    
2087
            //            //        var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]);
2088
            //            //        var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X,
2089
            //            //            AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y);
2090
            //            //        AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet
2091
            //            //            [ReverseP].Y
2092
            //            //            + PreviousV.Y * l);
2093

    
2094
            //            //        var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]);
2095
            //            //        l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet
2096
            //            //            [i].Y - AllControl.PointSet[ReverseP].Y);
2097
            //            //        AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y +
2098
            //            //            NextV.Y * l);
2099
            //            //        AllControl.updateControl();
2100
            //            //        DynamicThumbUpdate(control);
2101
            //            //        BorderUpdate();
2102
            //            //    }
2103
            //            //    break;
2104
            //            #endregion
2105
            //            default:
2106
            //                break;
2107
            //        }
2108
            //    }
2109
            //}
2110
        }
2111

    
2112
        /// <summary>
2113
        /// 회전
2114
        /// </summary>
2115
        /// <param name="sender"></param>
2116
        /// <param name="e"></param>
2117
        public void rotate_DragDelta(object sender, DragDeltaEventArgs e)
2118
        {
2119
            MoveRotate(e);
2120
        }
2121

    
2122
        double LastRotateHorizontalValue = 0;
2123
        double LastRotateVerticalValue = 0;
2124
        double LastWidthValue = 0;
2125
        double SetWidth = 0;
2126
        bool RotateFlag = false;
2127

    
2128
        /// <summary>
2129
        /// <history>humkyung 2018.05.09 upgrade rotate shape peformance</history>
2130
        /// </summary>
2131
        /// <param name="e"></param>
2132
        public void MoveRotate(DragDeltaEventArgs e)
2133
        {
2134
            double dDeltaAngle = 0;
2135

    
2136
            List<Point> AllPointSet = new List<Point>();
2137
            Point CenterPoint = new Point();
2138
            #region 회전율에 따른 DragDelta 값
2139

    
2140
            #region 원본소스
2141
            ////if (Math.Abs(e.HorizontalChange) > Math.Abs(e.VerticalChange))
2142
            ////{
2143
            //    //dDeltaAngle = +2;
2144
            //    //dDeltaAngle = (e.HorizontalChange / 20);
2145
            //    AngleValue = AngleValue + dDeltaAngle;
2146
            //    if (Math.Abs(e.HorizontalChange) > Math.Abs(e.VerticalChange))
2147
            //    {
2148
            //        if (LastRotateHorizontalValue < e.HorizontalChange)
2149
            //        {
2150
            //            dDeltaAngle = 2;
2151
            //            AngleValue = AngleValue + dDeltaAngle;
2152
            //        }
2153
            //        else
2154
            //        {
2155
            //            dDeltaAngle = -2;
2156
            //            AngleValue = AngleValue + dDeltaAngle;
2157
            //        }
2158
            //    }
2159
            //    //else
2160
            //    //{
2161
            //    //    if (LastRotateVerticalValue < e.VerticalChange)
2162
            //    //    {
2163
            //    //        dDeltaAngle = -2;
2164
            //    //        AngleValue = AngleValue + dDeltaAngle;
2165

    
2166
            //    //    }
2167
            //    //    else
2168
            //    //    {
2169
            //    //        dDeltaAngle = 2;
2170
            //    //        AngleValue = AngleValue + dDeltaAngle;
2171
            //    //    }
2172
            //    //}
2173
            ////}
2174
            ////else if (Math.Abs(e.HorizontalChange) < Math.Abs(e.VerticalChange))
2175
            ////{
2176
            ////    //dDeltaAngle = (e.VerticalChange / 20);
2177
            ////    dDeltaAngle = -2;
2178
            ////    AngleValue = AngleValue + dDeltaAngle;
2179
            ////} 
2180
            #endregion
2181

    
2182
            //강인구 수정
2183
            //AngleValue = AngleValue + dDeltaAngle;
2184
            #endregion
2185

    
2186
            #region 센터 포인트 구하기 (그룹핑)
2187
            foreach (var item in MemberSet)
2188
            {
2189
                if (item.DrawingData.GetType().Name == "TextControl")
2190
                {
2191
                    //double X = Canvas.GetLeft((item.DrawingData as TextControl));
2192
                    //double Y = Canvas.GetTop((item.DrawingData as TextControl));
2193
                    //AllPointSet.Add(new Point(X, Y));
2194
                    AllPointSet.Add((item.DrawingData as TextControl).StartPoint);
2195
                }
2196
                else
2197
                {
2198
                    foreach (Point itemP in (item.DrawingData as IPath).PointSet)
2199
                    {
2200
                        AllPointSet.Add(itemP);
2201
                    }
2202
                }
2203
            }
2204
            #endregion
2205
            CenterPoint = MathSet.FindCentroid(AllPointSet);
2206
            Point pt = Mouse.GetPosition(this);
2207

    
2208
            Point vec1 = new Point(this.rotatePoint.X - CenterPoint.X, this.rotatePoint.Y - CenterPoint.Y);
2209
            Point vec2 = new Point(pt.X - CenterPoint.X, pt.Y - CenterPoint.Y);
2210
            dDeltaAngle = (MathSet.getAngleBetweenVectors(vec1, vec2));
2211

    
2212
            AngleValue += dDeltaAngle;
2213
            if (AngleValue > 360) AngleValue -= 360;
2214
            if (AngleValue < 0) AngleValue += 360;
2215
            this.rotatePoint = pt;  /// save rotatePoint
2216

    
2217
            Dispatcher.BeginInvoke((Action)(() =>
2218
            {
2219
                foreach (var item in MemberSet)
2220
                {
2221
                    foreach (var thumb in item.ThumbList)
2222
                    {
2223
                        double x = Canvas.GetLeft(thumb);
2224
                        double y = Canvas.GetTop(thumb);
2225

    
2226
                        Point value = MathSet.RotateAbout(CenterPoint, new Point(x, y), dDeltaAngle);
2227
                        Canvas.SetLeft(thumb, value.X);
2228
                        Canvas.SetTop(thumb, value.Y);
2229

    
2230
                        /*
2231
                        if (item.DrawingData.GetType().Name == "ArrowTextControl" && thumb == item.ThumbList.Last())
2232
                        {
2233
                            Canvas.SetLeft(thumb, Canvas.GetLeft((item.DrawingData as ArrowTextControl).Base_TextBox));
2234
                            Canvas.SetTop(thumb, Canvas.GetTop((item.DrawingData as ArrowTextControl).Base_TextBox));
2235
                            if (!(item.DrawingData as ArrowTextControl).isTrans)
2236
                            {
2237
                                List<Point> ps = new List<Point>();
2238
                                
2239
                                //강인구 추가
2240
                                //var temp = (MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl;
2241
                                var temp = item.DrawingData as ArrowTextControl;
2242
                                switch (Math.Abs(temp.Angle).ToString())
2243
                                {
2244
                                    case "90":
2245
                                        {
2246
                                            ps.Clear();
2247
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽
2248
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); // 위 중간
2249
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); // 위 오른쪽
2250

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

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

    
2257
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 중간
2258
                                        }
2259
                                        break;
2260
                                    case "270":
2261
                                        {
2262
                                            ps.Clear();
2263
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽
2264
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); // 위 중간
2265
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); // 위 오른쪽
2266

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

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

    
2273
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 중간
2274
                                        }
2275
                                        break;
2276
                                    default:
2277
                                        {
2278
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단
2279
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단
2280
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단
2281
                                            ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2));  //우단
2282
                                        }
2283
                                        break;
2284
                                }
2285

    
2286
                                var endP = MathSet.getNearPoint(ps, temp.MidPoint);
2287
                                var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP);
2288

    
2289
                                Canvas.SetLeft((MemberSet.Where(data => data.DrawingData.GetType().Name == "ArrowTextControl")).FirstOrDefault().ThumbList[1], tempP.X);
2290
                                Canvas.SetTop((MemberSet.Where(data => data.DrawingData.GetType().Name == "ArrowTextControl")).FirstOrDefault().ThumbList[1], tempP.Y);
2291
                                //Canvas.SetLeft((MemberSet.First() as AdornerMember).ThumbList[1], tempP.X);
2292
                                //Canvas.SetTop((MemberSet.First() as AdornerMember).ThumbList[1], tempP.Y);
2293
                            }
2294
                        }
2295
                        */
2296
                    }
2297

    
2298
                    for (int i = 0; i < (item.DrawingData as IPath).PointSet.Count(); i++)
2299
                    {
2300
                        (item.DrawingData as IPath).PointSet[i] = MathSet.RotateAbout(CenterPoint, (item.DrawingData as IPath).PointSet[i], dDeltaAngle);
2301
                    }
2302
                }
2303
                #region 보더 업데이트
2304
                foreach (var item in MemberSet)
2305
                {
2306
                    switch (item.Drawingtype)
2307
                    {
2308
                        case ControlType.TextControl:
2309
                            ((TextControl)item.DrawingData).Angle = AngleValue;
2310

    
2311
                            RectangleGeometry Data = new RectangleGeometry
2312
                            {
2313
                                Rect = new Rect()
2314
                                {
2315
                                    X = Canvas.GetLeft((item.DrawingData as TextControl)),
2316
                                    Y = Canvas.GetTop((item.DrawingData as TextControl)),
2317
                                    Width = (item.DrawingData as TextControl).Base_TextBlock.ActualWidth / 2,
2318
                                    Height = (item.DrawingData as TextControl).Base_TextBlock.ActualHeight / 2,
2319
                                }
2320
                            };
2321
                            //if ((firstCondition as TextControl).Angle != 0)
2322
                            //{
2323
                            Point endPointV = new Point(Data.Bounds.Right, Data.Bounds.Bottom);
2324
                            Point middle = MathSet.getMiddlePoint((item.DrawingData as TextControl).StartPoint, endPointV);
2325

    
2326

    
2327
                            //AdornerBorder.RenderTransformOrigin = new Point(1, 1);
2328
                            //AdornerBorder.RenderTransform = new RotateTransform()
2329
                            //{
2330
                            //    Angle = (member as TextControl).Angle * -1,
2331
                            //    CenterX = middle.X + ((member as TextControl) as FrameworkElement).ActualWidth /2,
2332
                            //    CenterY = middle.Y + ((member as TextControl) as FrameworkElement).ActualHeight /2,
2333
                            //};
2334

    
2335
                            DragThumb.RenderTransformOrigin = new Point(0.0, 0.0);
2336
                            DragThumb.RenderTransform = new RotateTransform()
2337
                            {
2338
                                Angle = (item.DrawingData as TextControl).Angle,
2339
                                //CenterX = middle.X,
2340
                                //CenterY = middle.Y,
2341
                            };
2342

    
2343
                            AdornerBorder.RenderTransformOrigin = new Point(0.0, 0.0);
2344
                            AdornerBorder.RenderTransform = new RotateTransform()
2345
                            {
2346
                                Angle = (item.DrawingData as TextControl).Angle,
2347
                                //CenterX = middle.X,
2348
                                //CenterY = middle.Y,
2349
                            };
2350

    
2351
                            (item.DrawingData as TextControl).Base_Grid.RenderTransform = new RotateTransform()
2352
                            {
2353
                                Angle = (item.DrawingData as TextControl).Angle,
2354
                            };
2355

    
2356
                            BorderUpdate();
2357
                            break;
2358
                        //case ControlType.Viewbox:
2359
                        //    (item.DrawingData as IPath).updateControl();
2360
                        //    ((IViewBox)item.DrawingData).Angle = AngleValue;
2361
                        //    BorderUpdate();
2362
                        //    break;
2363
                        case ControlType.Date:
2364

    
2365
                            //강인구 추가(2018.02.22)
2366
                            ((DateControl)item.DrawingData).Angle = AngleValue;
2367
                            (item.DrawingData as IPath).updateControl();
2368

    
2369
                            BorderUpdate();
2370
                            //MessageBox.Show("잠시 정확도를 위해 막아두었습니다!");
2371
                            break;
2372
                        case ControlType.ArrowMultiLine:
2373
                        case ControlType.ArcLine:
2374
                        case ControlType.SingleLine:
2375
                        case ControlType.Triangle:
2376
                            (item.DrawingData as IPath).updateControl();
2377
                            BorderUpdate();
2378
                            break;
2379
                        case ControlType.ArrowTextControl:
2380
                            (item.DrawingData as IPath).updateControl();
2381
                            BorderUpdate();
2382
                            break;
2383
                        case ControlType.RectCloud:
2384
                            ((RectCloudControl)item.DrawingData).Angle = AngleValue;
2385
                            (item.DrawingData as IPath).updateControl();
2386
                            BorderUpdate();
2387
                            break;
2388
                        case ControlType.Rectangle:
2389
                            ((RectangleControl)item.DrawingData).Angle = AngleValue;
2390
                            (item.DrawingData as IPath).updateControl();
2391
                            BorderUpdate();
2392
                            break;
2393
                        case ControlType.ImgControl:
2394
                            ((ImgControl)item.DrawingData).Angle = AngleValue;
2395
                            (item.DrawingData as IPath).updateControl();
2396
                            BorderUpdate();
2397
                            break;
2398
                        //강인구 추가
2399
                        case ControlType.Sign:
2400
                            ((SignControl)item.DrawingData).Angle = AngleValue;
2401
                            (item.DrawingData as IPath).updateControl();
2402
                            BorderUpdate();
2403
                            break;
2404
                        //강인구 추가
2405
                        case ControlType.Symbol:
2406
                            ((SymControl)item.DrawingData).Angle = AngleValue;
2407
                            (item.DrawingData as IPath).updateControl();
2408
                            BorderUpdate();
2409
                            break;
2410
                        //강인구 추가
2411
                        case ControlType.Stamp:
2412
                            ((SymControlN)item.DrawingData).Angle = AngleValue;
2413
                            (item.DrawingData as IPath).updateControl();
2414
                            BorderUpdate();
2415
                            break;
2416
                        case ControlType.PolygonControl:
2417
                            //((IShapeControl)AllControl).Angle = AngleValue;
2418
                            (item.DrawingData as IPath).updateControl();
2419
                            BorderUpdate();
2420
                            break;
2421
                        case ControlType.PolygonCloud:
2422
                            //((IShapeControl)AllControl).Angle = AngleValue;
2423
                            ((ICloudControl)item.DrawingData).DrawingCloud();
2424
                            (item.DrawingData as IPath).updateControl();
2425
                            BorderUpdate();
2426
                            break;
2427
                        case ControlType.Circle:
2428
                            ((IShapeControl)item.DrawingData).Angle = AngleValue;
2429
                            (item.DrawingData as IPath).updateControl();
2430
                            ((CircleControl)item.DrawingData).SetCenterXY();
2431
                            BorderUpdate();
2432
                            break;
2433
                        case ControlType.Ink:
2434
                            for (int i = 0; i < (item.DrawingData as InkControl).PointC.Count(); i++)
2435
                            {
2436
                                for (int j = 0; j < (item.DrawingData as InkControl).PointC[i].pointSet.Count; j++)
2437
                                {
2438
                                    (item.DrawingData as InkControl).PointC[i].pointSet[j] = MathSet.RotateAbout(CenterPoint, (item.DrawingData as InkControl).PointC[i].pointSet[j], dDeltaAngle);
2439
                                }
2440
                            }
2441
                            (item.DrawingData as IPath).updateControl();
2442
                            BorderUpdate();
2443
                            break;
2444
                        //case MarkupType.PolygonEx:
2445
                        //    //trRotate.Angle = AngleValue;
2446
                        //    for (int i = 0; i < (item.DrawingData as PolyControl).PointC.Count(); i++)
2447
                        //    {
2448
                        //        //(item.DrawingData as PolyControl).PointC[i] = MathSet.RotateAbout(CenterPoint, (item.DrawingData as PolyControl).PointC[i]., dDeltaAngle);
2449
                        //        for (int j = 0; j < (item.DrawingData as PolyControl).PointC[i].pointSet.Count; j++)
2450
                        //        {
2451
                        //            (item.DrawingData as PolyControl).PointC[i].pointSet[j] = MathSet.RotateAbout(CenterPoint, (item.DrawingData as PolyControl).PointC[i].pointSet[j], dDeltaAngle);
2452
                        //        }
2453
                        //    }
2454
                        //    (item.DrawingData as IPath).updateControl();
2455
                        //    BorderUpdate();
2456
                        //    break;
2457
                        default:
2458
                            break;
2459
                    }
2460
                }
2461
                #endregion
2462
            }));
2463
            BorderUpdate();
2464
        }
2465

    
2466
        /// <summary>
2467
        /// starting rotate
2468
        /// </summary>
2469
        /// <param name="sender"></param>
2470
        /// <param name="e"></param>
2471
        private void rotate_DragStarted(object sender, DragStartedEventArgs e)
2472
        {
2473
            this.rotatePoint = Mouse.GetPosition(this); /// 2018.05.09 added by humkyung
2474
            rotateTop.Cursor = Cursors.SizeAll;
2475

    
2476
            /// get angle from text controls' angle if only text control exists - 2018.05.10 added by humkyung
2477
            if ((1 == MemberSet.Count) && (MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "TextControl")
2478
            {
2479
                this.AngleValue = ((MemberSet.First() as AdornerMember).DrawingData as TextControl).Angle;
2480
            }
2481
            /// up to here
2482

    
2483
            if (ViewerDataModel.Instance.UndoDataList == null)
2484
            {
2485
                return;
2486
            }
2487

    
2488
            if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Event == Event_Type.Thumb)
2489
            {
2490
                return;
2491
            }
2492
            if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List != null)
2493
            {
2494
                if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.Count > 0)
2495
                {
2496
                    if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.FirstOrDefault().PointSet != null)
2497
                    {
2498
                        return;
2499
                    }
2500
                }
2501
            }
2502

    
2503
            Undo_Event();
2504
        }
2505

    
2506
        private void rotate_DragCompleted(object sender, DragCompletedEventArgs e)
2507
        {
2508
            //CustomCursor.SetCursorTemplate(rotateTop, null);
2509
            rotateTop.Cursor = Cursors.Arrow;
2510

    
2511
            Undo_Event();
2512
        }
2513

    
2514
        private void drag_DragStarted(object sender, DragStartedEventArgs e)
2515
        {
2516
            //CustomCursor.SetCursorTemplate(DragThumb, this.Resources["MoveCursor"] as DataTemplate);
2517
            //DragThumb.Cursor = Cursors.None;
2518
            //DragThumb.Cursor = Cursors.SizeAll;
2519

    
2520
            if (ViewerDataModel.Instance.UndoDataList == null)
2521
            {
2522
                return;
2523
            }
2524
            if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Event == Event_Type.Thumb)
2525
            {
2526
                return;
2527
            }
2528
            if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List != null)
2529
            {
2530
                if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.Count > 0)
2531
                {
2532
                    if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.FirstOrDefault().PointSet != null)
2533
                    {
2534
                        return;
2535
                    }
2536
                }
2537
            }
2538

    
2539
            Undo_Event();
2540
        }
2541

    
2542
        private void Undo_Event()
2543
        {
2544
            List<Point> p_set = new List<Point>();
2545

    
2546
            Undo_data UndoData = new Undo_data()
2547
            {
2548
                IsUndo = false,
2549
                Event = Event_Type.Thumb,
2550
                EventTime = DateTime.Now,
2551
                Markup_List = new List<Multi_Undo_data>(),
2552
            };
2553

    
2554
            Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2555

    
2556
            foreach (var control in MemberSet)
2557
            {
2558
                multi_Undo_Data.PointSet = new List<Point>();
2559
                p_set = new List<Point>();
2560

    
2561
                if(control.DrawingData as TextControl != null)
2562
                {
2563
                    multi_Undo_Data.PointSet.Add((control.DrawingData as TextControl).StartPoint);
2564
                    multi_Undo_Data.PointSet.Add((control.DrawingData as TextControl).EndPoint);
2565
                }
2566

    
2567
                foreach (var point in ((control.DrawingData as CommentUserInfo) as IPath).PointSet)
2568
                {
2569
                    multi_Undo_Data.PointSet.Add(point);
2570
                }
2571

    
2572
                multi_Undo_Data.Angle = AngleValue;
2573

    
2574
                multi_Undo_Data.Markup = control.DrawingData as CommentUserInfo;
2575
                UndoData.Markup_List.Add(multi_Undo_Data);
2576
                multi_Undo_Data = new Multi_Undo_data();
2577
            }
2578
            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
2579
            {
2580
                ViewerDataModel.Instance.UndoDataList.Remove(i);
2581
            });
2582

    
2583
            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2584

    
2585
        }
2586

    
2587
        private void drag_DragCompleted(object sender, DragCompletedEventArgs e)
2588
        {
2589
            //CustomCursor.SetCursorTemplate(DragThumb, null);
2590
            DragThumb.Cursor = Cursors.Arrow;
2591

    
2592
            Undo_Event();
2593
        }
2594

    
2595
        public void ControlPointMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
2596
        {
2597
            AdornerMember control = MemberSet.FirstOrDefault();
2598

    
2599
            if ((control.DrawingData as ArrowTextControl) != null && DraggerThumb == null)
2600
            {
2601
                if ((control.DrawingData as ArrowTextControl).isTrans == false && (control.DrawingData as ArrowTextControl).isFixed == false)
2602
                {
2603
                    (control.DrawingData as ArrowTextControl).isTrans = true;
2604
                }
2605
            }
2606

    
2607
        }
2608

    
2609
        public void TextControlChanger()
2610
        {
2611
            if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "TextControl")
2612
            {
2613
                TextControl AllControl = (MemberSet.First() as AdornerMember).DrawingData as TextControl;
2614
                AllControl.Base_TextBox.Focus();
2615
                AllControl.Base_TextBox.Visibility = Visibility.Visible;
2616
                AllControl.Base_TextBlock.Visibility = Visibility.Collapsed;
2617
                AllControl.Base_TextBox.Focus();
2618
                AllControl.SizeChanged += (sen, ea) =>
2619
                {
2620
                    if (AllControl.Base_TextBox != null)
2621
                    {
2622
                        RectangleGeometry Data = new RectangleGeometry
2623
                        {
2624
                            Rect = new Rect()
2625
                            {
2626
                                X = AllControl.StartPoint.X,
2627
                                Y = AllControl.StartPoint.Y,
2628
                                Width = AllControl.Base_TextBox.Width,
2629
                                Height = AllControl.Base_TextBox.Height,
2630
                            }
2631
                        };
2632

    
2633
                        Point endPointV = new Point(Data.Bounds.Right, Data.Bounds.Bottom);
2634
                        Point middle = MathSet.getMiddlePoint(AllControl.StartPoint, endPointV);
2635
                        AllControl.Base_Grid.RenderTransform = new RotateTransform()
2636
                        {
2637
                            Angle = AllControl.Angle,
2638
                            CenterX = middle.X,
2639
                            CenterY = middle.Y,
2640
                        };
2641
                    }
2642
                    BorderUpdate();
2643
                };
2644
            }
2645
        }
2646

    
2647
        private void RectThumb_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) //더블클릭
2648
        {
2649
            if (e.ClickCount == 2 && MemberSet.Count == 1)
2650
            {
2651

    
2652
                if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "TextControl")
2653
                {
2654
                    TextControlChanger();
2655
                    //    TextControl AllControl = (MemberSet.First() as AdornerMember).DrawingData as TextControl;
2656
                    //    AllControl.Base_TextBox.Focus();
2657
                    //    AllControl.Base_TextBox.Visibility = Visibility.Visible;
2658
                    //    AllControl.Base_TextBlock.Visibility = Visibility.Collapsed;
2659
                    //    AllControl.Base_TextBox.Focus();
2660
                    //    AllControl.SizeChanged += (sen, ea) =>
2661
                    //    {
2662
                    //        if (AllControl.Base_TextBox != null)
2663
                    //        {   
2664
                    //            RectangleGeometry Data = new RectangleGeometry
2665
                    //            {
2666
                    //                Rect = new Rect()
2667
                    //                {
2668
                    //                    X = AllControl.StartPoint.X,
2669
                    //                    Y = AllControl.StartPoint.Y,
2670
                    //                    Width = AllControl.Base_TextBox.Width,
2671
                    //                    Height = AllControl.Base_TextBox.Height,
2672
                    //                }
2673
                    //            };
2674

    
2675
                    //            Point endPointV = new Point(Data.Bounds.Right, Data.Bounds.Bottom);
2676
                    //            Point middle = MathSet.getMiddlePoint(AllControl.StartPoint, endPointV);
2677
                    //            AllControl.Base_Grid.RenderTransform = new RotateTransform()
2678
                    //            {
2679
                    //                Angle = AllControl.Angle,
2680
                    //                CenterX = middle.X,
2681
                    //                CenterY = middle.Y,
2682
                    //            };
2683
                    //        }
2684
                    //        BorderUpdate();
2685
                    //    };
2686
                }
2687

    
2688
                else if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "ArrowTextControl")
2689
                {
2690
                    ArrowTextControl AllControl = (MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl;
2691
                    Thumb tm = (MemberSet.First() as AdornerMember).ThumbList.Last();
2692
                    ((ArrowTextControl)AllControl).Base_TextBox.Focus();
2693

    
2694
                    //강인구 추가(ArrowControl TextBox Thumb없애기
2695
                    tm.Visibility = Visibility.Collapsed;
2696

    
2697
                    ((MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl).Base_TextBox.IsHitTestVisible = true;
2698

    
2699
                    //(sender as System.Windows.Shapes.Rectangle).IsHitTestVisible = false;
2700
                    //(sender as System.Windows.Shapes.Rectangle).Visibility = Visibility.Hidden;
2701
                    //Canvas.SetZIndex(((ArrowTextControl)AllControl).Base_TextBox,9999);
2702
                    //editTextBox = ((ArrowTextControl)AllControl).Base_TextBox;
2703
                    //editTextBox.Style = ((ArrowTextControl)AllControl).Base_TextBox.Style;
2704
                    //editTextBox.Text = (AllControl as ArrowTextControl).ArrowText;
2705
                    //editTextBox.FontSize = (AllControl as ArrowTextControl).FontSize;
2706
                    //editTextBox.Foreground = (AllControl as ArrowTextControl).Foreground;
2707
                    //editTextBox.FontWeight = (AllControl as ArrowTextControl).FontWeight;
2708

    
2709
                    //(AllControl as ArrowTextControl).Base_TextBox.Visibility = Visibility.Collapsed;
2710
                    //editTextBox = (AllControl as ArrowTextControl).Base_TextBox;
2711
                    //editTextBox.TextChanged += (sen, ea) =>
2712
                    //  {
2713
                    //      ((ArrowTextControl)AllControl).ArrowText = editTextBox.Text;
2714
                    //  };
2715

    
2716

    
2717
                    //(sender as System.Windows.Shapes.Rectangle).Visibility = Visibility.Hidden;
2718
                    //((ArrowTextControl)AllControl).Base_TextBox.Background = new SolidColorBrush(Colors.Blue);
2719
                    //((ArrowTextControl)AllControl).Base_TextBox.Opacity = 1;
2720
                    //((ArrowTextControl)AllControl).Base_TextBox.Focus();
2721

    
2722
                    ((ArrowTextControl)AllControl).Base_TextBox.SizeChanged += (sen, ea) =>
2723

    
2724
                    {
2725
                        tm.Width = (AllControl as ArrowTextControl).BoxWidth;
2726
                        tm.Height = (AllControl as ArrowTextControl).BoxHeight;
2727

    
2728
                        List<Point> ps = new List<Point>();
2729
                        //RotateTransform myRotateTransform = new RotateTransform();
2730

    
2731

    
2732
                        //if (control.Angle == -270)
2733
                        //{
2734
                        //    myRotateTransform.Angle = 90;
2735
                        //    myRotateTransform.CenterX = Canvas.GetLeft(control.Base_TextBox);
2736
                        //    myRotateTransform.CenterY = Canvas.GetTop(control.Base_TextBox);
2737
                        //}
2738
                        //else if (control.Angle == -90)
2739
                        //{
2740
                        //    myRotateTransform.Angle = 270;
2741
                        //    myRotateTransform.CenterX = Canvas.GetLeft(control.Base_TextBox);
2742
                        //    myRotateTransform.CenterY = Canvas.GetTop(control.Base_TextBox);
2743
                        //}
2744
                        //TransformGroup myTransformGroup = new TransformGroup();
2745
                        //myTransformGroup.Children.Add(myRotateTransform);
2746

    
2747
                        ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth / 2, Canvas.GetTop(AllControl.Base_TextBox))); //상단
2748
                        ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth / 2, Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight)); // 하단
2749
                        ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox), Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight / 2)); //좌단
2750
                        ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth, Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight / 2));  //우단
2751

    
2752

    
2753

    
2754

    
2755
                        var endP = MathSet.getNearPoint(ps, AllControl.MidPoint);
2756
                        var tempP = MathSet.getMiddlePoint(AllControl.StartPoint, endP);
2757
                        if (AllControl.isTrans)
2758
                        {
2759
                            Canvas.SetLeft((MemberSet.First() as AdornerMember).ThumbList[1], AllControl.MidPoint.X);
2760
                            Canvas.SetTop((MemberSet.First() as AdornerMember).ThumbList[1], AllControl.MidPoint.Y);
2761
                        }
2762
                        else
2763
                        {
2764
                            Canvas.SetLeft((MemberSet.First() as AdornerMember).ThumbList[1], tempP.X);
2765
                            Canvas.SetTop((MemberSet.First() as AdornerMember).ThumbList[1], tempP.Y);
2766
                        }
2767

    
2768
                        
2769
                        BorderUpdate();
2770
                        
2771
                    };
2772
                }
2773
                else if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "DateControl")
2774
                {
2775
                    DateControl data = (MemberSet.First() as AdornerMember).DrawingData as DateControl;
2776
                    CalendarControl instanceCal = new CalendarControl(data.Text);
2777
                    //dropData.IsOpen = true;
2778
                    RadWindow rc = new RadWindow();
2779
                    rc.Width = 300;
2780
                    rc.Height = 300;
2781
                    rc.Header = "Change Date";
2782
                    rc.Content = instanceCal;
2783
                    rc.BorderThickness = new Thickness(3);
2784
                    rc.ResizeMode = ResizeMode.NoResize;
2785
                    rc.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2786
                    rc.ModalBackground = new SolidColorBrush(Colors.Black);
2787
                    rc.ModalBackground.Opacity = 0.6;
2788
                    Telerik.Windows.Controls.StyleManager.SetTheme(rc, new Telerik.Windows.Controls.Windows8Theme());
2789
                    instanceCal.changeDateCal.SelectionChanged += (sen, ea) =>
2790
                    {
2791
                        data.Text = instanceCal.changeDateCal.SelectedDate.Value.ToShortDateString();
2792
                        rc.Close();
2793
                    };
2794
                    rc.ShowDialog();
2795
                    //CalendarControl.xaml
2796
                }
2797
                else if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "ArcControl")
2798
                {
2799
                    ArcControl instance = ((MemberSet.First() as AdornerMember).DrawingData as ArcControl);
2800
                    if (instance.isTransOn)
2801
                    {
2802
                        instance.isTransOn = false;
2803
                    }
2804
                    else
2805
                    {
2806
                        instance.isTransOn = true;
2807
                    }
2808
                    instance.SetArcPath();
2809
                    BorderUpdate();
2810
                }
2811
                //else if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "CloudControl")
2812
                //{
2813
                //    CloudControl instance = ((MemberSet.First() as AdornerMember).DrawingData as CloudControl);
2814
                //    if (!instance.isChain)
2815
                //    {
2816
                //        if (instance.isTransOn)
2817
                //        {
2818
                //            instance.isTransOn = false;
2819
                //        }
2820
                //        else
2821
                //        {
2822
                //            instance.isTransOn = true;
2823
                //        }
2824

    
2825
                //        instance.SetCloud();
2826
                //        BorderUpdate();
2827
                //    }
2828
                //}
2829
                //else if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "LineControl")
2830
                //{
2831
                //    LineControl instance = ((MemberSet.First() as AdornerMember).DrawingData as LineControl);
2832
                //    if (instance.LineStyle == LineControl.LineStyleSet.MultiLine)
2833
                //    {
2834
                //        instance.Interval += 1;
2835
                //        instance.SetLinePath();
2836
                //        BorderUpdate();
2837
                //    }
2838

    
2839
                //    //instance.SetCloud();
2840
                //    //BorderUpdate();
2841
                //}
2842

    
2843
            }
2844
            //if (e.ClickCount == 2 && AllControl.GetType().Name == "TextControl") // Edit Mode
2845
            //{
2846
            //    ((TextControl)AllControl).Base_TextBox.Focus();
2847
            //    ((TextControl)AllControl).Base_TextBox.Visibility = Visibility.Visible;
2848
            //    ((TextControl)AllControl).Base_TextBlock.Visibility = Visibility.Collapsed;
2849
            //}
2850
            //if (e.ClickCount == 2 && AllControl.GetType().Name == "ArrowTextControl") // Edit Mode
2851
            //{
2852
            //    Thumb tm = (from kkk in this.ContainerContent.Children
2853
            //                where (kkk as FrameworkElement).Name == "LastThumb"
2854
            //                select kkk).FirstOrDefault() as Thumb;
2855
            //    ((ArrowTextControl)AllControl).Base_TextBox.Focus();
2856
            //    ((ArrowTextControl)AllControl).Base_TextBox.SizeChanged += (sen, ea) =>
2857
            //    {
2858
            //        tm.Width = (AllControl as ArrowTextControl).BoxWidth;
2859
            //        tm.Height = (AllControl as ArrowTextControl).BoxHeight;
2860
            //        Canvas.SetLeft(tm, (AllControl.EndPoint.X - tm.Width / 2));
2861
            //        Canvas.SetTop(tm, (AllControl.EndPoint.Y - tm.Height / 2));
2862
            //        Canvas.SetLeft((AllControl as ArrowTextControl).Base_TextBox, (AllControl.EndPoint.X - tm.Width / 2));
2863
            //        Canvas.SetTop((AllControl as ArrowTextControl).Base_TextBox, (AllControl.EndPoint.Y - tm.Height / 2));
2864
            //    };
2865
            //}
2866
        }
2867
        #endregion
2868

    
2869
        private void DragThumb_MouseDoubleClick(object sender, MouseButtonEventArgs e)
2870
        {
2871
            if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "TextControl" || (MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "ArrowTextControl")
2872
            {
2873
                DragThumb.Visibility = Visibility.Collapsed;
2874
            }   
2875
        }
2876

    
2877
        //private void testText_Loaded(object sender, RoutedEventArgs e)
2878
        //{
2879
        //    editTextBox = sender as TextBox;
2880
        //}
2881
    }
2882
}
클립보드 이미지 추가 (최대 크기: 500 MB)