프로젝트

일반

사용자정보

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

markus / KCOM / Controls / AdornerFinal.xaml.cs @ 05009a0e

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

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