프로젝트

일반

사용자정보

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

markus / KCOM / Views / MainMenu.xaml.cs @ 1066bae3

이력 | 보기 | 이력해설 | 다운로드 (319 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
using static KCOM.TempFile;
33
using System.Windows.Threading;
34
using System.Diagnostics;
35
using System.Threading;
36
using System.Windows.Resources;
37
using Svg2Xaml;
38
using System.Runtime.InteropServices;
39
using System.Windows.Media.Effects;
40
using MarkupToPDF.Controls.Cad;
41
using MarkupToPDF.Controls.Parsing;
42
using Telerik.Windows.Data;
43
using System.ComponentModel;
44

    
45
namespace KCOM.Views
46
{
47
    public static class ControlExtensions
48
    {
49
        public static T Clone<T>(this T controlToClone)
50
            where T : System.Windows.Controls.Control
51
        {
52
            System.Reflection.PropertyInfo[] controlProperties = typeof(T).GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance);
53

    
54
            T instance = Activator.CreateInstance<T>();
55

    
56
            foreach (PropertyInfo propInfo in controlProperties)
57
            {
58
                if (propInfo.CanWrite)
59
                {
60
                    if (propInfo.Name != "WindowTarget")
61
                        propInfo.SetValue(instance, propInfo.GetValue(controlToClone, null), null);
62
                }
63
            }
64
            return instance;
65
        }
66
    }
67

    
68
    public class MyConsole
69
    {
70
        private readonly System.Threading.ManualResetEvent _readLineSignal;
71
        private string _lastLine;
72
        public MyConsole()
73
        {
74
            _readLineSignal = new System.Threading.ManualResetEvent(false);
75
            Gui = new TextBox();
76
            Gui.AcceptsReturn = true;
77
            Gui.KeyUp += OnKeyUp;
78
        }
79

    
80
        private void OnKeyUp(object sender, KeyEventArgs e)
81
        {
82
            // this is always fired on UI thread
83
            if (e.Key == Key.Enter)
84
            {
85
                // quick and dirty, but that is not relevant to your question
86
                _lastLine = Gui.Text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries).Last();
87
                // now, when you detected that user typed a line, set signal
88
                _readLineSignal.Set();
89
            }
90
        }
91

    
92
        public TextBox Gui { get; private set; }
93

    
94
        public string ReadLine()
95
        {
96
            // that should always be called from non-ui thread
97
            if (Gui.Dispatcher.CheckAccess())
98
                throw new Exception("Cannot be called on UI thread");
99
            // reset signal
100
            _readLineSignal.Reset();
101
            // wait until signal is set. This call is blocking, but since we are on non-ui thread - there is no problem with that
102
            _readLineSignal.WaitOne();
103
            // we got signalled - return line user typed.
104
            return _lastLine;
105
        }
106

    
107
        public void WriteLine(string line)
108
        {
109
            if (!Gui.Dispatcher.CheckAccess())
110
            {
111
                Gui.Dispatcher.Invoke(new Action(() => WriteLine(line)));
112
                return;
113
            }
114

    
115
            Gui.Text += line + Environment.NewLine;
116
        }
117
    }
118

    
119
    /// <summary>
120
    /// MainMenu.xaml에 대한 상호 작용 논리
121
    /// </summary>
122
    public partial class MainMenu : UserControl
123
    {
124
        #region 프로퍼티
125
        public Undo_data UndoData { get; set; }
126
        public CommentUserInfo currentControl { get; set; }
127
        public ControlType controlType { get; set; }
128
        private Move move = new Move();
129
        private double[] rotateValue = { 0, 90, 180, 270 };
130
        public MouseHandlingMode mouseHandlingMode = MouseHandlingMode.None;
131
        private static readonly double DragThreshold = 5;
132
        private System.Windows.Input.Cursor cursor { get; set; }
133
        private Point canvasDrawingMouseDownPoint;
134
        public string filename { get; set; }
135
        private Point canvasZoomPanningMouseDownPoint;
136
        public Point getCurrentPoint;
137
        private Point canvasZoommovingMouseDownPoint;
138
        List<object> ControlList = new List<object>();
139
        private ListBox listBox = new ListBox();
140
        private Dictionary<Geometry, string> selected_item = new Dictionary<Geometry, string>();
141
        private bool isDraggingSelectionRect = false;
142
        DrawingAttributes inkDA = new DrawingAttributes();
143
        private VPRevision CurrentRev { get; set; }
144
        public RadRibbonButton btnConsolidate { get; set; }
145
        public RadRibbonButton btnFinalPDF { get; set; }
146
        public RadRibbonButton btnTeamConsolidate { get; set; }
147
        public RadRibbonButton btnConsolidateFinalPDF { get; set; }
148

    
149
        public string Filename_ { get; set; }
150
        public double L_Size = 0;
151
        public AdornerFinal adorner_;
152
        public Multi_Undo_data multi_Undo_Data;
153
        public string Symbol_ID = "";
154
        /// <summary>
155
        /// Set to 'true' when the left mouse-button is down.
156
        /// </summary>
157
        public bool isLeftMouseButtonDownOnWindow = false;
158

    
159
        public InkPresenter _InkBoard = null;
160
        Stroke stroke;
161
        Boolean IsDrawing = false;
162
        StylusPointCollection strokePoints;
163
        //StylusPointCollection erasePoints;
164
        RenderTargetBitmap canvasImage;
165
        Point Sync_Offset_Point;
166

    
167
        //강인구 테스트
168
        private Path _SelectionPath { get; set; }
169
        public Path SelectionPath
170
        {
171
            get
172
            {
173
                return _SelectionPath;
174
            }
175
            set
176
            {
177
                if (_SelectionPath != value)
178
                {
179
                    _SelectionPath = value;
180
                    RaisePropertyChanged("SelectionPath");
181

    
182
                }
183
            }
184
        }
185

    
186
        private System.Windows.Controls.Image _imageViewer { get; set; }
187
        public System.Windows.Controls.Image imageViewer
188
        {
189
            get
190
            {
191
                if (_imageViewer == null)
192
                {
193
                    _imageViewer = new System.Windows.Controls.Image();
194
                    return _imageViewer;
195
                }
196
                else
197
                {
198
                    return _imageViewer;
199
                }
200
            }
201
            set
202
            {
203
                if (_imageViewer != value)
204
                {
205
                    _imageViewer = value;
206
                }
207
            }
208
        }
209

    
210
        public bool IsSyncPDFMode { get; set; }
211

    
212
        private System.Windows.Controls.Image _imageViewer_Compare { get; set; }
213
        public System.Windows.Controls.Image imageViewer_Compare
214
        {
215
            get
216
            {
217
                if (_imageViewer_Compare == null)
218
                {
219
                    _imageViewer_Compare = new System.Windows.Controls.Image();
220
                    return _imageViewer_Compare;
221
                }
222
                else
223
                {
224
                    return _imageViewer_Compare;
225
                }
226
            }
227
            set
228
            {
229
                if (_imageViewer_Compare != value)
230
                {
231
                    _imageViewer_Compare = value;
232
                }
233
            }
234
        }
235

    
236
        #endregion
237

    
238
        public MainMenu()
239
        {
240
            //InitializeComponent();    
241
            this.Loaded += MainMenu_Loaded;
242
        }
243

    
244
        public class TempDt
245
        {
246
            public int PageNumber { get; set; }
247
            public string CommentID { get; set; }
248
            public string ConvertData { get; set; }
249
            public int DATA_TYPE { get; set; }
250
            public string MarkupInfoID { get; set; }
251
            public int IsUpdate { get; set; }
252
        }
253

    
254
        List<TempDt> tempDtList = new List<TempDt>();
255

    
256
        private void SetCursor()
257
        {
258
            this.Cursor = cursor;
259
        }
260

    
261
        private bool IsDrawingEnable(Point _canvasZoomPanningMouseDownPoint)
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
            return false;
272
        }
273

    
274
        private bool IsRotationDrawingEnable(Point _canvasZoomPanningMouseDownPoint)
275
        {
276
            if (rotate.Angle == 90 || rotate.Angle == 270)
277
            {
278
                if ((_canvasZoomPanningMouseDownPoint.X > 0 &&
279
                zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.X) &&
280
                (_canvasZoomPanningMouseDownPoint.Y > 0 &&
281
                zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.Y))
282
                {
283
                    return true;
284
                }
285
            }
286
            else
287
            {
288
                if ((_canvasZoomPanningMouseDownPoint.X > 0 &&
289
                zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.X) &&
290
                (_canvasZoomPanningMouseDownPoint.Y > 0 &&
291
                zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.Y))
292
                {
293
                    return true;
294
                }
295
            }
296

    
297
            return false;
298
        }
299

    
300

    
301
        public void DeleteItem(MarkupInfoItem item)
302
        {
303
            if (PreviewUserMarkupInfoItem != null && item.Consolidate == 1 && item.AvoidConsolidate == 0)
304
            {
305
                App.Custom_ViewInfoId = PreviewUserMarkupInfoItem.MarkupInfoID;
306
            }
307

    
308
            ViewerDataModel.Instance._markupInfoList.Remove(item);
309

    
310
            ViewerDataModel.Instance.MarkupControls.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a =>
311
            {
312
                ViewerDataModel.Instance.MarkupControls.Remove(a);
313
            });
314

    
315
            ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a =>
316
            {
317
                ViewerDataModel.Instance.MarkupControls_USER.Remove(a);
318
            });
319

    
320
            ViewerDataModel.Instance.MyMarkupList.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a =>
321
            {
322
                ComingNewBieEnd = false;
323
                ViewerDataModel.Instance.MyMarkupList.Remove(a);
324
                //임시파일에서도 삭제
325
                TempFile.DelTemp(a.ID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString());
326
            });
327

    
328
            gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
329

    
330
            if (PreviewUserMarkupInfoItem == null && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null)
331
            {
332
                if (gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList().Where(d => d.UserID == App.ViewInfo.UserID).Count() == 0)
333
                {
334
                    var infoId = Commons.shortGuid();
335
                    PreviewUserMarkupInfoItem = new MarkupInfoItem
336
                    {
337
                        CreateTime = DateTime.Now,
338
                        Depatment = userData.DEPARTMENT,
339
                        UpdateTime = DateTime.Now,
340
                        DisplayColor = "#FFFF0000",
341
                        UserID = userData.ID,
342
                        UserName = userData.NAME,
343
                        PageCount = 1,
344
                        Description = "",
345
                        MarkupInfoID = infoId,
346
                        MarkupList = null,
347
                        MarkupVersionID = Commons.shortGuid(),
348
                        Consolidate = 0,
349
                        PartConsolidate = 0,
350
                        userDelete = true,
351
                        AvoidConsolidate = 0,
352
                        IsPreviewUser = true
353
                    };
354
                    App.Custom_ViewInfoId = infoId;
355
                }
356
            }
357
            Logger.sendReqLog("DeleteMarkupAsync", App.ViewInfo.ProjectNO + "," + item.MarkupInfoID, 1);
358
            BaseClient.DeleteMarkupAsync(App.ViewInfo.ProjectNO, item.MarkupInfoID);
359
        }
360

    
361
        /// <summary>
362
        /// delete selected comments
363
        /// </summary>
364
        /// <param name="sender"></param>
365
        /// <param name="e"></param>
366
        public void DeleteCommentEvent(object sender, RoutedEventArgs e)
367
        {
368
            //선택된 어도너가 있을시 삭제가 되지 않음(강인구 추가)
369
            SelectionSet.Instance.UnSelect(this);
370

    
371
            Button content = (sender as Button);
372
            MarkupInfoItem item = content.CommandParameter as MarkupInfoItem;
373

    
374
            DeleteItem(item);
375
        }
376

    
377
        System.Windows.Media.Animation.DoubleAnimation da = new System.Windows.Media.Animation.DoubleAnimation();
378

    
379
        private static Timer timer;
380
        private int InitInterval = KCOM.Properties.Settings.Default.InitInterval;
381
        private void MainMenu_Loaded(object sender, RoutedEventArgs e)
382
        {
383
            InitializeComponent();
384
            
385
            //System.Diagnostics.Debug.WriteLine("MainMenu() : " + sw.ElapsedMilliseconds.ToString() + "ms");
386

    
387
            if (App.ParameterMode)
388
            {
389
                this.pageNavigator.PageChanging += pageNavigator_PageChanging;
390
                imageViewer_Compare = new Image();
391
                ViewerDataModel.Instance.Capture_Opacity = 0;
392
                da.From = 0.8;
393
                da.To = 0;
394
                da.Duration = new Duration(TimeSpan.FromSeconds(1));
395
                da.AutoReverse = true;
396
                da.RepeatBehavior = System.Windows.Media.Animation.RepeatBehavior.Forever;
397

    
398
                if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission)
399
                {
400
                    this.SymbolPane.Visibility = Visibility.Collapsed;
401
                    this.FavoritePane.Visibility = Visibility.Collapsed;
402
                    this.drawingRotateCanvas.IsHitTestVisible = false;
403
                }
404
            }
405
            timer = new Timer(timercallback, null, 0, InitInterval * 60000);
406
        }
407

    
408
        private void timercallback(Object o)
409
        {
410
            Stopwatch sw = new Stopwatch();
411
            sw.Start();
412
            TempFile.TempFileAdd();
413
            sw.Stop();
414

    
415
            Dispatcher.InvokeAsync(new Action(delegate
416
            {
417
               if (this.ParentOfType<MainWindow>().dzTopMenu.cbAutoSave.IsChecked == true) //Auto Save Checked?
418
                {
419
                    timer.Change(((int)this.ParentOfType<MainWindow>().dzTopMenu.cbSaveInterval.Value * 60000) / 2, sw.ElapsedMilliseconds); //Timer Setting
420
                }
421
            }));
422

    
423
            ////GC.Collect();
424
        }
425
        
426
        /// <summary>
427
        /// update my markuplist
428
        ///  - update existing markup data if already exist
429
        ///  - add new markup data if control is new
430
        /// </summary>
431
        public void UpdateMyMarkupList()
432
        {
433
            Logger.sendCheckLog("pageNavigator_PageChanging_ChangeCommentReact", 1);
434
            bool isComingNewBie = false;
435

    
436
            /// add or update markup list
437
            foreach (var control in ViewerDataModel.Instance.MarkupControls_USER)
438
            {
439
                var root = MarkupParser.MarkupToString(control, App.ViewInfo.UserID);
440

    
441
                var exist = ViewerDataModel.Instance.MyMarkupList.Where(data => data.ID == root.CommentID).FirstOrDefault();
442
                if (exist != null) //신규 추가 된 코멘트
443
                {
444
                    if (exist.Data != root.ConvertData) //코멘트가 같은지
445
                    {
446
                        exist.Data = root.ConvertData;
447
                        exist.IsUpdate = true;
448
                        ComingNewBieEnd = false;
449
                    }
450
                }
451
                else if (root.CommentID != null)
452
                {
453
                    isComingNewBie = true;
454
                    ViewerDataModel.Instance.MyMarkupList.Add(new MarkupItemEx
455
                    {
456
                        ID = control.CommentID,
457
                        Data = root.ConvertData,
458
                        Data_Type = root.DATA_TYPE,
459
                        MarkupInfoID = App.Custom_ViewInfoId,
460
                        PageNumber = this.pageNavigator.CurrentPage.PageNumber,
461
                        Symbol_ID = control.SymbolID,
462
                        Group_ID = control.GroupID,
463
                    });
464
                    ComingNewBieEnd = false;
465
                }
466
            }
467

    
468
            /// delete markup list
469
            int iPageNo = Convert.ToInt32(this.ParentOfType<MainWindow>().dzTopMenu.tlcurrentPage.Text);
470
            var deleted = (from markup in ViewerDataModel.Instance.MyMarkupList
471
                          where (markup.PageNumber == iPageNo) && (null == ViewerDataModel.Instance.MarkupControls_USER.Where(control => control.CommentID == markup.ID).FirstOrDefault())
472
                          select markup).ToList();
473
            foreach(var markup in deleted) ViewerDataModel.Instance.MyMarkupList.Remove(markup);
474
            /// up to here
475

    
476
            if (PreviewUserMarkupInfoItem != null && isComingNewBie && !ComingNewBieEnd)
477
            {
478
                if (ViewerDataModel.Instance._markupInfoList.Where(info => info.UserID == PreviewUserMarkupInfoItem.UserID).FirstOrDefault() == null)
479
                {
480
                    ComingNewBieEnd = true;
481
                    ViewerDataModel.Instance._markupInfoList.Insert(0, PreviewUserMarkupInfoItem);
482
                    PreviewUserMarkupInfoItem.IsPreviewUser = false;
483
                    gridViewMarkup.ItemsSource = null;
484
                    gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
485
                    gridViewMarkup.SelectedItem = PreviewUserMarkupInfoItem;
486

    
487
                    GroupDescriptor descriptor = new GroupDescriptor();
488
                    descriptor.Member = "Depatment";
489
                    descriptor.DisplayContent = "DEPT";
490
                    descriptor.SortDirection = ListSortDirection.Ascending;
491
                    gridViewMarkup.GroupDescriptors.Add(descriptor);
492
                }
493
            }
494
        }
495

    
496
        bool ComingNewBieEnd = false;
497

    
498
        private void pageNavigator_PageChanging(object sender, Controls.Sample.PageChangeEventArgs e)
499
        {
500
            Logger.sendCheckLog("pageNavigator_PageChanging_Start", 1);
501
            if (ViewerDataModel.Instance.UndoDataList.Count > 0)
502
            {
503
                Logger.sendCheckLog("pageNavigator_PageChanging_이전페이지Save", 1);
504
                this.ParentOfType<MainWindow>().dzTopMenu.SaveEvent(null, null);
505
            }
506
            Logger.sendCheckLog("pageNavigator_PageChanging_UndoDataListClear", 1);
507
            ViewerDataModel.Instance.UndoDataList.Clear();
508

    
509
            InkControl_Convert();
510

    
511
            SelectionSet.Instance.UnSelect(this);
512
            UpdateMyMarkupList();
513

    
514
            Logger.sendCheckLog("pageNavigator_PageChanging_변수생성 및 값 설정", 1);
515
            CompareMode.IsChecked = false;
516
            var BalancePoint = ViewerDataModel.Instance.PageBalanceMode == true ? e.PageNumber + ViewerDataModel.Instance.PageBalanceNumber : e.PageNumber;
517

    
518

    
519
            #region 페이지가 벗어난 경우
520

    
521
            if (BalancePoint < 1)
522
            {
523
                BalancePoint = 1;
524
                ViewerDataModel.Instance.PageBalanceNumber = 0;
525
            }
526

    
527
            if (pageNavigator.PageCount < BalancePoint)
528
            {
529
                BalancePoint = pageNavigator.PageCount;
530
                ViewerDataModel.Instance.PageBalanceNumber = 0;
531
            }
532

    
533
            #endregion
534

    
535
            ViewerDataModel.Instance.PageNumber = BalancePoint;
536

    
537
            Logger.sendCheckLog("pageNavigator_PageChanging_페이지 Image url 설정", 1);
538
            string uri = "";
539
            if (userData.COMPANY != "EXT")
540
            {
541
                uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToInt32(_ViewInfo.DocumentItemID) / 100).ToString(), _ViewInfo.DocumentItemID, e.PageNumber);
542
            }
543
            else
544
            {
545
                uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, e.PageNumber);
546
            }
547

    
548
            var defaultBitmapImage = new BitmapImage();
549
            defaultBitmapImage.BeginInit();
550
            defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
551
            defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
552
            defaultBitmapImage.UriSource = new Uri(uri);
553
            defaultBitmapImage.EndInit();
554

    
555
            ViewerDataModel.Instance.ImageViewPath = null;
556
            GC.Collect();
557

    
558
            Logger.sendCheckLog("pageNavigator_PageChanging_BitmapImage Downloading", 1);
559
            if (defaultBitmapImage.IsDownloading)
560
            {
561
                Logger.sendCheckLog("pageNavigator_PageChanging_BitmapImage IsDownloading", 1);
562
                defaultBitmapImage.DownloadCompleted += (ex, arg) =>
563
                {
564
                    defaultBitmapImage.Freeze();
565
                    mainPanel.UpdateLayout();
566
                    GC.Collect();
567
                    ViewerDataModel.Instance.ImageViewPath = defaultBitmapImage;
568
                    ViewerDataModel.Instance.ImageViewWidth = defaultBitmapImage.PixelWidth;
569
                    ViewerDataModel.Instance.ImageViewHeight = defaultBitmapImage.PixelHeight;
570
                };
571
            }
572

    
573
            zoomAndPanCanvas.Width = Convert.ToDouble(e.CurrentPage.PAGE_WIDTH);
574
            zoomAndPanCanvas.Height = Convert.ToDouble(e.CurrentPage.PAGE_HEIGHT);
575

    
576

    
577
            Common.ViewerDataModel.Instance.ContentWidth = zoomAndPanCanvas.Width;
578
            Common.ViewerDataModel.Instance.ContentHeight = zoomAndPanCanvas.Height;
579
            inkBoard.Width = zoomAndPanCanvas.Width;
580
            inkBoard.Height = zoomAndPanCanvas.Height;
581

    
582

    
583

    
584
            if (!testPanel2.IsHidden)
585
            {
586
                Logger.sendCheckLog("pageNavigator_PageChanging_!testPanel2.IsHidden 일 때", 1);
587
                //PDF모드일때 잠시 대기(강인구)
588
                if (IsSyncPDFMode)
589
                {
590
                    Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
591
                    var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber)));
592

    
593
                    Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image Downloading", 1);
594
                    if (pdfpath.IsDownloading)
595
                    {
596
                        pdfpath.DownloadCompleted += (ex, arg) =>
597
                        {
598
                            Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image DownloadCompleted", 1);
599
                            ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
600
                            ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
601
                            ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
602
                            zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
603
                            zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
604
                        };
605
                    }
606
                    else
607
                    {
608
                        Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image Page Setting", 1);
609
                        ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
610
                        ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
611
                        ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
612

    
613
                        zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
614
                        zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
615
                    }
616
                }
617
                else
618
                {
619
                    Logger.sendCheckLog("pageNavigator_PageChanging_uri2 값 설정", 1);
620
                    string uri2 = "";
621
                    if (userData.COMPANY != "EXT")
622
                    {
623
                        uri2 = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, BalancePoint);
624
                    }
625
                    else
626
                    {
627
                        uri2 = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, BalancePoint);
628
                    }
629

    
630
                    Logger.sendCheckLog("pageNavigator_PageChanging_defaultBitmapImage_Compare BitmapImage 설정", 1);
631
                    var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri2));
632

    
633
                    Logger.sendCheckLog("pageNavigator_PageChanging_zoomAndPanCanvas2 Page Setting", 1);
634
                    ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
635
                    ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
636
                    ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
637
                    zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
638
                    zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
639

    
640
                    Logger.sendCheckLog("pageNavigator_PageChanging_zoomAndPanControl ZoomTo 설정", 1);
641
                    zoomAndPanControl.ZoomTo(new Rect
642
                    {
643
                        X = 0,
644
                        Y = 0,
645
                        Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width),
646
                        Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height),
647
                    });
648

    
649
                    Logger.sendCheckLog("pageNavigator_PageChanging_defaultBitmapImage_Compare Downloading", 1);
650
                    if (defaultBitmapImage_Compare.IsDownloading)
651
                    {
652
                        defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
653
                        {
654
                            Logger.sendCheckLog("pageNavigator_PageChanging_defaultBitmapImage_Compare DownloadCompleted", 1);
655
                            ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
656
                            ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
657
                            ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
658

    
659
                            zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
660
                            zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
661

    
662
                            zoomAndPanControl.ZoomTo(new Rect
663
                            {
664
                                X = 0,
665
                                Y = 0,
666
                                Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width),
667
                                Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height),
668
                            });
669
                        };
670
                    }
671
                }
672
                tlSyncPageNum.Text = String.Format("Current Page : {0}", BalancePoint);
673
            }
674

    
675
            this.pageNavigator.SetNextPage();
676

    
677
            if (zoomAndPanCanvas2.Width.IsNaN())
678
            {
679
                zoomAndPanControl.ZoomTo(new Rect { X = 0, Y = 0, Width = zoomAndPanCanvas.Width, Height = zoomAndPanCanvas.Height });
680
            }
681

    
682
            Logger.sendCheckLog("-- pageNavigator_PageChanging_ControlData Setting --", 1);
683
            Common.ViewerDataModel.Instance.MarkupControls_USER.Clear();    //전체 제거
684
            Common.ViewerDataModel.Instance.MarkupControls.Clear();         //전체 제거
685

    
686
            List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업
687
            foreach (var info in gridSelectionItem)
688
            {
689
                Logger.sendCheckLog(String.Format("==>{0}", info), 1);
690
            }
691
            /// fire selection event
692
            this.gridViewMarkup.UnselectAll();
693
            this.gridViewMarkup.Select(gridSelectionItem);
694

    
695
            if (!testPanel2.IsHidden)
696
            {
697
                ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
698
                ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
699
                ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
700

    
701
                Common.ViewerDataModel.Instance.MarkupControls_Sync.Clear();
702
                List<MarkupInfoItem> gridSelectionRevItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList();
703

    
704

    
705
                foreach (var item in gridSelectionRevItem)
706
                {
707
                    item.MarkupList.Where(pageItem => pageItem.PageNumber == BalancePoint).ToList().ForEach(delegate (MarkupItem markupitem)
708
                    {
709
                        MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID);
710
                    });
711
                }
712
            }
713

    
714
            var instanceMain = this.ParentOfType<MainWindow>();
715
            instanceMain.dzTopMenu.tlcurrentPage.Text = e.CurrentPage.PAGE_NUMBER.ToString();
716
            instanceMain.dzTopMenu.tlcurrentPage_readonly.Text = e.CurrentPage.PAGE_NUMBER.ToString();
717

    
718
            instanceMain.dzTopMenu.rotateOffSet = 0;
719
            var pageinfo = this.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == e.CurrentPage.PAGE_NUMBER).FirstOrDefault();
720
            drawingPannelRotate(pageinfo.PAGE_ANGLE);
721

    
722
            //}
723
            SetCommentPages(true);
724
        }
725

    
726

    
727
        
728

    
729
        private void SetCommentPages(bool onlyMe = false)
730
        {
731
            Logger.sendCheckLog("pageNavigator_PageChanging_SetCommentPages Setting", 1);
732
            List<UsersCommentPagesMember> _pages = new List<UsersCommentPagesMember>();
733
            foreach (var item in ViewerDataModel.Instance._markupInfoList)
734
            {
735
                UsersCommentPagesMember instance = new UsersCommentPagesMember();
736
                instance.UserName = item.UserName;
737
                instance.Depart = item.Depatment;
738
                instance.MarkupInfoID = item.MarkupInfoID;
739
                instance.IsSelected = true;
740
                instance.isConSolidation = item.Consolidate;
741
                instance.SetColor = item.DisplayColor;
742
                if (item.UserID == App.ViewInfo.UserID && item.MarkupInfoID == item.MarkupInfoID)
743
                {
744
                    instance.PageNumber = ViewerDataModel.Instance.MyMarkupList.Select(d => d.PageNumber).ToList();
745
                }
746
                else
747
                {
748
                    instance.PageNumber = ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.MarkupInfoID == item.MarkupInfoID).Select(d => d.PageNumber).ToList();
749
                }
750
                _pages.Add(instance);
751
            }
752
            this.pageNavigator.SetCommentList(_pages.ToList());
753
        }
754

    
755
        private void zoomAndPanControl_MouseWheel(object sender, MouseWheelEventArgs e)
756
        {
757
            if (e.MiddleButton == MouseButtonState.Pressed)
758
            {
759

    
760
            }
761
            e.Handled = true;
762
            if (e.Delta > 0)
763
            {
764
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas);
765
                ZoomIn(currentContentMousePoint);
766
            }
767
            else
768
            {
769
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas);
770
                ZoomOut(currentContentMousePoint);
771
            }
772
        }
773

    
774
        private void zoomAndPanControl2_MouseWheel(object sender, MouseWheelEventArgs e)
775
        {
776
            e.Handled = true;
777
            if (e.Delta > 0)
778
            {
779
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas2);
780
                ZoomIn_Sync(currentContentMousePoint);
781
            }
782
            else
783
            {
784
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas2);
785
                ZoomOut_Sync(currentContentMousePoint);
786
            }
787
        }
788

    
789
        #region ZoomIn & ZoomOut
790

    
791
        private void ZoomOut_Executed(object sender, ExecutedRoutedEventArgs e)
792
        {
793
            ZoomOut(new Point(zoomAndPanControl.ContentZoomFocusX,
794
                zoomAndPanControl.ContentZoomFocusY));
795
        }
796

    
797
        private void ZoomIn_Executed(object sender, ExecutedRoutedEventArgs e)
798
        {
799
            ZoomIn(new Point(zoomAndPanControl.ContentZoomFocusX,
800
                zoomAndPanControl.ContentZoomFocusY));
801
        }
802

    
803

    
804
        //강인구 추가 (줌 인아웃 수치 변경)
805
        //큰해상도의 문서일 경우 줌 인 아웃시 사이즈 변동이 큼
806
        private void ZoomOut(Point contentZoomCenter)
807
        {
808
            if (zoomAndPanControl.ContentScale > 0.39)
809
            {
810
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale - 0.2, contentZoomCenter);
811
            }
812
            else
813
            {
814
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale / 2, contentZoomCenter);
815
            }
816

    
817
            if (zoomAndPanControl2 != null && Sync.IsChecked)
818
            {
819
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl.ContentScale, contentZoomCenter);
820
            }
821
        }
822

    
823
        private void ZoomIn(Point contentZoomCenter)
824
        {
825
            if (zoomAndPanControl.ContentScale > 0.19)
826
            {
827
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale + 0.2, contentZoomCenter);
828
            }
829
            else
830
            {
831
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale * 2, contentZoomCenter);
832
            }
833

    
834
            if (zoomAndPanControl2 != null && Sync.IsChecked)
835
            {
836
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl.ContentScale, contentZoomCenter);
837
            }
838

    
839
        }
840

    
841
        private void ZoomOut_Sync(Point contentZoomCenter)
842
        {
843
            if (zoomAndPanControl2.ContentScale > 0.39)
844
            {
845
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale - 0.2, contentZoomCenter);
846
            }
847
            else
848
            {
849
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale / 2, contentZoomCenter);
850
            }
851

    
852
            if (Sync.IsChecked)
853
            {
854
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl2.ContentScale, contentZoomCenter);
855
            }
856
        }
857

    
858
        private void ZoomIn_Sync(Point contentZoomCenter)
859
        {
860
            if (zoomAndPanControl2.ContentScale > 0.19)
861
            {
862
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale + 0.2, contentZoomCenter);
863
            }
864
            else
865
            {
866
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale * 2, contentZoomCenter);
867
            }
868

    
869
            if (Sync.IsChecked)
870
            {
871
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl2.ContentScale, contentZoomCenter);
872
            }
873
        }
874

    
875
        private void ZoomOut()
876
        {
877
            zoomAndPanControl.ContentScale -= 0.1;
878
            //if (zoomAndPanControl2 != null)
879
            //{
880
            //    zoomAndPanControl2.ContentScale -= 0.1;
881
            //}
882
        }
883

    
884
        private void ZoomIn()
885
        {
886
            zoomAndPanControl.ContentScale += 0.1;
887
            //if (zoomAndPanControl2 != null)
888
            //{
889
            //    zoomAndPanControl2.ContentScale += 0.1;
890
            //}
891
        }
892

    
893
        #endregion
894

    
895
        private void init()
896
        {
897
            foreach (var item in ViewerDataModel.Instance.MarkupControls)
898
            {
899

    
900
                ControlList.Clear();
901
                listBox.Items.Clear();
902
                selected_item.Clear();
903

    
904
                (item as IMarkupCommonData).IsSelected = false;
905
            }
906

    
907
        }
908

    
909
        private HitTestResultBehavior MyCallback(HitTestResult result)
910
        {
911
            //this.cursor = Cursors.UpArrow;
912
            var element = result.VisualHit;
913
            while (element != null && !(element is CommentUserInfo))
914
                element = VisualTreeHelper.GetParent(element);
915

    
916
            if (element == null)
917
            {
918
                return HitTestResultBehavior.Stop;
919
            }
920
            else
921
            {
922
                if (element is CommentUserInfo)
923
                {
924
                    if (!hitList.Contains(element))
925
                    {
926
                        hitList.Add((CommentUserInfo)element);
927
                    }
928
                    else
929
                    {
930
                        return HitTestResultBehavior.Stop;
931
                    }
932
                    //IntersectionDetail intersectionDetail =
933
                    //((GeometryHitTestResult)result).IntersectionDetail;
934
                    //switch (intersectionDetail)
935
                    //{
936
                    //    case IntersectionDetail.FullyContains:
937
                    //        // Add the hit test result to the list:
938
                    //        hitList.Add((CommentUserInfo)result.VisualHit);
939
                    //        return HitTestResultBehavior.Continue;
940
                    //    case IntersectionDetail.Intersects:
941
                    //        // Set the behavior to return visuals at all z-order levels:
942
                    //        return HitTestResultBehavior.Continue;
943
                    //    case IntersectionDetail.FullyInside:
944
                    //        // Set the behavior to return visuals at all z-order levels:
945
                    //        return HitTestResultBehavior.Continue;
946
                    //    default:
947
                    //        return HitTestResultBehavior.Stop;
948
                    //}
949
                }
950
            }
951
            return HitTestResultBehavior.Continue;
952
        }
953

    
954
        public void ReleaseSelectPath()
955
        {
956
            if (SelectionPath == null)
957
            {
958
                SelectionPath = new Path();
959
                SelectionPath.Name = "";
960
            }
961
            if (SelectionPath.Name != "")
962
            {
963
                SelectionPath.Name = "None";
964
            }
965
            SelectionPath.Opacity = 0.01;
966
            SelectionPath.RenderTransform = null;
967
            SelectionPath.RenderTransformOrigin = new Point(0, 0);
968
        }
969

    
970
        #region 컨트롤 초기화 
971
        public void Control_Init(object control)
972
        {
973
            if (L_Size != 0 && (control as IPath) != null)
974
            {
975
                (control as IPath).LineSize = L_Size;
976
                L_Size = 0;
977
            }
978

    
979
            switch (control.GetType().Name)
980
            {
981
                case "RectangleControl":
982
                    {
983
                        (control as RectangleControl).StrokeColor = Brushes.Red;
984
                    }
985
                    break;
986
                case "CircleControl":
987
                    {
988
                        (control as CircleControl).StrokeColor = Brushes.Red;
989
                    }
990
                    break;
991
                case "TriControl":
992
                    {
993
                        (control as TriControl).StrokeColor = Brushes.Red;
994
                    }
995
                    break;
996
                case "RectCloudControl":
997
                    {
998
                        (control as RectCloudControl).StrokeColor = Brushes.Red;
999
                    }
1000
                    break;
1001
                case "CloudControl":
1002
                    {
1003
                        (control as CloudControl).StrokeColor = Brushes.Red;
1004
                    }
1005
                    break;
1006
                case "PolygonControl":
1007
                    {
1008
                        (control as PolygonControl).StrokeColor = Brushes.Red;
1009
                    }
1010
                    break;
1011
                case "ArcControl":
1012
                    {
1013
                        (control as ArcControl).StrokeColor = Brushes.Red;
1014
                    }
1015
                    break;
1016
                case "ArrowArcControl":
1017
                    {
1018
                        (control as ArrowArcControl).StrokeColor = Brushes.Red;
1019
                    }
1020
                    break;
1021
                case "LineControl":
1022
                    {
1023
                        (control as LineControl).StrokeColor = Brushes.Red;
1024
                    }
1025
                    break;
1026
                case "ArrowControl_Multi":
1027
                    {
1028
                        (control as ArrowControl_Multi).StrokeColor = Brushes.Red;
1029
                    }
1030
                    break;
1031
                case "TextControl":
1032
                    {
1033
                        (control as TextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1034
                    }
1035
                    break;
1036
                case "ArrowTextControl":
1037
                    {
1038
                        (control as ArrowTextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1039
                    }
1040
                    break;
1041
                case "InsideWhiteControl":
1042
                    {
1043
                        (control as InsideWhiteControl).StrokeColor = Brushes.White;
1044
                    }
1045
                    break;
1046
                case "OverlapWhiteControl":
1047
                    {
1048
                        (control as OverlapWhiteControl).StrokeColor = Brushes.White;
1049
                    }
1050
                    break;
1051
                case "ClipWhiteControl":
1052
                    {
1053
                        (control as ClipWhiteControl).StrokeColor = Brushes.White;
1054
                    }
1055
                    break;
1056
                case "CoordinateControl":
1057
                    {
1058
                        (control as CoordinateControl).StrokeColor = Brushes.Black;
1059
                    }
1060
                    break;
1061
            }
1062
        }
1063
        #endregion
1064

    
1065
        public void firstCondition_MouseLeave(object sender, MouseEventArgs e)
1066
        {
1067
            //Control_Init(e.Source);
1068
        }
1069
        private Window _dragdropWindow = null;
1070

    
1071
        [DllImport("user32.dll")]
1072
        [return: MarshalAs(UnmanagedType.Bool)]
1073
        internal static extern bool GetCursorPos(ref Win32Point pt);
1074

    
1075
        [StructLayout(LayoutKind.Sequential)]
1076
        internal struct Win32Point
1077
        {
1078
            public Int32 X;
1079
            public Int32 Y;
1080
        };
1081
        public string symbol_id = null;
1082
        public long symbol_group_id;
1083
        public int symbol_SelectedIndex;
1084
        public ImageSource symbol_img;
1085
        public string symbol_Data = null;
1086
        public void symboldata(string id, long group_id, int SelectedIndex, string Data_, ImageSource img)
1087
        {
1088
            if (this._dragdropWindow != null)
1089
            {
1090
                this._dragdropWindow.Close();
1091
                this._dragdropWindow = null;
1092
            }
1093

    
1094
            symbol_id = id;
1095
            symbol_group_id = group_id;
1096
            symbol_SelectedIndex = SelectedIndex;
1097
            symbol_Data = Data_;
1098
            symbol_img = img;
1099

    
1100
      
1101
            CreateDragDropWindow2(img);
1102
        }
1103

    
1104
        private void CreateDragDropWindow2(ImageSource image)
1105
        {
1106
            this._dragdropWindow = new Window();
1107
            _dragdropWindow.Cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1108
            _dragdropWindow.WindowStyle = WindowStyle.None;
1109
            _dragdropWindow.AllowsTransparency = true;           
1110
            _dragdropWindow.AllowDrop = false;
1111
            _dragdropWindow.Background = null;
1112
            _dragdropWindow.IsHitTestVisible = false;
1113
            _dragdropWindow.SizeToContent = SizeToContent.WidthAndHeight;
1114
            _dragdropWindow.Topmost = true;
1115
            _dragdropWindow.ShowInTaskbar = false;
1116
            
1117
            Rectangle r = new Rectangle();
1118
            r.Width = image.Width;
1119
            r.Height = image.Height;
1120
            r.Opacity = 0.5;            
1121
            r.Fill = new ImageBrush(image);
1122
            this._dragdropWindow.Content = r;
1123

    
1124
            Win32Point w32Mouse = new Win32Point();
1125
            GetCursorPos(ref w32Mouse);
1126

    
1127
            //w32Mouse.X = getCurrentPoint.X;
1128
            this._dragdropWindow.Left = w32Mouse.X - (image.Width / 2);
1129
            this._dragdropWindow.Top = w32Mouse.Y - (image.Height / 2); 
1130
            this._dragdropWindow.Show();
1131
        }
1132

    
1133
        private void zoomAndPanControl_MouseMove(object sender, MouseEventArgs e)
1134
        {
1135
            if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
1136
            {
1137
                if (!floatingTip.IsOpen) { floatingTip.IsOpen = true; }
1138

    
1139
                Point currentPos = e.GetPosition(rect);
1140

    
1141
                floatingTip.HorizontalOffset = currentPos.X + 20;
1142
                floatingTip.VerticalOffset = currentPos.Y;
1143

    
1144

    
1145
                //ToolTip tool = new System.Windows.Controls.ToolTip();
1146
                //tool.Content = "ToolTip";
1147
                //panel.ToolTip = tool;
1148
            }
1149

    
1150
            if (mouseHandlingMode != MouseHandlingMode.Drawing)
1151
            {
1152
                #region 마우스 오버 시 색상 변경
1153
                //var firstCondition = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
1154
                //Color TempColor = MarkupToPDF.Controls.Common.ValueConverter.StringToColorConverter.Parse("FF07B4FF");
1155

    
1156
                //if (firstCondition != null)
1157
                //{
1158
                //    firstCondition.MouseLeave += new System.Windows.Input.MouseEventHandler(firstCondition_MouseLeave);
1159

    
1160
                //    if (firstCondition.GetType().Name == "TextControl")
1161
                //    {
1162
                //        (firstCondition as TextControl).BackInnerColor = new SolidColorBrush(TempColor);
1163
                //        return;
1164
                //    }
1165
                //    else if (firstCondition.GetType().Name == "ArrowTextControl")
1166
                //    {
1167
                //        (firstCondition as ArrowTextControl).BackInnerColor = new SolidColorBrush(TempColor);
1168
                //        return;
1169
                //    }
1170

    
1171
                //    if (L_Size == 0)
1172
                //    {
1173
                //        L_Size = (firstCondition as IPath).LineSize;
1174
                //        (firstCondition as IPath).LineSize *= 4;
1175
                //    }
1176
                //    switch (firstCondition.GetType().Name)
1177
                //    {
1178
                //        case "RectangleControl":
1179
                //            {
1180
                //                (firstCondition as RectangleControl).StrokeColor = new SolidColorBrush(TempColor);
1181
                //            }
1182
                //            break;
1183
                //        case "CircleControl":
1184
                //            {
1185
                //                (firstCondition as CircleControl).StrokeColor = new SolidColorBrush(TempColor);
1186
                //            }
1187
                //            break;
1188
                //        case "TriControl":
1189
                //            {
1190
                //                (firstCondition as TriControl).StrokeColor = new SolidColorBrush(TempColor);
1191
                //            }
1192
                //            break;
1193
                //        case "RectCloudControl":
1194
                //            {
1195
                //                (firstCondition as RectCloudControl).StrokeColor = new SolidColorBrush(TempColor);
1196
                //            }
1197
                //            break;
1198
                //        case "CloudControl":
1199
                //            {
1200
                //                (firstCondition as CloudControl).StrokeColor = new SolidColorBrush(TempColor);
1201
                //            }
1202
                //            break;
1203
                //        case "PolygonControl":
1204
                //            {
1205
                //                (firstCondition as PolygonControl).StrokeColor = new SolidColorBrush(TempColor);
1206
                //            }
1207
                //            break;
1208
                //        case "ArcControl":
1209
                //            {
1210
                //                (firstCondition as ArcControl).StrokeColor = new SolidColorBrush(TempColor);
1211
                //            }
1212
                //            break;
1213
                //        case "LineControl":
1214
                //            {
1215
                //                (firstCondition as LineControl).StrokeColor = new SolidColorBrush(TempColor);
1216
                //            }
1217
                //            break;
1218
                //        case "ArrowControl_Multi":
1219
                //            {
1220
                //                (firstCondition as ArrowControl_Multi).StrokeColor = new SolidColorBrush(TempColor);
1221
                //            }
1222
                //            break;
1223

    
1224
                //        default:
1225
                //            {
1226

    
1227
                //            }
1228
                //            break;
1229
                //    }
1230
                //} 
1231
                #endregion
1232
            }
1233

    
1234
            getCurrentPoint = e.GetPosition(drawingRotateCanvas);
1235
            #region 주석
1236
            //if (mouseButtonDown == MouseButton.Middle)
1237
            //{
1238
            //    SetCursor();
1239
            //    Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1240
            //    Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1241

    
1242
            //    Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
1243
            //    zoomAndPanControl.ContentOffsetX -= dragOffset.X;
1244
            //    zoomAndPanControl.ContentOffsetY -= dragOffset.Y;
1245

    
1246
            //    //SetCursor();
1247
            //    //Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1248
            //    //Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1249

    
1250
            //    //Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
1251

    
1252
            //    //zoomAndPanControl.ContentOffsetX += 1;
1253
            //    //zoomAndPanControl.ContentOffsetY += 1;
1254

    
1255
            //    //zoomAndPanControl.ContentOffsetX += dragOffset.X;
1256
            //    //zoomAndPanControl.ContentOffsetY += dragOffset.Y;
1257
            //}
1258
            #endregion
1259

    
1260
            if ((e.MiddleButton == MouseButtonState.Pressed) || (e.RightButton == MouseButtonState.Pressed))
1261
            {
1262
                SetCursor();
1263
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1264
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1265

    
1266
                Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
1267
                zoomAndPanControl.ContentOffsetX -= dragOffset.X;
1268
                zoomAndPanControl.ContentOffsetY -= dragOffset.Y;
1269

    
1270
                if (Sync.IsChecked)
1271
                {
1272
                    ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
1273
                    ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
1274
                }
1275
            }
1276

    
1277
            if (mouseHandlingMode == MouseHandlingMode.Drawing && currentControl != null)
1278
            {
1279
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1280
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1281
                SetCursor();
1282

    
1283
                if (IsDrawing)
1284
                {
1285
                    if (currentControl == null)
1286
                    {
1287
                        switch (controlType)
1288
                        {
1289
                            case ControlType.PenControl:
1290
                                {
1291
                                    if (inkBoard.Tag.ToString() == "Ink")
1292
                                    {
1293
                                        stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y));
1294
                                    }
1295
                                    else if (inkBoard.Tag.ToString() == "EraseByPoint")
1296
                                    {
1297
                                        RemovePointStroke(currentCanvasDrawingMouseMovePoint);
1298
                                    }
1299
                                    else if (inkBoard.Tag.ToString() == "EraseByStroke")
1300
                                    {
1301
                                        RemoveLineStroke(currentCanvasDrawingMouseMovePoint);
1302
                                    }
1303

    
1304
                                    //inkBoard.Strokes.Add(stroke);
1305
                                }
1306
                                break;
1307
                        }
1308
                        return;
1309
                    }
1310
                }
1311

    
1312
                if (currentControl != null)
1313
                {
1314
                    double moveX = currentCanvasDrawingMouseMovePoint.X - canvasDrawingMouseDownPoint.X;
1315
                    double moveY = currentCanvasDrawingMouseMovePoint.Y - canvasDrawingMouseDownPoint.Y;
1316
                    //강인구 추가
1317
                    currentControl.Opacity = ViewerDataModel.Instance.ControlOpacity;
1318

    
1319
                    if ((currentControl as IPath) != null)
1320
                    {
1321
                        (currentControl as IPath).LineSize = ViewerDataModel.Instance.LineSize;
1322
                    }
1323
                    if ((currentControl as LineControl) != null)
1324
                    {
1325
                        (currentControl as LineControl).Interval = ViewerDataModel.Instance.Interval;
1326
                    }
1327

    
1328
                    if ((currentControl as IShapeControl) != null)
1329
                    {
1330
                        (currentControl as IShapeControl).Paint = ViewerDataModel.Instance.paintSet;
1331
                    }
1332
                    if ((currentControl as TextControl) != null)
1333
                    {
1334
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true)
1335
                        {
1336
                            (currentControl as TextControl).TextStyle = FontStyles.Italic;
1337
                        }
1338
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true)
1339
                        {
1340
                            (currentControl as TextControl).TextWeight = FontWeights.Bold;
1341
                        }
1342
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true)
1343
                        {
1344
                            (currentControl as TextControl).UnderLine = TextDecorations.Underline;
1345
                        }
1346
                    }
1347
                    else if ((currentControl as ArrowTextControl) != null)
1348
                    {
1349
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true)
1350
                        {
1351
                            (currentControl as ArrowTextControl).TextStyle = FontStyles.Italic;
1352
                        }
1353
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true)
1354
                        {
1355
                            (currentControl as ArrowTextControl).TextWeight = FontWeights.Bold;
1356
                        }
1357
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true)
1358
                        {
1359
                            (currentControl as ArrowTextControl).UnderLine = TextDecorations.Underline;
1360
                        }
1361
                    }
1362
                    else if ((currentControl as RectCloudControl) != null)
1363
                    {
1364
                        (currentControl as RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
1365
                    }
1366
                    else if ((currentControl as CloudControl) != null)
1367
                    {
1368
                        (currentControl as CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
1369
                    }
1370

    
1371
                    switch (controlType)
1372
                    {
1373
                        case (ControlType.Coordinate):
1374
                            {
1375
                                var control = currentControl as CoordinateControl;
1376

    
1377
                                if (control != null)
1378
                                {
1379
                                    if (move.mousemode == MouseMode.Drawing)
1380
                                    {
1381
                                        //move.control_Move(ControlList, true, moveX, moveY);
1382
                                    }
1383
                                    else
1384
                                    {
1385
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1386
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1387
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1388
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1389

    
1390

    
1391
                                        if (ViewerDataModel.Instance.IsPressShift)
1392
                                        {
1393
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1394
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1395
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1396
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1397
                                        }
1398

    
1399
                                        control.PointSet = new List<Point>
1400
                                        {
1401
                                            control.StartPoint,
1402
                                            control.LeftBottomPoint,
1403
                                            control.EndPoint,
1404
                                            control.TopRightPoint,
1405
                                        };
1406
                                        control.updateControl();
1407
                                    }
1408

    
1409
                                    //강인구 추가
1410
                                    control.ControlType = controlType;
1411
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1412
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1413
                                    //  control.Paint = PaintSet.Fill;
1414
                                }
1415
                            }
1416
                            break;
1417
                        case (ControlType.InsideWhite):
1418
                            {
1419
                                var control = currentControl as InsideWhiteControl;
1420

    
1421
                                if (control != null)
1422
                                {
1423
                                    if (move.mousemode == MouseMode.Drawing)
1424
                                    {
1425
                                        //move.control_Move(ControlList, true, moveX, moveY);
1426
                                    }
1427
                                    else
1428
                                    {
1429
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1430
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1431
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1432
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1433

    
1434

    
1435
                                        if (ViewerDataModel.Instance.IsPressShift)
1436
                                        {
1437
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1438
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1439
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1440
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1441
                                        }
1442

    
1443
                                        control.PointSet = new List<Point>
1444
                                        {
1445
                                            control.StartPoint,
1446
                                            control.LeftBottomPoint,
1447
                                            control.EndPoint,
1448
                                            control.TopRightPoint,
1449
                                        };
1450
                                        control.updateControl();
1451
                                    }
1452

    
1453
                                    //강인구 추가
1454
                                    control.ControlType = controlType;
1455
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1456
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1457
                                    control.Paint = PaintSet.Fill;
1458
                                }
1459
                            }
1460
                            break;
1461
                        case (ControlType.OverlapWhite):
1462
                            {
1463
                                var control = currentControl as OverlapWhiteControl;
1464

    
1465
                                if (control != null)
1466
                                {
1467
                                    if (move.mousemode == MouseMode.Drawing)
1468
                                    {
1469
                                        //move.control_Move(ControlList, true, moveX, moveY);
1470
                                    }
1471
                                    else
1472
                                    {
1473
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1474
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1475
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1476
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1477

    
1478

    
1479
                                        if (ViewerDataModel.Instance.IsPressShift)
1480
                                        {
1481
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1482
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1483
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1484
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1485
                                        }
1486

    
1487
                                        control.PointSet = new List<Point>
1488
                                        {
1489
                                            control.StartPoint,
1490
                                            control.LeftBottomPoint,
1491
                                            control.EndPoint,
1492
                                            control.TopRightPoint,
1493
                                        };
1494
                                        control.updateControl();
1495
                                    }
1496

    
1497
                                    //강인구 추가
1498
                                    control.ControlType = controlType;
1499
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1500
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1501
                                    control.Paint = PaintSet.Fill;
1502
                                }
1503
                            }
1504
                            break;
1505
                        case (ControlType.ClipWhite):
1506
                            {
1507
                                var control = currentControl as ClipWhiteControl;
1508

    
1509
                                if (control != null)
1510
                                {
1511
                                    if (move.mousemode == MouseMode.Drawing)
1512
                                    {
1513
                                        //move.control_Move(ControlList, true, moveX, moveY);
1514
                                    }
1515
                                    else
1516
                                    {
1517
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1518
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1519
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1520
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1521

    
1522

    
1523
                                        if (ViewerDataModel.Instance.IsPressShift)
1524
                                        {
1525
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1526
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1527
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1528
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1529
                                        }
1530

    
1531
                                        control.PointSet = new List<Point>
1532
                                        {
1533
                                            control.StartPoint,
1534
                                            control.LeftBottomPoint,
1535
                                            control.EndPoint,
1536
                                            control.TopRightPoint,
1537
                                        };
1538
                                        control.updateControl();
1539
                                    }
1540

    
1541
                                    //강인구 추가
1542
                                    control.ControlType = controlType;
1543
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1544
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1545
                                    control.Paint = PaintSet.Fill;
1546
                                }
1547
                            }
1548
                            break;
1549
                        case ControlType.Rectangle:
1550
                            {
1551
                                var control = currentControl as RectangleControl;
1552

    
1553
                                if (control != null)
1554
                                {
1555
                                    if (move.mousemode == MouseMode.Drawing)
1556
                                    {
1557
                                        //move.control_Move(ControlList, true, moveX, moveY);
1558
                                    }
1559
                                    else
1560
                                    {
1561
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1562
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1563
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1564
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1565

    
1566

    
1567
                                        if (ViewerDataModel.Instance.IsPressShift)
1568
                                        {
1569
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1570
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1571
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1572
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1573
                                        }
1574

    
1575
                                        control.PointSet = new List<Point>
1576
                                        {
1577
                                            control.StartPoint,
1578
                                            control.LeftBottomPoint,
1579
                                            control.EndPoint,
1580
                                            control.TopRightPoint,
1581
                                        };
1582
                                        control.updateControl();
1583
                                    }
1584

    
1585
                                    //강인구 추가
1586
                                    control.ControlType = controlType;
1587
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1588
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1589
                                }
1590
                            }
1591
                            break;
1592

    
1593
                        case ControlType.RectCloud:
1594
                            {
1595
                                var control = currentControl as RectCloudControl;
1596

    
1597
                                if (control != null)
1598
                                {
1599
                                    if (move.mousemode == MouseMode.Drawing)
1600
                                    {
1601
                                        //move.control_Move(ControlList, true, moveX, moveY);
1602
                                    }
1603
                                    else
1604
                                    {
1605
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1606
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1607
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1608
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1609

    
1610
                                        if (ViewerDataModel.Instance.IsPressShift)
1611
                                        {
1612
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1613
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1614
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1615
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1616
                                        }
1617

    
1618
                                        control.PointSet = new List<Point>
1619
                                        {
1620
                                            control.StartPoint,
1621
                                            control.LeftBottomPoint,
1622
                                            control.EndPoint,
1623
                                            control.TopRightPoint,
1624
                                        };
1625
                                    }
1626

    
1627
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1628
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1629
                                }
1630
                            }
1631
                            break;
1632

    
1633
                        case ControlType.SingleLine:
1634
                            {
1635
                                var control = currentControl as LineControl;
1636
                                if (control != null)
1637
                                {
1638
                                    control.LineStyleSet = LineStyleSet.SingleLine;
1639
                                    control.ControlType = controlType;
1640
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1641
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1642
                                    Point tempPoint = control.EndPoint;
1643

    
1644
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1645
                                    {
1646
                                        //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1647
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1648
                                        control.EndPoint = tempPoint;
1649
                                    }
1650
                                    else
1651
                                    {
1652
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1653
                                    }
1654

    
1655
                                    control.PointSet = new List<Point>
1656
                                        {
1657
                                            control.StartPoint,
1658
                                            control.EndPoint,
1659
                                        };
1660

    
1661
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1662
                                }
1663

    
1664
                            }
1665
                            break;
1666

    
1667
                        case ControlType.CancelLine:
1668
                            {
1669
                                var control = currentControl as LineControl;
1670
                                if (control != null)
1671
                                {
1672
                                    control.LineStyleSet = LineStyleSet.CancelLine;
1673
                                    //control.LineStyle = LineControl.LineStyleSet.MultiLine;
1674
                                    control.ControlType = controlType;
1675
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1676
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1677
                                    Point tempPoint = control.EndPoint;
1678

    
1679
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1680
                                    {
1681
                                        //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1682
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1683
                                        control.EndPoint = tempPoint;
1684
                                    }
1685
                                    else
1686
                                    {
1687
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1688
                                    }
1689

    
1690

    
1691
                                    control.PointSet = new List<Point>
1692
                                            {
1693
                                                control.StartPoint,
1694
                                                control.EndPoint,
1695
                                            };
1696
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1697
                                }
1698

    
1699

    
1700
                            }
1701
                            break;
1702

    
1703
                        case ControlType.ArrowLine:
1704
                            {
1705
                                var control = currentControl as LineControl;
1706
                                if (control != null)
1707
                                {
1708
                                    control.LineStyleSet = LineStyleSet.ArrowLine;
1709
                                    control.ControlType = controlType;
1710
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1711
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1712
                                    Point tempPoint = control.EndPoint;
1713

    
1714
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1715
                                    {
1716
                                        //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1717
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1718
                                        control.EndPoint = tempPoint;
1719
                                    }
1720
                                    else
1721
                                    {
1722
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1723
                                    }
1724

    
1725

    
1726
                                    control.PointSet = new List<Point>
1727
                                            {
1728
                                                control.StartPoint,
1729
                                                control.EndPoint,
1730
                                            };
1731
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1732
                                }
1733
                            }
1734
                            break;
1735

    
1736
                        case ControlType.TwinLine:
1737
                            {
1738
                                var control = currentControl as LineControl;
1739
                                if (control != null)
1740
                                {
1741
                                    control.LineStyleSet = LineStyleSet.TwinLine;
1742
                                    control.ControlType = controlType;
1743
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1744
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1745
                                    Point tempPoint = control.EndPoint;
1746

    
1747
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1748
                                    {
1749
                                        //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1750
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1751
                                        control.EndPoint = tempPoint;
1752
                                    }
1753
                                    else
1754
                                    {
1755
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1756
                                    }
1757

    
1758

    
1759
                                    control.PointSet = new List<Point>
1760
                                            {
1761
                                                control.StartPoint,
1762
                                                control.EndPoint,
1763
                                            };
1764
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1765
                                }
1766
                            }
1767
                            break;
1768

    
1769
                        case ControlType.DimLine:
1770
                            {
1771
                                var control = currentControl as LineControl;
1772
                                if (control != null)
1773
                                {
1774
                                    control.LineStyleSet = LineStyleSet.DimLine;
1775
                                    control.ControlType = controlType;
1776
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1777
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1778
                                    Point tempPoint = control.EndPoint;
1779

    
1780
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1781
                                    {
1782
                                        //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1783
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1784
                                        control.EndPoint = tempPoint;
1785
                                    }
1786
                                    else
1787
                                    {
1788
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1789
                                    }
1790

    
1791
                                    control.PointSet = new List<Point>
1792
                                            {
1793
                                                control.StartPoint,
1794
                                                control.EndPoint,
1795
                                            };
1796
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1797
                                }
1798
                            }
1799
                            break;
1800

    
1801
                        case ControlType.ArcLine:
1802
                            {
1803
                                var control = currentControl as ArcControl;
1804
                                if (control != null)
1805
                                {
1806
                                    control.isTransOn = false;
1807
                                    control.ControlType = controlType;
1808
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1809
                                    control.MidPoint = new Point(0, 0);
1810
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1811
                                    Point tempPoint = control.EndPoint;
1812

    
1813
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1814
                                    {
1815
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1816
                                        control.EndPoint = tempPoint;
1817
                                    }
1818
                                    else
1819
                                    {
1820
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1821
                                    }
1822

    
1823

    
1824
                                    control.PointSet = new List<Point>
1825
                                            {
1826
                                                control.StartPoint,
1827
                                                control.MidPoint,
1828
                                                control.EndPoint,
1829
                                            };
1830
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1831
                                }
1832
                            }
1833
                            break;
1834

    
1835
                        case ControlType.ArcArrow:
1836
                            {
1837
                                var control = currentControl as ArrowArcControl;
1838
                                if (control != null)
1839
                                {
1840
                                    control.isTransOn = false;
1841
                                    control.ControlType = controlType;
1842
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1843
                                    control.MidPoint = new Point(0, 0);
1844
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1845
                                    Point tempPoint = control.EndPoint;
1846

    
1847
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1848
                                    {
1849
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1850
                                        control.EndPoint = tempPoint;
1851
                                    }
1852
                                    else
1853
                                    {
1854
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1855
                                    }
1856

    
1857

    
1858
                                    control.PointSet = new List<Point>
1859
                                            {
1860
                                                control.StartPoint,
1861
                                                control.MidPoint,
1862
                                                control.EndPoint,
1863
                                            };
1864
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1865
                                }
1866
                            }
1867
                            break;
1868

    
1869
                        case ControlType.ArrowMultiLine:
1870
                            {
1871
                                var control = currentControl as ArrowControl_Multi;
1872
                                if (control != null)
1873
                                {
1874
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1875
                                    Point tempPoint = control.EndPoint;
1876
                                    if (control.MiddlePoint == new Point(0, 0))
1877
                                    {
1878
                                        if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1879
                                        {
1880
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1881
                                            //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1882
                                            control.EndPoint = tempPoint;
1883
                                        }
1884
                                        else
1885
                                        {
1886
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1887
                                        }
1888
                                    }
1889
                                    else
1890
                                    {
1891
                                        if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1892
                                        {
1893
                                            //var AngleValue = MathSet.returnAngleString(control.MiddlePoint, ref tempPoint, true);
1894
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.MiddlePoint, ref tempPoint, true);
1895
                                            control.EndPoint = tempPoint;
1896
                                        }
1897
                                        else
1898
                                        {
1899
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.MiddlePoint, ref tempPoint, false);
1900
                                        }
1901

    
1902
                                    }
1903

    
1904
                                    control.PointSet = new List<Point>
1905
                                            {
1906
                                                control.StartPoint,
1907
                                                control.MiddlePoint,
1908
                                                control.EndPoint,
1909
                                            };
1910
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1911
                                }
1912
                            }
1913
                            break;
1914

    
1915
                        case ControlType.Circle:
1916
                            {
1917
                                var control = currentControl as CircleControl;
1918

    
1919
                                if (control != null)
1920
                                {
1921
                                    if (move.mousemode == MouseMode.Drawing)
1922
                                    {
1923
                                        //move.control_Move(ControlList, true, moveX, moveY);
1924
                                    }
1925
                                    else
1926
                                    {
1927
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1928
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1929
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1930
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1931

    
1932
                                        if (ViewerDataModel.Instance.IsPressShift)
1933
                                        {
1934
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1935
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1936
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1937
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1938
                                        }
1939

    
1940
                                        control.PointSet = new List<Point>
1941
                                        {
1942
                                            control.StartPoint,
1943
                                            control.LeftBottomPoint,
1944
                                            control.EndPoint,
1945
                                            control.TopRightPoint,
1946
                                        };
1947
                                    }
1948

    
1949
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1950
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1951

    
1952
                                }
1953
                            }
1954
                            break;
1955

    
1956
                        case ControlType.PolygonCloud:
1957
                            {
1958
                                var control = currentControl as CloudControl;
1959

    
1960
                                if (control != null)
1961
                                {
1962
                                    control.isTransOn = true;
1963
                                    control.PointSet.RemoveAt(control.PointSet.Count - 1);
1964

    
1965
                                    control.PointSet.Add(currentCanvasDrawingMouseMovePoint);
1966

    
1967
                                    control.SetCloud();
1968
                                    //강인구 추가
1969
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1970
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1971
                                }
1972
                            }
1973
                            break;
1974

    
1975
                        case ControlType.Triangle:
1976
                            {
1977
                                var control = currentControl as TriControl;
1978

    
1979
                                if (control != null)
1980
                                {
1981
                                    if (move.mousemode == MouseMode.Drawing)
1982
                                    {
1983
                                        //move.control_Move(ControlList, true, moveX, moveY);
1984
                                    }
1985
                                    else
1986
                                    {
1987
                                        control.Paint = ViewerDataModel.Instance.paintSet;
1988
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1989

    
1990
                                        if (ViewerDataModel.Instance.checkAxis)
1991
                                        {
1992
                                            Point tempPoint = control.EndPoint;
1993
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1994
                                            control.EndPoint = tempPoint;
1995
                                        }
1996

    
1997

    
1998
                                        if (ViewerDataModel.Instance.IsPressShift)
1999
                                        {
2000
                                            List<Point> Points = GetRegularTrianglePoints(control.StartPoint, control.EndPoint);
2001
                                            if (2 == Points.Count())
2002
                                            {
2003
                                                control.MidPoint = Points[0];
2004
                                                control.EndPoint = Points[1];
2005
                                            }
2006
                                        }
2007

    
2008
                                        control.PointSet = new List<Point>
2009
                                            {
2010
                                                control.StartPoint,
2011
                                                control.MidPoint,
2012
                                                control.EndPoint,
2013
                                            };
2014
                                    }
2015

    
2016
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
2017
                                    control.Paint = ViewerDataModel.Instance.paintSet;
2018
                                }
2019
                            }
2020
                            break;
2021

    
2022
                        case ControlType.ImgControl:
2023
                            {
2024
                                var control = currentControl as ImgControl;
2025

    
2026
                                if (control != null)
2027
                                {
2028
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2029
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2030
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2031
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2032

    
2033
                                    control.PointSet = new List<Point>
2034
                                        {
2035
                                            control.StartPoint,
2036
                                            control.LeftBottomPoint,
2037
                                            control.EndPoint,
2038
                                            control.TopRightPoint,
2039
                                        };
2040
                                }
2041
                            }
2042
                            break;
2043

    
2044
                        case ControlType.Date:
2045
                            {
2046
                                var control = currentControl as DateControl;
2047

    
2048
                                if (control != null)
2049
                                {
2050
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2051
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2052
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2053
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2054
                                    //control.Text = DateTime.Now.ToString("yyyy-MM-dd");
2055

    
2056
                                    control.PointSet = new List<Point>
2057
                                        {
2058
                                            control.StartPoint,
2059
                                            control.LeftBottomPoint,
2060
                                            control.EndPoint,
2061
                                            control.TopRightPoint,
2062
                                        };
2063
                                }
2064
                            }
2065
                            break;
2066

    
2067
                        case ControlType.ArrowTextControl:
2068
                            {
2069
                                var control = currentControl as ArrowTextControl;
2070

    
2071
                                if (control != null)
2072
                                {
2073
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2074
                                    Point tempPoint = control.EndPoint;
2075

    
2076
                                    control.MidPoint = new Point(control.EndPoint.X - 100, control.EndPoint.Y - 100);
2077

    
2078
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2079
                                    {
2080
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2081
                                        control.EndPoint = tempPoint;
2082
                                    }
2083
                                    else
2084
                                    {
2085
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2086
                                    }
2087
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2088

    
2089
                                    control.PointSet = new List<Point>
2090
                                            {
2091
                                                control.StartPoint,
2092
                                                control.MidPoint,
2093
                                                control.EndPoint,
2094
                                            };
2095
                                }
2096
                            }
2097
                            break;
2098

    
2099
                        case ControlType.ArrowTransTextControl:
2100
                            {
2101
                                var control = currentControl as ArrowTextControl;
2102

    
2103
                                if (control != null)
2104
                                {
2105
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2106
                                    Point tempPoint = control.EndPoint;
2107
                                    //control.MidPoint = currentCanvasDrawingMouseMovePoint;
2108

    
2109
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2110
                                    {
2111
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2112
                                        control.EndPoint = tempPoint;
2113
                                    }
2114
                                    else
2115
                                    {
2116
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2117
                                    }
2118
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2119
                                    control.isFixed = true;
2120

    
2121
                                    control.PointSet = new List<Point>
2122
                                            {
2123
                                                control.StartPoint,
2124
                                                control.MidPoint,
2125
                                                control.EndPoint,
2126
                                            };
2127
                                }
2128
                            }
2129
                            break;
2130

    
2131
                        case ControlType.ArrowTextBorderControl:
2132
                            {
2133
                                var control = currentControl as ArrowTextControl;
2134

    
2135
                                if (control != null)
2136
                                {
2137
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2138
                                    Point tempPoint = control.EndPoint;
2139
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2140
                                    {
2141
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2142
                                        control.EndPoint = tempPoint;
2143
                                    }
2144
                                    else
2145
                                    {
2146
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2147
                                    }
2148
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2149
                                    control.PointSet = new List<Point>
2150
                                            {
2151
                                                control.StartPoint,
2152
                                                control.MidPoint,
2153
                                                control.EndPoint,
2154
                                            };
2155
                                }
2156

    
2157
                            }
2158
                            break;
2159
                        case ControlType.ArrowTransTextBorderControl:
2160
                            {
2161
                                var control = currentControl as ArrowTextControl;
2162

    
2163
                                if (control != null)
2164
                                {
2165
                                    control.isFixed = true;
2166
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2167
                                    Point tempPoint = control.EndPoint;
2168
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2169
                                    {
2170
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2171
                                        control.EndPoint = tempPoint;
2172
                                    }
2173
                                    else
2174
                                    {
2175
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2176
                                    }
2177

    
2178
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2179
                                    control.PointSet = new List<Point>
2180
                                            {
2181
                                                control.StartPoint,
2182
                                                control.MidPoint,
2183
                                                control.EndPoint,
2184
                                            };
2185
                                }
2186

    
2187
                            }
2188
                            break;
2189
                        case ControlType.ArrowTextCloudControl:
2190
                            {
2191
                                var control = currentControl as ArrowTextControl;
2192

    
2193
                                if (control != null)
2194
                                {
2195
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2196
                                    Point tempPoint = control.EndPoint;
2197
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2198
                                    {
2199
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2200
                                        control.EndPoint = tempPoint;
2201
                                    }
2202
                                    else
2203
                                    {
2204
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2205
                                    }
2206
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2207
                                    control.PointSet = new List<Point>
2208
                                            {
2209
                                                control.StartPoint,
2210
                                                control.MidPoint,
2211
                                                control.EndPoint,
2212
                                            };
2213
                                }
2214

    
2215
                            }
2216
                            break;
2217
                        case ControlType.ArrowTransTextCloudControl:
2218
                            {
2219
                                var control = currentControl as ArrowTextControl;
2220

    
2221
                                if (control != null)
2222
                                {
2223
                                    control.isFixed = true;
2224
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2225
                                    Point tempPoint = control.EndPoint;
2226
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2227
                                    {
2228
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2229
                                        control.EndPoint = tempPoint;
2230
                                    }
2231
                                    else
2232
                                    {
2233
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2234
                                    }
2235
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2236
                                    control.PointSet = new List<Point>
2237
                                            {
2238
                                                control.StartPoint,
2239
                                                control.MidPoint,
2240
                                                control.EndPoint,
2241
                                            };
2242
                                }
2243

    
2244
                            }
2245
                            break;
2246
                        case ControlType.PolygonControl:
2247
                        case ControlType.ChainLine:
2248
                            {
2249
                                var control = currentControl as PolygonControl;
2250

    
2251
                                if (control != null)
2252
                                {
2253
                                    control.PointSet.RemoveAt(control.PointSet.Count - 1);
2254
                                    Point tempPoint = currentCanvasDrawingMouseMovePoint;
2255
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2256
                                    {
2257
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.PointSet[control.PointSet.Count - 1], ref tempPoint, true);
2258
                                    }
2259
                                    control.PointSet.Add(currentCanvasDrawingMouseMovePoint);
2260

    
2261
                                    control.Paint = ViewerDataModel.Instance.paintSet;
2262
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
2263
                                    control.Paint = ViewerDataModel.Instance.paintSet;
2264
                                    control.updateControl();
2265
                                }
2266
                            }
2267
                            break;
2268
                        //강인구 추가
2269
                        case ControlType.Sign:
2270
                            {
2271
                                var control = currentControl as SignControl;
2272

    
2273
                                if (control != null)
2274
                                {
2275
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2276
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2277
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2278
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2279

    
2280
                                    if (control.StartPoint != control.EndPoint && control.SignImage == null)
2281
                                    {
2282
                                        var _sign = GetUserSign.GetSign(App.ViewInfo.UserID, App.ViewInfo.ProjectNO);
2283
                                        byte[] imageBytes = System.Convert.FromBase64String(_sign);
2284
                                        System.IO.MemoryStream stream = new System.IO.MemoryStream();
2285
                                        stream.Write(imageBytes, 0, imageBytes.Length);
2286
                                        stream.Position = 0;
2287
                                        System.Drawing.Image img = System.Drawing.Image.FromStream(stream);
2288
                                        BitmapImage returnImage = new BitmapImage();
2289
                                        returnImage.BeginInit();
2290
                                        System.IO.MemoryStream ms = new System.IO.MemoryStream();
2291
                                        img.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
2292
                                        ms.Seek(0, System.IO.SeekOrigin.Begin);
2293
                                        returnImage.StreamSource = ms;
2294
                                        returnImage.EndInit();
2295
                                        stream.Close();
2296

    
2297
                                        control.SignImage = returnImage;
2298
                                    }
2299
                                    control.PointSet = new List<Point>
2300
                                        {
2301
                                            control.StartPoint,
2302
                                            control.LeftBottomPoint,
2303
                                            control.EndPoint,
2304
                                            control.TopRightPoint,
2305
                                        };
2306
                                }
2307
                            }
2308
                            break;
2309
                        //TODO: 강인구 추가
2310
                        case ControlType.Symbol:
2311
                            {
2312
                                var control = currentControl as SymControl;
2313

    
2314
                                if (control != null)
2315
                                {
2316
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2317
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2318
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2319
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2320
                                    control.LineSize = ViewerDataModel.Instance.LineSize + 3;
2321
                                    control.StrokeColor = new SolidColorBrush(Colors.Red);
2322

    
2323
                                    if (control.StartPoint != control.EndPoint)
2324
                                    {
2325
                                        if (control.PathData == null)
2326
                                        {
2327
                                            using (StringToPathConverter Convert = new StringToPathConverter())
2328
                                            {
2329
                                                control.PathData = Convert.Convert("M-5,5L0,0L20,30L40,-20 ");
2330
                                            }
2331
                                        }
2332
                                    }
2333

    
2334
                                    control.PointSet = new List<Point>
2335
                                        {
2336
                                            control.StartPoint,
2337
                                            control.LeftBottomPoint,
2338
                                            control.EndPoint,
2339
                                            control.TopRightPoint,
2340
                                        };
2341
                                }
2342
                            }
2343
                            break;
2344
                        ///TODO: 
2345
                        case ControlType.Stamp:
2346
                            {
2347
                                var control = currentControl as SymControlN;
2348

    
2349
                                if (control != null)
2350
                                {
2351

    
2352
                                    if (control.StartPoint == control.EndPoint)
2353
                                    {
2354
                                        //string appovalData = "";
2355

    
2356
                                        var xamlData = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString_NonPrefix(App.SystemInfo.STAMP);
2357
                                        xamlData = xamlData.Replace("daelim", "DAELIM");
2358

    
2359

    
2360
                                        //object obj = System.Windows.Markup.XamlReader.Load(xamlData);
2361

    
2362
                                        System.IO.MemoryStream stream = new System.IO.MemoryStream();
2363
                                        System.IO.StreamWriter writer = new System.IO.StreamWriter(stream);
2364
                                        writer.Write(xamlData);
2365
                                        writer.Flush();
2366
                                        stream.Position = 0;
2367

    
2368
                                        control.StrokeColor = new SolidColorBrush(Colors.Red);
2369
                                        object obj = System.Windows.Markup.XamlReader.Load(stream);
2370
                                        UIElement ob = obj as UIElement;
2371

    
2372
                                        //control.ApplyTemplate();
2373

    
2374
                                        control.SetViewBox();
2375
                                        control.PathXathData = App.SystemInfo.STAMP;
2376
                                        control.Base_ViewBox.Child = ob;
2377
                                    }
2378

    
2379
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2380
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2381
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2382
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2383
                                    //control.LineSize = ViewerDataModel.Instance.LineSize + 3;
2384

    
2385

    
2386
                                    control.PointSet = new List<Point>
2387
                                    {
2388
                                        control.StartPoint,
2389
                                        control.LeftBottomPoint,
2390
                                        control.EndPoint,
2391
                                        control.TopRightPoint,
2392
                                    };
2393
                                }
2394
                            }
2395
                            break;
2396
                        case ControlType.Mark:
2397
                            {
2398
                                var control = currentControl as RectangleControl;
2399

    
2400
                                if (control != null)
2401
                                {
2402
                                    if (move.mousemode == MouseMode.Drawing)
2403
                                    {
2404
                                        //move.control_Move(ControlList, true, moveX, moveY);
2405
                                    }
2406
                                    else
2407
                                    {
2408
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2409
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2410
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2411
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2412

    
2413

    
2414
                                        control.PointSet = new List<Point>
2415
                                    {
2416
                                        control.StartPoint,
2417
                                        control.LeftBottomPoint,
2418
                                        control.EndPoint,
2419
                                        control.TopRightPoint,
2420
                                    };
2421
                                    }
2422

    
2423
                                    //강인구 추가
2424
                                    control.Paint = PaintSet.Fill;
2425
                                }
2426
                            }
2427
                            break;
2428
                        case ControlType.PenControl:
2429
                            {
2430
                                stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y));
2431
                                //inkBoard.Strokes.Add(stroke);
2432
                            }
2433
                            break;
2434
                        default:
2435
                            break;
2436
                    }
2437
                }
2438
            }
2439
            else if (((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.Selecting) || 
2440
                ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.Capture) || 
2441
                ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.DragZoom))
2442
            {
2443
                Point curMouseDownPoint = e.GetPosition(drawingRotateCanvas);
2444

    
2445
                if (isDraggingSelectionRect)
2446
                {
2447
                    UpdateDragSelectionRect(canvasDrawingMouseDownPoint, curMouseDownPoint);
2448

    
2449
                    e.Handled = true;
2450
                }
2451
                else if (isLeftMouseButtonDownOnWindow)
2452
                {
2453
                    var dragDelta = curMouseDownPoint - canvasDrawingMouseDownPoint;
2454
                    double dragDistance = Math.Abs(dragDelta.Length);
2455

    
2456
                    if (dragDistance > DragThreshold)
2457
                    {
2458
                        isDraggingSelectionRect = true;
2459

    
2460
                        InitDragSelectionRect(canvasDrawingMouseDownPoint, curMouseDownPoint);
2461
                    }
2462

    
2463
                    e.Handled = true;
2464
                }
2465

    
2466

    
2467
                if (canvasDrawingMouseDownPoint == curMouseDownPoint)
2468
                {
2469
                    //SelectionPath = new Path();
2470
                    //PathFigure pathFigure = new PathFigure();
2471
                    //SelectionPath.Fill = new SolidColorBrush(Colors.Yellow);
2472
                    //SelectionPath.Opacity = 0.5;
2473
                    //SelectionPath.StrokeDashArray = new DoubleCollection() { 1 };
2474
                    //SelectionPath.StrokeDashCap = PenLineCap.Round;
2475
                    //SelectionPath.Stroke = new SolidColorBrush(Colors.Black);
2476
                }
2477
                else
2478
                {
2479
                    //List<Stroke> removingStroke = new List<Stroke>();
2480
                    //Rect p1 = new Rect(canvasDrawingMouseDownPoint, curMouseDownPoint);
2481
                    //StrokeCollection stC = new StrokeCollection();
2482
                    //for (int i = 0; i <= inkBoard.Strokes.Count - 1; i++)
2483
                    //{
2484
                    //    Rect p2 = inkBoard.Strokes[i].GetBounds();
2485
                    //    p1.Intersect(p2);
2486
                    //    if (p1.IsEmpty)
2487
                    //    {
2488

    
2489

    
2490
                    //        p1 = SelectionPath.Data.Bounds;
2491
                    //        bool intersectCheck = false;
2492
                    //        foreach (var T in inkBoard.Strokes[i].StylusPoints)
2493
                    //        {
2494
                    //            Rect p3 = new Rect(new Point(T.X, T.Y), new Size(10, 10));
2495
                    //            p1.Intersect(p3);
2496
                    //            if (!p1.IsEmpty)
2497
                    //            {
2498
                    //                intersectCheck = true;
2499
                    //            }
2500
                    //        }
2501
                    //        if (intersectCheck)
2502
                    //        {
2503
                    //            removingStroke.Add(inkBoard.Strokes[i]);
2504
                    //        }
2505

    
2506
                    //    }
2507
                    //    else
2508
                    //    {
2509
                    //        removingStroke.Add(inkBoard.Strokes[i]);
2510
                    //    }
2511
                    //}
2512

    
2513
                    e.Handled = true;
2514
                }
2515
            }
2516
            else if ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.DragSymbol)
2517
            { //symbol      
2518
                if(_dragdropWindow != null)
2519
                {
2520
                    Win32Point w32Mouse = new Win32Point();
2521
                    GetCursorPos(ref w32Mouse);
2522

    
2523
                    this._dragdropWindow.Left = w32Mouse.X - (symbol_img.Width / 2);
2524
                    this._dragdropWindow.Top = w32Mouse.Y - (symbol_img.Height / 2);
2525
                }                
2526
            }
2527
            else if ((e.LeftButton == MouseButtonState.Released) && (e.MiddleButton == MouseButtonState.Released) && 
2528
                (e.RightButton == MouseButtonState.Released) && ViewerDataModel.Instance.MarkupControls_USER.Count > 0)
2529
            {
2530
                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.ItemRect.Contains(getCurrentPoint)).FirstOrDefault();
2531
                if(control != null)
2532
                {
2533
                    this.cursor = Cursors.Hand;
2534
                    SetCursor();
2535
                }
2536
                else
2537
                {
2538
                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
2539
                    SetCursor();
2540
                }
2541
            }
2542
            else
2543
            {
2544
                //var hitRect = new Rect(currentCanvasDrawingMouseMovePoint.X - 10, currentCanvasDrawingMouseMovePoint.Y - 10, 20, 20);
2545

    
2546
                //VisualTreeHelper.HitTest(this.drawingRotateCanvas, null, MyCallback,
2547
                //    new GeometryHitTestParameters(new RectangleGeometry(hitRect)));
2548

    
2549
                //if (hitList.Count > 0)
2550
                //{
2551

    
2552
                //}
2553

    
2554
                #region 조건 설정 : firstCondition
2555
                //GeneralTransform generalTransform = this.DeepLayer._BaseLayer.TransformToVisual(Application.Current.RootVisual);
2556
                //pnts = generalTransform.Transform(pnts);
2557
                //Rect areaInAbsoluteCoordinates = new Rect(pnts.X - 10, pnts.Y - 10, 20, 20);
2558
                //var firstCondition = (from kkk in VisualTreeHelper.FindElementsInHostCoordinates(areaInAbsoluteCoordinates,
2559
                //                               this.DeepLayer._BaseLayer).ToObservable()
2560
                //                      where String.IsNullOrEmpty((kkk as FrameworkElement).Name)
2561
                //                      select kkk).FirstOrDefault();
2562

    
2563
                //var canvas = LogicalTreeHelper.FindLogicalNode(this, "drawingRotateCanvas") as Canvas;
2564
                //if (canvas !=null)
2565
                //{
2566
                //    foreach (var item in (canvas.Children[0] as ItemsControl).Items)
2567
                //    {
2568
                //        UIElement uiElement = (UIElement)(canvas.Children[0] as ItemsControl).ItemContainerGenerator.ContainerFromItem(item);
2569
                //        if (uiElement!=null)
2570
                //        {
2571
                //            uiElement.InputHitTest(currentCanvasDrawingMouseMovePoint).
2572
                //        }
2573
                //    }
2574
                //}
2575

    
2576
                //EllipseGeometry expandedHitTestArea = new EllipseGeometry(currentCanvasDrawingMouseMovePoint, 10.0, 10.0);
2577
                //hitResultsList.Clear();
2578

    
2579
                #endregion
2580
            }
2581
        }
2582

    
2583
        private void zoomAndPanControl2_MouseMove(object sender, MouseEventArgs e)
2584
        {
2585
            if ((e.MiddleButton == MouseButtonState.Pressed) || (e.RightButton == MouseButtonState.Pressed))
2586
            {
2587
                SetCursor();
2588
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas2);
2589
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas2);
2590

    
2591
                Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
2592

    
2593
                ViewerDataModel.Instance.Sync_ContentOffsetX -= dragOffset.X;
2594
                ViewerDataModel.Instance.Sync_ContentOffsetY -= dragOffset.Y;
2595

    
2596
                if (Sync.IsChecked)
2597
                {
2598
                    zoomAndPanControl.ContentOffsetX = ViewerDataModel.Instance.Sync_ContentOffsetX;
2599
                    zoomAndPanControl.ContentOffsetY = ViewerDataModel.Instance.Sync_ContentOffsetY;
2600
                }
2601
            }
2602
        }
2603

    
2604
        private List<CommentUserInfo> hitList = new List<CommentUserInfo>();
2605

    
2606
        private EllipseGeometry hitArea = new EllipseGeometry();
2607

    
2608
        private void zoomAndPanControl_MouseUp(object sender, MouseButtonEventArgs e)
2609
        {
2610
            IsDrawing = false;
2611

    
2612
            if (mouseHandlingMode != MouseHandlingMode.None)
2613
            {
2614
                if (mouseHandlingMode == MouseHandlingMode.Drawing)
2615
                {
2616
                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
2617

    
2618
                    SetCursor();
2619

    
2620
                    switch (controlType)
2621
                    {
2622
                        case ControlType.None:
2623
                            break;
2624
                        case ControlType.Rectangle:
2625
                            {
2626

    
2627
                            }
2628
                            break;
2629
                        case ControlType.PenControl:
2630
                            {
2631

    
2632
                            }
2633
                            break;
2634
                        default:
2635
                            break;
2636
                    }
2637
                }
2638
                else if (mouseHandlingMode == MouseHandlingMode.Selecting && e.ChangedButton == MouseButton.Left || mouseHandlingMode == MouseHandlingMode.Capture && e.ChangedButton == MouseButton.Left || mouseHandlingMode == MouseHandlingMode.DragZoom && e.ChangedButton == MouseButton.Left)
2639
                {
2640
                    if (isLeftMouseButtonDownOnWindow)
2641
                    {
2642
                        bool wasDragSelectionApplied = false;
2643

    
2644
                        if (isDraggingSelectionRect)
2645
                        {
2646
                            if (mouseHandlingMode == MouseHandlingMode.Capture && controlType == ControlType.ImgControl)
2647
                            {
2648
                                dragCaptureBorder.Visibility = Visibility.Collapsed;
2649
                                mouseHandlingMode = MouseHandlingMode.None;
2650
                                Point endPoint = e.GetPosition(zoomAndPanCanvas);
2651
                                symbolselectindex = symbolPanel_Instance.RadTab.SelectedIndex;
2652
                                Set_Symbol_Capture(endPoint);
2653
                                ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed;
2654
                                ViewerDataModel.Instance.ViewVisible = Visibility.Visible;                                
2655
                                ViewerDataModel.Instance.Capture_Opacity = 0;
2656
                            }
2657
                            else if (mouseHandlingMode == MouseHandlingMode.Capture)
2658
                            {
2659
                                dragCaptureBorder.Visibility = Visibility.Collapsed;
2660
                                mouseHandlingMode = MouseHandlingMode.None;
2661
                                Set_Capture();
2662

    
2663
                                ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed;
2664
                                ViewerDataModel.Instance.ViewVisible = Visibility.Visible;
2665
                                ViewerDataModel.Instance.Capture_Opacity = 0;
2666
                            }
2667
                            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
2668
                            {
2669
                                ApplyDragSelectionRect();
2670
                            }
2671
                            else
2672
                            {
2673
                                double x = Canvas.GetLeft(dragZoomBorder);
2674
                                double y = Canvas.GetTop(dragZoomBorder);
2675
                                double width = dragZoomBorder.Width;
2676
                                double height = dragZoomBorder.Height;
2677
                                Rect dragRect = new Rect(x, y, width, height);
2678

    
2679
                                ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.ZoomTo(dragRect);
2680

    
2681
                                dragZoomBorder.Visibility = Visibility.Collapsed;
2682
                            }
2683

    
2684
                            isDraggingSelectionRect = false;
2685
                            e.Handled = true;
2686
                            wasDragSelectionApplied = true;
2687
                        }
2688

    
2689
                        if (isLeftMouseButtonDownOnWindow)
2690
                        {
2691
                            isLeftMouseButtonDownOnWindow = false;
2692
                            this.ReleaseMouseCapture();
2693
                            e.Handled = true;
2694
                        }
2695

    
2696
                        if (!wasDragSelectionApplied)
2697
                        {
2698
                            init();
2699
                        }
2700
                    }
2701
                }
2702
                else if (e.RightButton == MouseButtonState.Pressed)
2703
                {
2704
                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
2705
                    SetCursor();
2706
                }
2707

    
2708
                zoomAndPanControl.ReleaseMouseCapture();
2709

    
2710

    
2711
                e.Handled = true;
2712
            }
2713
            else
2714
            {
2715
                this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
2716
                SetCursor();
2717
            }
2718

    
2719
            ///mouseButtonDown = MouseButton.Left;
2720
            //controlType = ControlType.SingleLine;
2721
        }
2722

    
2723
        public void Set_Symbol_Capture(Point endPoint)
2724
        {       
2725
            double x = canvasDrawingMouseDownPoint.X;
2726
            double y = canvasDrawingMouseDownPoint.Y;
2727
            if(x > endPoint.X)
2728
            {
2729
                x = endPoint.X;
2730
                y = endPoint.Y;
2731
            }
2732

    
2733
            double width = dragCaptureBorder.Width;
2734
            double height = dragCaptureBorder.Height;
2735

    
2736
            canvasImage = ConverterBitmapImage(zoomAndPanCanvas);
2737

    
2738
            if (x < 0)
2739
            {
2740
                width += x;
2741
                x = 0;
2742
            }
2743
            if (y < 0)
2744
            {
2745
                height += y;
2746
                y = 0;
2747

    
2748
                width = (int)canvasImage.PixelWidth - x;
2749
            }
2750
            if (x + width > canvasImage.PixelWidth)
2751
            {
2752
                width = (int)canvasImage.PixelWidth - x;
2753
            }
2754
            if (y + height > canvasImage.PixelHeight)
2755
            {
2756
                height = (int)canvasImage.PixelHeight - y;
2757
            }
2758
            var rect = new Int32Rect((int)x, (int)y, (int)width, (int)height);
2759

    
2760
            string uri = "";
2761
            if (userData.COMPANY != "EXT")
2762
            {
2763
                uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO,
2764
                    (Convert.ToInt32(_ViewInfo.DocumentItemID) / 100).ToString(), _ViewInfo.DocumentItemID, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber);
2765
            }
2766
            else
2767
            {
2768
                uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, _ViewInfo.DocumentItemID,
2769
                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber);
2770
            }
2771

    
2772
            var defaultBitmapImage = new BitmapImage();
2773
            defaultBitmapImage.BeginInit();
2774
            defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
2775
            defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
2776
            defaultBitmapImage.UriSource = new Uri(uri);
2777
            defaultBitmapImage.EndInit();
2778

    
2779
            //GC.Collect();
2780

    
2781
            if (defaultBitmapImage.IsDownloading)
2782
            {
2783
                defaultBitmapImage.DownloadCompleted += (ex, arg) =>
2784
                {
2785
                    defaultBitmapImage.Freeze();
2786
                    //GC.Collect();
2787
                    BitmapSource bs = new CroppedBitmap(defaultBitmapImage, rect);
2788
                    Save_Symbol_Capture(bs, (int)x, (int)y, (int)width, (int)height);
2789
                };
2790
            }
2791
        }
2792

    
2793
        private void zoomAndPanControl2_MouseUp(object sender, MouseButtonEventArgs e)
2794
        {
2795
            ///mouseButtonDown = MouseButton.Left;
2796
        }
2797

    
2798
        private void zoomAndPanControl_MouseLeave(object sender, MouseEventArgs e)
2799
        {
2800
            ///mouseButtonDown = MouseButton.Left;
2801
            //this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
2802
        }
2803

    
2804
        private void zoomAndPanControl_MouseDoubleClick(object sender, MouseButtonEventArgs e)
2805
        {
2806

    
2807
        }
2808

    
2809
        /// <summary>
2810
        /// select items by dragging
2811
        /// </summary>
2812
        private void ApplyDragSelectionRect()
2813
        {
2814
            dragSelectionBorder.Visibility = Visibility.Collapsed;
2815

    
2816
            double x = Canvas.GetLeft(dragSelectionBorder);
2817
            double y = Canvas.GetTop(dragSelectionBorder);
2818
            double width = dragSelectionBorder.Width;
2819
            double height = dragSelectionBorder.Height;
2820
            Boolean Flag = false;
2821
            List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2822
            var Items = ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.Visibility != Visibility.Hidden).ToList();
2823

    
2824
            Rect dragRect = new Rect(x, y, width, height);
2825
            ///dragRect.Inflate(width / 10, height / 10);
2826

    
2827
            foreach (var item in Items)
2828
            {
2829
                Flag = SelectionSet.Instance.SelectControl(item, dragRect);
2830

    
2831
                if (Flag)
2832
                {
2833
                    adornerSet.Add(item);
2834

    
2835
                    Control_Style(item);
2836
                }
2837
            }
2838
            if (adornerSet.Count > 0)
2839
            {
2840
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2841
                SelectLayer.Children.Add(final);
2842
            }
2843
        }
2844

    
2845
        private void InitDragSelectionRect(Point pt1, Point pt2)
2846
        {
2847
            //캡쳐 중
2848
            if (mouseHandlingMode == MouseHandlingMode.Capture)
2849
            {
2850
                dragCaptureBorder.Visibility = Visibility.Visible;
2851
            }
2852
            //선택 중
2853
            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
2854
            {
2855

    
2856
                dragSelectionBorder.Visibility = Visibility.Visible;
2857
            }
2858
            else
2859
            {
2860
                dragZoomBorder.Visibility = Visibility.Visible;
2861
            }
2862
            UpdateDragSelectionRect(pt1, pt2);
2863
        }
2864

    
2865
        /// <summary>
2866
        /// Update the position and size of the rectangle used for drag selection.
2867
        /// </summary>
2868
        private void UpdateDragSelectionRect(Point pt1, Point pt2)
2869
        {
2870
            double x, y, width, height;
2871

    
2872
            //
2873
            // Determine x,y,width and height of the rect inverting the points if necessary.
2874
            // 
2875

    
2876
            if (pt2.X < pt1.X)
2877
            {
2878
                x = pt2.X;
2879
                width = pt1.X - pt2.X;
2880
            }
2881
            else
2882
            {
2883
                x = pt1.X;
2884
                width = pt2.X - pt1.X;
2885
            }
2886

    
2887
            if (pt2.Y < pt1.Y)
2888
            {
2889
                y = pt2.Y;
2890
                height = pt1.Y - pt2.Y;
2891
            }
2892
            else
2893
            {
2894
                y = pt1.Y;
2895
                height = pt2.Y - pt1.Y;
2896
            }
2897

    
2898
            //
2899
            // Update the coordinates of the rectangle used for drag selection.
2900
            //
2901
            //캡쳐 중
2902
            if (mouseHandlingMode == MouseHandlingMode.Capture)
2903
            {
2904
                Canvas.SetLeft(dragCaptureBorder, x);
2905
                Canvas.SetTop(dragCaptureBorder, y);
2906
                dragCaptureBorder.Width = width;
2907
                dragCaptureBorder.Height = height;
2908
            }
2909
            //선택 중
2910
            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
2911
            {
2912
                Canvas.SetLeft(dragSelectionBorder, x);
2913
                Canvas.SetTop(dragSelectionBorder, y);
2914
                dragSelectionBorder.Width = width;
2915
                dragSelectionBorder.Height = height;
2916
            }
2917
            else
2918
            {
2919
                Canvas.SetLeft(dragZoomBorder, x);
2920
                Canvas.SetTop(dragZoomBorder, y);
2921
                dragZoomBorder.Width = width;
2922
                dragZoomBorder.Height = height;
2923
            }
2924
        }
2925

    
2926
        private void drawingPannelRotate(double angle)
2927
        {
2928
            Logger.sendCheckLog("pageNavigator_PageChanging_drawingPannelRotate Setting", 1);
2929
            rotate.Angle = angle;
2930
            var rotationNum = Math.Abs((rotate.Angle / 90));
2931

    
2932
            if (angle == 90 || angle == 270)
2933
            {
2934
                double emptySize = zoomAndPanCanvas.Width;
2935
                zoomAndPanCanvas.Width = zoomAndPanCanvas.Height;
2936
                zoomAndPanCanvas.Height = emptySize;
2937
            }
2938
            if (angle == 0)
2939
            {
2940
                translate.X = 0;
2941
                translate.Y = 0;
2942
            }
2943
            else if (angle == 90)
2944
            {
2945
                translate.X = zoomAndPanCanvas.Width;
2946
                translate.Y = 0;
2947
            }
2948
            else if (angle == 180)
2949
            {
2950
                translate.X = zoomAndPanCanvas.Width;
2951
                translate.Y = zoomAndPanCanvas.Height;
2952
            }
2953
            else
2954
            {
2955
                translate.X = 0;
2956
                translate.Y = zoomAndPanCanvas.Height;
2957
            }
2958

    
2959
            zoomAndPanControl.RotationAngle = rotate.Angle;
2960

    
2961

    
2962
            if (!testPanel2.IsHidden)
2963
            {
2964
                zoomAndPanControl2.RotationAngle = rotate.Angle;
2965
                zoomAndPanCanvas2.Width = zoomAndPanCanvas.Width;
2966
                zoomAndPanCanvas2.Height = zoomAndPanCanvas.Height;
2967
            }
2968

    
2969
            ViewerDataModel.Instance.ContentWidth = zoomAndPanCanvas.Width;
2970
            ViewerDataModel.Instance.ContentHeight = zoomAndPanCanvas.Height;
2971
            ViewerDataModel.Instance.AngleOffsetX = translate.X;
2972
            ViewerDataModel.Instance.AngleOffsetY = translate.Y;
2973
            ViewerDataModel.Instance.Angle = rotate.Angle;
2974
        }
2975

    
2976
        public void PlaceImageSymbol(string id, long group_id, int SelectedIndex, Point canvasZoomPanningMouseDownPoint)
2977
        {
2978
            string Data_ = "";
2979

    
2980
            try
2981
            {
2982
                Logger.sendReqLog("GetSymbolImageURL: ", id + "," + SelectedIndex, 1);
2983
                Data_ = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetSymbolImageURL(id, SelectedIndex);
2984
                if (Data_ != null || Data_ != "")
2985
                {
2986
                    Logger.sendResLog("GetSymbolImageURL", "TRUE", 1);
2987
                }
2988
                else
2989
                {
2990
                    Logger.sendResLog("GetSymbolImageURL", "FALSE", 1);
2991
                }
2992

    
2993
                MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
2994
                {
2995
                    SYMBOL_ID = id,//InnerItem.Symbol_ID
2996
                    STATE = 0,
2997
                };
2998
                if (Data_ != null)
2999
                {
3000
                    Image img = new Image();
3001
                    //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(Data_));
3002
                    if (Data_.Contains(".svg"))
3003
                    {
3004
                        byte[] imageData = null;
3005
                        DrawingImage image = null;
3006
                        using (System.Net.WebClient web = new System.Net.WebClient())
3007
                        {
3008
                            imageData = web.DownloadData(new Uri(Data_));
3009
                            System.IO.Stream stream = new System.IO.MemoryStream(imageData);
3010
                            image = SvgReader.Load(stream);
3011
                        }
3012
                        img.Source = image;
3013
                    }
3014
                    else
3015
                    {
3016
                        img.Source = new BitmapImage(new Uri(Data_));
3017
                    }
3018

    
3019
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
3020
                    {
3021
                        PointSet = new List<Point>(),
3022
                        FilePath = Data_,
3023
                        ImageData = img.Source,
3024
                        StartPoint = canvasZoomPanningMouseDownPoint,
3025
                        EndPoint = new Point(canvasZoomPanningMouseDownPoint.X + img.Source.Width, 
3026
                        canvasZoomPanningMouseDownPoint.Y + img.Source.Height),
3027
                        TopRightPoint = new Point(canvasZoomPanningMouseDownPoint.X+img.Source.Width,
3028
                        canvasZoomPanningMouseDownPoint.Y),
3029
                        LeftBottomPoint = new Point(canvasZoomPanningMouseDownPoint.X,
3030
                        canvasZoomPanningMouseDownPoint.Y + img.Source.Height)
3031
                    };
3032

    
3033
                    currentControl.PointSet = new List<Point>
3034
                                        {
3035
                                            currentControl.StartPoint,
3036
                                            currentControl.LeftBottomPoint,
3037
                                            currentControl.EndPoint,
3038
                                            currentControl.TopRightPoint,
3039
                                        };
3040
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
3041
                    UndoData = new Undo_data()
3042
                    {
3043
                        IsUndo = false,
3044
                        Event = Event_Type.Create,
3045
                        EventTime = DateTime.Now,
3046
                        Markup_List = new List<Multi_Undo_data>()
3047
                    };
3048
                    ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
3049
                    {
3050
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
3051
                    });
3052

    
3053
                    //multi_Undo_Data = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
3054
                    multi_Undo_Data = Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
3055
                    UndoData.Markup_List.Add(multi_Undo_Data);
3056
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
3057

    
3058
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
3059
                    currentControl.CommentID = Commons.shortGuid();
3060
                    currentControl.SymbolID = id;
3061
                    currentControl.GroupID = group_id;
3062
                    currentControl.ApplyTemplate();
3063
                    currentControl.SetImage();
3064

    
3065
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
3066
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
3067
                    SelectLayer.Children.Add(final);
3068
                }
3069
            }
3070
            catch (Exception ex)
3071
            {
3072
                this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(ex.Message, "Error");
3073
            }
3074
        }
3075

    
3076
        private void zoomAndPanControl_MouseDown(object sender, MouseButtonEventArgs e)
3077
        {            
3078
            var set_option = this.ParentOfType<MainWindow>().dzTopMenu.Parent.ChildrenOfType<RadNumericUpDown>().Where(item => item.IsKeyboardFocusWithin).FirstOrDefault();
3079
            if (set_option != null && !string.IsNullOrEmpty(set_option.ContentText))
3080
            {
3081
                set_option.Value = double.Parse(set_option.ContentText);
3082
            }
3083

    
3084
            InkControl_Convert();
3085

    
3086
            ///TODO:
3087
            var text_item = ViewerDataModel.Instance.MarkupControls_USER.Where(data =>
3088
            (data as TextControl) != null && (data as TextControl).Text == "" || (data as ArrowTextControl) != null && (data as ArrowTextControl).ArrowText == "").FirstOrDefault();
3089

    
3090
            if (text_item != null && (currentControl as ArrowTextControl) == null)
3091
            {
3092
                ViewerDataModel.Instance.MarkupControls_USER.Remove(text_item);
3093
            }
3094
            /// up to here
3095

    
3096
            foreach (var arrow_text in ViewerDataModel.Instance.MarkupControls_USER)
3097
            {
3098
                if (arrow_text as ArrowTextControl != null)
3099
                {
3100
                    (arrow_text as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3101
                }
3102
            }
3103

    
3104
            ///mouseButtonDown = e.ChangedButton;
3105
            /// complete drawing text control when user click mouse right button - 2018.05.14 added by humkyung
3106

    
3107
            //if (currentControl != null)
3108
            {
3109
                var text_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as TextControl) != null && (data as TextControl).Base_TextBox.Visibility == Visibility.Visible).FirstOrDefault();
3110
                if (text_item_ != null)
3111
                {
3112
                    (text_item_ as TextControl).Base_TextBlock.Visibility = Visibility.Visible;
3113
                    (text_item_ as TextControl).Base_TextBox.Visibility = Visibility.Collapsed;
3114
                    (text_item_ as TextControl).IsEditing = false;
3115
                    (text_item_ as TextControl).EnableEditing = false;
3116
                    currentControl = null;
3117
                }
3118

    
3119
                var Arrowtext_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as ArrowTextControl) != null && (data as ArrowTextControl).IsEditingMode == true).FirstOrDefault();
3120
                if (Arrowtext_item_ != null && ((Arrowtext_item_ as ArrowTextControl).IsNew == false))
3121
                {
3122
                    (Arrowtext_item_ as ArrowTextControl).IsEditingMode = false;
3123
                    (Arrowtext_item_ as ArrowTextControl).Base_TextBox.Focusable = false;
3124
                    currentControl = null;
3125
                }
3126
            }
3127

    
3128
            double Ang = 0;                                          
3129
            if (rotate.Angle != 0)
3130
            {
3131
                Ang = 360 - rotate.Angle;
3132
            }
3133

    
3134
            if (e.OriginalSource is System.Windows.Controls.Image)
3135
            {
3136
                (e.OriginalSource as System.Windows.Controls.Image).Focus();
3137
            }
3138

    
3139
            if (mouseHandlingMode == MouseHandlingMode.DragSymbol && e.LeftButton == MouseButtonState.Pressed)
3140
            {                
3141
                //this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
3142
                //SetCursor();
3143

    
3144
                //canvasDrawingMouseDownPoint = e.GetPosition(drawingRotateCanvas);
3145
                canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
3146
                if(symbol_id != null)
3147
                {
3148
                    PlaceImageSymbol(symbol_id, symbol_group_id, symbol_SelectedIndex, canvasZoomPanningMouseDownPoint);
3149
                }                
3150
            }
3151

    
3152
            if (mouseHandlingMode == MouseHandlingMode.DragSymbol && e.RightButton == MouseButtonState.Pressed)
3153
            {
3154
                if (this._dragdropWindow != null)
3155
                {
3156
                    this._dragdropWindow.Close();
3157
                    this._dragdropWindow = null;
3158
                    symbol_id = null;
3159
                }
3160
            }
3161

    
3162
            if (e.LeftButton == MouseButtonState.Pressed)
3163
            {
3164
                canvasDrawingMouseDownPoint = e.GetPosition(drawingRotateCanvas);
3165
                canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
3166

    
3167
                this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
3168
                SetCursor();
3169

    
3170
                if (!ViewerDataModel.Instance.IsPressCtrl)
3171
                {
3172
                    SelectionSet.Instance.UnSelect(this);
3173
                }
3174
            }
3175
            if (e.MiddleButton == MouseButtonState.Pressed)
3176
            {
3177
                canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
3178
                cursor = Cursors.SizeAll;
3179
                SetCursor();
3180
            }
3181
            if (e.RightButton == MouseButtonState.Pressed)
3182
            {
3183
                canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
3184
                cursor = Cursors.SizeAll;
3185
                SetCursor();
3186
            }
3187
            else if (e.XButton1 == MouseButtonState.Pressed)
3188
            {
3189
                if (this.pageNavigator.CurrentPage.PageNumber + 1 <= this.pageNavigator.PageCount)
3190
                {
3191
                    this.pageNavigator.GotoPage(this.pageNavigator._NextPage.PageNumber + 1);
3192
                }
3193

    
3194
                this.pageNavigator.GotoPage(this.pageNavigator._NextPage.PageNumber);
3195

    
3196
            }
3197
            else if (e.XButton2 == MouseButtonState.Pressed)
3198
            {
3199
                if (this.pageNavigator.CurrentPage.PageNumber > 1)
3200
                {
3201
                    this.pageNavigator.GotoPage(this.pageNavigator.CurrentPage.PageNumber - 1);
3202
                }
3203
            }
3204

    
3205
            //if (mouseButtonDown == MouseButton.Left && ViewerDataModel.Instance.MarkupControls_USER.Count > 0 && mouseHandlingMode != MouseHandlingMode.Drawing && currentControl == null)
3206
            if (e.LeftButton == MouseButtonState.Pressed && mouseHandlingMode != MouseHandlingMode.Drawing && currentControl == null)
3207
            {
3208
                if (mouseHandlingMode == MouseHandlingMode.Selecting)
3209
                {
3210
                    if (SelectLayer.Children.Count == 0)
3211
                    {
3212
                        isLeftMouseButtonDownOnWindow = true;
3213
                        mouseHandlingMode = MouseHandlingMode.Selecting;
3214
                    }
3215

    
3216
                    if (controlType == ControlType.None)
3217
                    {
3218
                        isLeftMouseButtonDownOnWindow = true;
3219
                    }
3220
                }
3221

    
3222
                //캡쳐 모드 설정
3223
                if (mouseHandlingMode == MouseHandlingMode.Capture)
3224
                {
3225
                    dragCaptureBorder.Visibility = Visibility.Visible;
3226
                    isLeftMouseButtonDownOnWindow = true;
3227
                }
3228

    
3229
                //줌 모드 설정
3230
                if (mouseHandlingMode == MouseHandlingMode.DragZoom)
3231
                {
3232
                    //dragSelectionBorder.Visibility = Visibility.Visible;
3233
                    isLeftMouseButtonDownOnWindow = true;
3234
                }
3235

    
3236
                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.ItemRect.Contains(getCurrentPoint)).FirstOrDefault();
3237
                if (control != null)
3238
                {
3239
                    AdornerFinal final = null;
3240

    
3241
                    if (!ViewerDataModel.Instance.IsPressCtrl)
3242
                    {
3243
                        /// 기존 selection 해제
3244
                        SelectionSet.Instance.UnSelect(this);
3245

    
3246
                        final = new AdornerFinal(control);
3247

    
3248
                        Control_Style(control);
3249

    
3250
                        if ((control as IPath) != null)
3251
                        {
3252
                            if ((control as IPath).LineSize != 0)
3253
                            {
3254
                                ViewerDataModel.Instance.LineSize = (control as IPath).LineSize;
3255
                            }
3256
                        }
3257
                        if ((control as IShapeControl) != null)
3258
                        {
3259
                            if ((control as IShapeControl).Paint == PaintSet.Hatch)
3260
                            {
3261
                                ViewerDataModel.Instance.checkHatchShape = true;
3262
                            }
3263
                            else if ((control as IShapeControl).Paint == PaintSet.Fill)
3264
                            {
3265
                                ViewerDataModel.Instance.checkFillShape = true;
3266
                            }
3267
                            else
3268
                            {
3269
                                ViewerDataModel.Instance.checkHatchShape = false;
3270
                                ViewerDataModel.Instance.checkFillShape = false;
3271
                            }
3272
                            ViewerDataModel.Instance.paintSet = (control as IShapeControl).Paint;
3273
                        }
3274

    
3275
                        ViewerDataModel.Instance.ControlOpacity = control.Opacity;
3276

    
3277
                        if ((control as TextControl) != null)
3278
                        {
3279
                            if ((control as TextControl).TextStyle == FontStyles.Italic)
3280
                            {
3281
                                ViewerDataModel.Instance.checkTextStyle = true;
3282
                            }
3283
                            else
3284
                            {
3285
                                ViewerDataModel.Instance.checkTextStyle = false;
3286
                            }
3287

    
3288
                            if ((control as TextControl).TextStyle == FontStyles.Italic)
3289
                            {
3290
                                ViewerDataModel.Instance.checkTextStyle = true;
3291
                            }
3292
                            else
3293
                            {
3294
                                ViewerDataModel.Instance.checkTextStyle = false;
3295
                            }
3296
                            if ((control as TextControl).TextWeight == FontWeights.Bold)
3297
                            {
3298
                                ViewerDataModel.Instance.checkTextWeight = true;
3299
                            }
3300
                            else
3301
                            {
3302
                                ViewerDataModel.Instance.checkTextWeight = false;
3303
                            }
3304
                            if ((control as TextControl).UnderLine == TextDecorations.Underline)
3305
                            {
3306
                                ViewerDataModel.Instance.checkUnderLine = true;
3307
                            }
3308
                            else
3309
                            {
3310
                                ViewerDataModel.Instance.checkUnderLine = false;
3311
                            }
3312
                            ViewerDataModel.Instance.TextSize = (control as TextControl).TextSize;
3313
                            ViewerDataModel.Instance.checkHighlight = (control as TextControl).IsHighLight;
3314

    
3315
                        }
3316
                        else if ((control as ArrowTextControl) != null)
3317
                        {
3318
                            if ((control as ArrowTextControl).TextStyle == FontStyles.Italic)
3319
                            {
3320
                                ViewerDataModel.Instance.checkTextStyle = true;
3321
                            }
3322
                            else
3323
                            {
3324
                                ViewerDataModel.Instance.checkTextStyle = false;
3325
                            }
3326

    
3327
                            if ((control as ArrowTextControl).TextStyle == FontStyles.Italic)
3328
                            {
3329
                                ViewerDataModel.Instance.checkTextStyle = true;
3330
                            }
3331
                            else
3332
                            {
3333
                                ViewerDataModel.Instance.checkTextStyle = false;
3334
                            }
3335
                            if ((control as ArrowTextControl).TextWeight == FontWeights.Bold)
3336
                            {
3337
                                ViewerDataModel.Instance.checkTextWeight = true;
3338
                            }
3339
                            else
3340
                            {
3341
                                ViewerDataModel.Instance.checkTextWeight = false;
3342
                            }
3343
                            if ((control as ArrowTextControl).UnderLine == TextDecorations.Underline)
3344
                            {
3345
                                ViewerDataModel.Instance.checkUnderLine = true;
3346
                            }
3347
                            else
3348
                            {
3349
                                ViewerDataModel.Instance.checkUnderLine = false;
3350
                            }
3351
                            ViewerDataModel.Instance.checkHighlight = (control as ArrowTextControl).isHighLight;
3352
                            ViewerDataModel.Instance.TextSize = (control as ArrowTextControl).TextSize;
3353
                        }
3354
                        else if ((control as RectCloudControl) != null)
3355
                        {
3356
                            ViewerDataModel.Instance.ArcLength = (control as RectCloudControl).ArcLength;
3357
                        }
3358
                        else if ((control as CloudControl) != null)
3359
                        {
3360
                            ViewerDataModel.Instance.ArcLength = (control as CloudControl).ArcLength;
3361
                        }
3362
                    }
3363
                    else
3364
                    {
3365
                        List<CommentUserInfo> comment = SelectionSet.Instance.SelectedItems;
3366
                        SelectionSet.Instance.UnSelect(this);
3367
                        comment.Add(control);
3368

    
3369
                        Control_Style(control);
3370

    
3371
                        final = new AdornerFinal(comment);
3372
                    }
3373

    
3374
                    if(final != null) this.SelectLayer.Children.Add(final);
3375
                }              
3376
            }
3377
            else if (mouseHandlingMode == MouseHandlingMode.Drawing)
3378
            {               
3379
                init();
3380
                //강인구 추가(우 클릭 일 경우 커서 변경 하지 않음)
3381
                if (cursor != Cursors.SizeAll)
3382
                {
3383
                    cursor = Cursors.Cross;
3384
                    SetCursor();
3385
                }
3386
                bool init_user = false;
3387
                foreach (var user in gridViewMarkup.Items)
3388
                {
3389
                    if ((user as MarkupInfoItem).UserID == App.ViewInfo.UserID)
3390
                    {
3391
                        init_user = true;
3392
                    }
3393
                }
3394
                if (init_user && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null && e.LeftButton == MouseButtonState.Pressed)
3395
                {
3396
                    RadWindow.Alert(new DialogParameters
3397
                    {
3398
                        Owner = Application.Current.MainWindow,
3399
                        Theme = new VisualStudio2013Theme(),
3400
                        Header = "안내",
3401
                        Content = "기존의 코멘트가 존재합니다. 사용자 리스트에서 먼저 선택해주세요",
3402
                    });
3403
                    return;
3404
                }
3405
                else
3406
                {
3407
                    var item = gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() as MarkupInfoItem;
3408
                    if (item != null)
3409
                    {
3410
                        App.Custom_ViewInfoId = item.MarkupInfoID;
3411
                    }
3412
                }
3413

    
3414
                multi_Undo_Data = new Multi_Undo_data();
3415
                //강인구 Undo/Redo 보류
3416
                UndoData = new Undo_data()
3417
                {
3418
                    IsUndo = false,
3419
                    Event = Event_Type.Create,
3420
                    EventTime = DateTime.Now,
3421
                    Markup_List = new List<Multi_Undo_data>()
3422
                };
3423

    
3424
                switch (controlType)
3425
                {
3426
                    case ControlType.Coordinate:
3427
                        {
3428
                            if (e.LeftButton == MouseButtonState.Pressed)
3429
                            {
3430
                                if (currentControl is CoordinateControl)
3431
                                {
3432
                                    if (IsGetoutpoint((currentControl as CoordinateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3433
                                    {
3434
                                        return;
3435
                                    }
3436

    
3437
                                    CreateControl();
3438

    
3439
                                    (currentControl as CoordinateControl).ApplyOverViewData();
3440
                                    currentControl = null;
3441
                                    this.cursor = Cursors.Arrow;
3442
                                }
3443
                                else
3444
                                {
3445
                                    this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
3446
                                    if (ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber
3447
                                     && d.Data_Type == Convert.ToInt32(MarkupToPDF.Controls.Common.ControlType.Coordinate)).Count() > 0)
3448
                                    {
3449
                                        currentControl = null;
3450
                                        this.cursor = Cursors.Arrow;
3451
                                        Common.ViewerDataModel.Instance.SystemMain.DialogMessage_Alert("이미 해당 페이지의 도면 영역을 설정하셨습니다.", "Notice");
3452
                                        return;
3453
                                    }
3454
                                    else
3455
                                    {
3456
                                        currentControl = new CoordinateControl
3457
                                        {
3458
                                            Background = new SolidColorBrush(Colors.Black),
3459
                                            ControlType = ControlType.Coordinate
3460
                                        };
3461

    
3462
                                        currentControl.CommentID = Commons.shortGuid();
3463
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3464
                                        currentControl.IsNew = true;
3465

    
3466
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3467

    
3468
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3469
                                    }
3470
                                }
3471
                            }
3472
                        }
3473
                        break;
3474
                    case ControlType.InsideWhite:
3475
                        {
3476
                            if (e.LeftButton == MouseButtonState.Pressed)
3477
                            {
3478
                                if (currentControl is InsideWhiteControl)
3479
                                {
3480
                                    if (IsGetoutpoint((currentControl as InsideWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3481
                                    {
3482
                                        return;
3483
                                    }
3484

    
3485
                                    CreateControl();
3486

    
3487
                                    (currentControl as InsideWhiteControl).ApplyOverViewData();
3488
                                    currentControl = null;
3489
                                    this.cursor = Cursors.Arrow;
3490
                                }
3491
                                else
3492
                                {
3493
                                    currentControl = new InsideWhiteControl
3494
                                    {
3495
                                        Background = new SolidColorBrush(Colors.Black),
3496
                                        ControlType = ControlType.InsideWhite
3497
                                    };
3498

    
3499
                                    currentControl.CommentID = Commons.shortGuid();
3500
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3501
                                    currentControl.IsNew = true;
3502
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3503

    
3504
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3505
                                }
3506
                            }
3507
                        }
3508
                        break;
3509
                    case ControlType.OverlapWhite:
3510
                        {
3511
                            if (e.LeftButton == MouseButtonState.Pressed)
3512
                            {
3513
                                if (currentControl is OverlapWhiteControl)
3514
                                {
3515
                                    if (IsGetoutpoint((currentControl as OverlapWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3516
                                    {
3517
                                        return;
3518
                                    }
3519

    
3520
                                    CreateControl();
3521

    
3522
                                    (currentControl as OverlapWhiteControl).ApplyOverViewData();
3523
                                    currentControl = null;
3524
                                    this.cursor = Cursors.Arrow;
3525
                                }
3526
                                else
3527
                                {
3528
                                    currentControl = new OverlapWhiteControl
3529
                                    {
3530
                                        Background = new SolidColorBrush(Colors.Black),
3531
                                        ControlType = ControlType.OverlapWhite
3532
                                    };
3533

    
3534
                                    currentControl.CommentID = Commons.shortGuid();
3535
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3536
                                    currentControl.IsNew = true;
3537
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3538

    
3539
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3540
                                }
3541
                            }
3542
                        }
3543
                        break;
3544
                    case ControlType.ClipWhite:
3545
                        {
3546
                            if (e.LeftButton == MouseButtonState.Pressed)
3547
                            {
3548
                                if (currentControl is ClipWhiteControl)
3549
                                {
3550
                                    if (IsGetoutpoint((currentControl as ClipWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3551
                                    {
3552
                                        return;
3553
                                    }
3554

    
3555
                                    CreateControl();
3556

    
3557
                                    (currentControl as ClipWhiteControl).ApplyOverViewData();
3558
                                    currentControl = null;
3559
                                    this.cursor = Cursors.Arrow;
3560
                                }
3561
                                else
3562
                                {
3563
                                    currentControl = new ClipWhiteControl
3564
                                    {
3565
                                        Background = new SolidColorBrush(Colors.Black),
3566
                                        ControlType = ControlType.ClipWhite
3567
                                    };
3568

    
3569
                                    currentControl.CommentID = Commons.shortGuid();
3570
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3571
                                    currentControl.IsNew = true;
3572
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3573

    
3574
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3575
                                }
3576
                            }
3577
                        }
3578
                        break;
3579
                    case ControlType.Rectangle:
3580
                        {
3581
                            if (e.LeftButton == MouseButtonState.Pressed)
3582
                            {
3583
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3584
                                //{
3585
                                    if (currentControl is RectangleControl)
3586
                                    {
3587
                                        //20180906 LJY TEST IsRotationDrawingEnable
3588
                                        if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3589
                                        {
3590
                                            return;
3591
                                        }
3592

    
3593
                                        CreateControl();
3594

    
3595
                                        (currentControl as RectangleControl).ApplyOverViewData();
3596
                                        currentControl = null;
3597
                                    
3598
                                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
3599
                                    }
3600
                                    else
3601
                                    {
3602
                                        currentControl = new RectangleControl
3603
                                        {
3604
                                            Background = new SolidColorBrush(Colors.Black),
3605
                                            ControlType = ControlType.Rectangle
3606
                                        };
3607

    
3608
                                        currentControl.CommentID = Commons.shortGuid();
3609
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3610
                                        currentControl.IsNew = true;
3611
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3612

    
3613
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3614
                                    }
3615
                                //}
3616
                            }
3617
                        }
3618
                        break;
3619
                    case ControlType.RectCloud:
3620
                        {
3621
                            if (e.LeftButton == MouseButtonState.Pressed)
3622
                            {
3623
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3624
                                //{
3625
                                    if (currentControl is RectCloudControl)
3626
                                    {
3627
                                        //20180906 LJY TEST IsRotationDrawingEnable
3628
                                        if (IsGetoutpoint((currentControl as RectCloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3629
                                        {
3630
                                            return;
3631
                                        }
3632

    
3633
                                        CreateControl();
3634

    
3635
                                        (currentControl as RectCloudControl).ApplyOverViewData();
3636
                                        currentControl = null;
3637
                                    
3638
                                        this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
3639
                                    }
3640
                                    else
3641
                                    {
3642
                                        currentControl = new RectCloudControl
3643
                                        {
3644
                                            Background = new SolidColorBrush(Colors.Black)
3645
                                        };
3646

    
3647
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3648
                                        currentControl.CommentID = Commons.shortGuid();
3649
                                        currentControl.IsNew = true;
3650
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3651
                                    }
3652
                                //}
3653
                            }
3654
                        }
3655
                        break;
3656
                    case ControlType.Circle:
3657
                        {
3658
                            if (e.LeftButton == MouseButtonState.Pressed)
3659
                            {
3660
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3661
                                //{
3662
                                    if (currentControl is CircleControl)
3663
                                    {
3664
                                        //20180906 LJY TEST IsRotationDrawingEnable
3665
                                        if (IsGetoutpoint((currentControl as CircleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3666
                                        {
3667
                                            return;
3668
                                        }
3669

    
3670
                                        CreateControl();
3671

    
3672
                                        (currentControl as CircleControl).ApplyOverViewData();
3673
                                        currentControl = null;
3674
                                    }
3675
                                    else
3676
                                    {
3677
                                        currentControl = new CircleControl
3678
                                        {
3679
                                            Background = new SolidColorBrush(Colors.Black)
3680
                                        };
3681

    
3682
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3683
                                        currentControl.CommentID = Commons.shortGuid();
3684
                                        currentControl.IsNew = true;
3685
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3686
                                    }
3687
                                //}
3688
                            }
3689
                        }
3690
                        break;
3691
                    case ControlType.Triangle:
3692
                        {
3693
                            if (e.LeftButton == MouseButtonState.Pressed)
3694
                            {
3695
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3696
                                //{
3697
                                    if (currentControl is TriControl)
3698
                                    {
3699
                                        var content = currentControl as TriControl;
3700
                                        if (content.MidPoint == new Point(0, 0))
3701
                                        {
3702
                                            content.MidPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
3703
                                        }
3704
                                        else
3705
                                        {
3706
                                            //20180906 LJY TEST IsRotationDrawingEnable
3707
                                            if (IsGetoutpoint((currentControl as TriControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3708
                                            {
3709
                                                return;
3710
                                            }
3711

    
3712
                                            CreateControl();
3713

    
3714
                                            (currentControl as TriControl).ApplyOverViewData();
3715
                                            currentControl = null;
3716
                                        }
3717
                                    }
3718
                                    else
3719
                                    {
3720
                                        currentControl = new TriControl
3721
                                        {
3722
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3723
                                            Background = new SolidColorBrush(Colors.Black),
3724
                                        };
3725

    
3726
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3727
                                        currentControl.CommentID = Commons.shortGuid();
3728
                                        currentControl.IsNew = true;
3729
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3730
                                    }
3731
                                //}
3732
                            }
3733
                        }
3734
                        break;
3735
                    case ControlType.SingleLine:
3736
                        {
3737
                            if (e.LeftButton == MouseButtonState.Pressed)
3738
                            {
3739
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3740
                                //{
3741
                                    if (currentControl is LineControl)
3742
                                    {
3743
                                        //20180906 LJY TEST IsRotationDrawingEnable
3744
                                        if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3745
                                        {
3746
                                            return;
3747
                                        }
3748

    
3749
                                        CreateControl();
3750

    
3751
                                        (currentControl as LineControl).ApplyOverViewData();
3752
                                        currentControl = null;
3753
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3754
                                    }
3755
                                    else
3756
                                    {
3757
                                        currentControl = new LineControl
3758
                                        {
3759
                                            Background = new SolidColorBrush(Colors.Black)
3760
                                        };
3761

    
3762
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3763
                                        currentControl.CommentID = Commons.shortGuid();
3764
                                        currentControl.IsNew = true;
3765
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3766
                                        this.MainAngle.Visibility = Visibility.Visible;
3767
                                    }
3768
                                //}
3769
                            }
3770
                        }
3771
                        break;
3772
                    case ControlType.CancelLine:
3773
                        {
3774
                            if (e.LeftButton == MouseButtonState.Pressed)
3775
                            {
3776
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3777
                                //{
3778
                                    if (currentControl is LineControl)
3779
                                    {
3780
                                        //20180906 LJY TEST IsRotationDrawingEnable
3781
                                        if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3782
                                        {
3783
                                            return;
3784
                                        }
3785

    
3786
                                        CreateControl();
3787

    
3788
                                        (currentControl as LineControl).ApplyOverViewData();
3789
                                        currentControl = null;
3790
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3791
                                    }
3792
                                    else
3793
                                    {
3794
                                        currentControl = new LineControl
3795
                                        {
3796
                                            Background = new SolidColorBrush(Colors.Black)
3797
                                        };
3798

    
3799
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3800
                                        currentControl.CommentID = Commons.shortGuid();
3801
                                        currentControl.IsNew = true;
3802
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3803
                                        this.MainAngle.Visibility = Visibility.Visible;
3804
                                    }
3805
                                //}
3806
                            }
3807
                        }
3808
                        break;
3809
                    case ControlType.ArrowLine:
3810
                        {
3811
                            if (e.LeftButton == MouseButtonState.Pressed)
3812
                            {
3813
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3814
                                //{
3815
                                    if (currentControl is LineControl)
3816
                                    {
3817
                                        //20180906 LJY TEST IsRotationDrawingEnable
3818
                                        if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3819
                                        {
3820
                                            return;
3821
                                        }
3822

    
3823
                                        CreateControl();
3824

    
3825
                                        (currentControl as LineControl).ApplyOverViewData();
3826
                                        currentControl = null;
3827
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3828
                                    }
3829
                                    else
3830
                                    {
3831
                                        currentControl = new LineControl
3832
                                        {
3833
                                            Background = new SolidColorBrush(Colors.Black)
3834
                                        };
3835

    
3836
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3837
                                        currentControl.CommentID = Commons.shortGuid();
3838
                                        currentControl.IsNew = true;
3839
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3840
                                        this.MainAngle.Visibility = Visibility.Visible;
3841
                                    }
3842
                                //}
3843
                            }
3844
                        }
3845
                        break;
3846
                    case ControlType.TwinLine:
3847
                        {
3848
                            if (e.LeftButton == MouseButtonState.Pressed)
3849
                            {
3850
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3851
                                //{
3852
                                    if (currentControl is LineControl)
3853
                                    {
3854
                                        //20180906 LJY TEST IsRotationDrawingEnable
3855
                                        if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3856
                                        {
3857
                                            return;
3858
                                        }
3859

    
3860
                                        CreateControl();
3861

    
3862
                                        (currentControl as LineControl).ApplyOverViewData();
3863
                                        currentControl = null;
3864
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3865
                                    }
3866
                                    else
3867
                                    {
3868
                                        currentControl = new LineControl
3869
                                        {
3870
                                            Background = new SolidColorBrush(Colors.Black)
3871
                                        };
3872
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3873
                                        currentControl.CommentID = Commons.shortGuid();
3874
                                        currentControl.IsNew = true;
3875
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3876
                                        this.MainAngle.Visibility = Visibility.Visible;
3877
                                    }
3878
                                //}
3879
                            }
3880
                        }
3881
                        break;
3882
                    case ControlType.DimLine:
3883
                        {
3884
                            if (e.LeftButton == MouseButtonState.Pressed)
3885
                            {
3886
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3887
                                //{
3888
                                    if (currentControl is LineControl)
3889
                                    {
3890
                                        //20180906 LJY TEST IsRotationDrawingEnable
3891
                                        if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3892
                                        {
3893
                                            return;
3894
                                        }
3895
                                        CreateControl();
3896

    
3897
                                        (currentControl as LineControl).ApplyOverViewData();
3898
                                        currentControl = null;
3899
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3900
                                    }
3901
                                    else
3902
                                    {
3903
                                        currentControl = new LineControl
3904
                                        {
3905
                                            Background = new SolidColorBrush(Colors.Black)
3906
                                        };
3907
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3908
                                        currentControl.CommentID = Commons.shortGuid();
3909
                                        currentControl.IsNew = true;
3910
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3911
                                        this.MainAngle.Visibility = Visibility.Visible;
3912
                                    }
3913
                                //}
3914
                            }
3915
                        }
3916
                        break;
3917
                    case ControlType.ChainLine:
3918
                        {
3919
                            if (currentControl is PolygonControl)
3920
                            {
3921
                                var control = currentControl as PolygonControl;
3922

    
3923
                                if (e.RightButton == MouseButtonState.Pressed)
3924
                                {
3925
                                    //20180906 LJY TEST IsRotationDrawingEnable
3926
                                    if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3927
                                    {
3928
                                        return;
3929
                                    }
3930

    
3931
                                    CreateControl();
3932

    
3933
                                    (currentControl as PolygonControl).ApplyOverViewData();
3934
                                    currentControl = null;
3935
                                    this.MainAngle.Visibility = Visibility.Collapsed;
3936
                                    return;
3937
                                }
3938

    
3939
                                if (!control.IsCompleted)
3940
                                {
3941
                                    control.PointSet.Add(control.EndPoint);
3942
                                    this.MainAngle.Visibility = Visibility.Visible;
3943
                                }
3944
                            }
3945
                            else
3946
                            {
3947
                                if (e.LeftButton == MouseButtonState.Pressed)
3948
                                {
3949
                                    MainAngle.Visibility = Visibility.Visible;
3950
                                    currentControl = new PolygonControl
3951
                                    {
3952
                                        PointSet = new List<Point>(),
3953
                                        //강인구 추가(ChainLine일때는 채우기 스타일을 주지 않기 위해 설정)
3954
                                        ControlType = ControlType.ChainLine,
3955
                                        DashSize = ViewerDataModel.Instance.DashSize,
3956
                                        LineSize = ViewerDataModel.Instance.LineSize,
3957
                                        //PointC = new StylusPointSet()
3958
                                    };
3959

    
3960
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3961
                                    //{
3962
                                        var polygonControl = (currentControl as PolygonControl);
3963
                                        currentControl.CommentID = Commons.shortGuid();
3964
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3965
                                        currentControl.IsNew = true;
3966
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3967
                                        //currentControl.OnApplyTemplate();
3968
                                        //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint);
3969
                                        //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint);
3970
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3971
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3972
                                    //}
3973
                                }
3974
                            }
3975
                        }
3976
                        break;
3977
                    case ControlType.ArcLine:
3978
                        {
3979
                            if (e.LeftButton == MouseButtonState.Pressed)
3980
                            {
3981
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3982
                                //{
3983
                                    if (currentControl is ArcControl)
3984
                                    {
3985
                                        //20180906 LJY TEST IsRotationDrawingEnable
3986
                                        if (IsGetoutpoint((currentControl as ArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3987
                                        {
3988
                                            return;
3989
                                        }
3990

    
3991
                                        CreateControl();
3992

    
3993
                                        (currentControl as ArcControl).ApplyOverViewData();
3994
                                        currentControl = null;
3995
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3996
                                    }
3997
                                    else
3998
                                    {
3999
                                        currentControl = new ArcControl
4000
                                        {
4001
                                            Background = new SolidColorBrush(Colors.Black)
4002
                                        };
4003
                                        currentControl.CommentID = Commons.shortGuid();
4004
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4005
                                        currentControl.IsNew = true;
4006
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4007
                                        this.MainAngle.Visibility = Visibility.Visible;
4008
                                    }
4009
                                //}
4010
                            }
4011
                            else if (e.RightButton == MouseButtonState.Pressed)
4012
                            {
4013
                                if (currentControl != null)
4014
                                {
4015
                                    (currentControl as ArcControl).setClock();
4016
                                    (currentControl as ArcControl).MidPoint = new Point(0, 0);
4017
                                    //(currentControl as ArcControl).ApplyTemplate();
4018
                                }
4019
                            }
4020
                        }
4021
                        break;
4022
                    case ControlType.ArcArrow:
4023
                        {
4024
                            if (e.LeftButton == MouseButtonState.Pressed)
4025
                            {
4026
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4027
                                //{
4028
                                if (currentControl is ArrowArcControl)
4029
                                {
4030
                                    //20180906 LJY TEST IsRotationDrawingEnable
4031
                                    if (IsGetoutpoint((currentControl as ArrowArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4032
                                    {
4033
                                        return;
4034
                                    }
4035

    
4036
                                    CreateControl();
4037

    
4038
                                    (currentControl as ArrowArcControl).ApplyOverViewData();
4039
                                    currentControl = null;
4040
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4041
                                }
4042
                                else
4043
                                {
4044
                                    currentControl = new ArrowArcControl
4045
                                    {
4046
                                        Background = new SolidColorBrush(Colors.Black)
4047
                                    };
4048
                                    currentControl.CommentID = Commons.shortGuid();
4049
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4050
                                    currentControl.IsNew = true;
4051
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4052
                                    this.MainAngle.Visibility = Visibility.Visible;
4053
                                }
4054
                                //}
4055
                            }
4056
                            else if (e.RightButton == MouseButtonState.Pressed)
4057
                            {
4058
                                if (currentControl != null)
4059
                                {
4060
                                    (currentControl as ArrowArcControl).setClock();
4061
                                    (currentControl as ArrowArcControl).MidPoint = new Point(0, 0);
4062
                                    //(currentControl as ArcControl).ApplyTemplate();
4063
                                }
4064
                            }
4065
                        }
4066
                        break;
4067
                    case ControlType.ArrowMultiLine:
4068
                        {
4069
                            if (e.LeftButton == MouseButtonState.Pressed)
4070
                            {
4071
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4072
                                //{
4073

    
4074
                                    if (currentControl is ArrowControl_Multi)
4075
                                    {
4076
                                        var content = currentControl as ArrowControl_Multi;
4077
                                        if (content.MiddlePoint == new Point(0, 0))
4078
                                        {
4079
                                            if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
4080
                                            {
4081
                                                content.MiddlePoint = content.EndPoint;
4082
                                            }
4083
                                            else
4084
                                            {
4085
                                                content.MiddlePoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
4086
                                            }
4087
                                        }
4088
                                        else
4089
                                        {
4090
                                            //20180906 LJY TEST IsRotationDrawingEnable
4091
                                            if (IsGetoutpoint((currentControl as ArrowControl_Multi).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4092
                                            {
4093
                                                return;
4094
                                            }
4095

    
4096
                                            CreateControl();
4097

    
4098
                                            (currentControl as ArrowControl_Multi).ApplyOverViewData();
4099
                                            currentControl = null;
4100
                                            this.MainAngle.Visibility = Visibility.Collapsed;
4101
                                        }
4102
                                    }
4103
                                    else
4104
                                    {
4105
                                        currentControl = new ArrowControl_Multi
4106
                                        {
4107
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
4108
                                            Background = new SolidColorBrush(Colors.Black)
4109
                                        };
4110
                                        currentControl.CommentID = Commons.shortGuid();
4111
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4112
                                        currentControl.IsNew = true;
4113
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4114
                                        this.MainAngle.Visibility = Visibility.Visible;
4115
                                    }
4116
                                //}
4117
                            }
4118
                        }
4119
                        break;
4120
                    case ControlType.PolygonCloud:
4121
                        {
4122
                            if (currentControl is CloudControl)
4123
                            {
4124
                                var control = currentControl as CloudControl;
4125
                                if (e.RightButton == MouseButtonState.Pressed)
4126
                                {
4127
                                    control.IsCompleted = true;
4128
                                }
4129

    
4130
                                if (!control.IsCompleted)
4131
                                {
4132
                                    control.PointSet.Add(control.EndPoint);
4133
                                }
4134
                                else
4135
                                {
4136
                                    //20180906 LJY TEST IsRotationDrawingEnable
4137
                                    if (IsGetoutpoint((currentControl as CloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4138
                                    {
4139
                                        return;
4140
                                    }
4141

    
4142
                                    CreateControl();
4143

    
4144
                                    control.isTransOn = true;
4145
                                    var firstPoint = control.PointSet.First();
4146

    
4147
                                    control.PointSet.Add(firstPoint);
4148
                                    control.DrawingCloud();
4149
                                    control.ApplyOverViewData();
4150

    
4151
                                    currentControl = null;
4152
                                }
4153
                            }
4154
                            else
4155
                            {
4156
                                if (e.LeftButton == MouseButtonState.Pressed)
4157
                                {
4158
                                    currentControl = new CloudControl
4159
                                    {
4160
                                        PointSet = new List<Point>(),
4161
                                        PointC = new StylusPointSet()
4162
                                    };
4163

    
4164
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4165
                                    //{
4166
                                        var polygonControl = (currentControl as CloudControl);
4167
                                        currentControl.CommentID = Commons.shortGuid();
4168
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4169
                                        currentControl.IsNew = true;
4170
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4171

    
4172
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
4173
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
4174
                                    
4175
                                    //}
4176
                                }
4177
                            }
4178
                        }
4179
                        break;
4180
                    case ControlType.ImgControl:
4181
                        {
4182
                            if (e.LeftButton == MouseButtonState.Pressed)
4183
                            {
4184
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4185
                                //{
4186
                                    if (currentControl is ImgControl)
4187
                                    {
4188
                                        //20180906 LJY TEST IsRotationDrawingEnable
4189
                                        if (IsGetoutpoint((currentControl as ImgControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4190
                                        {
4191
                                            return;
4192
                                        }
4193

    
4194
                                        CreateControl();
4195
                                        (currentControl as ImgControl).ApplyOverViewData();
4196
                                        controlType = ControlType.ImgControl;
4197
                                        currentControl = null;
4198
                                    }
4199
                                    else
4200
                                    {
4201
                                        
4202
                                        string extension = System.IO.Path.GetExtension(filename).ToUpper();
4203
                                        if (extension == ".PNG" || extension == ".JPEG" || extension == ".GIF" || extension == ".BMP" || extension == ".JPG" || extension == ".SVG")
4204
                                        {
4205
                                            Image img = new Image();
4206
                                            //img.Source = new BitmapImage(new Uri(filename));
4207
                                            if (filename.Contains(".svg"))
4208
                                            {
4209
                                                byte[] imageData = null;
4210
                                                DrawingImage image = null;
4211
                                                using (System.Net.WebClient web = new System.Net.WebClient())
4212
                                                {
4213
                                                    imageData = web.DownloadData(new Uri(filename));
4214
                                                    System.IO.Stream stream = new System.IO.MemoryStream(imageData);
4215
                                                    image = SvgReader.Load(stream);
4216
                                                }
4217
                                                img.Source = image;
4218
                                            }
4219
                                            else
4220
                                            {
4221
                                                img.Source = new BitmapImage(new Uri(filename));
4222
                                            }
4223

    
4224
                                            currentControl = new ImgControl
4225
                                            {
4226
                                                    Background = new SolidColorBrush(Colors.Black),
4227
                                                    PointSet = new List<Point>(),
4228
                                                    FilePath = filename,
4229
                                                    ImageData = img.Source,
4230
                                                    StartPoint = canvasDrawingMouseDownPoint,
4231
                                                    EndPoint = new Point(canvasDrawingMouseDownPoint.X + 100, canvasDrawingMouseDownPoint.Y + 100),
4232
                                                    TopRightPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y + 100),
4233
                                                    LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X + 100, canvasDrawingMouseDownPoint.Y),
4234
                                                    ControlType = ControlType.ImgControl
4235
                                                };
4236

    
4237
                                        
4238
                                                currentControl.CommentID = Commons.shortGuid();                                            
4239
                                                currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4240
                                                currentControl.IsNew = true;
4241
                                                ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4242

    
4243
                                                //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
4244
                                                (currentControl as ImgControl).Angle -= rotate.Angle;
4245
                                        }
4246
                                    }
4247
                                //}
4248
                            }
4249
                        }
4250
                        break;
4251
                    case ControlType.Date:
4252
                        {
4253
                            if (e.LeftButton == MouseButtonState.Pressed)
4254
                            {
4255
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4256
                                //{
4257
                                    if (currentControl is DateControl)
4258
                                    {
4259
                                        //20180906 LJY TEST IsRotationDrawingEnable
4260
                                        if (IsGetoutpoint((currentControl as DateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4261
                                        {
4262
                                            return;
4263
                                        }
4264

    
4265
                                        CreateControl();
4266
                                        (currentControl as DateControl).ApplyOverViewData();
4267
                                        currentControl = null;
4268

    
4269
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
4270
                                        {
4271
                                            controlType = ControlType.None;
4272
                                            IsSwingMode = false;
4273
                                            Common.ViewerDataModel.Instance.SelectedControl = "";
4274
                                            Common.ViewerDataModel.Instance.ControlTag = null;
4275
                                            mouseHandlingMode = MouseHandlingMode.None;
4276
                                            this.ParentOfType<MainWindow>().dzTopMenu.btn_Batch.IsChecked = false;
4277
                                            txtBatch.Visibility = Visibility.Collapsed;
4278

    
4279
                                        }
4280
                                    }
4281
                                    else
4282
                                    {
4283
                                        currentControl = new DateControl
4284
                                        {
4285
                                            Background = new SolidColorBrush(Colors.Black)
4286
                                        };
4287
                                        currentControl.CommentID = Commons.shortGuid();
4288
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4289
                                        currentControl.IsNew = true;
4290
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4291

    
4292
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
4293
                                        (currentControl as DateControl).Angle -= rotate.Angle;
4294
                                }
4295
                                //}
4296
                            }
4297
                        }
4298
                        break;
4299
                    case ControlType.TextControl:
4300
                        {
4301
                            if (e.LeftButton == MouseButtonState.Pressed)
4302
                            {
4303
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4304
                                {
4305
                                    currentControl = new TextControl
4306
                                    {
4307
                                        ControlType = controlType
4308
                                    };
4309
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
4310
                                    currentControl.CommentID = Commons.shortGuid();
4311
                                    currentControl.IsNew = true;
4312
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4313
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4314
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
4315

    
4316
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
4317
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);
4318
                                    
4319
                                    (currentControl as TextControl).ControlType_No = 0;
4320
                                    (currentControl as TextControl).Angle -= rotate.Angle;
4321
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
4322
                                    (currentControl as TextControl).ApplyTemplate();
4323
                                    (currentControl as TextControl).Base_TextBox.Focus();
4324

    
4325
                                    //System.Diagnostics.Debug.WriteLine("CanvasX" + (currentControl as TextControl).CanvasX);
4326
                                    //System.Diagnostics.Debug.WriteLine("CanvasY" + (currentControl as TextControl).CanvasY);
4327

    
4328
                                    CreateControl();
4329

    
4330
                                }
4331
                            }
4332
                        }
4333
                        break;
4334
                    case ControlType.TextBorder:
4335
                        {
4336
                            if (e.LeftButton == MouseButtonState.Pressed)
4337
                            {
4338
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4339
                                {
4340
                                    currentControl = new TextControl
4341
                                    {
4342
                                        ControlType = controlType
4343
                                    };
4344

    
4345
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
4346
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4347
                                    currentControl.CommentID = Commons.shortGuid();
4348
                                    currentControl.IsNew = true;
4349
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4350
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
4351
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
4352
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);
4353
                                    
4354
                                    (currentControl as TextControl).ControlType_No = 1;
4355
                                    (currentControl as TextControl).Angle = Ang;
4356
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
4357
                                    (currentControl as TextControl).ApplyTemplate();
4358
                                    (currentControl as TextControl).Base_TextBox.Focus();
4359
                                    CreateControl();
4360

    
4361
                                    //currentControl = null;
4362
                                }
4363
                            }
4364
                        }
4365
                        break;
4366
                    case ControlType.TextCloud:
4367
                        {
4368
                            if (e.LeftButton == MouseButtonState.Pressed)
4369
                            {
4370
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4371
                                {
4372
                                    currentControl = new TextControl
4373
                                    {
4374
                                        ControlType = controlType
4375
                                    };
4376

    
4377
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
4378
                                    currentControl.CommentID = Commons.shortGuid();
4379
                                    currentControl.IsNew = true;
4380
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4381
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4382

    
4383
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
4384
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
4385
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);                                    
4386

    
4387
                                    (currentControl as TextControl).Angle = Ang;
4388
                                    (currentControl as TextControl).ControlType_No = 2;
4389
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
4390
                                    (currentControl as TextControl).ApplyTemplate();
4391
                                    (currentControl as TextControl).Base_TextBox.Focus();
4392
                                    CreateControl();
4393
                                    //currentControl = null;
4394
                                }
4395
                            }
4396
                        }
4397
                        break;
4398
                    case ControlType.ArrowTextControl:
4399
                         {
4400
                            if (e.LeftButton == MouseButtonState.Pressed)
4401
                            {
4402
                                if (currentControl is ArrowTextControl)
4403
                                {
4404
                                    //20180906 LJY TEST IsRotationDrawingEnable
4405
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4406
                                    {
4407
                                        return;
4408
                                    }                                    
4409

    
4410
                                    CreateControl();
4411

    
4412
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4413
                                    (currentControl as ArrowTextControl).IsEditing = false;
4414
                                    (currentControl as ArrowTextControl).EnableEditing = false;
4415
                                    (currentControl as ArrowTextControl).IsNew = false;
4416
                                    currentControl = null;
4417
                                }
4418
                                else
4419
                                {
4420
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4421
                                    //{
4422
                                        currentControl = new ArrowTextControl();
4423
                                        currentControl.CommentID = Commons.shortGuid();
4424
                                        currentControl.IsNew = true;
4425
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4426
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4427

    
4428
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4429
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4430
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);
4431
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4432
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4433

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

    
4437
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4438
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4439
                                        this.MainAngle.Visibility = Visibility.Visible;
4440

    
4441
                                    
4442
                                    //}
4443
                                }
4444
                            }
4445
                        }
4446
                        break;
4447
                    case ControlType.ArrowTransTextControl:
4448
                        {
4449
                            if (e.LeftButton == MouseButtonState.Pressed)
4450
                            {
4451
                                if (currentControl is ArrowTextControl)
4452
                                {
4453
                                    //20180906 LJY TEST IsRotationDrawingEnable
4454
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4455
                                    {
4456
                                        return;
4457
                                    }                                    
4458

    
4459
                                    CreateControl();
4460
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4461
                                    currentControl.IsNew = false;
4462
                                    currentControl = null;
4463
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4464
                                }
4465
                                else
4466
                                {
4467
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4468
                                    //{
4469
                                         currentControl = new ArrowTextControl();
4470
                                        currentControl.CommentID = Commons.shortGuid();
4471
                                        currentControl.IsNew = true;
4472
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4473
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4474
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4475
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4476
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                  
4477
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4478
                                        (currentControl as ArrowTextControl).isFixed = true;
4479
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4480

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

    
4484
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4485
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4486
                                        (currentControl as ArrowTextControl).isTrans = true;
4487
                                }
4488
                            }
4489
                        }
4490
                        break;
4491
                    case ControlType.ArrowTextBorderControl:
4492
                         {
4493
                            if (e.LeftButton == MouseButtonState.Pressed)
4494
                            {
4495
                                if (currentControl is ArrowTextControl)
4496
                                {
4497
                                    //20180906 LJY TEST IsRotationDrawingEnable
4498
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4499
                                    {
4500
                                        return;
4501
                                    }
4502

    
4503
                                    CreateControl();
4504
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4505
                                    currentControl.IsNew = false;
4506
                                    currentControl = null;
4507
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4508
                                }
4509
                                else
4510
                                {
4511
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4512
                                    //{
4513
                                        currentControl = new ArrowTextControl()
4514
                                        {
4515
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect
4516
                                        };
4517
                                        currentControl.CommentID = Commons.shortGuid();
4518
                                        currentControl.IsNew = true;
4519
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4520
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4521

    
4522
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4523

    
4524
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4525

    
4526
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);
4527
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4528
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4529

    
4530
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
4531
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
4532
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4533
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4534
                                        this.MainAngle.Visibility = Visibility.Visible;                                    
4535
                                    //}
4536
                                }
4537
                            }
4538
                        }
4539
                        break;
4540
                    case ControlType.ArrowTransTextBorderControl:
4541
                        {
4542
                            if (e.LeftButton == MouseButtonState.Pressed)
4543
                            {
4544
                                if (currentControl is ArrowTextControl)
4545
                                {
4546
                                    //20180906 LJY TEST IsRotationDrawingEnable
4547
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4548
                                    {
4549
                                        return;
4550
                                    }
4551
                                    CreateControl();
4552
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4553
                                    currentControl.IsNew = false;
4554
                                    currentControl = null;
4555
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4556
                                }
4557
                                else
4558
                                {
4559
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4560
                                    //{
4561
                                    
4562

    
4563
                                    currentControl = new ArrowTextControl()
4564
                                        {
4565
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect
4566
                                        };
4567
                                        currentControl.CommentID = Commons.shortGuid();
4568
                                        currentControl.IsNew = true;
4569
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4570
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4571

    
4572
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4573

    
4574
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4575
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                                    
4576
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4577
                                        (currentControl as ArrowTextControl).isFixed = true;
4578
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4579
                                     
4580
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
4581
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
4582
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4583

    
4584
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();                                 
4585
                                        this.MainAngle.Visibility = Visibility.Visible;
4586
                                    
4587
                                    //20180911 LJY
4588
                                        (currentControl as ArrowTextControl).isTrans = true;
4589
                                    
4590

    
4591
                                    //}
4592
                                }
4593
                            }
4594
                        }
4595
                        break;
4596
                    case ControlType.ArrowTextCloudControl:
4597
                        {
4598
                            if (e.LeftButton == MouseButtonState.Pressed)
4599
                            {
4600
                                if (currentControl is ArrowTextControl)
4601
                                {
4602
                                    //20180906 LJY TEST IsRotationDrawingEnable
4603
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4604
                                    {
4605
                                        return;
4606
                                    }
4607
                                    CreateControl();
4608
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4609
                                    currentControl.IsNew = false;
4610
                                    currentControl = null;
4611
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4612
                                }
4613
                                else
4614
                                {
4615
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4616
                                    //{
4617
                                        currentControl = new ArrowTextControl()
4618
                                        {
4619
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud
4620
                                        };
4621
                                        currentControl.CommentID = Commons.shortGuid();
4622
                                        currentControl.IsNew = true;
4623
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4624
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4625

    
4626
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4627
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4628
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                                 
4629
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4630
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4631

    
4632
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
4633
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
4634
                                    
4635
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4636
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4637
                                        this.MainAngle.Visibility = Visibility.Visible;                                        
4638
                                    //}
4639
                                }
4640
                            }
4641
                        }
4642
                        break;
4643
                    case ControlType.ArrowTransTextCloudControl:
4644
                        {
4645
                            if (e.LeftButton == MouseButtonState.Pressed)
4646
                            {
4647
                                if (currentControl is ArrowTextControl)
4648
                                {
4649
                                    //20180906 LJY TEST IsRotationDrawingEnable
4650
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4651
                                    {
4652
                                        return;
4653
                                    }
4654
                                    CreateControl();
4655
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4656
                                    currentControl.IsNew = false;
4657
                                    currentControl = null;
4658
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4659
                                }
4660
                                else
4661
                                {
4662
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4663
                                    //{
4664
                                        currentControl = new ArrowTextControl()
4665
                                        {
4666
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud
4667
                                        };
4668
                                        currentControl.CommentID = Commons.shortGuid();
4669
                                        currentControl.IsNew = true; 
4670
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4671
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4672
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4673

    
4674
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4675
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                                        
4676
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4677
                                        (currentControl as ArrowTextControl).isFixed = true;
4678
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4679

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

    
4683
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4684
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4685
                                        this.MainAngle.Visibility = Visibility.Visible;  
4686
                                    
4687
                                    //20180911 LJY
4688
                                        (currentControl as ArrowTextControl).isTrans = true;
4689
                                    //}
4690
                                }
4691
                            }
4692
                        }
4693
                        break;
4694
                    case ControlType.PolygonControl:
4695
                        {
4696
                            if (currentControl is PolygonControl)
4697
                            {
4698
                                var control = currentControl as PolygonControl;
4699

    
4700
                                if (e.RightButton == MouseButtonState.Pressed)
4701
                                {
4702
                                    control.IsCompleted = true;
4703
                                }
4704

    
4705
                                if (!control.IsCompleted)
4706
                                {
4707
                                    control.PointSet.Add(control.EndPoint);
4708
                                }
4709
                                else
4710
                                {
4711
                                    //20180906 LJY TEST IsRotationDrawingEnable
4712
                                    if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4713
                                    {
4714
                                        return;
4715
                                    }
4716

    
4717
                                    var firstPoint = control.PointSet.First();
4718
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
4719
                                    control.LineSize = ViewerDataModel.Instance.LineSize;
4720
                                    control.PointSet.Add(firstPoint);
4721

    
4722
                                    control.ApplyOverViewData();
4723

    
4724
                                    CreateControl();
4725
                                    control.updateControl();
4726
                                    currentControl = null;
4727
                                }
4728
                            }
4729
                            else
4730
                            {
4731
                                if (e.LeftButton == MouseButtonState.Pressed)
4732
                                {
4733
                                    currentControl = new PolygonControl
4734
                                    {
4735
                                        PointSet = new List<Point>(),
4736
                                    };
4737

    
4738
                                    var polygonControl = (currentControl as PolygonControl);
4739
                                    currentControl.CommentID = Commons.shortGuid();
4740
                                    currentControl.IsNew = true;
4741
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4742
                                    polygonControl.StartPoint = canvasDrawingMouseDownPoint;
4743
                                    polygonControl.EndPoint = canvasDrawingMouseDownPoint;
4744
                                    polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
4745
                                    polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
4746
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4747
                                    polygonControl.ApplyTemplate();
4748
                                    polygonControl.Visibility = Visibility.Visible;
4749
                                }
4750
                            }
4751
                        }
4752
                        break;
4753
                    //강인구 추가
4754
                    case ControlType.Sign:
4755
                        {
4756
                            if (e.LeftButton == MouseButtonState.Pressed)
4757
                            {
4758
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4759
                                //{
4760
                                    var _sign = GetUserSign.GetSign(App.ViewInfo.UserID, App.ViewInfo.ProjectNO);
4761

    
4762
                                    if (_sign == null)
4763
                                    {
4764
                                        txtBatch.Visibility = Visibility.Collapsed;
4765
                                        mouseHandlingMode = IKCOM.MouseHandlingMode.None;
4766
                                        controlType = ControlType.None;
4767

    
4768
                                        this.ParentOfType<MainWindow>().DialogMessage_Alert("등록된 Sign이 없습니다.", "Alert");
4769
                                        this.ParentOfType<MainWindow>().ChildrenOfType<RadToggleButton>().Where(data => data.IsChecked == true).FirstOrDefault().IsChecked = false;
4770
                                        return;
4771
                                    }
4772

    
4773
                                    if (currentControl is SignControl)
4774
                                    {
4775
                                        //20180906 LJY TEST IsRotationDrawingEnable
4776
                                        if (IsGetoutpoint((currentControl as SignControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4777
                                        {
4778
                                            return;
4779
                                        }
4780

    
4781
                                        CreateControl();
4782
                                        currentControl = null;
4783
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
4784
                                        {
4785
                                            txtBatch.Text = "Place Date";
4786
                                            controlType = ControlType.Date;
4787
                                        }
4788
                                    }
4789
                                    else
4790
                                    {
4791
                                        currentControl = new SignControl
4792
                                        {
4793
                                            Background = new SolidColorBrush(Colors.Black),
4794
                                            UserNumber = App.ViewInfo.UserID,
4795
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
4796
                                            EndPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
4797
                                            ControlType = ControlType.Sign
4798
                                        };
4799

    
4800
                                        currentControl.CommentID = Commons.shortGuid();
4801
                                        currentControl.IsNew = true;
4802
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4803
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4804

    
4805
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
4806
                                        (currentControl as SignControl).Angle -= rotate.Angle;                                    
4807
                                }
4808
                                //}
4809
                            }
4810
                        }
4811
                        break;
4812
                    case ControlType.Mark:
4813
                        {
4814
                            if (e.LeftButton == MouseButtonState.Pressed)
4815
                            {
4816
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4817
                                //{
4818
                                    if (currentControl is RectangleControl)
4819
                                    {
4820
                                        //20180906 LJY TEST IsRotationDrawingEnable
4821
                                        if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4822
                                        {
4823
                                            return;
4824
                                        }
4825

    
4826
                                        CreateControl();
4827
                                        (currentControl as RectangleControl).ApplyOverViewData();
4828
                                        currentControl = null;
4829
                                    
4830
                                        this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
4831

    
4832
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
4833
                                        {
4834
                                            txtBatch.Text = "Place Signature";
4835
                                            controlType = ControlType.Sign;
4836
                                        }
4837
                                    }
4838
                                    else
4839
                                    {
4840
                                        currentControl = new RectangleControl
4841
                                        {
4842
                                            Background = new SolidColorBrush(Colors.Black),
4843
                                            Paint = PaintSet.Fill
4844
                                        };
4845

    
4846
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4847
                                        currentControl.CommentID = Commons.shortGuid();
4848
                                        currentControl.IsNew = true;
4849
                                        (currentControl as RectangleControl).DashSize = ViewerDataModel.Instance.DashSize;
4850
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4851
                                    }
4852
                                //}
4853
                            }
4854
                        }
4855
                        break;
4856
                    case ControlType.Symbol:
4857
                        {
4858
                            if (e.LeftButton == MouseButtonState.Pressed)
4859
                            {
4860
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4861
                                //{
4862
                                    if (currentControl is SymControl)
4863
                                    {
4864
                                        //20180906 LJY TEST IsRotationDrawingEnable
4865
                                        if (IsGetoutpoint((currentControl as SymControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4866
                                        {
4867
                                            return;
4868
                                        }
4869
                                        CreateControl();
4870
                                        currentControl = null;
4871
                                    
4872
                                        this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
4873
                                    }
4874
                                    else
4875
                                    {
4876
                                        currentControl = new SymControl
4877
                                        {
4878
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
4879
                                            Background = new SolidColorBrush(Colors.Black),
4880
                                            ControlType = ControlType.Symbol
4881
                                        };
4882

    
4883
                                        currentControl.IsNew = true;
4884
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4885
                                        currentControl.CommentID = Commons.shortGuid();
4886
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4887

    
4888
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
4889
                                        (currentControl as SymControl).Angle -= rotate.Angle;
4890
                                }
4891
                                //}
4892
                            }
4893
                        }
4894
                        break;
4895
                    case ControlType.Stamp:
4896
                        {
4897
                            if (e.LeftButton == MouseButtonState.Pressed)
4898
                            {
4899
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4900
                                //{
4901
                                    if (currentControl is SymControlN)
4902
                                    {
4903
                                        //20180906 LJY TEST IsRotationDrawingEnable
4904
                                        if (IsGetoutpoint((currentControl as SymControlN).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4905
                                        {
4906
                                            return;
4907
                                        }
4908

    
4909
                                        CreateControl();
4910
                                        currentControl = null;
4911
                                   
4912

    
4913
                                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
4914
                                    }
4915
                                    else
4916
                                    {
4917
                                        currentControl = new SymControlN
4918
                                        {
4919
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
4920
                                            Background = new SolidColorBrush(Colors.Black),
4921
                                            ControlType = ControlType.Stamp
4922
                                        };
4923

    
4924
                                        currentControl.IsNew = true;
4925
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4926
                                        currentControl.CommentID = Commons.shortGuid();
4927
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4928
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
4929
                                        (currentControl as SymControlN).Angle -= rotate.Angle;
4930
                                }                                    
4931
                                //}
4932
                            }
4933
                        }
4934
                        break;
4935
                    case ControlType.PenControl:
4936
                        {
4937
                            if (inkBoard.Tag.ToString() == "Ink")
4938
                            {
4939
                                inkBoard.IsEnabled = true;
4940
                                StartNewStroke(canvasDrawingMouseDownPoint);
4941
                            }
4942
                            else if (inkBoard.Tag.ToString() == "EraseByPoint")
4943
                            {
4944
                                RemovePointStroke(canvasDrawingMouseDownPoint);
4945
                            }
4946
                            else if (inkBoard.Tag.ToString() == "EraseByStroke")
4947
                            {
4948
                                RemoveLineStroke(canvasDrawingMouseDownPoint);
4949
                            }
4950
                            IsDrawing = true;
4951
                            return;
4952
                        }
4953
                    default:
4954
                        if (currentControl != null)
4955
                        {
4956
                            currentControl.CommentID = null;
4957
                            currentControl.IsNew = false;
4958
                        }
4959
                        break;
4960
                }
4961
            }
4962
            if (mouseHandlingMode != MouseHandlingMode.None && e.LeftButton == MouseButtonState.Pressed)
4963
            {
4964
                if (mouseHandlingMode == MouseHandlingMode.Adorner && SelectLayer.Children.Count > 0)
4965
                {
4966
                    bool mouseOff = false;
4967
                    foreach (var item in SelectLayer.Children)
4968
                    {
4969
                        if (item is AdornerFinal)
4970
                        {
4971

    
4972
                            var over = (item as AdornerFinal).MemberSet.Where(data => data.DrawingData.IsMouseOver).FirstOrDefault();
4973
                            if (over != null)
4974
                            {
4975
                                mouseOff = true;
4976
                            }
4977
                        }
4978
                    }
4979

    
4980
                    if (!mouseOff)
4981
                    {
4982
                        SelectionSet.Instance.UnSelect(this);
4983
                    }
4984
                }
4985
                zoomAndPanControl.CaptureMouse();
4986
                e.Handled = true;
4987
            }
4988
        }
4989

    
4990
        private void zoomAndPanControl2_MouseDown(object sender, MouseButtonEventArgs e)
4991
        {
4992
            ///mouseButtonDown = e.ChangedButton;
4993
            canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas2);
4994
        }
4995

    
4996
        private void RemoveLineStroke(Point P)
4997
        {
4998
            var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.ItemRect.Contains(P)).FirstOrDefault();
4999
            if (control != null)
5000
            {
5001
                UndoData = new Undo_data()
5002
                {
5003
                    IsUndo = false,
5004
                    Event = Event_Type.Delete,
5005
                    EventTime = DateTime.Now,
5006
                    Markup_List = new List<Multi_Undo_data>()
5007
                };
5008

    
5009

    
5010
                multi_Undo_Data.Markup = control as MarkupToPDF.Common.CommentUserInfo;
5011
                UndoData.Markup_List.Add(multi_Undo_Data);
5012
                multi_Undo_Data = new Multi_Undo_data();
5013

    
5014
                ViewerDataModel.Instance.MarkupControls_USER.Remove(control);
5015
                var Item_ = ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (control as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault();
5016
                ViewerDataModel.Instance.MyMarkupList.Remove(Item_);
5017
                
5018
                //임시파일에서도 삭제한다.
5019
                TempFile.DelTemp((control as MarkupToPDF.Common.CommentUserInfo).CommentID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString());
5020
                
5021
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
5022
                {
5023
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
5024
                });
5025
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
5026

    
5027
            }
5028
        }
5029

    
5030
        private void RemovePointStroke(Point P)
5031
        {
5032
            foreach (Stroke hits in inkBoard.Strokes)
5033
            {
5034
                foreach (StylusPoint sty in hits.StylusPoints)
5035
                {
5036

    
5037
                }
5038
                if (hits.HitTest(P))
5039
                {
5040
                    inkBoard.Strokes.Remove(hits);
5041
                    return;
5042
                }
5043
            }
5044
        }
5045

    
5046
        private void StartNewStroke(Point P)
5047
        {
5048
            strokePoints = new StylusPointCollection();
5049
            StylusPoint segment1Start = new StylusPoint(P.X, P.Y);
5050
            strokePoints.Add(segment1Start);
5051
            stroke = new Stroke(strokePoints);
5052

    
5053
            stroke.DrawingAttributes.Color = Colors.Red;
5054
            stroke.DrawingAttributes.Width = 4;
5055
            stroke.DrawingAttributes.Height = 4;
5056

    
5057
            inkBoard.Strokes.Add(stroke);
5058

    
5059
        }
5060

    
5061
        private void btnConsolidate_Click(object sender, RoutedEventArgs e)
5062
        {
5063
            ConsolidationMethod();
5064
        }
5065

    
5066
        /// <summary>
5067
        /// execute TeamConsolidationCommand
5068
        /// </summary>
5069
        public void TeamConsolidationMethod()
5070
        {
5071
            this.UpdateMyMarkupList();
5072
            if (this.gridViewMarkup.SelectedItems.Count == 0)
5073
            {
5074
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
5075
            }
5076
            else
5077
            {
5078

    
5079
                ViewerDataModel.Instance.IsConsolidate = true;
5080
                this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
5081

    
5082
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
5083
                {
5084
                    if (!this.userData.DEPARTMENT.Equals(item.Depatment))
5085
                    {
5086
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at your department", "Alert");
5087
                        return;
5088
                    }                    
5089
                }
5090
                List<MarkupInfoItem> MarkupInfoList = new List<MarkupInfoItem>();
5091
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
5092
                {
5093
                    MarkupInfoList.Add(item);
5094
                }
5095
                TeamConsolidateCommand.Instance.Execute(MarkupInfoList);
5096
            }
5097
        }
5098

    
5099
        public void ConsolidationMethod()
5100
        {
5101
            if (this.gridViewMarkup.SelectedItems.Count == 0)
5102
            {
5103
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
5104
            }
5105
            else
5106
            {
5107
                List<IKCOM.MarkupInfoItem> MySelectItem = new List<IKCOM.MarkupInfoItem>();
5108
                foreach (var item in this.gridViewMarkup.SelectedItems)
5109
                {
5110
                    MySelectItem.Add(item as IKCOM.MarkupInfoItem);
5111
                }
5112
                int iPageNo = Convert.ToInt32(this.ParentOfType<MainWindow>().dzTopMenu.tlcurrentPage.Text);
5113
                
5114
                ConsolidateCommand.Instance.Execute(MySelectItem, iPageNo);
5115
            }
5116
        }
5117

    
5118
        private void btnConsolidate_Loaded(object sender, RoutedEventArgs e)
5119
        {
5120
            if (App.ViewInfo != null)
5121
            {
5122
                btnConsolidate = (sender as RadRibbonButton);
5123
                if (!App.ViewInfo.NewCommentPermission)
5124
                {
5125
                    (sender as RadRibbonButton).Visibility = System.Windows.Visibility.Collapsed;
5126
                }
5127
            }
5128
        }
5129

    
5130
        private void btnTeamConsolidate_Click(object sender, RoutedEventArgs e)
5131
        {
5132
            TeamConsolidationMethod();
5133
        }
5134

    
5135
        private void btnTeamConsolidate_Loaded(object sender, RoutedEventArgs e)
5136
        {
5137
            btnTeamConsolidate = sender as RadRibbonButton;
5138
            if (App.ViewInfo != null)
5139
            {
5140
                if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면
5141
                {
5142
                    if (btnConsolidate != null)
5143
                    {
5144
                        btnConsolidate.Visibility = Visibility.Collapsed;
5145
                    }
5146

    
5147
                    if (!App.ViewInfo.NewCommentPermission)
5148
                    {
5149
                        btnTeamConsolidate.Visibility = Visibility.Collapsed;
5150
                    }
5151
                }
5152
                else
5153
                {
5154
                    btnTeamConsolidate.Visibility = Visibility.Collapsed;
5155
                }
5156
            }
5157
        }
5158

    
5159
        private void FinalPDFEvent(object sender, RoutedEventArgs e)
5160
        {
5161
            var item = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault();
5162
            if (item != null)
5163
            {
5164
                Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item.MarkupInfoID + "," + _ViewInfo.UserID, 1);
5165

    
5166
                BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item.MarkupInfoID, _ViewInfo.UserID);
5167
            }
5168
            else
5169
            {
5170
                DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내");
5171
            }
5172
        }
5173

    
5174
        private void btnFinalPDF_Loaded(object sender, RoutedEventArgs e)
5175
        {
5176
            btnFinalPDF = sender as RadRibbonButton;
5177
            if (App.ViewInfo != null)
5178
            {
5179
                if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면
5180
                {
5181
                    btnFinalPDF.Visibility = System.Windows.Visibility.Collapsed;
5182
                    if (btnConsolidate != null)
5183
                    {
5184
                        btnConsolidate.Visibility = Visibility.Collapsed;
5185
                    }
5186
                }
5187
            }
5188
        }
5189

    
5190
        private void ConsolidateFinalPDFEvent(object sender, RoutedEventArgs e)
5191
        {
5192
            UpdateMyMarkupList();
5193

    
5194
            if (this.gridViewMarkup.SelectedItems.Count == 0)
5195
            {
5196
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
5197
            }
5198
            else
5199
            {
5200
                ViewerDataModel.Instance.IsConsolidate = true;
5201
                this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
5202
                List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>();
5203

    
5204
                string project_no = App.ViewInfo.ProjectNO;
5205
                string doc_id = _DocInfo.ID;
5206
                string user_id = App.ViewInfo.UserID;
5207
                List<MarkupInfoItem> markupInfoItems = new List<MarkupInfoItem>();
5208
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
5209
                {
5210
                    markupInfoItems.Add(item);
5211
                }
5212
                Logger.sendReqLog("Consolidate", project_no + "," + user_id + "," + doc_id + "," + markupInfoItems, 1);
5213
                Logger.sendResLog("Consolidate", this.BaseClient.Consolidate(project_no, user_id, doc_id, markupInfoItems).ToString(), 1);
5214
                Logger.sendReqLog("GetMarkupInfoItemsAsync", App.ViewInfo.ProjectNO + "," + _DocInfo.ID, 1);
5215
                var items = this.BaseClient.GetMarkupInfoItems(App.ViewInfo.ProjectNO, _DocInfo.ID);
5216

    
5217
                var item2 = items.Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault();
5218
                if (item2 != null)
5219
                {
5220
                    Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item2.MarkupInfoID + "," + _ViewInfo.UserID, 1);
5221

    
5222
                    BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item2.MarkupInfoID, _ViewInfo.UserID);
5223
                    BaseClient.GetMarkupInfoItemsAsync(App.ViewInfo.ProjectNO, _DocInfo.ID);
5224
                }
5225
                else
5226
                {
5227
                    DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내");
5228
                }
5229
            }
5230
        }
5231

    
5232
        private void btnConsolidateFinalPDF_Loaded(object sender, RoutedEventArgs e)
5233
        {
5234
            btnConsolidateFinalPDF = (sender as RadRibbonButton);
5235

    
5236
            if (App.ViewInfo != null)
5237
            {
5238
                if (!App.ViewInfo.NewCommentPermission || !App.ViewInfo.CreateFinalPDFPermission)
5239
                {
5240
                    btnConsolidateFinalPDF.Visibility = System.Windows.Visibility.Collapsed;
5241
                }
5242
            }
5243
        }
5244

    
5245
        private void SyncCompare_Click(object sender, RoutedEventArgs e)
5246
        {
5247
            if (CompareMode.IsChecked)
5248
            {
5249
                if (ViewerDataModel.Instance.PageBalanceMode && ViewerDataModel.Instance.PageBalanceNumber == 0)
5250
                {
5251
                    ViewerDataModel.Instance.PageBalanceNumber = 1;
5252
                }
5253
                if (ViewerDataModel.Instance.PageNumber == 0)
5254
                {
5255
                    ViewerDataModel.Instance.PageNumber = 1;
5256
                }
5257

    
5258
                Logger.sendReqLog("GetCompareRectAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID + "," + CurrentRev.DOCUMENT_ID +
5259
                    "," + pageNavigator.CurrentPage.PageNumber.ToString() + "," + ViewerDataModel.Instance.PageNumber.ToString() + "," +
5260
                    userData.COMPANY != "EXT" ? "true" : "false", 1);
5261

    
5262
                BaseClient.GetCompareRectAsync(_ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber.ToString(), ViewerDataModel.Instance.PageNumber.ToString(), userData.COMPANY != "EXT" ? "true" : "false");
5263
            }
5264
            else
5265
            {
5266
                da.From = 1;
5267
                da.To = 1;
5268
                da.Duration = new Duration(TimeSpan.FromSeconds(9999));
5269
                da.AutoReverse = false;
5270
                canvas_compareBorder.Children.Clear();
5271
                canvas_compareBorder.BeginAnimation(OpacityProperty, da);
5272
            }
5273
        }
5274

    
5275
        private void Sync_Click(object sender, RoutedEventArgs e)
5276
        {
5277
            if (Sync.IsChecked)
5278
            {
5279
                ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
5280
                ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
5281
                ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
5282
            }
5283
        }
5284

    
5285
        private void SyncUserListExpender_Click(object sender, RoutedEventArgs e)
5286
        {
5287
            if (UserList.IsChecked)
5288
            {
5289
                this.gridViewRevMarkup.Visibility = Visibility.Visible;
5290
            }
5291
            else
5292
            {
5293
                this.gridViewRevMarkup.Visibility = Visibility.Collapsed;
5294
            }
5295
        }
5296

    
5297
        private void SyncPageBalance_Click(object sender, RoutedEventArgs e)
5298
        {
5299

    
5300
            if (BalanceMode.IsChecked)
5301
            {
5302
                ViewerDataModel.Instance.PageBalanceMode = true;
5303
            }
5304
            else
5305
            {
5306
                ViewerDataModel.Instance.PageBalanceMode = false;
5307
                ViewerDataModel.Instance.PageBalanceNumber = 0;
5308
            }
5309
        }
5310

    
5311
        private void SyncExit_Click(object sender, RoutedEventArgs e)
5312
        {
5313
            //초기화
5314
            testPanel2.IsHidden = true;
5315
            ViewerDataModel.Instance.PageBalanceMode = false;
5316
            ViewerDataModel.Instance.PageBalanceNumber = 0;
5317
            ViewerDataModel.Instance.PageNumber = 0;
5318
            ViewerDataModel.Instance.MarkupControls_Sync.Clear();
5319
            this.gridViewRevMarkup.Visibility = Visibility.Collapsed;
5320
            UserList.IsChecked = false;
5321
            BalanceMode.IsChecked = false;
5322
        }
5323

    
5324
        private void SyncPageChange_Click(object sender, RoutedEventArgs e)
5325
        {
5326
            if ((sender as System.Windows.Controls.Control).Tag != null)
5327
            {
5328
                //Compare 초기화
5329
                CompareMode.IsChecked = false;
5330
                var balancePoint = Convert.ToInt32((sender as System.Windows.Controls.Control).Tag);
5331

    
5332
                if (ViewerDataModel.Instance.PageNumber == 0)
5333
                {
5334
                    ViewerDataModel.Instance.PageNumber = 1;
5335
                }
5336

    
5337
                if (ViewerDataModel.Instance.PageBalanceNumber == pageNavigator.PageCount)
5338
                {
5339
                }
5340
                else
5341
                {
5342
                    ViewerDataModel.Instance.PageBalanceNumber += balancePoint;
5343
                }
5344

    
5345
                if (ViewerDataModel.Instance.PageNumber == pageNavigator.PageCount && balancePoint > 0)
5346
                {
5347

    
5348
                }
5349
                else if ((ViewerDataModel.Instance.PageNumber + balancePoint) >= 1)
5350
                {
5351
                    ViewerDataModel.Instance.PageNumber += balancePoint;
5352
                }
5353

    
5354
                if (!testPanel2.IsHidden)
5355
                {
5356
                    if (IsSyncPDFMode)
5357
                    {
5358
                        Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
5359
                        var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber)));
5360

    
5361
                        if (pdfpath.IsDownloading)
5362
                        {
5363
                            pdfpath.DownloadCompleted += (ex, arg) =>
5364
                            {
5365
                                ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5366
                                ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5367
                                ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5368
                                zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5369
                                zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5370
                            };
5371
                        }
5372
                        else
5373
                        {
5374
                            ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5375
                            ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5376
                            ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5377

    
5378
                            zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5379
                            zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5380
                        }
5381

    
5382
                    }
5383
                    else
5384
                    {
5385
                        string uri = "";
5386

    
5387
                        if (userData.COMPANY != "EXT")
5388
                        {
5389
                            uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber);
5390
                        }
5391
                        else
5392
                        {
5393
                            uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber);
5394
                        }
5395

    
5396
                        var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
5397

    
5398
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5399
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5400
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5401

    
5402
                        zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
5403
                        zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
5404

    
5405
                        if (defaultBitmapImage_Compare.IsDownloading)
5406
                        {
5407
                            defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
5408
                            {
5409
                                ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5410
                                ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5411
                                ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5412

    
5413
                                zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
5414
                                zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
5415
                            };
5416
                        }
5417
                    }
5418

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

    
5423
                    foreach (var item in gridSelectionRevItem)
5424
                    {
5425
                        item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageNumber).ToList().ForEach(delegate (MarkupItem markupitem)
5426
                        {
5427
                            MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID);
5428
                        });
5429
                    }
5430

    
5431
                    //강인구 추가
5432
                    zoomAndPanControl2.ZoomTo(new Rect
5433
                    {
5434
                        X = 0,
5435
                        Y = 0,
5436
                        Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width),
5437
                        Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height),
5438
                    });
5439

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

    
5442
                }
5443
            }
5444
        }
5445

    
5446
        private void SyncChange_Click(object sender, RoutedEventArgs e)
5447
        {
5448
            if (MarkupMode.IsChecked)
5449
            {
5450
                IsSyncPDFMode = true;
5451

    
5452
                var uri = CurrentRev.TO_VENDOR;
5453

    
5454
                if (ViewerDataModel.Instance.PageNumber == 0)
5455
                {
5456
                    ViewerDataModel.Instance.PageNumber = 1;
5457
                }
5458

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

    
5463
                if (pdfpath.IsDownloading)
5464
                {
5465
                    pdfpath.DownloadCompleted += (ex, arg) =>
5466
                    {
5467
                        ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5468
                        ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5469
                        ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5470
                        zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5471
                        zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5472
                    };
5473
                }
5474
                else
5475
                {
5476
                    ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5477
                    ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5478
                    ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5479

    
5480
                    zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5481
                    zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5482
                }
5483
            }
5484
            else
5485
            {
5486
                IsSyncPDFMode = false;
5487
                string uri = "";
5488
                if (userData.COMPANY != "EXT")
5489
                {
5490
                    uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5491
                }
5492
                else
5493
                {
5494
                    uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5495
                }
5496

    
5497
                var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
5498

    
5499
                ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5500
                ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5501
                ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5502

    
5503
                if (defaultBitmapImage_Compare.IsDownloading)
5504
                {
5505
                    defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
5506
                    {
5507
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5508
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5509
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5510
                    };
5511
                }
5512
                zoomAndPanControl2.ApplyTemplate();
5513
                zoomAndPanControl2.UpdateLayout();
5514
                zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
5515
                zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
5516
            }
5517
        }
5518

    
5519
        private void RadButton_Click(object sender, RoutedEventArgs e)
5520
        {
5521
            gridViewHistory_Busy.IsBusy = true;
5522

    
5523
            RadButton instance = sender as RadButton;
5524
            if (instance.CommandParameter != null)
5525
            {
5526
                CurrentRev = instance.CommandParameter as VPRevision;
5527
                BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) =>
5528
                {
5529
                    if (ea.Error == null && ea.Result != null)
5530
                    {
5531
                        testPanel2.IsHidden = false;
5532

    
5533
                        ViewerDataModel.Instance._markupInfoRevList.Clear();
5534
                        foreach(var info in ea.Result)
5535
                        {
5536
                            if(info.UserID == App.ViewInfo.UserID)
5537
                            {
5538
                                info.userDelete = true;
5539
                                info.DisplayColor = "FFFF0000";
5540
                            }
5541
                            else
5542
                            {
5543
                                info.userDelete = false;
5544
                            }
5545
                            ViewerDataModel.Instance._markupInfoRevList.Add(info);
5546
                        }
5547
                        gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList;
5548

    
5549
                        string uri = "";
5550
                        if (userData.COMPANY != "EXT")
5551
                        {
5552
                            uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5553
                        }
5554
                        else
5555
                        {
5556
                            uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5557
                        }
5558

    
5559
                        Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY);
5560

    
5561
                        var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
5562

    
5563
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5564
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5565
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5566

    
5567
                        if (defaultBitmapImage_Compare.IsDownloading)
5568
                        {
5569
                            defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
5570
                            {
5571
                                ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5572
                                ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5573
                                ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5574
                            };
5575
                        }
5576

    
5577
                        zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
5578
                        zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
5579
                        zoomAndPanControl2.RotationAngle = zoomAndPanControl.RotationAngle;
5580
                        zoomAndPanControl2.ApplyTemplate();
5581
                        zoomAndPanControl2.UpdateLayout();
5582

    
5583
                        if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY))
5584
                        {
5585
                            zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X;
5586
                            zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y;
5587
                        }
5588

    
5589
                        ViewerDataModel.Instance.Sync_ContentOffsetX = Sync_Offset_Point.X;
5590
                        ViewerDataModel.Instance.Sync_ContentOffsetY = Sync_Offset_Point.Y;
5591
                        ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
5592

    
5593
                        tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo);
5594
                        tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber);
5595
                        gridViewHistory_Busy.IsBusy = false;
5596
                    }
5597

    
5598
                    Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1);
5599
                };
5600
                BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID);
5601
                Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1);
5602
            }
5603
        }
5604

    
5605
        public void Sync_Event(VPRevision Currnet_Rev)
5606
        {
5607
            CurrentRev = Currnet_Rev;
5608

    
5609
            BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) =>
5610
            {
5611
                if (ea.Error == null && ea.Result != null)
5612
                {
5613
                    testPanel2.IsHidden = false;
5614

    
5615
                    ViewerDataModel.Instance._markupInfoRevList.Clear();
5616
                    foreach(var info in ea.Result)
5617
                    {
5618
                        if(info.UserID == App.ViewInfo.UserID)
5619
                        {
5620
                            info.userDelete = true;
5621
                            info.DisplayColor = "FFFF0000";
5622
                        }
5623
                        else
5624
                        {
5625
                            info.userDelete = false;
5626
                        }
5627
                        ViewerDataModel.Instance._markupInfoRevList.Add(info);
5628
                    }
5629
                    gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList;
5630

    
5631
                    string uri = "";
5632
                    if (userData.COMPANY != "EXT")
5633
                    {
5634
                        uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5635
                    }
5636
                    else
5637
                    {
5638
                        uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5639
                    }
5640

    
5641
                    Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY);
5642

    
5643
                    var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
5644

    
5645
                    ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5646
                    ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5647
                    ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5648

    
5649
                    if (defaultBitmapImage_Compare.IsDownloading)
5650
                    {
5651
                        defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
5652
                        {
5653
                            ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5654
                            ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5655
                            ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5656
                        };
5657
                    }
5658

    
5659

    
5660
                    zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
5661
                    zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
5662
                    zoomAndPanControl2.ApplyTemplate();
5663
                    zoomAndPanControl2.UpdateLayout();
5664

    
5665
                    if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY))
5666
                    {
5667
                        zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X;
5668
                        zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y;
5669
                    }
5670
                    //}
5671

    
5672
                    tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo);
5673
                    tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber);
5674
                    gridViewHistory_Busy.IsBusy = false;
5675
                }
5676
                Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1);
5677

    
5678
            };
5679
            Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1);
5680
            BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID);
5681
        }
5682

    
5683
        private void PdfLink_ButtonDown(object sender, MouseButtonEventArgs e)
5684
        {
5685
            if (sender is Image)
5686
            {
5687
                if ((sender as Image).Tag != null)
5688
                {
5689
                    var pdfUrl = (sender as Image).Tag.ToString();
5690
                    System.Diagnostics.Process.Start(pdfUrl);
5691
                }
5692
                else
5693
                {
5694
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("문서 정보가 잘못 되었습니다", "안내");
5695
                }
5696
            }
5697
        }
5698

    
5699
        private void Create_Symbol(object sender, RoutedEventArgs e)
5700
        {
5701
            MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn();
5702

    
5703
            if (SelectLayer.Children.Count < 1) //선택된 것이 없으면
5704
            {
5705
                DialogMessage_Alert("Please Select Controls", "Alert");
5706
            }
5707
            else //선택된 것이 있으면
5708
            {
5709
                string MarkupData = "";
5710
                adorner_ = new AdornerFinal();
5711

    
5712
                foreach (var item in SelectLayer.Children)
5713
                {
5714
                    if (item.GetType().Name == "AdornerFinal")
5715
                    {
5716
                        adorner_ = (item as Controls.AdornerFinal);
5717
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
5718
                        {
5719
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
5720
                            {
5721
                                markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
5722
                                MarkupData += markupReturn.ConvertData;
5723
                            }
5724
                        }
5725
                    }
5726
                }
5727
                DialogParameters parameters = new DialogParameters()
5728
                {
5729
                    Owner = Application.Current.MainWindow,
5730
                    Closed = (obj, args) => this.MarkupNamePromptClose(MarkupData, args),
5731
                    DefaultPromptResultValue = "Custom State",
5732
                    Content = "Name :",
5733
                    Header = "Insert Custom Symbol Name",
5734
                    Theme = new VisualStudio2013Theme(),
5735
                    ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
5736
                };
5737
                RadWindow.Prompt(parameters);
5738
            }
5739

    
5740
        }
5741
        public int symbolselectindex = 0;
5742
        private void SymbolMarkupNamePromptClose(byte[] Img_byte, string data, WindowClosedEventArgs args)
5743
        {
5744
            //Save save = new Save();
5745
            try
5746
            {
5747
                string svgfilename = null;
5748
                if (symbolname != null)
5749
                {
5750
                    if (symbolpng == true || symbolsvg == true)
5751
                    {
5752
                        kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
5753
                        string guid = Commons.shortGuid();
5754

    
5755
                        fileUploader.RunAsync(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".png", Img_byte);
5756
                        //Check_Uri.UriCheck();
5757
                        fileUploader.RunCompleted += (ex, arg) =>
5758
                        {
5759
                            filename = arg.Result;
5760
                            if (symbolpng == true)
5761
                            {
5762
                                if (filename != null)
5763
                                { 
5764
                                    if (symbolselectindex == 0)
5765
                                    {
5766
                                        SymbolSave(symbolname, filename, data);
5767
                                    }
5768
                                    else
5769
                                    {
5770
                                        SymbolSave_Public(symbolname, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
5771
                                    }
5772
                                    DataBind();
5773
                                }                                
5774
                            }
5775

    
5776
                            if (symbolsvg == true)
5777
                            {
5778
                                try
5779
                                {
5780
                                    var defaultBitmapImage = new BitmapImage();
5781
                                    defaultBitmapImage.BeginInit();
5782
                                    defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
5783
                                    defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
5784
                                    Check_Uri.UriCheck(filename);
5785
                                    defaultBitmapImage.UriSource = new Uri(filename);
5786
                                    defaultBitmapImage.EndInit();
5787

    
5788
                                    System.Drawing.Bitmap image;
5789

    
5790
                                    if (defaultBitmapImage.IsDownloading)
5791
                                    {
5792
                                        defaultBitmapImage.DownloadCompleted += (ex2, arg2) =>
5793
                                        {
5794
                                            defaultBitmapImage.Freeze();
5795
                                            image = GetBitmap(defaultBitmapImage);
5796
                                            image.Save(@AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
5797
                                            Process potrace = new Process
5798
                                            {
5799
                                                StartInfo = new ProcessStartInfo
5800
                                                {
5801
                                                    FileName = @AppDomain.CurrentDomain.BaseDirectory + "potrace.exe",
5802
                                                    Arguments = "-b svg " + @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp",
5803
                                                    RedirectStandardInput = true,
5804
                                                    RedirectStandardOutput = true,
5805
                                                    RedirectStandardError = true,
5806
                                                    UseShellExecute = false,
5807
                                                    CreateNoWindow = true,
5808
                                                    WindowStyle = ProcessWindowStyle.Hidden
5809
                                                },
5810
                                            };
5811

    
5812
                                            StringBuilder svgBuilder = new StringBuilder();
5813
                                            potrace.OutputDataReceived += (object sender2, DataReceivedEventArgs e2) =>
5814
                                            {
5815
                                                svgBuilder.AppendLine(e2.Data);
5816
                                            };
5817

    
5818
                                            potrace.EnableRaisingEvents = true;
5819
                                            potrace.Start();
5820
                                            potrace.Exited += (sender, e) =>
5821
                                            {
5822
                                                byte[] bytes = System.IO.File.ReadAllBytes(@AppDomain.CurrentDomain.BaseDirectory + "potrace.svg");
5823
                                                svgfilename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".svg", bytes);
5824
                                                Check_Uri.UriCheck(svgfilename);
5825
                                                if (symbolselectindex == 0)
5826
                                                {
5827
                                                    SymbolSave(symbolname, svgfilename, data);
5828
                                                }
5829
                                                else
5830
                                                {
5831
                                                    SymbolSave_Public(symbolname, svgfilename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
5832
                                                }
5833

    
5834
                                                DataBind();
5835
                                            };
5836
                                            potrace.WaitForExit();
5837
                                        };
5838
                                    }
5839
                                    else
5840
                                    {
5841
                                        //GC.Collect();
5842
                                    }
5843
                                }
5844
                                catch(Exception ee)
5845
                                {
5846
                                    DialogMessage_Alert("" + ee, "Alert");
5847
                                }
5848
                            }
5849
                        };                                             
5850
                    }
5851
                }
5852
            }
5853
            catch (Exception e)
5854
            {
5855
                //DialogMessage_Alert(e + "", "Alert");
5856
            }            
5857
        }
5858

    
5859
        public void SymbolSave(string Name, string Url, string Data)
5860
        {
5861
            try
5862
            {
5863
                SYMBOL_PRIVATE symbol_private = new SYMBOL_PRIVATE
5864
                {
5865
                    ID = Commons.shortGuid(),
5866
                    MEMBER_USER_ID = App.ViewInfo.UserID,
5867
                    NAME = Name,
5868
                    IMAGE_URL = Url,
5869
                    DATA = Data
5870
                };
5871

    
5872
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolCompleted += BaseClient_SaveSymbolCompleted;
5873
                Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1);
5874
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private);
5875
            }
5876
            catch (Exception)
5877
            {
5878
                throw;
5879
            }
5880
        }
5881

    
5882
        public void SymbolSave_Public(string Name, string Url, string Data, string Department)
5883
        {
5884
            try
5885
            {
5886
                SYMBOL_PUBLIC symbol_public = new SYMBOL_PUBLIC
5887
                {
5888
                    ID = Commons.shortGuid(),
5889
                    DEPARTMENT = Department,
5890
                    NAME = Name,
5891
                    IMAGE_URL = Url,
5892
                    DATA = Data
5893
                };
5894
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbolCompleted += BaseClient_AddPublicSymbolCompleted;
5895
                Logger.sendReqLog("AddPublicSymbol: ", symbol_public.ID + "," + symbol_public.DEPARTMENT + "," + symbol_public.NAME + "," + symbol_public.IMAGE_URL + "," + symbol_public.DATA, 1);
5896
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbol(symbol_public);
5897
            }
5898
            catch (Exception)
5899
            {
5900
                throw;
5901
            }
5902
        }
5903

    
5904
        private void BaseClient_AddPublicSymbolCompleted(object sender, ServiceDeepView.AddPublicSymbolCompletedEventArgs e)
5905
        {           
5906
            Logger.sendResLog("AddPublicSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
5907
            DataBind();
5908
        }
5909

    
5910
        private void BaseClient_SaveSymbolCompleted(object sender, ServiceDeepView.SaveSymbolCompletedEventArgs e)
5911
        {
5912
            Logger.sendResLog("RenameSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
5913
            DataBind();
5914
        }
5915
        private void DataBind()
5916
        {
5917
            try
5918
            {
5919
                Symbol_Custom Custom = new Symbol_Custom();
5920
                List<Symbol_Custom> Custom_List = new List<Symbol_Custom>();
5921
                //ServiceDeepView.ServiceDeepViewClient client = new ServiceDeepView.ServiceDeepViewClient(App._binding, App._EndPoint);
5922
                var symbol_Private = BaseClient.GetSymbolList(App.ViewInfo.UserID);
5923
                foreach (var item in symbol_Private)
5924
                {
5925
                    Custom.Name = item.NAME;
5926
                    Custom.ImageUri = item.IMAGE_URL;
5927
                    Custom.ID = item.ID;
5928
                    Custom_List.Add(Custom);
5929
                    Custom = new Symbol_Custom();
5930
                }
5931
                symbolPanel_Instance.lstSymbolPrivate.ItemsSource = Custom_List;
5932
                
5933
                Custom = new Symbol_Custom();
5934
                Custom_List = new List<Symbol_Custom>();
5935

    
5936
                symbolPanel_Instance.deptlist.ItemsSource = BaseClient.GetPublicSymbolDeptList();
5937

    
5938
                List<SYMBOL_PUBLIC> symbol_Public;
5939

    
5940
                if (symbolPanel_Instance.deptlist.SelectedValue != null)
5941
                {
5942
                    symbol_Public = BaseClient.GetPublicSymbolList(symbolPanel_Instance.deptlist.SelectedValue.ToString());
5943
                }
5944
                else
5945
                {
5946
                    symbol_Public = BaseClient.GetPublicSymbolList(null);
5947
                }
5948
                foreach (var item in symbol_Public)
5949
                {
5950
                    Custom.Name = item.NAME;
5951
                    Custom.ImageUri = item.IMAGE_URL;
5952
                    Custom.ID = item.ID;
5953
                    Custom_List.Add(Custom);
5954
                    Custom = new Symbol_Custom();
5955
                }
5956
                symbolPanel_Instance.lstSymbolPublic.ItemsSource = Custom_List;
5957
                BaseClient.Close();                
5958
            }
5959
            catch(Exception e)
5960
            {
5961
                //DialogMessage_Alert("DataBind", "Alert");
5962
            }
5963
            
5964
        }
5965
        private void MarkupNamePromptClose(string data, WindowClosedEventArgs args)
5966
        {
5967
            try
5968
            {
5969
                if (args.PromptResult != null)
5970
                {
5971
                    if (args.DialogResult.Value)
5972
                    {
5973
                        PngBitmapEncoder _Encoder = symImage(data);
5974

    
5975
                        System.IO.MemoryStream fs = new System.IO.MemoryStream();
5976
                        _Encoder.Save(fs);
5977
                        System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs);
5978

    
5979
                        byte[] Img_byte = fs.ToArray();
5980

    
5981
                        kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
5982
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Commons.shortGuid() + ".png", Img_byte);
5983
                        Check_Uri.UriCheck(filename);
5984
                        if (symbolPanel_Instance.RadTab.SelectedIndex == 0)
5985
                        {
5986
                            SaveCommand.Instance.SymbolSave(args.PromptResult, filename, data);
5987
                        }
5988
                        else
5989
                        {
5990
                            SaveCommand.Instance.SymbolSave_Public(args.PromptResult, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
5991
                        }
5992
                        DataBind();
5993
                    }
5994
                }
5995
            }
5996
            catch(Exception ex)
5997
            {
5998
                DialogMessage_Alert("" + ex, "Alert");
5999
            }
6000
        }
6001

    
6002
        public PngBitmapEncoder symImage(string data)
6003
        {
6004

    
6005
            Canvas _canvas = new Canvas();
6006
            _canvas.Background = Brushes.White;
6007
            _canvas.Width = adorner_.BorderSize.Width;
6008
            _canvas.Height = adorner_.BorderSize.Height;
6009
            MarkupParser.Parse(App.ViewInfo.ProjectNO, data, _canvas, "#FFFF0000", "");
6010

    
6011
            BitmapEncoder encoder = new PngBitmapEncoder();
6012

    
6013

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

    
6016
            DrawingVisual dv = new DrawingVisual();
6017

    
6018
            _canvas.Measure(new System.Windows.Size(adorner_.BorderSize.Width + 50, adorner_.BorderSize.Height + 50));
6019
            _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)));
6020

    
6021
            using (DrawingContext ctx = dv.RenderOpen())
6022
            {
6023
                VisualBrush vb = new VisualBrush(_canvas);
6024
                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)));
6025
            }
6026

    
6027
            try
6028
            {
6029
                renderBitmap.Render(dv);
6030

    
6031
                //GC.Collect();
6032
                GC.WaitForPendingFinalizers();
6033
                //GC.Collect();
6034
                // encode png data
6035
                PngBitmapEncoder pngEncoder = new PngBitmapEncoder();
6036
                // puch rendered bitmap into it
6037
                pngEncoder.Interlace = PngInterlaceOption.Off;
6038
                pngEncoder.Frames.Add(BitmapFrame.Create(renderBitmap));
6039
                return pngEncoder;
6040

    
6041
            }
6042
            catch //(Exception ex)
6043
            {
6044
                return null;
6045
            }
6046

    
6047
        }
6048

    
6049
        public void DialogMessage_Alert(string content, string header)
6050
        {
6051
            var box = new TextBlock();
6052
            box.MinWidth = 400;
6053
            box.FontSize = 11;
6054
            //box.FontSize = 12;
6055
            box.Text = content;
6056
            box.TextWrapping = System.Windows.TextWrapping.Wrap;
6057

    
6058
            DialogParameters parameters = new DialogParameters()
6059
            {
6060
                Owner = Application.Current.MainWindow,
6061
                Content = box,
6062
                Header = header,
6063
                Theme = new VisualStudio2013Theme(),
6064
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
6065
            };            
6066
            RadWindow.Alert(parameters);
6067
        }
6068

    
6069
        #region 캡쳐 기능
6070

    
6071
        public BitmapSource CutAreaToImage(int x, int y, int width, int height)
6072
        {
6073
            if (x < 0)
6074
            {
6075
                width += x;
6076
                x = 0;
6077
            }
6078
            if (y < 0)
6079
            {
6080
                height += y;
6081
                y = 0;
6082

    
6083
                width = (int)zoomAndPanCanvas.ActualWidth - x;
6084
            }
6085
            if (x + width > zoomAndPanCanvas.ActualWidth)
6086
            {
6087
                width = (int)zoomAndPanCanvas.ActualWidth - x;
6088
            }
6089
            if (y + height > zoomAndPanCanvas.ActualHeight)
6090
            {
6091
                height = (int)zoomAndPanCanvas.ActualHeight - y;
6092
            }
6093

    
6094
            byte[] pixels = CopyPixels(x, y, width, height);
6095

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

    
6098
            return BitmapSource.Create(width, height, 96, 96, PixelFormats.Pbgra32, null, pixels, stride);
6099
        }
6100

    
6101
        public byte[] CopyPixels(int x, int y, int width, int height)
6102
        {
6103
            byte[] pixels = new byte[width * height * 4];
6104
            int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8;
6105

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

    
6109
            return pixels;
6110
        }
6111

    
6112
        public RenderTargetBitmap ConverterBitmapImage(FrameworkElement element)
6113
        {
6114
            DrawingVisual drawingVisual = new DrawingVisual();
6115
            DrawingContext drawingContext = drawingVisual.RenderOpen();
6116

    
6117
            // 해당 객체의 그래픽요소로 사각형의 그림을 그립니다.
6118
            drawingContext.DrawRectangle(new VisualBrush(element), null,
6119
                new Rect(new Point(0, 0), new Point(element.ActualWidth, element.ActualHeight)));
6120
            drawingContext.Close();
6121

    
6122
            // 비트맵으로 변환합니다.
6123
            RenderTargetBitmap target =
6124
                new RenderTargetBitmap((int)element.ActualWidth, (int)element.ActualHeight,
6125
                96, 96, System.Windows.Media.PixelFormats.Pbgra32);
6126

    
6127
            target.Render(drawingVisual);
6128
            return target;
6129
        }
6130

    
6131
        System.Drawing.Bitmap GetBitmap(BitmapSource source)
6132
        {
6133
            System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(source.PixelWidth, source.PixelHeight, System.Drawing.Imaging.PixelFormat.Format32bppPArgb);
6134
            System.Drawing.Imaging.BitmapData data = bmp.LockBits(new System.Drawing.Rectangle(System.Drawing.Point.Empty, bmp.Size), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppPArgb);
6135
            source.CopyPixels(Int32Rect.Empty, data.Scan0, data.Height * data.Stride, data.Stride);
6136
            bmp.UnlockBits(data);
6137
            return bmp;
6138
        }
6139
        public string symbolname = null;
6140
        public bool symbolsvg = true;
6141
        public bool symbolpng = true;
6142

    
6143
        public void Save_Symbol_Capture(BitmapSource source, int x, int y, int width, int height)
6144
        {
6145
            System.Drawing.Bitmap image = GetBitmap(source);
6146
            //흰색 제거
6147
            //image.MakeTransparent(System.Drawing.Color.White);
6148

    
6149
            var imageStream = new System.IO.MemoryStream();
6150
            byte[] imageBytes = null;
6151
            using (imageStream)
6152
            {
6153
                image.Save(imageStream, System.Drawing.Imaging.ImageFormat.Png);
6154
                // test.Save(@"E:\test.png", System.Drawing.Imaging.ImageFormat.Png);
6155
                imageStream.Position = 0;
6156
                imageBytes = imageStream.ToArray();
6157
            }
6158

    
6159
            SymbolPrompt symbolPrompt = new SymbolPrompt();
6160

    
6161
            RadWindow CheckPop = new RadWindow();
6162
            //Alert check = new Alert(Msg);
6163

    
6164
            CheckPop = new RadWindow
6165
            {
6166
                MinWidth = 400,
6167
                MinHeight = 100,
6168
               // Closed = (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args),
6169
                Header = "Alert",
6170
                Content = symbolPrompt,
6171
                //DialogResult = 
6172
                ResizeMode = System.Windows.ResizeMode.NoResize,
6173
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
6174
                IsTopmost = true,
6175
            };
6176
            CheckPop.Closed += (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args);
6177
            StyleManager.SetTheme(CheckPop, new Office2013Theme());
6178
            CheckPop.ShowDialog();
6179

    
6180
            /*
6181
            DialogParameters parameters = new DialogParameters()
6182
            {
6183
                Owner = Application.Current.MainWindow,
6184
                Closed = (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args),
6185
                DefaultPromptResultValue = "Custom State",
6186
                Content = "Name :",
6187
                Header = "Insert Custom Symbol Name",
6188
                Theme = new VisualStudio2013Theme(),
6189
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
6190
            };            
6191
            RadWindow.Prompt(parameters);
6192
            */
6193
        }
6194

    
6195
        public void Save_Capture(BitmapSource source, int x, int y, int width, int height)
6196
        {
6197
            KCOM.Common.Converter.FileStreamToBase64 streamToBase64 = new Common.Converter.FileStreamToBase64();
6198
            KCOMDataModel.DataModel.CHECK_LIST check_;
6199
            string Result = streamToBase64.ImageToBase64(source);
6200
            KCOMDataModel.DataModel.CHECK_LIST Item = new KCOMDataModel.DataModel.CHECK_LIST();
6201
            string projectno = App.ViewInfo.ProjectNO;
6202
            string checklist_id = ViewerDataModel.Instance.CheckList_ID;
6203

    
6204
            Logger.sendReqLog("GetCheckList", projectno + "," + checklist_id, 1);
6205
            Item = this.BaseClient.GetCheckList(projectno, checklist_id);
6206
            if (Item != null)
6207
            {
6208
                Logger.sendResLog("GetCheckList", "TRUE", 1);
6209
            }
6210
            else
6211
            {
6212
                Logger.sendResLog("GetCheckList", "FALSE", 1);
6213
            }
6214

    
6215
            if (Item == null)
6216
            {
6217
                check_ = new KCOMDataModel.DataModel.CHECK_LIST
6218
                {
6219
                    ID = Commons.shortGuid(),
6220
                    USER_ID = App.ViewInfo.UserID,
6221
                    IMAGE_URL = Result,
6222
                    IMAGE_ANCHOR = x + "," + y + "," + width + "," + height,
6223
                    PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber,
6224
                    REVISION = ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision,
6225
                    DOCUMENT_ID = App.ViewInfo.DocumentItemID,
6226
                    PROJECT_NO = App.ViewInfo.ProjectNO,
6227
                    STATUS = "False",
6228
                    CREATE_TIME = DateTime.Now,
6229
                    UPDATE_TIME = DateTime.Now,
6230
                    DOCUMENT_NO = _DocItem.DOCUMENT_NO,
6231
                    STATUS_DESC_OPEN = "Vendor 반영 필요",
6232
                };
6233
                Logger.sendReqLog("AddCheckList", projectno + "," + check_, 1);
6234
                Logger.sendResLog("AddCheckList", this.BaseClient.AddCheckList(projectno, check_).ToString(), 1);
6235
                //this.BaseClient.AddCheckList(projectno, check_);
6236
            }
6237
            else
6238
            {
6239
                Item.IMAGE_URL = Result;
6240
                Item.IMAGE_ANCHOR = x + "," + y + "," + width + "," + height;
6241
                Item.PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber;
6242
                Logger.sendReqLog("SaveCheckList", projectno + "," + checklist_id + "," + Item, 1);
6243
                Logger.sendResLog("SaveCheckList", this.BaseClient.SaveCheckList(projectno, checklist_id, Item).ToString(), 1);
6244
                //this.BaseClient.SaveCheckList(projectno, checklist_id, Item);
6245
            }
6246

    
6247
        }
6248

    
6249
        public void Set_Capture()
6250
        {
6251
            double x = canvasDrawingMouseDownPoint.X;
6252
            double y = canvasDrawingMouseDownPoint.Y;
6253
            double width = dragCaptureBorder.Width;
6254
            double height = dragCaptureBorder.Height;
6255

    
6256
            if (width > 5 || height > 5)
6257
            {
6258
                canvasImage = ConverterBitmapImage(zoomAndPanCanvas);
6259
                BitmapSource source = CutAreaToImage((int)x, (int)y, (int)width, (int)height);
6260
                Save_Capture(source, (int)x, (int)y, (int)width, (int)height);
6261
            }
6262
        }
6263
        #endregion
6264

    
6265
        //MarkupInfoItem
6266
        public void CreateControl()
6267
        {
6268

    
6269
            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
6270
            {
6271
                ViewerDataModel.Instance.UndoDataList.Remove(i);
6272
            });
6273
            multi_Undo_Data.Markup = currentControl;
6274
            UndoData.Markup_List.Add(multi_Undo_Data);
6275

    
6276
            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
6277

    
6278
            //List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList();
6279
        }
6280

    
6281
        public Multi_Undo_data Control_Style(CommentUserInfo control)
6282
        {
6283
            multi_Undo_Data = new Multi_Undo_data();
6284

    
6285
            multi_Undo_Data.Markup = control;
6286

    
6287
            if ((control as IShapeControl) != null)
6288
            {
6289
                multi_Undo_Data.paint = (control as IShapeControl).Paint;
6290
            }
6291
            if ((control as IDashControl) != null)
6292
            {
6293
                multi_Undo_Data.DashSize = (control as IDashControl).DashSize;
6294
            }
6295
            if ((control as IPath) != null)
6296
            {
6297
                multi_Undo_Data.LineSize = (control as IPath).LineSize;
6298
            }
6299
            if ((control as UIElement) != null)
6300
            {
6301
                multi_Undo_Data.Opacity = (control as UIElement).Opacity;
6302
            }
6303

    
6304
            return multi_Undo_Data;
6305
        }
6306

    
6307
        private void Comment_Move(object sender, MouseButtonEventArgs e)
6308
        {
6309
            string Select_ID = (((e.Source as Telerik.Windows.Controls.RadButton).DataContext) as IKCOM.MarkupInfoItem).UserID;
6310
            foreach (var items in ViewerDataModel.Instance._markupInfoRevList)
6311
            {
6312
                if (items.UserID == Select_ID)
6313
                {
6314
                    foreach (var item in items.MarkupList)
6315
                    {
6316
                        if (item.PageNumber == pageNavigator.CurrentPage.PageNumber)
6317
                        {
6318
                            MarkupParser.ParseEx(App.ViewInfo.ProjectNO, item.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, "#FFFF0000", "", 
6319
                                items.MarkupInfoID, Commons.shortGuid());
6320
                        }
6321
                    }
6322
                }
6323
            }
6324
        }
6325

    
6326
        public void InkControl_Convert()
6327
        {
6328
            Logger.sendCheckLog("pageNavigator_PageChanging_InkControl_Convert", 1);
6329
            if (inkBoard.Strokes.Count > 0)
6330
            {
6331
                inkBoard.Strokes.ToList().ForEach(stroke =>
6332
                {
6333
                    List<Stroke> removingStroke = new List<Stroke>();
6334
                    StrokeCollection stC = new StrokeCollection();
6335

    
6336
                    removingStroke.Add(stroke);
6337

    
6338
                    InkToPath ip = new InkToPath();
6339
                    List<Point> inkPointSet = new List<Point>();
6340
                    PolygonControl pc = null;
6341
                    pc = new PolygonControl()
6342
                    {
6343
                        Angle = 0,
6344
                        PointSet = new List<Point>(),
6345
                        ControlType = ControlType.Ink
6346
                    };
6347
                    foreach (var item in removingStroke)
6348
                    {
6349
                        inkPointSet.AddRange(ip.StrokeGetPointsPlus(item));
6350
                        inkBoard.Strokes.Remove(item);
6351
                    }
6352
                    if (inkPointSet.Count != 0)
6353
                    {
6354
                        //강인구 추가(PenControl Undo Redo 추가)
6355
                        UndoData = new Undo_data()
6356
                        {
6357
                            IsUndo = false,
6358
                            Event = Event_Type.Create,
6359
                            EventTime = DateTime.Now,
6360
                            Markup_List = new List<Multi_Undo_data>()
6361
                        };
6362

    
6363
                        pc.StartPoint = inkPointSet[0];
6364
                        pc.EndPoint = inkPointSet[inkPointSet.Count - 1];
6365
                        pc.PointSet = inkPointSet;
6366
                        pc.LineSize = 3;
6367
                        pc.CommentID = Commons.shortGuid();
6368
                        pc.StrokeColor = new SolidColorBrush(Colors.Red);
6369
                        ViewerDataModel.Instance.MarkupControls_USER.Add(pc);
6370
                        ///pc.SetPolyPath();
6371

    
6372
                        ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
6373
                        {
6374
                            ViewerDataModel.Instance.UndoDataList.Remove(i);
6375
                        });
6376
                        multi_Undo_Data.Markup = pc as CommentUserInfo;
6377
                        UndoData.Markup_List.Add(multi_Undo_Data);
6378
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);
6379
                    }
6380
                });
6381
            }
6382
        }
6383

    
6384
        /// <summary>
6385
        /// 정원, 정사각형, 정삼각형을 그리기 위한 EndPoint계산
6386
        /// </summary>
6387
        /// <param name="StartP">StartPoint</param>
6388
        /// <param name="EndP">EndPoint</param>
6389
        /// <returns>Return_EndPoint</returns>
6390
        private Point GetSquareEndPoint(Point StartP, Point EndP)
6391
        {
6392
            Point Return_Point = new Point();
6393

    
6394
            double dx = EndP.X - StartP.X;
6395
            double dy = EndP.Y - StartP.Y;
6396
            double length;
6397

    
6398
            switch (controlType)
6399
            {
6400
                case ControlType.Triangle:
6401
                    {
6402
                        //삼각형의 StartPoint기준으로 반지름 만큼 증가하기 때문에 곱하기2 필요
6403
                        length = Math.Max(Math.Abs(dx) * 2, Math.Abs(dy));
6404
                        Return_Point = (dy < 0) ? new Point(StartP.X + length / 2, StartP.Y - length) : new Point(StartP.X + length / 2, StartP.Y + length);
6405
                    }
6406
                    break;
6407
                default:
6408
                    {
6409
                        length = Math.Max(Math.Abs(dx), Math.Abs(dy));
6410
                        Return_Point.X = (dx > 0) ? StartP.X + length : StartP.X - length;
6411
                        Return_Point.Y = (dy > 0) ? StartP.Y + length : StartP.Y - length;
6412
                    }
6413
                    break;
6414
            }
6415

    
6416
            return Return_Point;
6417
        }
6418

    
6419
        /// <summary>
6420
        /// 정삼각형을 그리기위한 두 포인트를 계산하여 넘겨줌
6421
        /// </summary>
6422
        /// <author>humkyung</author>
6423
        /// <date>2018.04.26</date>
6424
        /// <param name="StartP"></param>
6425
        /// <param name="EndP"></param>
6426
        /// <returns></returns>
6427
        /// <history>humkyung 2018.05.11 apply axis lock</history>
6428
        private List<Point> GetRegularTrianglePoints(Point StartP, Point EndP, bool bCheckAxis = false)
6429
        {
6430
            List<Point> res = new List<Point>();
6431

    
6432
            double dx = EndP.X - StartP.X;
6433
            double dy = EndP.Y - StartP.Y;
6434
            double length = Math.Sqrt(dx * dx + dy * dy);
6435
            double baseLength = length * Math.Tan(30.0 * Math.PI / 180.0);
6436
            dx /= length;
6437
            dy /= length;
6438
            double tmp = dx;
6439
            dx = -dy; dy = tmp; /// rotate by 90 degree
6440

    
6441
            res.Add(new Point(EndP.X + dx * baseLength, EndP.Y + dy * baseLength));
6442
            res.Add(new Point(EndP.X - dx * baseLength, EndP.Y - dy * baseLength));
6443

    
6444
            return res;
6445
        }
6446

    
6447
        /// <summary>
6448
        /// 캔버스에 그릴때 모든 포인트가 캔버스를 벗어 났는지 체크하여 넘겨줌
6449
        /// </summary>
6450
        /// <author>ingu</author>
6451
        /// <date>2018.06.05</date>
6452
        /// <param name="getPoint"></param>
6453
        /// <returns></returns>
6454
        private bool IsGetoutpoint(Point getPoint)
6455
        {
6456
            if (getPoint == new Point())
6457
            {
6458
                ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl);
6459
                currentControl = null;
6460
                return true;
6461
            }
6462

    
6463
            return false;
6464
        }
6465

    
6466
        private void zoomAndPanControl_DragOver(object sender, DragEventArgs e)
6467
        {
6468
            e.Effects = DragDropEffects.Copy;
6469
        }
6470

    
6471
        private void zoomAndPanControl_DragEnter(object sender, DragEventArgs e)
6472
        {
6473
            e.Effects = DragDropEffects.Copy;
6474
        }
6475

    
6476
        private void zoomAndPanControl_DragLeave(object sender, DragEventArgs e)
6477
        {
6478
            e.Effects = DragDropEffects.None;
6479
        }
6480

    
6481
        /*
6482
        private void zoomAndPanControl_Drop(object sender, DragEventArgs e)
6483
        {
6484
            try
6485
            {
6486
                if (e.Data.GetDataPresent(typeof(string)))
6487
                {
6488
                    this.getCurrentPoint = e.GetPosition(drawingRotateCanvas);
6489
                    string dragData = e.Data.GetData(typeof(string)) as string;
6490
                    Move_Symbol(sender, dragData);
6491
                }
6492
            }
6493
            catch (Exception ex)
6494
            {
6495
                Logger.sendResLog("zoomAndPanControl_Drop", ex.ToString(), 0);
6496
            }            
6497
        }
6498
        */
6499
    }
6500
}
클립보드 이미지 추가 (최대 크기: 500 MB)