프로젝트

일반

사용자정보

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

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

이력 | 보기 | 이력해설 | 다운로드 (345 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

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

    
52
            T instance = Activator.CreateInstance<T>();
53

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

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

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

    
90
        public TextBox Gui { get; private set; }
91

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

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

    
113
            Gui.Text += line + Environment.NewLine;
114
        }
115
    }
116

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

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

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

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

    
181
                }
182
            }
183
        }
184

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

    
209
        public bool IsSyncPDFMode { get; set; }
210

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

    
235
        #endregion
236

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

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

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

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

    
260
        private bool IsDrawingEnable(Point _canvasZoomPanningMouseDownPoint)
261
        {
262
            if ((_canvasZoomPanningMouseDownPoint.X > 0 &&
263
                zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.X) &&
264
                (_canvasZoomPanningMouseDownPoint.Y > 0 &&
265
                zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.Y))
266
            {
267
                return true;
268
            }
269

    
270
            return false;
271
        }
272

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

    
296
            return false;
297
        }
298

    
299

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

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

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

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

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

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

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

    
369
            Button content = (sender as Button);
370
            MarkupInfoItem item = content.CommandParameter as MarkupInfoItem;
371

    
372
            DeleteItem(item);
373
        }
374

    
375
        System.Windows.Media.Animation.DoubleAnimation da = new System.Windows.Media.Animation.DoubleAnimation();
376

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

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

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

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

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

    
421
            ////GC.Collect();
422
        }
423

    
424
        public void ReleaseAdorner()
425
        {
426
            try
427
            {
428
                Logger.sendCheckLog("pageNavigator_PageChanging_ReleaseAdorner", 1);
429
                if (SelectLayer.Children.Count > 0)
430
                {
431
                    foreach (var item in SelectLayer.Children)
432
                    {
433
                        if (item.GetType().Name == "AdornerFinal")
434
                        {
435
                            (item as AdornerFinal).unRegister();
436

    
437
                            foreach (var InnerItem in (item as AdornerFinal).MemberSet.Cast<AdornerMember>())
438
                            {
439
                                if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData))
440
                                {
441
                                    if (InnerItem.DrawingData.GetType().Name == "PolygonControl")
442
                                    {
443
                                        if ((InnerItem.DrawingData as PolygonControl).CommentID == null)
444
                                        {
445
                                            (InnerItem.DrawingData as PolygonControl).CommentID = Commons.shortGuid();
446
                                        }
447
                                    }
448

    
449
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(InnerItem.DrawingData as CommentUserInfo);
450
                                }
451
                            }
452
                        }
453
                    }
454
                    SelectLayer.Children.Clear();
455
                }
456
            }
457
            catch (Exception ex)
458
            {
459
                Logger.sendResLog("ReleaseAdorner", ex.ToString(), 0);
460
            }            
461
        }
462

    
463
        public List<CommentUserInfo> AddAdorner()
464
        {
465
            List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
466

    
467
            if (SelectLayer.Children.Count > 0)
468
            {
469
                foreach (var item in SelectLayer.Children)
470
                {
471
                    if (item.GetType().Name == "AdornerFinal")
472
                    {
473
                        (item as AdornerFinal).unRegister();
474

    
475
                        foreach (var InnerItem in (item as AdornerFinal).MemberSet.Cast<AdornerMember>())
476
                        {
477
                            if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData))
478
                            {
479
                                adornerSet.Add(InnerItem.DrawingData as CommentUserInfo);
480
                            }
481

    
482
                            Control_Style(InnerItem.DrawingData as CommentUserInfo);
483

    
484
                            UndoData.Markup_List.Add(multi_Undo_Data);
485
                            multi_Undo_Data = new Multi_Undo_data();
486
                        }
487
                    }
488
                }
489
                SelectLayer.Children.Clear();
490
            }
491
            return adornerSet;
492
        }
493

    
494
        public void ChangeCommentReact()
495
        {
496
            Logger.sendCheckLog("pageNavigator_PageChanging_ChangeCommentReact", 1);
497
            bool isComingNewBie = false;
498

    
499
            if (ViewerDataModel.Instance.MarkupControls_USER.Count > 0)
500
            {
501
                foreach (var control in ViewerDataModel.Instance.MarkupControls_USER)
502
                {
503
                    var root = MarkupParser.MarkupToString(control, App.ViewInfo.UserID);
504

    
505
                    var existItem = ViewerDataModel.Instance.MarkupList_USER.Where(data => data.ID == root.CommentID).FirstOrDefault();
506
                    if (existItem != null) //신규 추가 된 코멘트
507
                    {
508
                        if (existItem.Data != root.ConvertData) //코멘트가 같은지
509
                        {
510
                            existItem.Data = root.ConvertData;
511
                            existItem.IsUpdate = true;
512
                            ComingNewBieEnd = false;
513
                        }
514
                    }
515
                    else
516
                    {
517
                        if (root.CommentID != null)
518
                        {
519
                            isComingNewBie = true;
520
                            var currentCommentCheck = ViewerDataModel.Instance.MarkupList_USER.Where(dt => dt.ID == control.CommentID).FirstOrDefault();
521
                            if (currentCommentCheck != null)
522
                            {
523
                                currentCommentCheck.Data = root.ConvertData;
524
                            }
525
                            else
526
                            {
527
                                ViewerDataModel.Instance.MarkupList_USER.Add(new MarkupItemEx
528
                                {
529
                                    ID = control.CommentID,
530
                                    Data = root.ConvertData,
531
                                    Data_Type = root.DATA_TYPE,
532
                                    MarkupInfoID = App.Custom_ViewInfoId,
533
                                    PageNumber = this.pageNavigator.CurrentPage.PageNumber,
534
                                    Symbol_ID = control.SymbolID,
535
                                    Group_ID = control.GroupID,
536
                                });
537
                                ComingNewBieEnd = false;
538
                            }
539
                        }
540
                    }
541
                }
542
            }
543

    
544

    
545
            if (PreviewUserMarkupInfoItem != null && isComingNewBie && !ComingNewBieEnd)
546
            {
547
                if (ViewerDataModel.Instance._markupInfoList.Where(info => info.UserID == PreviewUserMarkupInfoItem.UserID).FirstOrDefault() == null)
548
                {
549
                    ComingNewBieEnd = true;
550
                    ViewerDataModel.Instance._markupInfoList.Insert(0, PreviewUserMarkupInfoItem);
551
                    PreviewUserMarkupInfoItem.IsPreviewUser = false;
552
                    gridViewMarkup.ItemsSource = null;
553
                    gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
554
                    gridViewMarkup.SelectedItem = PreviewUserMarkupInfoItem;
555
                }
556
            }
557

    
558
        }
559

    
560
        bool ComingNewBieEnd = false;
561

    
562
        private void pageNavigator_PageChanging(object sender, Controls.Sample.PageChangeEventArgs e)
563
        {
564
            Logger.sendCheckLog("pageNavigator_PageChanging_Start", 1);
565
            if (ViewerDataModel.Instance.UndoDataList.Count > 0)
566
            {
567
                Logger.sendCheckLog("pageNavigator_PageChanging_이전페이지Save", 1);
568
                this.ParentOfType<MainWindow>().dzTopMenu.SaveEvent(null, null);
569
            }
570
            Logger.sendCheckLog("pageNavigator_PageChanging_UndoDataListClear", 1);
571
            ViewerDataModel.Instance.UndoDataList.Clear();
572

    
573
            InkControl_Convert();
574

    
575
            ReleaseAdorner();
576
            ChangeCommentReact();
577

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

    
582

    
583
            #region 페이지가 벗어난 경우
584

    
585
            if (BalancePoint < 1)
586
            {
587
                BalancePoint = 1;
588
                ViewerDataModel.Instance.PageBalanceNumber = 0;
589
            }
590

    
591
            if (pageNavigator.PageCount < BalancePoint)
592
            {
593
                BalancePoint = pageNavigator.PageCount;
594
                ViewerDataModel.Instance.PageBalanceNumber = 0;
595
            }
596

    
597
            #endregion
598

    
599
            ViewerDataModel.Instance.PageNumber = BalancePoint;
600

    
601
            Logger.sendCheckLog("pageNavigator_PageChanging_페이지 Image url 설정", 1);
602
            string uri = "";
603
            if (userData.COMPANY != "EXT")
604
            {
605
                uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToInt32(_ViewInfo.DocumentItemID) / 100).ToString(), _ViewInfo.DocumentItemID, e.PageNumber);
606
            }
607
            else
608
            {
609
                uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, e.PageNumber);
610
            }
611

    
612
            var defaultBitmapImage = new BitmapImage();
613
            defaultBitmapImage.BeginInit();
614
            defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
615
            defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
616
            defaultBitmapImage.UriSource = new Uri(uri);
617
            defaultBitmapImage.EndInit();
618

    
619
            ViewerDataModel.Instance.ImageViewPath = null;
620
            GC.Collect();
621

    
622
            Logger.sendCheckLog("pageNavigator_PageChanging_BitmapImage Downloading", 1);
623
            if (defaultBitmapImage.IsDownloading)
624
            {
625
                Logger.sendCheckLog("pageNavigator_PageChanging_BitmapImage IsDownloading", 1);
626
                defaultBitmapImage.DownloadCompleted += (ex, arg) =>
627
                {
628
                    defaultBitmapImage.Freeze();
629
                    mainPanel.UpdateLayout();
630
                    GC.Collect();
631
                    ViewerDataModel.Instance.ImageViewPath = defaultBitmapImage;
632
                    ViewerDataModel.Instance.ImageViewWidth = defaultBitmapImage.PixelWidth;
633
                    ViewerDataModel.Instance.ImageViewHeight = defaultBitmapImage.PixelHeight;
634
                };
635
            }
636

    
637
            zoomAndPanCanvas.Width = Convert.ToDouble(e.CurrentPage.PAGE_WIDTH);
638
            zoomAndPanCanvas.Height = Convert.ToDouble(e.CurrentPage.PAGE_HEIGHT);
639

    
640

    
641
            Common.ViewerDataModel.Instance.ContentWidth = zoomAndPanCanvas.Width;
642
            Common.ViewerDataModel.Instance.ContentHeight = zoomAndPanCanvas.Height;
643
            inkBoard.Width = zoomAndPanCanvas.Width;
644
            inkBoard.Height = zoomAndPanCanvas.Height;
645

    
646

    
647

    
648
            if (!testPanel2.IsHidden)
649
            {
650
                Logger.sendCheckLog("pageNavigator_PageChanging_!testPanel2.IsHidden 일 때", 1);
651
                //PDF모드일때 잠시 대기(강인구)
652
                if (IsSyncPDFMode)
653
                {
654
                    Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
655
                    var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber)));
656

    
657
                    Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image Downloading", 1);
658
                    if (pdfpath.IsDownloading)
659
                    {
660
                        pdfpath.DownloadCompleted += (ex, arg) =>
661
                        {
662
                            Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image DownloadCompleted", 1);
663
                            ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
664
                            ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
665
                            ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
666
                            zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
667
                            zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
668
                        };
669
                    }
670
                    else
671
                    {
672
                        Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image Page Setting", 1);
673
                        ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
674
                        ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
675
                        ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
676

    
677
                        zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
678
                        zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
679
                    }
680
                }
681
                else
682
                {
683
                    Logger.sendCheckLog("pageNavigator_PageChanging_uri2 값 설정", 1);
684
                    string uri2 = "";
685
                    if (userData.COMPANY != "EXT")
686
                    {
687
                        uri2 = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, BalancePoint);
688
                    }
689
                    else
690
                    {
691
                        uri2 = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, BalancePoint);
692
                    }
693

    
694
                    Logger.sendCheckLog("pageNavigator_PageChanging_defaultBitmapImage_Compare BitmapImage 설정", 1);
695
                    var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri2));
696

    
697
                    Logger.sendCheckLog("pageNavigator_PageChanging_zoomAndPanCanvas2 Page Setting", 1);
698
                    ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
699
                    ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
700
                    ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
701
                    zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
702
                    zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
703

    
704
                    Logger.sendCheckLog("pageNavigator_PageChanging_zoomAndPanControl ZoomTo 설정", 1);
705
                    zoomAndPanControl.ZoomTo(new Rect
706
                    {
707
                        X = 0,
708
                        Y = 0,
709
                        Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width),
710
                        Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height),
711
                    });
712

    
713
                    Logger.sendCheckLog("pageNavigator_PageChanging_defaultBitmapImage_Compare Downloading", 1);
714
                    if (defaultBitmapImage_Compare.IsDownloading)
715
                    {
716
                        defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
717
                        {
718
                            Logger.sendCheckLog("pageNavigator_PageChanging_defaultBitmapImage_Compare DownloadCompleted", 1);
719
                            ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
720
                            ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
721
                            ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
722

    
723
                            zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
724
                            zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
725

    
726
                            zoomAndPanControl.ZoomTo(new Rect
727
                            {
728
                                X = 0,
729
                                Y = 0,
730
                                Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width),
731
                                Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height),
732
                            });
733
                        };
734
                    }
735
                }
736
                tlSyncPageNum.Text = String.Format("Current Page : {0}", BalancePoint);
737
            }
738

    
739
            this.pageNavigator.SetNextPage();
740

    
741
            if (zoomAndPanCanvas2.Width.IsNaN())
742
            {
743
                zoomAndPanControl.ZoomTo(new Rect { X = 0, Y = 0, Width = zoomAndPanCanvas.Width, Height = zoomAndPanCanvas.Height });
744
            }
745
            Logger.sendCheckLog("pageNavigator_PageChanging_ControlData Setting", 1);
746
            Common.ViewerDataModel.Instance.MarkupControls_USER.Clear();  //전체 제거
747
            Common.ViewerDataModel.Instance.MarkupControls.Clear();  //전체 제거
748

    
749
            List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업
750

    
751
            foreach (var item in gridSelectionItem)
752
            {
753
                if (item.UserID == App.ViewInfo.UserID)
754
                {
755
                    ViewerDataModel.Instance.current_page_commentcnt = ViewerDataModel.Instance.MarkupList_USER.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().Count;
756
                    ViewerDataModel.Instance.MarkupList_USER.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem)
757
                    {
758
                        MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, item.DisplayColor, "", 
759
                            item.MarkupInfoID, markupitem.ID);
760
                    });
761

    
762
                }
763
                else
764
                {
765
                    ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem)
766
                    {
767
                        MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls, item.DisplayColor, "", item.MarkupInfoID);
768
                    });
769
                }
770
            }
771

    
772
            if (!testPanel2.IsHidden)
773
            {
774
                ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
775
                ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
776
                ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
777

    
778
                Common.ViewerDataModel.Instance.MarkupControls_Sync.Clear();
779
                List<MarkupInfoItem> gridSelectionRevItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList();
780

    
781

    
782
                foreach (var item in gridSelectionRevItem)
783
                {
784
                    item.MarkupList.Where(pageItem => pageItem.PageNumber == BalancePoint).ToList().ForEach(delegate (MarkupItem markupitem)
785
                    {
786
                        MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID);
787
                    });
788
                }
789
            }
790

    
791
            var instanceMain = this.ParentOfType<MainWindow>();
792
            instanceMain.dzTopMenu.tlcurrentPage.Text = e.CurrentPage.PAGE_NUMBER.ToString();
793
            instanceMain.dzTopMenu.tlcurrentPage_readonly.Text = e.CurrentPage.PAGE_NUMBER.ToString();
794

    
795
            instanceMain.dzTopMenu.rotateOffSet = 0;
796
            var pageinfo = this.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == e.CurrentPage.PAGE_NUMBER).FirstOrDefault();
797
            drawingPannelRotate(pageinfo.PAGE_ANGLE);
798

    
799
            //}
800
            SetCommentPages(true);
801
        }
802

    
803

    
804
        
805

    
806
        private void SetCommentPages(bool onlyMe = false)
807
        {
808
            Logger.sendCheckLog("pageNavigator_PageChanging_SetCommentPages Setting", 1);
809
            List<UsersCommentPagesMember> _pages = new List<UsersCommentPagesMember>();
810
            foreach (var item in ViewerDataModel.Instance._markupInfoList)
811
            {
812
                UsersCommentPagesMember instance = new UsersCommentPagesMember();
813
                instance.UserName = item.UserName;
814
                instance.Depart = item.Depatment;
815
                instance.MarkupInfoID = item.MarkupInfoID;
816
                instance.IsSelected = true;
817
                instance.isConSolidation = item.Consolidate;
818
                instance.SetColor = item.DisplayColor;
819
                if (item.UserID == App.ViewInfo.UserID && item.MarkupInfoID == item.MarkupInfoID)
820
                {
821
                    instance.PageNumber = ViewerDataModel.Instance.MarkupList_USER.Select(d => d.PageNumber).ToList();
822
                }
823
                else
824
                {
825
                    instance.PageNumber = ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.MarkupInfoID == item.MarkupInfoID).Select(d => d.PageNumber).ToList();
826
                }
827
                _pages.Add(instance);
828
            }
829
            this.pageNavigator.SetCommentList(_pages.ToList());
830
        }
831

    
832
        private void zoomAndPanControl_MouseWheel(object sender, MouseWheelEventArgs e)
833
        {
834
            if (e.MiddleButton == MouseButtonState.Pressed)
835
            {
836

    
837
            }
838
            e.Handled = true;
839
            if (e.Delta > 0)
840
            {
841
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas);
842
                ZoomIn(currentContentMousePoint);
843
            }
844
            else
845
            {
846
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas);
847
                ZoomOut(currentContentMousePoint);
848
            }
849
        }
850

    
851
        private void zoomAndPanControl2_MouseWheel(object sender, MouseWheelEventArgs e)
852
        {
853
            e.Handled = true;
854
            if (e.Delta > 0)
855
            {
856
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas2);
857
                ZoomIn_Sync(currentContentMousePoint);
858
            }
859
            else
860
            {
861
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas2);
862
                ZoomOut_Sync(currentContentMousePoint);
863
            }
864
        }
865

    
866
        #region ZoomIn & ZoomOut
867

    
868
        private void ZoomOut_Executed(object sender, ExecutedRoutedEventArgs e)
869
        {
870
            ZoomOut(new Point(zoomAndPanControl.ContentZoomFocusX,
871
                zoomAndPanControl.ContentZoomFocusY));
872
        }
873

    
874
        private void ZoomIn_Executed(object sender, ExecutedRoutedEventArgs e)
875
        {
876
            ZoomIn(new Point(zoomAndPanControl.ContentZoomFocusX,
877
                zoomAndPanControl.ContentZoomFocusY));
878
        }
879

    
880

    
881
        //강인구 추가 (줌 인아웃 수치 변경)
882
        //큰해상도의 문서일 경우 줌 인 아웃시 사이즈 변동이 큼
883
        private void ZoomOut(Point contentZoomCenter)
884
        {
885
            if (zoomAndPanControl.ContentScale > 0.39)
886
            {
887
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale - 0.2, contentZoomCenter);
888
            }
889
            else
890
            {
891
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale / 2, contentZoomCenter);
892
            }
893

    
894
            if (zoomAndPanControl2 != null && Sync.IsChecked)
895
            {
896
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl.ContentScale, contentZoomCenter);
897
            }
898
        }
899

    
900
        private void ZoomIn(Point contentZoomCenter)
901
        {
902
            if (zoomAndPanControl.ContentScale > 0.19)
903
            {
904
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale + 0.2, contentZoomCenter);
905
            }
906
            else
907
            {
908
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale * 2, contentZoomCenter);
909
            }
910

    
911
            if (zoomAndPanControl2 != null && Sync.IsChecked)
912
            {
913
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl.ContentScale, contentZoomCenter);
914
            }
915

    
916
        }
917

    
918
        private void ZoomOut_Sync(Point contentZoomCenter)
919
        {
920
            if (zoomAndPanControl2.ContentScale > 0.39)
921
            {
922
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale - 0.2, contentZoomCenter);
923
            }
924
            else
925
            {
926
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale / 2, contentZoomCenter);
927
            }
928

    
929
            if (Sync.IsChecked)
930
            {
931
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl2.ContentScale, contentZoomCenter);
932
            }
933
        }
934

    
935
        private void ZoomIn_Sync(Point contentZoomCenter)
936
        {
937
            if (zoomAndPanControl2.ContentScale > 0.19)
938
            {
939
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale + 0.2, contentZoomCenter);
940
            }
941
            else
942
            {
943
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale * 2, contentZoomCenter);
944
            }
945

    
946
            if (Sync.IsChecked)
947
            {
948
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl2.ContentScale, contentZoomCenter);
949
            }
950
        }
951

    
952
        private void ZoomOut()
953
        {
954
            zoomAndPanControl.ContentScale -= 0.1;
955
            //if (zoomAndPanControl2 != null)
956
            //{
957
            //    zoomAndPanControl2.ContentScale -= 0.1;
958
            //}
959
        }
960

    
961
        private void ZoomIn()
962
        {
963
            zoomAndPanControl.ContentScale += 0.1;
964
            //if (zoomAndPanControl2 != null)
965
            //{
966
            //    zoomAndPanControl2.ContentScale += 0.1;
967
            //}
968
        }
969

    
970
        #endregion
971

    
972
        private void init()
973
        {
974
            foreach (var item in ViewerDataModel.Instance.MarkupControls)
975
            {
976

    
977
                ControlList.Clear();
978
                listBox.Items.Clear();
979
                selected_item.Clear();
980

    
981
                (item as IMarkupCommonData).IsSelected = false;
982
            }
983

    
984
        }
985

    
986
        private HitTestResultBehavior MyCallback(HitTestResult result)
987
        {
988
            //this.cursor = Cursors.UpArrow;
989
            var element = result.VisualHit;
990
            while (element != null && !(element is CommentUserInfo))
991
                element = VisualTreeHelper.GetParent(element);
992

    
993
            if (element == null)
994
            {
995
                return HitTestResultBehavior.Stop;
996
            }
997
            else
998
            {
999
                if (element is CommentUserInfo)
1000
                {
1001
                    if (!hitList.Contains(element))
1002
                    {
1003
                        hitList.Add((CommentUserInfo)element);
1004
                    }
1005
                    else
1006
                    {
1007
                        return HitTestResultBehavior.Stop;
1008
                    }
1009
                    //IntersectionDetail intersectionDetail =
1010
                    //((GeometryHitTestResult)result).IntersectionDetail;
1011
                    //switch (intersectionDetail)
1012
                    //{
1013
                    //    case IntersectionDetail.FullyContains:
1014
                    //        // Add the hit test result to the list:
1015
                    //        hitList.Add((CommentUserInfo)result.VisualHit);
1016
                    //        return HitTestResultBehavior.Continue;
1017
                    //    case IntersectionDetail.Intersects:
1018
                    //        // Set the behavior to return visuals at all z-order levels:
1019
                    //        return HitTestResultBehavior.Continue;
1020
                    //    case IntersectionDetail.FullyInside:
1021
                    //        // Set the behavior to return visuals at all z-order levels:
1022
                    //        return HitTestResultBehavior.Continue;
1023
                    //    default:
1024
                    //        return HitTestResultBehavior.Stop;
1025
                    //}
1026
                }
1027
            }
1028
            return HitTestResultBehavior.Continue;
1029
        }
1030

    
1031
        public void ReleaseSelectPath()
1032
        {
1033
            if (SelectionPath == null)
1034
            {
1035
                SelectionPath = new Path();
1036
                SelectionPath.Name = "";
1037
            }
1038
            if (SelectionPath.Name != "")
1039
            {
1040
                SelectionPath.Name = "None";
1041
            }
1042
            SelectionPath.Opacity = 0.01;
1043
            SelectionPath.RenderTransform = null;
1044
            SelectionPath.RenderTransformOrigin = new Point(0, 0);
1045
        }
1046

    
1047
        #region 컨트롤 초기화 
1048
        public void Control_Init(object control)
1049
        {
1050
            if (L_Size != 0 && (control as IPath) != null)
1051
            {
1052
                (control as IPath).LineSize = L_Size;
1053
                L_Size = 0;
1054
            }
1055

    
1056
            switch (control.GetType().Name)
1057
            {
1058
                case "RectangleControl":
1059
                    {
1060
                        (control as RectangleControl).StrokeColor = Brushes.Red;
1061
                    }
1062
                    break;
1063
                case "CircleControl":
1064
                    {
1065
                        (control as CircleControl).StrokeColor = Brushes.Red;
1066
                    }
1067
                    break;
1068
                case "TriControl":
1069
                    {
1070
                        (control as TriControl).StrokeColor = Brushes.Red;
1071
                    }
1072
                    break;
1073
                case "RectCloudControl":
1074
                    {
1075
                        (control as RectCloudControl).StrokeColor = Brushes.Red;
1076
                    }
1077
                    break;
1078
                case "CloudControl":
1079
                    {
1080
                        (control as CloudControl).StrokeColor = Brushes.Red;
1081
                    }
1082
                    break;
1083
                case "PolygonControl":
1084
                    {
1085
                        (control as PolygonControl).StrokeColor = Brushes.Red;
1086
                    }
1087
                    break;
1088
                case "ArcControl":
1089
                    {
1090
                        (control as ArcControl).StrokeColor = Brushes.Red;
1091
                    }
1092
                    break;
1093
                case "ArrowArcControl":
1094
                    {
1095
                        (control as ArrowArcControl).StrokeColor = Brushes.Red;
1096
                    }
1097
                    break;
1098
                case "LineControl":
1099
                    {
1100
                        (control as LineControl).StrokeColor = Brushes.Red;
1101
                    }
1102
                    break;
1103
                case "ArrowControl_Multi":
1104
                    {
1105
                        (control as ArrowControl_Multi).StrokeColor = Brushes.Red;
1106
                    }
1107
                    break;
1108
                case "TextControl":
1109
                    {
1110
                        (control as TextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1111
                    }
1112
                    break;
1113
                case "ArrowTextControl":
1114
                    {
1115
                        (control as ArrowTextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1116
                    }
1117
                    break;
1118
                case "InsideWhiteControl":
1119
                    {
1120
                        (control as InsideWhiteControl).StrokeColor = Brushes.White;
1121
                    }
1122
                    break;
1123
                case "OverlapWhiteControl":
1124
                    {
1125
                        (control as OverlapWhiteControl).StrokeColor = Brushes.White;
1126
                    }
1127
                    break;
1128
                case "ClipWhiteControl":
1129
                    {
1130
                        (control as ClipWhiteControl).StrokeColor = Brushes.White;
1131
                    }
1132
                    break;
1133
                case "CoordinateControl":
1134
                    {
1135
                        (control as CoordinateControl).StrokeColor = Brushes.Black;
1136
                    }
1137
                    break;
1138
            }
1139
        }
1140
        #endregion
1141

    
1142
        public void firstCondition_MouseLeave(object sender, MouseEventArgs e)
1143
        {
1144
            //Control_Init(e.Source);
1145
        }
1146
        private Window _dragdropWindow = null;
1147

    
1148
        [DllImport("user32.dll")]
1149
        [return: MarshalAs(UnmanagedType.Bool)]
1150
        internal static extern bool GetCursorPos(ref Win32Point pt);
1151

    
1152
        [StructLayout(LayoutKind.Sequential)]
1153
        internal struct Win32Point
1154
        {
1155
            public Int32 X;
1156
            public Int32 Y;
1157
        };
1158
        public string symbol_id = null;
1159
        public long symbol_group_id;
1160
        public int symbol_SelectedIndex;
1161
        public ImageSource symbol_img;
1162
        public string symbol_Data = null;
1163
        public void symboldata(string id, long group_id, int SelectedIndex, string Data_, ImageSource img)
1164
        {
1165
            if (this._dragdropWindow != null)
1166
            {
1167
                this._dragdropWindow.Close();
1168
                this._dragdropWindow = null;
1169
            }
1170

    
1171
            symbol_id = id;
1172
            symbol_group_id = group_id;
1173
            symbol_SelectedIndex = SelectedIndex;
1174
            symbol_Data = Data_;
1175
            symbol_img = img;
1176

    
1177
      
1178
            CreateDragDropWindow2(img);
1179
        }
1180

    
1181
        private void CreateDragDropWindow2(ImageSource image)
1182
        {
1183
            this._dragdropWindow = new Window();
1184
            _dragdropWindow.Cursor = new Cursor(MainWindow.CursorChange().StreamSource);
1185
            _dragdropWindow.WindowStyle = WindowStyle.None;
1186
            _dragdropWindow.AllowsTransparency = true;           
1187
            _dragdropWindow.AllowDrop = false;
1188
            _dragdropWindow.Background = null;
1189
            _dragdropWindow.IsHitTestVisible = false;
1190
            _dragdropWindow.SizeToContent = SizeToContent.WidthAndHeight;
1191
            _dragdropWindow.Topmost = true;
1192
            _dragdropWindow.ShowInTaskbar = false;
1193
            
1194
            Rectangle r = new Rectangle();
1195
            r.Width = image.Width;
1196
            r.Height = image.Height;
1197
            r.Opacity = 0.5;            
1198
            r.Fill = new ImageBrush(image);
1199
            this._dragdropWindow.Content = r;
1200

    
1201
            Win32Point w32Mouse = new Win32Point();
1202
            GetCursorPos(ref w32Mouse);
1203

    
1204
            //w32Mouse.X = getCurrentPoint.X;
1205
            this._dragdropWindow.Left = w32Mouse.X - (image.Width / 2);
1206
            this._dragdropWindow.Top = w32Mouse.Y - (image.Height / 2); 
1207
            this._dragdropWindow.Show();
1208
        }
1209

    
1210
        private void zoomAndPanControl_MouseMove(object sender, MouseEventArgs e)
1211
        {
1212
            if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
1213
            {
1214
                if (!floatingTip.IsOpen) { floatingTip.IsOpen = true; }
1215

    
1216
                Point currentPos = e.GetPosition(rect);
1217

    
1218
                floatingTip.HorizontalOffset = currentPos.X + 20;
1219
                floatingTip.VerticalOffset = currentPos.Y;
1220

    
1221

    
1222
                //ToolTip tool = new System.Windows.Controls.ToolTip();
1223
                //tool.Content = "ToolTip";
1224
                //panel.ToolTip = tool;
1225
            }
1226

    
1227
            if (mouseHandlingMode != MouseHandlingMode.Drawing)
1228
            {
1229
                #region 마우스 오버 시 색상 변경
1230
                //var firstCondition = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
1231
                //Color TempColor = MarkupToPDF.Controls.Common.ValueConverter.StringToColorConverter.Parse("FF07B4FF");
1232

    
1233
                //if (firstCondition != null)
1234
                //{
1235
                //    firstCondition.MouseLeave += new System.Windows.Input.MouseEventHandler(firstCondition_MouseLeave);
1236

    
1237
                //    if (firstCondition.GetType().Name == "TextControl")
1238
                //    {
1239
                //        (firstCondition as TextControl).BackInnerColor = new SolidColorBrush(TempColor);
1240
                //        return;
1241
                //    }
1242
                //    else if (firstCondition.GetType().Name == "ArrowTextControl")
1243
                //    {
1244
                //        (firstCondition as ArrowTextControl).BackInnerColor = new SolidColorBrush(TempColor);
1245
                //        return;
1246
                //    }
1247

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

    
1301
                //        default:
1302
                //            {
1303

    
1304
                //            }
1305
                //            break;
1306
                //    }
1307
                //} 
1308
                #endregion
1309
            }
1310

    
1311
            getCurrentPoint = e.GetPosition(drawingRotateCanvas);
1312
            #region 주석
1313
            //if (mouseButtonDown == MouseButton.Middle)
1314
            //{
1315
            //    SetCursor();
1316
            //    Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1317
            //    Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1318

    
1319
            //    Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
1320
            //    zoomAndPanControl.ContentOffsetX -= dragOffset.X;
1321
            //    zoomAndPanControl.ContentOffsetY -= dragOffset.Y;
1322

    
1323
            //    //SetCursor();
1324
            //    //Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1325
            //    //Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1326

    
1327
            //    //Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
1328

    
1329
            //    //zoomAndPanControl.ContentOffsetX += 1;
1330
            //    //zoomAndPanControl.ContentOffsetY += 1;
1331

    
1332
            //    //zoomAndPanControl.ContentOffsetX += dragOffset.X;
1333
            //    //zoomAndPanControl.ContentOffsetY += dragOffset.Y;
1334
            //}
1335
            #endregion
1336

    
1337
            if ((mouseButtonDown == MouseButton.Middle) || (mouseButtonDown == MouseButton.Right))
1338
            {
1339
                SetCursor();
1340
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1341
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1342

    
1343
                Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
1344
                zoomAndPanControl.ContentOffsetX -= dragOffset.X;
1345
                zoomAndPanControl.ContentOffsetY -= dragOffset.Y;
1346

    
1347
                if (Sync.IsChecked)
1348
                {
1349
                    ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
1350
                    ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
1351
                }
1352
            }
1353

    
1354
            if (mouseHandlingMode == MouseHandlingMode.Drawing && mouseButtonDown == MouseButton.Left)
1355
            {
1356
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1357
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1358
                SetCursor();
1359

    
1360
                if (IsDrawing)
1361
                {
1362
                    if (currentControl == null)
1363
                    {
1364
                        switch (controlType)
1365
                        {
1366
                            case ControlType.PenControl:
1367
                                {
1368
                                    if (inkBoard.Tag.ToString() == "Ink")
1369
                                    {
1370
                                        stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y));
1371
                                    }
1372
                                    else if (inkBoard.Tag.ToString() == "EraseByPoint")
1373
                                    {
1374
                                        RemovePointStroke(currentCanvasDrawingMouseMovePoint);
1375
                                    }
1376
                                    else if (inkBoard.Tag.ToString() == "EraseByStroke")
1377
                                    {
1378
                                        RemoveLineStroke(currentCanvasDrawingMouseMovePoint);
1379
                                    }
1380

    
1381
                                    //inkBoard.Strokes.Add(stroke);
1382
                                }
1383
                                break;
1384
                        }
1385
                        return;
1386
                    }
1387
                }
1388

    
1389
                if (currentControl != null)
1390
                {
1391
                    double moveX = currentCanvasDrawingMouseMovePoint.X - canvasDrawingMouseDownPoint.X;
1392
                    double moveY = currentCanvasDrawingMouseMovePoint.Y - canvasDrawingMouseDownPoint.Y;
1393
                    //강인구 추가
1394
                    currentControl.Opacity = ViewerDataModel.Instance.ControlOpacity;
1395

    
1396
                    if ((currentControl as IPath) != null)
1397
                    {
1398
                        (currentControl as IPath).LineSize = ViewerDataModel.Instance.LineSize;
1399
                    }
1400
                    if ((currentControl as LineControl) != null)
1401
                    {
1402
                        (currentControl as LineControl).Interval = ViewerDataModel.Instance.Interval;
1403
                    }
1404

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

    
1448
                    switch (controlType)
1449
                    {
1450
                        case (ControlType.Coordinate):
1451
                            {
1452
                                var control = currentControl as CoordinateControl;
1453

    
1454
                                if (control != null)
1455
                                {
1456
                                    if (move.mousemode == MouseMode.Drawing)
1457
                                    {
1458
                                        //move.control_Move(ControlList, true, moveX, moveY);
1459
                                    }
1460
                                    else
1461
                                    {
1462
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1463
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1464
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1465
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1466

    
1467

    
1468
                                        if (ViewerDataModel.Instance.IsPressShift)
1469
                                        {
1470
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1471
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1472
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1473
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1474
                                        }
1475

    
1476
                                        control.PointSet = new List<Point>
1477
                                        {
1478
                                            control.StartPoint,
1479
                                            control.LeftBottomPoint,
1480
                                            control.EndPoint,
1481
                                            control.TopRightPoint,
1482
                                        };
1483
                                        control.updateControl();
1484
                                    }
1485

    
1486
                                    //강인구 추가
1487
                                    control.ControlType = controlType;
1488
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1489
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1490
                                    //  control.Paint = PaintSet.Fill;
1491
                                }
1492
                            }
1493
                            break;
1494
                        case (ControlType.InsideWhite):
1495
                            {
1496
                                var control = currentControl as InsideWhiteControl;
1497

    
1498
                                if (control != null)
1499
                                {
1500
                                    if (move.mousemode == MouseMode.Drawing)
1501
                                    {
1502
                                        //move.control_Move(ControlList, true, moveX, moveY);
1503
                                    }
1504
                                    else
1505
                                    {
1506
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1507
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1508
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1509
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1510

    
1511

    
1512
                                        if (ViewerDataModel.Instance.IsPressShift)
1513
                                        {
1514
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1515
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1516
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1517
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1518
                                        }
1519

    
1520
                                        control.PointSet = new List<Point>
1521
                                        {
1522
                                            control.StartPoint,
1523
                                            control.LeftBottomPoint,
1524
                                            control.EndPoint,
1525
                                            control.TopRightPoint,
1526
                                        };
1527
                                        control.updateControl();
1528
                                    }
1529

    
1530
                                    //강인구 추가
1531
                                    control.ControlType = controlType;
1532
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1533
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1534
                                    control.Paint = PaintSet.Fill;
1535
                                }
1536
                            }
1537
                            break;
1538
                        case (ControlType.OverlapWhite):
1539
                            {
1540
                                var control = currentControl as OverlapWhiteControl;
1541

    
1542
                                if (control != null)
1543
                                {
1544
                                    if (move.mousemode == MouseMode.Drawing)
1545
                                    {
1546
                                        //move.control_Move(ControlList, true, moveX, moveY);
1547
                                    }
1548
                                    else
1549
                                    {
1550
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1551
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1552
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1553
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1554

    
1555

    
1556
                                        if (ViewerDataModel.Instance.IsPressShift)
1557
                                        {
1558
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1559
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1560
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1561
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1562
                                        }
1563

    
1564
                                        control.PointSet = new List<Point>
1565
                                        {
1566
                                            control.StartPoint,
1567
                                            control.LeftBottomPoint,
1568
                                            control.EndPoint,
1569
                                            control.TopRightPoint,
1570
                                        };
1571
                                        control.updateControl();
1572
                                    }
1573

    
1574
                                    //강인구 추가
1575
                                    control.ControlType = controlType;
1576
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1577
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1578
                                    control.Paint = PaintSet.Fill;
1579
                                }
1580
                            }
1581
                            break;
1582
                        case (ControlType.ClipWhite):
1583
                            {
1584
                                var control = currentControl as ClipWhiteControl;
1585

    
1586
                                if (control != null)
1587
                                {
1588
                                    if (move.mousemode == MouseMode.Drawing)
1589
                                    {
1590
                                        //move.control_Move(ControlList, true, moveX, moveY);
1591
                                    }
1592
                                    else
1593
                                    {
1594
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1595
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1596
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1597
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1598

    
1599

    
1600
                                        if (ViewerDataModel.Instance.IsPressShift)
1601
                                        {
1602
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1603
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1604
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1605
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1606
                                        }
1607

    
1608
                                        control.PointSet = new List<Point>
1609
                                        {
1610
                                            control.StartPoint,
1611
                                            control.LeftBottomPoint,
1612
                                            control.EndPoint,
1613
                                            control.TopRightPoint,
1614
                                        };
1615
                                        control.updateControl();
1616
                                    }
1617

    
1618
                                    //강인구 추가
1619
                                    control.ControlType = controlType;
1620
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1621
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1622
                                    control.Paint = PaintSet.Fill;
1623
                                }
1624
                            }
1625
                            break;
1626
                        case ControlType.Rectangle:
1627
                            {
1628
                                var control = currentControl as RectangleControl;
1629

    
1630
                                if (control != null)
1631
                                {
1632
                                    if (move.mousemode == MouseMode.Drawing)
1633
                                    {
1634
                                        //move.control_Move(ControlList, true, moveX, moveY);
1635
                                    }
1636
                                    else
1637
                                    {
1638
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1639
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1640
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1641
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1642

    
1643

    
1644
                                        if (ViewerDataModel.Instance.IsPressShift)
1645
                                        {
1646
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1647
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1648
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1649
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1650
                                        }
1651

    
1652
                                        control.PointSet = new List<Point>
1653
                                        {
1654
                                            control.StartPoint,
1655
                                            control.LeftBottomPoint,
1656
                                            control.EndPoint,
1657
                                            control.TopRightPoint,
1658
                                        };
1659
                                        control.updateControl();
1660
                                    }
1661

    
1662
                                    //강인구 추가
1663
                                    control.ControlType = controlType;
1664
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1665
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1666
                                }
1667
                            }
1668
                            break;
1669

    
1670
                        case ControlType.RectCloud:
1671
                            {
1672
                                var control = currentControl as RectCloudControl;
1673

    
1674
                                if (control != null)
1675
                                {
1676
                                    if (move.mousemode == MouseMode.Drawing)
1677
                                    {
1678
                                        //move.control_Move(ControlList, true, moveX, moveY);
1679
                                    }
1680
                                    else
1681
                                    {
1682
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1683
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1684
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1685
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1686

    
1687
                                        if (ViewerDataModel.Instance.IsPressShift)
1688
                                        {
1689
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1690
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1691
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1692
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1693
                                        }
1694

    
1695
                                        control.PointSet = new List<Point>
1696
                                        {
1697
                                            control.StartPoint,
1698
                                            control.LeftBottomPoint,
1699
                                            control.EndPoint,
1700
                                            control.TopRightPoint,
1701
                                        };
1702
                                    }
1703

    
1704
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1705
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1706
                                }
1707
                            }
1708
                            break;
1709

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

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

    
1732
                                    control.PointSet = new List<Point>
1733
                                        {
1734
                                            control.StartPoint,
1735
                                            control.EndPoint,
1736
                                        };
1737

    
1738
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1739
                                }
1740

    
1741
                            }
1742
                            break;
1743

    
1744
                        case ControlType.CancelLine:
1745
                            {
1746
                                var control = currentControl as LineControl;
1747
                                if (control != null)
1748
                                {
1749
                                    control.LineStyleSet = LineStyleSet.CancelLine;
1750
                                    //control.LineStyle = LineControl.LineStyleSet.MultiLine;
1751
                                    control.ControlType = controlType;
1752
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1753
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1754
                                    Point tempPoint = control.EndPoint;
1755

    
1756
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1757
                                    {
1758
                                        //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1759
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1760
                                        control.EndPoint = tempPoint;
1761
                                    }
1762
                                    else
1763
                                    {
1764
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1765
                                    }
1766

    
1767

    
1768
                                    control.PointSet = new List<Point>
1769
                                            {
1770
                                                control.StartPoint,
1771
                                                control.EndPoint,
1772
                                            };
1773
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1774
                                }
1775

    
1776

    
1777
                            }
1778
                            break;
1779

    
1780
                        case ControlType.ArrowLine:
1781
                            {
1782
                                var control = currentControl as LineControl;
1783
                                if (control != null)
1784
                                {
1785
                                    control.LineStyleSet = LineStyleSet.ArrowLine;
1786
                                    control.ControlType = controlType;
1787
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1788
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1789
                                    Point tempPoint = control.EndPoint;
1790

    
1791
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1792
                                    {
1793
                                        //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1794
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1795
                                        control.EndPoint = tempPoint;
1796
                                    }
1797
                                    else
1798
                                    {
1799
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1800
                                    }
1801

    
1802

    
1803
                                    control.PointSet = new List<Point>
1804
                                            {
1805
                                                control.StartPoint,
1806
                                                control.EndPoint,
1807
                                            };
1808
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1809
                                }
1810
                            }
1811
                            break;
1812

    
1813
                        case ControlType.TwinLine:
1814
                            {
1815
                                var control = currentControl as LineControl;
1816
                                if (control != null)
1817
                                {
1818
                                    control.LineStyleSet = LineStyleSet.TwinLine;
1819
                                    control.ControlType = controlType;
1820
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1821
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1822
                                    Point tempPoint = control.EndPoint;
1823

    
1824
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1825
                                    {
1826
                                        //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1827
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1828
                                        control.EndPoint = tempPoint;
1829
                                    }
1830
                                    else
1831
                                    {
1832
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1833
                                    }
1834

    
1835

    
1836
                                    control.PointSet = new List<Point>
1837
                                            {
1838
                                                control.StartPoint,
1839
                                                control.EndPoint,
1840
                                            };
1841
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1842
                                }
1843
                            }
1844
                            break;
1845

    
1846
                        case ControlType.DimLine:
1847
                            {
1848
                                var control = currentControl as LineControl;
1849
                                if (control != null)
1850
                                {
1851
                                    control.LineStyleSet = LineStyleSet.DimLine;
1852
                                    control.ControlType = controlType;
1853
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1854
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1855
                                    Point tempPoint = control.EndPoint;
1856

    
1857
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1858
                                    {
1859
                                        //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1860
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1861
                                        control.EndPoint = tempPoint;
1862
                                    }
1863
                                    else
1864
                                    {
1865
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1866
                                    }
1867

    
1868
                                    control.PointSet = new List<Point>
1869
                                            {
1870
                                                control.StartPoint,
1871
                                                control.EndPoint,
1872
                                            };
1873
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1874
                                }
1875
                            }
1876
                            break;
1877

    
1878
                        case ControlType.ChainLine:
1879
                            {
1880
                                var control = currentControl as PolygonControl;
1881

    
1882
                                if (control != null)
1883
                                {
1884

    
1885
                                    control.PointSet.RemoveAt(control.PointSet.Count - 1);
1886
                                    control.PointSet.Add(currentCanvasDrawingMouseMovePoint);
1887

    
1888
                                    Point tempPoint = control.PointSet[control.PointSet.Count - 1];
1889

    
1890
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1891
                                    {
1892
                                        //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1893
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.PointSet[control.PointSet.Count - 2], ref tempPoint, true);
1894
                                        control.PointSet[control.PointSet.Count - 1] = tempPoint;
1895
                                        //control.EndPoint = tempPoint;
1896
                                    }
1897
                                    else
1898
                                    {
1899
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1900
                                    }
1901

    
1902
                                    ///control.SetPolyPath();
1903

    
1904
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1905
                                }
1906
                            }
1907
                            break;
1908

    
1909
                        case ControlType.ArcLine:
1910
                            {
1911
                                var control = currentControl as ArcControl;
1912
                                if (control != null)
1913
                                {
1914
                                    control.isTransOn = false;
1915
                                    control.ControlType = controlType;
1916
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1917
                                    control.MidPoint = new Point(0, 0);
1918
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1919
                                    Point tempPoint = control.EndPoint;
1920

    
1921
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1922
                                    {
1923
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1924
                                        control.EndPoint = tempPoint;
1925
                                    }
1926
                                    else
1927
                                    {
1928
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1929
                                    }
1930

    
1931

    
1932
                                    control.PointSet = new List<Point>
1933
                                            {
1934
                                                control.StartPoint,
1935
                                                control.MidPoint,
1936
                                                control.EndPoint,
1937
                                            };
1938
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1939
                                }
1940
                            }
1941
                            break;
1942

    
1943
                        case ControlType.ArcArrow:
1944
                            {
1945
                                var control = currentControl as ArrowArcControl;
1946
                                if (control != null)
1947
                                {
1948
                                    control.isTransOn = false;
1949
                                    control.ControlType = controlType;
1950
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1951
                                    control.MidPoint = new Point(0, 0);
1952
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1953
                                    Point tempPoint = control.EndPoint;
1954

    
1955
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1956
                                    {
1957
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1958
                                        control.EndPoint = tempPoint;
1959
                                    }
1960
                                    else
1961
                                    {
1962
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1963
                                    }
1964

    
1965

    
1966
                                    control.PointSet = new List<Point>
1967
                                            {
1968
                                                control.StartPoint,
1969
                                                control.MidPoint,
1970
                                                control.EndPoint,
1971
                                            };
1972
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1973
                                }
1974
                            }
1975
                            break;
1976

    
1977
                        case ControlType.ArrowMultiLine:
1978
                            {
1979
                                var control = currentControl as ArrowControl_Multi;
1980
                                if (control != null)
1981
                                {
1982
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1983
                                    Point tempPoint = control.EndPoint;
1984
                                    if (control.MiddlePoint == new Point(0, 0))
1985
                                    {
1986
                                        if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1987
                                        {
1988
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1989
                                            //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1990
                                            control.EndPoint = tempPoint;
1991
                                        }
1992
                                        else
1993
                                        {
1994
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1995
                                        }
1996
                                    }
1997
                                    else
1998
                                    {
1999
                                        if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2000
                                        {
2001
                                            //var AngleValue = MathSet.returnAngleString(control.MiddlePoint, ref tempPoint, true);
2002
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.MiddlePoint, ref tempPoint, true);
2003
                                            control.EndPoint = tempPoint;
2004
                                        }
2005
                                        else
2006
                                        {
2007
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.MiddlePoint, ref tempPoint, false);
2008
                                        }
2009

    
2010
                                    }
2011

    
2012
                                    control.PointSet = new List<Point>
2013
                                            {
2014
                                                control.StartPoint,
2015
                                                control.MiddlePoint,
2016
                                                control.EndPoint,
2017
                                            };
2018
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
2019
                                }
2020
                            }
2021
                            break;
2022

    
2023
                        case ControlType.Circle:
2024
                            {
2025
                                var control = currentControl as CircleControl;
2026

    
2027
                                if (control != null)
2028
                                {
2029
                                    if (move.mousemode == MouseMode.Drawing)
2030
                                    {
2031
                                        //move.control_Move(ControlList, true, moveX, moveY);
2032
                                    }
2033
                                    else
2034
                                    {
2035
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2036
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2037
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2038
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2039

    
2040
                                        if (ViewerDataModel.Instance.IsPressShift)
2041
                                        {
2042
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
2043
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
2044
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
2045
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
2046
                                        }
2047

    
2048
                                        control.PointSet = new List<Point>
2049
                                        {
2050
                                            control.StartPoint,
2051
                                            control.LeftBottomPoint,
2052
                                            control.EndPoint,
2053
                                            control.TopRightPoint,
2054
                                        };
2055
                                    }
2056

    
2057
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
2058
                                    control.Paint = ViewerDataModel.Instance.paintSet;
2059

    
2060
                                }
2061
                            }
2062
                            break;
2063

    
2064
                        case ControlType.PolygonCloud:
2065
                            {
2066
                                var control = currentControl as CloudControl;
2067

    
2068
                                if (control != null)
2069
                                {
2070
                                    control.isTransOn = true;
2071
                                    control.PointSet.RemoveAt(control.PointSet.Count - 1);
2072

    
2073
                                    control.PointSet.Add(currentCanvasDrawingMouseMovePoint);
2074

    
2075
                                    control.SetCloud();
2076
                                    //강인구 추가
2077
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
2078
                                    control.Paint = ViewerDataModel.Instance.paintSet;
2079
                                }
2080
                            }
2081
                            break;
2082

    
2083
                        case ControlType.Triangle:
2084
                            {
2085
                                var control = currentControl as TriControl;
2086

    
2087
                                if (control != null)
2088
                                {
2089
                                    if (move.mousemode == MouseMode.Drawing)
2090
                                    {
2091
                                        //move.control_Move(ControlList, true, moveX, moveY);
2092
                                    }
2093
                                    else
2094
                                    {
2095
                                        control.Paint = ViewerDataModel.Instance.paintSet;
2096
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2097

    
2098
                                        if (ViewerDataModel.Instance.checkAxis)
2099
                                        {
2100
                                            Point tempPoint = control.EndPoint;
2101
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2102
                                            control.EndPoint = tempPoint;
2103
                                        }
2104

    
2105

    
2106
                                        if (ViewerDataModel.Instance.IsPressShift)
2107
                                        {
2108
                                            List<Point> Points = GetRegularTrianglePoints(control.StartPoint, control.EndPoint);
2109
                                            if (2 == Points.Count())
2110
                                            {
2111
                                                control.MidPoint = Points[0];
2112
                                                control.EndPoint = Points[1];
2113
                                            }
2114
                                        }
2115

    
2116
                                        control.PointSet = new List<Point>
2117
                                            {
2118
                                                control.StartPoint,
2119
                                                control.MidPoint,
2120
                                                control.EndPoint,
2121
                                            };
2122
                                    }
2123

    
2124
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
2125
                                    control.Paint = ViewerDataModel.Instance.paintSet;
2126
                                }
2127
                            }
2128
                            break;
2129

    
2130
                        case ControlType.ImgControl:
2131
                            {
2132
                                var control = currentControl as ImgControl;
2133

    
2134
                                if (control != null)
2135
                                {
2136
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2137
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2138
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2139
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2140

    
2141
                                    control.PointSet = new List<Point>
2142
                                        {
2143
                                            control.StartPoint,
2144
                                            control.LeftBottomPoint,
2145
                                            control.EndPoint,
2146
                                            control.TopRightPoint,
2147
                                        };
2148
                                }
2149
                            }
2150
                            break;
2151

    
2152
                        case ControlType.Date:
2153
                            {
2154
                                var control = currentControl as DateControl;
2155

    
2156
                                if (control != null)
2157
                                {
2158
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2159
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2160
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2161
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2162
                                    //control.Text = DateTime.Now.ToString("yyyy-MM-dd");
2163

    
2164
                                    control.PointSet = new List<Point>
2165
                                        {
2166
                                            control.StartPoint,
2167
                                            control.LeftBottomPoint,
2168
                                            control.EndPoint,
2169
                                            control.TopRightPoint,
2170
                                        };
2171
                                }
2172
                            }
2173
                            break;
2174

    
2175
                        case ControlType.ArrowTextControl:
2176
                            {
2177
                                var control = currentControl as ArrowTextControl;
2178

    
2179
                                if (control != null)
2180
                                {
2181
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2182
                                    Point tempPoint = control.EndPoint;
2183

    
2184
                                    control.MidPoint = new Point(control.EndPoint.X - 100, control.EndPoint.Y - 100);
2185

    
2186
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2187
                                    {
2188
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2189
                                        control.EndPoint = tempPoint;
2190
                                    }
2191
                                    else
2192
                                    {
2193
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2194
                                    }
2195
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2196

    
2197
                                    control.PointSet = new List<Point>
2198
                                            {
2199
                                                control.StartPoint,
2200
                                                control.MidPoint,
2201
                                                control.EndPoint,
2202
                                            };
2203
                                }
2204
                            }
2205
                            break;
2206

    
2207
                        case ControlType.ArrowTransTextControl:
2208
                            {
2209
                                var control = currentControl as ArrowTextControl;
2210

    
2211
                                if (control != null)
2212
                                {
2213
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2214
                                    Point tempPoint = control.EndPoint;
2215
                                    //control.MidPoint = currentCanvasDrawingMouseMovePoint;
2216

    
2217
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2218
                                    {
2219
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2220
                                        control.EndPoint = tempPoint;
2221
                                    }
2222
                                    else
2223
                                    {
2224
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2225
                                    }
2226
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2227
                                    control.isFixed = true;
2228

    
2229
                                    control.PointSet = new List<Point>
2230
                                            {
2231
                                                control.StartPoint,
2232
                                                control.MidPoint,
2233
                                                control.EndPoint,
2234
                                            };
2235
                                }
2236
                            }
2237
                            break;
2238

    
2239
                        case ControlType.ArrowTextBorderControl:
2240
                            {
2241
                                var control = currentControl as ArrowTextControl;
2242

    
2243
                                if (control != null)
2244
                                {
2245
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2246
                                    Point tempPoint = control.EndPoint;
2247
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2248
                                    {
2249
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2250
                                        control.EndPoint = tempPoint;
2251
                                    }
2252
                                    else
2253
                                    {
2254
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2255
                                    }
2256
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2257
                                    control.PointSet = new List<Point>
2258
                                            {
2259
                                                control.StartPoint,
2260
                                                control.MidPoint,
2261
                                                control.EndPoint,
2262
                                            };
2263
                                }
2264

    
2265
                            }
2266
                            break;
2267
                        case ControlType.ArrowTransTextBorderControl:
2268
                            {
2269
                                var control = currentControl as ArrowTextControl;
2270

    
2271
                                if (control != null)
2272
                                {
2273
                                    control.isFixed = true;
2274
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2275
                                    Point tempPoint = control.EndPoint;
2276
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2277
                                    {
2278
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2279
                                        control.EndPoint = tempPoint;
2280
                                    }
2281
                                    else
2282
                                    {
2283
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2284
                                    }
2285

    
2286
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2287
                                    control.PointSet = new List<Point>
2288
                                            {
2289
                                                control.StartPoint,
2290
                                                control.MidPoint,
2291
                                                control.EndPoint,
2292
                                            };
2293
                                }
2294

    
2295
                            }
2296
                            break;
2297
                        case ControlType.ArrowTextCloudControl:
2298
                            {
2299
                                var control = currentControl as ArrowTextControl;
2300

    
2301
                                if (control != null)
2302
                                {
2303
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2304
                                    Point tempPoint = control.EndPoint;
2305
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2306
                                    {
2307
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2308
                                        control.EndPoint = tempPoint;
2309
                                    }
2310
                                    else
2311
                                    {
2312
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2313
                                    }
2314
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2315
                                    control.PointSet = new List<Point>
2316
                                            {
2317
                                                control.StartPoint,
2318
                                                control.MidPoint,
2319
                                                control.EndPoint,
2320
                                            };
2321
                                }
2322

    
2323
                            }
2324
                            break;
2325
                        case ControlType.ArrowTransTextCloudControl:
2326
                            {
2327
                                var control = currentControl as ArrowTextControl;
2328

    
2329
                                if (control != null)
2330
                                {
2331
                                    control.isFixed = true;
2332
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2333
                                    Point tempPoint = control.EndPoint;
2334
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2335
                                    {
2336
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2337
                                        control.EndPoint = tempPoint;
2338
                                    }
2339
                                    else
2340
                                    {
2341
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2342
                                    }
2343
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2344
                                    control.PointSet = new List<Point>
2345
                                            {
2346
                                                control.StartPoint,
2347
                                                control.MidPoint,
2348
                                                control.EndPoint,
2349
                                            };
2350
                                }
2351

    
2352
                            }
2353
                            break;
2354
                        case ControlType.PolygonControl:
2355
                            {
2356

    
2357
                                var control = currentControl as PolygonControl;
2358

    
2359
                                if (control != null)
2360
                                {
2361
                                    control.PointSet.RemoveAt(control.PointSet.Count - 1);
2362
                                    control.PointSet.Add(currentCanvasDrawingMouseMovePoint);
2363
                                    control.Paint = ViewerDataModel.Instance.paintSet;
2364
                                    ///control.SetPolyPath();
2365
                                    //강인구 추가
2366
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
2367
                                    control.Paint = ViewerDataModel.Instance.paintSet;
2368
                                }
2369
                            }
2370
                            break;
2371
                        //강인구 추가
2372
                        case ControlType.Sign:
2373
                            {
2374
                                var control = currentControl as SignControl;
2375

    
2376
                                if (control != null)
2377
                                {
2378
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2379
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2380
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2381
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2382

    
2383
                                    if (control.StartPoint != control.EndPoint && control.SignImage == null)
2384
                                    {
2385
                                        var _sign = GetUserSign.GetSign(App.ViewInfo.UserID, App.ViewInfo.ProjectNO);
2386
                                        byte[] imageBytes = System.Convert.FromBase64String(_sign);
2387
                                        System.IO.MemoryStream stream = new System.IO.MemoryStream();
2388
                                        stream.Write(imageBytes, 0, imageBytes.Length);
2389
                                        stream.Position = 0;
2390
                                        System.Drawing.Image img = System.Drawing.Image.FromStream(stream);
2391
                                        BitmapImage returnImage = new BitmapImage();
2392
                                        returnImage.BeginInit();
2393
                                        System.IO.MemoryStream ms = new System.IO.MemoryStream();
2394
                                        img.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
2395
                                        ms.Seek(0, System.IO.SeekOrigin.Begin);
2396
                                        returnImage.StreamSource = ms;
2397
                                        returnImage.EndInit();
2398
                                        stream.Close();
2399

    
2400
                                        control.SignImage = returnImage;
2401
                                    }
2402
                                    control.PointSet = new List<Point>
2403
                                        {
2404
                                            control.StartPoint,
2405
                                            control.LeftBottomPoint,
2406
                                            control.EndPoint,
2407
                                            control.TopRightPoint,
2408
                                        };
2409
                                }
2410
                            }
2411
                            break;
2412
                        //TODO: 강인구 추가
2413
                        case ControlType.Symbol:
2414
                            {
2415
                                var control = currentControl as SymControl;
2416

    
2417
                                if (control != null)
2418
                                {
2419
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2420
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2421
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2422
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2423
                                    control.LineSize = ViewerDataModel.Instance.LineSize + 3;
2424
                                    control.StrokeColor = new SolidColorBrush(Colors.Red);
2425

    
2426
                                    if (control.StartPoint != control.EndPoint)
2427
                                    {
2428
                                        if (control.PathData == null)
2429
                                        {
2430
                                            using (StringToPathConverter Convert = new StringToPathConverter())
2431
                                            {
2432
                                                control.PathData = Convert.Convert("M-5,5L0,0L20,30L40,-20 ");
2433
                                            }
2434
                                        }
2435
                                    }
2436

    
2437
                                    control.PointSet = new List<Point>
2438
                                        {
2439
                                            control.StartPoint,
2440
                                            control.LeftBottomPoint,
2441
                                            control.EndPoint,
2442
                                            control.TopRightPoint,
2443
                                        };
2444
                                }
2445
                            }
2446
                            break;
2447
                        ///TODO: 
2448
                        case ControlType.Stamp:
2449
                            {
2450
                                var control = currentControl as SymControlN;
2451

    
2452
                                if (control != null)
2453
                                {
2454

    
2455
                                    if (control.StartPoint == control.EndPoint)
2456
                                    {
2457
                                        //string appovalData = "";
2458

    
2459
                                        var xamlData = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString_NonPrefix(App.SystemInfo.STAMP);
2460
                                        xamlData = xamlData.Replace("daelim", "DAELIM");
2461

    
2462

    
2463
                                        //object obj = System.Windows.Markup.XamlReader.Load(xamlData);
2464

    
2465
                                        System.IO.MemoryStream stream = new System.IO.MemoryStream();
2466
                                        System.IO.StreamWriter writer = new System.IO.StreamWriter(stream);
2467
                                        writer.Write(xamlData);
2468
                                        writer.Flush();
2469
                                        stream.Position = 0;
2470

    
2471
                                        control.StrokeColor = new SolidColorBrush(Colors.Red);
2472
                                        object obj = System.Windows.Markup.XamlReader.Load(stream);
2473
                                        UIElement ob = obj as UIElement;
2474

    
2475
                                        //control.ApplyTemplate();
2476

    
2477
                                        control.SetViewBox();
2478
                                        control.PathXathData = App.SystemInfo.STAMP;
2479
                                        control.Base_ViewBox.Child = ob;
2480
                                    }
2481

    
2482
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2483
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2484
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2485
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2486
                                    //control.LineSize = ViewerDataModel.Instance.LineSize + 3;
2487

    
2488

    
2489
                                    control.PointSet = new List<Point>
2490
                                    {
2491
                                        control.StartPoint,
2492
                                        control.LeftBottomPoint,
2493
                                        control.EndPoint,
2494
                                        control.TopRightPoint,
2495
                                    };
2496
                                }
2497
                            }
2498
                            break;
2499
                        case ControlType.Mark:
2500
                            {
2501
                                var control = currentControl as RectangleControl;
2502

    
2503
                                if (control != null)
2504
                                {
2505
                                    if (move.mousemode == MouseMode.Drawing)
2506
                                    {
2507
                                        //move.control_Move(ControlList, true, moveX, moveY);
2508
                                    }
2509
                                    else
2510
                                    {
2511
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2512
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2513
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2514
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2515

    
2516

    
2517
                                        control.PointSet = new List<Point>
2518
                                    {
2519
                                        control.StartPoint,
2520
                                        control.LeftBottomPoint,
2521
                                        control.EndPoint,
2522
                                        control.TopRightPoint,
2523
                                    };
2524
                                    }
2525

    
2526
                                    //강인구 추가
2527
                                    control.Paint = PaintSet.Fill;
2528
                                }
2529
                            }
2530
                            break;
2531
                        case ControlType.PenControl:
2532
                            {
2533
                                stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y));
2534
                                //inkBoard.Strokes.Add(stroke);
2535
                            }
2536
                            break;
2537
                        default:
2538
                            break;
2539
                    }
2540
                }
2541
            }
2542
            else if (mouseButtonDown == MouseButton.Left && mouseHandlingMode == MouseHandlingMode.Selecting || mouseButtonDown == MouseButton.Left && mouseHandlingMode == MouseHandlingMode.Capture || mouseButtonDown == MouseButton.Left && mouseHandlingMode == MouseHandlingMode.DragZoom)
2543
            {
2544
                Point curMouseDownPoint = e.GetPosition(drawingRotateCanvas);
2545

    
2546
                if (isDraggingSelectionRect)
2547
                {
2548
                    UpdateDragSelectionRect(canvasDrawingMouseDownPoint, curMouseDownPoint);
2549

    
2550
                    e.Handled = true;
2551
                }
2552
                else if (isLeftMouseButtonDownOnWindow)
2553
                {
2554
                    var dragDelta = curMouseDownPoint - canvasDrawingMouseDownPoint;
2555
                    double dragDistance = Math.Abs(dragDelta.Length);
2556

    
2557
                    if (dragDistance > DragThreshold)
2558
                    {
2559
                        isDraggingSelectionRect = true;
2560

    
2561
                        InitDragSelectionRect(canvasDrawingMouseDownPoint, curMouseDownPoint);
2562
                    }
2563

    
2564
                    e.Handled = true;
2565
                }
2566

    
2567

    
2568
                if (canvasDrawingMouseDownPoint == curMouseDownPoint)
2569
                {
2570
                    //SelectionPath = new Path();
2571
                    //PathFigure pathFigure = new PathFigure();
2572
                    //SelectionPath.Fill = new SolidColorBrush(Colors.Yellow);
2573
                    //SelectionPath.Opacity = 0.5;
2574
                    //SelectionPath.StrokeDashArray = new DoubleCollection() { 1 };
2575
                    //SelectionPath.StrokeDashCap = PenLineCap.Round;
2576
                    //SelectionPath.Stroke = new SolidColorBrush(Colors.Black);
2577
                }
2578
                else
2579
                {
2580
                    //List<Stroke> removingStroke = new List<Stroke>();
2581
                    //Rect p1 = new Rect(canvasDrawingMouseDownPoint, curMouseDownPoint);
2582
                    //StrokeCollection stC = new StrokeCollection();
2583
                    //for (int i = 0; i <= inkBoard.Strokes.Count - 1; i++)
2584
                    //{
2585
                    //    Rect p2 = inkBoard.Strokes[i].GetBounds();
2586
                    //    p1.Intersect(p2);
2587
                    //    if (p1.IsEmpty)
2588
                    //    {
2589

    
2590

    
2591
                    //        p1 = SelectionPath.Data.Bounds;
2592
                    //        bool intersectCheck = false;
2593
                    //        foreach (var T in inkBoard.Strokes[i].StylusPoints)
2594
                    //        {
2595
                    //            Rect p3 = new Rect(new Point(T.X, T.Y), new Size(10, 10));
2596
                    //            p1.Intersect(p3);
2597
                    //            if (!p1.IsEmpty)
2598
                    //            {
2599
                    //                intersectCheck = true;
2600
                    //            }
2601
                    //        }
2602
                    //        if (intersectCheck)
2603
                    //        {
2604
                    //            removingStroke.Add(inkBoard.Strokes[i]);
2605
                    //        }
2606

    
2607
                    //    }
2608
                    //    else
2609
                    //    {
2610
                    //        removingStroke.Add(inkBoard.Strokes[i]);
2611
                    //    }
2612
                    //}
2613

    
2614
                    e.Handled = true;
2615
                }
2616
            }
2617
            else if (mouseButtonDown == MouseButton.Left && mouseHandlingMode == MouseHandlingMode.DragSymbol)
2618
            { //symbol      
2619
                if(_dragdropWindow != null)
2620
                {
2621
                    Win32Point w32Mouse = new Win32Point();
2622
                    GetCursorPos(ref w32Mouse);
2623

    
2624
                    this._dragdropWindow.Left = w32Mouse.X - (symbol_img.Width / 2);
2625
                    this._dragdropWindow.Top = w32Mouse.Y - (symbol_img.Height / 2);
2626
                }                
2627
            }
2628
            else if (mouseButtonDown == MouseButton.Left && ViewerDataModel.Instance.MarkupControls_USER.Count > 0)
2629
            {
2630
                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
2631
                if (control != null)
2632
                {
2633
                    this.cursor = Cursors.Hand;
2634
                    SetCursor();
2635
                }
2636
                else
2637
                {
2638
                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
2639

    
2640
                    SetCursor();
2641
                }
2642
            }
2643
            else
2644
            {
2645
                //var hitRect = new Rect(currentCanvasDrawingMouseMovePoint.X - 10, currentCanvasDrawingMouseMovePoint.Y - 10, 20, 20);
2646

    
2647
                //VisualTreeHelper.HitTest(this.drawingRotateCanvas, null, MyCallback,
2648
                //    new GeometryHitTestParameters(new RectangleGeometry(hitRect)));
2649

    
2650
                //if (hitList.Count > 0)
2651
                //{
2652

    
2653
                //}
2654

    
2655
                #region 조건 설정 : firstCondition
2656
                //GeneralTransform generalTransform = this.DeepLayer._BaseLayer.TransformToVisual(Application.Current.RootVisual);
2657
                //pnts = generalTransform.Transform(pnts);
2658
                //Rect areaInAbsoluteCoordinates = new Rect(pnts.X - 10, pnts.Y - 10, 20, 20);
2659
                //var firstCondition = (from kkk in VisualTreeHelper.FindElementsInHostCoordinates(areaInAbsoluteCoordinates,
2660
                //                               this.DeepLayer._BaseLayer).ToObservable()
2661
                //                      where String.IsNullOrEmpty((kkk as FrameworkElement).Name)
2662
                //                      select kkk).FirstOrDefault();
2663

    
2664
                //var canvas = LogicalTreeHelper.FindLogicalNode(this, "drawingRotateCanvas") as Canvas;
2665
                //if (canvas !=null)
2666
                //{
2667
                //    foreach (var item in (canvas.Children[0] as ItemsControl).Items)
2668
                //    {
2669
                //        UIElement uiElement = (UIElement)(canvas.Children[0] as ItemsControl).ItemContainerGenerator.ContainerFromItem(item);
2670
                //        if (uiElement!=null)
2671
                //        {
2672
                //            uiElement.InputHitTest(currentCanvasDrawingMouseMovePoint).
2673
                //        }
2674
                //    }
2675
                //}
2676

    
2677
                //EllipseGeometry expandedHitTestArea = new EllipseGeometry(currentCanvasDrawingMouseMovePoint, 10.0, 10.0);
2678
                //hitResultsList.Clear();
2679

    
2680
                #endregion
2681
            }
2682
        }
2683

    
2684
        private void zoomAndPanControl2_MouseMove(object sender, MouseEventArgs e)
2685
        {
2686
            if ((mouseButtonDown == MouseButton.Middle) || (mouseButtonDown == MouseButton.Right))
2687
            {
2688
                SetCursor();
2689
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas2);
2690
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas2);
2691

    
2692
                Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
2693

    
2694
                ViewerDataModel.Instance.Sync_ContentOffsetX -= dragOffset.X;
2695
                ViewerDataModel.Instance.Sync_ContentOffsetY -= dragOffset.Y;
2696

    
2697
                if (Sync.IsChecked)
2698
                {
2699
                    zoomAndPanControl.ContentOffsetX = ViewerDataModel.Instance.Sync_ContentOffsetX;
2700
                    zoomAndPanControl.ContentOffsetY = ViewerDataModel.Instance.Sync_ContentOffsetY;
2701
                }
2702
            }
2703
        }
2704

    
2705
        private List<CommentUserInfo> hitList = new List<CommentUserInfo>();
2706

    
2707
        private EllipseGeometry hitArea = new EllipseGeometry();
2708

    
2709
        private void zoomAndPanControl_MouseUp(object sender, MouseButtonEventArgs e)
2710
        {
2711
            IsDrawing = false;
2712

    
2713
            if (mouseHandlingMode != MouseHandlingMode.None)
2714
            {
2715
                if (mouseHandlingMode == MouseHandlingMode.Drawing)
2716
                {
2717
                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
2718

    
2719
                    SetCursor();
2720

    
2721
                    switch (controlType)
2722
                    {
2723
                        case ControlType.None:
2724
                            break;
2725
                        case ControlType.Rectangle:
2726
                            {
2727

    
2728
                            }
2729
                            break;
2730
                        case ControlType.PenControl:
2731
                            {
2732

    
2733
                            }
2734
                            break;
2735
                        default:
2736
                            break;
2737
                    }
2738
                }
2739
                else if (mouseHandlingMode == MouseHandlingMode.Selecting && e.ChangedButton == MouseButton.Left || mouseHandlingMode == MouseHandlingMode.Capture && e.ChangedButton == MouseButton.Left || mouseHandlingMode == MouseHandlingMode.DragZoom && e.ChangedButton == MouseButton.Left)
2740
                {
2741
                    if (isLeftMouseButtonDownOnWindow)
2742
                    {
2743
                        bool wasDragSelectionApplied = false;
2744

    
2745
                        if (isDraggingSelectionRect)
2746
                        {
2747
                            if (mouseHandlingMode == MouseHandlingMode.Capture && controlType == ControlType.ImgControl)
2748
                            {
2749
                                dragCaptureBorder.Visibility = Visibility.Collapsed;
2750
                                mouseHandlingMode = MouseHandlingMode.None;
2751
                                Point endPoint = e.GetPosition(zoomAndPanCanvas);
2752
                                symbolselectindex = symbolPanel_Instance.RadTab.SelectedIndex;
2753
                                Set_Symbol_Capture(endPoint);
2754
                                ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed;
2755
                                ViewerDataModel.Instance.ViewVisible = Visibility.Visible;                                
2756
                                ViewerDataModel.Instance.Capture_Opacity = 0;
2757
                            }
2758
                            else if (mouseHandlingMode == MouseHandlingMode.Capture)
2759
                            {
2760
                                dragCaptureBorder.Visibility = Visibility.Collapsed;
2761
                                mouseHandlingMode = MouseHandlingMode.None;
2762
                                Set_Capture();
2763

    
2764
                                ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed;
2765
                                ViewerDataModel.Instance.ViewVisible = Visibility.Visible;
2766
                                ViewerDataModel.Instance.Capture_Opacity = 0;
2767
                            }
2768
                            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
2769
                            {
2770
                                ApplyDragSelectionRect();
2771
                            }
2772
                            else
2773
                            {
2774
                                double x = Canvas.GetLeft(dragZoomBorder);
2775
                                double y = Canvas.GetTop(dragZoomBorder);
2776
                                double width = dragZoomBorder.Width;
2777
                                double height = dragZoomBorder.Height;
2778
                                Rect dragRect = new Rect(x, y, width, height);
2779

    
2780
                                ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.ZoomTo(dragRect);
2781

    
2782
                                dragZoomBorder.Visibility = Visibility.Collapsed;
2783
                            }
2784

    
2785
                            isDraggingSelectionRect = false;
2786
                            e.Handled = true;
2787
                            wasDragSelectionApplied = true;
2788
                        }
2789

    
2790
                        if (isLeftMouseButtonDownOnWindow)
2791
                        {
2792
                            isLeftMouseButtonDownOnWindow = false;
2793
                            this.ReleaseMouseCapture();
2794
                            e.Handled = true;
2795
                        }
2796

    
2797
                        if (!wasDragSelectionApplied)
2798
                        {
2799
                            init();
2800
                        }
2801
                    }
2802
                }
2803
                else if (mouseButtonDown == MouseButton.Right)
2804
                {
2805
                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
2806
                    SetCursor();
2807
                }
2808

    
2809
                zoomAndPanControl.ReleaseMouseCapture();
2810

    
2811

    
2812
                e.Handled = true;
2813
            }
2814
            else
2815
            {
2816
                this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
2817
                SetCursor();
2818
            }
2819
            mouseButtonDown = MouseButton.Left;
2820

    
2821
            //controlType = ControlType.SingleLine;
2822
        }
2823

    
2824
        public void Set_Symbol_Capture(Point endPoint)
2825
        {       
2826
            double x = canvasDrawingMouseDownPoint.X;
2827
            double y = canvasDrawingMouseDownPoint.Y;
2828
            if(x > endPoint.X)
2829
            {
2830
                x = endPoint.X;
2831
                y = endPoint.Y;
2832
            }
2833

    
2834
            double width = dragCaptureBorder.Width;
2835
            double height = dragCaptureBorder.Height;
2836

    
2837
            canvasImage = ConverterBitmapImage(zoomAndPanCanvas);
2838

    
2839
            if (x < 0)
2840
            {
2841
                width += x;
2842
                x = 0;
2843
            }
2844
            if (y < 0)
2845
            {
2846
                height += y;
2847
                y = 0;
2848

    
2849
                width = (int)canvasImage.PixelWidth - x;
2850
            }
2851
            if (x + width > canvasImage.PixelWidth)
2852
            {
2853
                width = (int)canvasImage.PixelWidth - x;
2854
            }
2855
            if (y + height > canvasImage.PixelHeight)
2856
            {
2857
                height = (int)canvasImage.PixelHeight - y;
2858
            }
2859
            var rect = new Int32Rect((int)x, (int)y, (int)width, (int)height);
2860

    
2861
            string uri = "";
2862
            if (userData.COMPANY != "EXT")
2863
            {
2864
                uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO,
2865
                    (Convert.ToInt32(_ViewInfo.DocumentItemID) / 100).ToString(), _ViewInfo.DocumentItemID, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber);
2866
            }
2867
            else
2868
            {
2869
                uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, _ViewInfo.DocumentItemID,
2870
                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber);
2871
            }
2872

    
2873
            var defaultBitmapImage = new BitmapImage();
2874
            defaultBitmapImage.BeginInit();
2875
            defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
2876
            defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
2877
            defaultBitmapImage.UriSource = new Uri(uri);
2878
            defaultBitmapImage.EndInit();
2879

    
2880
            //GC.Collect();
2881

    
2882
            if (defaultBitmapImage.IsDownloading)
2883
            {
2884
                defaultBitmapImage.DownloadCompleted += (ex, arg) =>
2885
                {
2886
                    defaultBitmapImage.Freeze();
2887
                    //GC.Collect();
2888
                    BitmapSource bs = new CroppedBitmap(defaultBitmapImage, rect);
2889
                    Save_Symbol_Capture(bs, (int)x, (int)y, (int)width, (int)height);
2890
                };
2891
            }
2892
        }
2893

    
2894
        private void zoomAndPanControl2_MouseUp(object sender, MouseButtonEventArgs e)
2895
        {
2896
            mouseButtonDown = MouseButton.Left;
2897
        }
2898

    
2899
        private void zoomAndPanControl_MouseLeave(object sender, MouseEventArgs e)
2900
        {
2901
            mouseButtonDown = MouseButton.Left;
2902
            //this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
2903
        }
2904

    
2905
        private void zoomAndPanControl_MouseDoubleClick(object sender, MouseButtonEventArgs e)
2906
        {
2907

    
2908
        }
2909

    
2910
        /// <summary>
2911
        /// select item which's bouding rectangle is equal to given rectangle
2912
        /// </summary>
2913
        /// <author>humkyung</author>
2914
        /// <date>2018.06.14</date>
2915
        /// <param name="rect"></param>
2916
        public void SelecteItemByRect(Rect rect)
2917
        {
2918
            multi_Undo_Data = new Multi_Undo_data();
2919

    
2920
            UndoData = new Undo_data()
2921
            {
2922
                IsUndo = false,
2923
                Event = Event_Type.Select,
2924
                EventTime = DateTime.Now,
2925
                Markup_List = new List<Multi_Undo_data>()
2926
            };
2927
           
2928
            var Items = ViewerDataModel.Instance.MarkupControls_USER.ToList();
2929

    
2930
            CommentUserInfo selected = null;
2931
            double dMinDiff = double.MaxValue;
2932
            Move tmp = new Move();
2933
            foreach (var item in Items)
2934
            {
2935
                Rect boundingBox = tmp.ItemRect(item);
2936
                double dx = rect.X - boundingBox.X;
2937
                double dy = rect.Y - boundingBox.Y;
2938
                double dxx = rect.Right - boundingBox.Right;
2939
                double dyy = rect.Bottom - boundingBox.Bottom;
2940
                double dDiff = Math.Sqrt(dx * dx + dy * dy + dxx * dxx + dyy * dyy);
2941
                if (dDiff < dMinDiff)
2942
                {
2943
                    dMinDiff = dDiff;
2944
                    selected = item;
2945
                }
2946
            }
2947

    
2948
            if (selected != null)
2949
            {
2950
                this.ReleaseAdorner();
2951

    
2952
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2953
                adornerSet.Add(selected);
2954
                ViewerDataModel.Instance.MarkupControls_USER.Remove(selected);
2955

    
2956
                Control_Style(selected);
2957
                UndoData.Markup_List.Add(multi_Undo_Data);
2958
                multi_Undo_Data = new Multi_Undo_data();
2959

    
2960
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
2961
                {
2962
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2963
                });
2964
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2965

    
2966
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2967
                SelectLayer.Children.Add(final);
2968
            }
2969
        }
2970

    
2971
        private void ApplyDragSelectionRect()
2972
        {
2973
            multi_Undo_Data = new Multi_Undo_data();
2974

    
2975
            UndoData = new Undo_data()
2976
            {
2977
                IsUndo = false,
2978
                Event = Event_Type.Select,
2979
                EventTime = DateTime.Now,
2980
                Markup_List = new List<Multi_Undo_data>()
2981
            };
2982

    
2983
            dragSelectionBorder.Visibility = Visibility.Collapsed;
2984

    
2985
            double x = Canvas.GetLeft(dragSelectionBorder);
2986
            double y = Canvas.GetTop(dragSelectionBorder);
2987
            double width = dragSelectionBorder.Width;
2988
            double height = dragSelectionBorder.Height;
2989
            Rect dragRect = new Rect(x, y, width, height);
2990
            Boolean Flag = false;
2991
            dragRect.Inflate(width / 10, height / 10);
2992
            List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2993
            var Items = ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.Visibility != Visibility.Hidden).ToList();
2994

    
2995
            dragRect = new Rect(x, y, width, height);
2996
            dragRect.Inflate(width / 10, height / 10);
2997

    
2998
            foreach (var item in Items)
2999
            {
3000
                Flag = move.control_Select(item, dragRect);
3001

    
3002
                if (Flag)
3003
                {
3004
                    adornerSet.Add(item);
3005
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(item);
3006

    
3007
                    Control_Style(item);
3008
                    UndoData.Markup_List.Add(multi_Undo_Data);
3009
                    multi_Undo_Data = new Multi_Undo_data();
3010
                    if (item.GroupID > 0)
3011
                    {
3012

    
3013
                    }
3014
                }
3015
            }
3016
            if (adornerSet.Count > 0)
3017
            {
3018
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
3019
                {
3020
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
3021
                });
3022
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
3023

    
3024
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
3025
                SelectLayer.Children.Add(final);
3026
            }
3027
        }
3028

    
3029
        private void InitDragSelectionRect(Point pt1, Point pt2)
3030
        {
3031
            //캡쳐 중
3032
            if (mouseHandlingMode == MouseHandlingMode.Capture)
3033
            {
3034
                dragCaptureBorder.Visibility = Visibility.Visible;
3035
            }
3036
            //선택 중
3037
            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
3038
            {
3039

    
3040
                dragSelectionBorder.Visibility = Visibility.Visible;
3041
            }
3042
            else
3043
            {
3044
                dragZoomBorder.Visibility = Visibility.Visible;
3045
            }
3046
            UpdateDragSelectionRect(pt1, pt2);
3047
        }
3048

    
3049
        /// <summary>
3050
        /// Update the position and size of the rectangle used for drag selection.
3051
        /// </summary>
3052
        private void UpdateDragSelectionRect(Point pt1, Point pt2)
3053
        {
3054
            double x, y, width, height;
3055

    
3056
            //
3057
            // Determine x,y,width and height of the rect inverting the points if necessary.
3058
            // 
3059

    
3060
            if (pt2.X < pt1.X)
3061
            {
3062
                x = pt2.X;
3063
                width = pt1.X - pt2.X;
3064
            }
3065
            else
3066
            {
3067
                x = pt1.X;
3068
                width = pt2.X - pt1.X;
3069
            }
3070

    
3071
            if (pt2.Y < pt1.Y)
3072
            {
3073
                y = pt2.Y;
3074
                height = pt1.Y - pt2.Y;
3075
            }
3076
            else
3077
            {
3078
                y = pt1.Y;
3079
                height = pt2.Y - pt1.Y;
3080
            }
3081

    
3082
            //
3083
            // Update the coordinates of the rectangle used for drag selection.
3084
            //
3085
            //캡쳐 중
3086
            if (mouseHandlingMode == MouseHandlingMode.Capture)
3087
            {
3088
                Canvas.SetLeft(dragCaptureBorder, x);
3089
                Canvas.SetTop(dragCaptureBorder, y);
3090
                dragCaptureBorder.Width = width;
3091
                dragCaptureBorder.Height = height;
3092
            }
3093
            //선택 중
3094
            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
3095
            {
3096
                Canvas.SetLeft(dragSelectionBorder, x);
3097
                Canvas.SetTop(dragSelectionBorder, y);
3098
                dragSelectionBorder.Width = width;
3099
                dragSelectionBorder.Height = height;
3100
            }
3101
            else
3102
            {
3103
                Canvas.SetLeft(dragZoomBorder, x);
3104
                Canvas.SetTop(dragZoomBorder, y);
3105
                dragZoomBorder.Width = width;
3106
                dragZoomBorder.Height = height;
3107
            }
3108
        }
3109

    
3110
        public bool IsSelectionControl(Rect dragRect, Rect controlRect, Geometry OverViewPathData, ControlType type)
3111
        {
3112
            //// X, Y, WIDTH, HEIGHT 형태로 RECT를 만든다.
3113

    
3114
            bool result = false;
3115
            if (dragRect.Contains(controlRect))
3116
            {
3117
                result = true;
3118
                //잡은 객체들을 담은 리스트
3119
                try
3120
                {
3121
                    selected_item.Add(OverViewPathData, type.ToString());
3122
                }
3123
                catch (Exception)
3124
                {
3125

    
3126
                }
3127
            }
3128
            return result;
3129
        }
3130

    
3131
        private void drawingPannelRotate(double angle)
3132
        {
3133
            Logger.sendCheckLog("pageNavigator_PageChanging_drawingPannelRotate Setting", 1);
3134
            rotate.Angle = angle;
3135
            var rotationNum = Math.Abs((rotate.Angle / 90));
3136

    
3137
            if (angle == 90 || angle == 270)
3138
            {
3139
                double emptySize = zoomAndPanCanvas.Width;
3140
                zoomAndPanCanvas.Width = zoomAndPanCanvas.Height;
3141
                zoomAndPanCanvas.Height = emptySize;
3142
            }
3143
            if (angle == 0)
3144
            {
3145
                translate.X = 0;
3146
                translate.Y = 0;
3147
            }
3148
            else if (angle == 90)
3149
            {
3150
                translate.X = zoomAndPanCanvas.Width;
3151
                translate.Y = 0;
3152
            }
3153
            else if (angle == 180)
3154
            {
3155
                translate.X = zoomAndPanCanvas.Width;
3156
                translate.Y = zoomAndPanCanvas.Height;
3157
            }
3158
            else
3159
            {
3160
                translate.X = 0;
3161
                translate.Y = zoomAndPanCanvas.Height;
3162
            }
3163

    
3164
            zoomAndPanControl.RotationAngle = rotate.Angle;
3165

    
3166

    
3167
            if (!testPanel2.IsHidden)
3168
            {
3169
                zoomAndPanControl2.RotationAngle = rotate.Angle;
3170
                zoomAndPanCanvas2.Width = zoomAndPanCanvas.Width;
3171
                zoomAndPanCanvas2.Height = zoomAndPanCanvas.Height;
3172
            }
3173

    
3174
            ViewerDataModel.Instance.ContentWidth = zoomAndPanCanvas.Width;
3175
            ViewerDataModel.Instance.ContentHeight = zoomAndPanCanvas.Height;
3176
            ViewerDataModel.Instance.AngleOffsetX = translate.X;
3177
            ViewerDataModel.Instance.AngleOffsetY = translate.Y;
3178
            ViewerDataModel.Instance.Angle = rotate.Angle;
3179
        }
3180

    
3181
        public void PlaceImageSymbol(string id, long group_id, int SelectedIndex, Point canvasZoomPanningMouseDownPoint)
3182
        {
3183
            string Data_ = "";
3184

    
3185
            try
3186
            {
3187
                Logger.sendReqLog("GetSymbolImageURL: ", id + "," + SelectedIndex, 1);
3188
                Data_ = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetSymbolImageURL(id, SelectedIndex);
3189
                if (Data_ != null || Data_ != "")
3190
                {
3191
                    Logger.sendResLog("GetSymbolImageURL", "TRUE", 1);
3192
                }
3193
                else
3194
                {
3195
                    Logger.sendResLog("GetSymbolImageURL", "FALSE", 1);
3196
                }
3197

    
3198
                MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
3199
                {
3200
                    SYMBOL_ID = id,//InnerItem.Symbol_ID
3201
                    STATE = 0,
3202
                };
3203
                if (Data_ != null)
3204
                {
3205
                    Image img = new Image();
3206
                    //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(Data_));
3207
                    if (Data_.Contains(".svg"))
3208
                    {
3209
                        byte[] imageData = null;
3210
                        DrawingImage image = null;
3211
                        using (System.Net.WebClient web = new System.Net.WebClient())
3212
                        {
3213
                            imageData = web.DownloadData(new Uri(Data_));
3214
                            System.IO.Stream stream = new System.IO.MemoryStream(imageData);
3215
                            image = SvgReader.Load(stream);
3216
                        }
3217
                        img.Source = image;
3218
                    }
3219
                    else
3220
                    {
3221
                        img.Source = new BitmapImage(new Uri(Data_));
3222
                    }
3223

    
3224
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
3225
                    {
3226
                        PointSet = new List<Point>(),
3227
                        FilePath = Data_,
3228
                        ImageData = img.Source,
3229
                        StartPoint = canvasZoomPanningMouseDownPoint,
3230
                        EndPoint = new Point(canvasZoomPanningMouseDownPoint.X + img.Source.Width, 
3231
                        canvasZoomPanningMouseDownPoint.Y + img.Source.Height),
3232
                        TopRightPoint = new Point(canvasZoomPanningMouseDownPoint.X+img.Source.Width,
3233
                        canvasZoomPanningMouseDownPoint.Y),
3234
                        LeftBottomPoint = new Point(canvasZoomPanningMouseDownPoint.X,
3235
                        canvasZoomPanningMouseDownPoint.Y + img.Source.Height)
3236
                    };
3237

    
3238
                    currentControl.PointSet = new List<Point>
3239
                                        {
3240
                                            currentControl.StartPoint,
3241
                                            currentControl.LeftBottomPoint,
3242
                                            currentControl.EndPoint,
3243
                                            currentControl.TopRightPoint,
3244
                                        };
3245
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
3246
                    UndoData = new Undo_data()
3247
                    {
3248
                        IsUndo = false,
3249
                        Event = Event_Type.Create,
3250
                        EventTime = DateTime.Now,
3251
                        Markup_List = new List<Multi_Undo_data>()
3252
                    };
3253
                    ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
3254
                    {
3255
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
3256
                    });
3257

    
3258
                    //multi_Undo_Data = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
3259
                    multi_Undo_Data = Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
3260
                    UndoData.Markup_List.Add(multi_Undo_Data);
3261
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
3262

    
3263
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
3264
                    currentControl.CommentID = Commons.shortGuid();
3265
                    currentControl.SymbolID = id;
3266
                    currentControl.GroupID = group_id;
3267
                    currentControl.ApplyTemplate();
3268
                    currentControl.SetImage();
3269

    
3270
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
3271
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
3272
                    SelectLayer.Children.Add(final);
3273
                }
3274
            }
3275
            catch (Exception ex)
3276
            {
3277
                this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(ex.Message, "Error");
3278
            }
3279
        }
3280

    
3281
        private void zoomAndPanControl_MouseDown(object sender, MouseButtonEventArgs e)
3282
        {            
3283
            var set_option = this.ParentOfType<MainWindow>().dzTopMenu.Parent.ChildrenOfType<RadNumericUpDown>().Where(item => item.IsKeyboardFocusWithin).FirstOrDefault();
3284
            if (set_option != null && !string.IsNullOrEmpty(set_option.ContentText))
3285
            {
3286
                set_option.Value = double.Parse(set_option.ContentText);
3287
            }
3288

    
3289
            InkControl_Convert();
3290

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

    
3294
            if (text_item != null && (currentControl as ArrowTextControl) == null)
3295
            {
3296
                ViewerDataModel.Instance.MarkupControls_USER.Remove(text_item);
3297
            }
3298

    
3299
            foreach (var arrow_text in ViewerDataModel.Instance.MarkupControls_USER)
3300
            {
3301
                if (arrow_text as ArrowTextControl != null)
3302
                {
3303
                    (arrow_text as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3304
                }
3305
            }
3306

    
3307
            mouseButtonDown = e.ChangedButton;
3308
            /// complete drawing text control when user click mouse right button - 2018.05.14 added by humkyung
3309

    
3310
            //if (currentControl != null)
3311
            {
3312
                var text_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as TextControl) != null && (data as TextControl).Base_TextBox.Visibility == Visibility.Visible).FirstOrDefault();
3313
                if (text_item_ != null)
3314
                {
3315
                    (text_item_ as TextControl).Base_TextBlock.Visibility = Visibility.Visible;
3316
                    (text_item_ as TextControl).Base_TextBox.Visibility = Visibility.Collapsed;
3317
                    (text_item_ as TextControl).IsEditing = false;
3318
                    (text_item_ as TextControl).EnableEditing = false;
3319
                    currentControl = null;
3320
                }
3321

    
3322
                var Arrowtext_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as ArrowTextControl) != null && (data as ArrowTextControl).IsEditingMode == true).FirstOrDefault();
3323
                if (Arrowtext_item_ != null && ((Arrowtext_item_ as ArrowTextControl).IsNew == false))
3324
                {
3325
                    (Arrowtext_item_ as ArrowTextControl).IsEditingMode = false;
3326
                    (Arrowtext_item_ as ArrowTextControl).Base_TextBox.Focusable = false;
3327
                    currentControl = null;
3328
                }
3329
            }
3330

    
3331
            double Ang = 0;                                          
3332
            if (rotate.Angle != 0)
3333
            {
3334
                Ang = 360 - rotate.Angle;
3335
            }
3336
            move = new Move();
3337

    
3338
            if (e.OriginalSource is System.Windows.Controls.Image)
3339
            {
3340
                (e.OriginalSource as System.Windows.Controls.Image).Focus();
3341
            }
3342

    
3343
            if (mouseHandlingMode == MouseHandlingMode.DragSymbol && mouseButtonDown == MouseButton.Left)
3344
            {                
3345
                //this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
3346
                //SetCursor();
3347

    
3348
                //canvasDrawingMouseDownPoint = e.GetPosition(drawingRotateCanvas);
3349
                canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
3350
                if(symbol_id != null)
3351
                {
3352
                    PlaceImageSymbol(symbol_id, symbol_group_id, symbol_SelectedIndex, canvasZoomPanningMouseDownPoint);
3353
                }                
3354
            }
3355

    
3356
            if (mouseHandlingMode == MouseHandlingMode.DragSymbol && mouseButtonDown == MouseButton.Right)
3357
            {
3358
                if (this._dragdropWindow != null)
3359
                {
3360
                    this._dragdropWindow.Close();
3361
                    this._dragdropWindow = null;
3362
                    symbol_id = null;
3363
                }
3364
            }
3365

    
3366
            if (mouseButtonDown == MouseButton.Left)
3367
            {
3368
                canvasDrawingMouseDownPoint = e.GetPosition(drawingRotateCanvas);
3369
                canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
3370

    
3371
                this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
3372
                SetCursor();
3373

    
3374
                if (!ViewerDataModel.Instance.IsPressCtrl)
3375
                {
3376
                    ReleaseAdorner();
3377
                }
3378
            }
3379
            if (mouseButtonDown == MouseButton.Middle)
3380
            {
3381
                canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
3382
                cursor = Cursors.SizeAll;
3383
                SetCursor();
3384
            }
3385
            if (mouseButtonDown == MouseButton.Right)
3386
            {
3387
                canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
3388
                cursor = Cursors.SizeAll;
3389
                SetCursor();
3390
            }
3391
            else if (mouseButtonDown == MouseButton.XButton1)
3392
            {
3393
                if (this.pageNavigator.CurrentPage.PageNumber + 1 <= this.pageNavigator.PageCount)
3394
                {
3395
                    this.pageNavigator.GotoPage(this.pageNavigator._NextPage.PageNumber + 1);
3396
                }
3397

    
3398
                this.pageNavigator.GotoPage(this.pageNavigator._NextPage.PageNumber);
3399

    
3400
            }
3401
            else if (mouseButtonDown == MouseButton.XButton2)
3402
            {
3403
                if (this.pageNavigator.CurrentPage.PageNumber > 1)
3404
                {
3405
                    this.pageNavigator.GotoPage(this.pageNavigator.CurrentPage.PageNumber - 1);
3406
                }
3407
            }
3408

    
3409
            //if (mouseButtonDown == MouseButton.Left && ViewerDataModel.Instance.MarkupControls_USER.Count > 0 && mouseHandlingMode != MouseHandlingMode.Drawing && currentControl == null)
3410
            if (mouseButtonDown == MouseButton.Left && mouseHandlingMode != MouseHandlingMode.Drawing && currentControl == null)
3411
            {
3412
                if (mouseHandlingMode == MouseHandlingMode.Selecting)
3413
                {
3414
                    if (SelectLayer.Children.Count == 0)
3415
                    {
3416
                        isLeftMouseButtonDownOnWindow = true;
3417
                        mouseHandlingMode = MouseHandlingMode.Selecting;
3418
                    }
3419

    
3420
                    if (controlType == ControlType.None)
3421
                    {
3422
                        isLeftMouseButtonDownOnWindow = true;
3423
                    }
3424
                }
3425

    
3426
                //캡쳐 모드 설정
3427
                if (mouseHandlingMode == MouseHandlingMode.Capture)
3428
                {
3429
                    dragCaptureBorder.Visibility = Visibility.Visible;
3430
                    isLeftMouseButtonDownOnWindow = true;
3431
                }
3432

    
3433
                //줌 모드 설정
3434
                if (mouseHandlingMode == MouseHandlingMode.DragZoom)
3435
                {
3436
                    //dragSelectionBorder.Visibility = Visibility.Visible;
3437
                    isLeftMouseButtonDownOnWindow = true;
3438
                }               
3439

    
3440
                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
3441
                if (control != null)
3442
                {
3443
                    //강인구 추가 컨트롤 누르고 멀티 선택(다시확인필요)
3444
                    AdornerFinal final;
3445
                    List<Point> p_set = new List<Point>();
3446
                    List<CommentUserInfo> comment = new List<CommentUserInfo>();
3447
                    ViewerDataModel.Instance.MarkupControls.Remove(control);
3448
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(control);
3449
                    multi_Undo_Data = new Multi_Undo_data();
3450

    
3451
                    //강인구 Undo/Redo 보류
3452
                    UndoData = new Undo_data()
3453
                    {
3454
                        IsUndo = false,
3455
                        Event = Event_Type.Select,
3456
                        EventTime = DateTime.Now,
3457
                        Markup_List = new List<Multi_Undo_data>()
3458
                    };
3459

    
3460
                    if (!ViewerDataModel.Instance.IsPressCtrl)
3461
                    {
3462
                        ReleaseAdorner();
3463
                        final = new AdornerFinal(control);
3464
                        //단일 컨트롤 언두 저장
3465

    
3466
                        Control_Style(control);
3467
                        UndoData.Markup_List.Add(multi_Undo_Data);
3468

    
3469
                        if ((control as IPath) != null)
3470
                        {
3471
                            if ((control as IPath).LineSize != 0)
3472
                            {
3473
                                ViewerDataModel.Instance.LineSize = (control as IPath).LineSize;
3474
                            }
3475
                        }
3476
                        if ((control as IShapeControl) != null)
3477
                        {
3478
                            if ((control as IShapeControl).Paint == PaintSet.Hatch)
3479
                            {
3480
                                ViewerDataModel.Instance.checkHatchShape = true;
3481
                            }
3482
                            else if ((control as IShapeControl).Paint == PaintSet.Fill)
3483
                            {
3484
                                ViewerDataModel.Instance.checkFillShape = true;
3485
                            }
3486
                            else
3487
                            {
3488
                                ViewerDataModel.Instance.checkHatchShape = false;
3489
                                ViewerDataModel.Instance.checkFillShape = false;
3490
                            }
3491
                            ViewerDataModel.Instance.paintSet = (control as IShapeControl).Paint;
3492
                        }
3493

    
3494
                        ViewerDataModel.Instance.ControlOpacity = control.Opacity;
3495

    
3496
                        if ((control as TextControl) != null)
3497
                        {
3498
                            if ((control as TextControl).TextStyle == FontStyles.Italic)
3499
                            {
3500
                                ViewerDataModel.Instance.checkTextStyle = true;
3501
                            }
3502
                            else
3503
                            {
3504
                                ViewerDataModel.Instance.checkTextStyle = false;
3505
                            }
3506

    
3507
                            if ((control as TextControl).TextStyle == FontStyles.Italic)
3508
                            {
3509
                                ViewerDataModel.Instance.checkTextStyle = true;
3510
                            }
3511
                            else
3512
                            {
3513
                                ViewerDataModel.Instance.checkTextStyle = false;
3514
                            }
3515
                            if ((control as TextControl).TextWeight == FontWeights.Bold)
3516
                            {
3517
                                ViewerDataModel.Instance.checkTextWeight = true;
3518
                            }
3519
                            else
3520
                            {
3521
                                ViewerDataModel.Instance.checkTextWeight = false;
3522
                            }
3523
                            if ((control as TextControl).UnderLine == TextDecorations.Underline)
3524
                            {
3525
                                ViewerDataModel.Instance.checkUnderLine = true;
3526
                            }
3527
                            else
3528
                            {
3529
                                ViewerDataModel.Instance.checkUnderLine = false;
3530
                            }
3531
                            ViewerDataModel.Instance.TextSize = (control as TextControl).TextSize;
3532
                            ViewerDataModel.Instance.checkHighlight = (control as TextControl).IsHighLight;
3533

    
3534
                        }
3535
                        else if ((control as ArrowTextControl) != null)
3536
                        {
3537
                            if ((control as ArrowTextControl).TextStyle == FontStyles.Italic)
3538
                            {
3539
                                ViewerDataModel.Instance.checkTextStyle = true;
3540
                            }
3541
                            else
3542
                            {
3543
                                ViewerDataModel.Instance.checkTextStyle = false;
3544
                            }
3545

    
3546
                            if ((control as ArrowTextControl).TextStyle == FontStyles.Italic)
3547
                            {
3548
                                ViewerDataModel.Instance.checkTextStyle = true;
3549
                            }
3550
                            else
3551
                            {
3552
                                ViewerDataModel.Instance.checkTextStyle = false;
3553
                            }
3554
                            if ((control as ArrowTextControl).TextWeight == FontWeights.Bold)
3555
                            {
3556
                                ViewerDataModel.Instance.checkTextWeight = true;
3557
                            }
3558
                            else
3559
                            {
3560
                                ViewerDataModel.Instance.checkTextWeight = false;
3561
                            }
3562
                            if ((control as ArrowTextControl).UnderLine == TextDecorations.Underline)
3563
                            {
3564
                                ViewerDataModel.Instance.checkUnderLine = true;
3565
                            }
3566
                            else
3567
                            {
3568
                                ViewerDataModel.Instance.checkUnderLine = false;
3569
                            }
3570
                            ViewerDataModel.Instance.checkHighlight = (control as ArrowTextControl).isHighLight;
3571
                            ViewerDataModel.Instance.TextSize = (control as ArrowTextControl).TextSize;
3572
                        }
3573
                        else if ((control as RectCloudControl) != null)
3574
                        {
3575
                            ViewerDataModel.Instance.ArcLength = (control as RectCloudControl).ArcLength;
3576
                        }
3577
                        else if ((control as CloudControl) != null)
3578
                        {
3579
                            ViewerDataModel.Instance.ArcLength = (control as CloudControl).ArcLength;
3580
                        }
3581

    
3582
                    }
3583
                    else
3584
                    {
3585
                        comment = AddAdorner();
3586
                        comment.Add(control);
3587

    
3588
                        Control_Style(control);
3589
                        UndoData.Markup_List.Add(multi_Undo_Data);
3590

    
3591
                        final = new AdornerFinal(comment);
3592
                        //다중 컨트롤 언두 저장
3593
                    }
3594

    
3595
                    ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
3596
                    {
3597
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
3598
                    });
3599

    
3600
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
3601

    
3602
                    SelectLayer.Children.Add(final);
3603
                }              
3604
            }
3605
            else if (mouseHandlingMode == MouseHandlingMode.Drawing)
3606
            {               
3607
                init();
3608
                //강인구 추가(우 클릭 일 경우 커서 변경 하지 않음)
3609
                if (cursor != Cursors.SizeAll)
3610
                {
3611
                    cursor = Cursors.Cross;
3612
                    SetCursor();
3613
                }
3614
                bool init_user = false;
3615
                foreach (var user in gridViewMarkup.Items)
3616
                {
3617
                    if ((user as MarkupInfoItem).UserID == App.ViewInfo.UserID)
3618
                    {
3619
                        init_user = true;
3620
                    }
3621
                }
3622
                if (init_user && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null && e.LeftButton == MouseButtonState.Pressed)
3623
                {
3624
                    RadWindow.Alert(new DialogParameters
3625
                    {
3626
                        Owner = Application.Current.MainWindow,
3627
                        Theme = new VisualStudio2013Theme(),
3628
                        Header = "안내",
3629
                        Content = "기존의 코멘트가 존재합니다. 사용자 리스트에서 먼저 선택해주세요",
3630
                    });
3631
                    return;
3632
                }
3633
                else
3634
                {
3635
                    var item = gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() as MarkupInfoItem;
3636
                    if (item != null)
3637
                    {
3638
                        App.Custom_ViewInfoId = item.MarkupInfoID;
3639
                    }
3640
                }
3641

    
3642
                multi_Undo_Data = new Multi_Undo_data();
3643
                //강인구 Undo/Redo 보류
3644
                UndoData = new Undo_data()
3645
                {
3646
                    IsUndo = false,
3647
                    Event = Event_Type.Create,
3648
                    EventTime = DateTime.Now,
3649
                    Markup_List = new List<Multi_Undo_data>()
3650
                };
3651

    
3652
                switch (controlType)
3653
                {
3654
                    case ControlType.Coordinate:
3655
                        {
3656
                            if (mouseButtonDown == MouseButton.Left)
3657
                            {
3658
                                if (currentControl is CoordinateControl)
3659
                                {
3660
                                    if (IsGetoutpoint((currentControl as CoordinateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3661
                                    {
3662
                                        return;
3663
                                    }
3664

    
3665
                                    CreateControl();
3666

    
3667
                                    (currentControl as CoordinateControl).ApplyOverViewData();
3668
                                    currentControl = null;
3669
                                    this.cursor = Cursors.Arrow;
3670
                                }
3671
                                else
3672
                                {
3673
                                    this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
3674
                                    if (ViewerDataModel.Instance.MarkupList_USER.Where(d => d.PageNumber == Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber
3675
                                     && d.Data_Type == Convert.ToInt32(MarkupToPDF.Controls.Common.ControlType.Coordinate)).Count() > 0)
3676
                                    {
3677
                                        currentControl = null;
3678
                                        this.cursor = Cursors.Arrow;
3679
                                        Common.ViewerDataModel.Instance.SystemMain.DialogMessage_Alert("이미 해당 페이지의 도면 영역을 설정하셨습니다.", "Notice");
3680
                                        return;
3681
                                    }
3682
                                    else
3683
                                    {
3684
                                        currentControl = new CoordinateControl
3685
                                        {
3686
                                            Background = new SolidColorBrush(Colors.Black),
3687
                                            ControlType = ControlType.Coordinate
3688
                                        };
3689

    
3690
                                        currentControl.CommentID = Commons.shortGuid();
3691
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3692
                                        currentControl.IsNew = true;
3693

    
3694
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3695

    
3696
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3697
                                    }
3698
                                }
3699
                            }
3700
                        }
3701
                        break;
3702
                    case ControlType.InsideWhite:
3703
                        {
3704
                            if (mouseButtonDown == MouseButton.Left)
3705
                            {
3706
                                if (currentControl is InsideWhiteControl)
3707
                                {
3708
                                    if (IsGetoutpoint((currentControl as InsideWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3709
                                    {
3710
                                        return;
3711
                                    }
3712

    
3713
                                    CreateControl();
3714

    
3715
                                    (currentControl as InsideWhiteControl).ApplyOverViewData();
3716
                                    currentControl = null;
3717
                                    this.cursor = Cursors.Arrow;
3718
                                }
3719
                                else
3720
                                {
3721
                                    currentControl = new InsideWhiteControl
3722
                                    {
3723
                                        Background = new SolidColorBrush(Colors.Black),
3724
                                        ControlType = ControlType.InsideWhite
3725
                                    };
3726

    
3727
                                    currentControl.CommentID = Commons.shortGuid();
3728
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3729
                                    currentControl.IsNew = true;
3730
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3731

    
3732
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3733
                                }
3734
                            }
3735
                        }
3736
                        break;
3737
                    case ControlType.OverlapWhite:
3738
                        {
3739
                            if (mouseButtonDown == MouseButton.Left)
3740
                            {
3741
                                if (currentControl is OverlapWhiteControl)
3742
                                {
3743
                                    if (IsGetoutpoint((currentControl as OverlapWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3744
                                    {
3745
                                        return;
3746
                                    }
3747

    
3748
                                    CreateControl();
3749

    
3750
                                    (currentControl as OverlapWhiteControl).ApplyOverViewData();
3751
                                    currentControl = null;
3752
                                    this.cursor = Cursors.Arrow;
3753
                                }
3754
                                else
3755
                                {
3756
                                    currentControl = new OverlapWhiteControl
3757
                                    {
3758
                                        Background = new SolidColorBrush(Colors.Black),
3759
                                        ControlType = ControlType.OverlapWhite
3760
                                    };
3761

    
3762
                                    currentControl.CommentID = Commons.shortGuid();
3763
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3764
                                    currentControl.IsNew = true;
3765
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3766

    
3767
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3768
                                }
3769
                            }
3770
                        }
3771
                        break;
3772
                    case ControlType.ClipWhite:
3773
                        {
3774
                            if (mouseButtonDown == MouseButton.Left)
3775
                            {
3776
                                if (currentControl is ClipWhiteControl)
3777
                                {
3778
                                    if (IsGetoutpoint((currentControl as ClipWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3779
                                    {
3780
                                        return;
3781
                                    }
3782

    
3783
                                    CreateControl();
3784

    
3785
                                    (currentControl as ClipWhiteControl).ApplyOverViewData();
3786
                                    currentControl = null;
3787
                                    this.cursor = Cursors.Arrow;
3788
                                }
3789
                                else
3790
                                {
3791
                                    currentControl = new ClipWhiteControl
3792
                                    {
3793
                                        Background = new SolidColorBrush(Colors.Black),
3794
                                        ControlType = ControlType.ClipWhite
3795
                                    };
3796

    
3797
                                    currentControl.CommentID = Commons.shortGuid();
3798
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3799
                                    currentControl.IsNew = true;
3800
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3801

    
3802
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3803
                                }
3804
                            }
3805
                        }
3806
                        break;
3807
                    case ControlType.Rectangle:
3808
                        {
3809
                            if (mouseButtonDown == MouseButton.Left)
3810
                            {
3811
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3812
                                //{
3813
                                    if (currentControl is RectangleControl)
3814
                                    {
3815
                                        //20180906 LJY TEST IsRotationDrawingEnable
3816
                                        if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3817
                                        {
3818
                                            return;
3819
                                        }
3820

    
3821
                                        CreateControl();
3822

    
3823
                                        (currentControl as RectangleControl).ApplyOverViewData();
3824
                                        currentControl = null;
3825
                                    
3826
                                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
3827
                                    }
3828
                                    else
3829
                                    {
3830
                                        currentControl = new RectangleControl
3831
                                        {
3832
                                            Background = new SolidColorBrush(Colors.Black),
3833
                                            ControlType = ControlType.Rectangle
3834
                                        };
3835

    
3836
                                        currentControl.CommentID = Commons.shortGuid();
3837
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3838
                                        currentControl.IsNew = true;
3839
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3840

    
3841
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3842
                                    }
3843
                                //}
3844
                            }
3845
                        }
3846
                        break;
3847
                    case ControlType.RectCloud:
3848
                        {
3849
                            if (mouseButtonDown == MouseButton.Left)
3850
                            {
3851
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3852
                                //{
3853
                                    if (currentControl is RectCloudControl)
3854
                                    {
3855
                                        //20180906 LJY TEST IsRotationDrawingEnable
3856
                                        if (IsGetoutpoint((currentControl as RectCloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3857
                                        {
3858
                                            return;
3859
                                        }
3860

    
3861
                                        CreateControl();
3862

    
3863
                                        (currentControl as RectCloudControl).ApplyOverViewData();
3864
                                        currentControl = null;
3865
                                    
3866
                                        this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
3867
                                    }
3868
                                    else
3869
                                    {
3870
                                        currentControl = new RectCloudControl
3871
                                        {
3872
                                            Background = new SolidColorBrush(Colors.Black)
3873
                                        };
3874

    
3875
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3876
                                        currentControl.CommentID = Commons.shortGuid();
3877
                                        currentControl.IsNew = true;
3878
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3879
                                    }
3880
                                //}
3881
                            }
3882
                        }
3883
                        break;
3884
                    case ControlType.Circle:
3885
                        {
3886
                            if (mouseButtonDown == MouseButton.Left)
3887
                            {
3888
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3889
                                //{
3890
                                    if (currentControl is CircleControl)
3891
                                    {
3892
                                        //20180906 LJY TEST IsRotationDrawingEnable
3893
                                        if (IsGetoutpoint((currentControl as CircleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3894
                                        {
3895
                                            return;
3896
                                        }
3897

    
3898
                                        CreateControl();
3899

    
3900
                                        (currentControl as CircleControl).ApplyOverViewData();
3901
                                        currentControl = null;
3902
                                    }
3903
                                    else
3904
                                    {
3905
                                        currentControl = new CircleControl
3906
                                        {
3907
                                            Background = new SolidColorBrush(Colors.Black)
3908
                                        };
3909

    
3910
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3911
                                        currentControl.CommentID = Commons.shortGuid();
3912
                                        currentControl.IsNew = true;
3913
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3914
                                    }
3915
                                //}
3916
                            }
3917
                        }
3918
                        break;
3919
                    case ControlType.Triangle:
3920
                        {
3921
                            if (mouseButtonDown == MouseButton.Left)
3922
                            {
3923
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3924
                                //{
3925
                                    if (currentControl is TriControl)
3926
                                    {
3927
                                        var content = currentControl as TriControl;
3928
                                        if (content.MidPoint == new Point(0, 0))
3929
                                        {
3930
                                            content.MidPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
3931
                                        }
3932
                                        else
3933
                                        {
3934
                                            //20180906 LJY TEST IsRotationDrawingEnable
3935
                                            if (IsGetoutpoint((currentControl as TriControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3936
                                            {
3937
                                                return;
3938
                                            }
3939

    
3940
                                            CreateControl();
3941

    
3942
                                            (currentControl as TriControl).ApplyOverViewData();
3943
                                            currentControl = null;
3944
                                        }
3945
                                    }
3946
                                    else
3947
                                    {
3948
                                        currentControl = new TriControl
3949
                                        {
3950
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3951
                                            Background = new SolidColorBrush(Colors.Black),
3952
                                        };
3953

    
3954
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3955
                                        currentControl.CommentID = Commons.shortGuid();
3956
                                        currentControl.IsNew = true;
3957
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3958
                                    }
3959
                                //}
3960
                            }
3961
                        }
3962
                        break;
3963
                    case ControlType.SingleLine:
3964
                        {
3965
                            if (mouseButtonDown == MouseButton.Left)
3966
                            {
3967
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3968
                                //{
3969
                                    if (currentControl is LineControl)
3970
                                    {
3971
                                        //20180906 LJY TEST IsRotationDrawingEnable
3972
                                        if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3973
                                        {
3974
                                            return;
3975
                                        }
3976

    
3977
                                        CreateControl();
3978

    
3979
                                        (currentControl as LineControl).ApplyOverViewData();
3980
                                        currentControl = null;
3981
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3982
                                    }
3983
                                    else
3984
                                    {
3985
                                        currentControl = new LineControl
3986
                                        {
3987
                                            Background = new SolidColorBrush(Colors.Black)
3988
                                        };
3989

    
3990
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3991
                                        currentControl.CommentID = Commons.shortGuid();
3992
                                        currentControl.IsNew = true;
3993
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3994
                                        this.MainAngle.Visibility = Visibility.Visible;
3995
                                    }
3996
                                //}
3997
                            }
3998
                        }
3999
                        break;
4000
                    case ControlType.CancelLine:
4001
                        {
4002
                            if (mouseButtonDown == MouseButton.Left)
4003
                            {
4004
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4005
                                //{
4006
                                    if (currentControl is LineControl)
4007
                                    {
4008
                                        //20180906 LJY TEST IsRotationDrawingEnable
4009
                                        if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4010
                                        {
4011
                                            return;
4012
                                        }
4013

    
4014
                                        CreateControl();
4015

    
4016
                                        (currentControl as LineControl).ApplyOverViewData();
4017
                                        currentControl = null;
4018
                                        this.MainAngle.Visibility = Visibility.Collapsed;
4019
                                    }
4020
                                    else
4021
                                    {
4022
                                        currentControl = new LineControl
4023
                                        {
4024
                                            Background = new SolidColorBrush(Colors.Black)
4025
                                        };
4026

    
4027
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4028
                                        currentControl.CommentID = Commons.shortGuid();
4029
                                        currentControl.IsNew = true;
4030
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4031
                                        this.MainAngle.Visibility = Visibility.Visible;
4032
                                    }
4033
                                //}
4034
                            }
4035
                        }
4036
                        break;
4037
                    case ControlType.ArrowLine:
4038
                        {
4039
                            if (mouseButtonDown == MouseButton.Left)
4040
                            {
4041
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4042
                                //{
4043
                                    if (currentControl is LineControl)
4044
                                    {
4045
                                        //20180906 LJY TEST IsRotationDrawingEnable
4046
                                        if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4047
                                        {
4048
                                            return;
4049
                                        }
4050

    
4051
                                        CreateControl();
4052

    
4053
                                        (currentControl as LineControl).ApplyOverViewData();
4054
                                        currentControl = null;
4055
                                        this.MainAngle.Visibility = Visibility.Collapsed;
4056
                                    }
4057
                                    else
4058
                                    {
4059
                                        currentControl = new LineControl
4060
                                        {
4061
                                            Background = new SolidColorBrush(Colors.Black)
4062
                                        };
4063

    
4064
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4065
                                        currentControl.CommentID = Commons.shortGuid();
4066
                                        currentControl.IsNew = true;
4067
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4068
                                        this.MainAngle.Visibility = Visibility.Visible;
4069
                                    }
4070
                                //}
4071
                            }
4072
                        }
4073
                        break;
4074
                    case ControlType.TwinLine:
4075
                        {
4076
                            if (mouseButtonDown == MouseButton.Left)
4077
                            {
4078
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4079
                                //{
4080
                                    if (currentControl is LineControl)
4081
                                    {
4082
                                        //20180906 LJY TEST IsRotationDrawingEnable
4083
                                        if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4084
                                        {
4085
                                            return;
4086
                                        }
4087

    
4088
                                        CreateControl();
4089

    
4090
                                        (currentControl as LineControl).ApplyOverViewData();
4091
                                        currentControl = null;
4092
                                        this.MainAngle.Visibility = Visibility.Collapsed;
4093
                                    }
4094
                                    else
4095
                                    {
4096
                                        currentControl = new LineControl
4097
                                        {
4098
                                            Background = new SolidColorBrush(Colors.Black)
4099
                                        };
4100
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4101
                                        currentControl.CommentID = Commons.shortGuid();
4102
                                        currentControl.IsNew = true;
4103
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4104
                                        this.MainAngle.Visibility = Visibility.Visible;
4105
                                    }
4106
                                //}
4107
                            }
4108
                        }
4109
                        break;
4110
                    case ControlType.DimLine:
4111
                        {
4112
                            if (mouseButtonDown == MouseButton.Left)
4113
                            {
4114
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4115
                                //{
4116
                                    if (currentControl is LineControl)
4117
                                    {
4118
                                        //20180906 LJY TEST IsRotationDrawingEnable
4119
                                        if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4120
                                        {
4121
                                            return;
4122
                                        }
4123
                                        CreateControl();
4124

    
4125
                                        (currentControl as LineControl).ApplyOverViewData();
4126
                                        currentControl = null;
4127
                                        this.MainAngle.Visibility = Visibility.Collapsed;
4128
                                    }
4129
                                    else
4130
                                    {
4131
                                        currentControl = new LineControl
4132
                                        {
4133
                                            Background = new SolidColorBrush(Colors.Black)
4134
                                        };
4135
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4136
                                        currentControl.CommentID = Commons.shortGuid();
4137
                                        currentControl.IsNew = true;
4138
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4139
                                        this.MainAngle.Visibility = Visibility.Visible;
4140
                                    }
4141
                                //}
4142
                            }
4143
                        }
4144
                        break;
4145
                    case ControlType.ChainLine:
4146
                        {
4147
                            if (currentControl is PolygonControl)
4148
                            {
4149
                                var control = currentControl as PolygonControl;
4150

    
4151
                                if (mouseButtonDown == MouseButton.Right)
4152
                                {
4153
                                    //20180906 LJY TEST IsRotationDrawingEnable
4154
                                    if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4155
                                    {
4156
                                        return;
4157
                                    }
4158

    
4159
                                    CreateControl();
4160

    
4161
                                    (currentControl as PolygonControl).ApplyOverViewData();
4162
                                    currentControl = null;
4163
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4164
                                    return;
4165
                                }
4166

    
4167
                                if (!control.IsCompleted)
4168
                                {
4169
                                    control.PointSet.Add(control.EndPoint);
4170
                                    this.MainAngle.Visibility = Visibility.Visible;
4171
                                }
4172
                            }
4173
                            else
4174
                            {
4175
                                if (mouseButtonDown == MouseButton.Left)
4176
                                {
4177
                                    MainAngle.Visibility = Visibility.Visible;
4178
                                    currentControl = new PolygonControl
4179
                                    {
4180
                                        PointSet = new List<Point>(),
4181
                                        //강인구 추가(ChainLine일때는 채우기 스타일을 주지 않기 위해 설정)
4182
                                        ControlType = ControlType.ChainLine,
4183
                                        DashSize = ViewerDataModel.Instance.DashSize,
4184
                                        LineSize = ViewerDataModel.Instance.LineSize,
4185
                                        //PointC = new StylusPointSet()
4186
                                    };
4187

    
4188
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4189
                                    //{
4190
                                        var polygonControl = (currentControl as PolygonControl);
4191
                                        currentControl.CommentID = Commons.shortGuid();
4192
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4193
                                        currentControl.IsNew = true;
4194
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4195
                                        //currentControl.OnApplyTemplate();
4196
                                        //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint);
4197
                                        //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint);
4198
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
4199
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
4200
                                    //}
4201
                                }
4202
                            }
4203
                        }
4204
                        break;
4205
                    case ControlType.ArcLine:
4206
                        {
4207
                            if (mouseButtonDown == MouseButton.Left)
4208
                            {
4209
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4210
                                //{
4211
                                    if (currentControl is ArcControl)
4212
                                    {
4213
                                        //20180906 LJY TEST IsRotationDrawingEnable
4214
                                        if (IsGetoutpoint((currentControl as ArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4215
                                        {
4216
                                            return;
4217
                                        }
4218

    
4219
                                        CreateControl();
4220

    
4221
                                        (currentControl as ArcControl).ApplyOverViewData();
4222
                                        currentControl = null;
4223
                                        this.MainAngle.Visibility = Visibility.Collapsed;
4224
                                    }
4225
                                    else
4226
                                    {
4227
                                        currentControl = new ArcControl
4228
                                        {
4229
                                            Background = new SolidColorBrush(Colors.Black)
4230
                                        };
4231
                                        currentControl.CommentID = Commons.shortGuid();
4232
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4233
                                        currentControl.IsNew = true;
4234
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4235
                                        this.MainAngle.Visibility = Visibility.Visible;
4236
                                    }
4237
                                //}
4238
                            }
4239
                            else if (mouseButtonDown == MouseButton.Right)
4240
                            {
4241
                                if (currentControl != null)
4242
                                {
4243
                                    (currentControl as ArcControl).setClock();
4244
                                    (currentControl as ArcControl).MidPoint = new Point(0, 0);
4245
                                    //(currentControl as ArcControl).ApplyTemplate();
4246
                                }
4247
                            }
4248
                        }
4249
                        break;
4250
                    case ControlType.ArcArrow:
4251
                        {
4252
                            if (mouseButtonDown == MouseButton.Left)
4253
                            {
4254
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4255
                                //{
4256
                                if (currentControl is ArrowArcControl)
4257
                                {
4258
                                    //20180906 LJY TEST IsRotationDrawingEnable
4259
                                    if (IsGetoutpoint((currentControl as ArrowArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4260
                                    {
4261
                                        return;
4262
                                    }
4263

    
4264
                                    CreateControl();
4265

    
4266
                                    (currentControl as ArrowArcControl).ApplyOverViewData();
4267
                                    currentControl = null;
4268
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4269
                                }
4270
                                else
4271
                                {
4272
                                    currentControl = new ArrowArcControl
4273
                                    {
4274
                                        Background = new SolidColorBrush(Colors.Black)
4275
                                    };
4276
                                    currentControl.CommentID = Commons.shortGuid();
4277
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4278
                                    currentControl.IsNew = true;
4279
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4280
                                    this.MainAngle.Visibility = Visibility.Visible;
4281
                                }
4282
                                //}
4283
                            }
4284
                            else if (mouseButtonDown == MouseButton.Right)
4285
                            {
4286
                                if (currentControl != null)
4287
                                {
4288
                                    (currentControl as ArrowArcControl).setClock();
4289
                                    (currentControl as ArrowArcControl).MidPoint = new Point(0, 0);
4290
                                    //(currentControl as ArcControl).ApplyTemplate();
4291
                                }
4292
                            }
4293
                        }
4294
                        break;
4295
                    case ControlType.ArrowMultiLine:
4296
                        {
4297
                            if (mouseButtonDown == MouseButton.Left)
4298
                            {
4299
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4300
                                //{
4301

    
4302
                                    if (currentControl is ArrowControl_Multi)
4303
                                    {
4304
                                        var content = currentControl as ArrowControl_Multi;
4305
                                        if (content.MiddlePoint == new Point(0, 0))
4306
                                        {
4307
                                            if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
4308
                                            {
4309
                                                content.MiddlePoint = content.EndPoint;
4310
                                            }
4311
                                            else
4312
                                            {
4313
                                                content.MiddlePoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
4314
                                            }
4315
                                        }
4316
                                        else
4317
                                        {
4318
                                            //20180906 LJY TEST IsRotationDrawingEnable
4319
                                            if (IsGetoutpoint((currentControl as ArrowControl_Multi).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4320
                                            {
4321
                                                return;
4322
                                            }
4323

    
4324
                                            CreateControl();
4325

    
4326
                                            (currentControl as ArrowControl_Multi).ApplyOverViewData();
4327
                                            currentControl = null;
4328
                                            this.MainAngle.Visibility = Visibility.Collapsed;
4329
                                        }
4330
                                    }
4331
                                    else
4332
                                    {
4333
                                        currentControl = new ArrowControl_Multi
4334
                                        {
4335
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
4336
                                            Background = new SolidColorBrush(Colors.Black)
4337
                                        };
4338
                                        currentControl.CommentID = Commons.shortGuid();
4339
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4340
                                        currentControl.IsNew = true;
4341
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4342
                                        this.MainAngle.Visibility = Visibility.Visible;
4343
                                    }
4344
                                //}
4345
                            }
4346
                        }
4347
                        break;
4348
                    case ControlType.PolygonCloud:
4349
                        {
4350
                            if (currentControl is CloudControl)
4351
                            {
4352
                                var control = currentControl as CloudControl;
4353
                                if (mouseButtonDown == MouseButton.Right)
4354
                                {
4355
                                    control.IsCompleted = true;
4356
                                }
4357

    
4358
                                if (!control.IsCompleted)
4359
                                {
4360
                                    control.PointSet.Add(control.EndPoint);
4361
                                }
4362
                                else
4363
                                {
4364
                                    //20180906 LJY TEST IsRotationDrawingEnable
4365
                                    if (IsGetoutpoint((currentControl as CloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4366
                                    {
4367
                                        return;
4368
                                    }
4369

    
4370
                                    CreateControl();
4371

    
4372
                                    control.isTransOn = true;
4373
                                    var firstPoint = control.PointSet.First();
4374

    
4375
                                    control.PointSet.Add(firstPoint);
4376
                                    control.DrawingCloud();
4377
                                    control.ApplyOverViewData();
4378

    
4379
                                    currentControl = null;
4380
                                }
4381
                            }
4382
                            else
4383
                            {
4384
                                if (mouseButtonDown == MouseButton.Left)
4385
                                {
4386
                                    currentControl = new CloudControl
4387
                                    {
4388
                                        PointSet = new List<Point>(),
4389
                                        PointC = new StylusPointSet()
4390
                                    };
4391

    
4392
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4393
                                    //{
4394
                                        var polygonControl = (currentControl as CloudControl);
4395
                                        currentControl.CommentID = Commons.shortGuid();
4396
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4397
                                        currentControl.IsNew = true;
4398
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4399

    
4400
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
4401
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
4402
                                    //}
4403
                                }
4404
                            }
4405
                        }
4406
                        break;
4407
                    case ControlType.ImgControl:
4408
                        {
4409
                            if (mouseButtonDown == MouseButton.Left)
4410
                            {
4411
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4412
                                //{
4413
                                    if (currentControl is ImgControl)
4414
                                    {
4415
                                        //20180906 LJY TEST IsRotationDrawingEnable
4416
                                        if (IsGetoutpoint((currentControl as ImgControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4417
                                        {
4418
                                            return;
4419
                                        }
4420

    
4421
                                        CreateControl();
4422
                                        (currentControl as ImgControl).ApplyOverViewData();
4423
                                        controlType = ControlType.ImgControl;
4424
                                        currentControl = null;
4425
                                    }
4426
                                    else
4427
                                    {
4428
                                        
4429
                                        string extension = System.IO.Path.GetExtension(filename).ToUpper();
4430
                                        if (extension == ".PNG" || extension == ".JPEG" || extension == ".GIF" || extension == ".BMP" || extension == ".JPG" || extension == ".SVG")
4431
                                        {
4432
                                            Image img = new Image();
4433
                                            //img.Source = new BitmapImage(new Uri(filename));
4434
                                            if (filename.Contains(".svg"))
4435
                                            {
4436
                                                byte[] imageData = null;
4437
                                                DrawingImage image = null;
4438
                                                using (System.Net.WebClient web = new System.Net.WebClient())
4439
                                                {
4440
                                                    imageData = web.DownloadData(new Uri(filename));
4441
                                                    System.IO.Stream stream = new System.IO.MemoryStream(imageData);
4442
                                                    image = SvgReader.Load(stream);
4443
                                                }
4444
                                                img.Source = image;
4445
                                            }
4446
                                            else
4447
                                            {
4448
                                                img.Source = new BitmapImage(new Uri(filename));
4449
                                            }
4450

    
4451
                                            currentControl = new ImgControl
4452
                                            {
4453
                                                    Background = new SolidColorBrush(Colors.Black),
4454
                                                    PointSet = new List<Point>(),
4455
                                                    FilePath = filename,
4456
                                                    ImageData = img.Source,
4457
                                                    StartPoint = canvasDrawingMouseDownPoint,
4458
                                                    EndPoint = new Point(canvasDrawingMouseDownPoint.X + 100, canvasDrawingMouseDownPoint.Y + 100),
4459
                                                    TopRightPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y + 100),
4460
                                                    LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X + 100, canvasDrawingMouseDownPoint.Y),
4461
                                                    ControlType = ControlType.ImgControl
4462
                                                };
4463

    
4464
                                        
4465
                                                currentControl.CommentID = Commons.shortGuid();                                            
4466
                                                currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4467
                                                currentControl.IsNew = true;
4468
                                                ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4469

    
4470
                                                //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
4471
                                                (currentControl as ImgControl).Angle -= rotate.Angle;
4472
                                        }
4473
                                    }
4474
                                //}
4475
                            }
4476
                        }
4477
                        break;
4478
                    case ControlType.Date:
4479
                        {
4480
                            if (mouseButtonDown == MouseButton.Left)
4481
                            {
4482
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4483
                                //{
4484
                                    if (currentControl is DateControl)
4485
                                    {
4486
                                        //20180906 LJY TEST IsRotationDrawingEnable
4487
                                        if (IsGetoutpoint((currentControl as DateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4488
                                        {
4489
                                            return;
4490
                                        }
4491

    
4492
                                        CreateControl();
4493
                                        (currentControl as DateControl).ApplyOverViewData();
4494
                                        currentControl = null;
4495

    
4496
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
4497
                                        {
4498
                                            controlType = ControlType.None;
4499
                                            IsSwingMode = false;
4500
                                            Common.ViewerDataModel.Instance.SelectedControl = "";
4501
                                            Common.ViewerDataModel.Instance.ControlTag = null;
4502
                                            mouseHandlingMode = MouseHandlingMode.None;
4503
                                            this.ParentOfType<MainWindow>().dzTopMenu.btn_Batch.IsChecked = false;
4504
                                            txtBatch.Visibility = Visibility.Collapsed;
4505

    
4506
                                        }
4507
                                    }
4508
                                    else
4509
                                    {
4510
                                        currentControl = new DateControl
4511
                                        {
4512
                                            Background = new SolidColorBrush(Colors.Black)
4513
                                        };
4514
                                        currentControl.CommentID = Commons.shortGuid();
4515
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4516
                                        currentControl.IsNew = true;
4517
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4518

    
4519
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
4520
                                        (currentControl as DateControl).Angle -= rotate.Angle;
4521
                                }
4522
                                //}
4523
                            }
4524
                        }
4525
                        break;
4526
                    case ControlType.TextControl:
4527
                        {
4528
                            if (mouseButtonDown == MouseButton.Left)
4529
                            {
4530
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4531
                                {
4532
                                    currentControl = new TextControl
4533
                                    {
4534
                                        ControlType = controlType
4535
                                    };
4536
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
4537
                                    currentControl.CommentID = Commons.shortGuid();
4538
                                    currentControl.IsNew = true;
4539
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4540
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4541
                                    currentControl.SetValue(Canvas.ZIndexProperty, 2);
4542
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
4543
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);
4544
                                    
4545
                                    (currentControl as TextControl).ControlType_No = 0;
4546
                                    (currentControl as TextControl).Angle -= rotate.Angle;
4547
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
4548
                                    (currentControl as TextControl).ApplyTemplate();
4549
                                    (currentControl as TextControl).Base_TextBox.Focus();
4550

    
4551
                                    CreateControl();
4552

    
4553
                                }
4554
                            }
4555
                        }
4556
                        break;
4557
                    case ControlType.TextBorder:
4558
                        {
4559
                            if (mouseButtonDown == MouseButton.Left)
4560
                            {
4561
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4562
                                {
4563
                                    currentControl = new TextControl
4564
                                    {
4565
                                        ControlType = controlType
4566
                                    };
4567

    
4568
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
4569
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4570
                                    currentControl.CommentID = Commons.shortGuid();
4571
                                    currentControl.IsNew = true;
4572
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4573
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
4574
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
4575
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);
4576
                                    
4577
                                    (currentControl as TextControl).ControlType_No = 1;
4578
                                    (currentControl as TextControl).Angle = Ang;
4579
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
4580
                                    (currentControl as TextControl).ApplyTemplate();
4581
                                    (currentControl as TextControl).Base_TextBox.Focus();
4582
                                    CreateControl();
4583

    
4584
                                    //currentControl = null;
4585
                                }
4586
                            }
4587
                        }
4588
                        break;
4589
                    case ControlType.TextCloud:
4590
                        {
4591
                            if (mouseButtonDown == MouseButton.Left)
4592
                            {
4593
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4594
                                {
4595
                                    currentControl = new TextControl
4596
                                    {
4597
                                        ControlType = controlType
4598
                                    };
4599

    
4600
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
4601
                                    currentControl.CommentID = Commons.shortGuid();
4602
                                    currentControl.IsNew = true;
4603
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4604
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4605

    
4606
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
4607
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
4608
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);                                    
4609

    
4610
                                    (currentControl as TextControl).Angle = Ang;
4611
                                    (currentControl as TextControl).ControlType_No = 2;
4612
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
4613
                                    (currentControl as TextControl).ApplyTemplate();
4614
                                    (currentControl as TextControl).Base_TextBox.Focus();
4615
                                    CreateControl();
4616
                                    //currentControl = null;
4617
                                }
4618
                            }
4619
                        }
4620
                        break;
4621
                    case ControlType.ArrowTextControl:
4622
                         {
4623
                            if (mouseButtonDown == MouseButton.Left)
4624
                            {
4625
                                if (currentControl is ArrowTextControl)
4626
                                {
4627
                                    //20180906 LJY TEST IsRotationDrawingEnable
4628
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4629
                                    {
4630
                                        return;
4631
                                    }                                    
4632

    
4633
                                    CreateControl();
4634

    
4635
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4636
                                    (currentControl as ArrowTextControl).IsEditing = false;
4637
                                    (currentControl as ArrowTextControl).EnableEditing = false;
4638
                                    (currentControl as ArrowTextControl).IsNew = false;
4639
                                    currentControl = null;
4640
                                }
4641
                                else
4642
                                {
4643
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4644
                                    //{
4645
                                        currentControl = new ArrowTextControl();
4646
                                        currentControl.CommentID = Commons.shortGuid();
4647
                                        currentControl.IsNew = true;
4648
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4649
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4650

    
4651
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4652
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4653
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);
4654
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4655
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4656

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

    
4660
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4661
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4662
                                        this.MainAngle.Visibility = Visibility.Visible;
4663

    
4664
                                    
4665
                                    //}
4666
                                }
4667
                            }
4668
                        }
4669
                        break;
4670
                    case ControlType.ArrowTransTextControl:
4671
                        {
4672
                            if (mouseButtonDown == MouseButton.Left)
4673
                            {
4674
                                if (currentControl is ArrowTextControl)
4675
                                {
4676
                                    //20180906 LJY TEST IsRotationDrawingEnable
4677
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4678
                                    {
4679
                                        return;
4680
                                    }                                    
4681

    
4682
                                    CreateControl();
4683
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4684
                                    currentControl.IsNew = false;
4685
                                    currentControl = null;
4686
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4687
                                }
4688
                                else
4689
                                {
4690
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4691
                                    //{
4692
                                         currentControl = new ArrowTextControl();
4693
                                        currentControl.CommentID = Commons.shortGuid();
4694
                                        currentControl.IsNew = true;
4695
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4696
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4697
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4698
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4699
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                  
4700
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4701
                                        (currentControl as ArrowTextControl).isFixed = true;
4702
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4703

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

    
4707
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4708
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4709
                                        (currentControl as ArrowTextControl).isTrans = true;
4710
                                }
4711
                            }
4712
                        }
4713
                        break;
4714
                    case ControlType.ArrowTextBorderControl:
4715
                         {
4716
                            if (mouseButtonDown == MouseButton.Left)
4717
                            {
4718
                                if (currentControl is ArrowTextControl)
4719
                                {
4720
                                    //20180906 LJY TEST IsRotationDrawingEnable
4721
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4722
                                    {
4723
                                        return;
4724
                                    }
4725

    
4726
                                    CreateControl();
4727
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4728
                                    currentControl.IsNew = false;
4729
                                    currentControl = null;
4730
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4731
                                }
4732
                                else
4733
                                {
4734
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4735
                                    //{
4736
                                        currentControl = new ArrowTextControl()
4737
                                        {
4738
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect
4739
                                        };
4740
                                        currentControl.CommentID = Commons.shortGuid();
4741
                                        currentControl.IsNew = true;
4742
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4743
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4744

    
4745
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4746

    
4747
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4748

    
4749
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);
4750
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4751
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4752

    
4753
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
4754
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
4755
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4756
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4757
                                        this.MainAngle.Visibility = Visibility.Visible;                                    
4758
                                    //}
4759
                                }
4760
                            }
4761
                        }
4762
                        break;
4763
                    case ControlType.ArrowTransTextBorderControl:
4764
                        {
4765
                            if (mouseButtonDown == MouseButton.Left)
4766
                            {
4767
                                if (currentControl is ArrowTextControl)
4768
                                {
4769
                                    //20180906 LJY TEST IsRotationDrawingEnable
4770
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4771
                                    {
4772
                                        return;
4773
                                    }
4774
                                    CreateControl();
4775
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4776
                                    currentControl.IsNew = false;
4777
                                    currentControl = null;
4778
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4779
                                }
4780
                                else
4781
                                {
4782
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4783
                                    //{
4784
                                    
4785

    
4786
                                    currentControl = new ArrowTextControl()
4787
                                        {
4788
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect
4789
                                        };
4790
                                        currentControl.CommentID = Commons.shortGuid();
4791
                                        currentControl.IsNew = true;
4792
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4793
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4794

    
4795
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4796

    
4797
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4798
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                                    
4799
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4800
                                        (currentControl as ArrowTextControl).isFixed = true;
4801
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4802
                                     
4803
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
4804
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
4805
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4806

    
4807
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();                                 
4808
                                        this.MainAngle.Visibility = Visibility.Visible;
4809
                                    
4810
                                    //20180911 LJY
4811
                                        (currentControl as ArrowTextControl).isTrans = true;
4812
                                    
4813

    
4814
                                    //}
4815
                                }
4816
                            }
4817
                        }
4818
                        break;
4819
                    case ControlType.ArrowTextCloudControl:
4820
                        {
4821
                            if (mouseButtonDown == MouseButton.Left)
4822
                            {
4823
                                if (currentControl is ArrowTextControl)
4824
                                {
4825
                                    //20180906 LJY TEST IsRotationDrawingEnable
4826
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4827
                                    {
4828
                                        return;
4829
                                    }
4830
                                    CreateControl();
4831
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4832
                                    currentControl.IsNew = false;
4833
                                    currentControl = null;
4834
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4835
                                }
4836
                                else
4837
                                {
4838
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4839
                                    //{
4840
                                        currentControl = new ArrowTextControl()
4841
                                        {
4842
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud
4843
                                        };
4844
                                        currentControl.CommentID = Commons.shortGuid();
4845
                                        currentControl.IsNew = true;
4846
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4847
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4848

    
4849
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4850
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4851
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                                 
4852
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4853
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4854

    
4855
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
4856
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
4857
                                    
4858
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4859
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4860
                                        this.MainAngle.Visibility = Visibility.Visible;                                        
4861
                                    //}
4862
                                }
4863
                            }
4864
                        }
4865
                        break;
4866
                    case ControlType.ArrowTransTextCloudControl:
4867
                        {
4868
                            if (mouseButtonDown == MouseButton.Left)
4869
                            {
4870
                                if (currentControl is ArrowTextControl)
4871
                                {
4872
                                    //20180906 LJY TEST IsRotationDrawingEnable
4873
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4874
                                    {
4875
                                        return;
4876
                                    }
4877
                                    CreateControl();
4878
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4879
                                    currentControl.IsNew = false;
4880
                                    currentControl = null;
4881
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4882
                                }
4883
                                else
4884
                                {
4885
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4886
                                    //{
4887
                                        currentControl = new ArrowTextControl()
4888
                                        {
4889
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud
4890
                                        };
4891
                                        currentControl.CommentID = Commons.shortGuid();
4892
                                        currentControl.IsNew = true; 
4893
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4894
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4895
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4896

    
4897
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4898
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                                        
4899
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4900
                                        (currentControl as ArrowTextControl).isFixed = true;
4901
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4902

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

    
4906
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4907
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4908
                                        this.MainAngle.Visibility = Visibility.Visible;  
4909
                                    
4910
                                    //20180911 LJY
4911
                                        (currentControl as ArrowTextControl).isTrans = true;
4912
                                    //}
4913
                                }
4914
                            }
4915
                        }
4916
                        break;
4917
                    case ControlType.PolygonControl:
4918
                        {
4919
                            if (currentControl is PolygonControl)
4920
                            {
4921
                                var control = currentControl as PolygonControl;
4922

    
4923
                                if (mouseButtonDown == MouseButton.Right)
4924
                                {
4925
                                    control.IsCompleted = true;
4926
                                }
4927

    
4928
                                if (!control.IsCompleted)
4929
                                {
4930
                                    control.PointSet.Add(control.EndPoint);
4931
                                }
4932
                                else
4933
                                {
4934
                                    //20180906 LJY TEST IsRotationDrawingEnable
4935
                                    if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4936
                                    {
4937
                                        return;
4938
                                    }
4939

    
4940
                                    var firstPoint = control.PointSet.First();
4941
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
4942
                                    control.LineSize = ViewerDataModel.Instance.LineSize;
4943
                                    control.PointSet.Add(firstPoint);
4944

    
4945
                                    ///control.SetPolyPath();
4946

    
4947
                                    control.ApplyOverViewData();
4948

    
4949
                                    CreateControl();
4950

    
4951
                                    currentControl = null;
4952
                                }
4953
                            }
4954
                            else
4955
                            {
4956
                                if (mouseButtonDown == MouseButton.Left)
4957
                                {
4958
                                    currentControl = new PolygonControl
4959
                                    {
4960
                                        PointSet = new List<Point>(),
4961
                                        //PointC = new StylusPointSet()
4962
                                    };
4963

    
4964
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4965
                                    //{
4966
                                        var polygonControl = (currentControl as PolygonControl);
4967
                                        currentControl.CommentID = Commons.shortGuid();
4968
                                        currentControl.IsNew = true;
4969
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4970
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4971
                                        //currentControl.OnApplyTemplate();
4972
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
4973
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
4974
                                    //}
4975
                                }
4976
                            }
4977
                        }
4978
                        break;
4979
                    //강인구 추가
4980
                    case ControlType.Sign:
4981
                        {
4982
                            if (mouseButtonDown == MouseButton.Left)
4983
                            {
4984
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4985
                                //{
4986
                                    var _sign = GetUserSign.GetSign(App.ViewInfo.UserID, App.ViewInfo.ProjectNO);
4987

    
4988
                                    if (_sign == null)
4989
                                    {
4990
                                        txtBatch.Visibility = Visibility.Collapsed;
4991
                                        mouseHandlingMode = IKCOM.MouseHandlingMode.None;
4992
                                        controlType = ControlType.None;
4993

    
4994
                                        this.ParentOfType<MainWindow>().DialogMessage_Alert("등록된 Sign이 없습니다.", "Alert");
4995
                                        this.ParentOfType<MainWindow>().ChildrenOfType<RadToggleButton>().Where(data => data.IsChecked == true).FirstOrDefault().IsChecked = false;
4996
                                        return;
4997
                                    }
4998

    
4999
                                    if (currentControl is SignControl)
5000
                                    {
5001
                                        //20180906 LJY TEST IsRotationDrawingEnable
5002
                                        if (IsGetoutpoint((currentControl as SignControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
5003
                                        {
5004
                                            return;
5005
                                        }
5006

    
5007
                                        CreateControl();
5008
                                        currentControl = null;
5009
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
5010
                                        {
5011
                                            txtBatch.Text = "Place Date";
5012
                                            controlType = ControlType.Date;
5013
                                        }
5014
                                    }
5015
                                    else
5016
                                    {
5017
                                        currentControl = new SignControl
5018
                                        {
5019
                                            Background = new SolidColorBrush(Colors.Black),
5020
                                            UserNumber = App.ViewInfo.UserID,
5021
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
5022
                                            EndPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
5023
                                            ControlType = ControlType.Sign
5024
                                        };
5025

    
5026
                                        currentControl.CommentID = Commons.shortGuid();
5027
                                        currentControl.IsNew = true;
5028
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
5029
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
5030

    
5031
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
5032
                                        (currentControl as SignControl).Angle -= rotate.Angle;                                    
5033
                                }
5034
                                //}
5035
                            }
5036
                        }
5037
                        break;
5038
                    case ControlType.Mark:
5039
                        {
5040
                            if (mouseButtonDown == MouseButton.Left)
5041
                            {
5042
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
5043
                                //{
5044
                                    if (currentControl is RectangleControl)
5045
                                    {
5046
                                        //20180906 LJY TEST IsRotationDrawingEnable
5047
                                        if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
5048
                                        {
5049
                                            return;
5050
                                        }
5051

    
5052
                                        CreateControl();
5053
                                        (currentControl as RectangleControl).ApplyOverViewData();
5054
                                        currentControl = null;
5055
                                    
5056
                                        this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
5057

    
5058
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
5059
                                        {
5060
                                            txtBatch.Text = "Place Signature";
5061
                                            controlType = ControlType.Sign;
5062
                                        }
5063
                                    }
5064
                                    else
5065
                                    {
5066
                                        currentControl = new RectangleControl
5067
                                        {
5068
                                            Background = new SolidColorBrush(Colors.Black),
5069
                                            Paint = PaintSet.Fill
5070
                                        };
5071

    
5072
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
5073
                                        currentControl.CommentID = Commons.shortGuid();
5074
                                        currentControl.IsNew = true;
5075
                                        (currentControl as RectangleControl).DashSize = ViewerDataModel.Instance.DashSize;
5076
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
5077
                                    }
5078
                                //}
5079
                            }
5080
                        }
5081
                        break;
5082
                    case ControlType.Symbol:
5083
                        {
5084
                            if (mouseButtonDown == MouseButton.Left)
5085
                            {
5086
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
5087
                                //{
5088
                                    if (currentControl is SymControl)
5089
                                    {
5090
                                        //20180906 LJY TEST IsRotationDrawingEnable
5091
                                        if (IsGetoutpoint((currentControl as SymControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
5092
                                        {
5093
                                            return;
5094
                                        }
5095
                                        CreateControl();
5096
                                        currentControl = null;
5097
                                    
5098
                                        this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
5099
                                    }
5100
                                    else
5101
                                    {
5102
                                        currentControl = new SymControl
5103
                                        {
5104
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
5105
                                            Background = new SolidColorBrush(Colors.Black),
5106
                                            ControlType = ControlType.Symbol
5107
                                        };
5108

    
5109
                                        currentControl.IsNew = true;
5110
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
5111
                                        currentControl.CommentID = Commons.shortGuid();
5112
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
5113

    
5114
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
5115
                                        (currentControl as SymControl).Angle -= rotate.Angle;
5116
                                }
5117
                                //}
5118
                            }
5119
                        }
5120
                        break;
5121
                    case ControlType.Stamp:
5122
                        {
5123
                            if (mouseButtonDown == MouseButton.Left)
5124
                            {
5125
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
5126
                                //{
5127
                                    if (currentControl is SymControlN)
5128
                                    {
5129
                                        //20180906 LJY TEST IsRotationDrawingEnable
5130
                                        if (IsGetoutpoint((currentControl as SymControlN).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
5131
                                        {
5132
                                            return;
5133
                                        }
5134

    
5135
                                        CreateControl();
5136
                                        currentControl = null;
5137
                                   
5138

    
5139
                                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
5140
                                    }
5141
                                    else
5142
                                    {
5143
                                        currentControl = new SymControlN
5144
                                        {
5145
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
5146
                                            Background = new SolidColorBrush(Colors.Black),
5147
                                            ControlType = ControlType.Stamp
5148
                                        };
5149

    
5150
                                        currentControl.IsNew = true;
5151
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
5152
                                        currentControl.CommentID = Commons.shortGuid();
5153
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
5154
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
5155
                                        (currentControl as SymControlN).Angle -= rotate.Angle;
5156
                                }                                    
5157
                                //}
5158
                            }
5159
                        }
5160
                        break;
5161
                    case ControlType.PenControl:
5162
                        {
5163
                            if (inkBoard.Tag.ToString() == "Ink")
5164
                            {
5165
                                inkBoard.IsEnabled = true;
5166
                                StartNewStroke(canvasDrawingMouseDownPoint);
5167
                            }
5168
                            else if (inkBoard.Tag.ToString() == "EraseByPoint")
5169
                            {
5170
                                RemovePointStroke(canvasDrawingMouseDownPoint);
5171
                            }
5172
                            else if (inkBoard.Tag.ToString() == "EraseByStroke")
5173
                            {
5174
                                RemoveLineStroke(canvasDrawingMouseDownPoint);
5175
                            }
5176
                            IsDrawing = true;
5177
                            return;
5178
                        }
5179
                    default:
5180
                        if (currentControl != null)
5181
                        {
5182
                            currentControl.CommentID = null;
5183
                            currentControl.IsNew = false;
5184
                        }
5185
                        break;
5186
                }
5187
            }
5188
            if (mouseHandlingMode != MouseHandlingMode.None && mouseButtonDown == MouseButton.Left)
5189
            {
5190
                if (mouseHandlingMode == MouseHandlingMode.Adorner && SelectLayer.Children.Count > 0)
5191
                {
5192
                    bool mouseOff = false;
5193
                    foreach (var item in SelectLayer.Children)
5194
                    {
5195
                        if (item is AdornerFinal)
5196
                        {
5197

    
5198
                            var over = (item as AdornerFinal).MemberSet.Where(data => data.DrawingData.IsMouseOver).FirstOrDefault();
5199
                            if (over != null)
5200
                            {
5201
                                mouseOff = true;
5202
                            }
5203
                        }
5204
                    }
5205

    
5206
                    if (!mouseOff)
5207
                    {
5208
                        ReleaseAdorner();
5209
                    }
5210
                }
5211
                zoomAndPanControl.CaptureMouse();
5212
                e.Handled = true;
5213
            }
5214
        }
5215

    
5216
        private void zoomAndPanControl2_MouseDown(object sender, MouseButtonEventArgs e)
5217
        {
5218
            mouseButtonDown = e.ChangedButton;
5219
            canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas2);
5220
        }
5221

    
5222
        private void RemoveLineStroke(Point P)
5223
        {
5224
            var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
5225
            if (control != null)
5226
            {
5227
                UndoData = new Undo_data()
5228
                {
5229
                    IsUndo = false,
5230
                    Event = Event_Type.Delete,
5231
                    EventTime = DateTime.Now,
5232
                    Markup_List = new List<Multi_Undo_data>()
5233
                };
5234

    
5235

    
5236
                multi_Undo_Data.Markup = control as MarkupToPDF.Common.CommentUserInfo;
5237
                UndoData.Markup_List.Add(multi_Undo_Data);
5238
                multi_Undo_Data = new Multi_Undo_data();
5239

    
5240
                ViewerDataModel.Instance.MarkupControls_USER.Remove(control);
5241
                var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (control as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault();
5242
                ViewerDataModel.Instance.MarkupList_USER.Remove(Item_);
5243
                
5244
                //임시파일에서도 삭제한다.
5245
                TempFile.DelTemp((control as MarkupToPDF.Common.CommentUserInfo).CommentID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString());
5246
                
5247
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
5248
                {
5249
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
5250
                });
5251
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
5252

    
5253
            }
5254
        }
5255

    
5256
        private void RemovePointStroke(Point P)
5257
        {
5258
            foreach (Stroke hits in inkBoard.Strokes)
5259
            {
5260
                foreach (StylusPoint sty in hits.StylusPoints)
5261
                {
5262

    
5263
                }
5264
                if (hits.HitTest(P))
5265
                {
5266
                    inkBoard.Strokes.Remove(hits);
5267
                    return;
5268
                }
5269
            }
5270
        }
5271

    
5272
        private void StartNewStroke(Point P)
5273
        {
5274
            strokePoints = new StylusPointCollection();
5275
            StylusPoint segment1Start = new StylusPoint(P.X, P.Y);
5276
            strokePoints.Add(segment1Start);
5277
            stroke = new Stroke(strokePoints);
5278

    
5279
            stroke.DrawingAttributes.Color = Colors.Red;
5280
            stroke.DrawingAttributes.Width = 4;
5281
            stroke.DrawingAttributes.Height = 4;
5282

    
5283
            inkBoard.Strokes.Add(stroke);
5284

    
5285
        }
5286

    
5287
        private void btnConsolidate_Click(object sender, RoutedEventArgs e)
5288
        {
5289
            ConsolidationMethod();
5290
        }
5291

    
5292
        public void TeamConsolidationMethod()
5293
        {
5294
            ChangeCommentReact();
5295
            if (this.gridViewMarkup.SelectedItems.Count == 0)
5296
            {
5297
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
5298
            }
5299
            else
5300
            {
5301
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
5302
                {
5303
                    if (!this.userData.DEPARTMENT.Equals(item.Depatment))
5304
                    {
5305
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at your department", "Alert");
5306
                        return;
5307
                    }                    
5308
                }
5309
                ViewerDataModel.Instance.IsConsolidate = true;
5310
                this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
5311
                List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>();
5312

    
5313
                string project_no = App.ViewInfo.ProjectNO;
5314
                string doc_id = _DocInfo.ID;
5315
                string user_id = App.ViewInfo.UserID;
5316
                List<MarkupInfoItem> markupInfoItems = new List<MarkupInfoItem>();
5317
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
5318
                {
5319
                    markupInfoItems.Add(item);
5320
                }
5321
                Logger.sendReqLog("TeamConsolidate", project_no + "," + user_id + "," + doc_id + "," + markupInfoItems, 1);
5322
                Logger.sendResLog("TeamConsolidate", this.BaseClient.TeamConsolidate(project_no, user_id, doc_id, markupInfoItems).ToString(), 1);
5323
                //this.BaseClient.TeamConsolidate(project_no, user_id, doc_id, markupInfoItems);
5324

    
5325
                Logger.sendReqLog("GetMarkupInfoItemsAsync", App.ViewInfo.ProjectNO + "," + _DocInfo.ID, 1);
5326
                this.BaseClient.GetMarkupInfoItemsAsync(App.ViewInfo.ProjectNO, _DocInfo.ID);
5327
            }
5328
        }
5329
        public void ConsolidationMethod()
5330
        {
5331
            ChangeCommentReact();
5332

    
5333
            if (this.gridViewMarkup.SelectedItems.Count == 0)
5334
            {
5335
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
5336
            }
5337
            else
5338
            {
5339
                ViewerDataModel.Instance.IsConsolidate = true;
5340
                this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
5341
                List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>();
5342

    
5343
                string project_no = App.ViewInfo.ProjectNO;
5344
                string doc_id = _DocInfo.ID;
5345
                string user_id = App.ViewInfo.UserID;
5346
                List<MarkupInfoItem> markupInfoItems = new List<MarkupInfoItem>();
5347
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
5348
                {
5349
                    markupInfoItems.Add(item);
5350
                }
5351
                Logger.sendReqLog("Consolidate", project_no + "," + user_id + "," + doc_id + "," + markupInfoItems, 1);
5352
                Logger.sendResLog("Consolidate", this.BaseClient.Consolidate(project_no, user_id, doc_id, markupInfoItems).ToString(), 1);
5353
                //this.BaseClient.Consolidate(project_no, user_id, doc_id, markupInfoItems);
5354

    
5355
                Logger.sendReqLog("GetMarkupInfoItemsAsync", App.ViewInfo.ProjectNO + "," + _DocInfo.ID, 1);
5356
                this.BaseClient.GetMarkupInfoItemsAsync(App.ViewInfo.ProjectNO, _DocInfo.ID);
5357

    
5358
            }
5359
        }
5360

    
5361
        private void btnConsolidate_Loaded(object sender, RoutedEventArgs e)
5362
        {
5363
            if (App.ViewInfo != null)
5364
            {
5365
                btnConsolidate = (sender as RadRibbonButton);
5366
                if (!App.ViewInfo.NewCommentPermission)
5367
                {
5368
                    (sender as RadRibbonButton).Visibility = System.Windows.Visibility.Collapsed;
5369
                }
5370
            }
5371
        }
5372

    
5373
        private void btnTeamConsolidate_Click(object sender, RoutedEventArgs e)
5374
        {
5375
            TeamConsolidationMethod();
5376
        }
5377

    
5378
        private void btnTeamConsolidate_Loaded(object sender, RoutedEventArgs e)
5379
        {
5380
            btnTeamConsolidate = sender as RadRibbonButton;
5381
            if (App.ViewInfo != null)
5382
            {
5383
                if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면
5384
                {
5385
                    if (btnConsolidate != null)
5386
                    {
5387
                        btnConsolidate.Visibility = Visibility.Collapsed;
5388
                    }
5389

    
5390
                    if (!App.ViewInfo.NewCommentPermission)
5391
                    {
5392
                        btnTeamConsolidate.Visibility = Visibility.Collapsed;
5393
                    }
5394
                }
5395
                else
5396
                {
5397
                    btnTeamConsolidate.Visibility = Visibility.Collapsed;
5398
                }
5399
            }
5400
        }
5401

    
5402
        private void FinalPDFEvent(object sender, RoutedEventArgs e)
5403
        {
5404
            var item = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault();
5405
            if (item != null)
5406
            {
5407
                Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item.MarkupInfoID + "," + _ViewInfo.UserID, 1);
5408

    
5409
                BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item.MarkupInfoID, _ViewInfo.UserID);
5410
            }
5411
            else
5412
            {
5413
                DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내");
5414
            }
5415
        }
5416

    
5417
        private void btnFinalPDF_Loaded(object sender, RoutedEventArgs e)
5418
        {
5419
            btnFinalPDF = sender as RadRibbonButton;
5420
            if (App.ViewInfo != null)
5421
            {
5422
                if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면
5423
                {
5424
                    btnFinalPDF.Visibility = System.Windows.Visibility.Collapsed;
5425
                    if (btnConsolidate != null)
5426
                    {
5427
                        btnConsolidate.Visibility = Visibility.Collapsed;
5428
                    }
5429
                }
5430
            }
5431
        }
5432

    
5433
        private void ConsolidateFinalPDFEvent(object sender, RoutedEventArgs e)
5434
        {
5435
            ChangeCommentReact();
5436

    
5437
            if (this.gridViewMarkup.SelectedItems.Count == 0)
5438
            {
5439
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
5440
            }
5441
            else
5442
            {
5443
                ViewerDataModel.Instance.IsConsolidate = true;
5444
                this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
5445
                List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>();
5446

    
5447
                string project_no = App.ViewInfo.ProjectNO;
5448
                string doc_id = _DocInfo.ID;
5449
                string user_id = App.ViewInfo.UserID;
5450
                List<MarkupInfoItem> markupInfoItems = new List<MarkupInfoItem>();
5451
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
5452
                {
5453
                    markupInfoItems.Add(item);
5454
                }
5455
                Logger.sendReqLog("Consolidate", project_no + "," + user_id + "," + doc_id + "," + markupInfoItems, 1);
5456
                Logger.sendResLog("Consolidate", this.BaseClient.Consolidate(project_no, user_id, doc_id, markupInfoItems).ToString(), 1);
5457
                Logger.sendReqLog("GetMarkupInfoItemsAsync", App.ViewInfo.ProjectNO + "," + _DocInfo.ID, 1);
5458
                var items = this.BaseClient.GetMarkupInfoItems(App.ViewInfo.ProjectNO, _DocInfo.ID);
5459

    
5460
                var item2 = items.Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault();
5461
                if (item2 != null)
5462
                {
5463
                    Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item2.MarkupInfoID + "," + _ViewInfo.UserID, 1);
5464

    
5465
                    BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item2.MarkupInfoID, _ViewInfo.UserID);
5466
                    BaseClient.GetMarkupInfoItemsAsync(App.ViewInfo.ProjectNO, _DocInfo.ID);
5467
                }
5468
                else
5469
                {
5470
                    DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내");
5471
                }
5472
            }
5473
        }
5474

    
5475
        private void btnConsolidateFinalPDF_Loaded(object sender, RoutedEventArgs e)
5476
        {
5477
            btnConsolidateFinalPDF = (sender as RadRibbonButton);
5478

    
5479
            if (App.ViewInfo != null)
5480
            {
5481
                if (!App.ViewInfo.NewCommentPermission || !App.ViewInfo.CreateFinalPDFPermission)
5482
                {
5483
                    btnConsolidateFinalPDF.Visibility = System.Windows.Visibility.Collapsed;
5484
                }
5485
            }
5486
        }
5487

    
5488
        private void SyncCompare_Click(object sender, RoutedEventArgs e)
5489
        {
5490
            if (CompareMode.IsChecked)
5491
            {
5492
                if (ViewerDataModel.Instance.PageBalanceMode && ViewerDataModel.Instance.PageBalanceNumber == 0)
5493
                {
5494
                    ViewerDataModel.Instance.PageBalanceNumber = 1;
5495
                }
5496
                if (ViewerDataModel.Instance.PageNumber == 0)
5497
                {
5498
                    ViewerDataModel.Instance.PageNumber = 1;
5499
                }
5500

    
5501
                Logger.sendReqLog("GetCompareRectAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID + "," + CurrentRev.DOCUMENT_ID +
5502
                    "," + pageNavigator.CurrentPage.PageNumber.ToString() + "," + ViewerDataModel.Instance.PageNumber.ToString() + "," +
5503
                    userData.COMPANY != "EXT" ? "true" : "false", 1);
5504

    
5505
                BaseClient.GetCompareRectAsync(_ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber.ToString(), ViewerDataModel.Instance.PageNumber.ToString(), userData.COMPANY != "EXT" ? "true" : "false");
5506
            }
5507
            else
5508
            {
5509
                da.From = 1;
5510
                da.To = 1;
5511
                da.Duration = new Duration(TimeSpan.FromSeconds(9999));
5512
                da.AutoReverse = false;
5513
                canvas_compareBorder.Children.Clear();
5514
                canvas_compareBorder.BeginAnimation(OpacityProperty, da);
5515
            }
5516
        }
5517

    
5518
        private void Sync_Click(object sender, RoutedEventArgs e)
5519
        {
5520
            if (Sync.IsChecked)
5521
            {
5522
                ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
5523
                ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
5524
                ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
5525
            }
5526
        }
5527

    
5528
        private void SyncUserListExpender_Click(object sender, RoutedEventArgs e)
5529
        {
5530
            if (UserList.IsChecked)
5531
            {
5532
                this.gridViewRevMarkup.Visibility = Visibility.Visible;
5533
            }
5534
            else
5535
            {
5536
                this.gridViewRevMarkup.Visibility = Visibility.Collapsed;
5537
            }
5538
        }
5539

    
5540
        private void SyncPageBalance_Click(object sender, RoutedEventArgs e)
5541
        {
5542

    
5543
            if (BalanceMode.IsChecked)
5544
            {
5545
                ViewerDataModel.Instance.PageBalanceMode = true;
5546
            }
5547
            else
5548
            {
5549
                ViewerDataModel.Instance.PageBalanceMode = false;
5550
                ViewerDataModel.Instance.PageBalanceNumber = 0;
5551
            }
5552
        }
5553

    
5554
        private void SyncExit_Click(object sender, RoutedEventArgs e)
5555
        {
5556
            //초기화
5557
            testPanel2.IsHidden = true;
5558
            ViewerDataModel.Instance.PageBalanceMode = false;
5559
            ViewerDataModel.Instance.PageBalanceNumber = 0;
5560
            ViewerDataModel.Instance.PageNumber = 0;
5561
            ViewerDataModel.Instance.MarkupControls_Sync.Clear();
5562
            this.gridViewRevMarkup.Visibility = Visibility.Collapsed;
5563
            UserList.IsChecked = false;
5564
            BalanceMode.IsChecked = false;
5565
        }
5566

    
5567
        private void SyncPageChange_Click(object sender, RoutedEventArgs e)
5568
        {
5569
            if ((sender as System.Windows.Controls.Control).Tag != null)
5570
            {
5571
                //Compare 초기화
5572
                CompareMode.IsChecked = false;
5573
                var balancePoint = Convert.ToInt32((sender as System.Windows.Controls.Control).Tag);
5574

    
5575
                if (ViewerDataModel.Instance.PageNumber == 0)
5576
                {
5577
                    ViewerDataModel.Instance.PageNumber = 1;
5578
                }
5579

    
5580
                if (ViewerDataModel.Instance.PageBalanceNumber == pageNavigator.PageCount)
5581
                {
5582
                }
5583
                else
5584
                {
5585
                    ViewerDataModel.Instance.PageBalanceNumber += balancePoint;
5586
                }
5587

    
5588
                if (ViewerDataModel.Instance.PageNumber == pageNavigator.PageCount && balancePoint > 0)
5589
                {
5590

    
5591
                }
5592
                else if ((ViewerDataModel.Instance.PageNumber + balancePoint) >= 1)
5593
                {
5594
                    ViewerDataModel.Instance.PageNumber += balancePoint;
5595
                }
5596

    
5597
                if (!testPanel2.IsHidden)
5598
                {
5599
                    if (IsSyncPDFMode)
5600
                    {
5601
                        Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
5602
                        var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber)));
5603

    
5604
                        if (pdfpath.IsDownloading)
5605
                        {
5606
                            pdfpath.DownloadCompleted += (ex, arg) =>
5607
                            {
5608
                                ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5609
                                ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5610
                                ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5611
                                zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5612
                                zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5613
                            };
5614
                        }
5615
                        else
5616
                        {
5617
                            ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5618
                            ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5619
                            ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5620

    
5621
                            zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5622
                            zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5623
                        }
5624

    
5625
                    }
5626
                    else
5627
                    {
5628
                        string uri = "";
5629

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

    
5639
                        var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
5640

    
5641
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5642
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5643
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5644

    
5645
                        zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
5646
                        zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
5647

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

    
5656
                                zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
5657
                                zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
5658
                            };
5659
                        }
5660
                    }
5661

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

    
5666
                    foreach (var item in gridSelectionRevItem)
5667
                    {
5668
                        item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageNumber).ToList().ForEach(delegate (MarkupItem markupitem)
5669
                        {
5670
                            MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID);
5671
                        });
5672
                    }
5673

    
5674
                    //강인구 추가
5675
                    zoomAndPanControl2.ZoomTo(new Rect
5676
                    {
5677
                        X = 0,
5678
                        Y = 0,
5679
                        Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width),
5680
                        Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height),
5681
                    });
5682

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

    
5685
                }
5686
            }
5687
        }
5688

    
5689
        private void SyncChange_Click(object sender, RoutedEventArgs e)
5690
        {
5691
            if (MarkupMode.IsChecked)
5692
            {
5693
                IsSyncPDFMode = true;
5694

    
5695
                var uri = CurrentRev.TO_VENDOR;
5696

    
5697
                if (ViewerDataModel.Instance.PageNumber == 0)
5698
                {
5699
                    ViewerDataModel.Instance.PageNumber = 1;
5700
                }
5701

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

    
5706
                if (pdfpath.IsDownloading)
5707
                {
5708
                    pdfpath.DownloadCompleted += (ex, arg) =>
5709
                    {
5710
                        ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5711
                        ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5712
                        ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5713
                        zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5714
                        zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5715
                    };
5716
                }
5717
                else
5718
                {
5719
                    ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5720
                    ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5721
                    ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5722

    
5723
                    zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5724
                    zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5725
                }
5726
            }
5727
            else
5728
            {
5729
                IsSyncPDFMode = false;
5730
                string uri = "";
5731
                if (userData.COMPANY != "EXT")
5732
                {
5733
                    uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5734
                }
5735
                else
5736
                {
5737
                    uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5738
                }
5739

    
5740
                var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
5741

    
5742
                ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5743
                ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5744
                ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5745

    
5746
                if (defaultBitmapImage_Compare.IsDownloading)
5747
                {
5748
                    defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
5749
                    {
5750
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5751
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5752
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5753
                    };
5754
                }
5755
                zoomAndPanControl2.ApplyTemplate();
5756
                zoomAndPanControl2.UpdateLayout();
5757
                zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
5758
                zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
5759
            }
5760
        }
5761

    
5762
        private void RadButton_Click(object sender, RoutedEventArgs e)
5763
        {
5764
            gridViewHistory_Busy.IsBusy = true;
5765

    
5766
            RadButton instance = sender as RadButton;
5767
            if (instance.CommandParameter != null)
5768
            {
5769
                CurrentRev = instance.CommandParameter as VPRevision;
5770
                BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) =>
5771
                {
5772
                    if (ea.Error == null && ea.Result != null)
5773
                    {
5774
                        testPanel2.IsHidden = false;
5775

    
5776
                        ViewerDataModel.Instance._markupInfoRevList = SetDisplayColor(ea.Result, _ViewInfo.UserID);
5777
                        gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList;
5778

    
5779
                        string uri = "";
5780
                        if (userData.COMPANY != "EXT")
5781
                        {
5782
                            uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5783
                        }
5784
                        else
5785
                        {
5786
                            uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5787
                        }
5788

    
5789
                        Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY);
5790

    
5791
                        var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
5792

    
5793
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5794
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5795
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5796

    
5797
                        if (defaultBitmapImage_Compare.IsDownloading)
5798
                        {
5799
                            defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
5800
                            {
5801
                                ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5802
                                ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5803
                                ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5804
                            };
5805
                        }
5806

    
5807
                        zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
5808
                        zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
5809
                        zoomAndPanControl2.RotationAngle = zoomAndPanControl.RotationAngle;
5810
                        zoomAndPanControl2.ApplyTemplate();
5811
                        zoomAndPanControl2.UpdateLayout();
5812

    
5813
                        if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY))
5814
                        {
5815
                            zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X;
5816
                            zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y;
5817
                        }
5818

    
5819
                        ViewerDataModel.Instance.Sync_ContentOffsetX = Sync_Offset_Point.X;
5820
                        ViewerDataModel.Instance.Sync_ContentOffsetY = Sync_Offset_Point.Y;
5821
                        ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
5822

    
5823
                        tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo);
5824
                        tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber);
5825
                        gridViewHistory_Busy.IsBusy = false;
5826
                    }
5827

    
5828
                    Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1);
5829
                };
5830
                BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID);
5831
                Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1);
5832
            }
5833
        }
5834

    
5835
        public void Sync_Event(VPRevision Currnet_Rev)
5836
        {
5837
            CurrentRev = Currnet_Rev;
5838

    
5839
            BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) =>
5840
            {
5841
                if (ea.Error == null && ea.Result != null)
5842
                {
5843
                    testPanel2.IsHidden = false;
5844

    
5845
                    ViewerDataModel.Instance._markupInfoRevList = SetDisplayColor(ea.Result, _ViewInfo.UserID);
5846
                    gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList;
5847

    
5848
                    string uri = "";
5849
                    if (userData.COMPANY != "EXT")
5850
                    {
5851
                        uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5852
                    }
5853
                    else
5854
                    {
5855
                        uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5856
                    }
5857

    
5858
                    Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY);
5859

    
5860
                    var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
5861

    
5862
                    ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5863
                    ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5864
                    ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5865

    
5866
                    if (defaultBitmapImage_Compare.IsDownloading)
5867
                    {
5868
                        defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
5869
                        {
5870
                            ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5871
                            ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5872
                            ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5873
                        };
5874
                    }
5875

    
5876

    
5877
                    zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
5878
                    zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
5879
                    zoomAndPanControl2.ApplyTemplate();
5880
                    zoomAndPanControl2.UpdateLayout();
5881

    
5882
                    if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY))
5883
                    {
5884
                        zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X;
5885
                        zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y;
5886
                    }
5887
                    //}
5888

    
5889
                    tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo);
5890
                    tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber);
5891
                    gridViewHistory_Busy.IsBusy = false;
5892
                }
5893
                Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1);
5894

    
5895
            };
5896
            Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1);
5897
            BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID);
5898
        }
5899

    
5900
        private void PdfLink_ButtonDown(object sender, MouseButtonEventArgs e)
5901
        {
5902
            if (sender is Image)
5903
            {
5904
                if ((sender as Image).Tag != null)
5905
                {
5906
                    var pdfUrl = (sender as Image).Tag.ToString();
5907
                    System.Diagnostics.Process.Start(pdfUrl);
5908
                }
5909
                else
5910
                {
5911
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("문서 정보가 잘못 되었습니다", "안내");
5912
                }
5913
            }
5914
        }
5915

    
5916
        private void Create_Symbol(object sender, RoutedEventArgs e)
5917
        {
5918
            MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn();
5919

    
5920
            if (SelectLayer.Children.Count < 1) //선택된 것이 없으면
5921
            {
5922
                DialogMessage_Alert("Please Select Controls", "Alert");
5923
            }
5924
            else //선택된 것이 있으면
5925
            {
5926
                string MarkupData = "";
5927
                adorner_ = new AdornerFinal();
5928

    
5929
                foreach (var item in SelectLayer.Children)
5930
                {
5931
                    if (item.GetType().Name == "AdornerFinal")
5932
                    {
5933
                        adorner_ = (item as Controls.AdornerFinal);
5934
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
5935
                        {
5936
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
5937
                            {
5938
                                markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
5939
                                MarkupData += markupReturn.ConvertData;
5940
                            }
5941
                        }
5942
                    }
5943
                }
5944
                DialogParameters parameters = new DialogParameters()
5945
                {
5946
                    Owner = Application.Current.MainWindow,
5947
                    Closed = (obj, args) => this.MarkupNamePromptClose(MarkupData, args),
5948
                    DefaultPromptResultValue = "Custom State",
5949
                    Content = "Name :",
5950
                    Header = "Insert Custom Symbol Name",
5951
                    Theme = new VisualStudio2013Theme(),
5952
                    ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
5953
                };
5954
                RadWindow.Prompt(parameters);
5955
            }
5956

    
5957
        }
5958
        public int symbolselectindex = 0;
5959
        private void SymbolMarkupNamePromptClose(byte[] Img_byte, string data, WindowClosedEventArgs args)
5960
        {
5961
            //Save save = new Save();
5962
            try
5963
            {
5964
                string svgfilename = null;
5965
                if (symbolname != null)
5966
                {
5967
                    if (symbolpng == true || symbolsvg == true)
5968
                    {
5969
                        kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
5970
                        string guid = Commons.shortGuid();
5971

    
5972
                        fileUploader.RunAsync(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".png", Img_byte);
5973
                        //Check_Uri.UriCheck();
5974
                        fileUploader.RunCompleted += (ex, arg) =>
5975
                        {
5976
                            filename = arg.Result;
5977
                            if (symbolpng == true)
5978
                            {
5979
                                if (filename != null)
5980
                                { 
5981
                                    if (symbolselectindex == 0)
5982
                                    {
5983
                                        SymbolSave(symbolname, filename, data);
5984
                                    }
5985
                                    else
5986
                                    {
5987
                                        SymbolSave_Public(symbolname, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
5988
                                    }
5989
                                    DataBind();
5990
                                }                                
5991
                            }
5992

    
5993
                            if (symbolsvg == true)
5994
                            {
5995
                                try
5996
                                {
5997
                                    var defaultBitmapImage = new BitmapImage();
5998
                                    defaultBitmapImage.BeginInit();
5999
                                    defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
6000
                                    defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
6001
                                    Check_Uri.UriCheck(filename);
6002
                                    defaultBitmapImage.UriSource = new Uri(filename);
6003
                                    defaultBitmapImage.EndInit();
6004

    
6005
                                    System.Drawing.Bitmap image;
6006

    
6007
                                    if (defaultBitmapImage.IsDownloading)
6008
                                    {
6009
                                        defaultBitmapImage.DownloadCompleted += (ex2, arg2) =>
6010
                                        {
6011
                                            defaultBitmapImage.Freeze();
6012
                                            image = GetBitmap(defaultBitmapImage);
6013
                                            image.Save(@AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
6014
                                            Process potrace = new Process
6015
                                            {
6016
                                                StartInfo = new ProcessStartInfo
6017
                                                {
6018
                                                    FileName = @AppDomain.CurrentDomain.BaseDirectory + "potrace.exe",
6019
                                                    Arguments = "-b svg " + @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp",
6020
                                                    RedirectStandardInput = true,
6021
                                                    RedirectStandardOutput = true,
6022
                                                    RedirectStandardError = true,
6023
                                                    UseShellExecute = false,
6024
                                                    CreateNoWindow = true,
6025
                                                    WindowStyle = ProcessWindowStyle.Hidden
6026
                                                },
6027
                                            };
6028

    
6029
                                            StringBuilder svgBuilder = new StringBuilder();
6030
                                            potrace.OutputDataReceived += (object sender2, DataReceivedEventArgs e2) =>
6031
                                            {
6032
                                                svgBuilder.AppendLine(e2.Data);
6033
                                            };
6034

    
6035
                                            potrace.EnableRaisingEvents = true;
6036
                                            potrace.Start();
6037
                                            potrace.Exited += (sender, e) =>
6038
                                            {
6039
                                                byte[] bytes = System.IO.File.ReadAllBytes(@AppDomain.CurrentDomain.BaseDirectory + "potrace.svg");
6040
                                                svgfilename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".svg", bytes);
6041
                                                Check_Uri.UriCheck(svgfilename);
6042
                                                if (symbolselectindex == 0)
6043
                                                {
6044
                                                    SymbolSave(symbolname, svgfilename, data);
6045
                                                }
6046
                                                else
6047
                                                {
6048
                                                    SymbolSave_Public(symbolname, svgfilename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
6049
                                                }
6050

    
6051
                                                DataBind();
6052
                                            };
6053
                                            potrace.WaitForExit();
6054
                                        };
6055
                                    }
6056
                                    else
6057
                                    {
6058
                                        //GC.Collect();
6059
                                    }
6060
                                }
6061
                                catch(Exception ee)
6062
                                {
6063
                                    DialogMessage_Alert("" + ee, "Alert");
6064
                                }
6065
                            }
6066
                        };                                             
6067
                    }
6068
                }
6069
            }
6070
            catch (Exception e)
6071
            {
6072
                //DialogMessage_Alert(e + "", "Alert");
6073
            }            
6074
        }
6075

    
6076
        public void SymbolSave(string Name, string Url, string Data)
6077
        {
6078
            try
6079
            {
6080
                SYMBOL_PRIVATE symbol_private = new SYMBOL_PRIVATE
6081
                {
6082
                    ID = Commons.shortGuid(),
6083
                    MEMBER_USER_ID = App.ViewInfo.UserID,
6084
                    NAME = Name,
6085
                    IMAGE_URL = Url,
6086
                    DATA = Data
6087
                };
6088

    
6089
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolCompleted += BaseClient_SaveSymbolCompleted;
6090
                Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1);
6091
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private);
6092
            }
6093
            catch (Exception)
6094
            {
6095
                throw;
6096
            }
6097
        }
6098

    
6099
        public void SymbolSave_Public(string Name, string Url, string Data, string Department)
6100
        {
6101
            try
6102
            {
6103
                SYMBOL_PUBLIC symbol_public = new SYMBOL_PUBLIC
6104
                {
6105
                    ID = Commons.shortGuid(),
6106
                    DEPARTMENT = Department,
6107
                    NAME = Name,
6108
                    IMAGE_URL = Url,
6109
                    DATA = Data
6110
                };
6111
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbolCompleted += BaseClient_AddPublicSymbolCompleted;
6112
                Logger.sendReqLog("AddPublicSymbol: ", symbol_public.ID + "," + symbol_public.DEPARTMENT + "," + symbol_public.NAME + "," + symbol_public.IMAGE_URL + "," + symbol_public.DATA, 1);
6113
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbol(symbol_public);
6114
            }
6115
            catch (Exception)
6116
            {
6117
                throw;
6118
            }
6119
        }
6120

    
6121
        private void BaseClient_AddPublicSymbolCompleted(object sender, ServiceDeepView.AddPublicSymbolCompletedEventArgs e)
6122
        {           
6123
            Logger.sendResLog("AddPublicSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
6124
            DataBind();
6125
        }
6126

    
6127
        private void BaseClient_SaveSymbolCompleted(object sender, ServiceDeepView.SaveSymbolCompletedEventArgs e)
6128
        {
6129
            Logger.sendResLog("RenameSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
6130
            DataBind();
6131
        }
6132
        private void DataBind()
6133
        {
6134
            try
6135
            {
6136
                Symbol_Custom Custom = new Symbol_Custom();
6137
                List<Symbol_Custom> Custom_List = new List<Symbol_Custom>();
6138
                ServiceDeepView.ServiceDeepViewClient client = new ServiceDeepView.ServiceDeepViewClient(App._binding, App._EndPoint);
6139
                var symbol_Private = client.GetSymbolList(App.ViewInfo.UserID);
6140
                foreach (var item in symbol_Private)
6141
                {
6142
                    Custom.Name = item.NAME;
6143
                    Custom.ImageUri = item.IMAGE_URL;
6144
                    Custom.ID = item.ID;
6145
                    Custom_List.Add(Custom);
6146
                    Custom = new Symbol_Custom();
6147
                }
6148
                symbolPanel_Instance.lstSymbolPrivate.ItemsSource = Custom_List;
6149
                
6150
                Custom = new Symbol_Custom();
6151
                Custom_List = new List<Symbol_Custom>();
6152

    
6153
                symbolPanel_Instance.deptlist.ItemsSource = client.GetPublicSymbolDeptList();
6154

    
6155
                List<SYMBOL_PUBLIC> symbol_Public;
6156

    
6157

    
6158
                if (symbolPanel_Instance.deptlist.SelectedValue != null)
6159
                {
6160
                    symbol_Public = client.GetPublicSymbolList(symbolPanel_Instance.deptlist.SelectedValue.ToString());
6161
                }
6162
                else
6163
                {
6164
                    symbol_Public = client.GetPublicSymbolList(null);
6165
                }
6166
                foreach (var item in symbol_Public)
6167
                {
6168
                    Custom.Name = item.NAME;
6169
                    Custom.ImageUri = item.IMAGE_URL;
6170
                    Custom.ID = item.ID;
6171
                    Custom_List.Add(Custom);
6172
                    Custom = new Symbol_Custom();
6173
                }
6174
                symbolPanel_Instance.lstSymbolPublic.ItemsSource = Custom_List;
6175
                client.Close();                
6176
            }
6177
            catch(Exception e)
6178
            {
6179
                //DialogMessage_Alert("DataBind", "Alert");
6180
            }
6181
            
6182
        }
6183
        private void MarkupNamePromptClose(string data, WindowClosedEventArgs args)
6184
        {
6185
            try
6186
            {
6187
                if (args.PromptResult != null)
6188
                {
6189
                    if (args.DialogResult.Value)
6190
                    {
6191
                        PngBitmapEncoder _Encoder = symImage(data);
6192

    
6193
                        System.IO.MemoryStream fs = new System.IO.MemoryStream();
6194
                        _Encoder.Save(fs);
6195
                        System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs);
6196

    
6197
                        byte[] Img_byte = fs.ToArray();
6198

    
6199
                        kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
6200
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Commons.shortGuid() + ".png", Img_byte);
6201
                        Check_Uri.UriCheck(filename);
6202
                        if (symbolPanel_Instance.RadTab.SelectedIndex == 0)
6203
                        {
6204
                            SaveCommand.Instance.SymbolSave(args.PromptResult, filename, data);
6205
                        }
6206
                        else
6207
                        {
6208
                            SaveCommand.Instance.SymbolSave_Public(args.PromptResult, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
6209
                        }
6210
                        DataBind();
6211
                    }
6212
                }
6213
            }
6214
            catch(Exception ex)
6215
            {
6216
                DialogMessage_Alert("" + ex, "Alert");
6217
            }
6218
        }
6219

    
6220
        public PngBitmapEncoder symImage(string data)
6221
        {
6222

    
6223
            Canvas _canvas = new Canvas();
6224
            _canvas.Background = Brushes.White;
6225
            _canvas.Width = adorner_.BorderSize.Width;
6226
            _canvas.Height = adorner_.BorderSize.Height;
6227
            MarkupParser.Parse(App.ViewInfo.ProjectNO, data, _canvas, "#FFFF0000", "");
6228

    
6229
            BitmapEncoder encoder = new PngBitmapEncoder();
6230

    
6231

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

    
6234
            DrawingVisual dv = new DrawingVisual();
6235

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

    
6239
            using (DrawingContext ctx = dv.RenderOpen())
6240
            {
6241
                VisualBrush vb = new VisualBrush(_canvas);
6242
                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)));
6243
            }
6244

    
6245
            try
6246
            {
6247
                renderBitmap.Render(dv);
6248

    
6249
                //GC.Collect();
6250
                GC.WaitForPendingFinalizers();
6251
                //GC.Collect();
6252
                // encode png data
6253
                PngBitmapEncoder pngEncoder = new PngBitmapEncoder();
6254
                // puch rendered bitmap into it
6255
                pngEncoder.Interlace = PngInterlaceOption.Off;
6256
                pngEncoder.Frames.Add(BitmapFrame.Create(renderBitmap));
6257
                return pngEncoder;
6258

    
6259
            }
6260
            catch //(Exception ex)
6261
            {
6262
                return null;
6263
            }
6264

    
6265
        }
6266

    
6267
        public void DialogMessage_Alert(string content, string header)
6268
        {
6269
            var box = new TextBlock();
6270
            box.MinWidth = 400;
6271
            box.FontSize = 11;
6272
            //box.FontSize = 12;
6273
            box.Text = content;
6274
            box.TextWrapping = System.Windows.TextWrapping.Wrap;
6275

    
6276
            DialogParameters parameters = new DialogParameters()
6277
            {
6278
                Owner = Application.Current.MainWindow,
6279
                Content = box,
6280
                Header = header,
6281
                Theme = new VisualStudio2013Theme(),
6282
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
6283
            };            
6284
            RadWindow.Alert(parameters);
6285
        }
6286

    
6287
        #region 캡쳐 기능
6288

    
6289
        public BitmapSource CutAreaToImage(int x, int y, int width, int height)
6290
        {
6291
            if (x < 0)
6292
            {
6293
                width += x;
6294
                x = 0;
6295
            }
6296
            if (y < 0)
6297
            {
6298
                height += y;
6299
                y = 0;
6300

    
6301
                width = (int)zoomAndPanCanvas.ActualWidth - x;
6302
            }
6303
            if (x + width > zoomAndPanCanvas.ActualWidth)
6304
            {
6305
                width = (int)zoomAndPanCanvas.ActualWidth - x;
6306
            }
6307
            if (y + height > zoomAndPanCanvas.ActualHeight)
6308
            {
6309
                height = (int)zoomAndPanCanvas.ActualHeight - y;
6310
            }
6311

    
6312
            byte[] pixels = CopyPixels(x, y, width, height);
6313

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

    
6316
            return BitmapSource.Create(width, height, 96, 96, PixelFormats.Pbgra32, null, pixels, stride);
6317
        }
6318

    
6319
        public byte[] CopyPixels(int x, int y, int width, int height)
6320
        {
6321
            byte[] pixels = new byte[width * height * 4];
6322
            int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8;
6323

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

    
6327
            return pixels;
6328
        }
6329

    
6330
        public RenderTargetBitmap ConverterBitmapImage(FrameworkElement element)
6331
        {
6332
            DrawingVisual drawingVisual = new DrawingVisual();
6333
            DrawingContext drawingContext = drawingVisual.RenderOpen();
6334

    
6335
            // 해당 객체의 그래픽요소로 사각형의 그림을 그립니다.
6336
            drawingContext.DrawRectangle(new VisualBrush(element), null,
6337
                new Rect(new Point(0, 0), new Point(element.ActualWidth, element.ActualHeight)));
6338
            drawingContext.Close();
6339

    
6340
            // 비트맵으로 변환합니다.
6341
            RenderTargetBitmap target =
6342
                new RenderTargetBitmap((int)element.ActualWidth, (int)element.ActualHeight,
6343
                96, 96, System.Windows.Media.PixelFormats.Pbgra32);
6344

    
6345
            target.Render(drawingVisual);
6346
            return target;
6347
        }
6348

    
6349
        System.Drawing.Bitmap GetBitmap(BitmapSource source)
6350
        {
6351
            System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(source.PixelWidth, source.PixelHeight, System.Drawing.Imaging.PixelFormat.Format32bppPArgb);
6352
            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);
6353
            source.CopyPixels(Int32Rect.Empty, data.Scan0, data.Height * data.Stride, data.Stride);
6354
            bmp.UnlockBits(data);
6355
            return bmp;
6356
        }
6357
        public string symbolname = null;
6358
        public bool symbolsvg = true;
6359
        public bool symbolpng = true;
6360

    
6361
        public void Save_Symbol_Capture(BitmapSource source, int x, int y, int width, int height)
6362
        {
6363
            System.Drawing.Bitmap image = GetBitmap(source);
6364
            //흰색 제거
6365
            //image.MakeTransparent(System.Drawing.Color.White);
6366

    
6367
            var imageStream = new System.IO.MemoryStream();
6368
            byte[] imageBytes = null;
6369
            using (imageStream)
6370
            {
6371
                image.Save(imageStream, System.Drawing.Imaging.ImageFormat.Png);
6372
                // test.Save(@"E:\test.png", System.Drawing.Imaging.ImageFormat.Png);
6373
                imageStream.Position = 0;
6374
                imageBytes = imageStream.ToArray();
6375
            }
6376

    
6377
            SymbolPrompt symbolPrompt = new SymbolPrompt();
6378

    
6379
            RadWindow CheckPop = new RadWindow();
6380
            //Alert check = new Alert(Msg);
6381

    
6382
            CheckPop = new RadWindow
6383
            {
6384
                MinWidth = 400,
6385
                MinHeight = 100,
6386
               // Closed = (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args),
6387
                Header = "Alert",
6388
                Content = symbolPrompt,
6389
                //DialogResult = 
6390
                ResizeMode = System.Windows.ResizeMode.NoResize,
6391
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
6392
                IsTopmost = true,
6393
            };
6394
            CheckPop.Closed += (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args);
6395
            StyleManager.SetTheme(CheckPop, new Office2013Theme());
6396
            CheckPop.ShowDialog();
6397

    
6398
            /*
6399
            DialogParameters parameters = new DialogParameters()
6400
            {
6401
                Owner = Application.Current.MainWindow,
6402
                Closed = (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args),
6403
                DefaultPromptResultValue = "Custom State",
6404
                Content = "Name :",
6405
                Header = "Insert Custom Symbol Name",
6406
                Theme = new VisualStudio2013Theme(),
6407
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
6408
            };            
6409
            RadWindow.Prompt(parameters);
6410
            */
6411
        }
6412

    
6413
        public void Save_Capture(BitmapSource source, int x, int y, int width, int height)
6414
        {
6415
            KCOM.Common.Converter.FileStreamToBase64 streamToBase64 = new Common.Converter.FileStreamToBase64();
6416
            KCOMDataModel.DataModel.CHECK_LIST check_;
6417
            string Result = streamToBase64.ImageToBase64(source);
6418
            KCOMDataModel.DataModel.CHECK_LIST Item = new KCOMDataModel.DataModel.CHECK_LIST();
6419
            string projectno = App.ViewInfo.ProjectNO;
6420
            string checklist_id = ViewerDataModel.Instance.CheckList_ID;
6421

    
6422
            Logger.sendReqLog("GetCheckList", projectno + "," + checklist_id, 1);
6423
            Item = this.BaseClient.GetCheckList(projectno, checklist_id);
6424
            if (Item != null)
6425
            {
6426
                Logger.sendResLog("GetCheckList", "TRUE", 1);
6427
            }
6428
            else
6429
            {
6430
                Logger.sendResLog("GetCheckList", "FALSE", 1);
6431
            }
6432

    
6433
            if (Item == null)
6434
            {
6435
                check_ = new KCOMDataModel.DataModel.CHECK_LIST
6436
                {
6437
                    ID = Commons.shortGuid(),
6438
                    USER_ID = App.ViewInfo.UserID,
6439
                    IMAGE_URL = Result,
6440
                    IMAGE_ANCHOR = x + "," + y + "," + width + "," + height,
6441
                    PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber,
6442
                    REVISION = ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision,
6443
                    DOCUMENT_ID = App.ViewInfo.DocumentItemID,
6444
                    PROJECT_NO = App.ViewInfo.ProjectNO,
6445
                    STATUS = "False",
6446
                    CREATE_TIME = DateTime.Now,
6447
                    UPDATE_TIME = DateTime.Now,
6448
                    DOCUMENT_NO = _DocItem.DOCUMENT_NO,
6449
                    STATUS_DESC_OPEN = "Vendor 반영 필요",
6450
                };
6451
                Logger.sendReqLog("AddCheckList", projectno + "," + check_, 1);
6452
                Logger.sendResLog("AddCheckList", this.BaseClient.AddCheckList(projectno, check_).ToString(), 1);
6453
                //this.BaseClient.AddCheckList(projectno, check_);
6454
            }
6455
            else
6456
            {
6457
                Item.IMAGE_URL = Result;
6458
                Item.IMAGE_ANCHOR = x + "," + y + "," + width + "," + height;
6459
                Item.PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber;
6460
                Logger.sendReqLog("SaveCheckList", projectno + "," + checklist_id + "," + Item, 1);
6461
                Logger.sendResLog("SaveCheckList", this.BaseClient.SaveCheckList(projectno, checklist_id, Item).ToString(), 1);
6462
                //this.BaseClient.SaveCheckList(projectno, checklist_id, Item);
6463
            }
6464

    
6465
        }
6466

    
6467
        public void Set_Capture()
6468
        {
6469
            double x = canvasDrawingMouseDownPoint.X;
6470
            double y = canvasDrawingMouseDownPoint.Y;
6471
            double width = dragCaptureBorder.Width;
6472
            double height = dragCaptureBorder.Height;
6473

    
6474
            if (width > 5 || height > 5)
6475
            {
6476
                canvasImage = ConverterBitmapImage(zoomAndPanCanvas);
6477
                BitmapSource source = CutAreaToImage((int)x, (int)y, (int)width, (int)height);
6478
                Save_Capture(source, (int)x, (int)y, (int)width, (int)height);
6479
            }
6480
        }
6481
        #endregion
6482

    
6483
        //MarkupInfoItem
6484
        public void CreateControl()
6485
        {
6486

    
6487
            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
6488
            {
6489
                ViewerDataModel.Instance.UndoDataList.Remove(i);
6490
            });
6491
            multi_Undo_Data.Markup = currentControl;
6492
            UndoData.Markup_List.Add(multi_Undo_Data);
6493

    
6494
            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
6495

    
6496
            //List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList();
6497
        }
6498

    
6499
        public Multi_Undo_data Control_Style(CommentUserInfo control)
6500
        {
6501
            multi_Undo_Data = new Multi_Undo_data();
6502

    
6503
            multi_Undo_Data.Markup = control;
6504

    
6505
            if ((control as IShapeControl) != null)
6506
            {
6507
                multi_Undo_Data.paint = (control as IShapeControl).Paint;
6508
            }
6509
            if ((control as IDashControl) != null)
6510
            {
6511
                multi_Undo_Data.DashSize = (control as IDashControl).DashSize;
6512
            }
6513
            if ((control as IPath) != null)
6514
            {
6515
                multi_Undo_Data.LineSize = (control as IPath).LineSize;
6516
            }
6517
            if ((control as UIElement) != null)
6518
            {
6519
                multi_Undo_Data.Opacity = (control as UIElement).Opacity;
6520
            }
6521

    
6522
            return multi_Undo_Data;
6523
        }
6524

    
6525
        public void Undo()
6526
        {
6527
            // if (ViewerDataModel.Instance.IsPressCtrl)
6528
            //   {
6529
            //      ViewerDataModel.Instance.IsPressCtrl = false;
6530
            //   }
6531
            Undo_data undo = new Undo_data();
6532
            AdornerFinal final;
6533
            ReleaseAdorner();
6534

    
6535
            undo = ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == false).ToList().OrderByDescending(order => order.EventTime).FirstOrDefault();
6536
            if (undo == null)
6537
                return;
6538

    
6539

    
6540

    
6541
            switch (undo.Event)
6542
            {
6543
                case (Event_Type.Create):
6544
                    {
6545
                        foreach (var item in undo.Markup_List)
6546
                        {
6547
                            ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup));
6548
                        }
6549
                    }
6550
                    break;
6551
                case (Event_Type.Delete):
6552
                    {
6553
                        foreach (var item in undo.Markup_List)
6554
                        {
6555
                            ViewerDataModel.Instance.MarkupControls_USER.Add(item.Markup);
6556
                        }
6557
                    }
6558
                    break;
6559
                case (Event_Type.Thumb):
6560
                    {
6561
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
6562

    
6563
                        foreach (var item in undo.Markup_List)
6564
                        {
6565
                            ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup));
6566

    
6567
                            if ((item.Markup as IViewBox) != null)
6568
                            {
6569
                                (item.Markup as IViewBox).Angle = item.Angle;
6570
                            }
6571
                            if ((item.Markup as TextControl) != null)
6572
                            {
6573
                                (item.Markup as TextControl).Angle = item.Angle;
6574
                                Canvas.SetLeft((item.Markup as TextControl), item.PointSet[0].X);
6575
                                Canvas.SetTop((item.Markup as TextControl), item.PointSet[0].Y);
6576
                            }
6577
                            else
6578
                            {
6579
                                (item.Markup as IPath).PointSet = item.PointSet;
6580
                                (item.Markup as IPath).updateControl();
6581
                            }
6582

    
6583
                            comment.Add(item.Markup);
6584
                        }
6585
                        final = new AdornerFinal(comment);
6586
                        SelectLayer.Children.Add(final);
6587
                        ReleaseAdorner();
6588
                    }
6589
                    break;
6590
                case (Event_Type.Select):
6591
                    {
6592
                        ReleaseAdorner();
6593
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
6594

    
6595
                        foreach (var item in undo.Markup_List)
6596
                        {
6597
                            ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup));
6598

    
6599
                            if ((item.Markup as IPath) != null)
6600
                            {
6601
                                (item.Markup as IPath).LineSize = item.LineSize;
6602
                            }
6603
                            if ((item.Markup as UIElement) != null)
6604
                            {
6605
                                (item.Markup as UIElement).Opacity = item.Opacity;
6606
                            }
6607
                            if ((item.Markup as IDashControl) != null)
6608
                            {
6609
                                (item.Markup as IDashControl).DashSize = item.DashSize;
6610
                            }
6611
                            if ((item.Markup as IShapeControl) != null)
6612
                            {
6613
                                (item.Markup as IShapeControl).Paint = item.paint;
6614
                            }
6615

    
6616
                            comment.Add(item.Markup);
6617
                        }
6618

    
6619
                        final = new AdornerFinal(comment);
6620
                        SelectLayer.Children.Add(final);
6621
                    }
6622
                    break;
6623
                case (Event_Type.Option):
6624
                    {
6625
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
6626

    
6627
                        foreach (var item in undo.Markup_List)
6628
                        {
6629
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup);
6630

    
6631
                            if (undo.LineSize != 0 && item.Markup as IPath != null)
6632
                            {
6633
                                (item.Markup as IPath).LineSize = undo.LineSize;
6634
                            }
6635
                            else if (undo.Opacity != 0 && item.Markup as UIElement != null)
6636
                            {
6637
                                (item.Markup as UIElement).Opacity = undo.Opacity;
6638
                            }
6639
                            else if (undo.DashSize != null && item.Markup as IDashControl != null)
6640
                            {
6641
                                (item.Markup as IDashControl).DashSize = undo.DashSize;
6642
                            }
6643
                            else if (undo.Interval != 0 && item.Markup as LineControl != null)
6644
                            {
6645
                                (item.Markup as LineControl).Interval = undo.Interval;
6646
                            }
6647
                            else if (item.Markup as IShapeControl != null)
6648
                            {
6649
                                (item.Markup as IShapeControl).Paint = undo.paint;
6650
                            }
6651
                            comment.Add(item.Markup);
6652
                        }
6653
                        final = new AdornerFinal(comment);
6654
                        SelectLayer.Children.Add(final);
6655
                    }
6656
                    break;
6657
            }
6658
            ViewerDataModel.Instance.UndoDataList.Where(data => data.EventTime == undo.EventTime).ToList().OrderByDescending(order => order.EventTime).ToList().ForEach(i =>
6659
            {
6660
                i.IsUndo = true;
6661
            });
6662
        }
6663

    
6664

    
6665

    
6666
        public void Redo()
6667
        {
6668
            //if (ViewerDataModel.Instance.IsPressCtrl)
6669
            //{
6670
            //    ViewerDataModel.Instance.IsPressCtrl = false;
6671
            //}
6672
            AdornerFinal final;
6673
            Undo_data redo = new Undo_data();
6674
            redo = ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().OrderBy(order => order.EventTime).FirstOrDefault();
6675
            ReleaseAdorner();
6676
            if (redo == null)
6677
                return;
6678

    
6679
            switch (redo.Event)
6680
            {
6681
                case (Event_Type.Create):
6682
                    {
6683
                        foreach (var item in redo.Markup_List)
6684
                        {
6685
                            ViewerDataModel.Instance.MarkupControls_USER.Add(item.Markup);
6686
                            //temp.AddTemp(redo, pageNavigator.CurrentPage.PageNumber, 0, 0);
6687
                        }
6688
                    }
6689
                    break;
6690
                case (Event_Type.Delete):
6691
                    {
6692
                        foreach (var item in redo.Markup_List)
6693
                        {
6694
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup);
6695
                        }
6696
                    }
6697
                    break;
6698
                case (Event_Type.Thumb):
6699
                    {
6700
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
6701

    
6702
                        foreach (var item in redo.Markup_List)
6703
                        {
6704
                            ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup as CommentUserInfo));
6705

    
6706
                            if ((item.Markup as IViewBox) != null)
6707
                            {
6708
                                (item.Markup as IViewBox).Angle = item.Angle;
6709
                            }
6710
                            if ((item.Markup as TextControl) != null)
6711
                            {
6712
                                (item.Markup as TextControl).Angle = item.Angle;
6713

    
6714
                                Canvas.SetLeft((item.Markup as TextControl), item.PointSet[0].X);
6715
                                Canvas.SetTop((item.Markup as TextControl), item.PointSet[0].Y);
6716
                            }
6717
                            else
6718
                            {
6719
                                (item.Markup as IPath).PointSet = item.PointSet;
6720
                                (item.Markup as IPath).updateControl();
6721
                            }
6722
                            comment.Add(item.Markup);
6723
                        }
6724
                        final = new AdornerFinal(comment);
6725
                        SelectLayer.Children.Add(final);
6726
                        ReleaseAdorner();
6727
                    }
6728
                    break;
6729
                case (Event_Type.Select):
6730
                    {
6731
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
6732

    
6733
                        foreach (var item in redo.Markup_List)
6734
                        {
6735
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup);
6736

    
6737
                            if ((item.Markup as IPath) != null)
6738
                            {
6739
                                (item.Markup as IPath).LineSize = item.LineSize;
6740
                            }
6741
                            if ((item.Markup as UIElement) != null)
6742
                            {
6743
                                (item.Markup as UIElement).Opacity = item.Opacity;
6744
                            }
6745
                            if ((item.Markup as IDashControl) != null)
6746
                            {
6747
                                (item.Markup as IDashControl).DashSize = item.DashSize;
6748
                            }
6749
                            if ((item.Markup as IShapeControl) != null)
6750
                            {
6751
                                (item.Markup as IShapeControl).Paint = item.paint;
6752
                            }
6753

    
6754
                            comment.Add(item.Markup);
6755
                        }
6756
                        final = new AdornerFinal(comment);
6757
                        SelectLayer.Children.Add(final);
6758
                    }
6759
                    break;
6760
                case (Event_Type.Option):
6761
                    {
6762
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
6763

    
6764
                        foreach (var item in redo.Markup_List)
6765
                        {
6766
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup);
6767
                            if (redo.LineSize != 0 && item.Markup as IPath != null)
6768
                            {
6769
                                (item.Markup as IPath).LineSize = redo.LineSize;
6770
                            }
6771
                            else if (redo.Opacity != 0 && item.Markup as UIElement != null)
6772
                            {
6773
                                (item.Markup as UIElement).Opacity = redo.Opacity;
6774
                            }
6775
                            else if (redo.DashSize != null && item.Markup as IDashControl != null)
6776
                            {
6777
                                (item.Markup as IDashControl).DashSize = redo.DashSize;
6778
                            }
6779
                            else if (redo.Interval != 0 && item.Markup as LineControl != null)
6780
                            {
6781
                                (item.Markup as LineControl).Interval = redo.Interval;
6782
                            }
6783
                            else if (item.Markup as IShapeControl != null)
6784
                            {
6785
                                (item.Markup as IShapeControl).Paint = redo.paint;
6786
                            }
6787
                            comment.Add(item.Markup);
6788
                        }
6789
                        final = new AdornerFinal(comment);
6790
                        SelectLayer.Children.Add(final);
6791
                    }
6792
                    break;
6793
            }
6794

    
6795
            ViewerDataModel.Instance.UndoDataList.Where(data => data.EventTime == redo.EventTime).ToList().OrderByDescending(order => order.EventTime).ToList().ForEach(i =>
6796
            {
6797
                i.IsUndo = false;
6798
            });
6799
        }
6800

    
6801
        private void Comment_Move(object sender, MouseButtonEventArgs e)
6802
        {
6803
            string Select_ID = (((e.Source as Telerik.Windows.Controls.RadButton).DataContext) as IKCOM.MarkupInfoItem).UserID;
6804
            foreach (var items in ViewerDataModel.Instance._markupInfoRevList)
6805
            {
6806
                if (items.UserID == Select_ID)
6807
                {
6808
                    foreach (var item in items.MarkupList)
6809
                    {
6810
                        if (item.PageNumber == pageNavigator.CurrentPage.PageNumber)
6811
                        {
6812
                            MarkupParser.ParseEx(App.ViewInfo.ProjectNO, item.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, "#FFFF0000", "", 
6813
                                items.MarkupInfoID, Commons.shortGuid());
6814
                        }
6815
                    }
6816
                }
6817
            }
6818
        }
6819
        public void EmptyControlCheck()
6820
        {
6821
            for (var j = 0; j < (Common.ViewerDataModel.Instance.MarkupControls_USER).Count; j++)
6822
            {
6823
                if (((Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).GetType().Name == "TextControl")
6824
                {
6825
                    if (((MarkupToPDF.Controls.Text.TextControl)(Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).Text == null
6826
                    || ((MarkupToPDF.Controls.Text.TextControl)(Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).Text == "")
6827
                    {
6828
                        Common.ViewerDataModel.Instance.MarkupControls_USER.RemoveAt(j);
6829
                    }
6830
                }
6831
                else if (((Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).GetType().Name == "ArrowTextControl")
6832
                {
6833
                    if (((MarkupToPDF.Controls.Text.ArrowTextControl)(Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).Base_TextBox.Text == null
6834
                    || ((MarkupToPDF.Controls.Text.ArrowTextControl)(Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).Base_TextBox.Text == "")
6835
                    {
6836
                        Common.ViewerDataModel.Instance.MarkupControls_USER.RemoveAt(j);
6837
                    }
6838
                }
6839
            }
6840
        }
6841
        public void InkControl_Convert()
6842
        {
6843
            Logger.sendCheckLog("pageNavigator_PageChanging_InkControl_Convert", 1);
6844
            if (inkBoard.Strokes.Count > 0)
6845
            {
6846
                inkBoard.Strokes.ToList().ForEach(stroke =>
6847
                {
6848
                    List<Stroke> removingStroke = new List<Stroke>();
6849
                    StrokeCollection stC = new StrokeCollection();
6850

    
6851
                    removingStroke.Add(stroke);
6852

    
6853
                    InkToPath ip = new InkToPath();
6854
                    List<Point> inkPointSet = new List<Point>();
6855
                    PolygonControl pc = null;
6856
                    pc = new PolygonControl()
6857
                    {
6858
                        Angle = 0,
6859
                        PointSet = new List<Point>(),
6860
                        ControlType = ControlType.Ink
6861
                    };
6862
                    foreach (var item in removingStroke)
6863
                    {
6864
                        inkPointSet.AddRange(ip.StrokeGetPointsPlus(item));
6865
                        inkBoard.Strokes.Remove(item);
6866
                    }
6867
                    if (inkPointSet.Count != 0)
6868
                    {
6869
                        //강인구 추가(PenControl Undo Redo 추가)
6870
                        UndoData = new Undo_data()
6871
                        {
6872
                            IsUndo = false,
6873
                            Event = Event_Type.Create,
6874
                            EventTime = DateTime.Now,
6875
                            Markup_List = new List<Multi_Undo_data>()
6876
                        };
6877

    
6878
                        pc.StartPoint = inkPointSet[0];
6879
                        pc.EndPoint = inkPointSet[inkPointSet.Count - 1];
6880
                        pc.PointSet = inkPointSet;
6881
                        pc.LineSize = 3;
6882
                        pc.CommentID = Commons.shortGuid();
6883
                        pc.StrokeColor = new SolidColorBrush(Colors.Red);
6884
                        ViewerDataModel.Instance.MarkupControls_USER.Add(pc);
6885
                        ///pc.SetPolyPath();
6886

    
6887
                        ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
6888
                        {
6889
                            ViewerDataModel.Instance.UndoDataList.Remove(i);
6890
                        });
6891
                        multi_Undo_Data.Markup = pc as CommentUserInfo;
6892
                        UndoData.Markup_List.Add(multi_Undo_Data);
6893
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);
6894
                    }
6895
                });
6896
            }
6897
        }
6898

    
6899
        /// <summary>
6900
        /// 정원, 정사각형, 정삼각형을 그리기 위한 EndPoint계산
6901
        /// </summary>
6902
        /// <param name="StartP">StartPoint</param>
6903
        /// <param name="EndP">EndPoint</param>
6904
        /// <returns>Return_EndPoint</returns>
6905
        private Point GetSquareEndPoint(Point StartP, Point EndP)
6906
        {
6907
            Point Return_Point = new Point();
6908

    
6909
            double dx = EndP.X - StartP.X;
6910
            double dy = EndP.Y - StartP.Y;
6911
            double length;
6912

    
6913
            switch (controlType)
6914
            {
6915
                case ControlType.Triangle:
6916
                    {
6917
                        //삼각형의 StartPoint기준으로 반지름 만큼 증가하기 때문에 곱하기2 필요
6918
                        length = Math.Max(Math.Abs(dx) * 2, Math.Abs(dy));
6919
                        Return_Point = (dy < 0) ? new Point(StartP.X + length / 2, StartP.Y - length) : new Point(StartP.X + length / 2, StartP.Y + length);
6920
                    }
6921
                    break;
6922
                default:
6923
                    {
6924
                        length = Math.Max(Math.Abs(dx), Math.Abs(dy));
6925
                        Return_Point.X = (dx > 0) ? StartP.X + length : StartP.X - length;
6926
                        Return_Point.Y = (dy > 0) ? StartP.Y + length : StartP.Y - length;
6927
                    }
6928
                    break;
6929
            }
6930

    
6931
            return Return_Point;
6932
        }
6933

    
6934
        /// <summary>
6935
        /// 정삼각형을 그리기위한 두 포인트를 계산하여 넘겨줌
6936
        /// </summary>
6937
        /// <author>humkyung</author>
6938
        /// <date>2018.04.26</date>
6939
        /// <param name="StartP"></param>
6940
        /// <param name="EndP"></param>
6941
        /// <returns></returns>
6942
        /// <history>humkyung 2018.05.11 apply axis lock</history>
6943
        private List<Point> GetRegularTrianglePoints(Point StartP, Point EndP, bool bCheckAxis = false)
6944
        {
6945
            List<Point> res = new List<Point>();
6946

    
6947
            double dx = EndP.X - StartP.X;
6948
            double dy = EndP.Y - StartP.Y;
6949
            double length = Math.Sqrt(dx * dx + dy * dy);
6950
            double baseLength = length * Math.Tan(30.0 * Math.PI / 180.0);
6951
            dx /= length;
6952
            dy /= length;
6953
            double tmp = dx;
6954
            dx = -dy; dy = tmp; /// rotate by 90 degree
6955

    
6956
            res.Add(new Point(EndP.X + dx * baseLength, EndP.Y + dy * baseLength));
6957
            res.Add(new Point(EndP.X - dx * baseLength, EndP.Y - dy * baseLength));
6958

    
6959
            return res;
6960
        }
6961

    
6962
        /// <summary>
6963
        /// 캔버스에 그릴때 모든 포인트가 캔버스를 벗어 났는지 체크하여 넘겨줌
6964
        /// </summary>
6965
        /// <author>ingu</author>
6966
        /// <date>2018.06.05</date>
6967
        /// <param name="getPoint"></param>
6968
        /// <returns></returns>
6969
        private bool IsGetoutpoint(Point getPoint)
6970
        {
6971
            if (getPoint == new Point())
6972
            {
6973
                ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl);
6974
                currentControl = null;
6975
                return true;
6976
            }
6977

    
6978
            return false;
6979
        }
6980

    
6981
        private void zoomAndPanControl_DragOver(object sender, DragEventArgs e)
6982
        {
6983
            e.Effects = DragDropEffects.Copy;
6984
        }
6985

    
6986
        private void zoomAndPanControl_DragEnter(object sender, DragEventArgs e)
6987
        {
6988
            e.Effects = DragDropEffects.Copy;
6989
        }
6990

    
6991
        private void zoomAndPanControl_DragLeave(object sender, DragEventArgs e)
6992
        {
6993
            e.Effects = DragDropEffects.None;
6994
        }
6995

    
6996
        private void zoomAndPanControl_Drop(object sender, DragEventArgs e)
6997
        {
6998
            try
6999
            {
7000
                if (e.Data.GetDataPresent(typeof(string)))
7001
                {
7002
                    this.getCurrentPoint = e.GetPosition(drawingRotateCanvas);
7003
                    string dragData = e.Data.GetData(typeof(string)) as string;
7004
                    Move_Symbol(sender, dragData);
7005
                }
7006
            }
7007
            catch (Exception ex)
7008
            {
7009
                Logger.sendResLog("zoomAndPanControl_Drop", ex.ToString(), 0);
7010
            }            
7011
        }
7012

    
7013
        private void Move_Symbol(object sender, string dragData)
7014
        {
7015
            try
7016
            {
7017
                if (dragData.Contains("|DZ|"))
7018
                {
7019
                    List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
7020

    
7021
                    string[] delimiterChars = { "|DZ|" };
7022
                    string[] data = dragData.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
7023

    
7024
                    this.ParentOfType<MainWindow>().dzMainMenu.ReleaseAdorner();
7025

    
7026
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
7027

    
7028
                    //강인구 Undo/Redo 보류
7029
                    UndoData = new Undo_data()
7030
                    {
7031
                        IsUndo = false,
7032
                        Event = Event_Type.Create,
7033
                        EventTime = DateTime.Now,
7034
                        Markup_List = new List<Multi_Undo_data>()
7035
                    };
7036

    
7037
                    ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
7038
                    {
7039
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
7040
                    });
7041

    
7042
                    foreach (string parse in data)
7043
                    {
7044
                        if (parse != "")
7045
                        {
7046
                            System.Windows.Controls.Control item = MarkupParser.ParseEx(App.ViewInfo.ProjectNO, parse, ViewerDataModel.Instance.MarkupControls_USER, string.Empty, string.Empty);
7047
                            (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.shortGuid();
7048

    
7049
                            ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
7050
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
7051

    
7052
                            adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
7053

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

    
7056
                            UndoData.Markup_List.Add(multi_Undo_Data);
7057
                            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
7058
                        }
7059
                    }
7060
                    Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
7061

    
7062
                    /// move symbol to current mouse point
7063
                    double realPointX = this.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
7064
                    double realPointY = this.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
7065
                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
7066

    
7067
                    if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
7068
                    {
7069
                        final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
7070
                    }
7071
                    /// up to here
7072

    
7073
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Add(final);
7074
                }
7075
            }
7076
            catch (Exception ex)
7077
            {
7078
                Logger.sendResLog("Move_Symbol", ex.ToString(), 0);
7079
            }            
7080
        }        
7081
    }
7082
}
클립보드 이미지 추가 (최대 크기: 500 MB)