프로젝트

일반

사용자정보

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

markus / KCOM / Views / MainMenu.xaml.cs @ 5928384e

이력 | 보기 | 이력해설 | 다운로드 (318 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 (currentControl != null)
1284
                {
1285
                    double moveX = currentCanvasDrawingMouseMovePoint.X - canvasDrawingMouseDownPoint.X;
1286
                    double moveY = currentCanvasDrawingMouseMovePoint.Y - canvasDrawingMouseDownPoint.Y;
1287
                    //강인구 추가
1288
                    currentControl.Opacity = ViewerDataModel.Instance.ControlOpacity;
1289

    
1290
                    if ((currentControl as IPath) != null)
1291
                    {
1292
                        (currentControl as IPath).LineSize = ViewerDataModel.Instance.LineSize;
1293
                    }
1294
                    if ((currentControl as LineControl) != null)
1295
                    {
1296
                        (currentControl as LineControl).Interval = ViewerDataModel.Instance.Interval;
1297
                    }
1298

    
1299
                    if ((currentControl as IShapeControl) != null)
1300
                    {
1301
                        (currentControl as IShapeControl).Paint = ViewerDataModel.Instance.paintSet;
1302
                    }
1303
                    if ((currentControl as TextControl) != null)
1304
                    {
1305
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true)
1306
                        {
1307
                            (currentControl as TextControl).TextStyle = FontStyles.Italic;
1308
                        }
1309
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true)
1310
                        {
1311
                            (currentControl as TextControl).TextWeight = FontWeights.Bold;
1312
                        }
1313
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true)
1314
                        {
1315
                            (currentControl as TextControl).UnderLine = TextDecorations.Underline;
1316
                        }
1317
                    }
1318
                    else if ((currentControl as ArrowTextControl) != null)
1319
                    {
1320
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true)
1321
                        {
1322
                            (currentControl as ArrowTextControl).TextStyle = FontStyles.Italic;
1323
                        }
1324
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true)
1325
                        {
1326
                            (currentControl as ArrowTextControl).TextWeight = FontWeights.Bold;
1327
                        }
1328
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true)
1329
                        {
1330
                            (currentControl as ArrowTextControl).UnderLine = TextDecorations.Underline;
1331
                        }
1332
                    }
1333
                    else if ((currentControl as RectCloudControl) != null)
1334
                    {
1335
                        (currentControl as RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
1336
                    }
1337
                    else if ((currentControl as CloudControl) != null)
1338
                    {
1339
                        (currentControl as CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
1340
                    }
1341

    
1342
                    switch (controlType)
1343
                    {
1344
                        case (ControlType.Coordinate):
1345
                            {
1346
                                var control = currentControl as CoordinateControl;
1347

    
1348
                                if (control != null)
1349
                                {
1350
                                    if (move.mousemode == MouseMode.Drawing)
1351
                                    {
1352
                                        //move.control_Move(ControlList, true, moveX, moveY);
1353
                                    }
1354
                                    else
1355
                                    {
1356
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1357
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1358
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1359
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1360

    
1361

    
1362
                                        if (ViewerDataModel.Instance.IsPressShift)
1363
                                        {
1364
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1365
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1366
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1367
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1368
                                        }
1369

    
1370
                                        control.PointSet = new List<Point>
1371
                                        {
1372
                                            control.StartPoint,
1373
                                            control.LeftBottomPoint,
1374
                                            control.EndPoint,
1375
                                            control.TopRightPoint,
1376
                                        };
1377
                                        control.updateControl();
1378
                                    }
1379

    
1380
                                    //강인구 추가
1381
                                    control.ControlType = controlType;
1382
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1383
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1384
                                    //  control.Paint = PaintSet.Fill;
1385
                                }
1386
                            }
1387
                            break;
1388
                        case (ControlType.InsideWhite):
1389
                            {
1390
                                var control = currentControl as InsideWhiteControl;
1391

    
1392
                                if (control != null)
1393
                                {
1394
                                    if (move.mousemode == MouseMode.Drawing)
1395
                                    {
1396
                                        //move.control_Move(ControlList, true, moveX, moveY);
1397
                                    }
1398
                                    else
1399
                                    {
1400
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1401
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1402
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1403
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1404

    
1405

    
1406
                                        if (ViewerDataModel.Instance.IsPressShift)
1407
                                        {
1408
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1409
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1410
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1411
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1412
                                        }
1413

    
1414
                                        control.PointSet = new List<Point>
1415
                                        {
1416
                                            control.StartPoint,
1417
                                            control.LeftBottomPoint,
1418
                                            control.EndPoint,
1419
                                            control.TopRightPoint,
1420
                                        };
1421
                                        control.updateControl();
1422
                                    }
1423

    
1424
                                    //강인구 추가
1425
                                    control.ControlType = controlType;
1426
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1427
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1428
                                    control.Paint = PaintSet.Fill;
1429
                                }
1430
                            }
1431
                            break;
1432
                        case (ControlType.OverlapWhite):
1433
                            {
1434
                                var control = currentControl as OverlapWhiteControl;
1435

    
1436
                                if (control != null)
1437
                                {
1438
                                    if (move.mousemode == MouseMode.Drawing)
1439
                                    {
1440
                                        //move.control_Move(ControlList, true, moveX, moveY);
1441
                                    }
1442
                                    else
1443
                                    {
1444
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1445
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1446
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1447
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1448

    
1449

    
1450
                                        if (ViewerDataModel.Instance.IsPressShift)
1451
                                        {
1452
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1453
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1454
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1455
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1456
                                        }
1457

    
1458
                                        control.PointSet = new List<Point>
1459
                                        {
1460
                                            control.StartPoint,
1461
                                            control.LeftBottomPoint,
1462
                                            control.EndPoint,
1463
                                            control.TopRightPoint,
1464
                                        };
1465
                                        control.updateControl();
1466
                                    }
1467

    
1468
                                    //강인구 추가
1469
                                    control.ControlType = controlType;
1470
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1471
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1472
                                    control.Paint = PaintSet.Fill;
1473
                                }
1474
                            }
1475
                            break;
1476
                        case (ControlType.ClipWhite):
1477
                            {
1478
                                var control = currentControl as ClipWhiteControl;
1479

    
1480
                                if (control != null)
1481
                                {
1482
                                    if (move.mousemode == MouseMode.Drawing)
1483
                                    {
1484
                                        //move.control_Move(ControlList, true, moveX, moveY);
1485
                                    }
1486
                                    else
1487
                                    {
1488
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1489
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1490
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1491
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1492

    
1493

    
1494
                                        if (ViewerDataModel.Instance.IsPressShift)
1495
                                        {
1496
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1497
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1498
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1499
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1500
                                        }
1501

    
1502
                                        control.PointSet = new List<Point>
1503
                                        {
1504
                                            control.StartPoint,
1505
                                            control.LeftBottomPoint,
1506
                                            control.EndPoint,
1507
                                            control.TopRightPoint,
1508
                                        };
1509
                                        control.updateControl();
1510
                                    }
1511

    
1512
                                    //강인구 추가
1513
                                    control.ControlType = controlType;
1514
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1515
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1516
                                    control.Paint = PaintSet.Fill;
1517
                                }
1518
                            }
1519
                            break;
1520
                        case ControlType.Rectangle:
1521
                            {
1522
                                var control = currentControl as RectangleControl;
1523

    
1524
                                if (control != null)
1525
                                {
1526
                                    if (move.mousemode == MouseMode.Drawing)
1527
                                    {
1528
                                        //move.control_Move(ControlList, true, moveX, moveY);
1529
                                    }
1530
                                    else
1531
                                    {
1532
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1533
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1534
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1535
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1536

    
1537

    
1538
                                        if (ViewerDataModel.Instance.IsPressShift)
1539
                                        {
1540
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1541
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1542
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1543
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1544
                                        }
1545

    
1546
                                        control.PointSet = new List<Point>
1547
                                        {
1548
                                            control.StartPoint,
1549
                                            control.LeftBottomPoint,
1550
                                            control.EndPoint,
1551
                                            control.TopRightPoint,
1552
                                        };
1553
                                        control.updateControl();
1554
                                    }
1555

    
1556
                                    //강인구 추가
1557
                                    control.ControlType = controlType;
1558
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1559
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1560
                                }
1561
                            }
1562
                            break;
1563

    
1564
                        case ControlType.RectCloud:
1565
                            {
1566
                                var control = currentControl as RectCloudControl;
1567

    
1568
                                if (control != null)
1569
                                {
1570
                                    if (move.mousemode == MouseMode.Drawing)
1571
                                    {
1572
                                        //move.control_Move(ControlList, true, moveX, moveY);
1573
                                    }
1574
                                    else
1575
                                    {
1576
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1577
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1578
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1579
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1580

    
1581
                                        if (ViewerDataModel.Instance.IsPressShift)
1582
                                        {
1583
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1584
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1585
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1586
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1587
                                        }
1588

    
1589
                                        control.PointSet = new List<Point>
1590
                                        {
1591
                                            control.StartPoint,
1592
                                            control.LeftBottomPoint,
1593
                                            control.EndPoint,
1594
                                            control.TopRightPoint,
1595
                                        };
1596
                                    }
1597

    
1598
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1599
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1600
                                }
1601
                            }
1602
                            break;
1603

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

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

    
1626
                                    control.PointSet = new List<Point>
1627
                                        {
1628
                                            control.StartPoint,
1629
                                            control.EndPoint,
1630
                                        };
1631

    
1632
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1633
                                }
1634

    
1635
                            }
1636
                            break;
1637

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

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

    
1661

    
1662
                                    control.PointSet = new List<Point>
1663
                                            {
1664
                                                control.StartPoint,
1665
                                                control.EndPoint,
1666
                                            };
1667
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1668
                                }
1669

    
1670

    
1671
                            }
1672
                            break;
1673

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

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

    
1696

    
1697
                                    control.PointSet = new List<Point>
1698
                                            {
1699
                                                control.StartPoint,
1700
                                                control.EndPoint,
1701
                                            };
1702
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1703
                                }
1704
                            }
1705
                            break;
1706

    
1707
                        case ControlType.TwinLine:
1708
                            {
1709
                                var control = currentControl as LineControl;
1710
                                if (control != null)
1711
                                {
1712
                                    control.LineStyleSet = LineStyleSet.TwinLine;
1713
                                    control.ControlType = controlType;
1714
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1715
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1716
                                    Point tempPoint = control.EndPoint;
1717

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

    
1729

    
1730
                                    control.PointSet = new List<Point>
1731
                                            {
1732
                                                control.StartPoint,
1733
                                                control.EndPoint,
1734
                                            };
1735
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1736
                                }
1737
                            }
1738
                            break;
1739

    
1740
                        case ControlType.DimLine:
1741
                            {
1742
                                var control = currentControl as LineControl;
1743
                                if (control != null)
1744
                                {
1745
                                    control.LineStyleSet = LineStyleSet.DimLine;
1746
                                    control.ControlType = controlType;
1747
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1748
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1749
                                    Point tempPoint = control.EndPoint;
1750

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

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

    
1772
                        case ControlType.ArcLine:
1773
                            {
1774
                                var control = currentControl as ArcControl;
1775
                                if (control != null)
1776
                                {
1777
                                    control.isTransOn = false;
1778
                                    control.ControlType = controlType;
1779
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1780
                                    control.MidPoint = new Point(0, 0);
1781
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1782
                                    Point tempPoint = control.EndPoint;
1783

    
1784
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1785
                                    {
1786
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1787
                                        control.EndPoint = tempPoint;
1788
                                    }
1789
                                    else
1790
                                    {
1791
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1792
                                    }
1793

    
1794

    
1795
                                    control.PointSet = new List<Point>
1796
                                            {
1797
                                                control.StartPoint,
1798
                                                control.MidPoint,
1799
                                                control.EndPoint,
1800
                                            };
1801
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1802
                                }
1803
                            }
1804
                            break;
1805

    
1806
                        case ControlType.ArcArrow:
1807
                            {
1808
                                var control = currentControl as ArrowArcControl;
1809
                                if (control != null)
1810
                                {
1811
                                    control.isTransOn = false;
1812
                                    control.ControlType = controlType;
1813
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1814
                                    control.MidPoint = new Point(0, 0);
1815
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1816
                                    Point tempPoint = control.EndPoint;
1817

    
1818
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1819
                                    {
1820
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1821
                                        control.EndPoint = tempPoint;
1822
                                    }
1823
                                    else
1824
                                    {
1825
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1826
                                    }
1827

    
1828

    
1829
                                    control.PointSet = new List<Point>
1830
                                            {
1831
                                                control.StartPoint,
1832
                                                control.MidPoint,
1833
                                                control.EndPoint,
1834
                                            };
1835
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1836
                                }
1837
                            }
1838
                            break;
1839

    
1840
                        case ControlType.ArrowMultiLine:
1841
                            {
1842
                                var control = currentControl as ArrowControl_Multi;
1843
                                if (control != null)
1844
                                {
1845
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1846
                                    Point tempPoint = control.EndPoint;
1847
                                    if (control.MiddlePoint == new Point(0, 0))
1848
                                    {
1849
                                        if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1850
                                        {
1851
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1852
                                            //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1853
                                            control.EndPoint = tempPoint;
1854
                                        }
1855
                                        else
1856
                                        {
1857
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1858
                                        }
1859
                                    }
1860
                                    else
1861
                                    {
1862
                                        if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1863
                                        {
1864
                                            //var AngleValue = MathSet.returnAngleString(control.MiddlePoint, ref tempPoint, true);
1865
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.MiddlePoint, ref tempPoint, true);
1866
                                            control.EndPoint = tempPoint;
1867
                                        }
1868
                                        else
1869
                                        {
1870
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.MiddlePoint, ref tempPoint, false);
1871
                                        }
1872

    
1873
                                    }
1874

    
1875
                                    control.PointSet = new List<Point>
1876
                                            {
1877
                                                control.StartPoint,
1878
                                                control.MiddlePoint,
1879
                                                control.EndPoint,
1880
                                            };
1881
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1882
                                }
1883
                            }
1884
                            break;
1885

    
1886
                        case ControlType.Circle:
1887
                            {
1888
                                var control = currentControl as CircleControl;
1889

    
1890
                                if (control != null)
1891
                                {
1892
                                    if (move.mousemode == MouseMode.Drawing)
1893
                                    {
1894
                                        //move.control_Move(ControlList, true, moveX, moveY);
1895
                                    }
1896
                                    else
1897
                                    {
1898
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1899
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1900
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1901
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1902

    
1903
                                        if (ViewerDataModel.Instance.IsPressShift)
1904
                                        {
1905
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1906
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1907
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1908
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1909
                                        }
1910

    
1911
                                        control.PointSet = new List<Point>
1912
                                        {
1913
                                            control.StartPoint,
1914
                                            control.LeftBottomPoint,
1915
                                            control.EndPoint,
1916
                                            control.TopRightPoint,
1917
                                        };
1918
                                    }
1919

    
1920
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1921
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1922

    
1923
                                }
1924
                            }
1925
                            break;
1926

    
1927
                        case ControlType.PolygonCloud:
1928
                            {
1929
                                var control = currentControl as CloudControl;
1930

    
1931
                                if (control != null)
1932
                                {
1933
                                    control.isTransOn = true;
1934
                                    control.PointSet.RemoveAt(control.PointSet.Count - 1);
1935

    
1936
                                    control.PointSet.Add(currentCanvasDrawingMouseMovePoint);
1937

    
1938
                                    control.SetCloud();
1939
                                    //강인구 추가
1940
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1941
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1942
                                }
1943
                            }
1944
                            break;
1945

    
1946
                        case ControlType.Triangle:
1947
                            {
1948
                                var control = currentControl as TriControl;
1949

    
1950
                                if (control != null)
1951
                                {
1952
                                    if (move.mousemode == MouseMode.Drawing)
1953
                                    {
1954
                                        //move.control_Move(ControlList, true, moveX, moveY);
1955
                                    }
1956
                                    else
1957
                                    {
1958
                                        control.Paint = ViewerDataModel.Instance.paintSet;
1959
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1960

    
1961
                                        if (ViewerDataModel.Instance.checkAxis)
1962
                                        {
1963
                                            Point tempPoint = control.EndPoint;
1964
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1965
                                            control.EndPoint = tempPoint;
1966
                                        }
1967

    
1968

    
1969
                                        if (ViewerDataModel.Instance.IsPressShift)
1970
                                        {
1971
                                            List<Point> Points = GetRegularTrianglePoints(control.StartPoint, control.EndPoint);
1972
                                            if (2 == Points.Count())
1973
                                            {
1974
                                                control.MidPoint = Points[0];
1975
                                                control.EndPoint = Points[1];
1976
                                            }
1977
                                        }
1978

    
1979
                                        control.PointSet = new List<Point>
1980
                                            {
1981
                                                control.StartPoint,
1982
                                                control.MidPoint,
1983
                                                control.EndPoint,
1984
                                            };
1985
                                    }
1986

    
1987
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1988
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1989
                                }
1990
                            }
1991
                            break;
1992

    
1993
                        case ControlType.ImgControl:
1994
                            {
1995
                                var control = currentControl as ImgControl;
1996

    
1997
                                if (control != null)
1998
                                {
1999
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2000
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2001
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2002
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2003

    
2004
                                    control.PointSet = new List<Point>
2005
                                        {
2006
                                            control.StartPoint,
2007
                                            control.LeftBottomPoint,
2008
                                            control.EndPoint,
2009
                                            control.TopRightPoint,
2010
                                        };
2011
                                }
2012
                            }
2013
                            break;
2014

    
2015
                        case ControlType.Date:
2016
                            {
2017
                                var control = currentControl as DateControl;
2018

    
2019
                                if (control != null)
2020
                                {
2021
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2022
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2023
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2024
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2025
                                    //control.Text = DateTime.Now.ToString("yyyy-MM-dd");
2026

    
2027
                                    control.PointSet = new List<Point>
2028
                                        {
2029
                                            control.StartPoint,
2030
                                            control.LeftBottomPoint,
2031
                                            control.EndPoint,
2032
                                            control.TopRightPoint,
2033
                                        };
2034
                                }
2035
                            }
2036
                            break;
2037

    
2038
                        case ControlType.ArrowTextControl:
2039
                            {
2040
                                var control = currentControl as ArrowTextControl;
2041

    
2042
                                if (control != null)
2043
                                {
2044
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2045
                                    Point tempPoint = control.EndPoint;
2046

    
2047
                                    control.MidPoint = new Point(control.EndPoint.X - 100, control.EndPoint.Y - 100);
2048

    
2049
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2050
                                    {
2051
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2052
                                        control.EndPoint = tempPoint;
2053
                                    }
2054
                                    else
2055
                                    {
2056
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2057
                                    }
2058
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2059

    
2060
                                    control.PointSet = new List<Point>
2061
                                            {
2062
                                                control.StartPoint,
2063
                                                control.MidPoint,
2064
                                                control.EndPoint,
2065
                                            };
2066
                                }
2067
                            }
2068
                            break;
2069

    
2070
                        case ControlType.ArrowTransTextControl:
2071
                            {
2072
                                var control = currentControl as ArrowTextControl;
2073

    
2074
                                if (control != null)
2075
                                {
2076
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2077
                                    Point tempPoint = control.EndPoint;
2078
                                    //control.MidPoint = currentCanvasDrawingMouseMovePoint;
2079

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

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

    
2102
                        case ControlType.ArrowTextBorderControl:
2103
                            {
2104
                                var control = currentControl as ArrowTextControl;
2105

    
2106
                                if (control != null)
2107
                                {
2108
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2109
                                    Point tempPoint = control.EndPoint;
2110
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2111
                                    {
2112
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2113
                                        control.EndPoint = tempPoint;
2114
                                    }
2115
                                    else
2116
                                    {
2117
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2118
                                    }
2119
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2120
                                    control.PointSet = new List<Point>
2121
                                            {
2122
                                                control.StartPoint,
2123
                                                control.MidPoint,
2124
                                                control.EndPoint,
2125
                                            };
2126
                                }
2127

    
2128
                            }
2129
                            break;
2130
                        case ControlType.ArrowTransTextBorderControl:
2131
                            {
2132
                                var control = currentControl as ArrowTextControl;
2133

    
2134
                                if (control != null)
2135
                                {
2136
                                    control.isFixed = true;
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

    
2149
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2150
                                    control.PointSet = new List<Point>
2151
                                            {
2152
                                                control.StartPoint,
2153
                                                control.MidPoint,
2154
                                                control.EndPoint,
2155
                                            };
2156
                                }
2157

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

    
2164
                                if (control != null)
2165
                                {
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
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2178
                                    control.PointSet = new List<Point>
2179
                                            {
2180
                                                control.StartPoint,
2181
                                                control.MidPoint,
2182
                                                control.EndPoint,
2183
                                            };
2184
                                }
2185

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

    
2192
                                if (control != null)
2193
                                {
2194
                                    control.isFixed = true;
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.PolygonControl:
2218
                        case ControlType.ChainLine:
2219
                            {
2220
                                var control = currentControl as PolygonControl;
2221

    
2222
                                if (control != null)
2223
                                {
2224
                                    control.PointSet.RemoveAt(control.PointSet.Count - 1);
2225
                                    Point tempPoint = currentCanvasDrawingMouseMovePoint;
2226
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2227
                                    {
2228
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.PointSet[control.PointSet.Count - 1], ref tempPoint, true);
2229
                                    }
2230
                                    control.PointSet.Add(currentCanvasDrawingMouseMovePoint);
2231

    
2232
                                    control.Paint = ViewerDataModel.Instance.paintSet;
2233
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
2234
                                    control.Paint = ViewerDataModel.Instance.paintSet;
2235
                                    control.updateControl();
2236
                                }
2237
                            }
2238
                            break;
2239
                        //강인구 추가
2240
                        case ControlType.Sign:
2241
                            {
2242
                                var control = currentControl as SignControl;
2243

    
2244
                                if (control != null)
2245
                                {
2246
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2247
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2248
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2249
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2250

    
2251
                                    if (control.StartPoint != control.EndPoint && control.SignImage == null)
2252
                                    {
2253
                                        var _sign = GetUserSign.GetSign(App.ViewInfo.UserID, App.ViewInfo.ProjectNO);
2254
                                        byte[] imageBytes = System.Convert.FromBase64String(_sign);
2255
                                        System.IO.MemoryStream stream = new System.IO.MemoryStream();
2256
                                        stream.Write(imageBytes, 0, imageBytes.Length);
2257
                                        stream.Position = 0;
2258
                                        System.Drawing.Image img = System.Drawing.Image.FromStream(stream);
2259
                                        BitmapImage returnImage = new BitmapImage();
2260
                                        returnImage.BeginInit();
2261
                                        System.IO.MemoryStream ms = new System.IO.MemoryStream();
2262
                                        img.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
2263
                                        ms.Seek(0, System.IO.SeekOrigin.Begin);
2264
                                        returnImage.StreamSource = ms;
2265
                                        returnImage.EndInit();
2266
                                        stream.Close();
2267

    
2268
                                        control.SignImage = returnImage;
2269
                                    }
2270
                                    control.PointSet = new List<Point>
2271
                                        {
2272
                                            control.StartPoint,
2273
                                            control.LeftBottomPoint,
2274
                                            control.EndPoint,
2275
                                            control.TopRightPoint,
2276
                                        };
2277
                                }
2278
                            }
2279
                            break;
2280
                        //TODO: 강인구 추가
2281
                        case ControlType.Symbol:
2282
                            {
2283
                                var control = currentControl as SymControl;
2284

    
2285
                                if (control != null)
2286
                                {
2287
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2288
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2289
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2290
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2291
                                    control.LineSize = ViewerDataModel.Instance.LineSize + 3;
2292
                                    control.StrokeColor = new SolidColorBrush(Colors.Red);
2293

    
2294
                                    if (control.StartPoint != control.EndPoint)
2295
                                    {
2296
                                        if (control.PathData == null)
2297
                                        {
2298
                                            using (StringToPathConverter Convert = new StringToPathConverter())
2299
                                            {
2300
                                                control.PathData = Convert.Convert("M-5,5L0,0L20,30L40,-20 ");
2301
                                            }
2302
                                        }
2303
                                    }
2304

    
2305
                                    control.PointSet = new List<Point>
2306
                                        {
2307
                                            control.StartPoint,
2308
                                            control.LeftBottomPoint,
2309
                                            control.EndPoint,
2310
                                            control.TopRightPoint,
2311
                                        };
2312
                                }
2313
                            }
2314
                            break;
2315
                        ///TODO: 
2316
                        case ControlType.Stamp:
2317
                            {
2318
                                var control = currentControl as SymControlN;
2319

    
2320
                                if (control != null)
2321
                                {
2322

    
2323
                                    if (control.StartPoint == control.EndPoint)
2324
                                    {
2325
                                        //string appovalData = "";
2326

    
2327
                                        var xamlData = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString_NonPrefix(App.SystemInfo.STAMP);
2328
                                        xamlData = xamlData.Replace("daelim", "DAELIM");
2329

    
2330

    
2331
                                        //object obj = System.Windows.Markup.XamlReader.Load(xamlData);
2332

    
2333
                                        System.IO.MemoryStream stream = new System.IO.MemoryStream();
2334
                                        System.IO.StreamWriter writer = new System.IO.StreamWriter(stream);
2335
                                        writer.Write(xamlData);
2336
                                        writer.Flush();
2337
                                        stream.Position = 0;
2338

    
2339
                                        control.StrokeColor = new SolidColorBrush(Colors.Red);
2340
                                        object obj = System.Windows.Markup.XamlReader.Load(stream);
2341
                                        UIElement ob = obj as UIElement;
2342

    
2343
                                        //control.ApplyTemplate();
2344

    
2345
                                        control.SetViewBox();
2346
                                        control.PathXathData = App.SystemInfo.STAMP;
2347
                                        control.Base_ViewBox.Child = ob;
2348
                                    }
2349

    
2350
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2351
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2352
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2353
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2354
                                    //control.LineSize = ViewerDataModel.Instance.LineSize + 3;
2355

    
2356

    
2357
                                    control.PointSet = new List<Point>
2358
                                    {
2359
                                        control.StartPoint,
2360
                                        control.LeftBottomPoint,
2361
                                        control.EndPoint,
2362
                                        control.TopRightPoint,
2363
                                    };
2364
                                }
2365
                            }
2366
                            break;
2367
                        case ControlType.Mark:
2368
                            {
2369
                                var control = currentControl as RectangleControl;
2370

    
2371
                                if (control != null)
2372
                                {
2373
                                    if (move.mousemode == MouseMode.Drawing)
2374
                                    {
2375
                                        //move.control_Move(ControlList, true, moveX, moveY);
2376
                                    }
2377
                                    else
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

    
2384

    
2385
                                        control.PointSet = new List<Point>
2386
                                    {
2387
                                        control.StartPoint,
2388
                                        control.LeftBottomPoint,
2389
                                        control.EndPoint,
2390
                                        control.TopRightPoint,
2391
                                    };
2392
                                    }
2393

    
2394
                                    //강인구 추가
2395
                                    control.Paint = PaintSet.Fill;
2396
                                }
2397
                            }
2398
                            break;
2399
                        case ControlType.PenControl:
2400
                            {
2401
                                stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y));
2402
                                //inkBoard.Strokes.Add(stroke);
2403
                            }
2404
                            break;
2405
                        default:
2406
                            break;
2407
                    }
2408
                }
2409
            }
2410
            else if(mouseHandlingMode == MouseHandlingMode.Drawing && e.LeftButton == MouseButtonState.Pressed)
2411
            {
2412
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
2413
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
2414
                SetCursor();
2415
                if (currentControl == null)
2416
                {
2417
                    switch (controlType)
2418
                    {
2419
                        case ControlType.PenControl:
2420
                            {
2421
                                if (inkBoard.Tag.ToString() == "Ink")
2422
                                {
2423
                                    stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y));
2424
                                }
2425
                                else if (inkBoard.Tag.ToString() == "EraseByPoint")
2426
                                {
2427
                                    RemovePointStroke(currentCanvasDrawingMouseMovePoint);
2428
                                }
2429
                                else if (inkBoard.Tag.ToString() == "EraseByStroke")
2430
                                {
2431
                                    RemoveLineStroke(currentCanvasDrawingMouseMovePoint);
2432
                                }
2433

    
2434
                                //inkBoard.Strokes.Add(stroke);
2435
                            }
2436
                            break;
2437
                    }
2438
                    return;
2439
                }
2440
            }
2441
            else if (((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.Selecting) || 
2442
                ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.Capture) || 
2443
                ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.DragZoom))
2444
            {
2445
                Point curMouseDownPoint = e.GetPosition(drawingRotateCanvas);
2446

    
2447
                if (isDraggingSelectionRect)
2448
                {
2449
                    UpdateDragSelectionRect(canvasDrawingMouseDownPoint, curMouseDownPoint);
2450

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

    
2458
                    if (dragDistance > DragThreshold)
2459
                    {
2460
                        isDraggingSelectionRect = true;
2461

    
2462
                        InitDragSelectionRect(canvasDrawingMouseDownPoint, curMouseDownPoint);
2463
                    }
2464

    
2465
                    e.Handled = true;
2466
                }
2467

    
2468

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

    
2491

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

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

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

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

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

    
2551
                //if (hitList.Count > 0)
2552
                //{
2553

    
2554
                //}
2555

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

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

    
2578
                //EllipseGeometry expandedHitTestArea = new EllipseGeometry(currentCanvasDrawingMouseMovePoint, 10.0, 10.0);
2579
                //hitResultsList.Clear();
2580

    
2581
                #endregion
2582
            }
2583
        }
2584

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

    
2593
                Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
2594

    
2595
                ViewerDataModel.Instance.Sync_ContentOffsetX -= dragOffset.X;
2596
                ViewerDataModel.Instance.Sync_ContentOffsetY -= dragOffset.Y;
2597

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

    
2606
        private List<CommentUserInfo> hitList = new List<CommentUserInfo>();
2607

    
2608
        private EllipseGeometry hitArea = new EllipseGeometry();
2609

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

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

    
2620
                    SetCursor();
2621

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

    
2629
                            }
2630
                            break;
2631
                        case ControlType.PenControl:
2632
                            {
2633

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

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

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

    
2681
                                ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.ZoomTo(dragRect);
2682

    
2683
                                dragZoomBorder.Visibility = Visibility.Collapsed;
2684
                            }
2685

    
2686
                            isDraggingSelectionRect = false;
2687
                            e.Handled = true;
2688
                            wasDragSelectionApplied = true;
2689
                        }
2690

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

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

    
2710
                zoomAndPanControl.ReleaseMouseCapture();
2711

    
2712

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

    
2721
            ///mouseButtonDown = MouseButton.Left;
2722
            //controlType = ControlType.SingleLine;
2723
        }
2724

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

    
2735
            double width = dragCaptureBorder.Width;
2736
            double height = dragCaptureBorder.Height;
2737

    
2738
            canvasImage = ConverterBitmapImage(zoomAndPanCanvas);
2739

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

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

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

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

    
2781
            //GC.Collect();
2782

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

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

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

    
2806
        private void zoomAndPanControl_MouseDoubleClick(object sender, MouseButtonEventArgs e)
2807
        {
2808

    
2809
        }
2810

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

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

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

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

    
2833
                if (Flag)
2834
                {
2835
                    adornerSet.Add(item);
2836
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(item);
2837

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

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

    
2859
                dragSelectionBorder.Visibility = Visibility.Visible;
2860
            }
2861
            else
2862
            {
2863
                dragZoomBorder.Visibility = Visibility.Visible;
2864
            }
2865
            UpdateDragSelectionRect(pt1, pt2);
2866
        }
2867

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

    
2875
            //
2876
            // Determine x,y,width and height of the rect inverting the points if necessary.
2877
            // 
2878

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

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

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

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

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

    
2962
            zoomAndPanControl.RotationAngle = rotate.Angle;
2963

    
2964

    
2965
            if (!testPanel2.IsHidden)
2966
            {
2967
                zoomAndPanControl2.RotationAngle = rotate.Angle;
2968
                zoomAndPanCanvas2.Width = zoomAndPanCanvas.Width;
2969
                zoomAndPanCanvas2.Height = zoomAndPanCanvas.Height;
2970
            }
2971

    
2972
            ViewerDataModel.Instance.ContentWidth = zoomAndPanCanvas.Width;
2973
            ViewerDataModel.Instance.ContentHeight = zoomAndPanCanvas.Height;
2974
            ViewerDataModel.Instance.AngleOffsetX = translate.X;
2975
            ViewerDataModel.Instance.AngleOffsetY = translate.Y;
2976
            ViewerDataModel.Instance.Angle = rotate.Angle;
2977
        }
2978

    
2979
        public void PlaceImageSymbol(string id, long group_id, int SelectedIndex, Point canvasZoomPanningMouseDownPoint)
2980
        {
2981
            string Data_ = "";
2982

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

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

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

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

    
3056
                    //multi_Undo_Data = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
3057
                    multi_Undo_Data = Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
3058
                    UndoData.Markup_List.Add(multi_Undo_Data);
3059
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
3060

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

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

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

    
3087
            InkControl_Convert();
3088

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

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

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

    
3107
            ///mouseButtonDown = e.ChangedButton;
3108
            /// complete drawing text control when user click mouse right button - 2018.05.14 added by humkyung
3109

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

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

    
3131
            double Ang = 0;                                          
3132
            if (rotate.Angle != 0)
3133
            {
3134
                Ang = 360 - rotate.Angle;
3135
            }
3136

    
3137
            if (e.OriginalSource is System.Windows.Controls.Image)
3138
            {
3139
                (e.OriginalSource as System.Windows.Controls.Image).Focus();
3140
            }
3141

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

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

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

    
3165
            if (e.LeftButton == MouseButtonState.Pressed)
3166
            {
3167
                canvasDrawingMouseDownPoint = e.GetPosition(drawingRotateCanvas);
3168
                canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
3169

    
3170
                this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
3171
                SetCursor();
3172

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

    
3197
                this.pageNavigator.GotoPage(this.pageNavigator._NextPage.PageNumber);
3198

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

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

    
3219
                    if (controlType == ControlType.None)
3220
                    {
3221
                        isLeftMouseButtonDownOnWindow = true;
3222
                    }
3223
                }
3224

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

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

    
3239
                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
3240
                if (control != null)
3241
                {
3242
                    AdornerFinal final = null;
3243

    
3244
                    if (!ViewerDataModel.Instance.IsPressCtrl)
3245
                    {
3246
                        /// 기존 selection 해제
3247
                        SelectionSet.Instance.UnSelect(this);
3248

    
3249
                        final = new AdornerFinal(control);
3250

    
3251
                        Control_Style(control);
3252

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

    
3278
                        ViewerDataModel.Instance.ControlOpacity = control.Opacity;
3279

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

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

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

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

    
3372
                        Control_Style(control);
3373

    
3374
                        final = new AdornerFinal(comment);
3375
                    }
3376

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

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

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

    
3440
                                    CreateControl();
3441

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

    
3465
                                        currentControl.CommentID = Commons.shortGuid();
3466
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3467
                                        currentControl.IsNew = true;
3468

    
3469
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3470

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

    
3488
                                    CreateControl();
3489

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

    
3502
                                    currentControl.CommentID = Commons.shortGuid();
3503
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3504
                                    currentControl.IsNew = true;
3505
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3506

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

    
3523
                                    CreateControl();
3524

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

    
3537
                                    currentControl.CommentID = Commons.shortGuid();
3538
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3539
                                    currentControl.IsNew = true;
3540
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3541

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

    
3558
                                    CreateControl();
3559

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

    
3572
                                    currentControl.CommentID = Commons.shortGuid();
3573
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3574
                                    currentControl.IsNew = true;
3575
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3576

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

    
3596
                                        CreateControl();
3597

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

    
3611
                                        currentControl.CommentID = Commons.shortGuid();
3612
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3613
                                        currentControl.IsNew = true;
3614
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3615

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

    
3636
                                        CreateControl();
3637

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

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

    
3673
                                        CreateControl();
3674

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

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

    
3715
                                            CreateControl();
3716

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

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

    
3752
                                        CreateControl();
3753

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

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

    
3789
                                        CreateControl();
3790

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

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

    
3826
                                        CreateControl();
3827

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

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

    
3863
                                        CreateControl();
3864

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

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

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

    
3934
                                    CreateControl();
3935

    
3936
                                    (currentControl as PolygonControl).ApplyOverViewData();
3937
                                    currentControl = null;
3938
                                    this.MainAngle.Visibility = Visibility.Collapsed;
3939
                                    return;
3940
                                }
3941

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

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

    
3994
                                        CreateControl();
3995

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

    
4039
                                    CreateControl();
4040

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

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

    
4099
                                            CreateControl();
4100

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

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

    
4145
                                    CreateControl();
4146

    
4147
                                    control.isTransOn = true;
4148
                                    var firstPoint = control.PointSet.First();
4149

    
4150
                                    control.PointSet.Add(firstPoint);
4151
                                    control.DrawingCloud();
4152
                                    control.ApplyOverViewData();
4153

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

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

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

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

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

    
4240
                                        
4241
                                                currentControl.CommentID = Commons.shortGuid();                                            
4242
                                                currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4243
                                                currentControl.IsNew = true;
4244
                                                ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4245

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

    
4268
                                        CreateControl();
4269
                                        (currentControl as DateControl).ApplyOverViewData();
4270
                                        currentControl = null;
4271

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

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

    
4295
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
4296
                                        (currentControl as DateControl).Angle -= rotate.Angle;
4297
                                }
4298
                                //}
4299
                            }
4300
                        }
4301
                        break;
4302
                    case ControlType.TextControl:
4303
                        {
4304
                            if (e.LeftButton == MouseButtonState.Pressed)
4305
                            {
4306
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4307
                                {
4308
                                    currentControl = new TextControl
4309
                                    {
4310
                                        ControlType = controlType
4311
                                    };
4312
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
4313
                                    currentControl.CommentID = Commons.shortGuid();
4314
                                    currentControl.IsNew = true;
4315
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4316
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4317
                                    currentControl.SetValue(Canvas.ZIndexProperty, 2);
4318
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
4319
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);
4320
                                    
4321
                                    (currentControl as TextControl).ControlType_No = 0;
4322
                                    (currentControl as TextControl).Angle -= rotate.Angle;
4323
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
4324
                                    (currentControl as TextControl).ApplyTemplate();
4325
                                    (currentControl as TextControl).Base_TextBox.Focus();
4326

    
4327
                                    CreateControl();
4328

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

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

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

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

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

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

    
4409
                                    CreateControl();
4410

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
4721
                                    control.ApplyOverViewData();
4722

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
5008

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

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

    
5026
            }
5027
        }
5028

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

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

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

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

    
5056
            inkBoard.Strokes.Add(stroke);
5057

    
5058
        }
5059

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
5441
                }
5442
            }
5443
        }
5444

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

    
5451
                var uri = CurrentRev.TO_VENDOR;
5452

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
5658

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

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

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

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

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

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

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

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

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

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

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

    
5787
                                    System.Drawing.Bitmap image;
5788

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

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

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

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

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

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

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

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

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

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

    
5937
                List<SYMBOL_PUBLIC> symbol_Public;
5938

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

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

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

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

    
6001
        public PngBitmapEncoder symImage(string data)
6002
        {
6003

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

    
6010
            BitmapEncoder encoder = new PngBitmapEncoder();
6011

    
6012

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

    
6015
            DrawingVisual dv = new DrawingVisual();
6016

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

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

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

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

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

    
6046
        }
6047

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

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

    
6068
        #region 캡쳐 기능
6069

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

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

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

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

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

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

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

    
6108
            return pixels;
6109
        }
6110

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

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

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

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

    
6130
        System.Drawing.Bitmap GetBitmap(BitmapSource source)
6131
        {
6132
            System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(source.PixelWidth, source.PixelHeight, System.Drawing.Imaging.PixelFormat.Format32bppPArgb);
6133
            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);
6134
            source.CopyPixels(Int32Rect.Empty, data.Scan0, data.Height * data.Stride, data.Stride);
6135
            bmp.UnlockBits(data);
6136
            return bmp;
6137
        }
6138
        public string symbolname = null;
6139
        public bool symbolsvg = true;
6140
        public bool symbolpng = true;
6141

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

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

    
6158
            SymbolPrompt symbolPrompt = new SymbolPrompt();
6159

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

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

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

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

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

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

    
6246
        }
6247

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

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

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

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

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

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

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

    
6284
            multi_Undo_Data.Markup = control;
6285

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

    
6303
            return multi_Undo_Data;
6304
        }
6305

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

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

    
6335
                    removingStroke.Add(stroke);
6336

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

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

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

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

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

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

    
6415
            return Return_Point;
6416
        }
6417

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

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

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

    
6443
            return res;
6444
        }
6445

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

    
6462
            return false;
6463
        }
6464

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

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

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

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