프로젝트

일반

사용자정보

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

markus / KCOM / Views / MainMenu.xaml.cs @ 7cee8c20

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

1

2
using MarkupToPDF.Controls.Common;
3
using MarkupToPDF.Controls.Line;
4
using MarkupToPDF.Controls.Polygon;
5
using MarkupToPDF.Controls.Shape;
6
using MarkupToPDF.Controls.Text;
7
using MarkupToPDF.Controls.Etc;
8
using System;
9
using System.Collections.Generic;
10
using System.Linq;
11
using System.Text;
12
using System.Windows;
13
using System.Windows.Controls;
14
using System.Windows.Data;
15
using System.Windows.Documents;
16
using System.Windows.Input;
17
using System.Windows.Media;
18
using System.Windows.Media.Imaging;
19
using System.Windows.Navigation;
20
using System.Windows.Shapes;
21
using KCOM.Common;
22
using IKCOM;
23
using System.Windows.Ink;
24
using System.Collections.ObjectModel;
25
using Telerik.Windows.Controls;
26
using KCOM.Events;
27
using System.Reflection;
28
using MarkupToPDF.Common;
29
using KCOM.Controls;
30
using KCOMDataModel.DataModel;
31
using System.Xml;
32

    
33
namespace KCOM.Views
34
{
35
    public static class ControlExtensions
36
    {
37
        public static T Clone<T>(this T controlToClone)
38
            where T : System.Windows.Controls.Control
39
        {
40
            System.Reflection.PropertyInfo[] controlProperties = typeof(T).GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance);
41

    
42
            T instance = Activator.CreateInstance<T>();
43

    
44
            foreach (PropertyInfo propInfo in controlProperties)
45
            {
46
                if (propInfo.CanWrite)
47
                {
48
                    if (propInfo.Name != "WindowTarget")
49
                        propInfo.SetValue(instance, propInfo.GetValue(controlToClone, null), null);
50
                }
51
            }
52
            return instance;
53
        }
54
    }
55

    
56
    public class MyConsole
57
    {
58
        private readonly System.Threading.ManualResetEvent _readLineSignal;
59
        private string _lastLine;
60
        public MyConsole()
61
        {
62
            _readLineSignal = new System.Threading.ManualResetEvent(false);
63
            Gui = new TextBox();
64
            Gui.AcceptsReturn = true;
65
            Gui.KeyUp += OnKeyUp;
66
        }
67

    
68
        private void OnKeyUp(object sender, KeyEventArgs e)
69
        {
70
            // this is always fired on UI thread
71
            if (e.Key == Key.Enter)
72
            {
73
                // quick and dirty, but that is not relevant to your question
74
                _lastLine = Gui.Text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries).Last();
75
                // now, when you detected that user typed a line, set signal
76
                _readLineSignal.Set();
77
            }
78
        }
79

    
80
        public TextBox Gui { get; private set; }
81

    
82
        public string ReadLine()
83
        {
84
            // that should always be called from non-ui thread
85
            if (Gui.Dispatcher.CheckAccess())
86
                throw new Exception("Cannot be called on UI thread");
87
            // reset signal
88
            _readLineSignal.Reset();
89
            // wait until signal is set. This call is blocking, but since we are on non-ui thread - there is no problem with that
90
            _readLineSignal.WaitOne();
91
            // we got signalled - return line user typed.
92
            return _lastLine;
93
        }
94

    
95
        public void WriteLine(string line)
96
        {
97
            if (!Gui.Dispatcher.CheckAccess())
98
            {
99
                Gui.Dispatcher.Invoke(new Action(() => WriteLine(line)));
100
                return;
101
            }
102

    
103
            Gui.Text += line + Environment.NewLine;
104
        }
105
    }
106

    
107
    /// <summary>
108
    /// MainMenu.xaml에 대한 상호 작용 논리
109
    /// </summary>
110
    public partial class MainMenu : UserControl
111
    {
112
        #region 프로퍼티
113
        public Undo_data UndoData { get; set; }
114
        public CommentUserInfo currentControl { get; set; }
115
        public ControlType controlType { get; set; }
116
        private Move move;
117
        private double[] rotateValue = { 0, 90, 180, 270 };
118
        public MouseHandlingMode mouseHandlingMode = MouseHandlingMode.None;
119
        public MouseButton mouseButtonDown { get; set; }
120
        private static readonly double DragThreshold = 5;
121
        private System.Windows.Input.Cursor cursor { get; set; }
122
        private Point canvasDrawingMouseDownPoint;
123
        public string filename { get; set; }
124
        private Point canvasZoomPanningMouseDownPoint;
125
        public Point getCurrentPoint;
126
        private Point canvasZoommovingMouseDownPoint;
127
        List<object> ControlList = new List<object>();
128
        private ListBox listBox = new ListBox();
129
        private Dictionary<Geometry, string> selected_item = new Dictionary<Geometry, string>();
130
        private bool isDraggingSelectionRect = false;
131
        DrawingAttributes inkDA = new DrawingAttributes();
132
        private VPRevision CurrentRev { get; set; }
133
        public RadRibbonButton btnConsolidate { get; set; }
134
        public RadRibbonButton btnFinalPDF { get; set; }
135
        public RadRibbonButton btnTeamConsolidate { get; set; }
136
        public string Filename_ { get; set; }
137
        public double L_Size = 0;
138
        public AdornerFinal adorner_;
139
        public Multi_Undo_data multi_Undo_Data;
140
        public string Symbol_ID = "";
141
        /// <summary>
142
        /// Set to 'true' when the left mouse-button is down.
143
        /// </summary>
144
        public bool isLeftMouseButtonDownOnWindow = false;
145

    
146
        public InkPresenter _InkBoard = null;
147
        Stroke stroke;
148
        Boolean IsDrawing = false;
149
        StylusPointCollection strokePoints;
150
        StylusPointCollection erasePoints;
151
        RenderTargetBitmap canvasImage;
152
        Point Sync_Offset_Point;
153

    
154
        //강인구 테스트
155
        private Path _SelectionPath { get; set; }
156
        public Path SelectionPath
157
        {
158
            get
159
            {
160
                return _SelectionPath;
161
            }
162
            set
163
            {
164
                if (_SelectionPath != value)
165
                {
166
                    _SelectionPath = value;
167
                    RaisePropertyChanged("SelectionPath");
168

    
169
                }
170
            }
171
        }
172

    
173
        private System.Windows.Controls.Image _imageViewer { get; set; }
174
        public System.Windows.Controls.Image imageViewer
175
        {
176
            get
177
            {
178
                if (_imageViewer == null)
179
                {
180
                    _imageViewer = new System.Windows.Controls.Image();
181
                    return _imageViewer;
182
                }
183
                else
184
                {
185
                    return _imageViewer;
186
                }
187
            }
188
            set
189
            {
190
                if (_imageViewer != value)
191
                {
192
                    _imageViewer = value;
193
                }
194
            }
195
        }
196

    
197
        public bool IsSyncPDFMode { get; set; }
198

    
199
        private System.Windows.Controls.Image _imageViewer_Compare { get; set; }
200
        public System.Windows.Controls.Image imageViewer_Compare
201
        {
202
            get
203
            {
204
                if (_imageViewer_Compare == null)
205
                {
206
                    _imageViewer_Compare = new System.Windows.Controls.Image();
207
                    return _imageViewer_Compare;
208
                }
209
                else
210
                {
211
                    return _imageViewer_Compare;
212
                }
213
            }
214
            set
215
            {
216
                if (_imageViewer_Compare != value)
217
                {
218
                    _imageViewer_Compare = value;
219
                }
220
            }
221
        }
222

    
223
        #endregion
224

    
225

    
226
        public MainMenu()
227
        {
228
            InitializeComponent();
229
            this.Loaded += MainMenu_Loaded;
230
        }
231
        private void SetCursor()
232
        {
233
            this.Cursor = cursor;
234
        }
235

    
236
        private bool IsDrawingEnable(Point _canvasZoomPanningMouseDownPoint)
237
        {
238
            if ((_canvasZoomPanningMouseDownPoint.X > 0 &&
239
                zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.X) &&
240
                (_canvasZoomPanningMouseDownPoint.Y > 0 &&
241
                zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.Y))
242
            {
243
                return true;
244
            }
245

    
246
            return false;
247
        }
248

    
249
        private bool IsRotationDrawingEnable(Point _canvasZoomPanningMouseDownPoint)
250
        {
251
            if (rotate.Angle == 90 || rotate.Angle == 270)
252
            {
253
                if ((_canvasZoomPanningMouseDownPoint.X > 0 &&
254
                zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.X) &&
255
                (_canvasZoomPanningMouseDownPoint.Y > 0 &&
256
                zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.Y))
257
                {
258
                    return true;
259
                }
260
            }
261
            else
262
            {
263
                if ((_canvasZoomPanningMouseDownPoint.X > 0 &&
264
                zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.X) &&
265
                (_canvasZoomPanningMouseDownPoint.Y > 0 &&
266
                zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.Y))
267
                {
268
                    return true;
269
                }
270
            }               
271

    
272
            return false;
273
        }
274

    
275
       
276
        public void DeleteItem(MarkupInfoItem item)
277
        {
278
            if (PreviewUserMarkupInfoItem != null && item.Consolidate == 1 && item.AvoidConsolidate == 0)
279
            {
280
                App.Custom_ViewInfoId = PreviewUserMarkupInfoItem.MarkupInfoID;
281
            }
282

    
283
            ViewerDataModel.Instance._markupInfoList.Remove(item);
284

    
285
            ViewerDataModel.Instance.MarkupControls.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a =>
286
            {
287
                ViewerDataModel.Instance.MarkupControls.Remove(a);
288
            });
289

    
290
            ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a =>
291
            {
292
                ViewerDataModel.Instance.MarkupControls_USER.Remove(a);
293
            });
294

    
295
            ViewerDataModel.Instance.MarkupList_USER.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a =>
296
            {
297
                ComingNewBieEnd = false;
298
                ViewerDataModel.Instance.MarkupList_USER.Remove(a);
299
            });
300

    
301
            gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
302
            if (PreviewUserMarkupInfoItem == null && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null)
303
            {
304
                if (gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList().Where(d => d.UserID == App.ViewInfo.UserID).Count() == 0)
305
                {
306
                    var infoId = Events.Save.shortGuid();
307
                    PreviewUserMarkupInfoItem = new MarkupInfoItem
308
                    {
309
                        CreateTime = DateTime.Now,
310
                        Depatment = userData.DEPARTMENT,
311
                        UpdateTime = DateTime.Now,
312
                        DisplayColor = "#FFFF0000",
313
                        UserID = userData.ID,
314
                        UserName = userData.NAME,
315
                        PageCount = 1,
316
                        Description = "",
317
                        MarkupInfoID = infoId,
318
                        MarkupList = null,
319
                        MarkupVersionID = Events.Save.shortGuid(),
320
                        Consolidate = 0,
321
                        PartConsolidate = 0,
322
                        userDelete = true,
323
                        AvoidConsolidate = 0,
324
                        IsPreviewUser = true
325
                    };
326
                    App.Custom_ViewInfoId = infoId;
327
                }
328
            }
329
            BaseClient.DeleteMarkupAsync(App.ViewInfo.ProjectNO, item.MarkupInfoID);
330
        }
331

    
332
        public void DeleteCommentEvent(object sender, RoutedEventArgs e)
333
        {
334
            //선택된 어도너가 있을시 삭제가 되지 않음(강인구 추가)
335
            this.ReleaseAdorner();
336

    
337
            Button content = (sender as Button);
338
            MarkupInfoItem item = content.CommandParameter as MarkupInfoItem;
339

    
340
            DeleteItem(item);
341
        }
342

    
343
        System.Windows.Media.Animation.DoubleAnimation da = new System.Windows.Media.Animation.DoubleAnimation();
344

    
345
        private void MainMenu_Loaded(object sender, RoutedEventArgs e)
346
        {
347
            if (App.ParameterMode)
348
            {          
349
                if (System.IO.File.Exists(AppDomain.CurrentDomain.BaseDirectory + "ControlLog.xml")) //임시파일이 있는가?
350
                {
351
                    //this.pageNavigator.PageChanging += pageNavigator_PageChanging;
352
                    this.pageNavigator.PageChanging += TempLoad;
353
                    
354
                }
355
                else
356
                {
357
                    this.pageNavigator.PageChanging += pageNavigator_PageChanging;
358
                    imageViewer_Compare = new Image();
359

    
360
                    layerControl.ProjectNo = App.ViewInfo.ProjectNO;
361
                    ViewerDataModel.Instance.Capture_Opacity = 0;
362

    
363
                    da.From = 0.8;
364
                    da.To = 0;
365
                    da.Duration = new Duration(TimeSpan.FromSeconds(1));
366
                    da.AutoReverse = true;
367
                    da.RepeatBehavior = System.Windows.Media.Animation.RepeatBehavior.Forever;
368
                }
369
            }
370
        }
371

    
372
        //private void pageNavigator_PageChanging(object sender, Controls.Sample.PageChangeEventArgs e)
373
        private void TempLoad(object sender, Controls.Sample.PageChangeEventArgs e)
374
        {
375
            MarkupToPDF.Controls.Parsing.LayerControl layerControl = new MarkupToPDF.Controls.Parsing.LayerControl();
376
            XmlDocument xdoc = new XmlDocument();
377
            xdoc.Load(AppDomain.CurrentDomain.BaseDirectory + "ControlLog.xml"); // XML 데이타를 파일에서 로드                
378
            XmlNodeList nodes = xdoc.SelectNodes("/Root/CommentID"); // 특정 노드들을 필터링
379

    
380
            int PageNumber = 0;
381

    
382
            foreach (XmlNode node in nodes) //파일안에 데이터가 있는가?
383
            {
384
                string sCommentID = node.Attributes["Value"].Value;
385
                string ConvertData = node.SelectSingleNode("ConvertData").InnerText;
386
                string DATA_TYPE = node.SelectSingleNode("DATA_TYPE").InnerText;
387
                PageNumber = Convert.ToInt32(node.SelectSingleNode("PageNumber").InnerText);
388
                string MarkupInfoID = node.SelectSingleNode("MarkupInfoID").InnerText;
389

    
390
                layerControl.markupParseEx(ConvertData, Common.ViewerDataModel.Instance.MarkupControls_USER, "#FFFF0000", "", MarkupInfoID, sCommentID);                
391
            }
392

    
393

    
394
            //  ViewerDataModel.Instance.PageBalanceNumber = PageNumber;
395
            ViewerDataModel.Instance.PageNumber = ViewerDataModel.Instance.PageBalanceNumber = PageNumber;
396
          //  BalancePoint = 
397
            // BalancePoint = 2
398
            var BalancePoint = pageNavigator.PageCount;
399

    
400
            /*
401
            if (BalancePoint < 1)
402
            {
403
                BalancePoint = 1;
404
                ViewerDataModel.Instance.PageBalanceNumber = 0;
405
            }
406

    
407
            if (pageNavigator.PageCount < BalancePoint)
408
            {
409
                BalancePoint = pageNavigator.PageCount;
410
                ViewerDataModel.Instance.PageBalanceNumber = 0;
411
            }
412
            */
413

    
414
            string uri = "";
415
            if (userData.COMPANY != "EXT")
416
            {
417
                uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToInt32(_ViewInfo.DocumentItemID) / 100).ToString(), _ViewInfo.DocumentItemID, PageNumber);
418
            }
419
            else
420
            {
421
                uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, PageNumber);
422
            }
423

    
424
            var defaultBitmapImage = new BitmapImage(new Uri(uri));
425

    
426
            ViewerDataModel.Instance.ImageViewPath = defaultBitmapImage;
427
            ViewerDataModel.Instance.ImageViewWidth = defaultBitmapImage.PixelWidth;
428
            ViewerDataModel.Instance.ImageViewHeight = defaultBitmapImage.PixelHeight;
429

    
430
            if (defaultBitmapImage.IsDownloading)
431
            {
432
                defaultBitmapImage.DownloadCompleted += (ex, arg) =>
433
                {
434
                    ViewerDataModel.Instance.ImageViewPath = defaultBitmapImage;
435
                    ViewerDataModel.Instance.ImageViewWidth = defaultBitmapImage.PixelWidth;
436
                    ViewerDataModel.Instance.ImageViewHeight = defaultBitmapImage.PixelHeight;
437
                };
438
            }
439

    
440
            zoomAndPanCanvas.Width = Convert.ToDouble(e.CurrentPage.PAGE_WIDTH);
441
            zoomAndPanCanvas.Height = Convert.ToDouble(e.CurrentPage.PAGE_HEIGHT);
442

    
443

    
444
            Common.ViewerDataModel.Instance.ContentWidth = zoomAndPanCanvas.Width;
445
            Common.ViewerDataModel.Instance.ContentHeight = zoomAndPanCanvas.Height;
446
            inkBoard.Width = zoomAndPanCanvas.Width;
447
            inkBoard.Height = zoomAndPanCanvas.Height;
448

    
449

    
450
            if (!testPanel2.IsHidden)
451
            {
452
                //PDF모드일때 잠시 대기(강인구)
453
                if (IsSyncPDFMode)
454
                {
455
                    Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
456
                    var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber)));
457

    
458
                    if (pdfpath.IsDownloading)
459
                    {
460
                        pdfpath.DownloadCompleted += (ex, arg) =>
461
                        {
462
                            ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
463
                            ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
464
                            ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
465
                            zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
466
                            zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
467
                        };
468
                    }
469
                    else
470
                    {
471
                        ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
472
                        ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
473
                        ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
474

    
475
                        zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
476
                        zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
477
                    }
478
                }
479
                else
480
                {
481
                    string uri2 = "";
482
                    if (userData.COMPANY != "EXT")
483
                    {
484
                        uri2 = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, BalancePoint);
485
                    }
486
                    else
487
                    {
488
                        uri2 = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, BalancePoint);
489
                    }
490

    
491

    
492
                    var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri2));
493

    
494
                    ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
495
                    ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
496
                    ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
497
                    zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
498
                    zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
499

    
500
                    zoomAndPanControl.ZoomTo(new Rect
501
                    {
502
                        X = 0,
503
                        Y = 0,
504
                        Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width),
505
                        Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height),
506
                    });
507

    
508
                    if (defaultBitmapImage_Compare.IsDownloading)
509
                    {
510
                        defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
511
                        {
512

    
513
                            ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
514
                            ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
515
                            ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
516

    
517
                            zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
518
                            zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
519

    
520
                            zoomAndPanControl.ZoomTo(new Rect
521
                            {
522
                                X = 0,
523
                                Y = 0,
524
                                Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width),
525
                                Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height),
526
                            });
527
                        };
528
                    }
529
                }
530
                tlSyncPageNum.Text = String.Format("Current Page : {0}", BalancePoint);
531
            }
532

    
533
            this.pageNavigator.SetNextPage();
534

    
535

    
536

    
537
        }
538

    
539

    
540
        public void ReleaseAdorner()
541
        {
542
            if (SelectLayer.Children.Count > 0)
543
            {
544
                foreach (var item in SelectLayer.Children)
545
                {
546
                    if (item.GetType().Name == "AdornerFinal")
547
                    {
548
                        (item as AdornerFinal).unRegister();
549

    
550
                        foreach (var InnerItem in (item as AdornerFinal).MemberSet.Cast<AdornerMember>())
551
                        {
552
                            if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData))
553
                            {
554
                                if (InnerItem.DrawingData.GetType().Name == "PolygonControl")
555
                                {
556
                                    if ((InnerItem.DrawingData as PolygonControl).CommentID == null)
557
                                    {
558
                                        (InnerItem.DrawingData as PolygonControl).CommentID = KCOM.Events.Save.shortGuid();
559
                                    }
560
                                }
561

    
562
                                ViewerDataModel.Instance.MarkupControls_USER.Add(InnerItem.DrawingData as CommentUserInfo);
563
                            }
564
                        }
565
                    }
566
                }
567
                SelectLayer.Children.Clear();
568
            }
569
        }
570

    
571
        public List<CommentUserInfo> AddAdorner()
572
        {
573
            List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
574

    
575
            if (SelectLayer.Children.Count > 0)
576
            {
577
                foreach (var item in SelectLayer.Children)
578
                {
579
                    if (item.GetType().Name == "AdornerFinal")
580
                    {
581
                        (item as AdornerFinal).unRegister();
582

    
583
                        foreach (var InnerItem in (item as AdornerFinal).MemberSet.Cast<AdornerMember>())
584
                        {
585
                            if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData))
586
                            {
587
                                adornerSet.Add(InnerItem.DrawingData as CommentUserInfo);
588
                            }
589

    
590
                            Control_Style(InnerItem.DrawingData as CommentUserInfo);
591

    
592
                            UndoData.Markup_List.Add(multi_Undo_Data);
593
                            multi_Undo_Data = new Multi_Undo_data();
594
                        }
595
                    }
596
                }
597
                SelectLayer.Children.Clear();
598
            }
599
            return adornerSet;
600
        }
601

    
602
        public void ChangeCommentReact()
603
        {
604
            bool isComingNewBie = false;
605

    
606
            if (ViewerDataModel.Instance.MarkupControls_USER.Count > 0)
607
            {
608
                foreach (var control in ViewerDataModel.Instance.MarkupControls_USER)
609
                {
610
                    var root = layerControl.MarkupToString(control, App.ViewInfo.UserID);
611

    
612
                   
613
                        var existItem = ViewerDataModel.Instance.MarkupList_USER.Where(data => data.ID == root.CommentID).FirstOrDefault();
614
                        if (existItem != null) //신규 추가 된 코멘트
615
                        {
616
                            if (existItem.Data != root.ConvertData) //코멘트가 같은지
617
                            {
618
                                existItem.Data = root.ConvertData;
619
                                existItem.IsUpdate = true;
620
                            }
621
                        }
622
                        else
623
                        {
624
                            if (root.CommentID != null)
625
                            {
626
                                isComingNewBie = true;
627
                                var currentCommentCheck = ViewerDataModel.Instance.MarkupList_USER.Where(dt => dt.ID == control.CommentID).FirstOrDefault();
628
                                if (currentCommentCheck != null)
629
                                {
630
                                    currentCommentCheck.Data = root.ConvertData;
631
                                }
632
                                else
633
                                {
634
                                    ViewerDataModel.Instance.MarkupList_USER.Add(new MarkupItemEx
635
                                    {
636
                                        ID = control.CommentID,
637
                                        Data = root.ConvertData,
638
                                        Data_Type = root.DATA_TYPE,
639
                                        MarkupInfoID = App.Custom_ViewInfoId,
640
                                        PageNumber = this.pageNavigator.CurrentPage.PageNumber,
641
                                    });
642
                                }
643
                            }
644
                        }
645
                    
646

    
647
                    
648
                }
649
            }
650

    
651
            if (PreviewUserMarkupInfoItem != null && isComingNewBie && !ComingNewBieEnd)
652
            {
653
                if (ViewerDataModel.Instance._markupInfoList.Where(info => info.UserID == PreviewUserMarkupInfoItem.UserID).FirstOrDefault() == null)
654
                {
655
                    ComingNewBieEnd = true;
656
                    ViewerDataModel.Instance._markupInfoList.Insert(0, PreviewUserMarkupInfoItem);
657
                    PreviewUserMarkupInfoItem.IsPreviewUser = false;
658
                    gridViewMarkup.ItemsSource = null;
659
                    gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
660
                    gridViewMarkup.SelectedItem = PreviewUserMarkupInfoItem;
661
                }
662
            }
663

    
664
        }
665

    
666
        MarkupToPDF.Controls.Parsing.LayerControl layerControl = new MarkupToPDF.Controls.Parsing.LayerControl();
667
        bool ComingNewBieEnd = false;
668

    
669
        private void pageNavigator_PageChanging(object sender, Controls.Sample.PageChangeEventArgs e)
670
        {            
671
            if (ViewerDataModel.Instance.UndoDataList.Count > 0)
672
            {   
673
                this.ParentOfType<MainWindow>().dzTopMenu.SaveEvent(null, null);
674
            }
675

    
676
            ViewerDataModel.Instance.UndoDataList.Clear();
677

    
678
            InkControl_Convert();
679

    
680
            ReleaseAdorner();
681
            ChangeCommentReact();
682
            CompareMode.IsChecked = false;
683
            var BalancePoint = ViewerDataModel.Instance.PageBalanceMode == true ? e.PageNumber + ViewerDataModel.Instance.PageBalanceNumber : e.PageNumber;
684

    
685

    
686
            #region 페이지가 벗어난 경우
687

    
688
            if (BalancePoint < 1)
689
            {
690
                BalancePoint = 1;
691
                ViewerDataModel.Instance.PageBalanceNumber = 0;
692
            }
693

    
694
            if (pageNavigator.PageCount < BalancePoint)
695
            {
696
                BalancePoint = pageNavigator.PageCount;
697
                ViewerDataModel.Instance.PageBalanceNumber = 0;
698
            }
699

    
700
            #endregion
701

    
702
            ViewerDataModel.Instance.PageNumber = BalancePoint;
703

    
704
            string uri = "";
705
            if (userData.COMPANY != "EXT")
706
            {
707
                uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToInt32(_ViewInfo.DocumentItemID) / 100).ToString(), _ViewInfo.DocumentItemID, e.PageNumber);
708
            }
709
            else
710
            {
711
                uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, e.PageNumber);
712
            }
713

    
714
            var defaultBitmapImage = new BitmapImage(new Uri(uri));
715

    
716
            ViewerDataModel.Instance.ImageViewPath = defaultBitmapImage;
717
            ViewerDataModel.Instance.ImageViewWidth = defaultBitmapImage.PixelWidth;
718
            ViewerDataModel.Instance.ImageViewHeight = defaultBitmapImage.PixelHeight;
719

    
720
            if (defaultBitmapImage.IsDownloading)
721
            {
722
                defaultBitmapImage.DownloadCompleted += (ex, arg) =>
723
                {
724
                    ViewerDataModel.Instance.ImageViewPath = defaultBitmapImage;
725
                    ViewerDataModel.Instance.ImageViewWidth = defaultBitmapImage.PixelWidth;
726
                    ViewerDataModel.Instance.ImageViewHeight = defaultBitmapImage.PixelHeight;
727
                };
728
            }
729

    
730
            zoomAndPanCanvas.Width = Convert.ToDouble(e.CurrentPage.PAGE_WIDTH);
731
            zoomAndPanCanvas.Height = Convert.ToDouble(e.CurrentPage.PAGE_HEIGHT);
732

    
733

    
734
            Common.ViewerDataModel.Instance.ContentWidth = zoomAndPanCanvas.Width;
735
            Common.ViewerDataModel.Instance.ContentHeight = zoomAndPanCanvas.Height;
736
            inkBoard.Width = zoomAndPanCanvas.Width;
737
            inkBoard.Height = zoomAndPanCanvas.Height;
738

    
739

    
740
            if (!testPanel2.IsHidden)
741
            {
742
                //PDF모드일때 잠시 대기(강인구)
743
                if (IsSyncPDFMode)
744
                {
745
                    Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
746
                    var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber)));
747

    
748
                    if (pdfpath.IsDownloading)
749
                    {
750
                        pdfpath.DownloadCompleted += (ex, arg) =>
751
                        {
752
                            ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
753
                            ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
754
                            ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
755
                            zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
756
                            zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
757
                        };
758
                    }
759
                    else
760
                    {
761
                        ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
762
                        ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
763
                        ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
764

    
765
                        zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
766
                        zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
767
                    }
768
                }
769
                else
770
                {
771
                    string uri2 = "";
772
                    if (userData.COMPANY != "EXT")
773
                    {
774
                        uri2 = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, BalancePoint);
775
                    }
776
                    else
777
                    {
778
                        uri2 = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, BalancePoint);
779
                    }
780

    
781

    
782
                    var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri2));
783

    
784
                    ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
785
                    ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
786
                    ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
787
                    zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
788
                    zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
789

    
790
                    zoomAndPanControl.ZoomTo(new Rect
791
                    {
792
                        X = 0,
793
                        Y = 0,
794
                        Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width),
795
                        Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height),
796
                    });
797

    
798
                    if (defaultBitmapImage_Compare.IsDownloading)
799
                    {
800
                        defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
801
                        {
802

    
803
                            ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
804
                            ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
805
                            ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
806

    
807
                            zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
808
                            zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
809

    
810
                            zoomAndPanControl.ZoomTo(new Rect
811
                            {
812
                                X = 0,
813
                                Y = 0,
814
                                Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width),
815
                                Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height),
816
                            });
817
                        };
818
                    }
819
                }
820
                tlSyncPageNum.Text = String.Format("Current Page : {0}", BalancePoint);
821
            }
822

    
823
            this.pageNavigator.SetNextPage();
824

    
825
            if (zoomAndPanCanvas2.Width.IsNaN())
826
            {
827
                zoomAndPanControl.ZoomTo(new Rect { X = 0, Y = 0, Width = zoomAndPanCanvas.Width, Height = zoomAndPanCanvas.Height });
828
            }
829

    
830
            Common.ViewerDataModel.Instance.MarkupControls_USER.Clear();  //전체 제거
831
            Common.ViewerDataModel.Instance.MarkupControls.Clear();  //전체 제거
832

    
833
            List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업
834
 
835
            foreach (var item in gridSelectionItem)
836
            {
837
                if (item.UserID == App.ViewInfo.UserID)
838
                {
839
                    ViewerDataModel.Instance.MarkupList_USER.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem)
840
                    {
841
                        layerControl.markupParseEx(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, item.DisplayColor, "", item.MarkupInfoID, markupitem.ID);
842
                    });
843
                }
844
                else
845
                {
846
                    ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem)
847
                    {
848
                        layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls, item.DisplayColor, "", item.MarkupInfoID);
849
                    });
850
                }
851
            }
852

    
853
            if (!testPanel2.IsHidden)
854
            {
855
                ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
856
                ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
857
                ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
858

    
859
                Common.ViewerDataModel.Instance.MarkupControls_Sync.Clear();
860
                List<MarkupInfoItem> gridSelectionRevItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList();
861

    
862

    
863
                foreach (var item in gridSelectionRevItem)
864
                {
865
                    item.MarkupList.Where(pageItem => pageItem.PageNumber == BalancePoint).ToList().ForEach(delegate (MarkupItem markupitem)
866
                    {
867
                        layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID);
868
                    });
869
                }
870

    
871
            }
872

    
873
            var instanceMain = this.ParentOfType<MainWindow>();
874
            instanceMain.dzTopMenu.tlcurrentPage.Text = e.CurrentPage.PAGE_NUMBER.ToString();
875
            instanceMain.dzTopMenu.tlcurrentPage_readonly.Text = e.CurrentPage.PAGE_NUMBER.ToString();
876

    
877
            //강인구 추가
878
            instanceMain.dzTopMenu.rotateOffSet = 0;
879
            var pageinfo = this.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == e.CurrentPage.PAGE_NUMBER).FirstOrDefault();
880
            drawingPannelRotate(pageinfo.PAGE_ANGLE);
881

    
882
            //}
883
            SetCommentPages(true);
884
        }
885

    
886
        private void SetCommentPages(bool onlyMe = false)
887
        {
888

    
889
            List<UsersCommentPagesMember> _pages = new List<UsersCommentPagesMember>();
890
            foreach (var item in ViewerDataModel.Instance._markupInfoList)
891
            {
892
                UsersCommentPagesMember instance = new UsersCommentPagesMember();
893
                instance.UserName = item.UserName;
894
                instance.Depart = item.Depatment;
895
                instance.MarkupInfoID = item.MarkupInfoID;
896
                instance.IsSelected = true;
897
                instance.isConSolidation = item.Consolidate;
898
                instance.SetColor = item.DisplayColor;
899
                if (item.UserID == App.ViewInfo.UserID && item.MarkupInfoID == item.MarkupInfoID)
900
                {
901
                    instance.PageNumber = ViewerDataModel.Instance.MarkupList_USER.Select(d => d.PageNumber).ToList();
902
                }
903
                else
904
                {
905
                    instance.PageNumber = ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.MarkupInfoID == item.MarkupInfoID).Select(d => d.PageNumber).ToList();
906
                }
907
                _pages.Add(instance);
908
            }
909
            this.pageNavigator.SetCommentList(_pages.ToList());
910
        }
911

    
912
        private void zoomAndPanControl_MouseWheel(object sender, MouseWheelEventArgs e)
913
        {
914
            if (e.MiddleButton == MouseButtonState.Pressed)
915
            {
916

    
917
            }
918
            e.Handled = true;
919
            if (e.Delta > 0)
920
            {
921
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas);
922
                ZoomIn(currentContentMousePoint);
923
            }
924
            else
925
            {
926
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas);
927
                ZoomOut(currentContentMousePoint);
928
            }
929
        }
930

    
931
        private void zoomAndPanControl2_MouseWheel(object sender, MouseWheelEventArgs e)
932
        {
933
            e.Handled = true;
934
            if (e.Delta > 0)
935
            {
936
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas2);
937
                ZoomIn_Sync(currentContentMousePoint);
938
            }
939
            else
940
            {
941
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas2);
942
                ZoomOut_Sync(currentContentMousePoint);
943
            }
944
        }
945

    
946
        #region ZoomIn & ZoomOut
947

    
948
        private void ZoomOut_Executed(object sender, ExecutedRoutedEventArgs e)
949
        {
950
            ZoomOut(new Point(zoomAndPanControl.ContentZoomFocusX,
951
                zoomAndPanControl.ContentZoomFocusY));
952
        }
953

    
954
        private void ZoomIn_Executed(object sender, ExecutedRoutedEventArgs e)
955
        {
956
            ZoomIn(new Point(zoomAndPanControl.ContentZoomFocusX,
957
                zoomAndPanControl.ContentZoomFocusY));
958
        }
959

    
960

    
961
        //강인구 추가 (줌 인아웃 수치 변경)
962
        //큰해상도의 문서일 경우 줌 인 아웃시 사이즈 변동이 큼
963
        private void ZoomOut(Point contentZoomCenter)
964
        {
965
            if (zoomAndPanControl.ContentScale > 0.39)
966
            {
967
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale - 0.2, contentZoomCenter);
968
            }
969
            else
970
            {
971
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale / 2, contentZoomCenter);
972
            }
973

    
974
            if (zoomAndPanControl2 != null && Sync.IsChecked)
975
            {
976
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl.ContentScale, contentZoomCenter);
977
            }
978
        }
979

    
980
        private void ZoomIn(Point contentZoomCenter)
981
        {
982
            if (zoomAndPanControl.ContentScale > 0.19)
983
            {
984
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale + 0.2, contentZoomCenter);
985
            }
986
            else
987
            {
988
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale * 2, contentZoomCenter);
989
            }
990

    
991
            if (zoomAndPanControl2 != null && Sync.IsChecked)
992
            {
993
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl.ContentScale, contentZoomCenter);
994
            }
995

    
996
        }
997

    
998
        private void ZoomOut_Sync(Point contentZoomCenter)
999
        {
1000
            if (zoomAndPanControl2.ContentScale > 0.39)
1001
            {
1002
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale - 0.2, contentZoomCenter);
1003
            }
1004
            else
1005
            {
1006
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale / 2, contentZoomCenter);
1007
            }
1008

    
1009
            if (Sync.IsChecked)
1010
            {
1011
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl2.ContentScale, contentZoomCenter);
1012
            }
1013
        }
1014

    
1015
        private void ZoomIn_Sync(Point contentZoomCenter)
1016
        {
1017
            if (zoomAndPanControl2.ContentScale > 0.19)
1018
            {
1019
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale + 0.2, contentZoomCenter);
1020
            }
1021
            else
1022
            {
1023
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale * 2, contentZoomCenter);
1024
            }
1025

    
1026
            if (Sync.IsChecked)
1027
            {
1028
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl2.ContentScale, contentZoomCenter);
1029
            }
1030
        }
1031

    
1032
        private void ZoomOut()
1033
        {
1034
            zoomAndPanControl.ContentScale -= 0.1;
1035
            //if (zoomAndPanControl2 != null)
1036
            //{
1037
            //    zoomAndPanControl2.ContentScale -= 0.1;
1038
            //}
1039
        }
1040

    
1041
        private void ZoomIn()
1042
        {
1043
            zoomAndPanControl.ContentScale += 0.1;
1044
            //if (zoomAndPanControl2 != null)
1045
            //{
1046
            //    zoomAndPanControl2.ContentScale += 0.1;
1047
            //}
1048
        }
1049

    
1050
        #endregion
1051

    
1052
        private void init()
1053
        {
1054
            foreach (var item in ViewerDataModel.Instance.MarkupControls)
1055
            {
1056

    
1057
                ControlList.Clear();
1058
                listBox.Items.Clear();
1059
                selected_item.Clear();
1060

    
1061
                (item as IMarkupCommonData).IsSelected = false;
1062
            }
1063

    
1064
        }
1065

    
1066
        private HitTestResultBehavior MyCallback(HitTestResult result)
1067
        {
1068
            //this.cursor = Cursors.UpArrow;
1069
            var element = result.VisualHit;
1070
            while (element != null && !(element is CommentUserInfo))
1071
                element = VisualTreeHelper.GetParent(element);
1072

    
1073
            if (element == null)
1074
            {
1075
                return HitTestResultBehavior.Stop;
1076
            }
1077
            else
1078
            {
1079
                if (element is CommentUserInfo)
1080
                {
1081
                    if (!hitList.Contains(element))
1082
                    {
1083
                        hitList.Add((CommentUserInfo)element);
1084
                    }
1085
                    else
1086
                    {
1087
                        return HitTestResultBehavior.Stop;
1088
                    }
1089
                    //IntersectionDetail intersectionDetail =
1090
                    //((GeometryHitTestResult)result).IntersectionDetail;
1091
                    //switch (intersectionDetail)
1092
                    //{
1093
                    //    case IntersectionDetail.FullyContains:
1094
                    //        // Add the hit test result to the list:
1095
                    //        hitList.Add((CommentUserInfo)result.VisualHit);
1096
                    //        return HitTestResultBehavior.Continue;
1097
                    //    case IntersectionDetail.Intersects:
1098
                    //        // Set the behavior to return visuals at all z-order levels:
1099
                    //        return HitTestResultBehavior.Continue;
1100
                    //    case IntersectionDetail.FullyInside:
1101
                    //        // Set the behavior to return visuals at all z-order levels:
1102
                    //        return HitTestResultBehavior.Continue;
1103
                    //    default:
1104
                    //        return HitTestResultBehavior.Stop;
1105
                    //}
1106
                }
1107
            }
1108
            return HitTestResultBehavior.Continue;
1109
        }
1110

    
1111
        public void ReleaseSelectPath()
1112
        {
1113
            if (SelectionPath == null)
1114
            {
1115
                SelectionPath = new Path();
1116
                SelectionPath.Name = "";
1117
            }
1118
            if (SelectionPath.Name != "")
1119
            {
1120
                SelectionPath.Name = "None";
1121
            }
1122
            SelectionPath.Opacity = 0.01;
1123
            SelectionPath.RenderTransform = null;
1124
            SelectionPath.RenderTransformOrigin = new Point(0, 0);
1125
        }
1126

    
1127
        #region 컨트롤 초기화 
1128
        public void Control_Init(object control)
1129
        {
1130
            if (L_Size != 0 && (control as IPath) != null)
1131
            {
1132
                (control as IPath).LineSize = L_Size;
1133
                L_Size = 0;
1134
            }
1135

    
1136
            switch (control.GetType().Name)
1137
            {
1138
                case "RectangleControl":
1139
                    {
1140
                        (control as RectangleControl).StrokeColor = Brushes.Red;
1141
                    }
1142
                    break;
1143
                case "CircleControl":
1144
                    {
1145
                        (control as CircleControl).StrokeColor = Brushes.Red;
1146
                    }
1147
                    break;
1148
                case "TriControl":
1149
                    {
1150
                        (control as TriControl).StrokeColor = Brushes.Red;
1151
                    }
1152
                    break;
1153
                case "RectCloudControl":
1154
                    {
1155
                        (control as RectCloudControl).StrokeColor = Brushes.Red;
1156
                    }
1157
                    break;
1158
                case "CloudControl":
1159
                    {
1160
                        (control as CloudControl).StrokeColor = Brushes.Red;
1161
                    }
1162
                    break;
1163
                case "PolygonControl":
1164
                    {
1165
                        (control as PolygonControl).StrokeColor = Brushes.Red;
1166
                    }
1167
                    break;
1168
                case "ArcControl":
1169
                    {
1170
                        (control as ArcControl).StrokeColor = Brushes.Red;
1171
                    }
1172
                    break;
1173
                case "LineControl":
1174
                    {
1175
                        (control as LineControl).StrokeColor = Brushes.Red;
1176
                    }
1177
                    break;
1178
                case "ArrowControl_Multi":
1179
                    {
1180
                        (control as ArrowControl_Multi).StrokeColor = Brushes.Red;
1181
                    }
1182
                    break;
1183
                case "TextControl":
1184
                    {
1185
                        (control as TextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1186
                    }
1187
                    break;
1188
                case "ArrowTextControl":
1189
                    {
1190
                        (control as ArrowTextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1191
                    }
1192
                    break;
1193
            }
1194
        }
1195
        #endregion
1196

    
1197
        public void firstCondition_MouseLeave(object sender, MouseEventArgs e)
1198
        {
1199
            //Control_Init(e.Source);
1200
        }
1201

    
1202
        private void zoomAndPanControl_MouseMove(object sender, MouseEventArgs e)
1203
        {
1204
            if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
1205
            {
1206
                if (!floatingTip.IsOpen) { floatingTip.IsOpen = true; }
1207

    
1208
                Point currentPos = e.GetPosition(rect);
1209
                
1210
                floatingTip.HorizontalOffset = currentPos.X + 20;
1211
                floatingTip.VerticalOffset = currentPos.Y;
1212

    
1213

    
1214
                //ToolTip tool = new System.Windows.Controls.ToolTip();
1215
                //tool.Content = "ToolTip";
1216
                //panel.ToolTip = tool;
1217
            }
1218

    
1219
            if (mouseHandlingMode != MouseHandlingMode.Drawing)
1220
            {
1221
                #region 마우스 오버 시 색상 변경
1222
                //var firstCondition = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
1223
                //Color TempColor = MarkupToPDF.Controls.Common.ValueConverter.StringToColorConverter.Parse("FF07B4FF");
1224

    
1225
                //if (firstCondition != null)
1226
                //{
1227
                //    firstCondition.MouseLeave += new System.Windows.Input.MouseEventHandler(firstCondition_MouseLeave);
1228

    
1229
                //    if (firstCondition.GetType().Name == "TextControl")
1230
                //    {
1231
                //        (firstCondition as TextControl).BackInnerColor = new SolidColorBrush(TempColor);
1232
                //        return;
1233
                //    }
1234
                //    else if (firstCondition.GetType().Name == "ArrowTextControl")
1235
                //    {
1236
                //        (firstCondition as ArrowTextControl).BackInnerColor = new SolidColorBrush(TempColor);
1237
                //        return;
1238
                //    }
1239

    
1240
                //    if (L_Size == 0)
1241
                //    {
1242
                //        L_Size = (firstCondition as IPath).LineSize;
1243
                //        (firstCondition as IPath).LineSize *= 4;
1244
                //    }
1245
                //    switch (firstCondition.GetType().Name)
1246
                //    {
1247
                //        case "RectangleControl":
1248
                //            {
1249
                //                (firstCondition as RectangleControl).StrokeColor = new SolidColorBrush(TempColor);
1250
                //            }
1251
                //            break;
1252
                //        case "CircleControl":
1253
                //            {
1254
                //                (firstCondition as CircleControl).StrokeColor = new SolidColorBrush(TempColor);
1255
                //            }
1256
                //            break;
1257
                //        case "TriControl":
1258
                //            {
1259
                //                (firstCondition as TriControl).StrokeColor = new SolidColorBrush(TempColor);
1260
                //            }
1261
                //            break;
1262
                //        case "RectCloudControl":
1263
                //            {
1264
                //                (firstCondition as RectCloudControl).StrokeColor = new SolidColorBrush(TempColor);
1265
                //            }
1266
                //            break;
1267
                //        case "CloudControl":
1268
                //            {
1269
                //                (firstCondition as CloudControl).StrokeColor = new SolidColorBrush(TempColor);
1270
                //            }
1271
                //            break;
1272
                //        case "PolygonControl":
1273
                //            {
1274
                //                (firstCondition as PolygonControl).StrokeColor = new SolidColorBrush(TempColor);
1275
                //            }
1276
                //            break;
1277
                //        case "ArcControl":
1278
                //            {
1279
                //                (firstCondition as ArcControl).StrokeColor = new SolidColorBrush(TempColor);
1280
                //            }
1281
                //            break;
1282
                //        case "LineControl":
1283
                //            {
1284
                //                (firstCondition as LineControl).StrokeColor = new SolidColorBrush(TempColor);
1285
                //            }
1286
                //            break;
1287
                //        case "ArrowControl_Multi":
1288
                //            {
1289
                //                (firstCondition as ArrowControl_Multi).StrokeColor = new SolidColorBrush(TempColor);
1290
                //            }
1291
                //            break;
1292

    
1293
                //        default:
1294
                //            {
1295

    
1296
                //            }
1297
                //            break;
1298
                //    }
1299
                //} 
1300
                #endregion
1301
            }
1302

    
1303
            getCurrentPoint = e.GetPosition(drawingRotateCanvas);
1304

    
1305
            //if (mouseButtonDown == MouseButton.Middle)
1306
            //{
1307
            //    SetCursor();
1308
            //    Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1309
            //    Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1310

    
1311
            //    Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
1312
            //    zoomAndPanControl.ContentOffsetX -= dragOffset.X;
1313
            //    zoomAndPanControl.ContentOffsetY -= dragOffset.Y;
1314

    
1315
            //    //SetCursor();
1316
            //    //Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1317
            //    //Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1318

    
1319
            //    //Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
1320

    
1321
            //    //zoomAndPanControl.ContentOffsetX += 1;
1322
            //    //zoomAndPanControl.ContentOffsetY += 1;
1323

    
1324
            //    //zoomAndPanControl.ContentOffsetX += dragOffset.X;
1325
            //    //zoomAndPanControl.ContentOffsetY += dragOffset.Y;
1326
            //}
1327
            if ((mouseButtonDown == MouseButton.Middle) || (mouseButtonDown == MouseButton.Right))
1328
            {
1329
                SetCursor();
1330
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1331
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1332

    
1333
                Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
1334
                zoomAndPanControl.ContentOffsetX -= dragOffset.X;
1335
                zoomAndPanControl.ContentOffsetY -= dragOffset.Y;
1336

    
1337
                if (Sync.IsChecked)
1338
                {
1339
                    ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
1340
                    ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
1341
                }
1342
            }
1343

    
1344

    
1345
            if (mouseHandlingMode == MouseHandlingMode.Drawing && mouseButtonDown == MouseButton.Left)
1346
            {
1347
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1348
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1349
                SetCursor();
1350

    
1351
                if (IsDrawing)
1352
                {
1353
                    if (currentControl == null)
1354
                    {
1355
                        switch (controlType)
1356
                        {
1357
                            case ControlType.PenControl:
1358
                                {
1359
                                    if (inkBoard.Tag.ToString() == "Ink")
1360
                                    {
1361
                                        stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y));
1362
                                    }
1363
                                    else if (inkBoard.Tag.ToString() == "EraseByPoint")
1364
                                    {
1365
                                        RemovePointStroke(currentCanvasDrawingMouseMovePoint);
1366
                                    }
1367
                                    else if (inkBoard.Tag.ToString() == "EraseByStroke")
1368
                                    {
1369
                                        RemoveLineStroke(currentCanvasDrawingMouseMovePoint);
1370
                                    }
1371

    
1372
                                    //inkBoard.Strokes.Add(stroke);
1373
                                }
1374
                                break;
1375
                        }
1376
                        return;
1377
                    }
1378
                }
1379

    
1380
                if (currentControl != null)
1381
                {
1382
                    double moveX = currentCanvasDrawingMouseMovePoint.X - canvasDrawingMouseDownPoint.X;
1383
                    double moveY = currentCanvasDrawingMouseMovePoint.Y - canvasDrawingMouseDownPoint.Y;
1384
                    //강인구 추가
1385
                    currentControl.Opacity = ViewerDataModel.Instance.ControlOpacity;
1386

    
1387
                    if ((currentControl as IPath) != null)
1388
                    {
1389
                        (currentControl as IPath).LineSize = ViewerDataModel.Instance.LineSize;
1390
                    }
1391
                    if ((currentControl as LineControl) != null)
1392
                    {
1393
                        (currentControl as LineControl).Interval = ViewerDataModel.Instance.Interval;
1394
                    }
1395

    
1396
                    if ((currentControl as IShapeControl) != null)
1397
                    {
1398
                        (currentControl as IShapeControl).Paint = ViewerDataModel.Instance.paintSet;
1399
                    }
1400
                    if ((currentControl as TextControl) != null)
1401
                    {
1402
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true)
1403
                        {
1404
                            (currentControl as TextControl).TextStyle = FontStyles.Italic;
1405
                        }
1406
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true)
1407
                        {
1408
                            (currentControl as TextControl).TextWeight = FontWeights.Bold;
1409
                        }
1410
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true)
1411
                        {
1412
                            (currentControl as TextControl).UnderLine = TextDecorations.Underline;
1413
                        }
1414
                    }
1415
                    else if ((currentControl as ArrowTextControl) != null)
1416
                    {
1417
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true)
1418
                        {
1419
                            (currentControl as ArrowTextControl).TextStyle = FontStyles.Italic;
1420
                        }
1421
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true)
1422
                        {
1423
                            (currentControl as ArrowTextControl).TextWeight = FontWeights.Bold;
1424
                        }
1425
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true)
1426
                        {
1427
                            (currentControl as ArrowTextControl).UnderLine = TextDecorations.Underline;
1428
                        }
1429
                    }
1430
                    else if ((currentControl as RectCloudControl) != null)
1431
                    {
1432
                        (currentControl as RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
1433
                    }
1434
                    else if ((currentControl as CloudControl) != null)
1435
                    {
1436
                        (currentControl as CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
1437
                    }
1438

    
1439
                    switch (controlType)
1440
                    {
1441
                        case ControlType.Rectangle:
1442
                            {
1443
                                var control = currentControl as RectangleControl;
1444

    
1445
                                if (control != null)
1446
                                {
1447
                                    if (move.mousemode == MouseMode.Drawing)
1448
                                    {
1449
                                        //move.control_Move(ControlList, true, moveX, moveY);
1450
                                    }
1451
                                    else
1452
                                    {
1453
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1454
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1455
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1456
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1457

    
1458

    
1459
                                        if (ViewerDataModel.Instance.IsPressShift)
1460
                                        {
1461
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1462
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1463
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1464
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1465
                                        }
1466

    
1467
                                        control.PointSet = new List<Point>
1468
                                        {
1469
                                            control.StartPoint,
1470
                                            control.LeftBottomPoint,
1471
                                            control.EndPoint,
1472
                                            control.TopRightPoint,
1473
                                        };
1474
                                        control.updateControl();
1475
                                    }
1476

    
1477
                                    //강인구 추가
1478
                                    control.ControlType = controlType;
1479
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1480
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1481
                                }
1482
                            }
1483
                            break;
1484

    
1485
                        case ControlType.RectCloud:
1486
                            {
1487
                                var control = currentControl as RectCloudControl;
1488

    
1489
                                if (control != null)
1490
                                {
1491
                                    if (move.mousemode == MouseMode.Drawing)
1492
                                    {
1493
                                        //move.control_Move(ControlList, true, moveX, moveY);
1494
                                    }
1495
                                    else
1496
                                    {
1497
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1498
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1499
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1500
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1501

    
1502
                                        if (ViewerDataModel.Instance.IsPressShift)
1503
                                        {
1504
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1505
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1506
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1507
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1508
                                        }
1509

    
1510
                                        control.PointSet = new List<Point>
1511
                                        {
1512
                                            control.StartPoint,
1513
                                            control.LeftBottomPoint,
1514
                                            control.EndPoint,
1515
                                            control.TopRightPoint,
1516
                                        };
1517
                                    }
1518
                                    //강인구 추가
1519
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1520
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1521
                                }
1522
                            }
1523
                            break;
1524

    
1525
                        case ControlType.SingleLine:
1526
                            {
1527
                                if (currentControl != null)
1528
                                {
1529
                                    var control = currentControl as LineControl;
1530
                                    control.LineStyleSet = LineStyleSet.SingleLine;
1531
                                    control.ControlType = controlType;
1532
                                    if (control != null)
1533
                                    {
1534
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1535
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1536
                                        Point tempPoint = control.EndPoint;
1537

    
1538
                                        if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1539
                                        {
1540
                                            //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1541
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1542
                                            control.EndPoint = tempPoint;
1543
                                        }
1544
                                        else
1545
                                        {
1546
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1547
                                        }
1548

    
1549
                                        control.PointSet = new List<Point>
1550
                                        {
1551
                                            control.StartPoint,
1552
                                            control.EndPoint,
1553
                                        };
1554
                                        //강인구 추가
1555
                                        control.DashSize = ViewerDataModel.Instance.DashSize;
1556
                                    }
1557
                                }
1558

    
1559
                            }
1560
                            break;
1561

    
1562
                        case ControlType.CancelLine:
1563
                            {
1564
                                if (currentControl != null)
1565
                                {
1566
                                    var control = currentControl as LineControl;
1567
                                    control.LineStyleSet = LineStyleSet.CancelLine;
1568
                                    //control.LineStyle = LineControl.LineStyleSet.MultiLine;
1569
                                    control.ControlType = controlType;
1570
                                    if (control != null)
1571
                                    {
1572
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1573
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1574
                                        Point tempPoint = control.EndPoint;
1575

    
1576
                                        if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1577
                                        {
1578
                                            //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1579
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1580
                                            control.EndPoint = tempPoint;
1581
                                        }
1582
                                        else
1583
                                        {
1584
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1585
                                        }
1586

    
1587

    
1588
                                        control.PointSet = new List<Point>
1589
                                            {
1590
                                                control.StartPoint,
1591
                                                control.EndPoint,
1592
                                            };
1593
                                    }
1594
                                    //강인구 추가
1595
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1596
                                }
1597
                            }
1598
                            break;
1599

    
1600
                        case ControlType.ArrowLine:
1601
                            {
1602
                                if (currentControl != null)
1603
                                {
1604
                                    var control = currentControl as LineControl;
1605
                                    control.LineStyleSet = LineStyleSet.ArrowLine;
1606
                                    control.ControlType = controlType;
1607
                                    if (control != null)
1608
                                    {
1609
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1610
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1611
                                        Point tempPoint = control.EndPoint;
1612

    
1613
                                        if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1614
                                        {
1615
                                            //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1616
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1617
                                            control.EndPoint = tempPoint;
1618
                                        }
1619
                                        else
1620
                                        {
1621
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1622
                                        }
1623

    
1624

    
1625
                                        control.PointSet = new List<Point>
1626
                                            {
1627
                                                control.StartPoint,
1628
                                                control.EndPoint,
1629
                                            };
1630
                                    }
1631
                                    //강인구 추가
1632
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1633
                                }
1634

    
1635
                            }
1636
                            break;
1637

    
1638
                        case ControlType.TwinLine:
1639
                            {
1640
                                if (currentControl != null)
1641
                                {
1642
                                    var control = currentControl as LineControl;
1643
                                    control.LineStyleSet = LineStyleSet.TwinLine;
1644
                                    control.ControlType = controlType;
1645
                                    if (control != null)
1646
                                    {
1647
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1648
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1649
                                        Point tempPoint = control.EndPoint;
1650

    
1651
                                        if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1652
                                        {
1653
                                            //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1654
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1655
                                            control.EndPoint = tempPoint;
1656
                                        }
1657
                                        else
1658
                                        {
1659
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1660
                                        }
1661

    
1662

    
1663
                                        control.PointSet = new List<Point>
1664
                                            {
1665
                                                control.StartPoint,
1666
                                                control.EndPoint,
1667
                                            };
1668
                                    }
1669
                                    //강인구 추가
1670
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1671
                                }
1672

    
1673
                            }
1674
                            break;
1675

    
1676
                        case ControlType.DimLine:
1677
                            {
1678
                                if (currentControl != null)
1679
                                {
1680
                                    var control = currentControl as LineControl;
1681
                                    control.LineStyleSet = LineStyleSet.DimLine;
1682
                                    control.ControlType = controlType;
1683
                                    if (control != null)
1684
                                    {
1685
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1686
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1687
                                        Point tempPoint = control.EndPoint;
1688

    
1689
                                        if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1690
                                        {
1691
                                            //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1692
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1693
                                            control.EndPoint = tempPoint;
1694
                                        }
1695
                                        else
1696
                                        {
1697
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1698
                                        }
1699

    
1700
                                        control.PointSet = new List<Point>
1701
                                            {
1702
                                                control.StartPoint,
1703
                                                control.EndPoint,
1704
                                            };
1705
                                    }
1706
                                    //강인구 추가
1707
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1708
                                }
1709

    
1710
                            }
1711
                            break;
1712

    
1713
                        case ControlType.ChainLine:
1714
                            {
1715
                                var control = currentControl as PolygonControl;
1716

    
1717
                                if (control != null)
1718
                                {
1719

    
1720
                                    control.PointSet.RemoveAt(control.PointSet.Count - 1);
1721
                                    control.PointSet.Add(currentCanvasDrawingMouseMovePoint);
1722

    
1723
                                    Point tempPoint = control.PointSet[control.PointSet.Count - 1];
1724

    
1725
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1726
                                    {
1727
                                        //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1728
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.PointSet[control.PointSet.Count - 2], ref tempPoint, true);
1729
                                        control.PointSet[control.PointSet.Count - 1] = tempPoint;
1730
                                        //control.EndPoint = tempPoint;
1731
                                    }
1732
                                    else
1733
                                    {
1734
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1735
                                    }
1736

    
1737
                                    control.SetPolyPath();
1738
                                    //movePoint.X = currentCanvasDrawingMouseMovePoint.X;
1739
                                    //movePoint.Y = currentCanvasDrawingMouseMovePoint.Y;
1740
                                    //control.PointC.pointSet.Add(new Point(currentCanvasDrawingMouseMovePoint.X,currentCanvasDrawingMouseMovePoint.Y));
1741

    
1742
                                    //강인구 추가
1743
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1744
                                }
1745
                            }
1746
                            break;
1747

    
1748
                        case ControlType.ArcLine:
1749
                            {
1750
                                if (currentControl != null)
1751
                                {
1752
                                    var control = currentControl as ArcControl;
1753
                                    control.isTransOn = false;
1754
                                    control.ControlType = controlType;
1755

    
1756
                                    if (control != null)
1757
                                    {
1758
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1759
                                        control.MidPoint = new Point(0, 0);
1760
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1761
                                        Point tempPoint = control.EndPoint;
1762

    
1763
                                        if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1764
                                        {
1765
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1766
                                            control.EndPoint = tempPoint;
1767
                                        }
1768
                                        else
1769
                                        {
1770
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1771
                                        }
1772

    
1773

    
1774
                                        control.PointSet = new List<Point>
1775
                                            {
1776
                                                control.StartPoint,
1777
                                                control.MidPoint,
1778
                                                control.EndPoint,
1779
                                            };
1780
                                    }
1781
                                    //강인구 추가
1782
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1783
                                }
1784

    
1785
                            }
1786
                            break;
1787

    
1788
                        case ControlType.ArcArrow:
1789
                            {
1790
                                if (currentControl != null)
1791
                                {
1792
                                    var control = currentControl as ArcControl;
1793
                                    control.isTransOn = true;
1794
                                    control.ControlType = controlType;
1795

    
1796
                                    if (control != null)
1797
                                    {
1798
                                        if (move.mousemode == MouseMode.Drawing)
1799
                                        {
1800
                                            //move.control_Move(ControlList, true, moveX, moveY);
1801
                                        }
1802
                                        else
1803
                                        {
1804
                                            control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1805
                                            control.MidPoint = new Point(0, 0);
1806
                                            control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1807
                                        }
1808

    
1809
                                        control.PointSet = new List<Point>
1810
                                            {
1811
                                                control.StartPoint,
1812
                                                control.MidPoint,
1813
                                                control.EndPoint,
1814
                                            };
1815
                                    }
1816
                                    //강인구 추가
1817
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1818
                                }
1819
                            }
1820
                            break;
1821

    
1822
                        case ControlType.ArrowMultiLine:
1823
                            {
1824
                                if (currentControl != null)
1825
                                {
1826
                                    var control = currentControl as ArrowControl_Multi;
1827

    
1828
                                    if (control != null)
1829
                                    {
1830
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1831
                                        Point tempPoint = control.EndPoint;
1832
                                        if (control.MiddlePoint == new Point(0, 0))
1833
                                        {
1834
                                            if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1835
                                            {
1836
                                                ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1837
                                                //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1838
                                                control.EndPoint = tempPoint;
1839
                                            }
1840
                                            else
1841
                                            {
1842
                                                ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1843
                                            }
1844
                                        }
1845
                                        else
1846
                                        {
1847
                                            if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1848
                                            {
1849
                                                //var AngleValue = MathSet.returnAngleString(control.MiddlePoint, ref tempPoint, true);
1850
                                                ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.MiddlePoint, ref tempPoint, true);
1851
                                                control.EndPoint = tempPoint;
1852
                                            }
1853
                                            else
1854
                                            {
1855
                                                ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.MiddlePoint, ref tempPoint, false);
1856
                                            }
1857

    
1858
                                        }
1859

    
1860
                                        control.PointSet = new List<Point>
1861
                                            {
1862
                                                control.StartPoint,
1863
                                                control.MiddlePoint,
1864
                                                control.EndPoint,
1865
                                            };
1866

    
1867
                                    }
1868
                                    //강인구 추가
1869
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1870
                                }
1871

    
1872
                            }
1873
                            break;
1874

    
1875
                        case ControlType.Circle:
1876
                            {
1877
                                var control = currentControl as CircleControl;
1878

    
1879
                                if (control != null)
1880
                                {
1881
                                    if (move.mousemode == MouseMode.Drawing)
1882
                                    {
1883
                                        //move.control_Move(ControlList, true, moveX, moveY);
1884
                                    }
1885
                                    else
1886
                                    {
1887
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1888
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1889
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1890
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1891

    
1892
                                        if (ViewerDataModel.Instance.IsPressShift)
1893
                                        {
1894
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1895
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1896
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1897
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1898
                                        }
1899

    
1900
                                        control.PointSet = new List<Point>
1901
                                        {
1902
                                            control.StartPoint,
1903
                                            control.LeftBottomPoint,
1904
                                            control.EndPoint,
1905
                                            control.TopRightPoint,
1906
                                        };
1907
                                    }
1908
                                    //강인구 추가
1909
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1910
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1911

    
1912
                                }
1913
                            }
1914
                            break;
1915

    
1916
                        case ControlType.PolygonCloud:
1917
                            {
1918
                                var control = currentControl as CloudControl;
1919

    
1920
                                if (control != null)
1921
                                {
1922
                                    control.isTransOn = true;
1923
                                    control.PointSet.RemoveAt(control.PointSet.Count - 1);
1924

    
1925
                                    control.PointSet.Add(currentCanvasDrawingMouseMovePoint);
1926

    
1927
                                    control.SetCloud();
1928
                                    //강인구 추가
1929
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1930
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1931
                                }
1932
                            }
1933
                            break;
1934

    
1935
                        case ControlType.Triangle:
1936
                            {
1937
                                var control = currentControl as TriControl;
1938

    
1939
                                if (control != null)
1940
                                {
1941
                                    if (move.mousemode == MouseMode.Drawing)
1942
                                    {
1943
                                        //move.control_Move(ControlList, true, moveX, moveY);
1944
                                    }
1945
                                    else
1946
                                    {
1947
                                        control.Paint = ViewerDataModel.Instance.paintSet;
1948
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1949

    
1950
                                        if (ViewerDataModel.Instance.checkAxis)
1951
                                        {
1952
                                            Point tempPoint = control.EndPoint;
1953
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1954
                                            control.EndPoint = tempPoint;
1955
                                        }
1956

    
1957

    
1958
                                        if (ViewerDataModel.Instance.IsPressShift)
1959
                                        {
1960
                                            List<Point> Points = GetRegularTrianglePoints(control.StartPoint, control.EndPoint);
1961
                                            if (2 == Points.Count())
1962
                                            {
1963
                                                control.MidPoint = Points[0];
1964
                                                control.EndPoint = Points[1];
1965
                                            }
1966
                                        }
1967

    
1968
                                        control.PointSet = new List<Point>
1969
                                            {
1970
                                                control.StartPoint,
1971
                                                control.MidPoint,
1972
                                                control.EndPoint,
1973
                                            };
1974
                                    }
1975
                                    //강인구 추가
1976
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1977
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1978
                                }
1979
                            }
1980
                            break;
1981

    
1982
                        case ControlType.ImgControl:
1983
                            {
1984
                                var control = currentControl as ImgControl;
1985

    
1986
                                if (control != null)
1987
                                {
1988
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1989
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1990
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1991
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1992

    
1993
                                    control.PointSet = new List<Point>
1994
                                        {
1995
                                            control.StartPoint,
1996
                                            control.LeftBottomPoint,
1997
                                            control.EndPoint,
1998
                                            control.TopRightPoint,
1999
                                        };
2000
                                }
2001
                            }
2002
                            break;
2003

    
2004
                        case ControlType.Date:
2005
                            {
2006
                                var control = currentControl as DateControl;
2007

    
2008
                                if (control != null)
2009
                                {
2010
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2011
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2012
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2013
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2014
                                    //control.Text = DateTime.Now.ToString("yyyy-MM-dd");
2015

    
2016
                                    control.PointSet = new List<Point>
2017
                                        {
2018
                                            control.StartPoint,
2019
                                            control.LeftBottomPoint,
2020
                                            control.EndPoint,
2021
                                            control.TopRightPoint,
2022
                                        };
2023
                                }
2024
                            }
2025
                            break;
2026

    
2027
                        case ControlType.ArrowTextControl:
2028
                            {
2029
                                var control = currentControl as ArrowTextControl;
2030

    
2031
                                if (control != null)
2032
                                {
2033
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2034
                                    Point tempPoint = control.EndPoint;
2035

    
2036
                                    control.MidPoint = new Point(control.EndPoint.X - 100, control.EndPoint.Y - 100);
2037

    
2038
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2039
                                    {
2040
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2041
                                        control.EndPoint = tempPoint;
2042
                                    }
2043
                                    else
2044
                                    {
2045
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2046
                                    }
2047
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2048

    
2049
                                    control.PointSet = new List<Point>
2050
                                            {
2051
                                                control.StartPoint,
2052
                                                control.MidPoint,
2053
                                                control.EndPoint,
2054
                                            };
2055
                                }
2056
                            }
2057
                            break;
2058

    
2059
                        case ControlType.ArrowTransTextControl:
2060
                            {
2061
                                var control = currentControl as ArrowTextControl;
2062

    
2063
                                if (control != null)
2064
                                {
2065
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2066
                                    Point tempPoint = control.EndPoint;
2067
                                    //control.MidPoint = currentCanvasDrawingMouseMovePoint;
2068

    
2069
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2070
                                    {
2071
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2072
                                        control.EndPoint = tempPoint;
2073
                                    }
2074
                                    else
2075
                                    {
2076
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2077
                                    }
2078
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2079
                                    control.isFixed = true;
2080

    
2081
                                    control.PointSet = new List<Point>
2082
                                            {
2083
                                                control.StartPoint,
2084
                                                control.MidPoint,
2085
                                                control.EndPoint,
2086
                                            };
2087
                                }
2088
                            }
2089
                            break;
2090

    
2091
                        case ControlType.ArrowTextBorderControl:
2092
                            {
2093
                                var control = currentControl as ArrowTextControl;
2094

    
2095
                                if (control != null)
2096
                                {
2097
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2098
                                    Point tempPoint = control.EndPoint;
2099
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2100
                                    {
2101
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2102
                                        control.EndPoint = tempPoint;
2103
                                    }
2104
                                    else
2105
                                    {
2106
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2107
                                    }
2108
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2109
                                    control.PointSet = new List<Point>
2110
                                            {
2111
                                                control.StartPoint,
2112
                                                control.MidPoint,
2113
                                                control.EndPoint,
2114
                                            };
2115
                                }
2116

    
2117
                            }
2118
                            break;
2119
                        case ControlType.ArrowTransTextBorderControl:
2120
                            {
2121
                                var control = currentControl as ArrowTextControl;
2122

    
2123
                                if (control != null)
2124
                                {
2125
                                    control.isFixed = true;
2126
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2127
                                    Point tempPoint = control.EndPoint;
2128
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2129
                                    {
2130
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2131
                                        control.EndPoint = tempPoint;
2132
                                    }
2133
                                    else
2134
                                    {
2135
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2136
                                    }
2137

    
2138
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2139
                                    control.PointSet = new List<Point>
2140
                                            {
2141
                                                control.StartPoint,
2142
                                                control.MidPoint,
2143
                                                control.EndPoint,
2144
                                            };
2145
                                }
2146

    
2147
                            }
2148
                            break;
2149
                        case ControlType.ArrowTextCloudControl:
2150
                            {
2151
                                var control = currentControl as ArrowTextControl;
2152

    
2153
                                if (control != null)
2154
                                {
2155
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2156
                                    Point tempPoint = control.EndPoint;
2157
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2158
                                    {
2159
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2160
                                        control.EndPoint = tempPoint;
2161
                                    }
2162
                                    else
2163
                                    {
2164
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2165
                                    }
2166
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2167
                                    control.PointSet = new List<Point>
2168
                                            {
2169
                                                control.StartPoint,
2170
                                                control.MidPoint,
2171
                                                control.EndPoint,
2172
                                            };
2173
                                }
2174

    
2175
                            }
2176
                            break;
2177
                        case ControlType.ArrowTransTextCloudControl:
2178
                            {
2179
                                var control = currentControl as ArrowTextControl;
2180

    
2181
                                if (control != null)
2182
                                {
2183
                                    control.isFixed = true;
2184
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2185
                                    Point tempPoint = control.EndPoint;
2186
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2187
                                    {
2188
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2189
                                        control.EndPoint = tempPoint;
2190
                                    }
2191
                                    else
2192
                                    {
2193
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2194
                                    }
2195
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2196
                                    control.PointSet = new List<Point>
2197
                                            {
2198
                                                control.StartPoint,
2199
                                                control.MidPoint,
2200
                                                control.EndPoint,
2201
                                            };
2202
                                }
2203

    
2204
                            }
2205
                            break;
2206
                        case ControlType.PolygonControl:
2207
                            {
2208

    
2209
                                var control = currentControl as PolygonControl;
2210

    
2211
                                if (control != null)
2212
                                {
2213
                                    control.PointSet.RemoveAt(control.PointSet.Count - 1);
2214
                                    control.PointSet.Add(currentCanvasDrawingMouseMovePoint);
2215
                                    control.Paint = ViewerDataModel.Instance.paintSet;
2216
                                    control.SetPolyPath();
2217
                                    //강인구 추가
2218
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
2219
                                    control.Paint = ViewerDataModel.Instance.paintSet;
2220
                                }
2221
                            }
2222
                            break;
2223
                        //강인구 추가
2224
                        case ControlType.Sign:
2225
                            {
2226
                                var control = currentControl as SignControl;
2227

    
2228
                                if (control != null)
2229
                                {
2230
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2231
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2232
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2233
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2234

    
2235
                                    if (control.StartPoint != control.EndPoint && control.SignImage == null)
2236
                                    {
2237
                                        GetUserSign getUser = new GetUserSign();
2238
                                        var _sign = getUser.GetSign(App.ViewInfo.UserID, App.ViewInfo.ProjectNO);
2239
                                        byte[] imageBytes = System.Convert.FromBase64String(_sign);
2240
                                        System.IO.MemoryStream stream = new System.IO.MemoryStream();
2241
                                        stream.Write(imageBytes, 0, imageBytes.Length);
2242
                                        stream.Position = 0;
2243
                                        System.Drawing.Image img = System.Drawing.Image.FromStream(stream);
2244
                                        BitmapImage returnImage = new BitmapImage();
2245
                                        returnImage.BeginInit();
2246
                                        System.IO.MemoryStream ms = new System.IO.MemoryStream();
2247
                                        img.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
2248
                                        ms.Seek(0, System.IO.SeekOrigin.Begin);
2249
                                        returnImage.StreamSource = ms;
2250
                                        returnImage.EndInit();
2251
                                        stream.Close();
2252

    
2253
                                        control.SignImage = returnImage;
2254
                                    }
2255
                                    control.PointSet = new List<Point>
2256
                                        {
2257
                                            control.StartPoint,
2258
                                            control.LeftBottomPoint,
2259
                                            control.EndPoint,
2260
                                            control.TopRightPoint,
2261
                                        };
2262
                                }
2263
                            }
2264
                            break;
2265
                        //TODO: 강인구 추가
2266
                        case ControlType.Symbol:
2267
                            {
2268
                                var control = currentControl as SymControl;
2269

    
2270
                                if (control != null)
2271
                                {
2272
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2273
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2274
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2275
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2276
                                    control.LineSize = ViewerDataModel.Instance.LineSize + 3;
2277
                                    control.StrokeColor = new SolidColorBrush(Colors.Red);
2278

    
2279
                                    if (control.StartPoint != control.EndPoint)
2280
                                    {
2281
                                        if (control.PathData == null)
2282
                                        {
2283
                                            using (StringToPathConverter Convert = new StringToPathConverter())
2284
                                            {
2285
                                                control.PathData = Convert.Convert("M-5,5L0,0L20,30L40,-20 ");
2286
                                            }
2287
                                        }
2288
                                    }
2289

    
2290
                                    control.PointSet = new List<Point>
2291
                                        {
2292
                                            control.StartPoint,
2293
                                            control.LeftBottomPoint,
2294
                                            control.EndPoint,
2295
                                            control.TopRightPoint,
2296
                                        };
2297
                                }
2298
                            }
2299
                            break;
2300
                        ///TODO: 
2301
                        case ControlType.Stamp:
2302
                            {
2303
                                var control = currentControl as SymControlN;
2304

    
2305
                                if (control != null)
2306
                                {
2307

    
2308
                                    if (control.StartPoint == control.EndPoint)
2309
                                    {
2310
                                        string appovalData = "";
2311

    
2312
                                        var xamlData = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString_NonPrefix(App.SystemInfo.STAMP);
2313
                                        xamlData = xamlData.Replace("daelim", "DAELIM");
2314

    
2315

    
2316
                                        //object obj = System.Windows.Markup.XamlReader.Load(xamlData);
2317

    
2318
                                        System.IO.MemoryStream stream = new System.IO.MemoryStream();
2319
                                        System.IO.StreamWriter writer = new System.IO.StreamWriter(stream);
2320
                                        writer.Write(xamlData);
2321
                                        writer.Flush();
2322
                                        stream.Position = 0;
2323

    
2324
                                        control.StrokeColor = new SolidColorBrush(Colors.Red);
2325
                                        object obj = System.Windows.Markup.XamlReader.Load(stream);
2326
                                        UIElement ob = obj as UIElement;
2327

    
2328
                                        //control.ApplyTemplate();
2329

    
2330
                                        control.SetViewBox();
2331
                                        control.PathXathData = App.SystemInfo.STAMP;
2332
                                        control.Base_ViewBox.Child = ob;
2333
                                    }
2334

    
2335
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2336
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2337
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2338
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2339
                                    //control.LineSize = ViewerDataModel.Instance.LineSize + 3;
2340

    
2341

    
2342
                                    control.PointSet = new List<Point>
2343
                                    {
2344
                                        control.StartPoint,
2345
                                        control.LeftBottomPoint,
2346
                                        control.EndPoint,
2347
                                        control.TopRightPoint,
2348
                                    };
2349
                                }
2350
                            }
2351
                            break;
2352
                        case ControlType.Mark:
2353
                            {
2354
                                var control = currentControl as RectangleControl;
2355

    
2356
                                if (control != null)
2357
                                {
2358
                                    if (move.mousemode == MouseMode.Drawing)
2359
                                    {
2360
                                        //move.control_Move(ControlList, true, moveX, moveY);
2361
                                    }
2362
                                    else
2363
                                    {
2364
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2365
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2366
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2367
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2368

    
2369

    
2370
                                        control.PointSet = new List<Point>
2371
                                    {
2372
                                        control.StartPoint,
2373
                                        control.LeftBottomPoint,
2374
                                        control.EndPoint,
2375
                                        control.TopRightPoint,
2376
                                    };
2377
                                    }
2378

    
2379
                                    //강인구 추가
2380
                                    control.Paint = PaintSet.Fill;
2381
                                }
2382
                            }
2383
                            break;
2384
                        case ControlType.PenControl:
2385
                            {
2386
                                stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y));
2387
                                //inkBoard.Strokes.Add(stroke);
2388
                            }
2389
                            break;
2390
                        default:
2391
                            break;
2392
                    }
2393
                }
2394
            }
2395
            else if (mouseButtonDown == MouseButton.Left && mouseHandlingMode == MouseHandlingMode.Selecting || mouseButtonDown == MouseButton.Left && mouseHandlingMode == MouseHandlingMode.Capture || mouseButtonDown == MouseButton.Left && mouseHandlingMode == MouseHandlingMode.DragZoom)
2396
            {
2397
                Point curMouseDownPoint = e.GetPosition(drawingRotateCanvas);
2398

    
2399
                if (isDraggingSelectionRect)
2400
                {
2401
                    UpdateDragSelectionRect(canvasDrawingMouseDownPoint, curMouseDownPoint);
2402

    
2403
                    e.Handled = true;
2404
                }
2405
                else if (isLeftMouseButtonDownOnWindow)
2406
                {
2407
                    var dragDelta = curMouseDownPoint - canvasDrawingMouseDownPoint;
2408
                    double dragDistance = Math.Abs(dragDelta.Length);
2409

    
2410
                    if (dragDistance > DragThreshold)
2411
                    {
2412
                        isDraggingSelectionRect = true;
2413

    
2414
                        InitDragSelectionRect(canvasDrawingMouseDownPoint, curMouseDownPoint);
2415
                    }
2416

    
2417
                    e.Handled = true;
2418
                }
2419

    
2420

    
2421
                if (canvasDrawingMouseDownPoint == curMouseDownPoint)
2422
                {
2423
                    //SelectionPath = new Path();
2424
                    //PathFigure pathFigure = new PathFigure();
2425
                    //SelectionPath.Fill = new SolidColorBrush(Colors.Yellow);
2426
                    //SelectionPath.Opacity = 0.5;
2427
                    //SelectionPath.StrokeDashArray = new DoubleCollection() { 1 };
2428
                    //SelectionPath.StrokeDashCap = PenLineCap.Round;
2429
                    //SelectionPath.Stroke = new SolidColorBrush(Colors.Black);
2430
                }
2431
                else
2432
                {
2433
                    //List<Stroke> removingStroke = new List<Stroke>();
2434
                    //Rect p1 = new Rect(canvasDrawingMouseDownPoint, curMouseDownPoint);
2435
                    //StrokeCollection stC = new StrokeCollection();
2436
                    //for (int i = 0; i <= inkBoard.Strokes.Count - 1; i++)
2437
                    //{
2438
                    //    Rect p2 = inkBoard.Strokes[i].GetBounds();
2439
                    //    p1.Intersect(p2);
2440
                    //    if (p1.IsEmpty)
2441
                    //    {
2442

    
2443

    
2444
                    //        p1 = SelectionPath.Data.Bounds;
2445
                    //        bool intersectCheck = false;
2446
                    //        foreach (var T in inkBoard.Strokes[i].StylusPoints)
2447
                    //        {
2448
                    //            Rect p3 = new Rect(new Point(T.X, T.Y), new Size(10, 10));
2449
                    //            p1.Intersect(p3);
2450
                    //            if (!p1.IsEmpty)
2451
                    //            {
2452
                    //                intersectCheck = true;
2453
                    //            }
2454
                    //        }
2455
                    //        if (intersectCheck)
2456
                    //        {
2457
                    //            removingStroke.Add(inkBoard.Strokes[i]);
2458
                    //        }
2459

    
2460
                    //    }
2461
                    //    else
2462
                    //    {
2463
                    //        removingStroke.Add(inkBoard.Strokes[i]);
2464
                    //    }
2465
                    //}
2466

    
2467
                    e.Handled = true;
2468
                }
2469
            }
2470
            else if (mouseButtonDown == MouseButton.Left && ViewerDataModel.Instance.MarkupControls_USER.Count > 0)
2471
            {
2472
                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
2473
                if (control != null)
2474
                {
2475
                    this.cursor = Cursors.Hand;
2476
                    SetCursor();
2477
                }
2478
                else
2479
                {
2480
                    this.cursor = Cursors.Arrow;
2481
                    SetCursor();
2482
                }
2483
            }
2484
            else
2485
            {
2486
                //var hitRect = new Rect(currentCanvasDrawingMouseMovePoint.X - 10, currentCanvasDrawingMouseMovePoint.Y - 10, 20, 20);
2487

    
2488
                //VisualTreeHelper.HitTest(this.drawingRotateCanvas, null, MyCallback,
2489
                //    new GeometryHitTestParameters(new RectangleGeometry(hitRect)));
2490

    
2491
                //if (hitList.Count > 0)
2492
                //{
2493

    
2494
                //}
2495

    
2496
                #region 조건 설정 : firstCondition
2497
                //GeneralTransform generalTransform = this.DeepLayer._BaseLayer.TransformToVisual(Application.Current.RootVisual);
2498
                //pnts = generalTransform.Transform(pnts);
2499
                //Rect areaInAbsoluteCoordinates = new Rect(pnts.X - 10, pnts.Y - 10, 20, 20);
2500
                //var firstCondition = (from kkk in VisualTreeHelper.FindElementsInHostCoordinates(areaInAbsoluteCoordinates,
2501
                //                               this.DeepLayer._BaseLayer).ToObservable()
2502
                //                      where String.IsNullOrEmpty((kkk as FrameworkElement).Name)
2503
                //                      select kkk).FirstOrDefault();
2504

    
2505
                //var canvas = LogicalTreeHelper.FindLogicalNode(this, "drawingRotateCanvas") as Canvas;
2506
                //if (canvas !=null)
2507
                //{
2508
                //    foreach (var item in (canvas.Children[0] as ItemsControl).Items)
2509
                //    {
2510
                //        UIElement uiElement = (UIElement)(canvas.Children[0] as ItemsControl).ItemContainerGenerator.ContainerFromItem(item);
2511
                //        if (uiElement!=null)
2512
                //        {
2513
                //            uiElement.InputHitTest(currentCanvasDrawingMouseMovePoint).
2514
                //        }
2515
                //    }
2516
                //}
2517

    
2518
                //EllipseGeometry expandedHitTestArea = new EllipseGeometry(currentCanvasDrawingMouseMovePoint, 10.0, 10.0);
2519
                //hitResultsList.Clear();
2520

    
2521
                #endregion
2522
            }
2523
        }
2524

    
2525
        private void zoomAndPanControl2_MouseMove(object sender, MouseEventArgs e)
2526
        {
2527
            if ((mouseButtonDown == MouseButton.Middle) || (mouseButtonDown == MouseButton.Right))
2528
            {
2529
                SetCursor();
2530
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas2);
2531
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas2);
2532

    
2533
                Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
2534

    
2535
                ViewerDataModel.Instance.Sync_ContentOffsetX -= dragOffset.X;
2536
                ViewerDataModel.Instance.Sync_ContentOffsetY -= dragOffset.Y;
2537

    
2538
                if (Sync.IsChecked)
2539
                {
2540
                    zoomAndPanControl.ContentOffsetX = ViewerDataModel.Instance.Sync_ContentOffsetX;
2541
                    zoomAndPanControl.ContentOffsetY = ViewerDataModel.Instance.Sync_ContentOffsetY;
2542
                }
2543
            }
2544
        }
2545

    
2546
        private List<CommentUserInfo> hitList = new List<CommentUserInfo>();
2547

    
2548
        private EllipseGeometry hitArea = new EllipseGeometry();
2549

    
2550
        private void zoomAndPanControl_MouseUp(object sender, MouseButtonEventArgs e)
2551
        {
2552
            IsDrawing = false;
2553

    
2554
            if (mouseHandlingMode != MouseHandlingMode.None)
2555
            {
2556
                if (mouseHandlingMode == MouseHandlingMode.Drawing)
2557
                {
2558
                    this.cursor = Cursors.Arrow;
2559

    
2560
                    SetCursor();
2561

    
2562
                    switch (controlType)
2563
                    {
2564
                        case ControlType.None:
2565
                            break;
2566
                        case ControlType.Rectangle:
2567
                            {
2568

    
2569
                            }
2570
                            break;
2571
                        case ControlType.PenControl:
2572
                            {
2573

    
2574
                            }
2575
                            break;
2576
                        default:
2577
                            break;
2578
                    }
2579
                }
2580
                else if (mouseHandlingMode == MouseHandlingMode.Selecting && e.ChangedButton == MouseButton.Left || mouseHandlingMode == MouseHandlingMode.Capture && e.ChangedButton == MouseButton.Left || mouseHandlingMode == MouseHandlingMode.DragZoom && e.ChangedButton == MouseButton.Left)
2581
                {
2582
                    if (isLeftMouseButtonDownOnWindow)
2583
                    {
2584
                        bool wasDragSelectionApplied = false;
2585

    
2586
                        if (isDraggingSelectionRect)
2587
                        {
2588
                            if (mouseHandlingMode == MouseHandlingMode.Capture)
2589
                            {
2590
                                dragCaptureBorder.Visibility = Visibility.Collapsed;
2591
                                mouseHandlingMode = MouseHandlingMode.None;
2592
                                Set_Capture();
2593

    
2594
                                ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed;
2595
                                ViewerDataModel.Instance.ViewVisible = Visibility.Visible;
2596
                                ViewerDataModel.Instance.Capture_Opacity = 0;
2597
                            }
2598
                            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
2599
                            {
2600
                                ApplyDragSelectionRect();
2601
                            }
2602
                            else
2603
                            {
2604
                                double x = Canvas.GetLeft(dragZoomBorder);
2605
                                double y = Canvas.GetTop(dragZoomBorder);
2606
                                double width = dragZoomBorder.Width;
2607
                                double height = dragZoomBorder.Height;
2608
                                Rect dragRect = new Rect(x, y, width, height);
2609

    
2610
                                ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.ZoomTo(dragRect);
2611

    
2612
                                dragZoomBorder.Visibility = Visibility.Collapsed;
2613
                            }
2614

    
2615
                            isDraggingSelectionRect = false;
2616
                            e.Handled = true;
2617
                            wasDragSelectionApplied = true;
2618
                        }
2619

    
2620
                        if (isLeftMouseButtonDownOnWindow)
2621
                        {
2622
                            isLeftMouseButtonDownOnWindow = false;
2623
                            this.ReleaseMouseCapture();
2624
                            e.Handled = true;
2625
                        }
2626

    
2627
                        if (!wasDragSelectionApplied)
2628
                        {
2629
                            init();
2630
                        }
2631
                    }
2632
                }
2633
                else if (mouseButtonDown == MouseButton.Right)
2634
                {
2635
                    this.cursor = Cursors.Arrow;
2636
                    SetCursor();
2637
                }
2638

    
2639
                zoomAndPanControl.ReleaseMouseCapture();
2640

    
2641

    
2642
                e.Handled = true;
2643
            }
2644
            else
2645
            {
2646
                this.cursor = Cursors.Arrow;
2647
                SetCursor();
2648
            }
2649
            mouseButtonDown = MouseButton.Left;
2650

    
2651
            //controlType = ControlType.SingleLine;
2652
        }
2653

    
2654
        private void zoomAndPanControl2_MouseUp(object sender, MouseButtonEventArgs e)
2655
        {
2656
            mouseButtonDown = MouseButton.Left;
2657
        }
2658

    
2659
        private void zoomAndPanControl_MouseLeave(object sender, MouseEventArgs e)
2660
        {
2661
            mouseButtonDown = MouseButton.Left;
2662
            this.Cursor = Cursors.Arrow;
2663
        }
2664

    
2665
        private void zoomAndPanControl_MouseDoubleClick(object sender, MouseButtonEventArgs e)
2666
        {
2667

    
2668
        }
2669

    
2670
        /// <summary>
2671
        /// select item which's bouding rectangle is equal to given rectangle
2672
        /// </summary>
2673
        /// <author>humkyung</author>
2674
        /// <date>2018.06.14</date>
2675
        /// <param name="rect"></param>
2676
        public void SelecteItemByRect(Rect rect)
2677
        {
2678
            multi_Undo_Data = new Multi_Undo_data();
2679

    
2680
            UndoData = new Undo_data()
2681
            {
2682
                IsUndo = false,
2683
                Event = Event_Type.Select,
2684
                EventTime = DateTime.Now,
2685
                Markup_List = new List<Multi_Undo_data>()
2686
            };
2687
           
2688
            var Items = ViewerDataModel.Instance.MarkupControls_USER.ToList();
2689

    
2690
            CommentUserInfo selected = null;
2691
            double dMinDiff = double.MaxValue;
2692
            Move tmp = new Move();
2693
            foreach (var item in Items)
2694
            {
2695
                Rect boundingBox = tmp.ItemRect(item);
2696
                double dx = rect.X - boundingBox.X;
2697
                double dy = rect.Y - boundingBox.Y;
2698
                double dxx = rect.Right - boundingBox.Right;
2699
                double dyy = rect.Bottom - boundingBox.Bottom;
2700
                double dDiff = Math.Sqrt(dx * dx + dy * dy + dxx * dxx + dyy * dyy);
2701
                if (dDiff < dMinDiff)
2702
                {
2703
                    dMinDiff = dDiff;
2704
                    selected = item;
2705
                }
2706
            }
2707

    
2708
            if (selected != null)
2709
            {
2710
                this.ReleaseAdorner();
2711

    
2712
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2713
                adornerSet.Add(selected);
2714
                ViewerDataModel.Instance.MarkupControls_USER.Remove(selected);
2715

    
2716
                Control_Style(selected);
2717
                UndoData.Markup_List.Add(multi_Undo_Data);
2718
                multi_Undo_Data = new Multi_Undo_data();
2719

    
2720
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
2721
                {
2722
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2723
                });
2724
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2725

    
2726
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2727
                SelectLayer.Children.Add(final);
2728
            }
2729
        }
2730

    
2731
        private void ApplyDragSelectionRect()
2732
        {
2733
            multi_Undo_Data = new Multi_Undo_data();
2734

    
2735
            UndoData = new Undo_data()
2736
            {
2737
                IsUndo = false,
2738
                Event = Event_Type.Select,
2739
                EventTime = DateTime.Now,
2740
                Markup_List = new List<Multi_Undo_data>()
2741
            };
2742

    
2743
            dragSelectionBorder.Visibility = Visibility.Collapsed;
2744

    
2745
            double x = Canvas.GetLeft(dragSelectionBorder);
2746
            double y = Canvas.GetTop(dragSelectionBorder);
2747
            double width = dragSelectionBorder.Width;
2748
            double height = dragSelectionBorder.Height;
2749
            Rect dragRect = new Rect(x, y, width, height);
2750
            Boolean Flag = false;
2751
            dragRect.Inflate(width / 10, height / 10);
2752
            List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2753
            var Items = ViewerDataModel.Instance.MarkupControls_USER.ToList();
2754

    
2755
            dragRect = new Rect(x, y, width, height);
2756
            dragRect.Inflate(width / 10, height / 10);
2757

    
2758
            foreach (var item in Items)
2759
            {
2760
                Flag = move.control_Select(item, dragRect);
2761

    
2762
                if (Flag)
2763
                {
2764
                    adornerSet.Add(item);
2765
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(item);
2766

    
2767
                    Control_Style(item);
2768
                    UndoData.Markup_List.Add(multi_Undo_Data);
2769
                    multi_Undo_Data = new Multi_Undo_data();
2770
                }
2771
            }
2772
            if (adornerSet.Count > 0)
2773
            {
2774
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
2775
                {
2776
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2777
                });
2778
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2779

    
2780
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2781
                SelectLayer.Children.Add(final);
2782
            }
2783
        }
2784

    
2785
        private void InitDragSelectionRect(Point pt1, Point pt2)
2786
        {
2787
            //캡쳐 중
2788
            if (mouseHandlingMode == MouseHandlingMode.Capture)
2789
            {
2790
                dragCaptureBorder.Visibility = Visibility.Visible;
2791
            }
2792
            //선택 중
2793
            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
2794
            {
2795

    
2796
                dragSelectionBorder.Visibility = Visibility.Visible;
2797
            }
2798
            else
2799
            {
2800
                dragZoomBorder.Visibility = Visibility.Visible;
2801
            }
2802
            UpdateDragSelectionRect(pt1, pt2);
2803
        }
2804

    
2805
        /// <summary>
2806
        /// Update the position and size of the rectangle used for drag selection.
2807
        /// </summary>
2808
        private void UpdateDragSelectionRect(Point pt1, Point pt2)
2809
        {
2810
            double x, y, width, height;
2811

    
2812
            //
2813
            // Determine x,y,width and height of the rect inverting the points if necessary.
2814
            // 
2815

    
2816
            if (pt2.X < pt1.X)
2817
            {
2818
                x = pt2.X;
2819
                width = pt1.X - pt2.X;
2820
            }
2821
            else
2822
            {
2823
                x = pt1.X;
2824
                width = pt2.X - pt1.X;
2825
            }
2826

    
2827
            if (pt2.Y < pt1.Y)
2828
            {
2829
                y = pt2.Y;
2830
                height = pt1.Y - pt2.Y;
2831
            }
2832
            else
2833
            {
2834
                y = pt1.Y;
2835
                height = pt2.Y - pt1.Y;
2836
            }
2837

    
2838
            //
2839
            // Update the coordinates of the rectangle used for drag selection.
2840
            //
2841
            //캡쳐 중
2842
            if (mouseHandlingMode == MouseHandlingMode.Capture)
2843
            {
2844
                Canvas.SetLeft(dragCaptureBorder, x);
2845
                Canvas.SetTop(dragCaptureBorder, y);
2846
                dragCaptureBorder.Width = width;
2847
                dragCaptureBorder.Height = height;
2848
            }
2849
            //선택 중
2850
            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
2851
            {
2852
                Canvas.SetLeft(dragSelectionBorder, x);
2853
                Canvas.SetTop(dragSelectionBorder, y);
2854
                dragSelectionBorder.Width = width;
2855
                dragSelectionBorder.Height = height;
2856
            }
2857
            else
2858
            {
2859
                Canvas.SetLeft(dragZoomBorder, x);
2860
                Canvas.SetTop(dragZoomBorder, y);
2861
                dragZoomBorder.Width = width;
2862
                dragZoomBorder.Height = height;
2863
            }
2864
        }
2865

    
2866
        public bool IsSelectionControl(Rect dragRect, Rect controlRect, Geometry OverViewPathData, ControlType type)
2867
        {
2868
            //// X, Y, WIDTH, HEIGHT 형태로 RECT를 만든다.
2869

    
2870
            bool result = false;
2871
            if (dragRect.Contains(controlRect))
2872
            {
2873
                result = true;
2874
                //잡은 객체들을 담은 리스트
2875
                try
2876
                {
2877
                    selected_item.Add(OverViewPathData, type.ToString());
2878
                }
2879
                catch (Exception)
2880
                {
2881

    
2882
                }
2883
            }
2884
            return result;
2885
        }
2886

    
2887
        private void drawingPannelRotate(double angle)
2888
        {
2889
            rotate.Angle = angle;
2890
            var rotationNum = Math.Abs((rotate.Angle / 90));
2891

    
2892
            if (angle == 90 || angle == 270)
2893
            {
2894
                double emptySize = zoomAndPanCanvas.Width;
2895
                zoomAndPanCanvas.Width = zoomAndPanCanvas.Height;
2896
                zoomAndPanCanvas.Height = emptySize;
2897
            }
2898
            if (angle == 0)
2899
            {
2900
                translate.X = 0;
2901
                translate.Y = 0;
2902
            }
2903
            else if (angle == 90)
2904
            {
2905
                translate.X = zoomAndPanCanvas.Width;
2906
                translate.Y = 0;
2907
            }
2908
            else if (angle == 180)
2909
            {
2910
                translate.X = zoomAndPanCanvas.Width;
2911
                translate.Y = zoomAndPanCanvas.Height;
2912
            }
2913
            else
2914
            {
2915
                translate.X = 0;
2916
                translate.Y = zoomAndPanCanvas.Height;
2917
            }
2918

    
2919
            zoomAndPanControl.RotationAngle = rotate.Angle;
2920

    
2921

    
2922
            if (!testPanel2.IsHidden)
2923
            {
2924
                zoomAndPanControl2.RotationAngle = rotate.Angle;
2925
                zoomAndPanCanvas2.Width = zoomAndPanCanvas.Width;
2926
                zoomAndPanCanvas2.Height = zoomAndPanCanvas.Height;
2927
            }
2928

    
2929
            ViewerDataModel.Instance.ContentWidth = zoomAndPanCanvas.Width;
2930
            ViewerDataModel.Instance.ContentHeight = zoomAndPanCanvas.Height;
2931
            ViewerDataModel.Instance.AngleOffsetX = translate.X;
2932
            ViewerDataModel.Instance.AngleOffsetY = translate.Y;
2933
            ViewerDataModel.Instance.Angle = rotate.Angle;
2934
        }
2935

    
2936
        private void zoomAndPanControl_MouseDown(object sender, MouseButtonEventArgs e)
2937
        {
2938
            var set_option = this.ParentOfType<MainWindow>().dzTopMenu.Parent.ChildrenOfType<RadNumericUpDown>().Where(item => item.IsKeyboardFocusWithin).FirstOrDefault();
2939
            if (set_option != null)
2940
            {
2941
                set_option.Value = double.Parse(set_option.ContentText);
2942
            }
2943

    
2944
            InkControl_Convert();
2945

    
2946
            var text_item = ViewerDataModel.Instance.MarkupControls_USER.Where(data =>
2947
            (data as TextControl) != null && (data as TextControl).Text == "" || (data as ArrowTextControl) != null && (data as ArrowTextControl).ArrowText == "").FirstOrDefault();
2948

    
2949
            if (text_item != null && (currentControl as ArrowTextControl) == null)
2950
            {
2951
                ViewerDataModel.Instance.MarkupControls_USER.Remove(text_item);
2952
            }
2953

    
2954
            foreach (var arrow_text in ViewerDataModel.Instance.MarkupControls_USER)
2955
            {
2956
                if (arrow_text as ArrowTextControl != null)
2957
                {
2958
                    (arrow_text as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
2959
                }
2960
            }
2961

    
2962
            mouseButtonDown = e.ChangedButton;
2963
            /// complete drawing text control when user click mouse right button - 2018.05.14 added by humkyung
2964

    
2965
            //if (currentControl != null)
2966
            {
2967
                var text_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as TextControl) != null && (data as TextControl).Base_TextBox.Visibility == Visibility.Visible).FirstOrDefault();
2968
                if (text_item_ != null)
2969
                {
2970
                    (text_item_ as TextControl).Base_TextBlock.Visibility = Visibility.Visible;
2971
                    (text_item_ as TextControl).Base_TextBox.Visibility = Visibility.Collapsed;
2972
                    (text_item_ as TextControl).IsEditing = false;
2973
                    (text_item_ as TextControl).EnableEditing = false;
2974
                    currentControl = null;
2975
                }
2976

    
2977
                var Arrowtext_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as ArrowTextControl) != null && (data as ArrowTextControl).IsEditingMode == true).FirstOrDefault();
2978
                if (Arrowtext_item_ != null && ((Arrowtext_item_ as ArrowTextControl).IsNew == false))
2979
                {
2980
                    (Arrowtext_item_ as ArrowTextControl).IsEditingMode = false;
2981
                    (Arrowtext_item_ as ArrowTextControl).Base_TextBox.Focusable = false;
2982
                    currentControl = null;
2983
                }
2984
            }
2985

    
2986
            double Ang = 0;                                          
2987
            if (rotate.Angle != 0)
2988
            {
2989
                Ang = 360 - rotate.Angle;
2990
            }
2991
            move = new Move();
2992

    
2993
            if (e.OriginalSource is System.Windows.Controls.Image)
2994
            {
2995
                (e.OriginalSource as System.Windows.Controls.Image).Focus();
2996
            }
2997

    
2998
            if (mouseButtonDown == MouseButton.Left)
2999
            {
3000
                canvasDrawingMouseDownPoint = e.GetPosition(drawingRotateCanvas);
3001
                canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
3002

    
3003
                this.cursor = Cursors.Arrow;
3004
                SetCursor();
3005

    
3006
                if (!ViewerDataModel.Instance.IsPressCtrl)
3007
                {
3008
                    ReleaseAdorner();
3009
                }
3010
            }
3011
            if (mouseButtonDown == MouseButton.Middle)
3012
            {
3013
                canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
3014
                cursor = Cursors.SizeAll;
3015
                SetCursor();
3016
            }
3017
            if (mouseButtonDown == MouseButton.Right)
3018
            {
3019
                canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
3020
                cursor = Cursors.SizeAll;
3021
                SetCursor();
3022
            }
3023
            else if (mouseButtonDown == MouseButton.XButton1)
3024
            {
3025
                if (this.pageNavigator.CurrentPage.PageNumber + 1 <= this.pageNavigator.PageCount)
3026
                {
3027
                    this.pageNavigator.GotoPage(this.pageNavigator._NextPage.PageNumber + 1);
3028
                }
3029

    
3030
                this.pageNavigator.GotoPage(this.pageNavigator._NextPage.PageNumber);
3031

    
3032
            }
3033
            else if (mouseButtonDown == MouseButton.XButton2)
3034
            {
3035
                if (this.pageNavigator.CurrentPage.PageNumber > 1)
3036
                {
3037
                    this.pageNavigator.GotoPage(this.pageNavigator.CurrentPage.PageNumber - 1);
3038
                }
3039
            }
3040

    
3041
            //if (mouseButtonDown == MouseButton.Left && ViewerDataModel.Instance.MarkupControls_USER.Count > 0 && mouseHandlingMode != MouseHandlingMode.Drawing && currentControl == null)
3042
            if (mouseButtonDown == MouseButton.Left && mouseHandlingMode != MouseHandlingMode.Drawing && currentControl == null)
3043
            {
3044
                if (mouseHandlingMode == MouseHandlingMode.Selecting)
3045
                {
3046
                    if (SelectLayer.Children.Count == 0)
3047
                    {
3048
                        isLeftMouseButtonDownOnWindow = true;
3049
                        mouseHandlingMode = MouseHandlingMode.Selecting;
3050
                    }
3051

    
3052
                    if (controlType == ControlType.None)
3053
                    {
3054
                        isLeftMouseButtonDownOnWindow = true;
3055
                    }
3056
                }
3057

    
3058
                //캡쳐 모드 설정
3059
                if (mouseHandlingMode == MouseHandlingMode.Capture)
3060
                {
3061
                    dragCaptureBorder.Visibility = Visibility.Visible;
3062
                    isLeftMouseButtonDownOnWindow = true;
3063
                }
3064

    
3065
                //줌 모드 설정
3066
                if (mouseHandlingMode == MouseHandlingMode.DragZoom)
3067
                {
3068
                    //dragSelectionBorder.Visibility = Visibility.Visible;
3069
                    isLeftMouseButtonDownOnWindow = true;
3070
                }
3071

    
3072

    
3073
                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
3074
                if (control != null)
3075
                {
3076
                    //강인구 추가 컨트롤 누르고 멀티 선택(다시확인필요)
3077
                    AdornerFinal final;
3078
                    List<Point> p_set = new List<Point>();
3079
                    List<CommentUserInfo> comment = new List<CommentUserInfo>();
3080
                    ViewerDataModel.Instance.MarkupControls.Remove(control);
3081
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(control);
3082
                    multi_Undo_Data = new Multi_Undo_data();
3083

    
3084
                    //강인구 Undo/Redo 보류
3085
                    UndoData = new Undo_data()
3086
                    {
3087
                        IsUndo = false,
3088
                        Event = Event_Type.Select,
3089
                        EventTime = DateTime.Now,
3090
                        Markup_List = new List<Multi_Undo_data>()
3091
                    };
3092

    
3093
                    if (!ViewerDataModel.Instance.IsPressCtrl)
3094
                    {
3095
                        ReleaseAdorner();
3096
                        final = new AdornerFinal(control);
3097
                        //단일 컨트롤 언두 저장
3098

    
3099
                        Control_Style(control);
3100
                        UndoData.Markup_List.Add(multi_Undo_Data);
3101

    
3102
                        if ((control as IPath) != null)
3103
                        {
3104
                            if ((control as IPath).LineSize != 0)
3105
                            {
3106
                                ViewerDataModel.Instance.LineSize = (control as IPath).LineSize;
3107
                            }
3108
                        }
3109
                        if ((control as IShapeControl) != null)
3110
                        {
3111
                            if ((control as IShapeControl).Paint == PaintSet.Hatch)
3112
                            {
3113
                                ViewerDataModel.Instance.checkHatchShape = true;
3114
                            }
3115
                            else if ((control as IShapeControl).Paint == PaintSet.Fill)
3116
                            {
3117
                                ViewerDataModel.Instance.checkFillShape = true;
3118
                            }
3119
                            else
3120
                            {
3121
                                ViewerDataModel.Instance.checkHatchShape = false;
3122
                                ViewerDataModel.Instance.checkFillShape = false;
3123
                            }
3124
                            ViewerDataModel.Instance.paintSet = (control as IShapeControl).Paint;
3125
                        }
3126

    
3127
                        ViewerDataModel.Instance.ControlOpacity = control.Opacity;
3128

    
3129
                        if ((control as TextControl) != null)
3130
                        {
3131
                            if ((control as TextControl).TextStyle == FontStyles.Italic)
3132
                            {
3133
                                ViewerDataModel.Instance.checkTextStyle = true;
3134
                            }
3135
                            else
3136
                            {
3137
                                ViewerDataModel.Instance.checkTextStyle = false;
3138
                            }
3139

    
3140
                            if ((control as TextControl).TextStyle == FontStyles.Italic)
3141
                            {
3142
                                ViewerDataModel.Instance.checkTextStyle = true;
3143
                            }
3144
                            else
3145
                            {
3146
                                ViewerDataModel.Instance.checkTextStyle = false;
3147
                            }
3148
                            if ((control as TextControl).TextWeight == FontWeights.Bold)
3149
                            {
3150
                                ViewerDataModel.Instance.checkTextWeight = true;
3151
                            }
3152
                            else
3153
                            {
3154
                                ViewerDataModel.Instance.checkTextWeight = false;
3155
                            }
3156
                            if ((control as TextControl).UnderLine == TextDecorations.Underline)
3157
                            {
3158
                                ViewerDataModel.Instance.checkUnderLine = true;
3159
                            }
3160
                            else
3161
                            {
3162
                                ViewerDataModel.Instance.checkUnderLine = false;
3163
                            }
3164
                            ViewerDataModel.Instance.TextSize = (control as TextControl).TextSize;
3165
                            ViewerDataModel.Instance.checkHighlight = (control as TextControl).IsHighLight;
3166

    
3167
                        }
3168
                        else if ((control as ArrowTextControl) != null)
3169
                        {
3170
                            if ((control as ArrowTextControl).TextStyle == FontStyles.Italic)
3171
                            {
3172
                                ViewerDataModel.Instance.checkTextStyle = true;
3173
                            }
3174
                            else
3175
                            {
3176
                                ViewerDataModel.Instance.checkTextStyle = false;
3177
                            }
3178

    
3179
                            if ((control as ArrowTextControl).TextStyle == FontStyles.Italic)
3180
                            {
3181
                                ViewerDataModel.Instance.checkTextStyle = true;
3182
                            }
3183
                            else
3184
                            {
3185
                                ViewerDataModel.Instance.checkTextStyle = false;
3186
                            }
3187
                            if ((control as ArrowTextControl).TextWeight == FontWeights.Bold)
3188
                            {
3189
                                ViewerDataModel.Instance.checkTextWeight = true;
3190
                            }
3191
                            else
3192
                            {
3193
                                ViewerDataModel.Instance.checkTextWeight = false;
3194
                            }
3195
                            if ((control as ArrowTextControl).UnderLine == TextDecorations.Underline)
3196
                            {
3197
                                ViewerDataModel.Instance.checkUnderLine = true;
3198
                            }
3199
                            else
3200
                            {
3201
                                ViewerDataModel.Instance.checkUnderLine = false;
3202
                            }
3203
                            ViewerDataModel.Instance.checkHighlight = (control as ArrowTextControl).isHighLight;
3204
                            ViewerDataModel.Instance.TextSize = (control as ArrowTextControl).TextSize;
3205
                        }
3206
                        else if ((control as RectCloudControl) != null)
3207
                        {
3208
                            ViewerDataModel.Instance.ArcLength = (control as RectCloudControl).ArcLength;
3209
                        }
3210
                        else if ((control as CloudControl) != null)
3211
                        {
3212
                            ViewerDataModel.Instance.ArcLength = (control as CloudControl).ArcLength;
3213
                        }
3214

    
3215
                    }
3216
                    else
3217
                    {
3218
                        comment = AddAdorner();
3219
                        comment.Add(control);
3220

    
3221
                        Control_Style(control);
3222
                        UndoData.Markup_List.Add(multi_Undo_Data);
3223

    
3224
                        final = new AdornerFinal(comment);
3225
                        //다중 컨트롤 언두 저장
3226
                    }
3227

    
3228
                    ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
3229
                    {
3230
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
3231
                    });
3232

    
3233
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
3234

    
3235
                    SelectLayer.Children.Add(final);
3236
                }
3237
            }
3238

    
3239
            else if (mouseHandlingMode == MouseHandlingMode.Drawing)
3240
            {
3241
                init();
3242
                //강인구 추가(우 클릭 일 경우 커서 변경 하지 않음)
3243
                if (cursor != Cursors.SizeAll)
3244
                {
3245
                    cursor = Cursors.Cross;
3246
                    SetCursor();
3247
                }
3248
                bool init_user = false;
3249
                foreach (var user in gridViewMarkup.Items)
3250
                {
3251
                    if ((user as MarkupInfoItem).UserID == App.ViewInfo.UserID)
3252
                    {
3253
                        init_user = true;
3254
                    }
3255
                }
3256
                if (init_user && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null && e.LeftButton == MouseButtonState.Pressed)
3257
                {
3258
                    RadWindow.Alert(new DialogParameters
3259
                    {
3260
                        Theme = new VisualStudio2013Theme(),
3261
                        Header = "안내",
3262
                        Content = "기존의 코멘트가 존재합니다. 사용자 리스트에서 먼저 선택해주세요",
3263
                    });
3264
                    return;
3265
                }
3266
                else
3267
                {
3268
                    var item = gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() as MarkupInfoItem;
3269
                    if (item != null)
3270
                    {
3271
                        App.Custom_ViewInfoId = item.MarkupInfoID;
3272
                    }
3273
                }
3274

    
3275
                multi_Undo_Data = new Multi_Undo_data();
3276
                //강인구 Undo/Redo 보류
3277
                UndoData = new Undo_data()
3278
                {
3279
                    IsUndo = false,
3280
                    Event = Event_Type.Create,
3281
                    EventTime = DateTime.Now,
3282
                    Markup_List = new List<Multi_Undo_data>()
3283
                };
3284

    
3285
                 switch (controlType)
3286
                {
3287
                    case ControlType.Rectangle:
3288
                        {
3289
                            if (mouseButtonDown == MouseButton.Left)
3290
                            {
3291
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3292
                                //{
3293
                                    if (currentControl is RectangleControl)
3294
                                    {
3295
                                        //20180906 LJY TEST IsRotationDrawingEnable
3296
                                        if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3297
                                        {
3298
                                            return;
3299
                                        }
3300

    
3301
                                        CreateControl();
3302

    
3303
                                        (currentControl as RectangleControl).ApplyOverViewData();
3304
                                        currentControl = null;
3305
                                        this.cursor = Cursors.Arrow;
3306
                                    }
3307
                                    else
3308
                                    {
3309
                                        currentControl = new RectangleControl
3310
                                        {
3311
                                            Background = new SolidColorBrush(Colors.Black),
3312
                                            ControlType = ControlType.Rectangle
3313
                                        };
3314

    
3315
                                        currentControl.CommentID = Save.shortGuid();
3316
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3317
                                        currentControl.IsNew = true;
3318
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3319

    
3320
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3321
                                    }
3322
                                //}
3323
                            }
3324
                        }
3325
                        break;
3326
                    case ControlType.RectCloud:
3327
                        {
3328
                            if (mouseButtonDown == MouseButton.Left)
3329
                            {
3330
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3331
                                //{
3332
                                    if (currentControl is RectCloudControl)
3333
                                    {
3334
                                        //20180906 LJY TEST IsRotationDrawingEnable
3335
                                        if (IsGetoutpoint((currentControl as RectCloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3336
                                        {
3337
                                            return;
3338
                                        }
3339

    
3340
                                        CreateControl();
3341

    
3342
                                        (currentControl as RectCloudControl).ApplyOverViewData();
3343
                                        currentControl = null;
3344
                                        this.cursor = Cursors.Arrow;
3345
                                    }
3346
                                    else
3347
                                    {
3348
                                        currentControl = new RectCloudControl
3349
                                        {
3350
                                            Background = new SolidColorBrush(Colors.Black)
3351
                                        };
3352

    
3353
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3354
                                        currentControl.CommentID = Save.shortGuid();
3355
                                        currentControl.IsNew = true;
3356
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3357
                                    }
3358
                                //}
3359
                            }
3360
                        }
3361
                        break;
3362
                    case ControlType.Circle:
3363
                        {
3364
                            if (mouseButtonDown == MouseButton.Left)
3365
                            {
3366
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3367
                                //{
3368
                                    if (currentControl is CircleControl)
3369
                                    {
3370
                                        //20180906 LJY TEST IsRotationDrawingEnable
3371
                                        if (IsGetoutpoint((currentControl as CircleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3372
                                        {
3373
                                            return;
3374
                                        }
3375

    
3376
                                        CreateControl();
3377

    
3378
                                        (currentControl as CircleControl).ApplyOverViewData();
3379
                                        currentControl = null;
3380
                                    }
3381
                                    else
3382
                                    {
3383
                                        currentControl = new CircleControl
3384
                                        {
3385
                                            Background = new SolidColorBrush(Colors.Black)
3386
                                        };
3387

    
3388
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3389
                                        currentControl.CommentID = Save.shortGuid();
3390
                                        currentControl.IsNew = true;
3391
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3392
                                    }
3393
                                //}
3394
                            }
3395
                        }
3396
                        break;
3397
                    case ControlType.Triangle:
3398
                        {
3399
                            if (mouseButtonDown == MouseButton.Left)
3400
                            {
3401
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3402
                                //{
3403
                                    if (currentControl is TriControl)
3404
                                    {
3405
                                        var content = currentControl as TriControl;
3406
                                        if (content.MidPoint == new Point(0, 0))
3407
                                        {
3408
                                            content.MidPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
3409
                                        }
3410
                                        else
3411
                                        {
3412
                                            //20180906 LJY TEST IsRotationDrawingEnable
3413
                                            if (IsGetoutpoint((currentControl as TriControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3414
                                            {
3415
                                                return;
3416
                                            }
3417

    
3418
                                            CreateControl();
3419

    
3420
                                            (currentControl as TriControl).ApplyOverViewData();
3421
                                            currentControl = null;
3422
                                        }
3423
                                    }
3424
                                    else
3425
                                    {
3426
                                        currentControl = new TriControl
3427
                                        {
3428
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3429
                                            Background = new SolidColorBrush(Colors.Black),
3430
                                        };
3431

    
3432
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3433
                                        currentControl.CommentID = Save.shortGuid();
3434
                                        currentControl.IsNew = true;
3435
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3436
                                    }
3437
                                //}
3438
                            }
3439
                        }
3440
                        break;
3441
                    case ControlType.SingleLine:
3442
                        {
3443
                            if (mouseButtonDown == MouseButton.Left)
3444
                            {
3445
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3446
                                //{
3447
                                    if (currentControl is LineControl)
3448
                                    {
3449
                                        //20180906 LJY TEST IsRotationDrawingEnable
3450
                                        if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3451
                                        {
3452
                                            return;
3453
                                        }
3454

    
3455
                                        CreateControl();
3456

    
3457
                                        (currentControl as LineControl).ApplyOverViewData();
3458
                                        currentControl = null;
3459
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3460
                                    }
3461
                                    else
3462
                                    {
3463
                                        currentControl = new LineControl
3464
                                        {
3465
                                            Background = new SolidColorBrush(Colors.Black)
3466
                                        };
3467

    
3468
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3469
                                        currentControl.CommentID = Save.shortGuid();
3470
                                        currentControl.IsNew = true;
3471
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3472
                                        this.MainAngle.Visibility = Visibility.Visible;
3473
                                    }
3474
                                //}
3475
                            }
3476
                        }
3477
                        break;
3478
                    case ControlType.CancelLine:
3479
                        {
3480
                            if (mouseButtonDown == MouseButton.Left)
3481
                            {
3482
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3483
                                //{
3484
                                    if (currentControl is LineControl)
3485
                                    {
3486
                                        //20180906 LJY TEST IsRotationDrawingEnable
3487
                                        if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3488
                                        {
3489
                                            return;
3490
                                        }
3491

    
3492
                                        CreateControl();
3493

    
3494
                                        (currentControl as LineControl).ApplyOverViewData();
3495
                                        currentControl = null;
3496
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3497
                                    }
3498
                                    else
3499
                                    {
3500
                                        currentControl = new LineControl
3501
                                        {
3502
                                            Background = new SolidColorBrush(Colors.Black)
3503
                                        };
3504

    
3505
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3506
                                        currentControl.CommentID = Save.shortGuid();
3507
                                        currentControl.IsNew = true;
3508
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3509
                                        this.MainAngle.Visibility = Visibility.Visible;
3510
                                    }
3511
                                //}
3512
                            }
3513
                        }
3514
                        break;
3515
                    case ControlType.ArrowLine:
3516
                        {
3517
                            if (mouseButtonDown == MouseButton.Left)
3518
                            {
3519
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3520
                                //{
3521
                                    if (currentControl is LineControl)
3522
                                    {
3523
                                        //20180906 LJY TEST IsRotationDrawingEnable
3524
                                        if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3525
                                        {
3526
                                            return;
3527
                                        }
3528

    
3529
                                        CreateControl();
3530

    
3531
                                        (currentControl as LineControl).ApplyOverViewData();
3532
                                        currentControl = null;
3533
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3534
                                    }
3535
                                    else
3536
                                    {
3537
                                        currentControl = new LineControl
3538
                                        {
3539
                                            Background = new SolidColorBrush(Colors.Black)
3540
                                        };
3541

    
3542
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3543
                                        currentControl.CommentID = Save.shortGuid();
3544
                                        currentControl.IsNew = true;
3545
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3546
                                        this.MainAngle.Visibility = Visibility.Visible;
3547
                                    }
3548
                                //}
3549
                            }
3550
                        }
3551
                        break;
3552
                    case ControlType.TwinLine:
3553
                        {
3554
                            if (mouseButtonDown == MouseButton.Left)
3555
                            {
3556
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3557
                                //{
3558
                                    if (currentControl is LineControl)
3559
                                    {
3560
                                        //20180906 LJY TEST IsRotationDrawingEnable
3561
                                        if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3562
                                        {
3563
                                            return;
3564
                                        }
3565

    
3566
                                        CreateControl();
3567

    
3568
                                        (currentControl as LineControl).ApplyOverViewData();
3569
                                        currentControl = null;
3570
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3571
                                    }
3572
                                    else
3573
                                    {
3574
                                        currentControl = new LineControl
3575
                                        {
3576
                                            Background = new SolidColorBrush(Colors.Black)
3577
                                        };
3578
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3579
                                        currentControl.CommentID = Save.shortGuid();
3580
                                        currentControl.IsNew = true;
3581
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3582
                                        this.MainAngle.Visibility = Visibility.Visible;
3583
                                    }
3584
                                //}
3585
                            }
3586
                        }
3587
                        break;
3588
                    case ControlType.DimLine:
3589
                        {
3590
                            if (mouseButtonDown == MouseButton.Left)
3591
                            {
3592
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3593
                                //{
3594
                                    if (currentControl is LineControl)
3595
                                    {
3596
                                        //20180906 LJY TEST IsRotationDrawingEnable
3597
                                        if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3598
                                        {
3599
                                            return;
3600
                                        }
3601
                                        CreateControl();
3602

    
3603
                                        (currentControl as LineControl).ApplyOverViewData();
3604
                                        currentControl = null;
3605
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3606
                                    }
3607
                                    else
3608
                                    {
3609
                                        currentControl = new LineControl
3610
                                        {
3611
                                            Background = new SolidColorBrush(Colors.Black)
3612
                                        };
3613
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3614
                                        currentControl.CommentID = Save.shortGuid();
3615
                                        currentControl.IsNew = true;
3616
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3617
                                        this.MainAngle.Visibility = Visibility.Visible;
3618
                                    }
3619
                                //}
3620
                            }
3621
                        }
3622
                        break;
3623
                    case ControlType.ChainLine:
3624
                        {
3625
                            if (currentControl is PolygonControl)
3626
                            {
3627
                                var control = currentControl as PolygonControl;
3628

    
3629
                                if (mouseButtonDown == MouseButton.Right)
3630
                                {
3631
                                    //20180906 LJY TEST IsRotationDrawingEnable
3632
                                    if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3633
                                    {
3634
                                        return;
3635
                                    }
3636

    
3637
                                    CreateControl();
3638

    
3639
                                    (currentControl as PolygonControl).ApplyOverViewData();
3640
                                    currentControl = null;
3641
                                    this.MainAngle.Visibility = Visibility.Collapsed;
3642
                                    return;
3643
                                }
3644

    
3645
                                if (!control.IsCompleted)
3646
                                {
3647
                                    control.PointSet.Add(control.EndPoint);
3648
                                    this.MainAngle.Visibility = Visibility.Visible;
3649
                                }
3650
                            }
3651
                            else
3652
                            {
3653
                                if (mouseButtonDown == MouseButton.Left)
3654
                                {
3655
                                    MainAngle.Visibility = Visibility.Visible;
3656
                                    currentControl = new PolygonControl
3657
                                    {
3658
                                        PointSet = new List<Point>(),
3659
                                        //강인구 추가(ChainLine일때는 채우기 스타일을 주지 않기 위해 설정)
3660
                                        ControlType = ControlType.ChainLine,
3661
                                        DashSize = ViewerDataModel.Instance.DashSize,
3662
                                        LineSize = ViewerDataModel.Instance.LineSize,
3663
                                        //PointC = new StylusPointSet()
3664
                                    };
3665

    
3666
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3667
                                    //{
3668
                                        var polygonControl = (currentControl as PolygonControl);
3669
                                        currentControl.CommentID = Save.shortGuid();
3670
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3671
                                        currentControl.IsNew = true;
3672
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3673
                                        //currentControl.OnApplyTemplate();
3674
                                        //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint);
3675
                                        //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint);
3676
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3677
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3678
                                    //}
3679
                                }
3680
                            }
3681
                        }
3682
                        break;
3683
                    case ControlType.ArcLine:
3684
                        {
3685
                            if (mouseButtonDown == MouseButton.Left)
3686
                            {
3687
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3688
                                //{
3689
                                    if (currentControl is ArcControl)
3690
                                    {
3691
                                        //20180906 LJY TEST IsRotationDrawingEnable
3692
                                        if (IsGetoutpoint((currentControl as ArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3693
                                        {
3694
                                            return;
3695
                                        }
3696

    
3697
                                        CreateControl();
3698

    
3699
                                        (currentControl as ArcControl).ApplyOverViewData();
3700
                                        currentControl = null;
3701
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3702
                                    }
3703
                                    else
3704
                                    {
3705
                                        currentControl = new ArcControl
3706
                                        {
3707
                                            Background = new SolidColorBrush(Colors.Black)
3708
                                        };
3709
                                        currentControl.CommentID = Save.shortGuid();
3710
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3711
                                        currentControl.IsNew = true;
3712
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3713
                                        this.MainAngle.Visibility = Visibility.Visible;
3714
                                    }
3715
                                //}
3716
                            }
3717
                            else if (mouseButtonDown == MouseButton.Right)
3718
                            {
3719
                                if (currentControl != null)
3720
                                {
3721
                                    (currentControl as ArcControl).setClock();
3722
                                    (currentControl as ArcControl).MidPoint = new Point(0, 0);
3723
                                    //(currentControl as ArcControl).ApplyTemplate();
3724
                                }
3725
                            }
3726
                        }
3727
                        break;
3728
                    case ControlType.ArcArrow:
3729
                        {
3730
                            if (mouseButtonDown == MouseButton.Left)
3731
                            {
3732
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3733
                                //{
3734
                                    if (currentControl is ArcControl)
3735
                                    {
3736
                                        //20180906 LJY TEST IsRotationDrawingEnable
3737
                                        if (IsGetoutpoint((currentControl as ArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3738
                                        {
3739
                                            return;
3740
                                        }
3741

    
3742
                                        CreateControl();
3743

    
3744
                                        (currentControl as ArcControl).ApplyOverViewData();
3745
                                        currentControl = null;
3746
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3747
                                    }
3748
                                    else
3749
                                    {
3750
                                        currentControl = new ArcControl
3751
                                        {
3752
                                            Background = new SolidColorBrush(Colors.Red),
3753
                                        };
3754
                                        currentControl.CommentID = Save.shortGuid();
3755
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3756
                                        currentControl.IsNew = true;
3757
                                        (currentControl as IMarkupCommonData).ControlType = ControlType.ArcArrow;
3758
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3759
                                        this.MainAngle.Visibility = Visibility.Visible;
3760
                                    }
3761
                                //}
3762
                            }
3763
                            else if (mouseButtonDown == MouseButton.Right)
3764
                            {
3765
                                (currentControl as ArcControl).setClock();
3766
                            }
3767
                        }
3768
                        break;
3769
                    case ControlType.ArrowMultiLine:
3770
                        {
3771
                            if (mouseButtonDown == MouseButton.Left)
3772
                            {
3773
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3774
                                //{
3775

    
3776
                                    if (currentControl is ArrowControl_Multi)
3777
                                    {
3778
                                        var content = currentControl as ArrowControl_Multi;
3779
                                        if (content.MiddlePoint == new Point(0, 0))
3780
                                        {
3781
                                            if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
3782
                                            {
3783
                                                content.MiddlePoint = content.EndPoint;
3784
                                            }
3785
                                            else
3786
                                            {
3787
                                                content.MiddlePoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
3788
                                            }
3789
                                        }
3790
                                        else
3791
                                        {
3792
                                            //20180906 LJY TEST IsRotationDrawingEnable
3793
                                            if (IsGetoutpoint((currentControl as ArrowControl_Multi).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3794
                                            {
3795
                                                return;
3796
                                            }
3797

    
3798
                                            CreateControl();
3799

    
3800
                                            (currentControl as ArrowControl_Multi).ApplyOverViewData();
3801
                                            currentControl = null;
3802
                                            this.MainAngle.Visibility = Visibility.Collapsed;
3803
                                        }
3804
                                    }
3805
                                    else
3806
                                    {
3807
                                        currentControl = new ArrowControl_Multi
3808
                                        {
3809
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3810
                                            Background = new SolidColorBrush(Colors.Black)
3811
                                        };
3812
                                        currentControl.CommentID = Save.shortGuid();
3813
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3814
                                        currentControl.IsNew = true;
3815
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3816
                                        this.MainAngle.Visibility = Visibility.Visible;
3817
                                    }
3818
                                //}
3819
                            }
3820
                        }
3821
                        break;
3822
                    case ControlType.PolygonCloud:
3823
                        {
3824
                            if (currentControl is CloudControl)
3825
                            {
3826
                                var control = currentControl as CloudControl;
3827
                                if (mouseButtonDown == MouseButton.Right)
3828
                                {
3829
                                    control.IsCompleted = true;
3830
                                }
3831

    
3832
                                if (!control.IsCompleted)
3833
                                {
3834
                                    control.PointSet.Add(control.EndPoint);
3835
                                }
3836
                                else
3837
                                {
3838
                                    //20180906 LJY TEST IsRotationDrawingEnable
3839
                                    if (IsGetoutpoint((currentControl as CloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3840
                                    {
3841
                                        return;
3842
                                    }
3843

    
3844
                                    CreateControl();
3845

    
3846
                                    control.isTransOn = true;
3847
                                    var firstPoint = control.PointSet.First();
3848

    
3849
                                    control.PointSet.Add(firstPoint);
3850
                                    control.DrawingCloud();
3851
                                    control.ApplyOverViewData();
3852

    
3853
                                    currentControl = null;
3854
                                }
3855
                            }
3856
                            else
3857
                            {
3858
                                if (mouseButtonDown == MouseButton.Left)
3859
                                {
3860
                                    currentControl = new CloudControl
3861
                                    {
3862
                                        PointSet = new List<Point>(),
3863
                                        PointC = new StylusPointSet()
3864
                                    };
3865

    
3866
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3867
                                    //{
3868
                                        var polygonControl = (currentControl as CloudControl);
3869
                                        currentControl.CommentID = Save.shortGuid();
3870
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3871
                                        currentControl.IsNew = true;
3872
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3873

    
3874
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3875
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3876
                                    //}
3877
                                }
3878
                            }
3879
                        }
3880
                        break;
3881
                    case ControlType.ImgControl:
3882
                        {
3883
                            if (mouseButtonDown == MouseButton.Left)
3884
                            {
3885
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3886
                                //{
3887
                                    if (currentControl is ImgControl)
3888
                                    {
3889
                                        //20180906 LJY TEST IsRotationDrawingEnable
3890
                                        if (IsGetoutpoint((currentControl as ImgControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3891
                                        {
3892
                                            return;
3893
                                        }
3894

    
3895
                                        CreateControl();
3896
                                        (currentControl as ImgControl).ApplyOverViewData();
3897

    
3898
                                        currentControl = null;
3899
                                    }
3900
                                    else
3901
                                    {
3902
                                        string extension = System.IO.Path.GetExtension(filename).ToUpper();
3903
                                        if (extension == ".PNG" || extension == ".JPEG" || extension == ".GIF" || extension == ".BMP" || extension == ".JPG")
3904
                                        {
3905
                                            Image img = new Image();
3906
                                            img.Source = new BitmapImage(new Uri(filename));
3907

    
3908
                                            currentControl = new ImgControl
3909
                                            {
3910
                                                Background = new SolidColorBrush(Colors.Black),
3911
                                                PointSet = new List<Point>(),
3912
                                                FilePath = filename,
3913
                                                ImageData = img.Source,
3914
                                                StartPoint = canvasDrawingMouseDownPoint,
3915
                                                EndPoint = new Point(canvasDrawingMouseDownPoint.X + 100, canvasDrawingMouseDownPoint.Y + 100),
3916
                                                TopRightPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y + 100),
3917
                                                LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X + 100, canvasDrawingMouseDownPoint.Y)
3918
                                            };
3919

    
3920
                                            currentControl.CommentID = Save.shortGuid();
3921
                                            currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3922
                                            currentControl.IsNew = true;
3923
                                            ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3924

    
3925
                                            //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
3926
                                            (currentControl as ImgControl).Angle -= rotate.Angle;
3927
                                    }
3928
                                    }
3929
                                //}
3930
                            }
3931
                        }
3932
                        break;
3933
                    case ControlType.Date:
3934
                        {
3935
                            if (mouseButtonDown == MouseButton.Left)
3936
                            {
3937
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3938
                                //{
3939
                                    if (currentControl is DateControl)
3940
                                    {
3941
                                        //20180906 LJY TEST IsRotationDrawingEnable
3942
                                        if (IsGetoutpoint((currentControl as DateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3943
                                        {
3944
                                            return;
3945
                                        }
3946

    
3947
                                        CreateControl();
3948
                                        (currentControl as DateControl).ApplyOverViewData();
3949
                                        currentControl = null;
3950

    
3951
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
3952
                                        {
3953
                                            controlType = ControlType.None;
3954
                                            IsSwingMode = false;
3955
                                            Common.ViewerDataModel.Instance.SelectedControl = "";
3956
                                            Common.ViewerDataModel.Instance.ControlTag = null;
3957
                                            mouseHandlingMode = MouseHandlingMode.None;
3958
                                            this.ParentOfType<MainWindow>().dzTopMenu.btn_Batch.IsChecked = false;
3959
                                            txtBatch.Visibility = Visibility.Collapsed;
3960

    
3961
                                        }
3962
                                    }
3963
                                    else
3964
                                    {
3965
                                        currentControl = new DateControl
3966
                                        {
3967
                                            Background = new SolidColorBrush(Colors.Black)
3968
                                        };
3969
                                        currentControl.CommentID = Save.shortGuid();
3970
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3971
                                        currentControl.IsNew = true;
3972
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3973

    
3974
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
3975
                                        (currentControl as DateControl).Angle -= rotate.Angle;
3976
                                }
3977
                                //}
3978
                            }
3979
                        }
3980
                        break;
3981
                    case ControlType.TextControl:
3982
                        {
3983
                            if (mouseButtonDown == MouseButton.Left)
3984
                            {
3985
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3986
                                {
3987
                                    currentControl = new TextControl
3988
                                    {
3989
                                        ControlType = controlType
3990
                                    };
3991
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
3992
                                    currentControl.CommentID = Save.shortGuid();
3993
                                    currentControl.IsNew = true;
3994
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3995
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3996
                                    currentControl.SetValue(Canvas.ZIndexProperty, 2);
3997
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
3998
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);
3999
                                    currentControl.Focus();
4000
                                    (currentControl as TextControl).ApplyOverViewData();
4001
                                    (currentControl as TextControl).ControlType_No = 0;
4002
                                    (currentControl as TextControl).Angle -= rotate.Angle;
4003
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
4004

    
4005
                                    CreateControl();
4006

    
4007
                                    //currentControl = null;
4008
                                }
4009
                            }
4010
                        }
4011
                        break;
4012
                    case ControlType.TextBorder:
4013
                        {
4014
                            if (mouseButtonDown == MouseButton.Left)
4015
                            {
4016
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4017
                                {
4018
                                    currentControl = new TextControl
4019
                                    {
4020
                                        ControlType = controlType
4021
                                    };
4022

    
4023
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
4024
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4025
                                    currentControl.CommentID = Save.shortGuid();
4026
                                    currentControl.IsNew = true;
4027
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4028
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
4029
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
4030
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);
4031
                                    currentControl.Focus();
4032
                                    (currentControl as TextControl).ControlType_No = 1;
4033
                                    (currentControl as TextControl).Angle = Ang;
4034
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
4035
                                    CreateControl();
4036

    
4037
                                    //currentControl = null;
4038
                                }
4039
                            }
4040
                        }
4041
                        break;
4042
                    case ControlType.TextCloud:
4043
                        {
4044
                            if (mouseButtonDown == MouseButton.Left)
4045
                            {
4046
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4047
                                {
4048
                                    currentControl = new TextControl
4049
                                    {
4050
                                        ControlType = controlType
4051
                                    };
4052

    
4053
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
4054
                                    currentControl.CommentID = Save.shortGuid();
4055
                                    currentControl.IsNew = true;
4056
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4057
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4058

    
4059
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
4060
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
4061
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);
4062
                                    currentControl.Focus();
4063

    
4064
                                    (currentControl as TextControl).Angle = Ang;
4065
                                    (currentControl as TextControl).ControlType_No = 2;
4066
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
4067

    
4068
                                    CreateControl();
4069
                                    //currentControl = null;
4070
                                }
4071
                            }
4072
                        }
4073
                        break;
4074
                    case ControlType.ArrowTextControl:
4075
                         {
4076
                            if (mouseButtonDown == MouseButton.Left)
4077
                            {
4078
                                if (currentControl is ArrowTextControl)
4079
                                {
4080
                                    //20180906 LJY TEST IsRotationDrawingEnable
4081
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4082
                                    {
4083
                                        return;
4084
                                    }                                    
4085

    
4086
                                    CreateControl();
4087

    
4088
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4089
                                    (currentControl as ArrowTextControl).IsEditing = false;
4090
                                    (currentControl as ArrowTextControl).EnableEditing = false;
4091
                                    (currentControl as ArrowTextControl).IsNew = false;
4092
                                    currentControl = null;
4093
                                }
4094
                                else
4095
                                {
4096
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4097
                                    //{
4098
                                        currentControl = new ArrowTextControl();
4099
                                        currentControl.CommentID = Save.shortGuid();
4100
                                        currentControl.IsNew = true;
4101
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4102
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4103

    
4104
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4105
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4106
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);
4107
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4108
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4109

    
4110
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
4111
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
4112

    
4113
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4114
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4115
                                        this.MainAngle.Visibility = Visibility.Visible;
4116

    
4117
                                    
4118
                                    //}
4119
                                }
4120
                            }
4121
                        }
4122
                        break;
4123
                    case ControlType.ArrowTransTextControl:
4124
                        {
4125
                            if (mouseButtonDown == MouseButton.Left)
4126
                            {
4127
                                if (currentControl is ArrowTextControl)
4128
                                {
4129
                                    //20180906 LJY TEST IsRotationDrawingEnable
4130
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4131
                                    {
4132
                                        return;
4133
                                    }                                    
4134

    
4135
                                    CreateControl();
4136
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4137
                                    currentControl.IsNew = false;
4138
                                    currentControl = null;
4139
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4140
                                }
4141
                                else
4142
                                {
4143
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4144
                                    //{
4145
                                         currentControl = new ArrowTextControl();
4146
                                        currentControl.CommentID = Save.shortGuid();
4147
                                        currentControl.IsNew = true;
4148
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4149
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4150
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4151
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4152
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                  
4153
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4154
                                        (currentControl as ArrowTextControl).isFixed = true;
4155
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4156

    
4157
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
4158
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
4159

    
4160
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4161
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4162
                                        (currentControl as ArrowTextControl).isTrans = true;
4163
                                }
4164
                            }
4165
                        }
4166
                        break;
4167
                    case ControlType.ArrowTextBorderControl:
4168
                         {
4169
                            if (mouseButtonDown == MouseButton.Left)
4170
                            {
4171
                                if (currentControl is ArrowTextControl)
4172
                                {
4173
                                    //20180906 LJY TEST IsRotationDrawingEnable
4174
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4175
                                    {
4176
                                        return;
4177
                                    }
4178

    
4179
                                    CreateControl();
4180
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4181
                                    currentControl.IsNew = false;
4182
                                    currentControl = null;
4183
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4184
                                }
4185
                                else
4186
                                {
4187
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4188
                                    //{
4189
                                        currentControl = new ArrowTextControl()
4190
                                        {
4191
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect
4192
                                        };
4193
                                        currentControl.CommentID = Save.shortGuid();
4194
                                        currentControl.IsNew = true;
4195
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4196
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4197

    
4198
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4199

    
4200
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4201

    
4202
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);
4203
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4204
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4205

    
4206
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
4207
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
4208
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4209
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4210
                                        this.MainAngle.Visibility = Visibility.Visible;                                    
4211
                                    //}
4212
                                }
4213
                            }
4214
                        }
4215
                        break;
4216
                    case ControlType.ArrowTransTextBorderControl:
4217
                        {
4218
                            if (mouseButtonDown == MouseButton.Left)
4219
                            {
4220
                                if (currentControl is ArrowTextControl)
4221
                                {
4222
                                    //20180906 LJY TEST IsRotationDrawingEnable
4223
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4224
                                    {
4225
                                        return;
4226
                                    }
4227
                                    CreateControl();
4228
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4229
                                    currentControl.IsNew = false;
4230
                                    currentControl = null;
4231
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4232
                                }
4233
                                else
4234
                                {
4235
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4236
                                    //{
4237
                                    
4238

    
4239
                                    currentControl = new ArrowTextControl()
4240
                                        {
4241
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect
4242
                                        };
4243
                                        currentControl.CommentID = Save.shortGuid();
4244
                                        currentControl.IsNew = true;
4245
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4246
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4247

    
4248
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4249

    
4250
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4251
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                                    
4252
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4253
                                        (currentControl as ArrowTextControl).isFixed = true;
4254
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4255
                                     
4256
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
4257
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
4258
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4259

    
4260
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();                                 
4261
                                        this.MainAngle.Visibility = Visibility.Visible;
4262
                                    
4263
                                    //20180911 LJY
4264
                                        (currentControl as ArrowTextControl).isTrans = true;
4265
                                    
4266

    
4267
                                    //}
4268
                                }
4269
                            }
4270
                        }
4271
                        break;
4272
                    case ControlType.ArrowTextCloudControl:
4273
                        {
4274
                            if (mouseButtonDown == MouseButton.Left)
4275
                            {
4276
                                if (currentControl is ArrowTextControl)
4277
                                {
4278
                                    //20180906 LJY TEST IsRotationDrawingEnable
4279
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4280
                                    {
4281
                                        return;
4282
                                    }
4283
                                    CreateControl();
4284
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4285
                                    currentControl.IsNew = false;
4286
                                    currentControl = null;
4287
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4288
                                }
4289
                                else
4290
                                {
4291
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4292
                                    //{
4293
                                        currentControl = new ArrowTextControl()
4294
                                        {
4295
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud
4296
                                        };
4297
                                        currentControl.CommentID = Save.shortGuid();
4298
                                        currentControl.IsNew = true;
4299
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4300
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4301

    
4302
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4303
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4304
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                                 
4305
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4306
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4307

    
4308
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
4309
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
4310
                                    
4311
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4312
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4313
                                        this.MainAngle.Visibility = Visibility.Visible;                                        
4314
                                    //}
4315
                                }
4316
                            }
4317
                        }
4318
                        break;
4319
                    case ControlType.ArrowTransTextCloudControl:
4320
                        {
4321
                            if (mouseButtonDown == MouseButton.Left)
4322
                            {
4323
                                if (currentControl is ArrowTextControl)
4324
                                {
4325
                                    //20180906 LJY TEST IsRotationDrawingEnable
4326
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4327
                                    {
4328
                                        return;
4329
                                    }
4330
                                    CreateControl();
4331
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4332
                                    currentControl.IsNew = false;
4333
                                    currentControl = null;
4334
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4335
                                }
4336
                                else
4337
                                {
4338
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4339
                                    //{
4340
                                        currentControl = new ArrowTextControl()
4341
                                        {
4342
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud
4343
                                        };
4344
                                        currentControl.CommentID = Save.shortGuid();
4345
                                        currentControl.IsNew = true; 
4346
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4347
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4348
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4349

    
4350
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4351
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                                        
4352
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4353
                                        (currentControl as ArrowTextControl).isFixed = true;
4354
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4355

    
4356
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
4357
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
4358

    
4359
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4360
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4361
                                        this.MainAngle.Visibility = Visibility.Visible;  
4362
                                    
4363
                                    //20180911 LJY
4364
                                        (currentControl as ArrowTextControl).isTrans = true;
4365
                                    //}
4366
                                }
4367
                            }
4368
                        }
4369
                        break;
4370
                    case ControlType.PolygonControl:
4371
                        {
4372
                            if (currentControl is PolygonControl)
4373
                            {
4374
                                var control = currentControl as PolygonControl;
4375

    
4376
                                if (mouseButtonDown == MouseButton.Right)
4377
                                {
4378
                                    control.IsCompleted = true;
4379
                                }
4380

    
4381
                                if (!control.IsCompleted)
4382
                                {
4383
                                    control.PointSet.Add(control.EndPoint);
4384
                                }
4385
                                else
4386
                                {
4387
                                    //20180906 LJY TEST IsRotationDrawingEnable
4388
                                    if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4389
                                    {
4390
                                        return;
4391
                                    }
4392

    
4393
                                    var firstPoint = control.PointSet.First();
4394
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
4395
                                    control.LineSize = ViewerDataModel.Instance.LineSize;
4396
                                    control.PointSet.Add(firstPoint);
4397

    
4398
                                    control.SetPolyPath();
4399

    
4400
                                    control.ApplyOverViewData();
4401

    
4402
                                    CreateControl();
4403

    
4404
                                    currentControl = null;
4405
                                }
4406
                            }
4407
                            else
4408
                            {
4409
                                if (mouseButtonDown == MouseButton.Left)
4410
                                {
4411
                                    currentControl = new PolygonControl
4412
                                    {
4413
                                        PointSet = new List<Point>(),
4414
                                        //PointC = new StylusPointSet()
4415
                                    };
4416

    
4417
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4418
                                    //{
4419
                                        var polygonControl = (currentControl as PolygonControl);
4420
                                        currentControl.CommentID = Save.shortGuid();
4421
                                        currentControl.IsNew = true;
4422
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4423
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4424
                                        //currentControl.OnApplyTemplate();
4425
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
4426
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
4427
                                    //}
4428
                                }
4429
                            }
4430
                        }
4431
                        break;
4432
                    //강인구 추가
4433
                    case ControlType.Sign:
4434
                        {
4435
                            if (mouseButtonDown == MouseButton.Left)
4436
                            {
4437
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4438
                                //{
4439
                                    GetUserSign getUser = new GetUserSign();
4440
                                    var _sign = getUser.GetSign(App.ViewInfo.UserID, App.ViewInfo.ProjectNO);
4441

    
4442
                                    if (_sign == null)
4443
                                    {
4444
                                        txtBatch.Visibility = Visibility.Collapsed;
4445
                                        mouseHandlingMode = IKCOM.MouseHandlingMode.None;
4446
                                        controlType = ControlType.None;
4447

    
4448
                                        this.ParentOfType<MainWindow>().DialogMessage_Alert("등록된 Sign이 없습니다.", "Alert");
4449
                                        this.ParentOfType<MainWindow>().ChildrenOfType<RadToggleButton>().Where(data => data.IsChecked == true).FirstOrDefault().IsChecked = false;
4450
                                        return;
4451
                                    }
4452

    
4453
                                    if (currentControl is SignControl)
4454
                                    {
4455
                                        //20180906 LJY TEST IsRotationDrawingEnable
4456
                                        if (IsGetoutpoint((currentControl as SignControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4457
                                        {
4458
                                            return;
4459
                                        }
4460

    
4461
                                        CreateControl();
4462
                                        currentControl = null;
4463
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
4464
                                        {
4465
                                            txtBatch.Text = "Place Date";
4466
                                            controlType = ControlType.Date;
4467
                                        }
4468
                                    }
4469
                                    else
4470
                                    {
4471
                                        currentControl = new SignControl
4472
                                        {
4473
                                            Background = new SolidColorBrush(Colors.Black),
4474
                                            UserNumber = App.ViewInfo.UserID,
4475
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
4476
                                            EndPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
4477
                                            ControlType = ControlType.Sign
4478
                                        };
4479

    
4480
                                        currentControl.CommentID = Save.shortGuid();
4481
                                        currentControl.IsNew = true;
4482
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4483
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4484

    
4485
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
4486
                                        (currentControl as SignControl).Angle -= rotate.Angle;                                    
4487
                                }
4488
                                //}
4489
                            }
4490
                        }
4491
                        break;
4492
                    case ControlType.Mark:
4493
                        {
4494
                            if (mouseButtonDown == MouseButton.Left)
4495
                            {
4496
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4497
                                //{
4498
                                    if (currentControl is RectangleControl)
4499
                                    {
4500
                                        //20180906 LJY TEST IsRotationDrawingEnable
4501
                                        if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4502
                                        {
4503
                                            return;
4504
                                        }
4505

    
4506
                                        CreateControl();
4507
                                        (currentControl as RectangleControl).ApplyOverViewData();
4508
                                        currentControl = null;
4509
                                        this.cursor = Cursors.Arrow;
4510

    
4511
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
4512
                                        {
4513
                                            txtBatch.Text = "Place Signature";
4514
                                            controlType = ControlType.Sign;
4515
                                        }
4516
                                    }
4517
                                    else
4518
                                    {
4519
                                        currentControl = new RectangleControl
4520
                                        {
4521
                                            Background = new SolidColorBrush(Colors.Black),
4522
                                            Paint = PaintSet.Fill
4523
                                        };
4524

    
4525
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4526
                                        currentControl.CommentID = Save.shortGuid();
4527
                                        currentControl.IsNew = true;
4528
                                        (currentControl as RectangleControl).DashSize = ViewerDataModel.Instance.DashSize;
4529
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4530
                                    }
4531
                                //}
4532
                            }
4533
                        }
4534
                        break;
4535
                    case ControlType.Symbol:
4536
                        {
4537
                            if (mouseButtonDown == MouseButton.Left)
4538
                            {
4539
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4540
                                //{
4541
                                    if (currentControl is SymControl)
4542
                                    {
4543
                                        //20180906 LJY TEST IsRotationDrawingEnable
4544
                                        if (IsGetoutpoint((currentControl as SymControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4545
                                        {
4546
                                            return;
4547
                                        }
4548
                                        CreateControl();
4549
                                        currentControl = null;
4550
                                        this.cursor = Cursors.Arrow;
4551
                                    }
4552
                                    else
4553
                                    {
4554
                                        currentControl = new SymControl
4555
                                        {
4556
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
4557
                                            Background = new SolidColorBrush(Colors.Black),
4558
                                            ControlType = ControlType.Symbol
4559
                                        };
4560

    
4561
                                        currentControl.IsNew = true;
4562
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4563
                                        currentControl.CommentID = Save.shortGuid();
4564
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4565

    
4566
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
4567
                                        (currentControl as SymControl).Angle -= rotate.Angle;
4568
                                }
4569
                                //}
4570
                            }
4571
                        }
4572
                        break;
4573
                    case ControlType.Stamp:
4574
                        {
4575
                            if (mouseButtonDown == MouseButton.Left)
4576
                            {
4577
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4578
                                //{
4579
                                    if (currentControl is SymControlN)
4580
                                    {
4581
                                        //20180906 LJY TEST IsRotationDrawingEnable
4582
                                        if (IsGetoutpoint((currentControl as SymControlN).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4583
                                        {
4584
                                            return;
4585
                                        }
4586

    
4587
                                        CreateControl();
4588
                                        currentControl = null;
4589
                                        this.cursor = Cursors.Arrow;
4590
                                    }
4591
                                    else
4592
                                    {
4593
                                        currentControl = new SymControlN
4594
                                        {
4595
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
4596
                                            Background = new SolidColorBrush(Colors.Black),
4597
                                            ControlType = ControlType.Stamp
4598
                                        };
4599

    
4600
                                        currentControl.IsNew = true;
4601
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4602
                                        currentControl.CommentID = Save.shortGuid();
4603
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4604
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
4605
                                        (currentControl as SymControlN).Angle -= rotate.Angle;
4606
                                }                                    
4607
                                //}
4608
                            }
4609
                        }
4610
                        break;
4611
                    case ControlType.PenControl:
4612
                        {
4613
                            if (inkBoard.Tag.ToString() == "Ink")
4614
                            {
4615
                                inkBoard.IsEnabled = true;
4616
                                StartNewStroke(canvasDrawingMouseDownPoint);
4617
                            }
4618
                            else if (inkBoard.Tag.ToString() == "EraseByPoint")
4619
                            {
4620
                                RemovePointStroke(canvasDrawingMouseDownPoint);
4621
                            }
4622
                            else if (inkBoard.Tag.ToString() == "EraseByStroke")
4623
                            {
4624
                                RemoveLineStroke(canvasDrawingMouseDownPoint);
4625
                            }
4626
                            IsDrawing = true;
4627

    
4628
                            temp.AddTemp(currentControl, pageNavigator.CurrentPage.PageNumber);
4629
                            return;
4630
                        }
4631
                    default:
4632
                        if (currentControl != null)
4633
                        {
4634
                            currentControl.CommentID = null;
4635
                            currentControl.IsNew = false;
4636
                        }
4637
                        break;
4638
                }
4639
            }
4640
            if (mouseHandlingMode != MouseHandlingMode.None && mouseButtonDown == MouseButton.Left)
4641
            {
4642
                if (mouseHandlingMode == MouseHandlingMode.Adorner && SelectLayer.Children.Count > 0)
4643
                {
4644
                    bool mouseOff = false;
4645
                    foreach (var item in SelectLayer.Children)
4646
                    {
4647
                        if (item is AdornerFinal)
4648
                        {
4649

    
4650
                            var over = (item as AdornerFinal).MemberSet.Where(data => data.DrawingData.IsMouseOver).FirstOrDefault();
4651
                            if (over != null)
4652
                            {
4653
                                mouseOff = true;
4654
                            }
4655
                        }
4656
                    }
4657

    
4658
                    if (!mouseOff)
4659
                    {
4660
                        ReleaseAdorner();
4661
                    }
4662
                }
4663
                zoomAndPanControl.CaptureMouse();
4664
                e.Handled = true;
4665
            }
4666
        }
4667

    
4668
        private void zoomAndPanControl2_MouseDown(object sender, MouseButtonEventArgs e)
4669
        {
4670
            mouseButtonDown = e.ChangedButton;
4671
            canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas2);
4672
        }
4673

    
4674
        private void RemoveLineStroke(Point P)
4675
        {
4676
            var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
4677
            if (control != null)
4678
            {
4679
                UndoData = new Undo_data()
4680
                {
4681
                    IsUndo = false,
4682
                    Event = Event_Type.Delete,
4683
                    EventTime = DateTime.Now,
4684
                    Markup_List = new List<Multi_Undo_data>()
4685
                };
4686

    
4687

    
4688
                multi_Undo_Data.Markup = control as MarkupToPDF.Common.CommentUserInfo;
4689
                UndoData.Markup_List.Add(multi_Undo_Data);
4690
                multi_Undo_Data = new Multi_Undo_data();
4691

    
4692
                ViewerDataModel.Instance.MarkupControls_USER.Remove(control);
4693
                var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (control as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault();
4694
                ViewerDataModel.Instance.MarkupList_USER.Remove(Item_);
4695

    
4696

    
4697
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
4698
                {
4699
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
4700
                });
4701
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
4702

    
4703
            }
4704
        }
4705

    
4706
        private void RemovePointStroke(Point P)
4707
        {
4708
            foreach (Stroke hits in inkBoard.Strokes)
4709
            {
4710
                foreach (StylusPoint sty in hits.StylusPoints)
4711
                {
4712

    
4713
                }
4714
                if (hits.HitTest(P))
4715
                {
4716
                    inkBoard.Strokes.Remove(hits);
4717
                    return;
4718
                }
4719
            }
4720
        }
4721

    
4722
        private void StartNewStroke(Point P)
4723
        {
4724
            strokePoints = new StylusPointCollection();
4725
            StylusPoint segment1Start = new StylusPoint(P.X, P.Y);
4726
            strokePoints.Add(segment1Start);
4727
            stroke = new Stroke(strokePoints);
4728

    
4729
            stroke.DrawingAttributes.Color = Colors.Red;
4730
            stroke.DrawingAttributes.Width = 4;
4731
            stroke.DrawingAttributes.Height = 4;
4732

    
4733
            inkBoard.Strokes.Add(stroke);
4734

    
4735
        }
4736

    
4737
        private void btnConsolidate_Click(object sender, RoutedEventArgs e)
4738
        {
4739
            ConsolidationMethod();
4740
        }
4741

    
4742
        public void TeamConsolidationMethod()
4743
        {
4744
            ChangeCommentReact();
4745
            if (this.gridViewMarkup.SelectedItems.Count == 0)
4746
            {
4747
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
4748
            }
4749
            else
4750
            {
4751
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
4752
                {
4753
                    if (!this.userData.DEPARTMENT.Equals(item.Depatment))
4754
                    {
4755
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at your department", "Alert");
4756
                        return;
4757
                    }                    
4758
                }
4759
                ViewerDataModel.Instance.IsConsolidate = true;
4760
                this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
4761
                List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>();
4762

    
4763
                string project_no = App.ViewInfo.ProjectNO;
4764
                string doc_id = _DocInfo.ID;
4765
                string user_id = App.ViewInfo.UserID;
4766
                List<MarkupInfoItem> markupInfoItems = new List<MarkupInfoItem>();
4767
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
4768
                {                    
4769
                    markupInfoItems.Add(item);
4770
                }
4771
                this.BaseClient.TeamConsolidate(project_no, user_id, doc_id, markupInfoItems);
4772

    
4773
                this.BaseClient.GetMarkupInfoItemsAsync(App.ViewInfo.ProjectNO, _DocInfo.ID);
4774
            }
4775
        }
4776
        public void ConsolidationMethod()
4777
        {
4778
            ChangeCommentReact();
4779

    
4780
            if (this.gridViewMarkup.SelectedItems.Count == 0)
4781
            {
4782
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
4783
            }
4784
            else
4785
            {                                
4786
                ViewerDataModel.Instance.IsConsolidate = true;
4787
                this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
4788
                List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>();
4789

    
4790
                string project_no = App.ViewInfo.ProjectNO;
4791
                string doc_id = _DocInfo.ID;
4792
                string user_id = App.ViewInfo.UserID;
4793
                List<MarkupInfoItem> markupInfoItems = new List<MarkupInfoItem>();
4794
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
4795
                {
4796
                    markupInfoItems.Add(item);
4797
                }
4798
                this.BaseClient.Consolidate(project_no, user_id, doc_id, markupInfoItems);
4799
                
4800
                this.BaseClient.GetMarkupInfoItemsAsync(App.ViewInfo.ProjectNO, _DocInfo.ID);
4801
                
4802
            }
4803
        }
4804

    
4805
        private void btnConsolidate_Loaded(object sender, RoutedEventArgs e)
4806
        {
4807
            if (App.ViewInfo != null)
4808
            {
4809
                btnConsolidate = (sender as RadRibbonButton);
4810
                if (!App.ViewInfo.NewCommentPermission)
4811
                {
4812
                    (sender as RadRibbonButton).Visibility = System.Windows.Visibility.Collapsed;
4813
                }
4814
            }
4815
        }
4816

    
4817
        private void btnTeamConsolidate_Click(object sender, RoutedEventArgs e)
4818
        {
4819
            TeamConsolidationMethod();
4820
        }
4821

    
4822
        private void btnTeamConsolidate_Loaded(object sender, RoutedEventArgs e)
4823
        {
4824
            btnTeamConsolidate = sender as RadRibbonButton;
4825
            if (App.ViewInfo != null)
4826
            {
4827
                if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면
4828
                {
4829
                    if (btnConsolidate != null)
4830
                    {
4831
                        btnConsolidate.Visibility = Visibility.Collapsed;
4832
                    }
4833

    
4834
                    if (!App.ViewInfo.NewCommentPermission)
4835
                    {
4836
                        btnTeamConsolidate.Visibility = Visibility.Collapsed;
4837
                    }
4838
                }
4839
                else
4840
                {
4841
                    btnTeamConsolidate.Visibility = Visibility.Collapsed;
4842
                }
4843
            }
4844
        }
4845

    
4846
        private void FinalPDFEvent(object sender, RoutedEventArgs e)
4847
        {
4848
            var item = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault();
4849
            if (item != null)
4850
            {
4851
                BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item.MarkupInfoID, _ViewInfo.UserID);
4852
            }
4853
            else
4854
            {
4855
                DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내");
4856
            }
4857
        }
4858

    
4859
        private void btnFinalPDF_Loaded(object sender, RoutedEventArgs e)
4860
        {
4861
            btnFinalPDF = sender as RadRibbonButton;
4862
            if (App.ViewInfo != null)
4863
            {
4864
                if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면
4865
                {
4866
                    btnFinalPDF.Visibility = System.Windows.Visibility.Collapsed;
4867
                    if (btnConsolidate != null)
4868
                    {
4869
                        btnConsolidate.Visibility = Visibility.Collapsed;
4870
                    }
4871
                }
4872
            }
4873
        }
4874

    
4875
        private void SyncCompare_Click(object sender, RoutedEventArgs e)
4876
        {
4877
            if (CompareMode.IsChecked)
4878
            {
4879
                if (ViewerDataModel.Instance.PageBalanceMode && ViewerDataModel.Instance.PageBalanceNumber == 0)
4880
                {
4881
                    ViewerDataModel.Instance.PageBalanceNumber = 1;
4882
                }
4883
                if (ViewerDataModel.Instance.PageNumber == 0)
4884
                {
4885
                    ViewerDataModel.Instance.PageNumber = 1;
4886
                }
4887

    
4888
                BaseClient.GetCompareRectAsync(_ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber.ToString(), ViewerDataModel.Instance.PageNumber.ToString(), userData.COMPANY != "EXT" ? "true" : "false");
4889
            }
4890
            else
4891
            {
4892
                da.From = 1;
4893
                da.To = 1;
4894
                da.Duration = new Duration(TimeSpan.FromSeconds(9999));
4895
                da.AutoReverse = false;
4896
                canvas_compareBorder.Children.Clear();
4897
                canvas_compareBorder.BeginAnimation(OpacityProperty, da);
4898
            }
4899
        }
4900

    
4901
        private void Sync_Click(object sender, RoutedEventArgs e)
4902
        {
4903
            if (Sync.IsChecked)
4904
            {
4905
                ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
4906
                ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
4907
                ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
4908
            }
4909
        }
4910

    
4911
        private void SyncUserListExpender_Click(object sender, RoutedEventArgs e)
4912
        {
4913
            if (UserList.IsChecked)
4914
            {
4915
                this.gridViewRevMarkup.Visibility = Visibility.Visible;
4916
            }
4917
            else
4918
            {
4919
                this.gridViewRevMarkup.Visibility = Visibility.Collapsed;
4920
            }
4921
        }
4922

    
4923
        private void SyncPageBalance_Click(object sender, RoutedEventArgs e)
4924
        {
4925

    
4926
            if (BalanceMode.IsChecked)
4927
            {
4928
                ViewerDataModel.Instance.PageBalanceMode = true;
4929
            }
4930
            else
4931
            {
4932
                ViewerDataModel.Instance.PageBalanceMode = false;
4933
                ViewerDataModel.Instance.PageBalanceNumber = 0;
4934
            }
4935
        }
4936

    
4937
        private void SyncExit_Click(object sender, RoutedEventArgs e)
4938
        {
4939
            //초기화
4940
            testPanel2.IsHidden = true;
4941
            ViewerDataModel.Instance.PageBalanceMode = false;
4942
            ViewerDataModel.Instance.PageBalanceNumber = 0;
4943
            ViewerDataModel.Instance.PageNumber = 0;
4944
            ViewerDataModel.Instance.MarkupControls_Sync.Clear();
4945
            this.gridViewRevMarkup.Visibility = Visibility.Collapsed;
4946
            UserList.IsChecked = false;
4947
            BalanceMode.IsChecked = false;
4948
        }
4949

    
4950
        private void SyncPageChange_Click(object sender, RoutedEventArgs e)
4951
        {
4952
            if ((sender as System.Windows.Controls.Control).Tag != null)
4953
            {
4954
                //Compare 초기화
4955
                CompareMode.IsChecked = false;
4956
                var balancePoint = Convert.ToInt32((sender as System.Windows.Controls.Control).Tag);
4957

    
4958
                if (ViewerDataModel.Instance.PageNumber == 0)
4959
                {
4960
                    ViewerDataModel.Instance.PageNumber = 1;
4961
                }
4962

    
4963
                if (ViewerDataModel.Instance.PageBalanceNumber == pageNavigator.PageCount)
4964
                {
4965
                }
4966
                else
4967
                {
4968
                    ViewerDataModel.Instance.PageBalanceNumber += balancePoint;
4969
                }
4970

    
4971
                if (ViewerDataModel.Instance.PageNumber == pageNavigator.PageCount && balancePoint > 0)
4972
                {
4973

    
4974
                }
4975
                else if ((ViewerDataModel.Instance.PageNumber + balancePoint) >= 1)
4976
                {
4977
                    ViewerDataModel.Instance.PageNumber += balancePoint;
4978
                }
4979

    
4980
                if (!testPanel2.IsHidden)
4981
                {
4982
                    if (IsSyncPDFMode)
4983
                    {
4984
                        Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
4985
                        var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber)));
4986

    
4987
                        if (pdfpath.IsDownloading)
4988
                        {
4989
                            pdfpath.DownloadCompleted += (ex, arg) =>
4990
                            {
4991
                                ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
4992
                                ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
4993
                                ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
4994
                                zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
4995
                                zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
4996
                            };
4997
                        }
4998
                        else
4999
                        {
5000
                            ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5001
                            ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5002
                            ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5003

    
5004
                            zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5005
                            zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5006
                        }
5007

    
5008
                    }
5009
                    else
5010
                    {
5011
                        string uri = "";
5012

    
5013
                        if (userData.COMPANY != "EXT")
5014
                        {
5015
                            uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber);
5016
                        }
5017
                        else
5018
                        {
5019
                            uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber);
5020
                        }
5021

    
5022
                        var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
5023

    
5024
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5025
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5026
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5027

    
5028
                        zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
5029
                        zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
5030

    
5031
                        if (defaultBitmapImage_Compare.IsDownloading)
5032
                        {
5033
                            defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
5034
                            {
5035
                                ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5036
                                ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5037
                                ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5038

    
5039
                                zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
5040
                                zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
5041
                            };
5042
                        }
5043
                    }
5044

    
5045
                    //강인구 추가(페이지 이동시 코멘트 재 호출)
5046
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
5047
                    List<MarkupInfoItem> gridSelectionRevItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList();
5048

    
5049
                    foreach (var item in gridSelectionRevItem)
5050
                    {
5051
                        item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageNumber).ToList().ForEach(delegate (MarkupItem markupitem)
5052
                        {
5053
                            layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID);
5054
                        });
5055
                    }
5056

    
5057
                    //강인구 추가
5058
                    zoomAndPanControl2.ZoomTo(new Rect
5059
                    {
5060
                        X = 0,
5061
                        Y = 0,
5062
                        Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width),
5063
                        Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height),
5064
                    });
5065

    
5066
                    tlSyncPageNum.Text = String.Format("Current Page : {0}", ViewerDataModel.Instance.PageNumber);
5067

    
5068
                }
5069
            }
5070
        }
5071

    
5072
        private void SyncChange_Click(object sender, RoutedEventArgs e)
5073
        {
5074
            if (MarkupMode.IsChecked)
5075
            {
5076
                IsSyncPDFMode = true;
5077

    
5078
                var uri = CurrentRev.TO_VENDOR;
5079

    
5080
                if (ViewerDataModel.Instance.PageNumber == 0)
5081
                {
5082
                    ViewerDataModel.Instance.PageNumber = 1;
5083
                }
5084

    
5085
                //PDF모드 잠시 대기(강인구)
5086
                Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
5087
                var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber)));
5088

    
5089
                if (pdfpath.IsDownloading)
5090
                {
5091
                    pdfpath.DownloadCompleted += (ex, arg) =>
5092
                    {
5093
                        ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5094
                        ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5095
                        ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5096
                        zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5097
                        zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5098
                    };
5099
                }
5100
                else
5101
                {
5102
                    ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5103
                    ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5104
                    ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5105

    
5106
                    zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5107
                    zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5108
                }
5109
            }
5110
            else
5111
            {
5112
                IsSyncPDFMode = false;
5113
                string uri = "";
5114
                if (userData.COMPANY != "EXT")
5115
                {
5116
                    uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5117
                }
5118
                else
5119
                {
5120
                    uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5121
                }
5122

    
5123
                var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
5124

    
5125
                ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5126
                ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5127
                ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5128

    
5129
                if (defaultBitmapImage_Compare.IsDownloading)
5130
                {
5131
                    defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
5132
                    {
5133
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5134
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5135
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5136
                    };
5137
                }
5138
                zoomAndPanControl2.ApplyTemplate();
5139
                zoomAndPanControl2.UpdateLayout();
5140
                zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
5141
                zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
5142
            }
5143
        }
5144

    
5145
        private void RadButton_Click(object sender, RoutedEventArgs e)
5146
        {
5147
            gridViewHistory_Busy.IsBusy = true;
5148

    
5149
            RadButton instance = sender as RadButton;
5150
            if (instance.CommandParameter != null)
5151
            {
5152
                CurrentRev = instance.CommandParameter as VPRevision;
5153
                BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) =>
5154
                {
5155
                    if (ea.Error == null && ea.Result != null)
5156
                    {
5157
                        testPanel2.IsHidden = false;
5158

    
5159
                        ViewerDataModel.Instance._markupInfoRevList = SetDisplayColor(ea.Result, _ViewInfo.UserID);
5160
                        gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList;
5161

    
5162
                        string uri = "";
5163
                        if (userData.COMPANY != "EXT")
5164
                        {
5165
                            uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5166
                        }
5167
                        else
5168
                        {
5169
                            uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5170
                        }
5171

    
5172
                        Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY);
5173

    
5174
                        var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
5175

    
5176
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5177
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5178
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5179

    
5180
                        if (defaultBitmapImage_Compare.IsDownloading)
5181
                        {
5182
                            defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
5183
                            {
5184
                                ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5185
                                ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5186
                                ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5187
                            };
5188
                        }
5189

    
5190
                        zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
5191
                        zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
5192
                        zoomAndPanControl2.RotationAngle = zoomAndPanControl.RotationAngle;
5193
                        zoomAndPanControl2.ApplyTemplate();
5194
                        zoomAndPanControl2.UpdateLayout();
5195

    
5196
                        if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY))
5197
                        {
5198
                            zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X;
5199
                            zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y;
5200
                        }
5201

    
5202
                        ViewerDataModel.Instance.Sync_ContentOffsetX = Sync_Offset_Point.X;
5203
                        ViewerDataModel.Instance.Sync_ContentOffsetY = Sync_Offset_Point.Y;
5204
                        ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
5205

    
5206
                        tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo);
5207
                        tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber);
5208
                        gridViewHistory_Busy.IsBusy = false;
5209
                    }
5210
                };
5211
                BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID);
5212
            }
5213
        }
5214

    
5215
        public void Sync_Event(VPRevision Currnet_Rev)
5216
        {
5217
            CurrentRev = Currnet_Rev;
5218

    
5219
            BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) =>
5220
            {
5221
                if (ea.Error == null && ea.Result != null)
5222
                {
5223
                    testPanel2.IsHidden = false;
5224

    
5225
                    ViewerDataModel.Instance._markupInfoRevList = SetDisplayColor(ea.Result, _ViewInfo.UserID);
5226
                    gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList;
5227

    
5228
                    string uri = "";
5229
                    if (userData.COMPANY != "EXT")
5230
                    {
5231
                        uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5232
                    }
5233
                    else
5234
                    {
5235
                        uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5236
                    }
5237

    
5238
                    Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY);
5239

    
5240
                    var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
5241

    
5242
                    ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5243
                    ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5244
                    ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5245

    
5246
                    if (defaultBitmapImage_Compare.IsDownloading)
5247
                    {
5248
                        defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
5249
                        {
5250
                            ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5251
                            ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5252
                            ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5253
                        };
5254
                    }
5255
                    
5256
                    
5257
                    zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
5258
                    zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
5259
                    zoomAndPanControl2.ApplyTemplate();
5260
                    zoomAndPanControl2.UpdateLayout();
5261

    
5262
                    if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY))
5263
                    {
5264
                        zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X;
5265
                        zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y;
5266
                    }
5267
                    //}
5268

    
5269
                    tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo);
5270
                    tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber);
5271
                    gridViewHistory_Busy.IsBusy = false;
5272
                }
5273
            };
5274
            BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID);
5275

    
5276

    
5277
        }
5278

    
5279
        private void PdfLink_ButtonDown(object sender, MouseButtonEventArgs e)
5280
        {
5281
            if (sender is Image)
5282
            {
5283
                if ((sender as Image).Tag != null)
5284
                {
5285
                    var pdfUrl = (sender as Image).Tag.ToString();
5286
                    System.Diagnostics.Process.Start(pdfUrl);
5287
                }
5288
                else
5289
                {
5290
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("문서 정보가 잘못 되었습니다", "안내");
5291
                }
5292
            }
5293
        }
5294

    
5295
        private void Create_Symbol(object sender, RoutedEventArgs e)
5296
        {
5297
            MarkupToPDF.Controls.Parsing.LayerControl.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.LayerControl.MarkupReturn();
5298
            MarkupToPDF.Controls.Parsing.LayerControl layer = new MarkupToPDF.Controls.Parsing.LayerControl();
5299

    
5300
            if (SelectLayer.Children.Count < 1) //선택된 것이 없으면
5301
            {
5302
                DialogMessage_Alert("Please Select Controls", "Alert");
5303
            }
5304
            else //선택된 것이 있으면
5305
            {
5306
                string MarkupData = "";
5307
                adorner_ = new AdornerFinal();
5308

    
5309
                foreach (var item in SelectLayer.Children)
5310
                {
5311
                    if (item.GetType().Name == "AdornerFinal")
5312
                    {
5313
                        adorner_ = (item as Controls.AdornerFinal);
5314
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
5315
                        {
5316
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
5317
                            {
5318
                                markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
5319
                                MarkupData += markupReturn.ConvertData;
5320
                            }
5321
                        }
5322
                    }
5323
                }
5324
                DialogParameters parameters = new DialogParameters()
5325
                {
5326
                    Closed = (obj, args) => this.MarkupNamePromptClose(MarkupData, args),
5327
                    DefaultPromptResultValue = "Custom State",
5328
                    Content = "Name :",
5329
                    Header = "Insert Custom Symbol Name",
5330
                    Theme = new VisualStudio2013Theme(),
5331
                    ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
5332
                };
5333
                RadWindow.Prompt(parameters);
5334
            }
5335

    
5336
        }
5337

    
5338
        private void MarkupNamePromptClose(string data, WindowClosedEventArgs args)
5339
        {
5340
            Save save = new Save();
5341

    
5342
            if (args.DialogResult.Value)
5343
            {
5344
                PngBitmapEncoder _Encoder = symImage(data);
5345

    
5346
                System.IO.MemoryStream fs = new System.IO.MemoryStream();
5347
                _Encoder.Save(fs);
5348
                System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs);
5349

    
5350
                byte[] Img_byte = fs.ToArray();
5351

    
5352
                kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
5353
                filename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Save.shortGuid() + ".png", Img_byte);
5354

    
5355
                save.SymbolSave(args.PromptResult, filename, data);
5356
            }
5357
        }
5358

    
5359
        public PngBitmapEncoder symImage(string data)
5360
        {
5361

    
5362
            Canvas _canvas = new Canvas();
5363
            _canvas.Background = Brushes.White;
5364
            _canvas.Width = adorner_.BorderSize.Width;
5365
            _canvas.Height = adorner_.BorderSize.Height;
5366
            layerControl.markupParse(data, _canvas, "#FFFF0000", "");
5367

    
5368
            BitmapEncoder encoder = new PngBitmapEncoder();
5369

    
5370

    
5371
            RenderTargetBitmap renderBitmap = new RenderTargetBitmap((int)_canvas.Width + 50, (int)_canvas.Height + 50, 96d, 96d, PixelFormats.Pbgra32);
5372

    
5373
            DrawingVisual dv = new DrawingVisual();
5374

    
5375
            _canvas.Measure(new System.Windows.Size(adorner_.BorderSize.Width + 50, adorner_.BorderSize.Height + 50));
5376
            _canvas.Arrange(new Rect(new System.Windows.Point { X = -adorner_.BorderSize.X - 20, Y = -adorner_.BorderSize.Y - 20 }, new Point(adorner_.BorderSize.Width + 20, adorner_.BorderSize.Height + 20)));
5377

    
5378
            using (DrawingContext ctx = dv.RenderOpen())
5379
            {
5380
                VisualBrush vb = new VisualBrush(_canvas);
5381
                ctx.DrawRectangle(vb, null, new Rect(new System.Windows.Point { X = -adorner_.BorderSize.X, Y = -adorner_.BorderSize.Y }, new Point(adorner_.BorderSize.Width + 20, adorner_.BorderSize.Height + 20)));
5382
            }
5383

    
5384
            try
5385
            {
5386
                renderBitmap.Render(dv);
5387

    
5388
                GC.Collect();
5389
                GC.WaitForPendingFinalizers();
5390
                GC.Collect();
5391
                // encode png data
5392
                PngBitmapEncoder pngEncoder = new PngBitmapEncoder();
5393
                // puch rendered bitmap into it
5394
                pngEncoder.Interlace = PngInterlaceOption.Off;
5395
                pngEncoder.Frames.Add(BitmapFrame.Create(renderBitmap));
5396
                return pngEncoder;
5397

    
5398
            }
5399
            catch (Exception ex)
5400
            {
5401
                return null;
5402
            }
5403

    
5404
        }
5405

    
5406
        public void DialogMessage_Alert(string content, string header)
5407
        {
5408
            var box = new TextBlock();
5409
            box.MinWidth = 400;
5410
            box.FontSize = 11;
5411
            //box.FontSize = 12;
5412
            box.Text = content;
5413
            box.TextWrapping = System.Windows.TextWrapping.Wrap;
5414

    
5415
            DialogParameters parameters = new DialogParameters()
5416
            {
5417
                Content = box,
5418
                Header = header,
5419
                Theme = new VisualStudio2013Theme(),
5420
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
5421
            };
5422
            RadWindow.Alert(parameters);
5423
        }
5424

    
5425
        #region 캡쳐 기능
5426

    
5427
        public BitmapSource CutAreaToImage(int x, int y, int width, int height)
5428
        {
5429
            if (x < 0)
5430
            {
5431
                width += x;
5432
                x = 0;
5433
            }
5434
            if (y < 0)
5435
            {
5436
                height += y;
5437
                y = 0;
5438

    
5439
                width = (int)zoomAndPanCanvas.ActualWidth - x;
5440
            }
5441
            if (x + width > zoomAndPanCanvas.ActualWidth)
5442
            {
5443
                width = (int)zoomAndPanCanvas.ActualWidth - x;
5444
            }
5445
            if (y + height > zoomAndPanCanvas.ActualHeight)
5446
            {
5447
                height = (int)zoomAndPanCanvas.ActualHeight - y;
5448
            }
5449

    
5450
            byte[] pixels = CopyPixels(x, y, width, height);
5451

    
5452
            int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8;
5453

    
5454
            return BitmapSource.Create(width, height, 96, 96, PixelFormats.Pbgra32, null, pixels, stride);
5455
        }
5456

    
5457
        public byte[] CopyPixels(int x, int y, int width, int height)
5458
        {
5459
            byte[] pixels = new byte[width * height * 4];
5460
            int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8;
5461

    
5462
            // Canvas 이미지에서 객체 역역만큼 픽셀로 복사
5463
            canvasImage.CopyPixels(new Int32Rect(x, y, width, height), pixels, stride, 0);
5464

    
5465
            return pixels;
5466
        }
5467

    
5468
        public RenderTargetBitmap ConverterBitmapImage(FrameworkElement element)
5469
        {
5470
            DrawingVisual drawingVisual = new DrawingVisual();
5471
            DrawingContext drawingContext = drawingVisual.RenderOpen();
5472

    
5473
            // 해당 객체의 그래픽요소로 사각형의 그림을 그립니다.
5474
            drawingContext.DrawRectangle(new VisualBrush(element), null,
5475
                new Rect(new Point(0, 0), new Point(element.ActualWidth, element.ActualHeight)));
5476
            drawingContext.Close();
5477

    
5478
            // 비트맵으로 변환합니다.
5479
            RenderTargetBitmap target =
5480
                new RenderTargetBitmap((int)element.ActualWidth, (int)element.ActualHeight,
5481
                96, 96, System.Windows.Media.PixelFormats.Pbgra32);
5482

    
5483
            target.Render(drawingVisual);
5484
            return target;
5485
        }
5486

    
5487
        public void Save_Capture(BitmapSource source, int x, int y, int width, int height)
5488
        {
5489
            KCOM.Common.Converter.FileStreamToBase64 streamToBase64 = new Common.Converter.FileStreamToBase64();
5490
            KCOMDataModel.DataModel.CHECK_LIST check_;
5491
            string Result = streamToBase64.ImageToBase64(source);
5492
            KCOMDataModel.DataModel.CHECK_LIST Item = new KCOMDataModel.DataModel.CHECK_LIST();
5493
            string projectno = App.ViewInfo.ProjectNO;
5494
            string checklist_id = ViewerDataModel.Instance.CheckList_ID;
5495
            Item = this.BaseClient.GetCheckList(projectno, checklist_id);
5496
            if (Item == null)
5497
            {
5498
                check_ = new KCOMDataModel.DataModel.CHECK_LIST
5499
                {
5500
                    ID = Save.shortGuid(),
5501
                    USER_ID = App.ViewInfo.UserID,
5502
                    IMAGE_URL = Result,
5503
                    IMAGE_ANCHOR = x + "," + y + "," + width + "," + height,
5504
                    PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber,
5505
                    REVISION = ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision,
5506
                    DOCUMENT_ID = App.ViewInfo.DocumentItemID,
5507
                    PROJECT_NO = App.ViewInfo.ProjectNO,
5508
                    STATUS = "False",
5509
                    CREATE_TIME = DateTime.Now,
5510
                    UPDATE_TIME = DateTime.Now,
5511
                    DOCUMENT_NO = _DocItem.DOCUMENT_NO,
5512
                    STATUS_DESC_OPEN = "Vendor 반영 필요",
5513
                };
5514
                this.BaseClient.AddCheckList(projectno, check_);
5515
            }
5516
            else
5517
            {
5518
                Item.IMAGE_URL = Result;
5519
                Item.IMAGE_ANCHOR = x + "," + y + "," + width + "," + height;
5520
                Item.PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber;
5521
                this.BaseClient.SaveCheckList(projectno, checklist_id, Item);
5522
            }
5523
            
5524
        }
5525

    
5526
        public void Set_Capture()
5527
        {            
5528
            double x = canvasDrawingMouseDownPoint.X;
5529
            double y = canvasDrawingMouseDownPoint.Y;
5530
            double width = dragCaptureBorder.Width;
5531
            double height = dragCaptureBorder.Height;
5532

    
5533
            if (width > 5 || height > 5)
5534
            {
5535
                canvasImage = ConverterBitmapImage(zoomAndPanCanvas);
5536
                BitmapSource source = CutAreaToImage((int)x, (int)y, (int)width, (int)height);
5537
                Save_Capture(source, (int)x, (int)y, (int)width, (int)height);
5538
            }
5539
        }
5540
        #endregion
5541

    
5542
        TempFile temp = new TempFile();
5543
        //MarkupInfoItem
5544
        public void CreateControl()
5545
        {
5546
            
5547
            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
5548
            {
5549
                ViewerDataModel.Instance.UndoDataList.Remove(i);
5550
            });
5551
            multi_Undo_Data.Markup = currentControl;
5552
            UndoData.Markup_List.Add(multi_Undo_Data);
5553
           
5554
            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
5555

    
5556
            //List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList();
5557

    
5558
            temp.AddTemp(currentControl, pageNavigator.CurrentPage.PageNumber);
5559
        }
5560

    
5561
        
5562
        public Multi_Undo_data Control_Style(CommentUserInfo control)
5563
        {
5564
            multi_Undo_Data = new Multi_Undo_data();
5565

    
5566
            multi_Undo_Data.Markup = control;
5567

    
5568
            if ((control as IShapeControl) != null)
5569
            {
5570
                multi_Undo_Data.paint = (control as IShapeControl).Paint;
5571
            }
5572
            if ((control as IDashControl) != null)
5573
            {
5574
                multi_Undo_Data.DashSize = (control as IDashControl).DashSize;
5575
            }
5576
            if ((control as IPath) != null)
5577
            {
5578
                multi_Undo_Data.LineSize = (control as IPath).LineSize;
5579
            }
5580
            if ((control as UIElement) != null)
5581
            {
5582
                multi_Undo_Data.Opacity = (control as UIElement).Opacity;
5583
            }
5584

    
5585
            return multi_Undo_Data;
5586
        }
5587

    
5588
        public void Undo()
5589
        {
5590
            if (ViewerDataModel.Instance.IsPressCtrl)
5591
            {
5592
                ViewerDataModel.Instance.IsPressCtrl = false;
5593
            }
5594
            Undo_data undo = new Undo_data();
5595
            AdornerFinal final;
5596
            ReleaseAdorner();
5597

    
5598
            undo = ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == false).ToList().OrderByDescending(order => order.EventTime).FirstOrDefault();
5599
            if (undo == null)
5600
                return;
5601

    
5602
            
5603

    
5604
            switch (undo.Event)
5605
            {
5606
                case (Event_Type.Create):
5607
                    {
5608
                        foreach (var item in undo.Markup_List)
5609
                        {
5610
                            ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup));
5611
                            //임시파일에서도 삭제한다.
5612
                            temp.DataDel(item.Markup.CommentID);
5613
                        }
5614
                    }
5615
                    break;
5616
                case (Event_Type.Delete):
5617
                    {
5618
                        foreach (var item in undo.Markup_List)
5619
                        {
5620
                            ViewerDataModel.Instance.MarkupControls_USER.Add(item.Markup);
5621
                        }
5622
                    }
5623
                    break;
5624
                case (Event_Type.Thumb):
5625
                    {
5626
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
5627

    
5628
                        foreach (var item in undo.Markup_List)
5629
                        {
5630
                            ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup));
5631

    
5632
                            if ((item.Markup as IViewBox) != null)
5633
                            {
5634
                                (item.Markup as IViewBox).Angle = item.Angle;
5635
                            }
5636
                            if ((item.Markup as TextControl) != null)
5637
                            {
5638
                                (item.Markup as TextControl).Angle = item.Angle;
5639
                                Canvas.SetLeft((item.Markup as TextControl), item.PointSet[0].X);
5640
                                Canvas.SetTop((item.Markup as TextControl), item.PointSet[0].Y);
5641
                            }
5642
                            else
5643
                            {
5644
                                (item.Markup as IPath).PointSet = item.PointSet;
5645
                                (item.Markup as IPath).updateControl();
5646
                            }
5647

    
5648
                            comment.Add(item.Markup);
5649
                        }
5650
                        final = new AdornerFinal(comment);
5651
                        SelectLayer.Children.Add(final);
5652
                        ReleaseAdorner();
5653
                    }
5654
                    break;
5655
                case (Event_Type.Select):
5656
                    {
5657
                        ReleaseAdorner();
5658
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
5659

    
5660
                        foreach (var item in undo.Markup_List)
5661
                        {
5662
                            ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup));
5663

    
5664
                            if ((item.Markup as IPath) != null)
5665
                            {
5666
                                (item.Markup as IPath).LineSize = item.LineSize;
5667
                            }
5668
                            if ((item.Markup as UIElement) != null)
5669
                            {
5670
                                (item.Markup as UIElement).Opacity = item.Opacity;
5671
                            }
5672
                            if ((item.Markup as IDashControl) != null)
5673
                            {
5674
                                (item.Markup as IDashControl).DashSize = item.DashSize;
5675
                            }
5676
                            if ((item.Markup as IShapeControl) != null)
5677
                            {
5678
                                (item.Markup as IShapeControl).Paint = item.paint;
5679
                            }
5680

    
5681
                            comment.Add(item.Markup);
5682
                        }
5683

    
5684
                        final = new AdornerFinal(comment);
5685
                        SelectLayer.Children.Add(final);
5686
                    }
5687
                    break;
5688
                case (Event_Type.Option):
5689
                    {
5690
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
5691

    
5692
                        foreach (var item in undo.Markup_List)
5693
                        {
5694
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup);
5695

    
5696
                            if (undo.LineSize != 0 && item.Markup as IPath != null)
5697
                            {
5698
                                (item.Markup as IPath).LineSize = undo.LineSize;
5699
                            }
5700
                            else if (undo.Opacity != 0 && item.Markup as UIElement != null)
5701
                            {
5702
                                (item.Markup as UIElement).Opacity = undo.Opacity;
5703
                            }
5704
                            else if (undo.DashSize != null && item.Markup as IDashControl != null)
5705
                            {
5706
                                (item.Markup as IDashControl).DashSize = undo.DashSize;
5707
                            }
5708
                            else if (undo.Interval != 0 && item.Markup as LineControl != null)
5709
                            {
5710
                                (item.Markup as LineControl).Interval = undo.Interval;
5711
                            }
5712
                            else if (item.Markup as IShapeControl != null)
5713
                            {
5714
                                (item.Markup as IShapeControl).Paint = undo.paint;
5715
                            }
5716
                            comment.Add(item.Markup);
5717
                        }
5718
                        final = new AdornerFinal(comment);
5719
                        SelectLayer.Children.Add(final);
5720
                    }
5721
                    break;
5722
            }
5723
            ViewerDataModel.Instance.UndoDataList.Where(data => data.EventTime == undo.EventTime).ToList().OrderByDescending(order => order.EventTime).ToList().ForEach(i =>
5724
           {
5725
               i.IsUndo = true;
5726
           });
5727
        }
5728

    
5729
        public void Redo()
5730
        {
5731
            if (ViewerDataModel.Instance.IsPressCtrl)
5732
            {
5733
                ViewerDataModel.Instance.IsPressCtrl = false;
5734
            }
5735
            AdornerFinal final;
5736
            Undo_data redo = new Undo_data();
5737
            redo = ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().OrderBy(order => order.EventTime).FirstOrDefault();
5738
            ReleaseAdorner();
5739
            if (redo == null)
5740
                return;
5741

    
5742
            switch (redo.Event)
5743
            {
5744
                case (Event_Type.Create):
5745
                    {
5746
                        foreach (var item in redo.Markup_List)
5747
                        {
5748
                            ViewerDataModel.Instance.MarkupControls_USER.Add(item.Markup);
5749
                            temp.AddTemp(item.Markup, pageNavigator.CurrentPage.PageNumber);
5750
                        }
5751
                    }
5752
                    break;
5753
                case (Event_Type.Delete):
5754
                    {
5755
                        foreach (var item in redo.Markup_List)
5756
                        {
5757
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup);
5758
                        }
5759
                    }
5760
                    break;
5761
                case (Event_Type.Thumb):
5762
                    {
5763
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
5764

    
5765
                        foreach (var item in redo.Markup_List)
5766
                        {
5767
                            ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup as CommentUserInfo));
5768

    
5769
                            if ((item.Markup as IViewBox) != null)
5770
                            {
5771
                                (item.Markup as IViewBox).Angle = item.Angle;
5772
                            }
5773
                            if ((item.Markup as TextControl) != null)
5774
                            {
5775
                                (item.Markup as TextControl).Angle = item.Angle;
5776

    
5777
                                Canvas.SetLeft((item.Markup as TextControl), item.PointSet[0].X);
5778
                                Canvas.SetTop((item.Markup as TextControl), item.PointSet[0].Y);
5779
                            }
5780
                            else
5781
                            {
5782
                                (item.Markup as IPath).PointSet = item.PointSet;
5783
                                (item.Markup as IPath).updateControl();
5784
                            }
5785
                            comment.Add(item.Markup);
5786
                        }
5787
                        final = new AdornerFinal(comment);
5788
                        SelectLayer.Children.Add(final);
5789
                        ReleaseAdorner();
5790
                    }
5791
                    break;
5792
                case (Event_Type.Select):
5793
                    {
5794
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
5795

    
5796
                        foreach (var item in redo.Markup_List)
5797
                        {
5798
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup);
5799

    
5800
                            if ((item.Markup as IPath) != null)
5801
                            {
5802
                                (item.Markup as IPath).LineSize = item.LineSize;
5803
                            }
5804
                            if ((item.Markup as UIElement) != null)
5805
                            {
5806
                                (item.Markup as UIElement).Opacity = item.Opacity;
5807
                            }
5808
                            if ((item.Markup as IDashControl) != null)
5809
                            {
5810
                                (item.Markup as IDashControl).DashSize = item.DashSize;
5811
                            }
5812
                            if ((item.Markup as IShapeControl) != null)
5813
                            {
5814
                                (item.Markup as IShapeControl).Paint = item.paint;
5815
                            }
5816

    
5817
                            comment.Add(item.Markup);
5818
                        }
5819
                        final = new AdornerFinal(comment);
5820
                        SelectLayer.Children.Add(final);
5821
                    }
5822
                    break;
5823
                case (Event_Type.Option):
5824
                    {
5825
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
5826

    
5827
                        foreach (var item in redo.Markup_List)
5828
                        {
5829
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup);
5830
                            if (redo.LineSize != 0 && item.Markup as IPath != null)
5831
                            {
5832
                                (item.Markup as IPath).LineSize = redo.LineSize;
5833
                            }
5834
                            else if (redo.Opacity != 0 && item.Markup as UIElement != null)
5835
                            {
5836
                                (item.Markup as UIElement).Opacity = redo.Opacity;
5837
                            }
5838
                            else if (redo.DashSize != null && item.Markup as IDashControl != null)
5839
                            {
5840
                                (item.Markup as IDashControl).DashSize = redo.DashSize;
5841
                            }
5842
                            else if (redo.Interval != 0 && item.Markup as LineControl != null)
5843
                            {
5844
                                (item.Markup as LineControl).Interval = redo.Interval;
5845
                            }
5846
                            else if (item.Markup as IShapeControl != null)
5847
                            {
5848
                                (item.Markup as IShapeControl).Paint = redo.paint;
5849
                            }
5850
                            comment.Add(item.Markup);
5851
                        }
5852
                        final = new AdornerFinal(comment);
5853
                        SelectLayer.Children.Add(final);
5854
                    }
5855
                    break;
5856
            }
5857

    
5858
            ViewerDataModel.Instance.UndoDataList.Where(data => data.EventTime == redo.EventTime).ToList().OrderByDescending(order => order.EventTime).ToList().ForEach(i =>
5859
            {
5860
                i.IsUndo = false;
5861
            });
5862
        }
5863

    
5864
        private void Comment_Move(object sender, MouseButtonEventArgs e)
5865
        {
5866
            string Select_ID = (((e.Source as Telerik.Windows.Controls.RadButton).DataContext) as IKCOM.MarkupInfoItem).UserID;
5867
            foreach (var items in ViewerDataModel.Instance._markupInfoRevList)
5868
            {
5869
                if (items.UserID == Select_ID)
5870
                {
5871
                    foreach (var item in items.MarkupList)
5872
                    {
5873
                        if (item.PageNumber == pageNavigator.CurrentPage.PageNumber)
5874
                        {
5875
                            layerControl.markupParseEx(item.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, "#FFFF0000", "", items.MarkupInfoID, Save.shortGuid());
5876
                        }
5877
                    }
5878
                }
5879
            }
5880
        }
5881
        public void EmptyControlCheck()
5882
        {
5883
            for (var j = 0; j < (Common.ViewerDataModel.Instance.MarkupControls_USER).Count; j++)
5884
            {
5885
                if (((Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).GetType().Name == "TextControl")
5886
                {
5887
                    if (((MarkupToPDF.Controls.Text.TextControl)(Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).Text == null
5888
                    || ((MarkupToPDF.Controls.Text.TextControl)(Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).Text == "")
5889
                    {
5890
                        Common.ViewerDataModel.Instance.MarkupControls_USER.RemoveAt(j);
5891
                    }
5892
                }
5893
                else if (((Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).GetType().Name == "ArrowTextControl")
5894
                {
5895
                    if (((MarkupToPDF.Controls.Text.ArrowTextControl)(Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).Base_TextBox.Text == null
5896
                    || ((MarkupToPDF.Controls.Text.ArrowTextControl)(Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).Base_TextBox.Text == "")
5897
                    {
5898
                        Common.ViewerDataModel.Instance.MarkupControls_USER.RemoveAt(j);
5899
                    }
5900
                }
5901
            }
5902
        }
5903
        public void InkControl_Convert()
5904
        {
5905
            if (inkBoard.Strokes.Count > 0)
5906
            {
5907
                inkBoard.Strokes.ToList().ForEach(stroke =>
5908
                {
5909
                    List<Stroke> removingStroke = new List<Stroke>();
5910
                    StrokeCollection stC = new StrokeCollection();
5911

    
5912
                    removingStroke.Add(stroke);
5913

    
5914
                    InkToPath ip = new InkToPath();
5915
                    List<Point> inkPointSet = new List<Point>();
5916
                    PolygonControl pc = null;
5917
                    pc = new PolygonControl()
5918
                    {
5919
                        Angle = 0,
5920
                        PointSet = new List<Point>(),
5921
                        ControlType = ControlType.Ink
5922
                    };
5923
                    foreach (var item in removingStroke)
5924
                    {
5925
                        inkPointSet.AddRange(ip.StrokeGetPointsPlus(item));
5926
                        inkBoard.Strokes.Remove(item);
5927
                    }
5928
                    if (inkPointSet.Count != 0)
5929
                    {
5930
                        //강인구 추가(PenControl Undo Redo 추가)
5931
                        UndoData = new Undo_data()
5932
                        {
5933
                            IsUndo = false,
5934
                            Event = Event_Type.Create,
5935
                            EventTime = DateTime.Now,
5936
                            Markup_List = new List<Multi_Undo_data>()
5937
                        };
5938

    
5939
                        pc.StartPoint = inkPointSet[0];
5940
                        pc.EndPoint = inkPointSet[inkPointSet.Count - 1];
5941
                        pc.PointSet = inkPointSet;
5942
                        pc.LineSize = 3;
5943
                        pc.CommentID = Save.shortGuid();
5944
                        pc.StrokeColor = new SolidColorBrush(Colors.Red);
5945
                        ViewerDataModel.Instance.MarkupControls_USER.Add(pc);
5946
                        pc.SetPolyPath();
5947

    
5948
                        ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
5949
                        {
5950
                            ViewerDataModel.Instance.UndoDataList.Remove(i);
5951
                        });
5952
                        multi_Undo_Data.Markup = pc as CommentUserInfo;
5953
                        UndoData.Markup_List.Add(multi_Undo_Data);
5954
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);
5955
                    }
5956
                });
5957
            }
5958
        }
5959

    
5960
        /// <summary>
5961
        /// 정원, 정사각형, 정삼각형을 그리기 위한 EndPoint계산
5962
        /// </summary>
5963
        /// <param name="StartP">StartPoint</param>
5964
        /// <param name="EndP">EndPoint</param>
5965
        /// <returns>Return_EndPoint</returns>
5966
        private Point GetSquareEndPoint(Point StartP, Point EndP)
5967
        {
5968
            Point Return_Point = new Point();
5969

    
5970
            double dx = EndP.X - StartP.X;
5971
            double dy = EndP.Y - StartP.Y;
5972
            double length;
5973

    
5974
            switch (controlType)
5975
            {
5976
                case ControlType.Triangle:
5977
                    {
5978
                        //삼각형의 StartPoint기준으로 반지름 만큼 증가하기 때문에 곱하기2 필요
5979
                        length = Math.Max(Math.Abs(dx) * 2, Math.Abs(dy));
5980
                        Return_Point = (dy < 0) ? new Point(StartP.X + length / 2, StartP.Y - length) : new Point(StartP.X + length / 2, StartP.Y + length);
5981
                    }
5982
                    break;
5983
                default:
5984
                    {
5985
                        length = Math.Max(Math.Abs(dx), Math.Abs(dy));
5986
                        Return_Point.X = (dx > 0) ? StartP.X + length : StartP.X - length;
5987
                        Return_Point.Y = (dy > 0) ? StartP.Y + length : StartP.Y - length;
5988
                    }
5989
                    break;
5990
            }
5991

    
5992
            return Return_Point;
5993
        }
5994

    
5995
        /// <summary>
5996
        /// 정삼각형을 그리기위한 두 포인트를 계산하여 넘겨줌
5997
        /// </summary>
5998
        /// <author>humkyung</author>
5999
        /// <date>2018.04.26</date>
6000
        /// <param name="StartP"></param>
6001
        /// <param name="EndP"></param>
6002
        /// <returns></returns>
6003
        /// <history>humkyung 2018.05.11 apply axis lock</history>
6004
        private List<Point> GetRegularTrianglePoints(Point StartP, Point EndP, bool bCheckAxis = false)
6005
        {
6006
            List<Point> res = new List<Point>();
6007

    
6008
            double dx = EndP.X - StartP.X;
6009
            double dy = EndP.Y - StartP.Y;
6010
            double length = Math.Sqrt(dx * dx + dy * dy);
6011
            double baseLength = length * Math.Tan(30.0 * Math.PI / 180.0);
6012
            dx /= length;
6013
            dy /= length;
6014
            double tmp = dx;
6015
            dx = -dy; dy = tmp; /// rotate by 90 degree
6016

    
6017
            res.Add(new Point(EndP.X + dx * baseLength, EndP.Y + dy * baseLength));
6018
            res.Add(new Point(EndP.X - dx * baseLength, EndP.Y - dy * baseLength));
6019

    
6020
            return res;
6021
        }
6022

    
6023
        /// <summary>
6024
        /// 캔버스에 그릴때 모든 포인트가 캔버스를 벗어 났는지 체크하여 넘겨줌
6025
        /// </summary>
6026
        /// <author>ingu</author>
6027
        /// <date>2018.06.05</date>
6028
        /// <param name="getPoint"></param>
6029
        /// <returns></returns>
6030
        private bool IsGetoutpoint(Point getPoint)
6031
        {
6032
            if (getPoint == new Point())
6033
            {
6034
                ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl);
6035
                currentControl = null;
6036
                return true;
6037
            }
6038

    
6039
            return false;
6040
        }
6041

    
6042
        private void zoomAndPanControl_DragOver(object sender, DragEventArgs e)
6043
        {
6044
            e.Effects = DragDropEffects.Copy;
6045
        }
6046

    
6047
        private void zoomAndPanControl_DragEnter(object sender, DragEventArgs e)
6048
        {
6049
            e.Effects = DragDropEffects.Copy;
6050
        }
6051

    
6052
        private void zoomAndPanControl_DragLeave(object sender, DragEventArgs e)
6053
        {
6054
            e.Effects = DragDropEffects.None;
6055
        }
6056

    
6057
        private void zoomAndPanControl_Drop(object sender, DragEventArgs e)
6058
        {
6059
            if (e.Data.GetDataPresent(typeof(string)))
6060
            {
6061
                this.getCurrentPoint = e.GetPosition(drawingRotateCanvas);
6062
                string dragData = e.Data.GetData(typeof(string)) as string;
6063
                Move_Symbol(sender, dragData);
6064
            }
6065
        }
6066

    
6067
        private void Move_Symbol(object sender, string dragData)
6068
        {
6069
            if (dragData.Contains("|DZ|"))
6070
            {
6071
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
6072

    
6073
                string[] delimiterChars = { "|DZ|" };
6074
                string[] data = dragData.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
6075

    
6076
                this.ParentOfType<MainWindow>().dzMainMenu.ReleaseAdorner();
6077

    
6078
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
6079

    
6080
                //강인구 Undo/Redo 보류
6081
                UndoData = new Undo_data()
6082
                {
6083
                    IsUndo = false,
6084
                    Event = Event_Type.Create,
6085
                    EventTime = DateTime.Now,
6086
                    Markup_List = new List<Multi_Undo_data>()
6087
                };
6088

    
6089
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
6090
                {
6091
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
6092
                });
6093

    
6094
                foreach (string parse in data)
6095
                {
6096
                    if (parse != "")
6097
                    {
6098
                        System.Windows.Controls.Control item = this.layerControl.markupParse_Paste(parse, ViewerDataModel.Instance.MarkupControls_USER);
6099
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid();
6100

    
6101
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
6102
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
6103

    
6104
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
6105

    
6106
                        multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo);
6107

    
6108
                        UndoData.Markup_List.Add(multi_Undo_Data);
6109
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);
6110
                    }
6111
                }
6112
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
6113

    
6114
                /// move symbol to current mouse point
6115
                double realPointX = this.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
6116
                double realPointY = this.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
6117
                final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
6118

    
6119
                if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
6120
                {
6121
                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
6122
                }
6123
                /// up to here
6124
                
6125
                ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Add(final);
6126
            }
6127
        }
6128
    }
6129
}
클립보드 이미지 추가 (최대 크기: 500 MB)