프로젝트

일반

사용자정보

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

markus / KCOM / Views / MainMenu.xaml.cs @ a6272c57

이력 | 보기 | 이력해설 | 다운로드 (259 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(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, (Convert.ToUInt32(_ViewInfo.DocumentItemID) / 100).ToString(), _ViewInfo.DocumentItemID, e.PageNumber);
542
            }
543
            else
544
            {
545
                uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _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(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, BalancePoint);
624
                    }
625
                    else
626
                    {
627
                        uri2 = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _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
                }
933
            }
934
            return HitTestResultBehavior.Continue;
935
        }
936

    
937
        public void ReleaseSelectPath()
938
        {
939
            if (SelectionPath == null)
940
            {
941
                SelectionPath = new Path();
942
                SelectionPath.Name = "";
943
            }
944
            if (SelectionPath.Name != "")
945
            {
946
                SelectionPath.Name = "None";
947
            }
948
            SelectionPath.Opacity = 0.01;
949
            SelectionPath.RenderTransform = null;
950
            SelectionPath.RenderTransformOrigin = new Point(0, 0);
951
        }
952

    
953
        #region 컨트롤 초기화 
954
        public void Control_Init(object control)
955
        {
956
            if (L_Size != 0 && (control as IPath) != null)
957
            {
958
                (control as IPath).LineSize = L_Size;
959
                L_Size = 0;
960
            }
961

    
962
            switch (control.GetType().Name)
963
            {
964
                case "RectangleControl":
965
                    {
966
                        (control as RectangleControl).StrokeColor = Brushes.Red;
967
                    }
968
                    break;
969
                case "CircleControl":
970
                    {
971
                        (control as CircleControl).StrokeColor = Brushes.Red;
972
                    }
973
                    break;
974
                case "TriControl":
975
                    {
976
                        (control as TriControl).StrokeColor = Brushes.Red;
977
                    }
978
                    break;
979
                case "RectCloudControl":
980
                    {
981
                        (control as RectCloudControl).StrokeColor = Brushes.Red;
982
                    }
983
                    break;
984
                case "CloudControl":
985
                    {
986
                        (control as CloudControl).StrokeColor = Brushes.Red;
987
                    }
988
                    break;
989
                case "PolygonControl":
990
                    {
991
                        (control as PolygonControl).StrokeColor = Brushes.Red;
992
                    }
993
                    break;
994
                case "ArcControl":
995
                    {
996
                        (control as ArcControl).StrokeColor = Brushes.Red;
997
                    }
998
                    break;
999
                case "ArrowArcControl":
1000
                    {
1001
                        (control as ArrowArcControl).StrokeColor = Brushes.Red;
1002
                    }
1003
                    break;
1004
                case "LineControl":
1005
                    {
1006
                        (control as LineControl).StrokeColor = Brushes.Red;
1007
                    }
1008
                    break;
1009
                case "ArrowControl_Multi":
1010
                    {
1011
                        (control as ArrowControl_Multi).StrokeColor = Brushes.Red;
1012
                    }
1013
                    break;
1014
                case "TextControl":
1015
                    {
1016
                        (control as TextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1017
                    }
1018
                    break;
1019
                case "ArrowTextControl":
1020
                    {
1021
                        (control as ArrowTextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1022
                    }
1023
                    break;
1024
                case "InsideWhiteControl":
1025
                    {
1026
                        (control as InsideWhiteControl).StrokeColor = Brushes.White;
1027
                    }
1028
                    break;
1029
                case "OverlapWhiteControl":
1030
                    {
1031
                        (control as OverlapWhiteControl).StrokeColor = Brushes.White;
1032
                    }
1033
                    break;
1034
                case "ClipWhiteControl":
1035
                    {
1036
                        (control as ClipWhiteControl).StrokeColor = Brushes.White;
1037
                    }
1038
                    break;
1039
                case "CoordinateControl":
1040
                    {
1041
                        (control as CoordinateControl).StrokeColor = Brushes.Black;
1042
                    }
1043
                    break;
1044
            }
1045
        }
1046
        #endregion
1047

    
1048
        public void firstCondition_MouseLeave(object sender, MouseEventArgs e)
1049
        {
1050
            //Control_Init(e.Source);
1051
        }
1052
        private Window _dragdropWindow = null;
1053

    
1054
        [DllImport("user32.dll")]
1055
        [return: MarshalAs(UnmanagedType.Bool)]
1056
        internal static extern bool GetCursorPos(ref Win32Point pt);
1057

    
1058
        [StructLayout(LayoutKind.Sequential)]
1059
        internal struct Win32Point
1060
        {
1061
            public Int32 X;
1062
            public Int32 Y;
1063
        };
1064
        public string symbol_id = null;
1065
        public long symbol_group_id;
1066
        public int symbol_SelectedIndex;
1067
        public ImageSource symbol_img;
1068
        public string symbol_Data = null;
1069
        public void symboldata(string id, long group_id, int SelectedIndex, string Data_, ImageSource img)
1070
        {
1071
            if (this._dragdropWindow != null)
1072
            {
1073
                this._dragdropWindow.Close();
1074
                this._dragdropWindow = null;
1075
            }
1076

    
1077
            symbol_id = id;
1078
            symbol_group_id = group_id;
1079
            symbol_SelectedIndex = SelectedIndex;
1080
            symbol_Data = Data_;
1081
            symbol_img = img;
1082

    
1083
      
1084
            CreateDragDropWindow2(img);
1085
        }
1086

    
1087
        private void CreateDragDropWindow2(ImageSource image)
1088
        {
1089
            this._dragdropWindow = new Window();
1090
            _dragdropWindow.Cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1091
            _dragdropWindow.WindowStyle = WindowStyle.None;
1092
            _dragdropWindow.AllowsTransparency = true;           
1093
            _dragdropWindow.AllowDrop = false;
1094
            _dragdropWindow.Background = null;
1095
            _dragdropWindow.IsHitTestVisible = false;
1096
            _dragdropWindow.SizeToContent = SizeToContent.WidthAndHeight;
1097
            _dragdropWindow.Topmost = true;
1098
            _dragdropWindow.ShowInTaskbar = false;
1099
            
1100
            Rectangle r = new Rectangle();
1101
            r.Width = image.Width;
1102
            r.Height = image.Height;
1103
            r.Opacity = 0.5;            
1104
            r.Fill = new ImageBrush(image);
1105
            this._dragdropWindow.Content = r;
1106

    
1107
            Win32Point w32Mouse = new Win32Point();
1108
            GetCursorPos(ref w32Mouse);
1109

    
1110
            //w32Mouse.X = getCurrentPoint.X;
1111
            this._dragdropWindow.Left = w32Mouse.X - (image.Width / 2);
1112
            this._dragdropWindow.Top = w32Mouse.Y - (image.Height / 2); 
1113
            this._dragdropWindow.Show();
1114
        }
1115

    
1116
        private void zoomAndPanControl_MouseMove(object sender, MouseEventArgs e)
1117
        {
1118
            if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
1119
            {
1120
                if (!floatingTip.IsOpen) { floatingTip.IsOpen = true; }
1121

    
1122
                Point currentPos = e.GetPosition(rect);
1123

    
1124
                floatingTip.HorizontalOffset = currentPos.X + 20;
1125
                floatingTip.VerticalOffset = currentPos.Y;
1126
            }
1127

    
1128
            getCurrentPoint = e.GetPosition(drawingRotateCanvas);
1129
            
1130
            if ((e.MiddleButton == MouseButtonState.Pressed) || (e.RightButton == MouseButtonState.Pressed))
1131
            {
1132
                SetCursor();
1133
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1134
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1135

    
1136
                Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
1137
                zoomAndPanControl.ContentOffsetX -= dragOffset.X;
1138
                zoomAndPanControl.ContentOffsetY -= dragOffset.Y;
1139

    
1140
                if (Sync.IsChecked)
1141
                {
1142
                    ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
1143
                    ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
1144
                }
1145
            }
1146

    
1147
            if (mouseHandlingMode == MouseHandlingMode.Drawing && currentControl != null)
1148
            {
1149
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1150
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1151
                SetCursor();
1152

    
1153
                if (currentControl != null)
1154
                {
1155
                    double moveX = currentCanvasDrawingMouseMovePoint.X - canvasDrawingMouseDownPoint.X;
1156
                    double moveY = currentCanvasDrawingMouseMovePoint.Y - canvasDrawingMouseDownPoint.Y;
1157
                    //강인구 추가
1158
                    currentControl.Opacity = ViewerDataModel.Instance.ControlOpacity;
1159

    
1160
                    if ((currentControl as IPath) != null)
1161
                    {
1162
                        (currentControl as IPath).LineSize = ViewerDataModel.Instance.LineSize;
1163
                    }
1164
                    if ((currentControl as LineControl) != null)
1165
                    {
1166
                        (currentControl as LineControl).Interval = ViewerDataModel.Instance.Interval;
1167
                    }
1168

    
1169
                    if ((currentControl as IShapeControl) != null)
1170
                    {
1171
                        (currentControl as IShapeControl).Paint = ViewerDataModel.Instance.paintSet;
1172
                    }
1173
                    if ((currentControl as TextControl) != null)
1174
                    {
1175
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true)
1176
                        {
1177
                            (currentControl as TextControl).TextStyle = FontStyles.Italic;
1178
                        }
1179
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true)
1180
                        {
1181
                            (currentControl as TextControl).TextWeight = FontWeights.Bold;
1182
                        }
1183
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true)
1184
                        {
1185
                            (currentControl as TextControl).UnderLine = TextDecorations.Underline;
1186
                        }
1187
                    }
1188
                    else if ((currentControl as ArrowTextControl) != null)
1189
                    {
1190
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true)
1191
                        {
1192
                            (currentControl as ArrowTextControl).TextStyle = FontStyles.Italic;
1193
                        }
1194
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true)
1195
                        {
1196
                            (currentControl as ArrowTextControl).TextWeight = FontWeights.Bold;
1197
                        }
1198
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true)
1199
                        {
1200
                            (currentControl as ArrowTextControl).UnderLine = TextDecorations.Underline;
1201
                        }
1202
                    }
1203
                    else if ((currentControl as RectCloudControl) != null)
1204
                    {
1205
                        (currentControl as RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
1206
                    }
1207
                    else if ((currentControl as CloudControl) != null)
1208
                    {
1209
                        (currentControl as CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
1210
                    }
1211

    
1212
                    switch (controlType)
1213
                    {
1214
                        case (ControlType.Coordinate):
1215
                            {
1216
                                var control = currentControl as CoordinateControl;
1217
                                if (control != null)
1218
                                {
1219
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1220
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1221
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1222
                                }
1223
                            }
1224
                            break;
1225
                        case (ControlType.InsideWhite):
1226
                            {
1227
                                var control = currentControl as InsideWhiteControl;
1228
                                if (control != null)
1229
                                {
1230
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1231
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1232
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1233
                                    control.Paint = PaintSet.Fill;
1234
                                }
1235
                            }
1236
                            break;
1237
                        case ControlType.OverlapWhite:
1238
                            {
1239
                                var control = currentControl as OverlapWhiteControl;
1240
                                if (control != null)
1241
                                {
1242
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1243
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1244
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1245
                                    control.Paint = PaintSet.Fill;
1246
                                }
1247
                            }
1248
                            break;
1249
                        case ControlType.ClipWhite:
1250
                            {
1251
                                var control = currentControl as ClipWhiteControl;
1252
                                if (control != null)
1253
                                {
1254
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1255
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1256
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1257
                                    control.Paint = PaintSet.Fill;
1258
                                }
1259
                            }
1260
                            break;
1261
                        case ControlType.RectCloud:
1262
                            {
1263
                                var control = currentControl as RectCloudControl;
1264
                                if (control != null)
1265
                                {
1266
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1267
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1268
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1269
                                }
1270
                            }
1271
                            break;
1272
                        case ControlType.SingleLine:
1273
                        case ControlType.CancelLine:
1274
                        case ControlType.ArrowLine:
1275
                        case ControlType.TwinLine:
1276
                        case ControlType.DimLine:
1277
                            {
1278
                                var control = currentControl as LineControl;
1279
                                if (control != null)
1280
                                {
1281
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1282
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1283
                                }
1284
                            }
1285
                            break;
1286

    
1287
                        case ControlType.ArcLine:
1288
                            {
1289
                                var control = currentControl as ArcControl;
1290
                                if (control != null)
1291
                                {
1292
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1293
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1294
                                }
1295
                            }
1296
                            break;
1297

    
1298
                        case ControlType.ArcArrow:
1299
                            {
1300
                                var control = currentControl as ArrowArcControl;
1301
                                if (control != null)
1302
                                {
1303
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1304
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1305
                                }
1306
                            }
1307
                            break;
1308

    
1309
                        case ControlType.ArrowMultiLine:
1310
                            {
1311
                                var control = currentControl as ArrowControl_Multi;
1312
                                if (control != null)
1313
                                {
1314
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1315
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1316
                                }
1317
                            }
1318
                            break;
1319

    
1320
                        case ControlType.Circle:
1321
                            {
1322
                                if (currentControl != null)
1323
                                {
1324
                                    currentControl.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1325
                                    (currentControl as CircleControl).DashSize = ViewerDataModel.Instance.DashSize;
1326
                                    (currentControl as CircleControl).Paint = ViewerDataModel.Instance.paintSet;
1327
                                }
1328
                            }
1329
                            break;
1330

    
1331
                        case ControlType.PolygonCloud:
1332
                            {
1333
                                var control = currentControl as CloudControl;
1334
                                if (control != null)
1335
                                {
1336
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1337
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1338
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1339
                                }
1340
                            }
1341
                            break;
1342

    
1343
                        case ControlType.Triangle:
1344
                            {
1345
                                var control = currentControl as TriControl;
1346
                                if (control != null)
1347
                                {
1348
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1349
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1350
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1351
                                }
1352
                            }
1353
                            break;
1354

    
1355
                        case ControlType.ImgControl:
1356
                            {
1357
                                var control = currentControl as ImgControl;
1358
                                if (control != null)
1359
                                {
1360
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1361
                                }
1362
                            }
1363
                            break;
1364

    
1365
                        case ControlType.Date:
1366
                            {
1367
                                var control = currentControl as DateControl;
1368
                                if (control != null)
1369
                                {
1370
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1371
                                }
1372
                            }
1373
                            break;
1374

    
1375
                        case ControlType.ArrowTextControl:
1376
                        case ControlType.ArrowTransTextControl:
1377
                        case ControlType.ArrowTextBorderControl:
1378
                        case ControlType.ArrowTransTextBorderControl:
1379
                        case ControlType.ArrowTextCloudControl:
1380
                        case ControlType.ArrowTransTextCloudControl:
1381
                            {
1382
                                var control = currentControl as ArrowTextControl;
1383
                                if (control != null)
1384
                                {
1385
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1386
                                }
1387
                            }
1388
                            break;
1389
                        case ControlType.PolygonControl:
1390
                        case ControlType.ChainLine:
1391
                            {
1392
                                var control = currentControl as PolygonControl;
1393
                                if (control != null)
1394
                                {
1395
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1396
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1397
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1398
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1399
                                }
1400
                            }
1401
                            break;
1402
                        case ControlType.Sign:
1403
                            {
1404
                                var control = currentControl as SignControl;
1405
                                if (control != null)
1406
                                {
1407
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1408
                                }
1409
                            }
1410
                            break;
1411
                        case ControlType.Symbol:
1412
                            {
1413
                                var control = currentControl as SymControl;
1414
                                if (control != null)
1415
                                {
1416
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1417
                                }
1418
                            }
1419
                            break;
1420
                        case ControlType.Stamp:
1421
                            {
1422
                                var control = currentControl as SymControlN;
1423
                                if (control != null)
1424
                                {
1425
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1426
                                }
1427
                            }
1428
                            break;
1429
                        case ControlType.Rectangle:
1430
                        case ControlType.Mark:
1431
                            {
1432
                                var control = currentControl as RectangleControl;
1433
                                if (control != null)
1434
                                {
1435
                                    control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift);
1436
                                    if(control.ControlType == ControlType.Mark) control.Paint = PaintSet.Fill;
1437
                                }
1438
                            }
1439
                            break;
1440
                        case ControlType.PenControl:
1441
                            {
1442
                                stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y));
1443
                                //inkBoard.Strokes.Add(stroke);
1444
                            }
1445
                            break;
1446
                        default:
1447
                            break;
1448
                    }
1449
                }
1450
            }
1451
            else if(mouseHandlingMode == MouseHandlingMode.Drawing && e.LeftButton == MouseButtonState.Pressed)
1452
            {
1453
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1454
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1455
                SetCursor();
1456
                if (currentControl == null)
1457
                {
1458
                    switch (controlType)
1459
                    {
1460
                        case ControlType.PenControl:
1461
                            {
1462
                                if (inkBoard.Tag.ToString() == "Ink")
1463
                                {
1464
                                    stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y));
1465
                                }
1466
                                else if (inkBoard.Tag.ToString() == "EraseByPoint")
1467
                                {
1468
                                    RemovePointStroke(currentCanvasDrawingMouseMovePoint);
1469
                                }
1470
                                else if (inkBoard.Tag.ToString() == "EraseByStroke")
1471
                                {
1472
                                    RemoveLineStroke(currentCanvasDrawingMouseMovePoint);
1473
                                }
1474

    
1475
                                //inkBoard.Strokes.Add(stroke);
1476
                            }
1477
                            break;
1478
                    }
1479
                    return;
1480
                }
1481
            }
1482
            else if (((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.Selecting) || 
1483
                ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.Capture) || 
1484
                ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.DragZoom))
1485
            {
1486
                Point curMouseDownPoint = e.GetPosition(drawingRotateCanvas);
1487

    
1488
                if (isDraggingSelectionRect)
1489
                {
1490
                    UpdateDragSelectionRect(canvasDrawingMouseDownPoint, curMouseDownPoint);
1491
                    e.Handled = true;
1492
                }
1493
                else if (isLeftMouseButtonDownOnWindow)
1494
                {
1495
                    var dragDelta = curMouseDownPoint - canvasDrawingMouseDownPoint;
1496
                    double dragDistance = Math.Abs(dragDelta.Length);
1497

    
1498
                    if (dragDistance > DragThreshold)
1499
                    {
1500
                        isDraggingSelectionRect = true;
1501
                        InitDragSelectionRect(canvasDrawingMouseDownPoint, curMouseDownPoint);
1502
                    }
1503

    
1504
                    e.Handled = true;
1505
                }
1506

    
1507
                if (canvasDrawingMouseDownPoint == curMouseDownPoint)
1508
                {
1509
                }
1510
                else
1511
                {
1512
                    e.Handled = true;
1513
                }
1514
            }
1515
            else if ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.DragSymbol)
1516
            { //symbol      
1517
                if(_dragdropWindow != null)
1518
                {
1519
                    Win32Point w32Mouse = new Win32Point();
1520
                    GetCursorPos(ref w32Mouse);
1521

    
1522
                    this._dragdropWindow.Left = w32Mouse.X - (symbol_img.Width / 2);
1523
                    this._dragdropWindow.Top = w32Mouse.Y - (symbol_img.Height / 2);
1524
                }                
1525
            }
1526
            else if ((e.LeftButton == MouseButtonState.Released) && (e.MiddleButton == MouseButtonState.Released) && 
1527
                (e.RightButton == MouseButtonState.Released) && ViewerDataModel.Instance.MarkupControls_USER.Count > 0)
1528
            {
1529
                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
1530
                if(control != null)
1531
                {
1532
                    this.cursor = Cursors.Hand;
1533
                    SetCursor();
1534
                }
1535
                else
1536
                {
1537
                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1538
                    SetCursor();
1539
                }
1540
            }
1541
            else
1542
            {
1543
            }
1544
        }
1545

    
1546
        private void zoomAndPanControl2_MouseMove(object sender, MouseEventArgs e)
1547
        {
1548
            if ((e.MiddleButton == MouseButtonState.Pressed) || (e.RightButton == MouseButtonState.Pressed))
1549
            {
1550
                SetCursor();
1551
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas2);
1552
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas2);
1553

    
1554
                Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
1555

    
1556
                ViewerDataModel.Instance.Sync_ContentOffsetX -= dragOffset.X;
1557
                ViewerDataModel.Instance.Sync_ContentOffsetY -= dragOffset.Y;
1558

    
1559
                if (Sync.IsChecked)
1560
                {
1561
                    zoomAndPanControl.ContentOffsetX = ViewerDataModel.Instance.Sync_ContentOffsetX;
1562
                    zoomAndPanControl.ContentOffsetY = ViewerDataModel.Instance.Sync_ContentOffsetY;
1563
                }
1564
            }
1565
        }
1566

    
1567
        private List<CommentUserInfo> hitList = new List<CommentUserInfo>();
1568

    
1569
        private EllipseGeometry hitArea = new EllipseGeometry();
1570

    
1571
        private void zoomAndPanControl_MouseUp(object sender, MouseButtonEventArgs e)
1572
        {
1573
            IsDrawing = false;
1574

    
1575
            if (mouseHandlingMode != MouseHandlingMode.None)
1576
            {
1577
                if (mouseHandlingMode == MouseHandlingMode.Drawing)
1578
                {
1579
                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1580

    
1581
                    SetCursor();
1582

    
1583
                    switch (controlType)
1584
                    {
1585
                        case ControlType.None:
1586
                            break;
1587
                        case ControlType.Rectangle:
1588
                            {
1589

    
1590
                            }
1591
                            break;
1592
                        case ControlType.PenControl:
1593
                            {
1594

    
1595
                            }
1596
                            break;
1597
                        default:
1598
                            break;
1599
                    }
1600
                }
1601
                else if (mouseHandlingMode == MouseHandlingMode.Selecting && e.ChangedButton == MouseButton.Left || mouseHandlingMode == MouseHandlingMode.Capture && e.ChangedButton == MouseButton.Left || mouseHandlingMode == MouseHandlingMode.DragZoom && e.ChangedButton == MouseButton.Left)
1602
                {
1603
                    if (isLeftMouseButtonDownOnWindow)
1604
                    {
1605
                        bool wasDragSelectionApplied = false;
1606

    
1607
                        if (isDraggingSelectionRect)
1608
                        {
1609
                            if (mouseHandlingMode == MouseHandlingMode.Capture && controlType == ControlType.ImgControl)
1610
                            {
1611
                                dragCaptureBorder.Visibility = Visibility.Collapsed;
1612
                                mouseHandlingMode = MouseHandlingMode.None;
1613
                                Point endPoint = e.GetPosition(zoomAndPanCanvas);
1614
                                symbolselectindex = symbolPanel_Instance.RadTab.SelectedIndex;
1615
                                Set_Symbol_Capture(endPoint);
1616
                                ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed;
1617
                                ViewerDataModel.Instance.ViewVisible = Visibility.Visible;                                
1618
                                ViewerDataModel.Instance.Capture_Opacity = 0;
1619
                            }
1620
                            else if (mouseHandlingMode == MouseHandlingMode.Capture)
1621
                            {
1622
                                dragCaptureBorder.Visibility = Visibility.Collapsed;
1623
                                mouseHandlingMode = MouseHandlingMode.None;
1624
                                Set_Capture();
1625

    
1626
                                ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed;
1627
                                ViewerDataModel.Instance.ViewVisible = Visibility.Visible;
1628
                                ViewerDataModel.Instance.Capture_Opacity = 0;
1629
                            }
1630
                            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
1631
                            {
1632
                                ApplyDragSelectionRect();
1633
                            }
1634
                            else
1635
                            {
1636
                                double x = Canvas.GetLeft(dragZoomBorder);
1637
                                double y = Canvas.GetTop(dragZoomBorder);
1638
                                double width = dragZoomBorder.Width;
1639
                                double height = dragZoomBorder.Height;
1640
                                Rect dragRect = new Rect(x, y, width, height);
1641

    
1642
                                ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.ZoomTo(dragRect);
1643

    
1644
                                dragZoomBorder.Visibility = Visibility.Collapsed;
1645
                            }
1646

    
1647
                            isDraggingSelectionRect = false;
1648
                            e.Handled = true;
1649
                            wasDragSelectionApplied = true;
1650
                        }
1651

    
1652
                        if (isLeftMouseButtonDownOnWindow)
1653
                        {
1654
                            isLeftMouseButtonDownOnWindow = false;
1655
                            this.ReleaseMouseCapture();
1656
                            e.Handled = true;
1657
                        }
1658

    
1659
                        if (!wasDragSelectionApplied)
1660
                        {
1661
                            init();
1662
                        }
1663
                    }
1664
                }
1665
                else if (e.RightButton == MouseButtonState.Pressed)
1666
                {
1667
                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1668
                    SetCursor();
1669
                }
1670

    
1671
                zoomAndPanControl.ReleaseMouseCapture();
1672

    
1673

    
1674
                e.Handled = true;
1675
            }
1676
            else
1677
            {
1678
                this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1679
                SetCursor();
1680
            }
1681

    
1682
            ///mouseButtonDown = MouseButton.Left;
1683
            //controlType = ControlType.SingleLine;
1684
        }
1685

    
1686
        public void Set_Symbol_Capture(Point endPoint)
1687
        {       
1688
            double x = canvasDrawingMouseDownPoint.X;
1689
            double y = canvasDrawingMouseDownPoint.Y;
1690
            if(x > endPoint.X)
1691
            {
1692
                x = endPoint.X;
1693
                y = endPoint.Y;
1694
            }
1695

    
1696
            double width = dragCaptureBorder.Width;
1697
            double height = dragCaptureBorder.Height;
1698

    
1699
            canvasImage = ConverterBitmapImage(zoomAndPanCanvas);
1700

    
1701
            if (x < 0)
1702
            {
1703
                width += x;
1704
                x = 0;
1705
            }
1706
            if (y < 0)
1707
            {
1708
                height += y;
1709
                y = 0;
1710

    
1711
                width = (int)canvasImage.PixelWidth - x;
1712
            }
1713
            if (x + width > canvasImage.PixelWidth)
1714
            {
1715
                width = (int)canvasImage.PixelWidth - x;
1716
            }
1717
            if (y + height > canvasImage.PixelHeight)
1718
            {
1719
                height = (int)canvasImage.PixelHeight - y;
1720
            }
1721
            var rect = new Int32Rect((int)x, (int)y, (int)width, (int)height);
1722

    
1723
            string uri = "";
1724
            if (userData.COMPANY != "EXT")
1725
            {
1726
                uri = String.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO,
1727
                    (Convert.ToInt32(_ViewInfo.DocumentItemID) / 100).ToString(), _ViewInfo.DocumentItemID, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber);
1728
            }
1729
            else
1730
            {
1731
                uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, _ViewInfo.DocumentItemID,
1732
                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber);
1733
            }
1734

    
1735
            var defaultBitmapImage = new BitmapImage();
1736
            defaultBitmapImage.BeginInit();
1737
            defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
1738
            defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
1739
            defaultBitmapImage.UriSource = new Uri(uri);
1740
            defaultBitmapImage.EndInit();
1741

    
1742
            //GC.Collect();
1743

    
1744
            if (defaultBitmapImage.IsDownloading)
1745
            {
1746
                defaultBitmapImage.DownloadCompleted += (ex, arg) =>
1747
                {
1748
                    defaultBitmapImage.Freeze();
1749
                    //GC.Collect();
1750
                    BitmapSource bs = new CroppedBitmap(defaultBitmapImage, rect);
1751
                    Save_Symbol_Capture(bs, (int)x, (int)y, (int)width, (int)height);
1752
                };
1753
            }
1754
        }
1755

    
1756
        private void zoomAndPanControl2_MouseUp(object sender, MouseButtonEventArgs e)
1757
        {
1758
            ///mouseButtonDown = MouseButton.Left;
1759
        }
1760

    
1761
        private void zoomAndPanControl_MouseLeave(object sender, MouseEventArgs e)
1762
        {
1763
            ///mouseButtonDown = MouseButton.Left;
1764
            //this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1765
        }
1766

    
1767
        private void zoomAndPanControl_MouseDoubleClick(object sender, MouseButtonEventArgs e)
1768
        {
1769

    
1770
        }
1771

    
1772
        /// <summary>
1773
        /// select items by dragging
1774
        /// </summary>
1775
        private void ApplyDragSelectionRect()
1776
        {
1777
            dragSelectionBorder.Visibility = Visibility.Collapsed;
1778

    
1779
            double x = Canvas.GetLeft(dragSelectionBorder);
1780
            double y = Canvas.GetTop(dragSelectionBorder);
1781
            double width = dragSelectionBorder.Width;
1782
            double height = dragSelectionBorder.Height;
1783
            Boolean Flag = false;
1784
            List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
1785
            var Items = ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.Visibility != Visibility.Hidden).ToList();
1786

    
1787
            Rect dragRect = new Rect(x, y, width, height);
1788
            ///dragRect.Inflate(width / 10, height / 10);
1789

    
1790
            foreach (var item in Items)
1791
            {
1792
                Flag = SelectionSet.Instance.SelectControl(item, dragRect);
1793

    
1794
                if (Flag)
1795
                {
1796
                    adornerSet.Add(item);
1797
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(item);
1798
                    Control_Style(item);
1799
                }
1800
            }
1801
            if (adornerSet.Count > 0)
1802
            {
1803
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
1804
                SelectLayer.Children.Add(final);
1805
            }
1806
        }
1807

    
1808
        private void InitDragSelectionRect(Point pt1, Point pt2)
1809
        {
1810
            //캡쳐 중
1811
            if (mouseHandlingMode == MouseHandlingMode.Capture)
1812
            {
1813
                dragCaptureBorder.Visibility = Visibility.Visible;
1814
            }
1815
            //선택 중
1816
            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
1817
            {
1818

    
1819
                dragSelectionBorder.Visibility = Visibility.Visible;
1820
            }
1821
            else
1822
            {
1823
                dragZoomBorder.Visibility = Visibility.Visible;
1824
            }
1825
            UpdateDragSelectionRect(pt1, pt2);
1826
        }
1827

    
1828
        /// <summary>
1829
        /// Update the position and size of the rectangle used for drag selection.
1830
        /// </summary>
1831
        private void UpdateDragSelectionRect(Point pt1, Point pt2)
1832
        {
1833
            double x, y, width, height;
1834

    
1835
            //
1836
            // Determine x,y,width and height of the rect inverting the points if necessary.
1837
            // 
1838

    
1839
            if (pt2.X < pt1.X)
1840
            {
1841
                x = pt2.X;
1842
                width = pt1.X - pt2.X;
1843
            }
1844
            else
1845
            {
1846
                x = pt1.X;
1847
                width = pt2.X - pt1.X;
1848
            }
1849

    
1850
            if (pt2.Y < pt1.Y)
1851
            {
1852
                y = pt2.Y;
1853
                height = pt1.Y - pt2.Y;
1854
            }
1855
            else
1856
            {
1857
                y = pt1.Y;
1858
                height = pt2.Y - pt1.Y;
1859
            }
1860

    
1861
            //
1862
            // Update the coordinates of the rectangle used for drag selection.
1863
            //
1864
            //캡쳐 중
1865
            if (mouseHandlingMode == MouseHandlingMode.Capture)
1866
            {
1867
                Canvas.SetLeft(dragCaptureBorder, x);
1868
                Canvas.SetTop(dragCaptureBorder, y);
1869
                dragCaptureBorder.Width = width;
1870
                dragCaptureBorder.Height = height;
1871
            }
1872
            //선택 중
1873
            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
1874
            {
1875
                Canvas.SetLeft(dragSelectionBorder, x);
1876
                Canvas.SetTop(dragSelectionBorder, y);
1877
                dragSelectionBorder.Width = width;
1878
                dragSelectionBorder.Height = height;
1879
            }
1880
            else
1881
            {
1882
                Canvas.SetLeft(dragZoomBorder, x);
1883
                Canvas.SetTop(dragZoomBorder, y);
1884
                dragZoomBorder.Width = width;
1885
                dragZoomBorder.Height = height;
1886
            }
1887
        }
1888

    
1889
        private void drawingPannelRotate(double angle)
1890
        {
1891
            Logger.sendCheckLog("pageNavigator_PageChanging_drawingPannelRotate Setting", 1);
1892
            rotate.Angle = angle;
1893
            var rotationNum = Math.Abs((rotate.Angle / 90));
1894

    
1895
            if (angle == 90 || angle == 270)
1896
            {
1897
                double emptySize = zoomAndPanCanvas.Width;
1898
                zoomAndPanCanvas.Width = zoomAndPanCanvas.Height;
1899
                zoomAndPanCanvas.Height = emptySize;
1900
            }
1901
            if (angle == 0)
1902
            {
1903
                translate.X = 0;
1904
                translate.Y = 0;
1905
            }
1906
            else if (angle == 90)
1907
            {
1908
                translate.X = zoomAndPanCanvas.Width;
1909
                translate.Y = 0;
1910
            }
1911
            else if (angle == 180)
1912
            {
1913
                translate.X = zoomAndPanCanvas.Width;
1914
                translate.Y = zoomAndPanCanvas.Height;
1915
            }
1916
            else
1917
            {
1918
                translate.X = 0;
1919
                translate.Y = zoomAndPanCanvas.Height;
1920
            }
1921

    
1922
            zoomAndPanControl.RotationAngle = rotate.Angle;
1923

    
1924

    
1925
            if (!testPanel2.IsHidden)
1926
            {
1927
                zoomAndPanControl2.RotationAngle = rotate.Angle;
1928
                zoomAndPanCanvas2.Width = zoomAndPanCanvas.Width;
1929
                zoomAndPanCanvas2.Height = zoomAndPanCanvas.Height;
1930
            }
1931

    
1932
            ViewerDataModel.Instance.ContentWidth = zoomAndPanCanvas.Width;
1933
            ViewerDataModel.Instance.ContentHeight = zoomAndPanCanvas.Height;
1934
            ViewerDataModel.Instance.AngleOffsetX = translate.X;
1935
            ViewerDataModel.Instance.AngleOffsetY = translate.Y;
1936
            ViewerDataModel.Instance.Angle = rotate.Angle;
1937
        }
1938

    
1939
        public void PlaceImageSymbol(string id, long group_id, int SelectedIndex, Point canvasZoomPanningMouseDownPoint)
1940
        {
1941
            string Data_ = "";
1942

    
1943
            try
1944
            {
1945
                Logger.sendReqLog("GetSymbolImageURL: ", id + "," + SelectedIndex, 1);
1946
                Data_ = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetSymbolImageURL(id, SelectedIndex);
1947
                if (Data_ != null || Data_ != "")
1948
                {
1949
                    Logger.sendResLog("GetSymbolImageURL", "TRUE", 1);
1950
                }
1951
                else
1952
                {
1953
                    Logger.sendResLog("GetSymbolImageURL", "FALSE", 1);
1954
                }
1955

    
1956
                //MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
1957
                //{
1958
                //    SYMBOL_ID = id,//InnerItem.Symbol_ID
1959
                //    STATE = 0,
1960
                //};
1961
                if (Data_ != null)
1962
                {
1963
                    Image img = new Image();
1964
                    //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(Data_));
1965
                    if (Data_.Contains(".svg"))
1966
                    {
1967
                        byte[] imageData = null;
1968
                        DrawingImage image = null;
1969
                        using (System.Net.WebClient web = new System.Net.WebClient())
1970
                        {
1971
                            imageData = web.DownloadData(new Uri(Data_));
1972
                            System.IO.Stream stream = new System.IO.MemoryStream(imageData);
1973
                            image = SvgReader.Load(stream);
1974
                        }
1975
                        img.Source = image;
1976
                    }
1977
                    else
1978
                    {
1979
                        img.Source = new BitmapImage(new Uri(Data_));
1980
                    }
1981

    
1982
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
1983
                    {
1984
                        PointSet = new List<Point>(),
1985
                        FilePath = Data_,
1986
                        ImageData = img.Source,
1987
                        StartPoint = canvasZoomPanningMouseDownPoint,
1988
                        EndPoint = new Point(canvasZoomPanningMouseDownPoint.X + img.Source.Width, 
1989
                        canvasZoomPanningMouseDownPoint.Y + img.Source.Height),
1990
                        TopRightPoint = new Point(canvasZoomPanningMouseDownPoint.X+img.Source.Width,
1991
                        canvasZoomPanningMouseDownPoint.Y),
1992
                        LeftBottomPoint = new Point(canvasZoomPanningMouseDownPoint.X,
1993
                        canvasZoomPanningMouseDownPoint.Y + img.Source.Height)
1994
                    };
1995

    
1996
                    currentControl.PointSet = new List<Point>
1997
                                        {
1998
                                            currentControl.StartPoint,
1999
                                            currentControl.LeftBottomPoint,
2000
                                            currentControl.EndPoint,
2001
                                            currentControl.TopRightPoint,
2002
                                        };
2003
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2004
                    UndoData = new Undo_data()
2005
                    {
2006
                        IsUndo = false,
2007
                        Event = Event_Type.Create,
2008
                        EventTime = DateTime.Now,
2009
                        Markup_List = new List<Multi_Undo_data>()
2010
                    };
2011
                    ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2012
                    {
2013
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
2014
                    });
2015

    
2016
                    //multi_Undo_Data = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2017
                    multi_Undo_Data = Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2018
                    UndoData.Markup_List.Add(multi_Undo_Data);
2019
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2020

    
2021
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2022
                    currentControl.CommentID = Commons.shortGuid();
2023
                    currentControl.SymbolID = id;
2024
                    currentControl.GroupID = group_id;
2025
                    currentControl.ApplyTemplate();
2026
                    currentControl.SetImage();
2027

    
2028
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2029
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2030
                    SelectLayer.Children.Add(final);
2031
                }
2032
            }
2033
            catch (Exception ex)
2034
            {
2035
                this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(ex.Message, "Error");
2036
            }
2037
        }
2038

    
2039
        private void zoomAndPanControl_MouseDown(object sender, MouseButtonEventArgs e)
2040
        {            
2041
            var set_option = this.ParentOfType<MainWindow>().dzTopMenu.Parent.ChildrenOfType<RadNumericUpDown>().Where(item => item.IsKeyboardFocusWithin).FirstOrDefault();
2042
            if (set_option != null && !string.IsNullOrEmpty(set_option.ContentText))
2043
            {
2044
                set_option.Value = double.Parse(set_option.ContentText);
2045
            }
2046

    
2047
            InkControl_Convert();
2048

    
2049
            ///TODO:
2050
            var text_item = ViewerDataModel.Instance.MarkupControls_USER.Where(data =>
2051
            (data as TextControl) != null && (data as TextControl).Text == "" || (data as ArrowTextControl) != null && (data as ArrowTextControl).ArrowText == "").FirstOrDefault();
2052

    
2053
            if (text_item != null && (currentControl as ArrowTextControl) == null)
2054
            {
2055
                ViewerDataModel.Instance.MarkupControls_USER.Remove(text_item);
2056
            }
2057
            /// up to here
2058

    
2059
            foreach (var arrow_text in ViewerDataModel.Instance.MarkupControls_USER)
2060
            {
2061
                if (arrow_text as ArrowTextControl != null)
2062
                {
2063
                    (arrow_text as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
2064
                }
2065
            }
2066

    
2067
            //if (currentControl != null)
2068
            {
2069
                var text_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as TextControl) != null && (data as TextControl).Base_TextBox.Visibility == Visibility.Visible).FirstOrDefault();
2070
                if (text_item_ != null)
2071
                {
2072
                    (text_item_ as TextControl).Base_TextBlock.Visibility = Visibility.Visible;
2073
                    (text_item_ as TextControl).Base_TextBox.Visibility = Visibility.Collapsed;
2074
                    (text_item_ as TextControl).IsEditing = false;
2075
                    (text_item_ as TextControl).EnableEditing = false;
2076
                    currentControl = null;
2077
                }
2078

    
2079
                var Arrowtext_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as ArrowTextControl) != null && (data as ArrowTextControl).IsEditingMode == true).FirstOrDefault();
2080
                if (Arrowtext_item_ != null && ((Arrowtext_item_ as ArrowTextControl).IsNew == false))
2081
                {
2082
                    (Arrowtext_item_ as ArrowTextControl).IsEditingMode = false;
2083
                    (Arrowtext_item_ as ArrowTextControl).Base_TextBox.Focusable = false;
2084
                    currentControl = null;
2085
                }
2086
            }
2087

    
2088
            double Ang = 0;                                          
2089
            if (rotate.Angle != 0)
2090
            {
2091
                Ang = 360 - rotate.Angle;
2092
            }
2093

    
2094
            if (e.OriginalSource is System.Windows.Controls.Image)
2095
            {
2096
                (e.OriginalSource as System.Windows.Controls.Image).Focus();
2097
            }
2098

    
2099
            if (mouseHandlingMode == MouseHandlingMode.DragSymbol && e.LeftButton == MouseButtonState.Pressed)
2100
            {                
2101
                canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2102
                if(symbol_id != null)
2103
                {
2104
                    PlaceImageSymbol(symbol_id, symbol_group_id, symbol_SelectedIndex, canvasZoomPanningMouseDownPoint);
2105
                }                
2106
            }
2107

    
2108
            if (mouseHandlingMode == MouseHandlingMode.DragSymbol && e.RightButton == MouseButtonState.Pressed)
2109
            {
2110
                if (this._dragdropWindow != null)
2111
                {
2112
                    this._dragdropWindow.Close();
2113
                    this._dragdropWindow = null;
2114
                    symbol_id = null;
2115
                }
2116
            }
2117

    
2118
            if (e.LeftButton == MouseButtonState.Pressed)
2119
            {
2120
                canvasDrawingMouseDownPoint = e.GetPosition(drawingRotateCanvas);
2121
                canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2122

    
2123
                this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
2124
                SetCursor();
2125

    
2126
                if (!ViewerDataModel.Instance.IsPressCtrl) SelectionSet.Instance.UnSelect(this);
2127
            }
2128

    
2129
            if (e.MiddleButton == MouseButtonState.Pressed)
2130
            {
2131
                canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2132
                cursor = Cursors.SizeAll;
2133
                SetCursor();
2134
            }
2135
            if (e.RightButton == MouseButtonState.Pressed)
2136
            {
2137
                canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
2138
                cursor = Cursors.SizeAll;
2139
                SetCursor();
2140
            }
2141
            else if (e.XButton1 == MouseButtonState.Pressed)
2142
            {
2143
                if (this.pageNavigator.CurrentPage.PageNumber + 1 <= this.pageNavigator.PageCount)
2144
                {
2145
                    this.pageNavigator.GotoPage(this.pageNavigator._NextPage.PageNumber + 1);
2146
                }
2147

    
2148
                this.pageNavigator.GotoPage(this.pageNavigator._NextPage.PageNumber);
2149

    
2150
            }
2151
            else if (e.XButton2 == MouseButtonState.Pressed)
2152
            {
2153
                if (this.pageNavigator.CurrentPage.PageNumber > 1)
2154
                {
2155
                    this.pageNavigator.GotoPage(this.pageNavigator.CurrentPage.PageNumber - 1);
2156
                }
2157
            }
2158

    
2159
            if (e.LeftButton == MouseButtonState.Pressed && mouseHandlingMode != MouseHandlingMode.Drawing && currentControl == null)
2160
            {
2161
                if (mouseHandlingMode == MouseHandlingMode.Selecting)
2162
                {
2163
                    if (SelectLayer.Children.Count == 0)
2164
                    {
2165
                        isLeftMouseButtonDownOnWindow = true;
2166
                        mouseHandlingMode = MouseHandlingMode.Selecting;
2167
                    }
2168

    
2169
                    if (controlType == ControlType.None)
2170
                    {
2171
                        isLeftMouseButtonDownOnWindow = true;
2172
                    }
2173
                }
2174

    
2175
                /// 캡쳐 모드 설정
2176
                if (mouseHandlingMode == MouseHandlingMode.Capture)
2177
                {
2178
                    dragCaptureBorder.Visibility = Visibility.Visible;
2179
                    isLeftMouseButtonDownOnWindow = true;
2180
                }
2181

    
2182
                /// 줌 모드 설정
2183
                if (mouseHandlingMode == MouseHandlingMode.DragZoom)
2184
                {
2185
                    isLeftMouseButtonDownOnWindow = true;
2186
                }
2187

    
2188
                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
2189
                if (control != null)
2190
                {
2191
                    AdornerFinal final = null;
2192

    
2193
                    if (!ViewerDataModel.Instance.IsPressCtrl)
2194
                    {
2195
                        /// 기존 selection 해제
2196
                        SelectionSet.Instance.UnSelect(this);
2197

    
2198
                        final = new AdornerFinal(control);
2199

    
2200
                        this.Control_Style(control);
2201

    
2202
                        if ((control as IPath) != null)
2203
                        {
2204
                            if ((control as IPath).LineSize != 0)
2205
                            {
2206
                                ViewerDataModel.Instance.LineSize = (control as IPath).LineSize;
2207
                            }
2208
                        }
2209
                        if ((control as IShapeControl) != null)
2210
                        {
2211
                            if ((control as IShapeControl).Paint == PaintSet.Hatch)
2212
                            {
2213
                                ViewerDataModel.Instance.checkHatchShape = true;
2214
                            }
2215
                            else if ((control as IShapeControl).Paint == PaintSet.Fill)
2216
                            {
2217
                                ViewerDataModel.Instance.checkFillShape = true;
2218
                            }
2219
                            else
2220
                            {
2221
                                ViewerDataModel.Instance.checkHatchShape = false;
2222
                                ViewerDataModel.Instance.checkFillShape = false;
2223
                            }
2224
                            ViewerDataModel.Instance.paintSet = (control as IShapeControl).Paint;
2225
                        }
2226

    
2227
                        ViewerDataModel.Instance.ControlOpacity = control.Opacity;
2228

    
2229
                        if ((control as TextControl) != null)
2230
                        {
2231
                            if ((control as TextControl).TextStyle == FontStyles.Italic)
2232
                            {
2233
                                ViewerDataModel.Instance.checkTextStyle = true;
2234
                            }
2235
                            else
2236
                            {
2237
                                ViewerDataModel.Instance.checkTextStyle = false;
2238
                            }
2239

    
2240
                            if ((control as TextControl).TextStyle == FontStyles.Italic)
2241
                            {
2242
                                ViewerDataModel.Instance.checkTextStyle = true;
2243
                            }
2244
                            else
2245
                            {
2246
                                ViewerDataModel.Instance.checkTextStyle = false;
2247
                            }
2248
                            if ((control as TextControl).TextWeight == FontWeights.Bold)
2249
                            {
2250
                                ViewerDataModel.Instance.checkTextWeight = true;
2251
                            }
2252
                            else
2253
                            {
2254
                                ViewerDataModel.Instance.checkTextWeight = false;
2255
                            }
2256
                            if ((control as TextControl).UnderLine == TextDecorations.Underline)
2257
                            {
2258
                                ViewerDataModel.Instance.checkUnderLine = true;
2259
                            }
2260
                            else
2261
                            {
2262
                                ViewerDataModel.Instance.checkUnderLine = false;
2263
                            }
2264
                            ViewerDataModel.Instance.TextSize = (control as TextControl).TextSize;
2265
                            ViewerDataModel.Instance.checkHighlight = (control as TextControl).IsHighLight;
2266

    
2267
                        }
2268
                        else if ((control as ArrowTextControl) != null)
2269
                        {
2270
                            if ((control as ArrowTextControl).TextStyle == FontStyles.Italic)
2271
                            {
2272
                                ViewerDataModel.Instance.checkTextStyle = true;
2273
                            }
2274
                            else
2275
                            {
2276
                                ViewerDataModel.Instance.checkTextStyle = false;
2277
                            }
2278

    
2279
                            if ((control as ArrowTextControl).TextStyle == FontStyles.Italic)
2280
                            {
2281
                                ViewerDataModel.Instance.checkTextStyle = true;
2282
                            }
2283
                            else
2284
                            {
2285
                                ViewerDataModel.Instance.checkTextStyle = false;
2286
                            }
2287
                            if ((control as ArrowTextControl).TextWeight == FontWeights.Bold)
2288
                            {
2289
                                ViewerDataModel.Instance.checkTextWeight = true;
2290
                            }
2291
                            else
2292
                            {
2293
                                ViewerDataModel.Instance.checkTextWeight = false;
2294
                            }
2295
                            if ((control as ArrowTextControl).UnderLine == TextDecorations.Underline)
2296
                            {
2297
                                ViewerDataModel.Instance.checkUnderLine = true;
2298
                            }
2299
                            else
2300
                            {
2301
                                ViewerDataModel.Instance.checkUnderLine = false;
2302
                            }
2303
                            ViewerDataModel.Instance.checkHighlight = (control as ArrowTextControl).isHighLight;
2304
                            ViewerDataModel.Instance.TextSize = (control as ArrowTextControl).TextSize;
2305
                        }
2306
                        else if ((control as RectCloudControl) != null)
2307
                        {
2308
                            ViewerDataModel.Instance.ArcLength = (control as RectCloudControl).ArcLength;
2309
                        }
2310
                        else if ((control as CloudControl) != null)
2311
                        {
2312
                            ViewerDataModel.Instance.ArcLength = (control as CloudControl).ArcLength;
2313
                        }
2314
                    }
2315
                    else
2316
                    {
2317
                        List<CommentUserInfo> comment = SelectionSet.Instance.SelectedItems;
2318
                        SelectionSet.Instance.UnSelect(this);
2319
                        comment.Add(control);
2320

    
2321
                        Control_Style(control);
2322

    
2323
                        final = new AdornerFinal(comment);
2324
                    }
2325

    
2326
                    if (final != null)
2327
                    {
2328
                        this.SelectLayer.Children.Add(final);
2329
                    }
2330
                }              
2331
            }
2332
            else if (mouseHandlingMode == MouseHandlingMode.Drawing)
2333
            {               
2334
                init();
2335
                //강인구 추가(우 클릭 일 경우 커서 변경 하지 않음)
2336
                if (cursor != Cursors.SizeAll)
2337
                {
2338
                    cursor = Cursors.Cross;
2339
                    SetCursor();
2340
                }
2341
                bool init_user = false;
2342
                foreach (var user in gridViewMarkup.Items)
2343
                {
2344
                    if ((user as MarkupInfoItem).UserID == App.ViewInfo.UserID)
2345
                    {
2346
                        init_user = true;
2347
                    }
2348
                }
2349
                if (init_user && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null && e.LeftButton == MouseButtonState.Pressed)
2350
                {
2351
                    RadWindow.Alert(new DialogParameters
2352
                    {
2353
                        Owner = Application.Current.MainWindow,
2354
                        Theme = new VisualStudio2013Theme(),
2355
                        Header = "안내",
2356
                        Content = "기존의 코멘트가 존재합니다. 사용자 리스트에서 먼저 선택해주세요",
2357
                    });
2358
                    return;
2359
                }
2360
                else
2361
                {
2362
                    var item = gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() as MarkupInfoItem;
2363
                    if (item != null)
2364
                    {
2365
                        App.Custom_ViewInfoId = item.MarkupInfoID;
2366
                    }
2367
                }
2368

    
2369
                switch (controlType)
2370
                {
2371
                    case ControlType.Coordinate:
2372
                        {
2373
                            if (e.LeftButton == MouseButtonState.Pressed)
2374
                            {
2375
                                if (currentControl is CoordinateControl)
2376
                                {
2377
                                    if (IsGetoutpoint((currentControl as CoordinateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2378
                                    {
2379
                                        return;
2380
                                    }
2381

    
2382
                                    CreateCommand.Instance.Execute(currentControl);
2383

    
2384
                                    currentControl = null;
2385
                                    this.cursor = Cursors.Arrow;
2386
                                }
2387
                                else
2388
                                {
2389
                                    this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
2390
                                    if (ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber
2391
                                     && d.Data_Type == Convert.ToInt32(MarkupToPDF.Controls.Common.ControlType.Coordinate)).Count() > 0)
2392
                                    {
2393
                                        currentControl = null;
2394
                                        this.cursor = Cursors.Arrow;
2395
                                        Common.ViewerDataModel.Instance.SystemMain.DialogMessage_Alert("이미 해당 페이지의 도면 영역을 설정하셨습니다.", "Notice");
2396
                                        return;
2397
                                    }
2398
                                    else
2399
                                    {
2400
                                        currentControl = new CoordinateControl
2401
                                        {
2402
                                            Background = new SolidColorBrush(Colors.Black),
2403
                                            ControlType = ControlType.Coordinate
2404
                                        };
2405

    
2406
                                        currentControl.CommentID = Commons.shortGuid();
2407
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2408
                                        currentControl.IsNew = true;
2409

    
2410
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2411

    
2412
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
2413
                                    }
2414
                                }
2415
                            }
2416
                        }
2417
                        break;
2418
                    case ControlType.InsideWhite:
2419
                        {
2420
                            if (e.LeftButton == MouseButtonState.Pressed)
2421
                            {
2422
                                if (currentControl is InsideWhiteControl)
2423
                                {
2424
                                    if (IsGetoutpoint((currentControl as InsideWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2425
                                    {
2426
                                        return;
2427
                                    }
2428

    
2429
                                    CreateCommand.Instance.Execute(currentControl);
2430

    
2431
                                    currentControl = null;
2432
                                    this.cursor = Cursors.Arrow;
2433
                                }
2434
                                else
2435
                                {
2436
                                    currentControl = new InsideWhiteControl
2437
                                    {
2438
                                        Background = new SolidColorBrush(Colors.Black),
2439
                                        ControlType = ControlType.InsideWhite
2440
                                    };
2441

    
2442
                                    currentControl.CommentID = Commons.shortGuid();
2443
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2444
                                    currentControl.IsNew = true;
2445
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2446

    
2447
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
2448
                                }
2449
                            }
2450
                        }
2451
                        break;
2452
                    case ControlType.OverlapWhite:
2453
                        {
2454
                            if (e.LeftButton == MouseButtonState.Pressed)
2455
                            {
2456
                                if (currentControl is OverlapWhiteControl)
2457
                                {
2458
                                    if (IsGetoutpoint((currentControl as OverlapWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2459
                                    {
2460
                                        return;
2461
                                    }
2462

    
2463
                                    CreateCommand.Instance.Execute(currentControl);
2464

    
2465
                                    currentControl = null;
2466
                                    this.cursor = Cursors.Arrow;
2467
                                }
2468
                                else
2469
                                {
2470
                                    currentControl = new OverlapWhiteControl
2471
                                    {
2472
                                        Background = new SolidColorBrush(Colors.Black),
2473
                                        ControlType = ControlType.OverlapWhite
2474
                                    };
2475

    
2476
                                    currentControl.CommentID = Commons.shortGuid();
2477
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2478
                                    currentControl.IsNew = true;
2479
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2480

    
2481
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
2482
                                }
2483
                            }
2484
                        }
2485
                        break;
2486
                    case ControlType.ClipWhite:
2487
                        {
2488
                            if (e.LeftButton == MouseButtonState.Pressed)
2489
                            {
2490
                                if (currentControl is ClipWhiteControl)
2491
                                {
2492
                                    if (IsGetoutpoint((currentControl as ClipWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2493
                                    {
2494
                                        return;
2495
                                    }
2496

    
2497
                                    CreateCommand.Instance.Execute(currentControl);
2498

    
2499
                                    currentControl = null;
2500
                                    this.cursor = Cursors.Arrow;
2501
                                }
2502
                                else
2503
                                {
2504
                                    currentControl = new ClipWhiteControl
2505
                                    {
2506
                                        Background = new SolidColorBrush(Colors.Black),
2507
                                        StartPoint = this.canvasDrawingMouseDownPoint,
2508
                                        ControlType = ControlType.ClipWhite
2509
                                    };
2510

    
2511
                                    currentControl.CommentID = Commons.shortGuid();
2512
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2513
                                    currentControl.IsNew = true;
2514
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2515

    
2516
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
2517
                                }
2518
                            }
2519
                        }
2520
                        break;
2521
                    case ControlType.Rectangle:
2522
                        {
2523
                            if (e.LeftButton == MouseButtonState.Pressed)
2524
                            {
2525
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
2526
                                //{
2527
                                    if (currentControl is RectangleControl)
2528
                                    {
2529
                                        //20180906 LJY TEST IsRotationDrawingEnable
2530
                                        if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2531
                                        {
2532
                                            return;
2533
                                        }
2534

    
2535
                                        CreateCommand.Instance.Execute(currentControl);
2536

    
2537
                                        currentControl = null;
2538
                                    
2539
                                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
2540
                                    }
2541
                                    else
2542
                                    {
2543
                                        currentControl = new RectangleControl
2544
                                        {
2545
                                            Background = new SolidColorBrush(Colors.Black),
2546
                                            StartPoint = this.canvasDrawingMouseDownPoint,
2547
                                            ControlType = ControlType.Rectangle
2548
                                        };
2549

    
2550
                                        currentControl.CommentID = Commons.shortGuid();
2551
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2552
                                        currentControl.IsNew = true;
2553
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2554

    
2555
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
2556
                                    }
2557
                                //}
2558
                            }
2559
                        }
2560
                        break;
2561
                    case ControlType.RectCloud:
2562
                        {
2563
                            if (e.LeftButton == MouseButtonState.Pressed)
2564
                            {
2565
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
2566
                                //{
2567
                                    if (currentControl is RectCloudControl)
2568
                                    {
2569
                                        //20180906 LJY TEST IsRotationDrawingEnable
2570
                                        if (IsGetoutpoint((currentControl as RectCloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2571
                                        {
2572
                                            return;
2573
                                        }
2574

    
2575
                                        CreateCommand.Instance.Execute(currentControl);
2576

    
2577
                                        currentControl = null;
2578
                                    
2579
                                        this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
2580
                                    }
2581
                                    else
2582
                                    {
2583
                                        currentControl = new RectCloudControl
2584
                                        {
2585
                                            StartPoint = this.canvasDrawingMouseDownPoint,
2586
                                            ControlType = ControlType.RectCloud,
2587
                                            Background = new SolidColorBrush(Colors.Black)
2588
                                        };
2589

    
2590
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2591
                                        currentControl.CommentID = Commons.shortGuid();
2592
                                        currentControl.IsNew = true;
2593
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2594
                                    }
2595
                                //}
2596
                            }
2597
                        }
2598
                        break;
2599
                    case ControlType.Circle:
2600
                        {
2601
                            if (e.LeftButton == MouseButtonState.Pressed)
2602
                            {
2603
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
2604
                                //{
2605
                                    if (currentControl is CircleControl)
2606
                                    {
2607
                                        //20180906 LJY TEST IsRotationDrawingEnable
2608
                                        if (IsGetoutpoint((currentControl as CircleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2609
                                        {
2610
                                            return;
2611
                                        }
2612

    
2613
                                        CreateCommand.Instance.Execute(currentControl);
2614

    
2615
                                        currentControl = null;
2616
                                    }
2617
                                    else
2618
                                    {
2619
                                        currentControl = new CircleControl
2620
                                        {
2621
                                            StartPoint = this.canvasDrawingMouseDownPoint,
2622
                                            LeftBottomPoint = this.canvasDrawingMouseDownPoint,
2623
                                            Background = new SolidColorBrush(Colors.Black)
2624
                                        };
2625

    
2626
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2627
                                        currentControl.CommentID = Commons.shortGuid();
2628
                                        currentControl.IsNew = true;
2629
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2630
                                    }
2631
                                //}
2632
                            }
2633
                        }
2634
                        break;
2635
                    case ControlType.Triangle:
2636
                        {
2637
                            if (e.LeftButton == MouseButtonState.Pressed)
2638
                            {
2639
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
2640
                                //{
2641
                                    if (currentControl is TriControl)
2642
                                    {
2643
                                        var content = currentControl as TriControl;
2644
                                        if (content.MidPoint == new Point(0, 0))
2645
                                        {
2646
                                            content.MidPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2647
                                        }
2648
                                        else
2649
                                        {
2650
                                            //20180906 LJY TEST IsRotationDrawingEnable
2651
                                            if (IsGetoutpoint((currentControl as TriControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2652
                                            {
2653
                                                return;
2654
                                            }
2655

    
2656
                                            CreateCommand.Instance.Execute(currentControl);
2657

    
2658
                                            currentControl = null;
2659
                                        }
2660
                                    }
2661
                                    else
2662
                                    {
2663
                                        currentControl = new TriControl
2664
                                        {
2665
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
2666
                                            Background = new SolidColorBrush(Colors.Black),
2667
                                        };
2668

    
2669
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2670
                                        currentControl.CommentID = Commons.shortGuid();
2671
                                        currentControl.IsNew = true;
2672
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2673
                                    }
2674
                                //}
2675
                            }
2676
                        }
2677
                        break;
2678
                    case ControlType.SingleLine:
2679
                        {
2680
                            if (e.LeftButton == MouseButtonState.Pressed)
2681
                            {
2682
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
2683
                                //{
2684
                                    if (currentControl is LineControl)
2685
                                    {
2686
                                        //20180906 LJY TEST IsRotationDrawingEnable
2687
                                        if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2688
                                        {
2689
                                            return;
2690
                                        }
2691

    
2692
                                        CreateCommand.Instance.Execute(currentControl);
2693

    
2694
                                        currentControl = null;
2695
                                        this.MainAngle.Visibility = Visibility.Collapsed;
2696
                                    }
2697
                                    else
2698
                                    {
2699
                                        currentControl = new LineControl
2700
                                        {
2701
                                            ControlType = ControlType.SingleLine,
2702
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
2703
                                            Background = new SolidColorBrush(Colors.Black)
2704
                                        };
2705

    
2706
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2707
                                        currentControl.CommentID = Commons.shortGuid();
2708
                                        currentControl.IsNew = true;
2709
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2710
                                        this.MainAngle.Visibility = Visibility.Visible;
2711
                                    }
2712
                                //}
2713
                            }
2714
                        }
2715
                        break;
2716
                    case ControlType.CancelLine:
2717
                        {
2718
                            if (e.LeftButton == MouseButtonState.Pressed)
2719
                            {
2720
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
2721
                                //{
2722
                                    if (currentControl is LineControl)
2723
                                    {
2724
                                        //20180906 LJY TEST IsRotationDrawingEnable
2725
                                        if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2726
                                        {
2727
                                            return;
2728
                                        }
2729

    
2730
                                        CreateCommand.Instance.Execute(currentControl);
2731

    
2732
                                        currentControl = null;
2733
                                        this.MainAngle.Visibility = Visibility.Collapsed;
2734
                                    }
2735
                                    else
2736
                                    {
2737
                                        currentControl = new LineControl
2738
                                        {
2739
                                            ControlType = ControlType.CancelLine,
2740
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
2741
                                            Background = new SolidColorBrush(Colors.Black)
2742
                                        };
2743

    
2744
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2745
                                        currentControl.CommentID = Commons.shortGuid();
2746
                                        currentControl.IsNew = true;
2747
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2748
                                        this.MainAngle.Visibility = Visibility.Visible;
2749
                                    }
2750
                                //}
2751
                            }
2752
                        }
2753
                        break;
2754
                    case ControlType.ArrowLine:
2755
                        {
2756
                            if (e.LeftButton == MouseButtonState.Pressed)
2757
                            {
2758
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
2759
                                //{
2760
                                    if (currentControl is LineControl)
2761
                                    {
2762
                                        //20180906 LJY TEST IsRotationDrawingEnable
2763
                                        if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2764
                                        {
2765
                                            return;
2766
                                        }
2767

    
2768
                                        CreateCommand.Instance.Execute(currentControl);
2769

    
2770
                                        currentControl = null;
2771
                                        this.MainAngle.Visibility = Visibility.Collapsed;
2772
                                    }
2773
                                    else
2774
                                    {
2775
                                        currentControl = new LineControl
2776
                                        {
2777
                                            ControlType = ControlType.ArrowLine,
2778
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
2779
                                            Background = new SolidColorBrush(Colors.Black)
2780
                                        };
2781

    
2782
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2783
                                        currentControl.CommentID = Commons.shortGuid();
2784
                                        currentControl.IsNew = true;
2785
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2786
                                        this.MainAngle.Visibility = Visibility.Visible;
2787
                                    }
2788
                                //}
2789
                            }
2790
                        }
2791
                        break;
2792
                    case ControlType.TwinLine:
2793
                        {
2794
                            if (e.LeftButton == MouseButtonState.Pressed)
2795
                            {
2796
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
2797
                                //{
2798
                                    if (currentControl is LineControl)
2799
                                    {
2800
                                        //20180906 LJY TEST IsRotationDrawingEnable
2801
                                        if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2802
                                        {
2803
                                            return;
2804
                                        }
2805

    
2806
                                        CreateCommand.Instance.Execute(currentControl);
2807

    
2808
                                        currentControl = null;
2809
                                        this.MainAngle.Visibility = Visibility.Collapsed;
2810
                                    }
2811
                                    else
2812
                                    {
2813
                                        currentControl = new LineControl
2814
                                        {
2815
                                            ControlType = ControlType.TwinLine,
2816
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
2817
                                            Background = new SolidColorBrush(Colors.Black)
2818
                                        };
2819
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2820
                                        currentControl.CommentID = Commons.shortGuid();
2821
                                        currentControl.IsNew = true;
2822
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2823
                                        this.MainAngle.Visibility = Visibility.Visible;
2824
                                    }
2825
                                //}
2826
                            }
2827
                        }
2828
                        break;
2829
                    case ControlType.DimLine:
2830
                        {
2831
                            if (e.LeftButton == MouseButtonState.Pressed)
2832
                            {
2833
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
2834
                                //{
2835
                                    if (currentControl is LineControl)
2836
                                    {
2837
                                        //20180906 LJY TEST IsRotationDrawingEnable
2838
                                        if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2839
                                        {
2840
                                            return;
2841
                                        }
2842
                                        CreateCommand.Instance.Execute(currentControl);
2843

    
2844
                                        currentControl = null;
2845
                                        this.MainAngle.Visibility = Visibility.Collapsed;
2846
                                    }
2847
                                    else
2848
                                    {
2849
                                        currentControl = new LineControl
2850
                                        {
2851
                                            ControlType = ControlType.DimLine,
2852
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
2853
                                            Background = new SolidColorBrush(Colors.Black)
2854
                                        };
2855
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2856
                                        currentControl.CommentID = Commons.shortGuid();
2857
                                        currentControl.IsNew = true;
2858
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2859
                                        this.MainAngle.Visibility = Visibility.Visible;
2860
                                    }
2861
                                //}
2862
                            }
2863
                        }
2864
                        break;
2865
                    case ControlType.ChainLine:
2866
                        {
2867
                            if (currentControl is PolygonControl)
2868
                            {
2869
                                var control = currentControl as PolygonControl;
2870

    
2871
                                if (e.RightButton == MouseButtonState.Pressed)
2872
                                {
2873
                                    //20180906 LJY TEST IsRotationDrawingEnable
2874
                                    if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2875
                                    {
2876
                                        return;
2877
                                    }
2878

    
2879
                                    CreateCommand.Instance.Execute(currentControl);
2880

    
2881
                                    currentControl = null;
2882
                                    this.MainAngle.Visibility = Visibility.Collapsed;
2883
                                    return;
2884
                                }
2885

    
2886
                                if (!control.IsCompleted)
2887
                                {
2888
                                    control.PointSet.Add(control.EndPoint);
2889
                                    this.MainAngle.Visibility = Visibility.Visible;
2890
                                }
2891
                            }
2892
                            else
2893
                            {
2894
                                if (e.LeftButton == MouseButtonState.Pressed)
2895
                                {
2896
                                    MainAngle.Visibility = Visibility.Visible;
2897
                                    currentControl = new PolygonControl
2898
                                    {
2899
                                        PointSet = new List<Point>(),
2900
                                        //강인구 추가(ChainLine일때는 채우기 스타일을 주지 않기 위해 설정)
2901
                                        ControlType = ControlType.ChainLine,
2902
                                        DashSize = ViewerDataModel.Instance.DashSize,
2903
                                        LineSize = ViewerDataModel.Instance.LineSize,
2904
                                        //PointC = new StylusPointSet()
2905
                                    };
2906

    
2907
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
2908
                                    //{
2909
                                        var polygonControl = (currentControl as PolygonControl);
2910
                                        currentControl.CommentID = Commons.shortGuid();
2911
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2912
                                        currentControl.IsNew = true;
2913
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2914
                                        //currentControl.OnApplyTemplate();
2915
                                        //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint);
2916
                                        //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint);
2917
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
2918
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
2919
                                    //}
2920
                                }
2921
                            }
2922
                        }
2923
                        break;
2924
                    case ControlType.ArcLine:
2925
                        {
2926
                            if (e.LeftButton == MouseButtonState.Pressed)
2927
                            {
2928
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
2929
                                //{
2930
                                    if (currentControl is ArcControl)
2931
                                    {
2932
                                        //20180906 LJY TEST IsRotationDrawingEnable
2933
                                        if (IsGetoutpoint((currentControl as ArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2934
                                        {
2935
                                            return;
2936
                                        }
2937

    
2938
                                        CreateCommand.Instance.Execute(currentControl);
2939

    
2940
                                        currentControl = null;
2941
                                        this.MainAngle.Visibility = Visibility.Collapsed;
2942
                                    }
2943
                                    else
2944
                                    {
2945
                                        currentControl = new ArcControl
2946
                                        {
2947
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
2948
                                            Background = new SolidColorBrush(Colors.Black)
2949
                                        };
2950
                                        currentControl.CommentID = Commons.shortGuid();
2951
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2952
                                        currentControl.IsNew = true;
2953
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2954
                                        this.MainAngle.Visibility = Visibility.Visible;
2955
                                    }
2956
                                //}
2957
                            }
2958
                            else if (e.RightButton == MouseButtonState.Pressed)
2959
                            {
2960
                                if (currentControl != null)
2961
                                {
2962
                                    (currentControl as ArcControl).setClock();
2963
                                    (currentControl as ArcControl).MidPoint = new Point(0, 0);
2964
                                    //(currentControl as ArcControl).ApplyTemplate();
2965
                                }
2966
                            }
2967
                        }
2968
                        break;
2969
                    case ControlType.ArcArrow:
2970
                        {
2971
                            if (e.LeftButton == MouseButtonState.Pressed)
2972
                            {
2973
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
2974
                                //{
2975
                                if (currentControl is ArrowArcControl)
2976
                                {
2977
                                    //20180906 LJY TEST IsRotationDrawingEnable
2978
                                    if (IsGetoutpoint((currentControl as ArrowArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
2979
                                    {
2980
                                        return;
2981
                                    }
2982

    
2983
                                    CreateCommand.Instance.Execute(currentControl);
2984

    
2985
                                    currentControl = null;
2986
                                    this.MainAngle.Visibility = Visibility.Collapsed;
2987
                                }
2988
                                else
2989
                                {
2990
                                    currentControl = new ArrowArcControl
2991
                                    {
2992
                                        StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
2993
                                        Background = new SolidColorBrush(Colors.Black)
2994
                                    };
2995
                                    currentControl.CommentID = Commons.shortGuid();
2996
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
2997
                                    currentControl.IsNew = true;
2998
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
2999
                                    this.MainAngle.Visibility = Visibility.Visible;
3000
                                }
3001
                                //}
3002
                            }
3003
                            else if (e.RightButton == MouseButtonState.Pressed)
3004
                            {
3005
                                if (currentControl != null)
3006
                                {
3007
                                    (currentControl as ArrowArcControl).setClock();
3008
                                    (currentControl as ArrowArcControl).MidPoint = new Point(0, 0);
3009
                                    //(currentControl as ArcControl).ApplyTemplate();
3010
                                }
3011
                            }
3012
                        }
3013
                        break;
3014
                    case ControlType.ArrowMultiLine:
3015
                        {
3016
                            if (e.LeftButton == MouseButtonState.Pressed)
3017
                            {
3018
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3019
                                //{
3020

    
3021
                                    if (currentControl is ArrowControl_Multi)
3022
                                    {
3023
                                        var content = currentControl as ArrowControl_Multi;
3024
                                        if (content.MiddlePoint == new Point(0, 0))
3025
                                        {
3026
                                            if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
3027
                                            {
3028
                                                content.MiddlePoint = content.EndPoint;
3029
                                            }
3030
                                            else
3031
                                            {
3032
                                                content.MiddlePoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
3033
                                            }
3034
                                        }
3035
                                        else
3036
                                        {
3037
                                            //20180906 LJY TEST IsRotationDrawingEnable
3038
                                            if (IsGetoutpoint((currentControl as ArrowControl_Multi).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3039
                                            {
3040
                                                return;
3041
                                            }
3042

    
3043
                                            CreateCommand.Instance.Execute(currentControl);
3044

    
3045
                                            currentControl = null;
3046
                                            this.MainAngle.Visibility = Visibility.Collapsed;
3047
                                        }
3048
                                    }
3049
                                    else
3050
                                    {
3051
                                        currentControl = new ArrowControl_Multi
3052
                                        {
3053
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3054
                                            Background = new SolidColorBrush(Colors.Black)
3055
                                        };
3056
                                        currentControl.CommentID = Commons.shortGuid();
3057
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3058
                                        currentControl.IsNew = true;
3059
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3060
                                        this.MainAngle.Visibility = Visibility.Visible;
3061
                                    }
3062
                                //}
3063
                            }
3064
                        }
3065
                        break;
3066
                    case ControlType.PolygonCloud:
3067
                        {
3068
                            if (currentControl is CloudControl)
3069
                            {
3070
                                var control = currentControl as CloudControl;
3071
                                if (e.RightButton == MouseButtonState.Pressed)
3072
                                {
3073
                                    control.IsCompleted = true;
3074
                                }
3075

    
3076
                                if (!control.IsCompleted)
3077
                                {
3078
                                    control.PointSet.Add(control.EndPoint);
3079
                                }
3080
                                else
3081
                                {
3082
                                    //20180906 LJY TEST IsRotationDrawingEnable
3083
                                    if (IsGetoutpoint((currentControl as CloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3084
                                    {
3085
                                        return;
3086
                                    }
3087

    
3088
                                    CreateCommand.Instance.Execute(currentControl);
3089

    
3090
                                    control.isTransOn = true;
3091
                                    var firstPoint = control.PointSet.First();
3092

    
3093
                                    control.PointSet.Add(firstPoint);
3094
                                    control.DrawingCloud();
3095
                                    control.ApplyOverViewData();
3096

    
3097
                                    currentControl = null;
3098
                                }
3099
                            }
3100
                            else
3101
                            {
3102
                                if (e.LeftButton == MouseButtonState.Pressed)
3103
                                {
3104
                                    currentControl = new CloudControl
3105
                                    {
3106
                                        PointSet = new List<Point>(),
3107
                                        PointC = new StylusPointSet()
3108
                                    };
3109

    
3110
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3111
                                    //{
3112
                                        var polygonControl = (currentControl as CloudControl);
3113
                                        currentControl.CommentID = Commons.shortGuid();
3114
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3115
                                        currentControl.IsNew = true;
3116
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3117

    
3118
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3119
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3120
                                    
3121
                                    //}
3122
                                }
3123
                            }
3124
                        }
3125
                        break;
3126
                    case ControlType.ImgControl:
3127
                        {
3128
                            if (e.LeftButton == MouseButtonState.Pressed)
3129
                            {
3130
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3131
                                //{
3132
                                    if (currentControl is ImgControl)
3133
                                    {
3134
                                        //20180906 LJY TEST IsRotationDrawingEnable
3135
                                        if (IsGetoutpoint((currentControl as ImgControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3136
                                        {
3137
                                            return;
3138
                                        }
3139

    
3140
                                        CreateCommand.Instance.Execute(currentControl);
3141
                                        controlType = ControlType.ImgControl;
3142
                                        currentControl = null;
3143
                                    }
3144
                                    else
3145
                                    {
3146
                                        
3147
                                        string extension = System.IO.Path.GetExtension(filename).ToUpper();
3148
                                        if (extension == ".PNG" || extension == ".JPEG" || extension == ".GIF" || extension == ".BMP" || extension == ".JPG" || extension == ".SVG")
3149
                                        {
3150
                                            Image img = new Image();
3151
                                            if (filename.Contains(".svg"))
3152
                                            {
3153
                                                byte[] imageData = null;
3154
                                                DrawingImage image = null;
3155
                                                using (System.Net.WebClient web = new System.Net.WebClient())
3156
                                                {
3157
                                                    imageData = web.DownloadData(new Uri(filename));
3158
                                                    System.IO.Stream stream = new System.IO.MemoryStream(imageData);
3159
                                                    image = SvgReader.Load(stream);
3160
                                                }
3161
                                                img.Source = image;
3162
                                            }
3163
                                            else
3164
                                            {
3165
                                                img.Source = new BitmapImage(new Uri(filename));
3166
                                            }
3167

    
3168
                                            currentControl = new ImgControl
3169
                                            {
3170
                                                    Background = new SolidColorBrush(Colors.Black),
3171
                                                    PointSet = new List<Point>(),
3172
                                                    FilePath = filename,
3173
                                                    ImageData = img.Source,
3174
                                                    StartPoint = canvasDrawingMouseDownPoint,
3175
                                                    EndPoint = new Point(canvasDrawingMouseDownPoint.X + 100, canvasDrawingMouseDownPoint.Y + 100),
3176
                                                    TopRightPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y + 100),
3177
                                                    LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X + 100, canvasDrawingMouseDownPoint.Y),
3178
                                                    ControlType = ControlType.ImgControl
3179
                                                };
3180

    
3181
                                        
3182
                                                currentControl.CommentID = Commons.shortGuid();                                            
3183
                                                currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3184
                                                currentControl.IsNew = true;
3185
                                                ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3186

    
3187
                                                //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
3188
                                                (currentControl as ImgControl).Angle -= rotate.Angle;
3189
                                        }
3190
                                    }
3191
                                //}
3192
                            }
3193
                        }
3194
                        break;
3195
                    case ControlType.Date:
3196
                        {
3197
                            if (e.LeftButton == MouseButtonState.Pressed)
3198
                            {
3199
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3200
                                //{
3201
                                    if (currentControl is DateControl)
3202
                                    {
3203
                                        //20180906 LJY TEST IsRotationDrawingEnable
3204
                                        if (IsGetoutpoint((currentControl as DateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3205
                                        {
3206
                                            return;
3207
                                        }
3208

    
3209
                                        CreateCommand.Instance.Execute(currentControl);
3210
                                        currentControl = null;
3211

    
3212
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
3213
                                        {
3214
                                            controlType = ControlType.None;
3215
                                            IsSwingMode = false;
3216
                                            Common.ViewerDataModel.Instance.SelectedControl = "";
3217
                                            Common.ViewerDataModel.Instance.ControlTag = null;
3218
                                            mouseHandlingMode = MouseHandlingMode.None;
3219
                                            this.ParentOfType<MainWindow>().dzTopMenu.btn_Batch.IsChecked = false;
3220
                                            txtBatch.Visibility = Visibility.Collapsed;
3221

    
3222
                                        }
3223
                                    }
3224
                                    else
3225
                                    {
3226
                                        currentControl = new DateControl
3227
                                        {
3228
                                            StartPoint = canvasDrawingMouseDownPoint,
3229
                                            Background = new SolidColorBrush(Colors.Black)
3230
                                        };
3231
                                        currentControl.CommentID = Commons.shortGuid();
3232
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3233
                                        currentControl.IsNew = true;
3234
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3235

    
3236
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
3237
                                        (currentControl as DateControl).Angle -= rotate.Angle;
3238
                                }
3239
                                //}
3240
                            }
3241
                        }
3242
                        break;
3243
                    case ControlType.TextControl:
3244
                        {
3245
                            if (e.LeftButton == MouseButtonState.Pressed)
3246
                            {
3247
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3248
                                {
3249
                                    currentControl = new TextControl
3250
                                    {
3251
                                        ControlType = controlType
3252
                                    };
3253
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
3254
                                    currentControl.CommentID = Commons.shortGuid();
3255
                                    currentControl.IsNew = true;
3256
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3257
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3258
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3259

    
3260
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
3261
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);
3262
                                    
3263
                                    (currentControl as TextControl).ControlType_No = 0;
3264
                                    (currentControl as TextControl).Angle -= rotate.Angle;
3265
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
3266
                                    (currentControl as TextControl).ApplyTemplate();
3267
                                    (currentControl as TextControl).Base_TextBox.Focus();
3268

    
3269
                                    //System.Diagnostics.Debug.WriteLine("CanvasX" + (currentControl as TextControl).CanvasX);
3270
                                    //System.Diagnostics.Debug.WriteLine("CanvasY" + (currentControl as TextControl).CanvasY);
3271

    
3272
                                    CreateCommand.Instance.Execute(currentControl);
3273

    
3274
                                }
3275
                            }
3276
                        }
3277
                        break;
3278
                    case ControlType.TextBorder:
3279
                        {
3280
                            if (e.LeftButton == MouseButtonState.Pressed)
3281
                            {
3282
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3283
                                {
3284
                                    currentControl = new TextControl
3285
                                    {
3286
                                        ControlType = controlType
3287
                                    };
3288

    
3289
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
3290
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3291
                                    currentControl.CommentID = Commons.shortGuid();
3292
                                    currentControl.IsNew = true;
3293
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3294
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3295
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
3296
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);
3297
                                    
3298
                                    (currentControl as TextControl).ControlType_No = 1;
3299
                                    (currentControl as TextControl).Angle = Ang;
3300
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
3301
                                    (currentControl as TextControl).ApplyTemplate();
3302
                                    (currentControl as TextControl).Base_TextBox.Focus();
3303
                                    CreateCommand.Instance.Execute(currentControl);
3304

    
3305
                                    //currentControl = null;
3306
                                }
3307
                            }
3308
                        }
3309
                        break;
3310
                    case ControlType.TextCloud:
3311
                        {
3312
                            if (e.LeftButton == MouseButtonState.Pressed)
3313
                            {
3314
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3315
                                {
3316
                                    currentControl = new TextControl
3317
                                    {
3318
                                        ControlType = controlType
3319
                                    };
3320

    
3321
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
3322
                                    currentControl.CommentID = Commons.shortGuid();
3323
                                    currentControl.IsNew = true;
3324
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3325
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3326

    
3327
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3328
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
3329
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);                                    
3330

    
3331
                                    (currentControl as TextControl).Angle = Ang;
3332
                                    (currentControl as TextControl).ControlType_No = 2;
3333
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
3334
                                    (currentControl as TextControl).ApplyTemplate();
3335
                                    (currentControl as TextControl).Base_TextBox.Focus();
3336
                                    CreateCommand.Instance.Execute(currentControl);
3337
                                    //currentControl = null;
3338
                                }
3339
                            }
3340
                        }
3341
                        break;
3342
                    case ControlType.ArrowTextControl:
3343
                         {
3344
                            if (e.LeftButton == MouseButtonState.Pressed)
3345
                            {
3346
                                if (currentControl is ArrowTextControl)
3347
                                {
3348
                                    //20180906 LJY TEST IsRotationDrawingEnable
3349
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3350
                                    {
3351
                                        return;
3352
                                    }
3353

    
3354
                                    CreateCommand.Instance.Execute(currentControl);
3355

    
3356
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3357
                                    (currentControl as ArrowTextControl).IsEditing = false;
3358
                                    (currentControl as ArrowTextControl).EnableEditing = false;
3359
                                    (currentControl as ArrowTextControl).IsNew = false;
3360
                                    currentControl = null;
3361
                                }
3362
                                else
3363
                                {
3364
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3365
                                    //{
3366
                                        currentControl = new ArrowTextControl();
3367
                                        currentControl.CommentID = Commons.shortGuid();
3368
                                        currentControl.IsNew = true;
3369
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3370
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3371

    
3372
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3373
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
3374
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);
3375
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
3376
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3377

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

    
3381
                                        (currentControl as ArrowTextControl).ApplyTemplate();
3382
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
3383
                                        this.MainAngle.Visibility = Visibility.Visible;
3384

    
3385
                                    
3386
                                    //}
3387
                                }
3388
                            }
3389
                        }
3390
                        break;
3391
                    case ControlType.ArrowTransTextControl:
3392
                        {
3393
                            if (e.LeftButton == MouseButtonState.Pressed)
3394
                            {
3395
                                if (currentControl is ArrowTextControl)
3396
                                {
3397
                                    //20180906 LJY TEST IsRotationDrawingEnable
3398
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3399
                                    {
3400
                                        return;
3401
                                    }
3402

    
3403
                                    CreateCommand.Instance.Execute(currentControl);
3404
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3405
                                    currentControl.IsNew = false;
3406
                                    currentControl = null;
3407
                                    this.MainAngle.Visibility = Visibility.Collapsed;
3408
                                }
3409
                                else
3410
                                {
3411
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3412
                                    //{
3413
                                         currentControl = new ArrowTextControl();
3414
                                        currentControl.CommentID = Commons.shortGuid();
3415
                                        currentControl.IsNew = true;
3416
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3417
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3418
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3419
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
3420
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                  
3421
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
3422
                                        (currentControl as ArrowTextControl).isFixed = true;
3423
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3424

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

    
3428
                                        (currentControl as ArrowTextControl).ApplyTemplate();
3429
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
3430
                                        (currentControl as ArrowTextControl).isTrans = true;
3431
                                }
3432
                            }
3433
                        }
3434
                        break;
3435
                    case ControlType.ArrowTextBorderControl:
3436
                         {
3437
                            if (e.LeftButton == MouseButtonState.Pressed)
3438
                            {
3439
                                if (currentControl is ArrowTextControl)
3440
                                {
3441
                                    //20180906 LJY TEST IsRotationDrawingEnable
3442
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3443
                                    {
3444
                                        return;
3445
                                    }
3446

    
3447
                                    CreateCommand.Instance.Execute(currentControl);
3448
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3449
                                    currentControl.IsNew = false;
3450
                                    currentControl = null;
3451
                                    this.MainAngle.Visibility = Visibility.Collapsed;
3452
                                }
3453
                                else
3454
                                {
3455
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3456
                                    //{
3457
                                        currentControl = new ArrowTextControl()
3458
                                        {
3459
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect
3460
                                        };
3461
                                        currentControl.CommentID = Commons.shortGuid();
3462
                                        currentControl.IsNew = true;
3463
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3464
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3465

    
3466
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3467

    
3468
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
3469

    
3470
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);
3471
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3472
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
3473

    
3474
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
3475
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
3476
                                        (currentControl as ArrowTextControl).ApplyTemplate();
3477
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
3478
                                        this.MainAngle.Visibility = Visibility.Visible;                                    
3479
                                    //}
3480
                                }
3481
                            }
3482
                        }
3483
                        break;
3484
                    case ControlType.ArrowTransTextBorderControl:
3485
                        {
3486
                            if (e.LeftButton == MouseButtonState.Pressed)
3487
                            {
3488
                                if (currentControl is ArrowTextControl)
3489
                                {
3490
                                    //20180906 LJY TEST IsRotationDrawingEnable
3491
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3492
                                    {
3493
                                        return;
3494
                                    }
3495
                                    CreateCommand.Instance.Execute(currentControl);
3496
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3497
                                    currentControl.IsNew = false;
3498
                                    currentControl = null;
3499
                                    this.MainAngle.Visibility = Visibility.Collapsed;
3500
                                }
3501
                                else
3502
                                {
3503
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3504
                                    //{
3505
                                    
3506

    
3507
                                    currentControl = new ArrowTextControl()
3508
                                        {
3509
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect
3510
                                        };
3511
                                        currentControl.CommentID = Commons.shortGuid();
3512
                                        currentControl.IsNew = true;
3513
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3514
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3515

    
3516
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3517

    
3518
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
3519
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                                    
3520
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
3521
                                        (currentControl as ArrowTextControl).isFixed = true;
3522
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3523
                                     
3524
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
3525
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
3526
                                        (currentControl as ArrowTextControl).ApplyTemplate();
3527

    
3528
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();                                 
3529
                                        this.MainAngle.Visibility = Visibility.Visible;
3530
                                    
3531
                                    //20180911 LJY
3532
                                        (currentControl as ArrowTextControl).isTrans = true;
3533
                                    
3534

    
3535
                                    //}
3536
                                }
3537
                            }
3538
                        }
3539
                        break;
3540
                    case ControlType.ArrowTextCloudControl:
3541
                        {
3542
                            if (e.LeftButton == MouseButtonState.Pressed)
3543
                            {
3544
                                if (currentControl is ArrowTextControl)
3545
                                {
3546
                                    //20180906 LJY TEST IsRotationDrawingEnable
3547
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3548
                                    {
3549
                                        return;
3550
                                    }
3551
                                    CreateCommand.Instance.Execute(currentControl);
3552
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3553
                                    currentControl.IsNew = false;
3554
                                    currentControl = null;
3555
                                    this.MainAngle.Visibility = Visibility.Collapsed;
3556
                                }
3557
                                else
3558
                                {
3559
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3560
                                    //{
3561
                                        currentControl = new ArrowTextControl()
3562
                                        {
3563
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud
3564
                                        };
3565
                                        currentControl.CommentID = Commons.shortGuid();
3566
                                        currentControl.IsNew = true;
3567
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3568
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3569

    
3570
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3571
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
3572
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                                 
3573
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
3574
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3575

    
3576
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
3577
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
3578
                                    
3579
                                        (currentControl as ArrowTextControl).ApplyTemplate();
3580
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
3581
                                        this.MainAngle.Visibility = Visibility.Visible;                                        
3582
                                    //}
3583
                                }
3584
                            }
3585
                        }
3586
                        break;
3587
                    case ControlType.ArrowTransTextCloudControl:
3588
                        {
3589
                            if (e.LeftButton == MouseButtonState.Pressed)
3590
                            {
3591
                                if (currentControl is ArrowTextControl)
3592
                                {
3593
                                    //20180906 LJY TEST IsRotationDrawingEnable
3594
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3595
                                    {
3596
                                        return;
3597
                                    }
3598
                                    CreateCommand.Instance.Execute(currentControl);
3599
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3600
                                    currentControl.IsNew = false;
3601
                                    currentControl = null;
3602
                                    this.MainAngle.Visibility = Visibility.Collapsed;
3603
                                }
3604
                                else
3605
                                {
3606
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3607
                                    //{
3608
                                        currentControl = new ArrowTextControl()
3609
                                        {
3610
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud
3611
                                        };
3612
                                        currentControl.CommentID = Commons.shortGuid();
3613
                                        currentControl.IsNew = true; 
3614
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3615
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3616
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3617

    
3618
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
3619
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                                        
3620
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
3621
                                        (currentControl as ArrowTextControl).isFixed = true;
3622
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
3623

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

    
3627
                                        (currentControl as ArrowTextControl).ApplyTemplate();
3628
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
3629
                                        this.MainAngle.Visibility = Visibility.Visible;  
3630
                                    
3631
                                    //20180911 LJY
3632
                                        (currentControl as ArrowTextControl).isTrans = true;
3633
                                    //}
3634
                                }
3635
                            }
3636
                        }
3637
                        break;
3638
                    case ControlType.PolygonControl:
3639
                        {
3640
                            if (currentControl is PolygonControl)
3641
                            {
3642
                                var control = currentControl as PolygonControl;
3643

    
3644
                                if (e.RightButton == MouseButtonState.Pressed)
3645
                                {
3646
                                    control.IsCompleted = true;
3647
                                }
3648

    
3649
                                if (!control.IsCompleted)
3650
                                {
3651
                                    control.PointSet.Add(control.EndPoint);
3652
                                }
3653
                                else
3654
                                {
3655
                                    //20180906 LJY TEST IsRotationDrawingEnable
3656
                                    if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3657
                                    {
3658
                                        return;
3659
                                    }
3660

    
3661
                                    var firstPoint = control.PointSet.First();
3662
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
3663
                                    control.LineSize = ViewerDataModel.Instance.LineSize;
3664
                                    control.PointSet.Add(firstPoint);
3665

    
3666
                                    control.ApplyOverViewData();
3667

    
3668
                                    CreateCommand.Instance.Execute(currentControl);
3669
                                    control.updateControl();
3670
                                    currentControl = null;
3671
                                }
3672
                            }
3673
                            else
3674
                            {
3675
                                if (e.LeftButton == MouseButtonState.Pressed)
3676
                                {
3677
                                    currentControl = new PolygonControl
3678
                                    {
3679
                                        PointSet = new List<Point>(),
3680
                                    };
3681

    
3682
                                    var polygonControl = (currentControl as PolygonControl);
3683
                                    currentControl.CommentID = Commons.shortGuid();
3684
                                    currentControl.IsNew = true;
3685
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3686
                                    polygonControl.StartPoint = canvasDrawingMouseDownPoint;
3687
                                    polygonControl.EndPoint = canvasDrawingMouseDownPoint;
3688
                                    polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3689
                                    polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3690
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3691
                                    polygonControl.ApplyTemplate();
3692
                                    polygonControl.Visibility = Visibility.Visible;
3693
                                }
3694
                            }
3695
                        }
3696
                        break;
3697
                    //강인구 추가
3698
                    case ControlType.Sign:
3699
                        {
3700
                            if (e.LeftButton == MouseButtonState.Pressed)
3701
                            {
3702
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3703
                                //{
3704
                                    var _sign = GetUserSign.GetSign(App.ViewInfo.UserID, App.ViewInfo.ProjectNO);
3705

    
3706
                                    if (_sign == null)
3707
                                    {
3708
                                        txtBatch.Visibility = Visibility.Collapsed;
3709
                                        mouseHandlingMode = IKCOM.MouseHandlingMode.None;
3710
                                        controlType = ControlType.None;
3711

    
3712
                                        this.ParentOfType<MainWindow>().DialogMessage_Alert("등록된 Sign이 없습니다.", "Alert");
3713
                                        this.ParentOfType<MainWindow>().ChildrenOfType<RadToggleButton>().Where(data => data.IsChecked == true).FirstOrDefault().IsChecked = false;
3714
                                        return;
3715
                                    }
3716

    
3717
                                    if (currentControl is SignControl)
3718
                                    {
3719
                                        //20180906 LJY TEST IsRotationDrawingEnable
3720
                                        if (IsGetoutpoint((currentControl as SignControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3721
                                        {
3722
                                            return;
3723
                                        }
3724

    
3725
                                        CreateCommand.Instance.Execute(currentControl);
3726
                                        currentControl = null;
3727
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
3728
                                        {
3729
                                            txtBatch.Text = "Place Date";
3730
                                            controlType = ControlType.Date;
3731
                                        }
3732
                                    }
3733
                                    else
3734
                                    {
3735
                                        currentControl = new SignControl
3736
                                        {
3737
                                            Background = new SolidColorBrush(Colors.Black),
3738
                                            UserNumber = App.ViewInfo.UserID,
3739
                                            ProjectNO = App.ViewInfo.ProjectNO,
3740
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3741
                                            EndPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3742
                                            ControlType = ControlType.Sign
3743
                                        };
3744

    
3745
                                        currentControl.CommentID = Commons.shortGuid();
3746
                                        currentControl.IsNew = true;
3747
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3748
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3749

    
3750
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
3751
                                        (currentControl as SignControl).Angle -= rotate.Angle;                                    
3752
                                }
3753
                                //}
3754
                            }
3755
                        }
3756
                        break;
3757
                    case ControlType.Mark:
3758
                        {
3759
                            if (e.LeftButton == MouseButtonState.Pressed)
3760
                            {
3761
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3762
                                //{
3763
                                    if (currentControl is RectangleControl)
3764
                                    {
3765
                                        //20180906 LJY TEST IsRotationDrawingEnable
3766
                                        if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3767
                                        {
3768
                                            return;
3769
                                        }
3770

    
3771
                                        CreateCommand.Instance.Execute(currentControl);
3772
                                        (currentControl as RectangleControl).ApplyOverViewData();
3773
                                        currentControl = null;
3774
                                    
3775
                                        this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
3776

    
3777
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
3778
                                        {
3779
                                            txtBatch.Text = "Place Signature";
3780
                                            controlType = ControlType.Sign;
3781
                                        }
3782
                                    }
3783
                                    else
3784
                                    {
3785
                                        currentControl = new RectangleControl
3786
                                        {
3787
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3788
                                            Background = new SolidColorBrush(Colors.Black),
3789
                                            ControlType = ControlType.Mark ,
3790
                                            Paint = PaintSet.Fill
3791
                                        };
3792

    
3793
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3794
                                        currentControl.CommentID = Commons.shortGuid();
3795
                                        currentControl.IsNew = true;
3796
                                        (currentControl as RectangleControl).DashSize = ViewerDataModel.Instance.DashSize;
3797
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3798
                                    }
3799
                                //}
3800
                            }
3801
                        }
3802
                        break;
3803
                    case ControlType.Symbol:
3804
                        {
3805
                            if (e.LeftButton == MouseButtonState.Pressed)
3806
                            {
3807
                                if (currentControl is SymControl)
3808
                                {
3809
                                    //20180906 LJY TEST IsRotationDrawingEnable
3810
                                    if (IsGetoutpoint((currentControl as SymControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3811
                                    {
3812
                                        return;
3813
                                    }
3814
                                    CreateCommand.Instance.Execute(currentControl);
3815
                                    currentControl = null;
3816
                                
3817
                                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
3818
                                }
3819
                                else
3820
                                {
3821
                                    currentControl = new SymControl
3822
                                    {
3823
                                        StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3824
                                        Background = new SolidColorBrush(Colors.Black),
3825
                                        LineSize = ViewerDataModel.Instance.LineSize + 3,
3826
                                        ControlType = ControlType.Symbol
3827
                                    };
3828

    
3829
                                    currentControl.IsNew = true;
3830
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3831
                                    currentControl.CommentID = Commons.shortGuid();
3832
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3833

    
3834
                                    //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
3835
                                    (currentControl as SymControl).Angle -= rotate.Angle;
3836
                                }
3837
                                //}
3838
                            }
3839
                        }
3840
                        break;
3841
                    case ControlType.Stamp:
3842
                        {
3843
                            if (e.LeftButton == MouseButtonState.Pressed)
3844
                            {
3845
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3846
                                //{
3847
                                    if (currentControl is SymControlN)
3848
                                    {
3849
                                        //20180906 LJY TEST IsRotationDrawingEnable
3850
                                        if (IsGetoutpoint((currentControl as SymControlN).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3851
                                        {
3852
                                            return;
3853
                                        }
3854

    
3855
                                        CreateCommand.Instance.Execute(currentControl);
3856
                                        currentControl = null;
3857
                                   
3858

    
3859
                                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
3860
                                    }
3861
                                    else
3862
                                    {
3863
                                        currentControl = new SymControlN
3864
                                        {
3865
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3866
                                            Background = new SolidColorBrush(Colors.Black),
3867
                                            STAMP = App.SystemInfo.STAMP,
3868
                                            ControlType = ControlType.Stamp
3869
                                        };
3870

    
3871
                                        currentControl.IsNew = true;
3872
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3873
                                        currentControl.CommentID = Commons.shortGuid();
3874
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3875
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
3876
                                        (currentControl as SymControlN).Angle -= rotate.Angle;
3877
                                }                                    
3878
                                //}
3879
                            }
3880
                        }
3881
                        break;
3882
                    case ControlType.PenControl:
3883
                        {
3884
                            if (inkBoard.Tag.ToString() == "Ink")
3885
                            {
3886
                                inkBoard.IsEnabled = true;
3887
                                StartNewStroke(canvasDrawingMouseDownPoint);
3888
                            }
3889
                            else if (inkBoard.Tag.ToString() == "EraseByPoint")
3890
                            {
3891
                                RemovePointStroke(canvasDrawingMouseDownPoint);
3892
                            }
3893
                            else if (inkBoard.Tag.ToString() == "EraseByStroke")
3894
                            {
3895
                                RemoveLineStroke(canvasDrawingMouseDownPoint);
3896
                            }
3897
                            IsDrawing = true;
3898
                            return;
3899
                        }
3900
                    default:
3901
                        if (currentControl != null)
3902
                        {
3903
                            currentControl.CommentID = null;
3904
                            currentControl.IsNew = false;
3905
                        }
3906
                        break;
3907
                }
3908
            }
3909
            if (mouseHandlingMode != MouseHandlingMode.None && e.LeftButton == MouseButtonState.Pressed)
3910
            {
3911
                if (mouseHandlingMode == MouseHandlingMode.Adorner && SelectLayer.Children.Count > 0)
3912
                {
3913
                    bool mouseOff = false;
3914
                    foreach (var item in SelectLayer.Children)
3915
                    {
3916
                        if (item is AdornerFinal)
3917
                        {
3918

    
3919
                            var over = (item as AdornerFinal).Members.Where(data => data.DrawingData.IsMouseOver).FirstOrDefault();
3920
                            if (over != null)
3921
                            {
3922
                                mouseOff = true;
3923
                            }
3924
                        }
3925
                    }
3926

    
3927
                    if (!mouseOff)
3928
                    {
3929
                        SelectionSet.Instance.UnSelect(this);
3930
                    }
3931
                }
3932
                zoomAndPanControl.CaptureMouse();
3933
                e.Handled = true;
3934
            }
3935
        }
3936

    
3937
        private void zoomAndPanControl2_MouseDown(object sender, MouseButtonEventArgs e)
3938
        {
3939
            ///mouseButtonDown = e.ChangedButton;
3940
            canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas2);
3941
        }
3942

    
3943
        private void RemoveLineStroke(Point P)
3944
        {
3945
            var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
3946
            if (control != null)
3947
            {
3948
                UndoData = new Undo_data()
3949
                {
3950
                    IsUndo = false,
3951
                    Event = Event_Type.Delete,
3952
                    EventTime = DateTime.Now,
3953
                    Markup_List = new List<Multi_Undo_data>()
3954
                };
3955

    
3956

    
3957
                multi_Undo_Data.Markup = control as MarkupToPDF.Common.CommentUserInfo;
3958
                UndoData.Markup_List.Add(multi_Undo_Data);
3959
                multi_Undo_Data = new Multi_Undo_data();
3960

    
3961
                ViewerDataModel.Instance.MarkupControls_USER.Remove(control);
3962
                var Item_ = ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (control as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault();
3963
                ViewerDataModel.Instance.MyMarkupList.Remove(Item_);
3964
                
3965
                //임시파일에서도 삭제한다.
3966
                TempFile.DelTemp((control as MarkupToPDF.Common.CommentUserInfo).CommentID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString());
3967
                
3968
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
3969
                {
3970
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
3971
                });
3972
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
3973

    
3974
            }
3975
        }
3976

    
3977
        private void RemovePointStroke(Point P)
3978
        {
3979
            foreach (Stroke hits in inkBoard.Strokes)
3980
            {
3981
                foreach (StylusPoint sty in hits.StylusPoints)
3982
                {
3983

    
3984
                }
3985
                if (hits.HitTest(P))
3986
                {
3987
                    inkBoard.Strokes.Remove(hits);
3988
                    return;
3989
                }
3990
            }
3991
        }
3992

    
3993
        private void StartNewStroke(Point P)
3994
        {
3995
            strokePoints = new StylusPointCollection();
3996
            StylusPoint segment1Start = new StylusPoint(P.X, P.Y);
3997
            strokePoints.Add(segment1Start);
3998
            stroke = new Stroke(strokePoints);
3999

    
4000
            stroke.DrawingAttributes.Color = Colors.Red;
4001
            stroke.DrawingAttributes.Width = 4;
4002
            stroke.DrawingAttributes.Height = 4;
4003

    
4004
            inkBoard.Strokes.Add(stroke);
4005

    
4006
        }
4007

    
4008
        private void btnConsolidate_Click(object sender, RoutedEventArgs e)
4009
        {
4010
            ConsolidationMethod();
4011
        }
4012

    
4013
        /// <summary>
4014
        /// execute TeamConsolidationCommand
4015
        /// </summary>
4016
        public void TeamConsolidationMethod()
4017
        {
4018
            this.UpdateMyMarkupList();
4019
            if (this.gridViewMarkup.SelectedItems.Count == 0)
4020
            {
4021
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
4022
            }
4023
            else
4024
            {
4025

    
4026
                ViewerDataModel.Instance.IsConsolidate = true;
4027
                this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
4028

    
4029
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
4030
                {
4031
                    if (!this.userData.DEPARTMENT.Equals(item.Depatment))
4032
                    {
4033
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at your department", "Alert");
4034
                        return;
4035
                    }                    
4036
                }
4037
                List<MarkupInfoItem> MarkupInfoList = new List<MarkupInfoItem>();
4038
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
4039
                {
4040
                    MarkupInfoList.Add(item);
4041
                }
4042
                TeamConsolidateCommand.Instance.Execute(MarkupInfoList);
4043
            }
4044
        }
4045

    
4046
        public void ConsolidationMethod()
4047
        {
4048
            if (this.gridViewMarkup.SelectedItems.Count == 0)
4049
            {
4050
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
4051
            }
4052
            else
4053
            {
4054
                List<IKCOM.MarkupInfoItem> MySelectItem = new List<IKCOM.MarkupInfoItem>();
4055
                foreach (var item in this.gridViewMarkup.SelectedItems)
4056
                {
4057
                    MySelectItem.Add(item as IKCOM.MarkupInfoItem);
4058
                }
4059
                int iPageNo = Convert.ToInt32(this.ParentOfType<MainWindow>().dzTopMenu.tlcurrentPage.Text);
4060
                
4061
                ConsolidateCommand.Instance.Execute(MySelectItem, iPageNo);
4062
            }
4063
        }
4064

    
4065
        private void btnConsolidate_Loaded(object sender, RoutedEventArgs e)
4066
        {
4067
            if (App.ViewInfo != null)
4068
            {
4069
                btnConsolidate = (sender as RadRibbonButton);
4070
                if (!App.ViewInfo.NewCommentPermission)
4071
                {
4072
                    (sender as RadRibbonButton).Visibility = System.Windows.Visibility.Collapsed;
4073
                }
4074
            }
4075
        }
4076

    
4077
        private void btnTeamConsolidate_Click(object sender, RoutedEventArgs e)
4078
        {
4079
            TeamConsolidationMethod();
4080
        }
4081

    
4082
        private void btnTeamConsolidate_Loaded(object sender, RoutedEventArgs e)
4083
        {
4084
            btnTeamConsolidate = sender as RadRibbonButton;
4085
            if (App.ViewInfo != null)
4086
            {
4087
                if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면
4088
                {
4089
                    if (btnConsolidate != null)
4090
                    {
4091
                        btnConsolidate.Visibility = Visibility.Collapsed;
4092
                    }
4093

    
4094
                    if (!App.ViewInfo.NewCommentPermission)
4095
                    {
4096
                        btnTeamConsolidate.Visibility = Visibility.Collapsed;
4097
                    }
4098
                }
4099
                else
4100
                {
4101
                    btnTeamConsolidate.Visibility = Visibility.Collapsed;
4102
                }
4103
            }
4104
        }
4105

    
4106
        private void FinalPDFEvent(object sender, RoutedEventArgs e)
4107
        {
4108
            var item = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault();
4109
            if (item != null)
4110
            {
4111
                Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item.MarkupInfoID + "," + _ViewInfo.UserID, 1);
4112

    
4113
                BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item.MarkupInfoID, _ViewInfo.UserID);
4114
            }
4115
            else
4116
            {
4117
                DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내");
4118
            }
4119
        }
4120

    
4121
        private void btnFinalPDF_Loaded(object sender, RoutedEventArgs e)
4122
        {
4123
            btnFinalPDF = sender as RadRibbonButton;
4124
            if (App.ViewInfo != null)
4125
            {
4126
                if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면
4127
                {
4128
                    btnFinalPDF.Visibility = System.Windows.Visibility.Collapsed;
4129
                    if (btnConsolidate != null)
4130
                    {
4131
                        btnConsolidate.Visibility = Visibility.Collapsed;
4132
                    }
4133
                }
4134
            }
4135
        }
4136

    
4137
        private void ConsolidateFinalPDFEvent(object sender, RoutedEventArgs e)
4138
        {
4139
            UpdateMyMarkupList();
4140

    
4141
            if (this.gridViewMarkup.SelectedItems.Count == 0)
4142
            {
4143
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
4144
            }
4145
            else
4146
            {
4147
                ViewerDataModel.Instance.IsConsolidate = true;
4148
                this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
4149
                List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>();
4150

    
4151
                string project_no = App.ViewInfo.ProjectNO;
4152
                string doc_id = _DocInfo.ID;
4153
                string user_id = App.ViewInfo.UserID;
4154
                List<MarkupInfoItem> markupInfoItems = new List<MarkupInfoItem>();
4155
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
4156
                {
4157
                    markupInfoItems.Add(item);
4158
                }
4159
                Logger.sendReqLog("Consolidate", project_no + "," + user_id + "," + doc_id + "," + markupInfoItems, 1);
4160
                Logger.sendResLog("Consolidate", this.BaseClient.Consolidate(project_no, user_id, doc_id, markupInfoItems).ToString(), 1);
4161
                Logger.sendReqLog("GetMarkupInfoItemsAsync", App.ViewInfo.ProjectNO + "," + _DocInfo.ID, 1);
4162
                var items = this.BaseClient.GetMarkupInfoItems(App.ViewInfo.ProjectNO, _DocInfo.ID);
4163

    
4164
                var item2 = items.Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault();
4165
                if (item2 != null)
4166
                {
4167
                    Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item2.MarkupInfoID + "," + _ViewInfo.UserID, 1);
4168

    
4169
                    BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item2.MarkupInfoID, _ViewInfo.UserID);
4170
                    BaseClient.GetMarkupInfoItemsAsync(App.ViewInfo.ProjectNO, _DocInfo.ID);
4171
                }
4172
                else
4173
                {
4174
                    DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내");
4175
                }
4176
            }
4177
        }
4178

    
4179
        private void btnConsolidateFinalPDF_Loaded(object sender, RoutedEventArgs e)
4180
        {
4181
            btnConsolidateFinalPDF = (sender as RadRibbonButton);
4182

    
4183
            if (App.ViewInfo != null)
4184
            {
4185
                if (!App.ViewInfo.NewCommentPermission || !App.ViewInfo.CreateFinalPDFPermission)
4186
                {
4187
                    btnConsolidateFinalPDF.Visibility = System.Windows.Visibility.Collapsed;
4188
                }
4189
            }
4190
        }
4191

    
4192
        private void SyncCompare_Click(object sender, RoutedEventArgs e)
4193
        {
4194
            if (CompareMode.IsChecked)
4195
            {
4196
                if (ViewerDataModel.Instance.PageBalanceMode && ViewerDataModel.Instance.PageBalanceNumber == 0)
4197
                {
4198
                    ViewerDataModel.Instance.PageBalanceNumber = 1;
4199
                }
4200
                if (ViewerDataModel.Instance.PageNumber == 0)
4201
                {
4202
                    ViewerDataModel.Instance.PageNumber = 1;
4203
                }
4204

    
4205
                Logger.sendReqLog("GetCompareRectAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID + "," + CurrentRev.DOCUMENT_ID +
4206
                    "," + pageNavigator.CurrentPage.PageNumber.ToString() + "," + ViewerDataModel.Instance.PageNumber.ToString() + "," +
4207
                    userData.COMPANY != "EXT" ? "true" : "false", 1);
4208

    
4209
                BaseClient.GetCompareRectAsync(_ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber.ToString(), ViewerDataModel.Instance.PageNumber.ToString(), userData.COMPANY != "EXT" ? "true" : "false");
4210
            }
4211
            else
4212
            {
4213
                da.From = 1;
4214
                da.To = 1;
4215
                da.Duration = new Duration(TimeSpan.FromSeconds(9999));
4216
                da.AutoReverse = false;
4217
                canvas_compareBorder.Children.Clear();
4218
                canvas_compareBorder.BeginAnimation(OpacityProperty, da);
4219
            }
4220
        }
4221

    
4222
        private void Sync_Click(object sender, RoutedEventArgs e)
4223
        {
4224
            if (Sync.IsChecked)
4225
            {
4226
                ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
4227
                ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
4228
                ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
4229
            }
4230
        }
4231

    
4232
        private void SyncUserListExpender_Click(object sender, RoutedEventArgs e)
4233
        {
4234
            if (UserList.IsChecked)
4235
            {
4236
                this.gridViewRevMarkup.Visibility = Visibility.Visible;
4237
            }
4238
            else
4239
            {
4240
                this.gridViewRevMarkup.Visibility = Visibility.Collapsed;
4241
            }
4242
        }
4243

    
4244
        private void SyncPageBalance_Click(object sender, RoutedEventArgs e)
4245
        {
4246

    
4247
            if (BalanceMode.IsChecked)
4248
            {
4249
                ViewerDataModel.Instance.PageBalanceMode = true;
4250
            }
4251
            else
4252
            {
4253
                ViewerDataModel.Instance.PageBalanceMode = false;
4254
                ViewerDataModel.Instance.PageBalanceNumber = 0;
4255
            }
4256
        }
4257

    
4258
        private void SyncExit_Click(object sender, RoutedEventArgs e)
4259
        {
4260
            //초기화
4261
            testPanel2.IsHidden = true;
4262
            ViewerDataModel.Instance.PageBalanceMode = false;
4263
            ViewerDataModel.Instance.PageBalanceNumber = 0;
4264
            ViewerDataModel.Instance.PageNumber = 0;
4265
            ViewerDataModel.Instance.MarkupControls_Sync.Clear();
4266
            this.gridViewRevMarkup.Visibility = Visibility.Collapsed;
4267
            UserList.IsChecked = false;
4268
            BalanceMode.IsChecked = false;
4269
        }
4270

    
4271
        private void SyncPageChange_Click(object sender, RoutedEventArgs e)
4272
        {
4273
            if ((sender as System.Windows.Controls.Control).Tag != null)
4274
            {
4275
                //Compare 초기화
4276
                CompareMode.IsChecked = false;
4277
                var balancePoint = Convert.ToInt32((sender as System.Windows.Controls.Control).Tag);
4278

    
4279
                if (ViewerDataModel.Instance.PageNumber == 0)
4280
                {
4281
                    ViewerDataModel.Instance.PageNumber = 1;
4282
                }
4283

    
4284
                if (ViewerDataModel.Instance.PageBalanceNumber == pageNavigator.PageCount)
4285
                {
4286
                }
4287
                else
4288
                {
4289
                    ViewerDataModel.Instance.PageBalanceNumber += balancePoint;
4290
                }
4291

    
4292
                if (ViewerDataModel.Instance.PageNumber == pageNavigator.PageCount && balancePoint > 0)
4293
                {
4294

    
4295
                }
4296
                else if ((ViewerDataModel.Instance.PageNumber + balancePoint) >= 1)
4297
                {
4298
                    ViewerDataModel.Instance.PageNumber += balancePoint;
4299
                }
4300

    
4301
                if (!testPanel2.IsHidden)
4302
                {
4303
                    if (IsSyncPDFMode)
4304
                    {
4305
                        Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
4306
                        var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber)));
4307

    
4308
                        if (pdfpath.IsDownloading)
4309
                        {
4310
                            pdfpath.DownloadCompleted += (ex, arg) =>
4311
                            {
4312
                                ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
4313
                                ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
4314
                                ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
4315
                                zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
4316
                                zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
4317
                            };
4318
                        }
4319
                        else
4320
                        {
4321
                            ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
4322
                            ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
4323
                            ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
4324

    
4325
                            zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
4326
                            zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
4327
                        }
4328

    
4329
                    }
4330
                    else
4331
                    {
4332
                        string uri = "";
4333

    
4334
                        if (userData.COMPANY != "EXT")
4335
                        {
4336
                            uri = String.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber);
4337
                        }
4338
                        else
4339
                        {
4340
                            uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber);
4341
                        }
4342

    
4343
                        var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
4344

    
4345
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4346
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4347
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4348

    
4349
                        zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
4350
                        zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
4351

    
4352
                        if (defaultBitmapImage_Compare.IsDownloading)
4353
                        {
4354
                            defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
4355
                            {
4356
                                ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4357
                                ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4358
                                ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4359

    
4360
                                zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
4361
                                zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
4362
                            };
4363
                        }
4364
                    }
4365

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

    
4370
                    foreach (var item in gridSelectionRevItem)
4371
                    {
4372
                        item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageNumber).ToList().ForEach(delegate (MarkupItem markupitem)
4373
                        {
4374
                            MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID);
4375
                        });
4376
                    }
4377

    
4378
                    //강인구 추가
4379
                    zoomAndPanControl2.ZoomTo(new Rect
4380
                    {
4381
                        X = 0,
4382
                        Y = 0,
4383
                        Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width),
4384
                        Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height),
4385
                    });
4386

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

    
4389
                }
4390
            }
4391
        }
4392

    
4393
        private void SyncChange_Click(object sender, RoutedEventArgs e)
4394
        {
4395
            if (MarkupMode.IsChecked)
4396
            {
4397
                IsSyncPDFMode = true;
4398

    
4399
                var uri = CurrentRev.TO_VENDOR;
4400

    
4401
                if (ViewerDataModel.Instance.PageNumber == 0)
4402
                {
4403
                    ViewerDataModel.Instance.PageNumber = 1;
4404
                }
4405

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

    
4410
                if (pdfpath.IsDownloading)
4411
                {
4412
                    pdfpath.DownloadCompleted += (ex, arg) =>
4413
                    {
4414
                        ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
4415
                        ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
4416
                        ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
4417
                        zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
4418
                        zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
4419
                    };
4420
                }
4421
                else
4422
                {
4423
                    ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
4424
                    ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
4425
                    ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
4426

    
4427
                    zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
4428
                    zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
4429
                }
4430
            }
4431
            else
4432
            {
4433
                IsSyncPDFMode = false;
4434
                string uri = "";
4435
                if (userData.COMPANY != "EXT")
4436
                {
4437
                    uri = String.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
4438
                }
4439
                else
4440
                {
4441
                    uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
4442
                }
4443

    
4444
                var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
4445

    
4446
                ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4447
                ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4448
                ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4449

    
4450
                if (defaultBitmapImage_Compare.IsDownloading)
4451
                {
4452
                    defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
4453
                    {
4454
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4455
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4456
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4457
                    };
4458
                }
4459
                zoomAndPanControl2.ApplyTemplate();
4460
                zoomAndPanControl2.UpdateLayout();
4461
                zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
4462
                zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
4463
            }
4464
        }
4465

    
4466
        private void RadButton_Click(object sender, RoutedEventArgs e)
4467
        {
4468
            gridViewHistory_Busy.IsBusy = true;
4469

    
4470
            RadButton instance = sender as RadButton;
4471
            if (instance.CommandParameter != null)
4472
            {
4473
                CurrentRev = instance.CommandParameter as VPRevision;
4474
                BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) =>
4475
                {
4476
                    if (ea.Error == null && ea.Result != null)
4477
                    {
4478
                        testPanel2.IsHidden = false;
4479

    
4480
                        ViewerDataModel.Instance._markupInfoRevList.Clear();
4481
                        foreach(var info in ea.Result)
4482
                        {
4483
                            if(info.UserID == App.ViewInfo.UserID)
4484
                            {
4485
                                info.userDelete = true;
4486
                                info.DisplayColor = "FFFF0000";
4487
                            }
4488
                            else
4489
                            {
4490
                                info.userDelete = false;
4491
                            }
4492
                            ViewerDataModel.Instance._markupInfoRevList.Add(info);
4493
                        }
4494
                        gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList;
4495

    
4496
                        string uri = "";
4497
                        if (userData.COMPANY != "EXT")
4498
                        {
4499
                            uri = String.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
4500
                        }
4501
                        else
4502
                        {
4503
                            uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
4504
                        }
4505

    
4506
                        Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY);
4507

    
4508
                        var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
4509

    
4510
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4511
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4512
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4513

    
4514
                        if (defaultBitmapImage_Compare.IsDownloading)
4515
                        {
4516
                            defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
4517
                            {
4518
                                ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4519
                                ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4520
                                ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4521
                            };
4522
                        }
4523

    
4524
                        zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
4525
                        zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
4526
                        zoomAndPanControl2.RotationAngle = zoomAndPanControl.RotationAngle;
4527
                        zoomAndPanControl2.ApplyTemplate();
4528
                        zoomAndPanControl2.UpdateLayout();
4529

    
4530
                        if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY))
4531
                        {
4532
                            zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X;
4533
                            zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y;
4534
                        }
4535

    
4536
                        ViewerDataModel.Instance.Sync_ContentOffsetX = Sync_Offset_Point.X;
4537
                        ViewerDataModel.Instance.Sync_ContentOffsetY = Sync_Offset_Point.Y;
4538
                        ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
4539

    
4540
                        tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo);
4541
                        tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber);
4542
                        gridViewHistory_Busy.IsBusy = false;
4543
                    }
4544

    
4545
                    Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1);
4546
                };
4547
                BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID);
4548
                Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1);
4549
            }
4550
        }
4551

    
4552
        public void Sync_Event(VPRevision Currnet_Rev)
4553
        {
4554
            CurrentRev = Currnet_Rev;
4555

    
4556
            BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) =>
4557
            {
4558
                if (ea.Error == null && ea.Result != null)
4559
                {
4560
                    testPanel2.IsHidden = false;
4561

    
4562
                    ViewerDataModel.Instance._markupInfoRevList.Clear();
4563
                    foreach(var info in ea.Result)
4564
                    {
4565
                        if(info.UserID == App.ViewInfo.UserID)
4566
                        {
4567
                            info.userDelete = true;
4568
                            info.DisplayColor = "FFFF0000";
4569
                        }
4570
                        else
4571
                        {
4572
                            info.userDelete = false;
4573
                        }
4574
                        ViewerDataModel.Instance._markupInfoRevList.Add(info);
4575
                    }
4576
                    gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList;
4577

    
4578
                    string uri = "";
4579
                    if (userData.COMPANY != "EXT")
4580
                    {
4581
                        uri = String.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
4582
                    }
4583
                    else
4584
                    {
4585
                        uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
4586
                    }
4587

    
4588
                    Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY);
4589

    
4590
                    var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
4591

    
4592
                    ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4593
                    ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4594
                    ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4595

    
4596
                    if (defaultBitmapImage_Compare.IsDownloading)
4597
                    {
4598
                        defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
4599
                        {
4600
                            ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
4601
                            ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
4602
                            ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
4603
                        };
4604
                    }
4605

    
4606

    
4607
                    zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
4608
                    zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
4609
                    zoomAndPanControl2.ApplyTemplate();
4610
                    zoomAndPanControl2.UpdateLayout();
4611

    
4612
                    if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY))
4613
                    {
4614
                        zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X;
4615
                        zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y;
4616
                    }
4617
                    //}
4618

    
4619
                    tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo);
4620
                    tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber);
4621
                    gridViewHistory_Busy.IsBusy = false;
4622
                }
4623
                Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1);
4624

    
4625
            };
4626
            Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1);
4627
            BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID);
4628
        }
4629

    
4630
        private void PdfLink_ButtonDown(object sender, MouseButtonEventArgs e)
4631
        {
4632
            if (sender is Image)
4633
            {
4634
                if ((sender as Image).Tag != null)
4635
                {
4636
                    var pdfUrl = (sender as Image).Tag.ToString();
4637
                    System.Diagnostics.Process.Start(pdfUrl);
4638
                }
4639
                else
4640
                {
4641
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("문서 정보가 잘못 되었습니다", "안내");
4642
                }
4643
            }
4644
        }
4645

    
4646
        private void Create_Symbol(object sender, RoutedEventArgs e)
4647
        {
4648
            MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn();
4649

    
4650
            if (SelectLayer.Children.Count < 1) //선택된 것이 없으면
4651
            {
4652
                DialogMessage_Alert("Please Select Controls", "Alert");
4653
            }
4654
            else //선택된 것이 있으면
4655
            {
4656
                string MarkupData = "";
4657
                adorner_ = new AdornerFinal();
4658

    
4659
                foreach (var item in SelectLayer.Children)
4660
                {
4661
                    if (item.GetType().Name == "AdornerFinal")
4662
                    {
4663
                        adorner_ = (item as Controls.AdornerFinal);
4664
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
4665
                        {
4666
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
4667
                            {
4668
                                markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
4669
                                MarkupData += markupReturn.ConvertData;
4670
                            }
4671
                        }
4672
                    }
4673
                }
4674
                DialogParameters parameters = new DialogParameters()
4675
                {
4676
                    Owner = Application.Current.MainWindow,
4677
                    Closed = (obj, args) => this.MarkupNamePromptClose(MarkupData, args),
4678
                    DefaultPromptResultValue = "Custom State",
4679
                    Content = "Name :",
4680
                    Header = "Insert Custom Symbol Name",
4681
                    Theme = new VisualStudio2013Theme(),
4682
                    ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
4683
                };
4684
                RadWindow.Prompt(parameters);
4685
            }
4686

    
4687
        }
4688
        public int symbolselectindex = 0;
4689
        private void SymbolMarkupNamePromptClose(byte[] Img_byte, string data, WindowClosedEventArgs args)
4690
        {
4691
            //Save save = new Save();
4692
            try
4693
            {
4694
                string svgfilename = null;
4695
                if (symbolname != null)
4696
                {
4697
                    if (symbolpng == true || symbolsvg == true)
4698
                    {
4699
                        kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
4700
                        string guid = Commons.shortGuid();
4701

    
4702
                        fileUploader.RunAsync(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".png", Img_byte);
4703
                        //Check_Uri.UriCheck();
4704
                        fileUploader.RunCompleted += (ex, arg) =>
4705
                        {
4706
                            filename = arg.Result;
4707
                            if (symbolpng == true)
4708
                            {
4709
                                if (filename != null)
4710
                                { 
4711
                                    if (symbolselectindex == 0)
4712
                                    {
4713
                                        SymbolSave(symbolname, filename, data);
4714
                                    }
4715
                                    else
4716
                                    {
4717
                                        SymbolSave_Public(symbolname, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
4718
                                    }
4719
                                    DataBind();
4720
                                }                                
4721
                            }
4722

    
4723
                            if (symbolsvg == true)
4724
                            {
4725
                                try
4726
                                {
4727
                                    var defaultBitmapImage = new BitmapImage();
4728
                                    defaultBitmapImage.BeginInit();
4729
                                    defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
4730
                                    defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
4731
                                    Check_Uri.UriCheck(filename);
4732
                                    defaultBitmapImage.UriSource = new Uri(filename);
4733
                                    defaultBitmapImage.EndInit();
4734

    
4735
                                    System.Drawing.Bitmap image;
4736

    
4737
                                    if (defaultBitmapImage.IsDownloading)
4738
                                    {
4739
                                        defaultBitmapImage.DownloadCompleted += (ex2, arg2) =>
4740
                                        {
4741
                                            defaultBitmapImage.Freeze();
4742
                                            image = GetBitmap(defaultBitmapImage);
4743
                                            image.Save(@AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
4744
                                            Process potrace = new Process
4745
                                            {
4746
                                                StartInfo = new ProcessStartInfo
4747
                                                {
4748
                                                    FileName = @AppDomain.CurrentDomain.BaseDirectory + "potrace.exe",
4749
                                                    Arguments = "-b svg " + @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp",
4750
                                                    RedirectStandardInput = true,
4751
                                                    RedirectStandardOutput = true,
4752
                                                    RedirectStandardError = true,
4753
                                                    UseShellExecute = false,
4754
                                                    CreateNoWindow = true,
4755
                                                    WindowStyle = ProcessWindowStyle.Hidden
4756
                                                },
4757
                                            };
4758

    
4759
                                            StringBuilder svgBuilder = new StringBuilder();
4760
                                            potrace.OutputDataReceived += (object sender2, DataReceivedEventArgs e2) =>
4761
                                            {
4762
                                                svgBuilder.AppendLine(e2.Data);
4763
                                            };
4764

    
4765
                                            potrace.EnableRaisingEvents = true;
4766
                                            potrace.Start();
4767
                                            potrace.Exited += (sender, e) =>
4768
                                            {
4769
                                                byte[] bytes = System.IO.File.ReadAllBytes(@AppDomain.CurrentDomain.BaseDirectory + "potrace.svg");
4770
                                                svgfilename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".svg", bytes);
4771
                                                Check_Uri.UriCheck(svgfilename);
4772
                                                if (symbolselectindex == 0)
4773
                                                {
4774
                                                    SymbolSave(symbolname, svgfilename, data);
4775
                                                }
4776
                                                else
4777
                                                {
4778
                                                    SymbolSave_Public(symbolname, svgfilename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
4779
                                                }
4780

    
4781
                                                DataBind();
4782
                                            };
4783
                                            potrace.WaitForExit();
4784
                                        };
4785
                                    }
4786
                                    else
4787
                                    {
4788
                                        //GC.Collect();
4789
                                    }
4790
                                }
4791
                                catch(Exception ee)
4792
                                {
4793
                                    DialogMessage_Alert("" + ee, "Alert");
4794
                                }
4795
                            }
4796
                        };                                             
4797
                    }
4798
                }
4799
            }
4800
            catch (Exception e)
4801
            {
4802
                //DialogMessage_Alert(e + "", "Alert");
4803
            }            
4804
        }
4805

    
4806
        public void SymbolSave(string Name, string Url, string Data)
4807
        {
4808
            try
4809
            {
4810
                SYMBOL_PRIVATE symbol_private = new SYMBOL_PRIVATE
4811
                {
4812
                    ID = Commons.shortGuid(),
4813
                    MEMBER_USER_ID = App.ViewInfo.UserID,
4814
                    NAME = Name,
4815
                    IMAGE_URL = Url,
4816
                    DATA = Data
4817
                };
4818

    
4819
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolCompleted += BaseClient_SaveSymbolCompleted;
4820
                Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1);
4821
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private);
4822
            }
4823
            catch (Exception)
4824
            {
4825
                throw;
4826
            }
4827
        }
4828

    
4829
        public void SymbolSave_Public(string Name, string Url, string Data, string Department)
4830
        {
4831
            try
4832
            {
4833
                SYMBOL_PUBLIC symbol_public = new SYMBOL_PUBLIC
4834
                {
4835
                    ID = Commons.shortGuid(),
4836
                    DEPARTMENT = Department,
4837
                    NAME = Name,
4838
                    IMAGE_URL = Url,
4839
                    DATA = Data
4840
                };
4841
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbolCompleted += BaseClient_AddPublicSymbolCompleted;
4842
                Logger.sendReqLog("AddPublicSymbol: ", symbol_public.ID + "," + symbol_public.DEPARTMENT + "," + symbol_public.NAME + "," + symbol_public.IMAGE_URL + "," + symbol_public.DATA, 1);
4843
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbol(symbol_public);
4844
            }
4845
            catch (Exception)
4846
            {
4847
                throw;
4848
            }
4849
        }
4850

    
4851
        private void BaseClient_AddPublicSymbolCompleted(object sender, ServiceDeepView.AddPublicSymbolCompletedEventArgs e)
4852
        {           
4853
            Logger.sendResLog("AddPublicSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
4854
            DataBind();
4855
        }
4856

    
4857
        private void BaseClient_SaveSymbolCompleted(object sender, ServiceDeepView.SaveSymbolCompletedEventArgs e)
4858
        {
4859
            Logger.sendResLog("RenameSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
4860
            DataBind();
4861
        }
4862
        private void DataBind()
4863
        {
4864
            try
4865
            {
4866
                Symbol_Custom Custom = new Symbol_Custom();
4867
                List<Symbol_Custom> Custom_List = new List<Symbol_Custom>();
4868
                
4869
                var symbol_Private = BaseClient.GetSymbolList(App.ViewInfo.UserID);
4870
                foreach (var item in symbol_Private)
4871
                {
4872
                    Custom.Name = item.NAME;
4873
                    Custom.ImageUri = item.IMAGE_URL;
4874
                    Custom.ID = item.ID;
4875
                    Custom_List.Add(Custom);
4876
                    Custom = new Symbol_Custom();
4877
                }
4878
                symbolPanel_Instance.lstSymbolPrivate.ItemsSource = Custom_List;
4879
                
4880
                Custom = new Symbol_Custom();
4881
                Custom_List = new List<Symbol_Custom>();
4882

    
4883
                symbolPanel_Instance.deptlist.ItemsSource = BaseClient.GetPublicSymbolDeptList();
4884

    
4885
                List<SYMBOL_PUBLIC> symbol_Public;
4886

    
4887
                if (symbolPanel_Instance.deptlist.SelectedValue != null)
4888
                {
4889
                    symbol_Public = BaseClient.GetPublicSymbolList(symbolPanel_Instance.deptlist.SelectedValue.ToString());
4890
                }
4891
                else
4892
                {
4893
                    symbol_Public = BaseClient.GetPublicSymbolList(null);
4894
                }
4895
                foreach (var item in symbol_Public)
4896
                {
4897
                    Custom.Name = item.NAME;
4898
                    Custom.ImageUri = item.IMAGE_URL;
4899
                    Custom.ID = item.ID;
4900
                    Custom_List.Add(Custom);
4901
                    Custom = new Symbol_Custom();
4902
                }
4903
                symbolPanel_Instance.lstSymbolPublic.ItemsSource = Custom_List;
4904
                BaseClient.Close();                
4905
            }
4906
            catch(Exception e)
4907
            {
4908
                //DialogMessage_Alert("DataBind", "Alert");
4909
            }
4910
            
4911
        }
4912
        private void MarkupNamePromptClose(string data, WindowClosedEventArgs args)
4913
        {
4914
            try
4915
            {
4916
                if (args.PromptResult != null)
4917
                {
4918
                    if (args.DialogResult.Value)
4919
                    {
4920
                        PngBitmapEncoder _Encoder = symImage(data);
4921

    
4922
                        System.IO.MemoryStream fs = new System.IO.MemoryStream();
4923
                        _Encoder.Save(fs);
4924
                        System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs);
4925

    
4926
                        byte[] Img_byte = fs.ToArray();
4927

    
4928
                        kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
4929
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Commons.shortGuid() + ".png", Img_byte);
4930
                        Check_Uri.UriCheck(filename);
4931
                        if (symbolPanel_Instance.RadTab.SelectedIndex == 0)
4932
                        {
4933
                            SaveCommand.Instance.SymbolSave(args.PromptResult, filename, data);
4934
                        }
4935
                        else
4936
                        {
4937
                            SaveCommand.Instance.SymbolSave_Public(args.PromptResult, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
4938
                        }
4939
                        DataBind();
4940
                    }
4941
                }
4942
            }
4943
            catch(Exception ex)
4944
            {
4945
                DialogMessage_Alert("" + ex, "Alert");
4946
            }
4947
        }
4948

    
4949
        public PngBitmapEncoder symImage(string data)
4950
        {
4951

    
4952
            Canvas _canvas = new Canvas();
4953
            _canvas.Background = Brushes.White;
4954
            _canvas.Width = adorner_.BorderSize.Width;
4955
            _canvas.Height = adorner_.BorderSize.Height;
4956
            MarkupParser.Parse(App.ViewInfo.ProjectNO, data, _canvas, "#FFFF0000", "");
4957

    
4958
            BitmapEncoder encoder = new PngBitmapEncoder();
4959

    
4960

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

    
4963
            DrawingVisual dv = new DrawingVisual();
4964

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

    
4968
            using (DrawingContext ctx = dv.RenderOpen())
4969
            {
4970
                VisualBrush vb = new VisualBrush(_canvas);
4971
                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)));
4972
            }
4973

    
4974
            try
4975
            {
4976
                renderBitmap.Render(dv);
4977

    
4978
                //GC.Collect();
4979
                GC.WaitForPendingFinalizers();
4980
                //GC.Collect();
4981
                // encode png data
4982
                PngBitmapEncoder pngEncoder = new PngBitmapEncoder();
4983
                // puch rendered bitmap into it
4984
                pngEncoder.Interlace = PngInterlaceOption.Off;
4985
                pngEncoder.Frames.Add(BitmapFrame.Create(renderBitmap));
4986
                return pngEncoder;
4987

    
4988
            }
4989
            catch //(Exception ex)
4990
            {
4991
                return null;
4992
            }
4993

    
4994
        }
4995

    
4996
        public void DialogMessage_Alert(string content, string header)
4997
        {
4998
            var box = new TextBlock();
4999
            box.MinWidth = 400;
5000
            box.FontSize = 11;
5001
            //box.FontSize = 12;
5002
            box.Text = content;
5003
            box.TextWrapping = System.Windows.TextWrapping.Wrap;
5004

    
5005
            DialogParameters parameters = new DialogParameters()
5006
            {
5007
                Owner = Application.Current.MainWindow,
5008
                Content = box,
5009
                Header = header,
5010
                Theme = new VisualStudio2013Theme(),
5011
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
5012
            };            
5013
            RadWindow.Alert(parameters);
5014
        }
5015

    
5016
        #region 캡쳐 기능
5017

    
5018
        public BitmapSource CutAreaToImage(int x, int y, int width, int height)
5019
        {
5020
            if (x < 0)
5021
            {
5022
                width += x;
5023
                x = 0;
5024
            }
5025
            if (y < 0)
5026
            {
5027
                height += y;
5028
                y = 0;
5029

    
5030
                width = (int)zoomAndPanCanvas.ActualWidth - x;
5031
            }
5032
            if (x + width > zoomAndPanCanvas.ActualWidth)
5033
            {
5034
                width = (int)zoomAndPanCanvas.ActualWidth - x;
5035
            }
5036
            if (y + height > zoomAndPanCanvas.ActualHeight)
5037
            {
5038
                height = (int)zoomAndPanCanvas.ActualHeight - y;
5039
            }
5040

    
5041
            byte[] pixels = CopyPixels(x, y, width, height);
5042

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

    
5045
            return BitmapSource.Create(width, height, 96, 96, PixelFormats.Pbgra32, null, pixels, stride);
5046
        }
5047

    
5048
        public byte[] CopyPixels(int x, int y, int width, int height)
5049
        {
5050
            byte[] pixels = new byte[width * height * 4];
5051
            int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8;
5052

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

    
5056
            return pixels;
5057
        }
5058

    
5059
        public RenderTargetBitmap ConverterBitmapImage(FrameworkElement element)
5060
        {
5061
            DrawingVisual drawingVisual = new DrawingVisual();
5062
            DrawingContext drawingContext = drawingVisual.RenderOpen();
5063

    
5064
            // 해당 객체의 그래픽요소로 사각형의 그림을 그립니다.
5065
            drawingContext.DrawRectangle(new VisualBrush(element), null,
5066
                new Rect(new Point(0, 0), new Point(element.ActualWidth, element.ActualHeight)));
5067
            drawingContext.Close();
5068

    
5069
            // 비트맵으로 변환합니다.
5070
            RenderTargetBitmap target =
5071
                new RenderTargetBitmap((int)element.ActualWidth, (int)element.ActualHeight,
5072
                96, 96, System.Windows.Media.PixelFormats.Pbgra32);
5073

    
5074
            target.Render(drawingVisual);
5075
            return target;
5076
        }
5077

    
5078
        System.Drawing.Bitmap GetBitmap(BitmapSource source)
5079
        {
5080
            System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(source.PixelWidth, source.PixelHeight, System.Drawing.Imaging.PixelFormat.Format32bppPArgb);
5081
            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);
5082
            source.CopyPixels(Int32Rect.Empty, data.Scan0, data.Height * data.Stride, data.Stride);
5083
            bmp.UnlockBits(data);
5084
            return bmp;
5085
        }
5086
        public string symbolname = null;
5087
        public bool symbolsvg = true;
5088
        public bool symbolpng = true;
5089

    
5090
        public void Save_Symbol_Capture(BitmapSource source, int x, int y, int width, int height)
5091
        {
5092
            System.Drawing.Bitmap image = GetBitmap(source);
5093
            //흰색 제거
5094
            //image.MakeTransparent(System.Drawing.Color.White);
5095

    
5096
            var imageStream = new System.IO.MemoryStream();
5097
            byte[] imageBytes = null;
5098
            using (imageStream)
5099
            {
5100
                image.Save(imageStream, System.Drawing.Imaging.ImageFormat.Png);
5101
                // test.Save(@"E:\test.png", System.Drawing.Imaging.ImageFormat.Png);
5102
                imageStream.Position = 0;
5103
                imageBytes = imageStream.ToArray();
5104
            }
5105

    
5106
            SymbolPrompt symbolPrompt = new SymbolPrompt();
5107

    
5108
            RadWindow CheckPop = new RadWindow();
5109
            //Alert check = new Alert(Msg);
5110

    
5111
            CheckPop = new RadWindow
5112
            {
5113
                MinWidth = 400,
5114
                MinHeight = 100,
5115
               // Closed = (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args),
5116
                Header = "Alert",
5117
                Content = symbolPrompt,
5118
                //DialogResult = 
5119
                ResizeMode = System.Windows.ResizeMode.NoResize,
5120
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
5121
                IsTopmost = true,
5122
            };
5123
            CheckPop.Closed += (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args);
5124
            StyleManager.SetTheme(CheckPop, new Office2013Theme());
5125
            CheckPop.ShowDialog();
5126

    
5127
            /*
5128
            DialogParameters parameters = new DialogParameters()
5129
            {
5130
                Owner = Application.Current.MainWindow,
5131
                Closed = (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args),
5132
                DefaultPromptResultValue = "Custom State",
5133
                Content = "Name :",
5134
                Header = "Insert Custom Symbol Name",
5135
                Theme = new VisualStudio2013Theme(),
5136
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
5137
            };            
5138
            RadWindow.Prompt(parameters);
5139
            */
5140
        }
5141

    
5142
        public void Save_Capture(BitmapSource source, int x, int y, int width, int height)
5143
        {
5144
            KCOM.Common.Converter.FileStreamToBase64 streamToBase64 = new Common.Converter.FileStreamToBase64();
5145
            KCOMDataModel.DataModel.CHECK_LIST check_;
5146
            string Result = streamToBase64.ImageToBase64(source);
5147
            KCOMDataModel.DataModel.CHECK_LIST Item = new KCOMDataModel.DataModel.CHECK_LIST();
5148
            string projectno = App.ViewInfo.ProjectNO;
5149
            string checklist_id = ViewerDataModel.Instance.CheckList_ID;
5150

    
5151
            Logger.sendReqLog("GetCheckList", projectno + "," + checklist_id, 1);
5152
            Item = this.BaseClient.GetCheckList(projectno, checklist_id);
5153
            if (Item != null)
5154
            {
5155
                Logger.sendResLog("GetCheckList", "TRUE", 1);
5156
            }
5157
            else
5158
            {
5159
                Logger.sendResLog("GetCheckList", "FALSE", 1);
5160
            }
5161

    
5162
            if (Item == null)
5163
            {
5164
                check_ = new KCOMDataModel.DataModel.CHECK_LIST
5165
                {
5166
                    ID = Commons.shortGuid(),
5167
                    USER_ID = App.ViewInfo.UserID,
5168
                    IMAGE_URL = Result,
5169
                    IMAGE_ANCHOR = x + "," + y + "," + width + "," + height,
5170
                    PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber,
5171
                    REVISION = ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision,
5172
                    DOCUMENT_ID = App.ViewInfo.DocumentItemID,
5173
                    PROJECT_NO = App.ViewInfo.ProjectNO,
5174
                    STATUS = "False",
5175
                    CREATE_TIME = DateTime.Now,
5176
                    UPDATE_TIME = DateTime.Now,
5177
                    DOCUMENT_NO = _DocItem.DOCUMENT_NO,
5178
                    STATUS_DESC_OPEN = "Vendor 반영 필요",
5179
                };
5180
                Logger.sendReqLog("AddCheckList", projectno + "," + check_, 1);
5181
                Logger.sendResLog("AddCheckList", this.BaseClient.AddCheckList(projectno, check_).ToString(), 1);
5182
                //this.BaseClient.AddCheckList(projectno, check_);
5183
            }
5184
            else
5185
            {
5186
                Item.IMAGE_URL = Result;
5187
                Item.IMAGE_ANCHOR = x + "," + y + "," + width + "," + height;
5188
                Item.PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber;
5189
                Logger.sendReqLog("SaveCheckList", projectno + "," + checklist_id + "," + Item, 1);
5190
                Logger.sendResLog("SaveCheckList", this.BaseClient.SaveCheckList(projectno, checklist_id, Item).ToString(), 1);
5191
                //this.BaseClient.SaveCheckList(projectno, checklist_id, Item);
5192
            }
5193

    
5194
        }
5195

    
5196
        public void Set_Capture()
5197
        {
5198
            double x = canvasDrawingMouseDownPoint.X;
5199
            double y = canvasDrawingMouseDownPoint.Y;
5200
            double width = dragCaptureBorder.Width;
5201
            double height = dragCaptureBorder.Height;
5202

    
5203
            if (width > 5 || height > 5)
5204
            {
5205
                canvasImage = ConverterBitmapImage(zoomAndPanCanvas);
5206
                BitmapSource source = CutAreaToImage((int)x, (int)y, (int)width, (int)height);
5207
                Save_Capture(source, (int)x, (int)y, (int)width, (int)height);
5208
            }
5209
        }
5210
        #endregion
5211

    
5212
        public Multi_Undo_data Control_Style(CommentUserInfo control)
5213
        {
5214
            multi_Undo_Data = new Multi_Undo_data();
5215

    
5216
            multi_Undo_Data.Markup = control;
5217

    
5218
            if ((control as IShapeControl) != null)
5219
            {
5220
                multi_Undo_Data.paint = (control as IShapeControl).Paint;
5221
            }
5222
            if ((control as IDashControl) != null)
5223
            {
5224
                multi_Undo_Data.DashSize = (control as IDashControl).DashSize;
5225
            }
5226
            if ((control as IPath) != null)
5227
            {
5228
                multi_Undo_Data.LineSize = (control as IPath).LineSize;
5229
            }
5230
            if ((control as UIElement) != null)
5231
            {
5232
                multi_Undo_Data.Opacity = (control as UIElement).Opacity;
5233
            }
5234

    
5235
            return multi_Undo_Data;
5236
        }
5237

    
5238
        private void Comment_Move(object sender, MouseButtonEventArgs e)
5239
        {
5240
            string Select_ID = (((e.Source as Telerik.Windows.Controls.RadButton).DataContext) as IKCOM.MarkupInfoItem).UserID;
5241
            foreach (var items in ViewerDataModel.Instance._markupInfoRevList)
5242
            {
5243
                if (items.UserID == Select_ID)
5244
                {
5245
                    foreach (var item in items.MarkupList)
5246
                    {
5247
                        if (item.PageNumber == pageNavigator.CurrentPage.PageNumber)
5248
                        {
5249
                            MarkupParser.ParseEx(App.ViewInfo.ProjectNO, item.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, "#FFFF0000", "", 
5250
                                items.MarkupInfoID, Commons.shortGuid());
5251
                        }
5252
                    }
5253
                }
5254
            }
5255
        }
5256

    
5257
        public void InkControl_Convert()
5258
        {
5259
            Logger.sendCheckLog("pageNavigator_PageChanging_InkControl_Convert", 1);
5260
            if (inkBoard.Strokes.Count > 0)
5261
            {
5262
                inkBoard.Strokes.ToList().ForEach(stroke =>
5263
                {
5264
                    List<Stroke> removingStroke = new List<Stroke>();
5265
                    StrokeCollection stC = new StrokeCollection();
5266

    
5267
                    removingStroke.Add(stroke);
5268

    
5269
                    InkToPath ip = new InkToPath();
5270
                    List<Point> inkPointSet = new List<Point>();
5271
                    PolygonControl pc = null;
5272
                    pc = new PolygonControl()
5273
                    {
5274
                        Angle = 0,
5275
                        PointSet = new List<Point>(),
5276
                        ControlType = ControlType.Ink
5277
                    };
5278
                    foreach (var item in removingStroke)
5279
                    {
5280
                        inkPointSet.AddRange(ip.StrokeGetPointsPlus(item));
5281
                        inkBoard.Strokes.Remove(item);
5282
                    }
5283
                    if (inkPointSet.Count != 0)
5284
                    {
5285
                        //강인구 추가(PenControl Undo Redo 추가)
5286
                        UndoData = new Undo_data()
5287
                        {
5288
                            IsUndo = false,
5289
                            Event = Event_Type.Create,
5290
                            EventTime = DateTime.Now,
5291
                            Markup_List = new List<Multi_Undo_data>()
5292
                        };
5293

    
5294
                        pc.StartPoint = inkPointSet[0];
5295
                        pc.EndPoint = inkPointSet[inkPointSet.Count - 1];
5296
                        pc.PointSet = inkPointSet;
5297
                        pc.LineSize = 3;
5298
                        pc.CommentID = Commons.shortGuid();
5299
                        pc.StrokeColor = new SolidColorBrush(Colors.Red);
5300
                        ViewerDataModel.Instance.MarkupControls_USER.Add(pc);
5301
                        ///pc.SetPolyPath();
5302

    
5303
                        ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
5304
                        {
5305
                            ViewerDataModel.Instance.UndoDataList.Remove(i);
5306
                        });
5307
                        multi_Undo_Data.Markup = pc as CommentUserInfo;
5308
                        UndoData.Markup_List.Add(multi_Undo_Data);
5309
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);
5310
                    }
5311
                });
5312
            }
5313
        }
5314

    
5315
        /// <summary>
5316
        /// 정원, 정사각형, 정삼각형을 그리기 위한 EndPoint계산
5317
        /// </summary>
5318
        /// <param name="StartP">StartPoint</param>
5319
        /// <param name="EndP">EndPoint</param>
5320
        /// <returns>Return_EndPoint</returns>
5321
        private Point GetSquareEndPoint(Point StartP, Point EndP)
5322
        {
5323
            Point Return_Point = new Point();
5324

    
5325
            double dx = EndP.X - StartP.X;
5326
            double dy = EndP.Y - StartP.Y;
5327
            double length;
5328

    
5329
            switch (controlType)
5330
            {
5331
                case ControlType.Triangle:
5332
                    {
5333
                        //삼각형의 StartPoint기준으로 반지름 만큼 증가하기 때문에 곱하기2 필요
5334
                        length = Math.Max(Math.Abs(dx) * 2, Math.Abs(dy));
5335
                        Return_Point = (dy < 0) ? new Point(StartP.X + length / 2, StartP.Y - length) : new Point(StartP.X + length / 2, StartP.Y + length);
5336
                    }
5337
                    break;
5338
                default:
5339
                    {
5340
                        length = Math.Max(Math.Abs(dx), Math.Abs(dy));
5341
                        Return_Point.X = (dx > 0) ? StartP.X + length : StartP.X - length;
5342
                        Return_Point.Y = (dy > 0) ? StartP.Y + length : StartP.Y - length;
5343
                    }
5344
                    break;
5345
            }
5346

    
5347
            return Return_Point;
5348
        }
5349

    
5350
        /// <summary>
5351
        /// 정삼각형을 그리기위한 두 포인트를 계산하여 넘겨줌
5352
        /// </summary>
5353
        /// <author>humkyung</author>
5354
        /// <date>2018.04.26</date>
5355
        /// <param name="StartP"></param>
5356
        /// <param name="EndP"></param>
5357
        /// <returns></returns>
5358
        /// <history>humkyung 2018.05.11 apply axis lock</history>
5359
        private List<Point> GetRegularTrianglePoints(Point StartP, Point EndP, bool bCheckAxis = false)
5360
        {
5361
            List<Point> res = new List<Point>();
5362

    
5363
            double dx = EndP.X - StartP.X;
5364
            double dy = EndP.Y - StartP.Y;
5365
            double length = Math.Sqrt(dx * dx + dy * dy);
5366
            double baseLength = length * Math.Tan(30.0 * Math.PI / 180.0);
5367
            dx /= length;
5368
            dy /= length;
5369
            double tmp = dx;
5370
            dx = -dy; dy = tmp; /// rotate by 90 degree
5371

    
5372
            res.Add(new Point(EndP.X + dx * baseLength, EndP.Y + dy * baseLength));
5373
            res.Add(new Point(EndP.X - dx * baseLength, EndP.Y - dy * baseLength));
5374

    
5375
            return res;
5376
        }
5377

    
5378
        /// <summary>
5379
        /// 캔버스에 그릴때 모든 포인트가 캔버스를 벗어 났는지 체크하여 넘겨줌
5380
        /// </summary>
5381
        /// <author>ingu</author>
5382
        /// <date>2018.06.05</date>
5383
        /// <param name="getPoint"></param>
5384
        /// <returns></returns>
5385
        private bool IsGetoutpoint(Point getPoint)
5386
        {
5387
            if (getPoint == new Point())
5388
            {
5389
                ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl);
5390
                currentControl = null;
5391
                return true;
5392
            }
5393

    
5394
            return false;
5395
        }
5396

    
5397
        private void zoomAndPanControl_DragOver(object sender, DragEventArgs e)
5398
        {
5399
            e.Effects = DragDropEffects.Copy;
5400
        }
5401

    
5402
        private void zoomAndPanControl_DragEnter(object sender, DragEventArgs e)
5403
        {
5404
            e.Effects = DragDropEffects.Copy;
5405
        }
5406

    
5407
        private void zoomAndPanControl_DragLeave(object sender, DragEventArgs e)
5408
        {
5409
            e.Effects = DragDropEffects.None;
5410
        }
5411

    
5412
        /*
5413
        private void zoomAndPanControl_Drop(object sender, DragEventArgs e)
5414
        {
5415
            try
5416
            {
5417
                if (e.Data.GetDataPresent(typeof(string)))
5418
                {
5419
                    this.getCurrentPoint = e.GetPosition(drawingRotateCanvas);
5420
                    string dragData = e.Data.GetData(typeof(string)) as string;
5421
                    Move_Symbol(sender, dragData);
5422
                }
5423
            }
5424
            catch (Exception ex)
5425
            {
5426
                Logger.sendResLog("zoomAndPanControl_Drop", ex.ToString(), 0);
5427
            }            
5428
        }
5429
        */
5430
    }
5431
}
클립보드 이미지 추가 (최대 크기: 500 MB)