프로젝트

일반

사용자정보

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

markus / KCOM / Views / MainMenu.xaml.cs @ 0f065e57

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

1 787a4489 KangIngu

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 670a4be2 humkyung
using KCOMDataModel.DataModel;
31 d7548b21 ljiyeon
using System.Xml;
32 6707a5c7 ljiyeon
using static KCOM.TempFile;
33
using System.Windows.Threading;
34
using System.Diagnostics;
35
using System.Threading;
36 787a4489 KangIngu
37
namespace KCOM.Views
38
{
39
    public static class ControlExtensions
40
    {
41
        public static T Clone<T>(this T controlToClone)
42
            where T : System.Windows.Controls.Control
43
        {
44
            System.Reflection.PropertyInfo[] controlProperties = typeof(T).GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance);
45
46
            T instance = Activator.CreateInstance<T>();
47
48
            foreach (PropertyInfo propInfo in controlProperties)
49
            {
50
                if (propInfo.CanWrite)
51
                {
52
                    if (propInfo.Name != "WindowTarget")
53
                        propInfo.SetValue(instance, propInfo.GetValue(controlToClone, null), null);
54
                }
55
            }
56
            return instance;
57
        }
58
    }
59
60 a0bab669 KangIngu
    public class MyConsole
61
    {
62
        private readonly System.Threading.ManualResetEvent _readLineSignal;
63
        private string _lastLine;
64
        public MyConsole()
65
        {
66
            _readLineSignal = new System.Threading.ManualResetEvent(false);
67
            Gui = new TextBox();
68
            Gui.AcceptsReturn = true;
69
            Gui.KeyUp += OnKeyUp;
70
        }
71
72
        private void OnKeyUp(object sender, KeyEventArgs e)
73
        {
74
            // this is always fired on UI thread
75
            if (e.Key == Key.Enter)
76
            {
77
                // quick and dirty, but that is not relevant to your question
78
                _lastLine = Gui.Text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries).Last();
79
                // now, when you detected that user typed a line, set signal
80
                _readLineSignal.Set();
81
            }
82
        }
83
84
        public TextBox Gui { get; private set; }
85
86
        public string ReadLine()
87
        {
88
            // that should always be called from non-ui thread
89
            if (Gui.Dispatcher.CheckAccess())
90
                throw new Exception("Cannot be called on UI thread");
91
            // reset signal
92
            _readLineSignal.Reset();
93
            // wait until signal is set. This call is blocking, but since we are on non-ui thread - there is no problem with that
94
            _readLineSignal.WaitOne();
95
            // we got signalled - return line user typed.
96
            return _lastLine;
97
        }
98
99
        public void WriteLine(string line)
100
        {
101
            if (!Gui.Dispatcher.CheckAccess())
102
            {
103
                Gui.Dispatcher.Invoke(new Action(() => WriteLine(line)));
104
                return;
105
            }
106
107
            Gui.Text += line + Environment.NewLine;
108
        }
109
    }
110
111 787a4489 KangIngu
    /// <summary>
112
    /// MainMenu.xaml에 대한 상호 작용 논리
113
    /// </summary>
114
    public partial class MainMenu : UserControl
115
    {
116
        #region 프로퍼티
117
        public Undo_data UndoData { get; set; }
118
        public CommentUserInfo currentControl { get; set; }
119
        public ControlType controlType { get; set; }
120
        private Move move;
121
        private double[] rotateValue = { 0, 90, 180, 270 };
122
        public MouseHandlingMode mouseHandlingMode = MouseHandlingMode.None;
123
        public MouseButton mouseButtonDown { get; set; }
124
        private static readonly double DragThreshold = 5;
125 eb2b9248 KangIngu
        private System.Windows.Input.Cursor cursor { get; set; }
126 787a4489 KangIngu
        private Point canvasDrawingMouseDownPoint;
127
        public string filename { get; set; }
128
        private Point canvasZoomPanningMouseDownPoint;
129
        public Point getCurrentPoint;
130
        private Point canvasZoommovingMouseDownPoint;
131
        List<object> ControlList = new List<object>();
132
        private ListBox listBox = new ListBox();
133
        private Dictionary<Geometry, string> selected_item = new Dictionary<Geometry, string>();
134
        private bool isDraggingSelectionRect = false;
135
        DrawingAttributes inkDA = new DrawingAttributes();
136
        private VPRevision CurrentRev { get; set; }
137
        public RadRibbonButton btnConsolidate { get; set; }
138
        public RadRibbonButton btnFinalPDF { get; set; }
139
        public RadRibbonButton btnTeamConsolidate { get; set; }
140
        public string Filename_ { get; set; }
141
        public double L_Size = 0;
142
        public AdornerFinal adorner_;
143
        public Multi_Undo_data multi_Undo_Data;
144 5ce56a3a KangIngu
        public string Symbol_ID = "";
145 787a4489 KangIngu
        /// <summary>
146
        /// Set to 'true' when the left mouse-button is down.
147
        /// </summary>
148 9f473fb7 KangIngu
        public bool isLeftMouseButtonDownOnWindow = false;
149 787a4489 KangIngu
150
        public InkPresenter _InkBoard = null;
151
        Stroke stroke;
152
        Boolean IsDrawing = false;
153
        StylusPointCollection strokePoints;
154
        StylusPointCollection erasePoints;
155
        RenderTargetBitmap canvasImage;
156
        Point Sync_Offset_Point;
157
158
        //강인구 테스트
159
        private Path _SelectionPath { get; set; }
160
        public Path SelectionPath
161
        {
162
            get
163
            {
164
                return _SelectionPath;
165
            }
166
            set
167
            {
168
                if (_SelectionPath != value)
169
                {
170
                    _SelectionPath = value;
171
                    RaisePropertyChanged("SelectionPath");
172
173
                }
174
            }
175
        }
176
177
        private System.Windows.Controls.Image _imageViewer { get; set; }
178
        public System.Windows.Controls.Image imageViewer
179
        {
180
            get
181
            {
182
                if (_imageViewer == null)
183
                {
184
                    _imageViewer = new System.Windows.Controls.Image();
185
                    return _imageViewer;
186
                }
187
                else
188
                {
189
                    return _imageViewer;
190
                }
191
            }
192
            set
193
            {
194
                if (_imageViewer != value)
195
                {
196
                    _imageViewer = value;
197
                }
198
            }
199
        }
200
201
        public bool IsSyncPDFMode { get; set; }
202
203
        private System.Windows.Controls.Image _imageViewer_Compare { get; set; }
204
        public System.Windows.Controls.Image imageViewer_Compare
205
        {
206
            get
207
            {
208
                if (_imageViewer_Compare == null)
209
                {
210
                    _imageViewer_Compare = new System.Windows.Controls.Image();
211
                    return _imageViewer_Compare;
212
                }
213
                else
214
                {
215
                    return _imageViewer_Compare;
216
                }
217
            }
218
            set
219
            {
220
                if (_imageViewer_Compare != value)
221
                {
222
                    _imageViewer_Compare = value;
223
                }
224
            }
225
        }
226
227
        #endregion
228 6707a5c7 ljiyeon
                
229 787a4489 KangIngu
        public MainMenu()
230
        {
231 e0204db0 djkim
            //InitializeComponent();    
232 0c997b99 ljiyeon
            this.Loaded += MainMenu_Loaded;
233 787a4489 KangIngu
        }
234 6707a5c7 ljiyeon
235
        public class TempDt
236
        {
237
            public int PageNumber { get; set; }
238
            public string CommentID { get; set; }
239
            public string ConvertData { get; set; }
240
            public int DATA_TYPE { get; set; }
241
            public string MarkupInfoID { get; set; }
242
            public int IsUpdate { get; set; }
243
        }
244
245
        List<TempDt> tempDtList = new List<TempDt>();
246
            
247 787a4489 KangIngu
        private void SetCursor()
248
        {
249
            this.Cursor = cursor;
250
        }
251
252
        private bool IsDrawingEnable(Point _canvasZoomPanningMouseDownPoint)
253
        {
254
            if ((_canvasZoomPanningMouseDownPoint.X > 0 &&
255 ca40e004 ljiyeon
                zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.X) &&
256
                (_canvasZoomPanningMouseDownPoint.Y > 0 &&
257
                zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.Y))
258 787a4489 KangIngu
            {
259
                return true;
260
            }
261
262
            return false;
263
        }
264
265 ca40e004 ljiyeon
        private bool IsRotationDrawingEnable(Point _canvasZoomPanningMouseDownPoint)
266
        {
267
            if (rotate.Angle == 90 || rotate.Angle == 270)
268
            {
269
                if ((_canvasZoomPanningMouseDownPoint.X > 0 &&
270
                zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.X) &&
271
                (_canvasZoomPanningMouseDownPoint.Y > 0 &&
272
                zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.Y))
273
                {
274
                    return true;
275
                }
276
            }
277
            else
278
            {
279
                if ((_canvasZoomPanningMouseDownPoint.X > 0 &&
280
                zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.X) &&
281
                (_canvasZoomPanningMouseDownPoint.Y > 0 &&
282
                zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.Y))
283
                {
284
                    return true;
285
                }
286
            }               
287
288
            return false;
289
        }
290
291 d7548b21 ljiyeon
       
292 787a4489 KangIngu
        public void DeleteItem(MarkupInfoItem item)
293
        {
294
            if (PreviewUserMarkupInfoItem != null && item.Consolidate == 1 && item.AvoidConsolidate == 0)
295
            {
296
                App.Custom_ViewInfoId = PreviewUserMarkupInfoItem.MarkupInfoID;
297
            }
298
299
            ViewerDataModel.Instance._markupInfoList.Remove(item);
300
301
            ViewerDataModel.Instance.MarkupControls.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a =>
302
            {
303
                ViewerDataModel.Instance.MarkupControls.Remove(a);
304
            });
305
306
            ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a =>
307
            {
308
                ViewerDataModel.Instance.MarkupControls_USER.Remove(a);
309
            });
310
311
            ViewerDataModel.Instance.MarkupList_USER.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a =>
312
            {
313
                ComingNewBieEnd = false;
314
                ViewerDataModel.Instance.MarkupList_USER.Remove(a);
315 6707a5c7 ljiyeon
                //임시파일에서도 삭제
316
                for (int i = 0; i < item.MarkupList.Count; i++)
317
                {
318
                    temp.DelTemp(item.MarkupList[i].ID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString());                    
319
                }
320 787a4489 KangIngu
            });
321
322
            gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
323
            if (PreviewUserMarkupInfoItem == null && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null)
324
            {
325
                if (gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList().Where(d => d.UserID == App.ViewInfo.UserID).Count() == 0)
326
                {
327
                    var infoId = Events.Save.shortGuid();
328
                    PreviewUserMarkupInfoItem = new MarkupInfoItem
329
                    {
330
                        CreateTime = DateTime.Now,
331
                        Depatment = userData.DEPARTMENT,
332 992a98b4 KangIngu
                        UpdateTime = DateTime.Now,
333 787a4489 KangIngu
                        DisplayColor = "#FFFF0000",
334
                        UserID = userData.ID,
335
                        UserName = userData.NAME,
336
                        PageCount = 1,
337
                        Description = "",
338
                        MarkupInfoID = infoId,
339
                        MarkupList = null,
340
                        MarkupVersionID = Events.Save.shortGuid(),
341
                        Consolidate = 0,
342
                        PartConsolidate = 0,
343
                        userDelete = true,
344
                        AvoidConsolidate = 0,
345
                        IsPreviewUser = true
346
                    };
347
                    App.Custom_ViewInfoId = infoId;
348
                }
349
            }
350 0f065e57 ljiyeon
            Logger.sendReqLog("DeleteMarkupAsync", App.ViewInfo.ProjectNO + "," + item.MarkupInfoID, 1);
351 787a4489 KangIngu
            BaseClient.DeleteMarkupAsync(App.ViewInfo.ProjectNO, item.MarkupInfoID);
352
        }
353
354
        public void DeleteCommentEvent(object sender, RoutedEventArgs e)
355
        {
356
            //선택된 어도너가 있을시 삭제가 되지 않음(강인구 추가)
357
            this.ReleaseAdorner();
358
359
            Button content = (sender as Button);
360
            MarkupInfoItem item = content.CommandParameter as MarkupInfoItem;
361
362
            DeleteItem(item);
363
        }
364
365
        System.Windows.Media.Animation.DoubleAnimation da = new System.Windows.Media.Animation.DoubleAnimation();
366
367 6707a5c7 ljiyeon
        private static Timer timer;
368
        private int InitInterval = KCOM.Properties.Settings.Default.InitInterval;
369 787a4489 KangIngu
        private void MainMenu_Loaded(object sender, RoutedEventArgs e)
370 0c997b99 ljiyeon
        {                      
371
            ////측정
372
            //Stopwatch sw = new Stopwatch();
373
            //sw.Start();
374 e0204db0 djkim
                InitializeComponent();
375 0c997b99 ljiyeon
            //System.Diagnostics.Debug.WriteLine("MainMenu() : " + sw.ElapsedMilliseconds.ToString() + "ms");
376
            
377 787a4489 KangIngu
            if (App.ParameterMode)
378 6707a5c7 ljiyeon
            {
379
                this.pageNavigator.PageChanging += pageNavigator_PageChanging;
380
                imageViewer_Compare = new Image();
381
                layerControl.ProjectNo = App.ViewInfo.ProjectNO;
382
                ViewerDataModel.Instance.Capture_Opacity = 0;
383
                da.From = 0.8;
384
                da.To = 0;
385
                da.Duration = new Duration(TimeSpan.FromSeconds(1));
386
                da.AutoReverse = true;
387 e0204db0 djkim
                da.RepeatBehavior = System.Windows.Media.Animation.RepeatBehavior.Forever;
388
389
                if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission)
390
                {                    
391
                    this.SymbolPane.Visibility = Visibility.Collapsed;
392
                    this.FavoritePane.Visibility = Visibility.Collapsed;
393
                    this.drawingRotateCanvas.IsHitTestVisible = false;
394
                }
395 6707a5c7 ljiyeon
            }
396
            timer = new Timer(timercallback, null, 0, InitInterval * 60000); 
397 ccf944bb ljiyeon
        }
398
399 6707a5c7 ljiyeon
        private void timercallback(Object o)
400 ccf944bb ljiyeon
        {
401 6707a5c7 ljiyeon
            Stopwatch sw = new Stopwatch();
402
            sw.Start();
403
            TempFileAdd();
404
            sw.Stop();
405 ccf944bb ljiyeon
406 6707a5c7 ljiyeon
            Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
407 ccf944bb ljiyeon
            {
408 6707a5c7 ljiyeon
               if (this.ParentOfType<MainWindow>().dzTopMenu.cbAutoSave.IsChecked == true) //Auto Save Checked?
409
                {
410
                    timer.Change(((int)this.ParentOfType<MainWindow>().dzTopMenu.cbSaveInterval.Value * 60000) / 2, sw.ElapsedMilliseconds); //Timer Setting
411
                }
412
            }));
413 ccf944bb ljiyeon
414 6707a5c7 ljiyeon
            GC.Collect();
415
        }
416 ccf944bb ljiyeon
417 6707a5c7 ljiyeon
        void TempFileAdd()
418 44c5e27e ljiyeon
        {
419 6707a5c7 ljiyeon
            Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
420 ccf944bb ljiyeon
            {
421 44c5e27e ljiyeon
                if (ViewerDataModel.Instance.UndoDataList.Count > 0)
422 ccf944bb ljiyeon
                {
423 44c5e27e ljiyeon
                    DateTime undoTime = ViewerDataModel.Instance.UndoDataList.OrderByDescending(order => order.EventTime).FirstOrDefault().EventTime;
424
                    DateTime updatetime = DateTime.Now.AddDays(-1);
425
                    if (ViewerDataModel.Instance._markupInfoList.Count > 0)
426
                    {
427
                        updatetime = ViewerDataModel.Instance._markupInfoList.OrderByDescending(order => order.UpdateTime).FirstOrDefault().UpdateTime;
428
                    }
429 ccf944bb ljiyeon
430 6707a5c7 ljiyeon
                    EmptyControlCheck();
431 ccf944bb ljiyeon
432 6707a5c7 ljiyeon
                    if (undoTime > updatetime)
433 ccf944bb ljiyeon
                    {
434 6707a5c7 ljiyeon
                        if (ViewerDataModel.Instance.MarkupControls_USER.Count > 0)
435 ccf944bb ljiyeon
                        {
436 6707a5c7 ljiyeon
                            foreach (var control in ViewerDataModel.Instance.MarkupControls_USER)
437
                            {
438
                                var root = layerControl.MarkupToString(control, App.ViewInfo.UserID);
439 44c5e27e ljiyeon
440 6707a5c7 ljiyeon
                                var existItem = ViewerDataModel.Instance.MarkupList_USER.Where(data => data.ID == root.CommentID).FirstOrDefault();
441
                                if (existItem != null)
442
                                {
443 44c5e27e ljiyeon
                                    if (existItem.Data != root.ConvertData)
444 6707a5c7 ljiyeon
                                    {
445
                                        tempDtList.Add(new TempDt()
446
                                        {
447
                                            CommentID = control.CommentID,
448
                                            ConvertData = root.ConvertData,
449
                                            DATA_TYPE = root.DATA_TYPE,
450
                                            MarkupInfoID = App.Custom_ViewInfoId,
451
                                            PageNumber = this.pageNavigator.CurrentPage.PageNumber,
452
                                            IsUpdate = 1
453
                                        });
454
                                    }
455
                                }
456
                                else //신규 추가 된 코멘트
457
                                {
458
                                    if (root.CommentID != null)
459
                                    {
460
                                        var currentCommentCheck = ViewerDataModel.Instance.MarkupList_USER.Where(dt => dt.ID == control.CommentID).FirstOrDefault();
461
                                        if (currentCommentCheck != null)
462
                                        {
463
                                            tempDtList.Add(new TempDt()
464
                                            {
465
                                                CommentID = control.CommentID,
466
                                                ConvertData = root.ConvertData,
467
                                                DATA_TYPE = root.DATA_TYPE,
468
                                                MarkupInfoID = App.Custom_ViewInfoId,
469
                                                PageNumber = this.pageNavigator.CurrentPage.PageNumber,
470
                                                IsUpdate = 1
471
                                            });
472
                                        }
473
                                        else
474
                                        {
475
                                            tempDtList.Add(new TempDt()
476
                                            {
477
                                                CommentID = control.CommentID,
478
                                                ConvertData = root.ConvertData,
479
                                                DATA_TYPE = root.DATA_TYPE,
480
                                                MarkupInfoID = App.Custom_ViewInfoId,
481
                                                PageNumber = this.pageNavigator.CurrentPage.PageNumber,
482
                                                IsUpdate = 0
483
                                            });
484
                                        }
485
                                    }
486
                                }
487 44c5e27e ljiyeon
                            }
488 6707a5c7 ljiyeon
                        }
489 ccf944bb ljiyeon
490 6707a5c7 ljiyeon
                        temp.WriteTemp(tempDtList);
491
                        tempDtList.Clear();
492 ccf944bb ljiyeon
                    }
493
                }
494 6707a5c7 ljiyeon
            }));
495 ccf944bb ljiyeon
496 6707a5c7 ljiyeon
        }
497 ccf944bb ljiyeon
498
499 6707a5c7 ljiyeon
        public class TempLoadData
500
        {
501
            public int PageNumber { get; set; }
502
            public string CommentID { get; set; }
503
            public string ConvertData { get; set; }
504
            public string DATA_TYPE { get; set; }
505
            public string MarkupInfoID { get; set; }
506
            public int IsUpdate { get; set; }
507
        }
508 ccf944bb ljiyeon
509 6707a5c7 ljiyeon
        List<TempLoadData> tempLoadData = new List<TempLoadData>();
510
        public string FilePath = AppDomain.CurrentDomain.BaseDirectory + "Temp\\" + App.ViewInfo.DocumentItemID + ".tmp";
511 ccf944bb ljiyeon
512 6707a5c7 ljiyeon
        public void TempLoad()
513
        {
514
            if ((System.IO.File.Exists(FilePath)) == true) 
515
            {
516
                XmlDocument xdoc = new XmlDocument();
517
                xdoc.Load(FilePath);               
518
                XmlNodeList nodes = xdoc.SelectNodes("/Root/CommentID"); 
519
                int PageNumber = 0;
520
                if (nodes.Count > 0) 
521
                {
522
                    if (MessageBox.Show("저장하지 못한 데이터가 있습니다. 불러오시겠습니까?", "MARKUS", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
523 ccf944bb ljiyeon
                    {
524 6707a5c7 ljiyeon
                        foreach (XmlNode node in nodes)
525 ccf944bb ljiyeon
                        {
526 6707a5c7 ljiyeon
                            string CommentID = node.Attributes["Value"].Value;
527
                            string ConvertData = node.SelectSingleNode("ConvertData").InnerText;
528
                            string DATA_TYPE = node.SelectSingleNode("DATA_TYPE").InnerText;
529
                            string MarkupInfoID = node.SelectSingleNode("MarkupInfoID").InnerText;
530
                            int IsUpdate = Convert.ToInt32(node.SelectSingleNode("IsUpdate").InnerText);
531
                            PageNumber = Convert.ToInt32(node.SelectSingleNode("PageNumber").InnerText);                           
532
                            
533
                            tempLoadData.Add(new TempLoadData()
534 ccf944bb ljiyeon
                            {
535 6707a5c7 ljiyeon
                                PageNumber = PageNumber,
536
                                CommentID = CommentID,
537
                                ConvertData = ConvertData,
538
                                DATA_TYPE = DATA_TYPE,
539
                                MarkupInfoID = MarkupInfoID,
540
                                IsUpdate = IsUpdate
541 ccf944bb ljiyeon
                            });
542 6707a5c7 ljiyeon
                        }
543 ccf944bb ljiyeon
544 6707a5c7 ljiyeon
                        if (PageNumber > 0)
545
                        {
546
                            this.pageNavigator.GotoPage(PageNumber);
547
                        }
548 ccf944bb ljiyeon
549 6707a5c7 ljiyeon
                        // Temp Object add               
550
                        if (pageNavigator.CurrentPage.PageNumber == PageNumber)
551
                        {
552
                            TempControlLoad();
553
                        }
554
                        tempLoadData.Clear();
555
                    }
556
                }
557
                else //파일 삭제
558
                {
559
                    temp.Remove();
560
                }
561
            }          
562 ccf944bb ljiyeon
        }
563 6707a5c7 ljiyeon
    
564 787a4489 KangIngu
565
        public void ReleaseAdorner()
566
        {
567
            if (SelectLayer.Children.Count > 0)
568
            {
569
                foreach (var item in SelectLayer.Children)
570
                {
571
                    if (item.GetType().Name == "AdornerFinal")
572
                    {
573
                        (item as AdornerFinal).unRegister();
574
575
                        foreach (var InnerItem in (item as AdornerFinal).MemberSet.Cast<AdornerMember>())
576
                        {
577
                            if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData))
578
                            {
579
                                if (InnerItem.DrawingData.GetType().Name == "PolygonControl")
580
                                {
581
                                    if ((InnerItem.DrawingData as PolygonControl).CommentID == null)
582
                                    {
583
                                        (InnerItem.DrawingData as PolygonControl).CommentID = KCOM.Events.Save.shortGuid();
584
                                    }
585
                                }
586
587
                                ViewerDataModel.Instance.MarkupControls_USER.Add(InnerItem.DrawingData as CommentUserInfo);
588
                            }
589
                        }
590
                    }
591
                }
592
                SelectLayer.Children.Clear();
593
            }
594
        }
595
596
        public List<CommentUserInfo> AddAdorner()
597
        {
598
            List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
599
600
            if (SelectLayer.Children.Count > 0)
601
            {
602
                foreach (var item in SelectLayer.Children)
603
                {
604
                    if (item.GetType().Name == "AdornerFinal")
605
                    {
606
                        (item as AdornerFinal).unRegister();
607
608
                        foreach (var InnerItem in (item as AdornerFinal).MemberSet.Cast<AdornerMember>())
609
                        {
610
                            if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData))
611
                            {
612
                                adornerSet.Add(InnerItem.DrawingData as CommentUserInfo);
613
                            }
614
615
                            Control_Style(InnerItem.DrawingData as CommentUserInfo);
616
617
                            UndoData.Markup_List.Add(multi_Undo_Data);
618
                            multi_Undo_Data = new Multi_Undo_data();
619
                        }
620
                    }
621
                }
622
                SelectLayer.Children.Clear();
623
            }
624
            return adornerSet;
625
        }
626
627
        public void ChangeCommentReact()
628
        {
629
            bool isComingNewBie = false;
630
631
            if (ViewerDataModel.Instance.MarkupControls_USER.Count > 0)
632
            {
633
                foreach (var control in ViewerDataModel.Instance.MarkupControls_USER)
634
                {
635
                    var root = layerControl.MarkupToString(control, App.ViewInfo.UserID);
636 d7548b21 ljiyeon
                   
637 6707a5c7 ljiyeon
                    var existItem = ViewerDataModel.Instance.MarkupList_USER.Where(data => data.ID == root.CommentID).FirstOrDefault();
638
                    if (existItem != null) //신규 추가 된 코멘트
639
                    {
640
                        if (existItem.Data != root.ConvertData) //코멘트가 같은지
641 787a4489 KangIngu
                        {
642 6707a5c7 ljiyeon
                            existItem.Data = root.ConvertData;
643
                            existItem.IsUpdate = true;
644 d7548b21 ljiyeon
                        }
645 6707a5c7 ljiyeon
                    }
646
                    else
647
                    {
648
                        if (root.CommentID != null)
649 d7548b21 ljiyeon
                        {
650 6707a5c7 ljiyeon
                            isComingNewBie = true;
651
                            var currentCommentCheck = ViewerDataModel.Instance.MarkupList_USER.Where(dt => dt.ID == control.CommentID).FirstOrDefault();
652
                            if (currentCommentCheck != null)
653 787a4489 KangIngu
                            {
654 6707a5c7 ljiyeon
                                currentCommentCheck.Data = root.ConvertData;
655
                            }
656
                            else
657
                            {
658
                                ViewerDataModel.Instance.MarkupList_USER.Add(new MarkupItemEx
659 787a4489 KangIngu
                                {
660 6707a5c7 ljiyeon
                                    ID = control.CommentID,
661
                                    Data = root.ConvertData,
662
                                    Data_Type = root.DATA_TYPE,
663
                                    MarkupInfoID = App.Custom_ViewInfoId,
664
                                    PageNumber = this.pageNavigator.CurrentPage.PageNumber,
665
                                });
666 787a4489 KangIngu
                            }
667
                        }
668 6707a5c7 ljiyeon
                    }                    
669 787a4489 KangIngu
                }
670
            }
671
672 6707a5c7 ljiyeon
673 787a4489 KangIngu
            if (PreviewUserMarkupInfoItem != null && isComingNewBie && !ComingNewBieEnd)
674
            {
675
                if (ViewerDataModel.Instance._markupInfoList.Where(info => info.UserID == PreviewUserMarkupInfoItem.UserID).FirstOrDefault() == null)
676
                {
677
                    ComingNewBieEnd = true;
678
                    ViewerDataModel.Instance._markupInfoList.Insert(0, PreviewUserMarkupInfoItem);
679
                    PreviewUserMarkupInfoItem.IsPreviewUser = false;
680
                    gridViewMarkup.ItemsSource = null;
681
                    gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
682
                    gridViewMarkup.SelectedItem = PreviewUserMarkupInfoItem;
683
                }
684
            }
685
686
        }
687
688
        MarkupToPDF.Controls.Parsing.LayerControl layerControl = new MarkupToPDF.Controls.Parsing.LayerControl();
689
        bool ComingNewBieEnd = false;
690
691
        private void pageNavigator_PageChanging(object sender, Controls.Sample.PageChangeEventArgs e)
692 23a96932 djkim
        {            
693 316d0f5c KangIngu
            if (ViewerDataModel.Instance.UndoDataList.Count > 0)
694 d7548b21 ljiyeon
            {   
695 316d0f5c KangIngu
                this.ParentOfType<MainWindow>().dzTopMenu.SaveEvent(null, null);
696
            }
697 6707a5c7 ljiyeon
            
698 787a4489 KangIngu
            ViewerDataModel.Instance.UndoDataList.Clear();
699 6707a5c7 ljiyeon
            
700 787a4489 KangIngu
            InkControl_Convert();
701
702
            ReleaseAdorner();
703
            ChangeCommentReact();
704
            CompareMode.IsChecked = false;
705
            var BalancePoint = ViewerDataModel.Instance.PageBalanceMode == true ? e.PageNumber + ViewerDataModel.Instance.PageBalanceNumber : e.PageNumber;
706
707
708
            #region 페이지가 벗어난 경우
709
710
            if (BalancePoint < 1)
711
            {
712
                BalancePoint = 1;
713
                ViewerDataModel.Instance.PageBalanceNumber = 0;
714
            }
715
716
            if (pageNavigator.PageCount < BalancePoint)
717
            {
718
                BalancePoint = pageNavigator.PageCount;
719
                ViewerDataModel.Instance.PageBalanceNumber = 0;
720
            }
721
722
            #endregion
723
724
            ViewerDataModel.Instance.PageNumber = BalancePoint;
725
726 a874198d humkyung
            string uri = "";
727 a1716fa5 KangIngu
            if (userData.COMPANY != "EXT")
728 a874198d humkyung
            {
729
                uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToInt32(_ViewInfo.DocumentItemID) / 100).ToString(), _ViewInfo.DocumentItemID, e.PageNumber);
730
            }
731
            else
732
            {
733
                uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, e.PageNumber);
734
            }
735 787a4489 KangIngu
736 8a9f6742 djkim
            var defaultBitmapImage = new BitmapImage();
737
            defaultBitmapImage.BeginInit();
738
            defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
739
            defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
740
            defaultBitmapImage.UriSource = new Uri(uri);
741
            defaultBitmapImage.EndInit();
742
743
            ViewerDataModel.Instance.ImageViewPath = null;
744 4ca11b36 djkim
            GC.Collect();            
745 787a4489 KangIngu
746
            if (defaultBitmapImage.IsDownloading)
747
            {
748
                defaultBitmapImage.DownloadCompleted += (ex, arg) =>
749
                {
750 8a9f6742 djkim
                    defaultBitmapImage.Freeze();
751
                    mainPanel.UpdateLayout();
752 4ca11b36 djkim
                    GC.Collect();                    
753 787a4489 KangIngu
                    ViewerDataModel.Instance.ImageViewPath = defaultBitmapImage;
754
                    ViewerDataModel.Instance.ImageViewWidth = defaultBitmapImage.PixelWidth;
755
                    ViewerDataModel.Instance.ImageViewHeight = defaultBitmapImage.PixelHeight;
756
                };
757
            }
758
759
            zoomAndPanCanvas.Width = Convert.ToDouble(e.CurrentPage.PAGE_WIDTH);
760
            zoomAndPanCanvas.Height = Convert.ToDouble(e.CurrentPage.PAGE_HEIGHT);
761
762
763
            Common.ViewerDataModel.Instance.ContentWidth = zoomAndPanCanvas.Width;
764
            Common.ViewerDataModel.Instance.ContentHeight = zoomAndPanCanvas.Height;
765
            inkBoard.Width = zoomAndPanCanvas.Width;
766
            inkBoard.Height = zoomAndPanCanvas.Height;
767
768 6707a5c7 ljiyeon
           
769 787a4489 KangIngu
770
            if (!testPanel2.IsHidden)
771
            {
772
                //PDF모드일때 잠시 대기(강인구)
773
                if (IsSyncPDFMode)
774
                {
775
                    Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
776
                    var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber)));
777
778
                    if (pdfpath.IsDownloading)
779
                    {
780
                        pdfpath.DownloadCompleted += (ex, arg) =>
781
                        {
782
                            ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
783
                            ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
784
                            ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
785
                            zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
786
                            zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
787
                        };
788
                    }
789
                    else
790
                    {
791
                        ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
792
                        ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
793
                        ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
794
795
                        zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
796
                        zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
797
                    }
798
                }
799
                else
800
                {
801 a874198d humkyung
                    string uri2 = "";
802 a1716fa5 KangIngu
                    if (userData.COMPANY != "EXT")
803 a874198d humkyung
                    {
804
                        uri2 = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, BalancePoint);
805
                    }
806
                    else
807
                    {
808
                        uri2 = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, BalancePoint);
809
                    }
810 a1716fa5 KangIngu
811 787a4489 KangIngu
812
                    var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri2));
813
814
                    ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
815
                    ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
816
                    ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
817
                    zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
818
                    zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
819
820
                    zoomAndPanControl.ZoomTo(new Rect
821
                    {
822
                        X = 0,
823
                        Y = 0,
824
                        Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width),
825
                        Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height),
826
                    });
827
828
                    if (defaultBitmapImage_Compare.IsDownloading)
829
                    {
830
                        defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
831
                        {
832
833
                            ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
834
                            ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
835
                            ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
836
837
                            zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
838
                            zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
839
840
                            zoomAndPanControl.ZoomTo(new Rect
841
                            {
842
                                X = 0,
843
                                Y = 0,
844
                                Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width),
845
                                Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height),
846
                            });
847
                        };
848
                    }
849
                }
850
                tlSyncPageNum.Text = String.Format("Current Page : {0}", BalancePoint);
851
            }
852
853
            this.pageNavigator.SetNextPage();
854
855
            if (zoomAndPanCanvas2.Width.IsNaN())
856
            {
857
                zoomAndPanControl.ZoomTo(new Rect { X = 0, Y = 0, Width = zoomAndPanCanvas.Width, Height = zoomAndPanCanvas.Height });
858
            }
859
860
            Common.ViewerDataModel.Instance.MarkupControls_USER.Clear();  //전체 제거
861
            Common.ViewerDataModel.Instance.MarkupControls.Clear();  //전체 제거
862
863
            List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업
864 d7548b21 ljiyeon
 
865 787a4489 KangIngu
            foreach (var item in gridSelectionItem)
866
            {
867
                if (item.UserID == App.ViewInfo.UserID)
868
                {
869 6707a5c7 ljiyeon
                    ViewerDataModel.Instance.current_page_commentcnt = ViewerDataModel.Instance.MarkupList_USER.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().Count;
870 787a4489 KangIngu
                    ViewerDataModel.Instance.MarkupList_USER.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem)
871
                    {
872
                        layerControl.markupParseEx(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, item.DisplayColor, "", item.MarkupInfoID, markupitem.ID);
873
                    });
874 6707a5c7 ljiyeon
                    
875 787a4489 KangIngu
                }
876
                else
877
                {
878
                    ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem)
879
                    {
880
                        layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls, item.DisplayColor, "", item.MarkupInfoID);
881
                    });
882
                }
883
            }
884 6707a5c7 ljiyeon
            
885 787a4489 KangIngu
            if (!testPanel2.IsHidden)
886
            {
887 dd0ffcfb KangIngu
                ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
888
                ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
889
                ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
890
891 787a4489 KangIngu
                Common.ViewerDataModel.Instance.MarkupControls_Sync.Clear();
892
                List<MarkupInfoItem> gridSelectionRevItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList();
893
894
895
                foreach (var item in gridSelectionRevItem)
896
                {
897
                    item.MarkupList.Where(pageItem => pageItem.PageNumber == BalancePoint).ToList().ForEach(delegate (MarkupItem markupitem)
898
                    {
899
                        layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID);
900
                    });
901
                }
902
903
            }
904
905
            var instanceMain = this.ParentOfType<MainWindow>();
906
            instanceMain.dzTopMenu.tlcurrentPage.Text = e.CurrentPage.PAGE_NUMBER.ToString();
907 992a98b4 KangIngu
            instanceMain.dzTopMenu.tlcurrentPage_readonly.Text = e.CurrentPage.PAGE_NUMBER.ToString();
908 787a4489 KangIngu
909
            instanceMain.dzTopMenu.rotateOffSet = 0;
910
            var pageinfo = this.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == e.CurrentPage.PAGE_NUMBER).FirstOrDefault();
911
            drawingPannelRotate(pageinfo.PAGE_ANGLE);
912
913
            //}
914
            SetCommentPages(true);
915
        }
916 6707a5c7 ljiyeon
        
917
918
        //Temp Control Load
919
        public void TempControlLoad()
920
        {
921
            List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
922
923
            for (int k = 0; k < tempLoadData.Count; k++)
924
            {
925
                System.Windows.Controls.Control item = null;
926
                Multi_Undo_data multi_Undo_Data;
927
                
928
929
                switch (tempLoadData[k].IsUpdate)
930
                {
931
                    case 0://추가
932
                        var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.CommentID == tempLoadData[k].CommentID).FirstOrDefault();
933
                        if (control != null)
934
                        {
935
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(control);
936
                            var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (control as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault();
937
                            ViewerDataModel.Instance.MarkupList_USER.Remove(Item_);
938
                        }
939
940
                        //Control                   
941
                        item = layerControl.TempMarkupParseEx(tempLoadData[k].ConvertData, Common.ViewerDataModel.Instance.MarkupControls_USER, "#FFFF0000", "", tempLoadData[k].MarkupInfoID, tempLoadData[k].CommentID);
942
                                               
943
                        UndoData = new Undo_data()
944
                        {
945
                            IsUndo = false,
946
                            Event = Event_Type.Create,
947
                            EventTime = DateTime.Now,
948
                            Opacity = ViewerDataModel.Instance.ControlOpacity,
949
                            Markup_List = new List<Multi_Undo_data>()
950
                        };
951
952
                        multi_Undo_Data = new Multi_Undo_data();
953
                        multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo);
954
                        UndoData.Markup_List.Add(multi_Undo_Data);
955
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);
956
                        break;
957
                    case 1://수정
958
                        control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.CommentID == tempLoadData[k].CommentID).FirstOrDefault();
959
                        if (control != null)
960
                        {
961
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(control);
962
                            var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (control as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault();
963
                            ViewerDataModel.Instance.MarkupList_USER.Remove(Item_);
964
                        }
965
966
                        //Control                   
967
                        item = layerControl.TempMarkupParseEx(tempLoadData[k].ConvertData, Common.ViewerDataModel.Instance.MarkupControls_USER, "#FFFF0000", "", tempLoadData[k].MarkupInfoID, tempLoadData[k].CommentID);
968
969
                        UndoData = new Undo_data()
970
                        {
971
                            IsUndo = false,
972
                            Event = Event_Type.Thumb,
973
                            EventTime = DateTime.Now,
974
                            Opacity = ViewerDataModel.Instance.ControlOpacity,
975
                            Markup_List = new List<Multi_Undo_data>()
976
                        };
977
978
                        multi_Undo_Data = new Multi_Undo_data();
979
                        multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo);
980
                        UndoData.Markup_List.Add(multi_Undo_Data);
981
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
982
                        break;
983
                    case 2://삭제
984
985
                        control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.CommentID == tempLoadData[k].CommentID).FirstOrDefault();
986
                        if (control != null)
987
                        {
988
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(control);
989
                            var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (control as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault();
990
                            ViewerDataModel.Instance.MarkupList_USER.Remove(Item_);                  
991
                        }
992
                        break;
993
                }              
994
            }       
995
        }
996 787a4489 KangIngu
997
        private void SetCommentPages(bool onlyMe = false)
998
        {
999
1000
            List<UsersCommentPagesMember> _pages = new List<UsersCommentPagesMember>();
1001
            foreach (var item in ViewerDataModel.Instance._markupInfoList)
1002
            {
1003
                UsersCommentPagesMember instance = new UsersCommentPagesMember();
1004
                instance.UserName = item.UserName;
1005
                instance.Depart = item.Depatment;
1006
                instance.MarkupInfoID = item.MarkupInfoID;
1007
                instance.IsSelected = true;
1008
                instance.isConSolidation = item.Consolidate;
1009
                instance.SetColor = item.DisplayColor;
1010
                if (item.UserID == App.ViewInfo.UserID && item.MarkupInfoID == item.MarkupInfoID)
1011
                {
1012
                    instance.PageNumber = ViewerDataModel.Instance.MarkupList_USER.Select(d => d.PageNumber).ToList();
1013
                }
1014
                else
1015
                {
1016
                    instance.PageNumber = ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.MarkupInfoID == item.MarkupInfoID).Select(d => d.PageNumber).ToList();
1017
                }
1018
                _pages.Add(instance);
1019
            }
1020
            this.pageNavigator.SetCommentList(_pages.ToList());
1021
        }
1022
1023
        private void zoomAndPanControl_MouseWheel(object sender, MouseWheelEventArgs e)
1024
        {
1025
            if (e.MiddleButton == MouseButtonState.Pressed)
1026
            {
1027
1028
            }
1029
            e.Handled = true;
1030
            if (e.Delta > 0)
1031
            {
1032
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas);
1033
                ZoomIn(currentContentMousePoint);
1034
            }
1035
            else
1036
            {
1037
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas);
1038
                ZoomOut(currentContentMousePoint);
1039
            }
1040
        }
1041
1042 a1716fa5 KangIngu
        private void zoomAndPanControl2_MouseWheel(object sender, MouseWheelEventArgs e)
1043
        {
1044
            e.Handled = true;
1045
            if (e.Delta > 0)
1046
            {
1047
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas2);
1048
                ZoomIn_Sync(currentContentMousePoint);
1049
            }
1050
            else
1051
            {
1052
                Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas2);
1053
                ZoomOut_Sync(currentContentMousePoint);
1054
            }
1055
        }
1056
1057 787a4489 KangIngu
        #region ZoomIn & ZoomOut
1058
1059
        private void ZoomOut_Executed(object sender, ExecutedRoutedEventArgs e)
1060
        {
1061
            ZoomOut(new Point(zoomAndPanControl.ContentZoomFocusX,
1062
                zoomAndPanControl.ContentZoomFocusY));
1063
        }
1064
1065
        private void ZoomIn_Executed(object sender, ExecutedRoutedEventArgs e)
1066
        {
1067
            ZoomIn(new Point(zoomAndPanControl.ContentZoomFocusX,
1068
                zoomAndPanControl.ContentZoomFocusY));
1069
        }
1070
1071
1072
        //강인구 추가 (줌 인아웃 수치 변경)
1073
        //큰해상도의 문서일 경우 줌 인 아웃시 사이즈 변동이 큼
1074
        private void ZoomOut(Point contentZoomCenter)
1075
        {
1076
            if (zoomAndPanControl.ContentScale > 0.39)
1077
            {
1078
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale - 0.2, contentZoomCenter);
1079
            }
1080
            else
1081
            {
1082
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale / 2, contentZoomCenter);
1083
            }
1084
1085 9cd2865b KangIngu
            if (zoomAndPanControl2 != null && Sync.IsChecked)
1086 787a4489 KangIngu
            {
1087 9cd2865b KangIngu
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl.ContentScale, contentZoomCenter);
1088 787a4489 KangIngu
            }
1089
        }
1090
1091
        private void ZoomIn(Point contentZoomCenter)
1092
        {
1093
            if (zoomAndPanControl.ContentScale > 0.19)
1094
            {
1095
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale + 0.2, contentZoomCenter);
1096
            }
1097
            else
1098
            {
1099
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale * 2, contentZoomCenter);
1100
            }
1101
1102 9cd2865b KangIngu
            if (zoomAndPanControl2 != null && Sync.IsChecked)
1103 787a4489 KangIngu
            {
1104 9cd2865b KangIngu
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl.ContentScale, contentZoomCenter);
1105 787a4489 KangIngu
            }
1106 a1716fa5 KangIngu
1107
        }
1108
1109
        private void ZoomOut_Sync(Point contentZoomCenter)
1110
        {
1111
            if (zoomAndPanControl2.ContentScale > 0.39)
1112
            {
1113
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale - 0.2, contentZoomCenter);
1114
            }
1115
            else
1116
            {
1117
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale / 2, contentZoomCenter);
1118
            }
1119
1120
            if (Sync.IsChecked)
1121
            {
1122
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl2.ContentScale, contentZoomCenter);
1123
            }
1124
        }
1125
1126
        private void ZoomIn_Sync(Point contentZoomCenter)
1127
        {
1128
            if (zoomAndPanControl2.ContentScale > 0.19)
1129
            {
1130
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale + 0.2, contentZoomCenter);
1131
            }
1132
            else
1133
            {
1134
                zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale * 2, contentZoomCenter);
1135
            }
1136
1137
            if (Sync.IsChecked)
1138
            {
1139
                zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl2.ContentScale, contentZoomCenter);
1140
            }
1141 787a4489 KangIngu
        }
1142
1143
        private void ZoomOut()
1144
        {
1145
            zoomAndPanControl.ContentScale -= 0.1;
1146
            //if (zoomAndPanControl2 != null)
1147
            //{
1148
            //    zoomAndPanControl2.ContentScale -= 0.1;
1149
            //}
1150
        }
1151
1152
        private void ZoomIn()
1153
        {
1154
            zoomAndPanControl.ContentScale += 0.1;
1155
            //if (zoomAndPanControl2 != null)
1156
            //{
1157
            //    zoomAndPanControl2.ContentScale += 0.1;
1158
            //}
1159
        }
1160
1161
        #endregion
1162
1163
        private void init()
1164
        {
1165
            foreach (var item in ViewerDataModel.Instance.MarkupControls)
1166
            {
1167
1168
                ControlList.Clear();
1169
                listBox.Items.Clear();
1170
                selected_item.Clear();
1171
1172
                (item as IMarkupCommonData).IsSelected = false;
1173
            }
1174
1175
        }
1176
1177
        private HitTestResultBehavior MyCallback(HitTestResult result)
1178
        {
1179
            //this.cursor = Cursors.UpArrow;
1180
            var element = result.VisualHit;
1181
            while (element != null && !(element is CommentUserInfo))
1182
                element = VisualTreeHelper.GetParent(element);
1183
1184
            if (element == null)
1185
            {
1186
                return HitTestResultBehavior.Stop;
1187
            }
1188
            else
1189
            {
1190
                if (element is CommentUserInfo)
1191
                {
1192
                    if (!hitList.Contains(element))
1193
                    {
1194
                        hitList.Add((CommentUserInfo)element);
1195
                    }
1196
                    else
1197
                    {
1198
                        return HitTestResultBehavior.Stop;
1199
                    }
1200
                    //IntersectionDetail intersectionDetail =
1201
                    //((GeometryHitTestResult)result).IntersectionDetail;
1202
                    //switch (intersectionDetail)
1203
                    //{
1204
                    //    case IntersectionDetail.FullyContains:
1205
                    //        // Add the hit test result to the list:
1206
                    //        hitList.Add((CommentUserInfo)result.VisualHit);
1207
                    //        return HitTestResultBehavior.Continue;
1208
                    //    case IntersectionDetail.Intersects:
1209
                    //        // Set the behavior to return visuals at all z-order levels:
1210
                    //        return HitTestResultBehavior.Continue;
1211
                    //    case IntersectionDetail.FullyInside:
1212
                    //        // Set the behavior to return visuals at all z-order levels:
1213
                    //        return HitTestResultBehavior.Continue;
1214
                    //    default:
1215
                    //        return HitTestResultBehavior.Stop;
1216
                    //}
1217
                }
1218
            }
1219
            return HitTestResultBehavior.Continue;
1220
        }
1221
1222
        public void ReleaseSelectPath()
1223
        {
1224
            if (SelectionPath == null)
1225
            {
1226
                SelectionPath = new Path();
1227
                SelectionPath.Name = "";
1228
            }
1229
            if (SelectionPath.Name != "")
1230
            {
1231
                SelectionPath.Name = "None";
1232
            }
1233
            SelectionPath.Opacity = 0.01;
1234
            SelectionPath.RenderTransform = null;
1235
            SelectionPath.RenderTransformOrigin = new Point(0, 0);
1236
        }
1237
1238
        #region 컨트롤 초기화 
1239
        public void Control_Init(object control)
1240
        {
1241
            if (L_Size != 0 && (control as IPath) != null)
1242
            {
1243
                (control as IPath).LineSize = L_Size;
1244
                L_Size = 0;
1245
            }
1246
1247
            switch (control.GetType().Name)
1248
            {
1249
                case "RectangleControl":
1250
                    {
1251
                        (control as RectangleControl).StrokeColor = Brushes.Red;
1252
                    }
1253
                    break;
1254
                case "CircleControl":
1255
                    {
1256
                        (control as CircleControl).StrokeColor = Brushes.Red;
1257
                    }
1258
                    break;
1259
                case "TriControl":
1260
                    {
1261
                        (control as TriControl).StrokeColor = Brushes.Red;
1262
                    }
1263
                    break;
1264
                case "RectCloudControl":
1265
                    {
1266
                        (control as RectCloudControl).StrokeColor = Brushes.Red;
1267
                    }
1268
                    break;
1269
                case "CloudControl":
1270
                    {
1271
                        (control as CloudControl).StrokeColor = Brushes.Red;
1272
                    }
1273
                    break;
1274
                case "PolygonControl":
1275
                    {
1276
                        (control as PolygonControl).StrokeColor = Brushes.Red;
1277
                    }
1278
                    break;
1279
                case "ArcControl":
1280
                    {
1281
                        (control as ArcControl).StrokeColor = Brushes.Red;
1282
                    }
1283
                    break;
1284
                case "LineControl":
1285
                    {
1286
                        (control as LineControl).StrokeColor = Brushes.Red;
1287
                    }
1288
                    break;
1289
                case "ArrowControl_Multi":
1290
                    {
1291
                        (control as ArrowControl_Multi).StrokeColor = Brushes.Red;
1292
                    }
1293
                    break;
1294
                case "TextControl":
1295
                    {
1296
                        (control as TextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1297
                    }
1298
                    break;
1299
                case "ArrowTextControl":
1300
                    {
1301
                        (control as ArrowTextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1302
                    }
1303
                    break;
1304
            }
1305
        }
1306
        #endregion
1307
1308
        public void firstCondition_MouseLeave(object sender, MouseEventArgs e)
1309
        {
1310
            //Control_Init(e.Source);
1311
        }
1312
1313
        private void zoomAndPanControl_MouseMove(object sender, MouseEventArgs e)
1314
        {
1315
            if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
1316
            {
1317
                if (!floatingTip.IsOpen) { floatingTip.IsOpen = true; }
1318
1319
                Point currentPos = e.GetPosition(rect);
1320 d71ee575 djkim
1321 787a4489 KangIngu
                floatingTip.HorizontalOffset = currentPos.X + 20;
1322
                floatingTip.VerticalOffset = currentPos.Y;
1323
1324
1325
                //ToolTip tool = new System.Windows.Controls.ToolTip();
1326
                //tool.Content = "ToolTip";
1327
                //panel.ToolTip = tool;
1328
            }
1329
1330
            if (mouseHandlingMode != MouseHandlingMode.Drawing)
1331
            {
1332
                #region 마우스 오버 시 색상 변경
1333
                //var firstCondition = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
1334
                //Color TempColor = MarkupToPDF.Controls.Common.ValueConverter.StringToColorConverter.Parse("FF07B4FF");
1335
1336
                //if (firstCondition != null)
1337
                //{
1338
                //    firstCondition.MouseLeave += new System.Windows.Input.MouseEventHandler(firstCondition_MouseLeave);
1339
1340
                //    if (firstCondition.GetType().Name == "TextControl")
1341
                //    {
1342
                //        (firstCondition as TextControl).BackInnerColor = new SolidColorBrush(TempColor);
1343
                //        return;
1344
                //    }
1345
                //    else if (firstCondition.GetType().Name == "ArrowTextControl")
1346
                //    {
1347
                //        (firstCondition as ArrowTextControl).BackInnerColor = new SolidColorBrush(TempColor);
1348
                //        return;
1349
                //    }
1350
1351
                //    if (L_Size == 0)
1352
                //    {
1353
                //        L_Size = (firstCondition as IPath).LineSize;
1354
                //        (firstCondition as IPath).LineSize *= 4;
1355
                //    }
1356
                //    switch (firstCondition.GetType().Name)
1357
                //    {
1358
                //        case "RectangleControl":
1359
                //            {
1360
                //                (firstCondition as RectangleControl).StrokeColor = new SolidColorBrush(TempColor);
1361
                //            }
1362
                //            break;
1363
                //        case "CircleControl":
1364
                //            {
1365
                //                (firstCondition as CircleControl).StrokeColor = new SolidColorBrush(TempColor);
1366
                //            }
1367
                //            break;
1368
                //        case "TriControl":
1369
                //            {
1370
                //                (firstCondition as TriControl).StrokeColor = new SolidColorBrush(TempColor);
1371
                //            }
1372
                //            break;
1373
                //        case "RectCloudControl":
1374
                //            {
1375
                //                (firstCondition as RectCloudControl).StrokeColor = new SolidColorBrush(TempColor);
1376
                //            }
1377
                //            break;
1378
                //        case "CloudControl":
1379
                //            {
1380
                //                (firstCondition as CloudControl).StrokeColor = new SolidColorBrush(TempColor);
1381
                //            }
1382
                //            break;
1383
                //        case "PolygonControl":
1384
                //            {
1385
                //                (firstCondition as PolygonControl).StrokeColor = new SolidColorBrush(TempColor);
1386
                //            }
1387
                //            break;
1388
                //        case "ArcControl":
1389
                //            {
1390
                //                (firstCondition as ArcControl).StrokeColor = new SolidColorBrush(TempColor);
1391
                //            }
1392
                //            break;
1393
                //        case "LineControl":
1394
                //            {
1395
                //                (firstCondition as LineControl).StrokeColor = new SolidColorBrush(TempColor);
1396
                //            }
1397
                //            break;
1398
                //        case "ArrowControl_Multi":
1399
                //            {
1400
                //                (firstCondition as ArrowControl_Multi).StrokeColor = new SolidColorBrush(TempColor);
1401
                //            }
1402
                //            break;
1403
1404
                //        default:
1405
                //            {
1406
1407
                //            }
1408
                //            break;
1409
                //    }
1410
                //} 
1411
                #endregion
1412
            }
1413
1414
            getCurrentPoint = e.GetPosition(drawingRotateCanvas);
1415
1416 992a98b4 KangIngu
            //if (mouseButtonDown == MouseButton.Middle)
1417
            //{
1418
            //    SetCursor();
1419
            //    Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1420
            //    Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1421 9f473fb7 KangIngu
1422 992a98b4 KangIngu
            //    Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
1423
            //    zoomAndPanControl.ContentOffsetX -= dragOffset.X;
1424
            //    zoomAndPanControl.ContentOffsetY -= dragOffset.Y;
1425 9f473fb7 KangIngu
1426 992a98b4 KangIngu
            //    //SetCursor();
1427
            //    //Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1428
            //    //Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1429 787a4489 KangIngu
1430 992a98b4 KangIngu
            //    //Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
1431 787a4489 KangIngu
1432 992a98b4 KangIngu
            //    //zoomAndPanControl.ContentOffsetX += 1;
1433
            //    //zoomAndPanControl.ContentOffsetY += 1;
1434 787a4489 KangIngu
1435 992a98b4 KangIngu
            //    //zoomAndPanControl.ContentOffsetX += dragOffset.X;
1436
            //    //zoomAndPanControl.ContentOffsetY += dragOffset.Y;
1437
            //}
1438
            if ((mouseButtonDown == MouseButton.Middle) || (mouseButtonDown == MouseButton.Right))
1439 787a4489 KangIngu
            {
1440 e54660e8 KangIngu
                SetCursor();
1441 787a4489 KangIngu
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1442
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1443
1444
                Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
1445
                zoomAndPanControl.ContentOffsetX -= dragOffset.X;
1446
                zoomAndPanControl.ContentOffsetY -= dragOffset.Y;
1447 9cd2865b KangIngu
1448 a1716fa5 KangIngu
                if (Sync.IsChecked)
1449 9cd2865b KangIngu
                {
1450
                    ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
1451
                    ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
1452
                }
1453 787a4489 KangIngu
            }
1454 992a98b4 KangIngu
1455
1456
            if (mouseHandlingMode == MouseHandlingMode.Drawing && mouseButtonDown == MouseButton.Left)
1457 787a4489 KangIngu
            {
1458
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1459
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1460
                SetCursor();
1461
1462
                if (IsDrawing)
1463
                {
1464
                    if (currentControl == null)
1465
                    {
1466
                        switch (controlType)
1467
                        {
1468
                            case ControlType.PenControl:
1469
                                {
1470
                                    if (inkBoard.Tag.ToString() == "Ink")
1471
                                    {
1472
                                        stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y));
1473
                                    }
1474
                                    else if (inkBoard.Tag.ToString() == "EraseByPoint")
1475
                                    {
1476
                                        RemovePointStroke(currentCanvasDrawingMouseMovePoint);
1477
                                    }
1478
                                    else if (inkBoard.Tag.ToString() == "EraseByStroke")
1479
                                    {
1480
                                        RemoveLineStroke(currentCanvasDrawingMouseMovePoint);
1481
                                    }
1482
1483
                                    //inkBoard.Strokes.Add(stroke);
1484
                                }
1485
                                break;
1486
                        }
1487
                        return;
1488
                    }
1489
                }
1490
1491
                if (currentControl != null)
1492
                {
1493
                    double moveX = currentCanvasDrawingMouseMovePoint.X - canvasDrawingMouseDownPoint.X;
1494
                    double moveY = currentCanvasDrawingMouseMovePoint.Y - canvasDrawingMouseDownPoint.Y;
1495
                    //강인구 추가
1496
                    currentControl.Opacity = ViewerDataModel.Instance.ControlOpacity;
1497
1498
                    if ((currentControl as IPath) != null)
1499
                    {
1500
                        (currentControl as IPath).LineSize = ViewerDataModel.Instance.LineSize;
1501
                    }
1502 5ce56a3a KangIngu
                    if ((currentControl as LineControl) != null)
1503
                    {
1504
                        (currentControl as LineControl).Interval = ViewerDataModel.Instance.Interval;
1505
                    }
1506
1507 787a4489 KangIngu
                    if ((currentControl as IShapeControl) != null)
1508
                    {
1509
                        (currentControl as IShapeControl).Paint = ViewerDataModel.Instance.paintSet;
1510
                    }
1511
                    if ((currentControl as TextControl) != null)
1512
                    {
1513
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true)
1514
                        {
1515
                            (currentControl as TextControl).TextStyle = FontStyles.Italic;
1516
                        }
1517
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true)
1518
                        {
1519 d4b0c723 KangIngu
                            (currentControl as TextControl).TextWeight = FontWeights.Bold;
1520 787a4489 KangIngu
                        }
1521
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true)
1522
                        {
1523
                            (currentControl as TextControl).UnderLine = TextDecorations.Underline;
1524
                        }
1525
                    }
1526
                    else if ((currentControl as ArrowTextControl) != null)
1527
                    {
1528
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true)
1529
                        {
1530
                            (currentControl as ArrowTextControl).TextStyle = FontStyles.Italic;
1531
                        }
1532
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true)
1533
                        {
1534 d4b0c723 KangIngu
                            (currentControl as ArrowTextControl).TextWeight = FontWeights.Bold;
1535 787a4489 KangIngu
                        }
1536
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true)
1537
                        {
1538
                            (currentControl as ArrowTextControl).UnderLine = TextDecorations.Underline;
1539
                        }
1540
                    }
1541 9f473fb7 KangIngu
                    else if ((currentControl as RectCloudControl) != null)
1542
                    {
1543
                        (currentControl as RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
1544
                    }
1545
                    else if ((currentControl as CloudControl) != null)
1546
                    {
1547
                        (currentControl as CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
1548
                    }
1549 787a4489 KangIngu
1550
                    switch (controlType)
1551
                    {
1552
                        case ControlType.Rectangle:
1553
                            {
1554
                                var control = currentControl as RectangleControl;
1555
1556
                                if (control != null)
1557
                                {
1558
                                    if (move.mousemode == MouseMode.Drawing)
1559
                                    {
1560
                                        //move.control_Move(ControlList, true, moveX, moveY);
1561
                                    }
1562
                                    else
1563
                                    {
1564 17a22987 KangIngu
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1565
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1566
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1567
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1568 787a4489 KangIngu
1569
1570 17a22987 KangIngu
                                        if (ViewerDataModel.Instance.IsPressShift)
1571
                                        {
1572 4318fdeb KangIngu
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1573 17a22987 KangIngu
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1574
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1575
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1576
                                        }
1577 e54660e8 KangIngu
1578 787a4489 KangIngu
                                        control.PointSet = new List<Point>
1579
                                        {
1580 17a22987 KangIngu
                                            control.StartPoint,
1581
                                            control.LeftBottomPoint,
1582
                                            control.EndPoint,
1583
                                            control.TopRightPoint,
1584 787a4489 KangIngu
                                        };
1585
                                        control.updateControl();
1586
                                    }
1587
1588
                                    //강인구 추가
1589
                                    control.ControlType = controlType;
1590
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1591
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1592
                                }
1593
                            }
1594
                            break;
1595
1596
                        case ControlType.RectCloud:
1597
                            {
1598
                                var control = currentControl as RectCloudControl;
1599
1600
                                if (control != null)
1601
                                {
1602
                                    if (move.mousemode == MouseMode.Drawing)
1603
                                    {
1604
                                        //move.control_Move(ControlList, true, moveX, moveY);
1605
                                    }
1606
                                    else
1607
                                    {
1608
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1609
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1610
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1611
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1612
1613 17a22987 KangIngu
                                        if (ViewerDataModel.Instance.IsPressShift)
1614
                                        {
1615 4318fdeb KangIngu
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1616 17a22987 KangIngu
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1617
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1618
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1619
                                        }
1620
1621 787a4489 KangIngu
                                        control.PointSet = new List<Point>
1622
                                        {
1623
                                            control.StartPoint,
1624
                                            control.LeftBottomPoint,
1625
                                            control.EndPoint,
1626
                                            control.TopRightPoint,
1627
                                        };
1628
                                    }
1629 d71ee575 djkim
1630 787a4489 KangIngu
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1631
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1632
                                }
1633
                            }
1634
                            break;
1635
1636
                        case ControlType.SingleLine:
1637
                            {
1638 d71ee575 djkim
                                var control = currentControl as LineControl;
1639
                                if (control != null)
1640 787a4489 KangIngu
                                {
1641
                                    control.LineStyleSet = LineStyleSet.SingleLine;
1642
                                    control.ControlType = controlType;
1643 d71ee575 djkim
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1644
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1645
                                    Point tempPoint = control.EndPoint;
1646 5ce56a3a KangIngu
1647 d71ee575 djkim
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1648
                                    {
1649
                                        //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1650
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1651
                                        control.EndPoint = tempPoint;
1652
                                    }
1653
                                    else
1654
                                    {
1655
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1656
                                    }
1657 5ce56a3a KangIngu
1658 d71ee575 djkim
                                    control.PointSet = new List<Point>
1659 5ce56a3a KangIngu
                                        {
1660
                                            control.StartPoint,
1661
                                            control.EndPoint,
1662
                                        };
1663 d71ee575 djkim
1664
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1665 787a4489 KangIngu
                                }
1666
1667
                            }
1668
                            break;
1669
1670
                        case ControlType.CancelLine:
1671
                            {
1672 d71ee575 djkim
                                var control = currentControl as LineControl;
1673
                                if (control != null)
1674 787a4489 KangIngu
                                {
1675
                                    control.LineStyleSet = LineStyleSet.CancelLine;
1676
                                    //control.LineStyle = LineControl.LineStyleSet.MultiLine;
1677
                                    control.ControlType = controlType;
1678 d71ee575 djkim
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1679
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1680
                                    Point tempPoint = control.EndPoint;
1681 787a4489 KangIngu
1682 d71ee575 djkim
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1683
                                    {
1684
                                        //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1685
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1686
                                        control.EndPoint = tempPoint;
1687
                                    }
1688
                                    else
1689
                                    {
1690
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1691
                                    }
1692 787a4489 KangIngu
1693
1694 d71ee575 djkim
                                    control.PointSet = new List<Point>
1695 787a4489 KangIngu
                                            {
1696
                                                control.StartPoint,
1697
                                                control.EndPoint,
1698
                                            };
1699
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1700
                                }
1701 d71ee575 djkim
1702
1703 787a4489 KangIngu
                            }
1704
                            break;
1705
1706
                        case ControlType.ArrowLine:
1707
                            {
1708 d71ee575 djkim
                                var control = currentControl as LineControl;
1709
                                if (control != null)
1710 787a4489 KangIngu
                                {
1711
                                    control.LineStyleSet = LineStyleSet.ArrowLine;
1712
                                    control.ControlType = controlType;
1713 d71ee575 djkim
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1714
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1715
                                    Point tempPoint = control.EndPoint;
1716 787a4489 KangIngu
1717 d71ee575 djkim
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1718
                                    {
1719
                                        //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1720
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1721
                                        control.EndPoint = tempPoint;
1722
                                    }
1723
                                    else
1724
                                    {
1725
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1726
                                    }
1727 787a4489 KangIngu
1728
1729 d71ee575 djkim
                                    control.PointSet = new List<Point>
1730 787a4489 KangIngu
                                            {
1731
                                                control.StartPoint,
1732
                                                control.EndPoint,
1733
                                            };
1734
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1735
                                }
1736
                            }
1737
                            break;
1738
1739
                        case ControlType.TwinLine:
1740
                            {
1741 d71ee575 djkim
                                var control = currentControl as LineControl;
1742
                                if (control != null)
1743 787a4489 KangIngu
                                {
1744
                                    control.LineStyleSet = LineStyleSet.TwinLine;
1745
                                    control.ControlType = controlType;
1746 d71ee575 djkim
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1747
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1748
                                    Point tempPoint = control.EndPoint;
1749 787a4489 KangIngu
1750 d71ee575 djkim
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1751
                                    {
1752
                                        //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1753
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1754
                                        control.EndPoint = tempPoint;
1755
                                    }
1756
                                    else
1757
                                    {
1758
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1759
                                    }
1760 787a4489 KangIngu
1761
1762 d71ee575 djkim
                                    control.PointSet = new List<Point>
1763 787a4489 KangIngu
                                            {
1764
                                                control.StartPoint,
1765
                                                control.EndPoint,
1766
                                            };
1767
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1768
                                }
1769
                            }
1770
                            break;
1771
1772
                        case ControlType.DimLine:
1773
                            {
1774 d71ee575 djkim
                                var control = currentControl as LineControl;
1775
                                if (control != null)
1776 787a4489 KangIngu
                                {
1777
                                    control.LineStyleSet = LineStyleSet.DimLine;
1778
                                    control.ControlType = controlType;
1779 d71ee575 djkim
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1780
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1781
                                    Point tempPoint = control.EndPoint;
1782 787a4489 KangIngu
1783 d71ee575 djkim
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1784
                                    {
1785
                                        //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1786
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1787
                                        control.EndPoint = tempPoint;
1788
                                    }
1789
                                    else
1790
                                    {
1791
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1792
                                    }
1793 787a4489 KangIngu
1794 d71ee575 djkim
                                    control.PointSet = new List<Point>
1795 787a4489 KangIngu
                                            {
1796
                                                control.StartPoint,
1797
                                                control.EndPoint,
1798
                                            };
1799
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1800
                                }
1801
                            }
1802
                            break;
1803
1804
                        case ControlType.ChainLine:
1805
                            {
1806
                                var control = currentControl as PolygonControl;
1807
1808
                                if (control != null)
1809
                                {
1810 2eac4f76 KangIngu
1811 787a4489 KangIngu
                                    control.PointSet.RemoveAt(control.PointSet.Count - 1);
1812
                                    control.PointSet.Add(currentCanvasDrawingMouseMovePoint);
1813 2eac4f76 KangIngu
1814
                                    Point tempPoint = control.PointSet[control.PointSet.Count - 1];
1815
1816
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1817
                                    {
1818
                                        //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1819 e54660e8 KangIngu
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.PointSet[control.PointSet.Count - 2], ref tempPoint, true);
1820 2eac4f76 KangIngu
                                        control.PointSet[control.PointSet.Count - 1] = tempPoint;
1821
                                        //control.EndPoint = tempPoint;
1822
                                    }
1823
                                    else
1824
                                    {
1825
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1826
                                    }
1827
1828 787a4489 KangIngu
                                    control.SetPolyPath();
1829
1830
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1831
                                }
1832
                            }
1833
                            break;
1834
1835
                        case ControlType.ArcLine:
1836
                            {
1837 d71ee575 djkim
                                var control = currentControl as ArcControl;
1838
                                if (control != null)
1839 787a4489 KangIngu
                                {
1840
                                    control.isTransOn = false;
1841
                                    control.ControlType = controlType;
1842 d71ee575 djkim
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1843
                                    control.MidPoint = new Point(0, 0);
1844
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1845
                                    Point tempPoint = control.EndPoint;
1846 787a4489 KangIngu
1847 d71ee575 djkim
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1848 787a4489 KangIngu
                                    {
1849 d71ee575 djkim
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1850
                                        control.EndPoint = tempPoint;
1851
                                    }
1852
                                    else
1853
                                    {
1854
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1855
                                    }
1856 787a4489 KangIngu
1857
1858 d71ee575 djkim
                                    control.PointSet = new List<Point>
1859 787a4489 KangIngu
                                            {
1860
                                                control.StartPoint,
1861
                                                control.MidPoint,
1862
                                                control.EndPoint,
1863
                                            };
1864
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1865
                                }
1866
1867 d71ee575 djkim
1868 787a4489 KangIngu
                            }
1869
                            break;
1870
1871
                        case ControlType.ArcArrow:
1872
                            {
1873 d71ee575 djkim
                                var control = currentControl as ArcControl;
1874
                                if (control != null)
1875 787a4489 KangIngu
                                {
1876
                                    control.isTransOn = true;
1877
                                    control.ControlType = controlType;
1878 d71ee575 djkim
                                    if (move.mousemode == MouseMode.Drawing)
1879 787a4489 KangIngu
                                    {
1880 d71ee575 djkim
                                        //move.control_Move(ControlList, true, moveX, moveY);
1881
                                    }
1882
                                    else
1883
                                    {
1884
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1885
                                        control.MidPoint = new Point(0, 0);
1886
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1887
                                    }
1888 787a4489 KangIngu
1889 d71ee575 djkim
                                    control.PointSet = new List<Point>
1890 787a4489 KangIngu
                                            {
1891
                                                control.StartPoint,
1892
                                                control.MidPoint,
1893
                                                control.EndPoint,
1894
                                            };
1895
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1896
                                }
1897
                            }
1898
                            break;
1899
1900
                        case ControlType.ArrowMultiLine:
1901
                            {
1902 d71ee575 djkim
                                var control = currentControl as ArrowControl_Multi;
1903
                                if (control != null)
1904 787a4489 KangIngu
                                {
1905 d71ee575 djkim
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1906
                                    Point tempPoint = control.EndPoint;
1907
                                    if (control.MiddlePoint == new Point(0, 0))
1908 787a4489 KangIngu
                                    {
1909 d71ee575 djkim
                                        if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1910 787a4489 KangIngu
                                        {
1911 d71ee575 djkim
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1912
                                            //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1913
                                            control.EndPoint = tempPoint;
1914 787a4489 KangIngu
                                        }
1915
                                        else
1916
                                        {
1917 d71ee575 djkim
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1918
                                        }
1919
                                    }
1920
                                    else
1921
                                    {
1922
                                        if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1923
                                        {
1924
                                            //var AngleValue = MathSet.returnAngleString(control.MiddlePoint, ref tempPoint, true);
1925
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.MiddlePoint, ref tempPoint, true);
1926
                                            control.EndPoint = tempPoint;
1927
                                        }
1928
                                        else
1929
                                        {
1930
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.MiddlePoint, ref tempPoint, false);
1931 787a4489 KangIngu
                                        }
1932
1933 d71ee575 djkim
                                    }
1934
1935
                                    control.PointSet = new List<Point>
1936 787a4489 KangIngu
                                            {
1937
                                                control.StartPoint,
1938
                                                control.MiddlePoint,
1939
                                                control.EndPoint,
1940
                                            };
1941
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1942
                                }
1943
                            }
1944
                            break;
1945
1946
                        case ControlType.Circle:
1947
                            {
1948
                                var control = currentControl as CircleControl;
1949
1950
                                if (control != null)
1951
                                {
1952
                                    if (move.mousemode == MouseMode.Drawing)
1953
                                    {
1954
                                        //move.control_Move(ControlList, true, moveX, moveY);
1955
                                    }
1956
                                    else
1957
                                    {
1958
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1959
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1960
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1961
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1962
1963 17a22987 KangIngu
                                        if (ViewerDataModel.Instance.IsPressShift)
1964
                                        {
1965 4318fdeb KangIngu
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1966 17a22987 KangIngu
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1967
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1968
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1969
                                        }
1970
1971 787a4489 KangIngu
                                        control.PointSet = new List<Point>
1972
                                        {
1973
                                            control.StartPoint,
1974
                                            control.LeftBottomPoint,
1975
                                            control.EndPoint,
1976
                                            control.TopRightPoint,
1977
                                        };
1978
                                    }
1979 d71ee575 djkim
1980 787a4489 KangIngu
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1981
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1982
1983
                                }
1984
                            }
1985
                            break;
1986
1987
                        case ControlType.PolygonCloud:
1988
                            {
1989
                                var control = currentControl as CloudControl;
1990
1991
                                if (control != null)
1992
                                {
1993
                                    control.isTransOn = true;
1994
                                    control.PointSet.RemoveAt(control.PointSet.Count - 1);
1995
1996
                                    control.PointSet.Add(currentCanvasDrawingMouseMovePoint);
1997
1998
                                    control.SetCloud();
1999
                                    //강인구 추가
2000
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
2001
                                    control.Paint = ViewerDataModel.Instance.paintSet;
2002
                                }
2003
                            }
2004
                            break;
2005
2006
                        case ControlType.Triangle:
2007
                            {
2008
                                var control = currentControl as TriControl;
2009
2010
                                if (control != null)
2011
                                {
2012
                                    if (move.mousemode == MouseMode.Drawing)
2013
                                    {
2014
                                        //move.control_Move(ControlList, true, moveX, moveY);
2015
                                    }
2016
                                    else
2017
                                    {
2018
                                        control.Paint = ViewerDataModel.Instance.paintSet;
2019
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2020
2021 992a98b4 KangIngu
                                        if (ViewerDataModel.Instance.checkAxis)
2022
                                        {
2023
                                            Point tempPoint = control.EndPoint;
2024
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2025
                                            control.EndPoint = tempPoint;
2026
                                        }
2027
2028 4318fdeb KangIngu
2029
                                        if (ViewerDataModel.Instance.IsPressShift)
2030
                                        {
2031 e753423e humkyung
                                            List<Point> Points = GetRegularTrianglePoints(control.StartPoint, control.EndPoint);
2032
                                            if (2 == Points.Count())
2033
                                            {
2034
                                                control.MidPoint = Points[0];
2035
                                                control.EndPoint = Points[1];
2036
                                            }
2037 4318fdeb KangIngu
                                        }
2038
2039 787a4489 KangIngu
                                        control.PointSet = new List<Point>
2040
                                            {
2041
                                                control.StartPoint,
2042
                                                control.MidPoint,
2043
                                                control.EndPoint,
2044
                                            };
2045
                                    }
2046 d71ee575 djkim
2047 787a4489 KangIngu
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
2048
                                    control.Paint = ViewerDataModel.Instance.paintSet;
2049
                                }
2050
                            }
2051
                            break;
2052
2053
                        case ControlType.ImgControl:
2054
                            {
2055
                                var control = currentControl as ImgControl;
2056
2057
                                if (control != null)
2058
                                {
2059
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2060
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2061
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2062
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2063
2064
                                    control.PointSet = new List<Point>
2065
                                        {
2066
                                            control.StartPoint,
2067
                                            control.LeftBottomPoint,
2068
                                            control.EndPoint,
2069
                                            control.TopRightPoint,
2070
                                        };
2071
                                }
2072
                            }
2073
                            break;
2074
2075
                        case ControlType.Date:
2076
                            {
2077
                                var control = currentControl as DateControl;
2078
2079
                                if (control != null)
2080
                                {
2081
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2082
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2083
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2084
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2085
                                    //control.Text = DateTime.Now.ToString("yyyy-MM-dd");
2086
2087
                                    control.PointSet = new List<Point>
2088
                                        {
2089
                                            control.StartPoint,
2090
                                            control.LeftBottomPoint,
2091
                                            control.EndPoint,
2092
                                            control.TopRightPoint,
2093
                                        };
2094
                                }
2095
                            }
2096
                            break;
2097
2098
                        case ControlType.ArrowTextControl:
2099
                            {
2100
                                var control = currentControl as ArrowTextControl;
2101
2102
                                if (control != null)
2103
                                {
2104
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2105 5ce56a3a KangIngu
                                    Point tempPoint = control.EndPoint;
2106 9f473fb7 KangIngu
2107
                                    control.MidPoint = new Point(control.EndPoint.X - 100, control.EndPoint.Y - 100);
2108
2109 5ce56a3a KangIngu
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2110
                                    {
2111
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2112
                                        control.EndPoint = tempPoint;
2113
                                    }
2114
                                    else
2115
                                    {
2116
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2117
                                    }
2118 992a98b4 KangIngu
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2119 787a4489 KangIngu
2120
                                    control.PointSet = new List<Point>
2121
                                            {
2122
                                                control.StartPoint,
2123
                                                control.MidPoint,
2124
                                                control.EndPoint,
2125
                                            };
2126
                                }
2127
                            }
2128
                            break;
2129
2130
                        case ControlType.ArrowTransTextControl:
2131
                            {
2132
                                var control = currentControl as ArrowTextControl;
2133
2134
                                if (control != null)
2135
                                {
2136
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2137 5ce56a3a KangIngu
                                    Point tempPoint = control.EndPoint;
2138 01cbc243 KangIngu
                                    //control.MidPoint = currentCanvasDrawingMouseMovePoint;
2139 9f473fb7 KangIngu
2140 5ce56a3a KangIngu
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2141
                                    {
2142
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2143
                                        control.EndPoint = tempPoint;
2144
                                    }
2145
                                    else
2146
                                    {
2147
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2148
                                    }
2149 01cbc243 KangIngu
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2150 787a4489 KangIngu
                                    control.isFixed = true;
2151
2152
                                    control.PointSet = new List<Point>
2153
                                            {
2154
                                                control.StartPoint,
2155
                                                control.MidPoint,
2156
                                                control.EndPoint,
2157
                                            };
2158
                                }
2159
                            }
2160
                            break;
2161
2162
                        case ControlType.ArrowTextBorderControl:
2163
                            {
2164
                                var control = currentControl as ArrowTextControl;
2165
2166
                                if (control != null)
2167
                                {
2168
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2169 5ce56a3a KangIngu
                                    Point tempPoint = control.EndPoint;
2170
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2171
                                    {
2172
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2173
                                        control.EndPoint = tempPoint;
2174
                                    }
2175
                                    else
2176
                                    {
2177
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2178
                                    }
2179 992a98b4 KangIngu
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2180 787a4489 KangIngu
                                    control.PointSet = new List<Point>
2181
                                            {
2182
                                                control.StartPoint,
2183
                                                control.MidPoint,
2184
                                                control.EndPoint,
2185
                                            };
2186
                                }
2187
2188
                            }
2189
                            break;
2190
                        case ControlType.ArrowTransTextBorderControl:
2191
                            {
2192
                                var control = currentControl as ArrowTextControl;
2193
2194
                                if (control != null)
2195
                                {
2196
                                    control.isFixed = true;
2197
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2198 5ce56a3a KangIngu
                                    Point tempPoint = control.EndPoint;
2199
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2200
                                    {
2201
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2202
                                        control.EndPoint = tempPoint;
2203
                                    }
2204
                                    else
2205
                                    {
2206
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2207
                                    }
2208 01cbc243 KangIngu
2209
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2210 787a4489 KangIngu
                                    control.PointSet = new List<Point>
2211
                                            {
2212
                                                control.StartPoint,
2213
                                                control.MidPoint,
2214
                                                control.EndPoint,
2215
                                            };
2216
                                }
2217
2218
                            }
2219
                            break;
2220
                        case ControlType.ArrowTextCloudControl:
2221
                            {
2222
                                var control = currentControl as ArrowTextControl;
2223
2224
                                if (control != null)
2225
                                {
2226
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2227 5ce56a3a KangIngu
                                    Point tempPoint = control.EndPoint;
2228
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2229
                                    {
2230
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2231
                                        control.EndPoint = tempPoint;
2232
                                    }
2233
                                    else
2234
                                    {
2235
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2236
                                    }
2237 992a98b4 KangIngu
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2238 787a4489 KangIngu
                                    control.PointSet = new List<Point>
2239
                                            {
2240
                                                control.StartPoint,
2241
                                                control.MidPoint,
2242
                                                control.EndPoint,
2243
                                            };
2244
                                }
2245
2246
                            }
2247
                            break;
2248
                        case ControlType.ArrowTransTextCloudControl:
2249
                            {
2250
                                var control = currentControl as ArrowTextControl;
2251
2252
                                if (control != null)
2253
                                {
2254
                                    control.isFixed = true;
2255
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2256 5ce56a3a KangIngu
                                    Point tempPoint = control.EndPoint;
2257
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2258
                                    {
2259
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2260
                                        control.EndPoint = tempPoint;
2261
                                    }
2262
                                    else
2263
                                    {
2264
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2265
                                    }
2266 01cbc243 KangIngu
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2267 787a4489 KangIngu
                                    control.PointSet = new List<Point>
2268
                                            {
2269
                                                control.StartPoint,
2270
                                                control.MidPoint,
2271
                                                control.EndPoint,
2272
                                            };
2273
                                }
2274
2275
                            }
2276
                            break;
2277
                        case ControlType.PolygonControl:
2278
                            {
2279 e54660e8 KangIngu
2280 787a4489 KangIngu
                                var control = currentControl as PolygonControl;
2281
2282
                                if (control != null)
2283
                                {
2284
                                    control.PointSet.RemoveAt(control.PointSet.Count - 1);
2285
                                    control.PointSet.Add(currentCanvasDrawingMouseMovePoint);
2286
                                    control.Paint = ViewerDataModel.Instance.paintSet;
2287
                                    control.SetPolyPath();
2288
                                    //강인구 추가
2289
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
2290
                                    control.Paint = ViewerDataModel.Instance.paintSet;
2291
                                }
2292
                            }
2293
                            break;
2294
                        //강인구 추가
2295
                        case ControlType.Sign:
2296
                            {
2297
                                var control = currentControl as SignControl;
2298
2299
                                if (control != null)
2300
                                {
2301
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2302
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2303
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2304
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2305
2306
                                    if (control.StartPoint != control.EndPoint && control.SignImage == null)
2307
                                    {
2308
                                        GetUserSign getUser = new GetUserSign();
2309
                                        var _sign = getUser.GetSign(App.ViewInfo.UserID, App.ViewInfo.ProjectNO);
2310
                                        byte[] imageBytes = System.Convert.FromBase64String(_sign);
2311
                                        System.IO.MemoryStream stream = new System.IO.MemoryStream();
2312
                                        stream.Write(imageBytes, 0, imageBytes.Length);
2313
                                        stream.Position = 0;
2314
                                        System.Drawing.Image img = System.Drawing.Image.FromStream(stream);
2315
                                        BitmapImage returnImage = new BitmapImage();
2316
                                        returnImage.BeginInit();
2317
                                        System.IO.MemoryStream ms = new System.IO.MemoryStream();
2318
                                        img.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
2319
                                        ms.Seek(0, System.IO.SeekOrigin.Begin);
2320
                                        returnImage.StreamSource = ms;
2321
                                        returnImage.EndInit();
2322
                                        stream.Close();
2323
2324
                                        control.SignImage = returnImage;
2325
                                    }
2326
                                    control.PointSet = new List<Point>
2327
                                        {
2328
                                            control.StartPoint,
2329
                                            control.LeftBottomPoint,
2330
                                            control.EndPoint,
2331
                                            control.TopRightPoint,
2332
                                        };
2333
                                }
2334
                            }
2335
                            break;
2336 5a9353a9 humkyung
                        //TODO: 강인구 추가
2337 787a4489 KangIngu
                        case ControlType.Symbol:
2338
                            {
2339
                                var control = currentControl as SymControl;
2340
2341
                                if (control != null)
2342
                                {
2343
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2344
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2345
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2346
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2347
                                    control.LineSize = ViewerDataModel.Instance.LineSize + 3;
2348
                                    control.StrokeColor = new SolidColorBrush(Colors.Red);
2349
2350
                                    if (control.StartPoint != control.EndPoint)
2351
                                    {
2352
                                        if (control.PathData == null)
2353
                                        {
2354
                                            using (StringToPathConverter Convert = new StringToPathConverter())
2355
                                            {
2356
                                                control.PathData = Convert.Convert("M-5,5L0,0L20,30L40,-20 ");
2357
                                            }
2358
                                        }
2359
                                    }
2360
2361
                                    control.PointSet = new List<Point>
2362
                                        {
2363
                                            control.StartPoint,
2364
                                            control.LeftBottomPoint,
2365
                                            control.EndPoint,
2366
                                            control.TopRightPoint,
2367
                                        };
2368
                                }
2369
                            }
2370
                            break;
2371 5a9353a9 humkyung
                        ///TODO: 
2372 787a4489 KangIngu
                        case ControlType.Stamp:
2373
                            {
2374
                                var control = currentControl as SymControlN;
2375
2376
                                if (control != null)
2377
                                {
2378
2379
                                    if (control.StartPoint == control.EndPoint)
2380
                                    {
2381 9a1ce1db KangIngu
                                        string appovalData = "";
2382 787a4489 KangIngu
2383 9a1ce1db KangIngu
                                        var xamlData = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString_NonPrefix(App.SystemInfo.STAMP);
2384 787a4489 KangIngu
                                        xamlData = xamlData.Replace("daelim", "DAELIM");
2385
2386 a0bab669 KangIngu
2387 787a4489 KangIngu
                                        //object obj = System.Windows.Markup.XamlReader.Load(xamlData);
2388
2389
                                        System.IO.MemoryStream stream = new System.IO.MemoryStream();
2390
                                        System.IO.StreamWriter writer = new System.IO.StreamWriter(stream);
2391
                                        writer.Write(xamlData);
2392
                                        writer.Flush();
2393
                                        stream.Position = 0;
2394
2395
                                        control.StrokeColor = new SolidColorBrush(Colors.Red);
2396
                                        object obj = System.Windows.Markup.XamlReader.Load(stream);
2397
                                        UIElement ob = obj as UIElement;
2398
2399
                                        //control.ApplyTemplate();
2400
2401
                                        control.SetViewBox();
2402 b200de5a KangIngu
                                        control.PathXathData = App.SystemInfo.STAMP;
2403 787a4489 KangIngu
                                        control.Base_ViewBox.Child = ob;
2404
                                    }
2405
2406
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2407
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2408
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2409
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2410
                                    //control.LineSize = ViewerDataModel.Instance.LineSize + 3;
2411
2412
2413
                                    control.PointSet = new List<Point>
2414
                                    {
2415
                                        control.StartPoint,
2416
                                        control.LeftBottomPoint,
2417
                                        control.EndPoint,
2418
                                        control.TopRightPoint,
2419
                                    };
2420
                                }
2421
                            }
2422
                            break;
2423
                        case ControlType.Mark:
2424
                            {
2425
                                var control = currentControl as RectangleControl;
2426
2427
                                if (control != null)
2428
                                {
2429
                                    if (move.mousemode == MouseMode.Drawing)
2430
                                    {
2431
                                        //move.control_Move(ControlList, true, moveX, moveY);
2432
                                    }
2433
                                    else
2434
                                    {
2435
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2436
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2437
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2438
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2439
2440
2441
                                        control.PointSet = new List<Point>
2442
                                    {
2443
                                        control.StartPoint,
2444
                                        control.LeftBottomPoint,
2445
                                        control.EndPoint,
2446
                                        control.TopRightPoint,
2447
                                    };
2448
                                    }
2449
2450
                                    //강인구 추가
2451
                                    control.Paint = PaintSet.Fill;
2452
                                }
2453
                            }
2454
                            break;
2455
                        case ControlType.PenControl:
2456
                            {
2457
                                stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y));
2458
                                //inkBoard.Strokes.Add(stroke);
2459
                            }
2460
                            break;
2461
                        default:
2462
                            break;
2463
                    }
2464
                }
2465
            }
2466 9f473fb7 KangIngu
            else if (mouseButtonDown == MouseButton.Left && mouseHandlingMode == MouseHandlingMode.Selecting || mouseButtonDown == MouseButton.Left && mouseHandlingMode == MouseHandlingMode.Capture || mouseButtonDown == MouseButton.Left && mouseHandlingMode == MouseHandlingMode.DragZoom)
2467 787a4489 KangIngu
            {
2468
                Point curMouseDownPoint = e.GetPosition(drawingRotateCanvas);
2469
2470
                if (isDraggingSelectionRect)
2471
                {
2472
                    UpdateDragSelectionRect(canvasDrawingMouseDownPoint, curMouseDownPoint);
2473
2474
                    e.Handled = true;
2475
                }
2476
                else if (isLeftMouseButtonDownOnWindow)
2477
                {
2478
                    var dragDelta = curMouseDownPoint - canvasDrawingMouseDownPoint;
2479
                    double dragDistance = Math.Abs(dragDelta.Length);
2480
2481
                    if (dragDistance > DragThreshold)
2482
                    {
2483
                        isDraggingSelectionRect = true;
2484
2485
                        InitDragSelectionRect(canvasDrawingMouseDownPoint, curMouseDownPoint);
2486
                    }
2487
2488
                    e.Handled = true;
2489
                }
2490
2491
2492
                if (canvasDrawingMouseDownPoint == curMouseDownPoint)
2493
                {
2494
                    //SelectionPath = new Path();
2495
                    //PathFigure pathFigure = new PathFigure();
2496
                    //SelectionPath.Fill = new SolidColorBrush(Colors.Yellow);
2497
                    //SelectionPath.Opacity = 0.5;
2498
                    //SelectionPath.StrokeDashArray = new DoubleCollection() { 1 };
2499
                    //SelectionPath.StrokeDashCap = PenLineCap.Round;
2500
                    //SelectionPath.Stroke = new SolidColorBrush(Colors.Black);
2501
                }
2502
                else
2503
                {
2504
                    //List<Stroke> removingStroke = new List<Stroke>();
2505
                    //Rect p1 = new Rect(canvasDrawingMouseDownPoint, curMouseDownPoint);
2506
                    //StrokeCollection stC = new StrokeCollection();
2507
                    //for (int i = 0; i <= inkBoard.Strokes.Count - 1; i++)
2508
                    //{
2509
                    //    Rect p2 = inkBoard.Strokes[i].GetBounds();
2510
                    //    p1.Intersect(p2);
2511
                    //    if (p1.IsEmpty)
2512
                    //    {
2513
2514
2515
                    //        p1 = SelectionPath.Data.Bounds;
2516
                    //        bool intersectCheck = false;
2517
                    //        foreach (var T in inkBoard.Strokes[i].StylusPoints)
2518
                    //        {
2519
                    //            Rect p3 = new Rect(new Point(T.X, T.Y), new Size(10, 10));
2520
                    //            p1.Intersect(p3);
2521
                    //            if (!p1.IsEmpty)
2522
                    //            {
2523
                    //                intersectCheck = true;
2524
                    //            }
2525
                    //        }
2526
                    //        if (intersectCheck)
2527
                    //        {
2528
                    //            removingStroke.Add(inkBoard.Strokes[i]);
2529
                    //        }
2530
2531
                    //    }
2532
                    //    else
2533
                    //    {
2534
                    //        removingStroke.Add(inkBoard.Strokes[i]);
2535
                    //    }
2536
                    //}
2537
2538
                    e.Handled = true;
2539
                }
2540
            }
2541
            else if (mouseButtonDown == MouseButton.Left && ViewerDataModel.Instance.MarkupControls_USER.Count > 0)
2542
            {
2543
                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
2544
                if (control != null)
2545
                {
2546
                    this.cursor = Cursors.Hand;
2547
                    SetCursor();
2548
                }
2549
                else
2550
                {
2551
                    this.cursor = Cursors.Arrow;
2552
                    SetCursor();
2553
                }
2554
            }
2555
            else
2556
            {
2557
                //var hitRect = new Rect(currentCanvasDrawingMouseMovePoint.X - 10, currentCanvasDrawingMouseMovePoint.Y - 10, 20, 20);
2558
2559
                //VisualTreeHelper.HitTest(this.drawingRotateCanvas, null, MyCallback,
2560
                //    new GeometryHitTestParameters(new RectangleGeometry(hitRect)));
2561
2562
                //if (hitList.Count > 0)
2563
                //{
2564
2565
                //}
2566
2567
                #region 조건 설정 : firstCondition
2568
                //GeneralTransform generalTransform = this.DeepLayer._BaseLayer.TransformToVisual(Application.Current.RootVisual);
2569
                //pnts = generalTransform.Transform(pnts);
2570
                //Rect areaInAbsoluteCoordinates = new Rect(pnts.X - 10, pnts.Y - 10, 20, 20);
2571
                //var firstCondition = (from kkk in VisualTreeHelper.FindElementsInHostCoordinates(areaInAbsoluteCoordinates,
2572
                //                               this.DeepLayer._BaseLayer).ToObservable()
2573
                //                      where String.IsNullOrEmpty((kkk as FrameworkElement).Name)
2574
                //                      select kkk).FirstOrDefault();
2575
2576
                //var canvas = LogicalTreeHelper.FindLogicalNode(this, "drawingRotateCanvas") as Canvas;
2577
                //if (canvas !=null)
2578
                //{
2579
                //    foreach (var item in (canvas.Children[0] as ItemsControl).Items)
2580
                //    {
2581
                //        UIElement uiElement = (UIElement)(canvas.Children[0] as ItemsControl).ItemContainerGenerator.ContainerFromItem(item);
2582
                //        if (uiElement!=null)
2583
                //        {
2584
                //            uiElement.InputHitTest(currentCanvasDrawingMouseMovePoint).
2585
                //        }
2586
                //    }
2587
                //}
2588
2589
                //EllipseGeometry expandedHitTestArea = new EllipseGeometry(currentCanvasDrawingMouseMovePoint, 10.0, 10.0);
2590
                //hitResultsList.Clear();
2591
2592
                #endregion
2593
            }
2594
        }
2595
2596 a1716fa5 KangIngu
        private void zoomAndPanControl2_MouseMove(object sender, MouseEventArgs e)
2597
        {
2598
            if ((mouseButtonDown == MouseButton.Middle) || (mouseButtonDown == MouseButton.Right))
2599
            {
2600
                SetCursor();
2601
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas2);
2602
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas2);
2603
2604
                Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
2605
2606
                ViewerDataModel.Instance.Sync_ContentOffsetX -= dragOffset.X;
2607
                ViewerDataModel.Instance.Sync_ContentOffsetY -= dragOffset.Y;
2608
2609
                if (Sync.IsChecked)
2610
                {
2611
                    zoomAndPanControl.ContentOffsetX = ViewerDataModel.Instance.Sync_ContentOffsetX;
2612
                    zoomAndPanControl.ContentOffsetY = ViewerDataModel.Instance.Sync_ContentOffsetY;
2613
                }
2614
            }
2615
        }
2616
2617 787a4489 KangIngu
        private List<CommentUserInfo> hitList = new List<CommentUserInfo>();
2618
2619
        private EllipseGeometry hitArea = new EllipseGeometry();
2620
2621
        private void zoomAndPanControl_MouseUp(object sender, MouseButtonEventArgs e)
2622
        {
2623
            IsDrawing = false;
2624
2625
            if (mouseHandlingMode != MouseHandlingMode.None)
2626
            {
2627
                if (mouseHandlingMode == MouseHandlingMode.Drawing)
2628
                {
2629
                    this.cursor = Cursors.Arrow;
2630
2631
                    SetCursor();
2632
2633
                    switch (controlType)
2634
                    {
2635
                        case ControlType.None:
2636
                            break;
2637
                        case ControlType.Rectangle:
2638
                            {
2639
2640
                            }
2641
                            break;
2642
                        case ControlType.PenControl:
2643
                            {
2644
2645
                            }
2646
                            break;
2647
                        default:
2648
                            break;
2649
                    }
2650
                }
2651 9f473fb7 KangIngu
                else if (mouseHandlingMode == MouseHandlingMode.Selecting && e.ChangedButton == MouseButton.Left || mouseHandlingMode == MouseHandlingMode.Capture && e.ChangedButton == MouseButton.Left || mouseHandlingMode == MouseHandlingMode.DragZoom && e.ChangedButton == MouseButton.Left)
2652 787a4489 KangIngu
                {
2653
                    if (isLeftMouseButtonDownOnWindow)
2654
                    {
2655
                        bool wasDragSelectionApplied = false;
2656
2657
                        if (isDraggingSelectionRect)
2658
                        {
2659
                            if (mouseHandlingMode == MouseHandlingMode.Capture)
2660
                            {
2661
                                dragCaptureBorder.Visibility = Visibility.Collapsed;
2662
                                mouseHandlingMode = MouseHandlingMode.None;
2663
                                Set_Capture();
2664
2665
                                ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed;
2666
                                ViewerDataModel.Instance.ViewVisible = Visibility.Visible;
2667
                                ViewerDataModel.Instance.Capture_Opacity = 0;
2668
                            }
2669 9f473fb7 KangIngu
                            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
2670 787a4489 KangIngu
                            {
2671
                                ApplyDragSelectionRect();
2672
                            }
2673 9f473fb7 KangIngu
                            else
2674
                            {
2675
                                double x = Canvas.GetLeft(dragZoomBorder);
2676
                                double y = Canvas.GetTop(dragZoomBorder);
2677
                                double width = dragZoomBorder.Width;
2678
                                double height = dragZoomBorder.Height;
2679
                                Rect dragRect = new Rect(x, y, width, height);
2680
2681
                                ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.ZoomTo(dragRect);
2682
2683
                                dragZoomBorder.Visibility = Visibility.Collapsed;
2684
                            }
2685 787a4489 KangIngu
2686 9f473fb7 KangIngu
                            isDraggingSelectionRect = false;
2687 787a4489 KangIngu
                            e.Handled = true;
2688
                            wasDragSelectionApplied = true;
2689
                        }
2690
2691
                        if (isLeftMouseButtonDownOnWindow)
2692
                        {
2693
                            isLeftMouseButtonDownOnWindow = false;
2694
                            this.ReleaseMouseCapture();
2695
                            e.Handled = true;
2696
                        }
2697
2698
                        if (!wasDragSelectionApplied)
2699
                        {
2700
                            init();
2701
                        }
2702
                    }
2703
                }
2704
                else if (mouseButtonDown == MouseButton.Right)
2705
                {
2706
                    this.cursor = Cursors.Arrow;
2707
                    SetCursor();
2708
                }
2709
2710
                zoomAndPanControl.ReleaseMouseCapture();
2711
2712
2713
                e.Handled = true;
2714
            }
2715
            else
2716
            {
2717
                this.cursor = Cursors.Arrow;
2718
                SetCursor();
2719
            }
2720
            mouseButtonDown = MouseButton.Left;
2721
2722
            //controlType = ControlType.SingleLine;
2723
        }
2724
2725 a1716fa5 KangIngu
        private void zoomAndPanControl2_MouseUp(object sender, MouseButtonEventArgs e)
2726
        {
2727
            mouseButtonDown = MouseButton.Left;
2728
        }
2729
2730 787a4489 KangIngu
        private void zoomAndPanControl_MouseLeave(object sender, MouseEventArgs e)
2731
        {
2732
            mouseButtonDown = MouseButton.Left;
2733
            this.Cursor = Cursors.Arrow;
2734
        }
2735
2736
        private void zoomAndPanControl_MouseDoubleClick(object sender, MouseButtonEventArgs e)
2737
        {
2738
2739
        }
2740
2741 2aaf9645 humkyung
        /// <summary>
2742
        /// select item which's bouding rectangle is equal to given rectangle
2743
        /// </summary>
2744
        /// <author>humkyung</author>
2745
        /// <date>2018.06.14</date>
2746
        /// <param name="rect"></param>
2747
        public void SelecteItemByRect(Rect rect)
2748
        {
2749
            multi_Undo_Data = new Multi_Undo_data();
2750
2751
            UndoData = new Undo_data()
2752
            {
2753
                IsUndo = false,
2754
                Event = Event_Type.Select,
2755
                EventTime = DateTime.Now,
2756
                Markup_List = new List<Multi_Undo_data>()
2757
            };
2758
           
2759
            var Items = ViewerDataModel.Instance.MarkupControls_USER.ToList();
2760
2761
            CommentUserInfo selected = null;
2762
            double dMinDiff = double.MaxValue;
2763
            Move tmp = new Move();
2764
            foreach (var item in Items)
2765
            {
2766
                Rect boundingBox = tmp.ItemRect(item);
2767
                double dx = rect.X - boundingBox.X;
2768
                double dy = rect.Y - boundingBox.Y;
2769
                double dxx = rect.Right - boundingBox.Right;
2770
                double dyy = rect.Bottom - boundingBox.Bottom;
2771
                double dDiff = Math.Sqrt(dx * dx + dy * dy + dxx * dxx + dyy * dyy);
2772
                if (dDiff < dMinDiff)
2773
                {
2774
                    dMinDiff = dDiff;
2775
                    selected = item;
2776
                }
2777
            }
2778
2779
            if (selected != null)
2780
            {
2781
                this.ReleaseAdorner();
2782
2783
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2784
                adornerSet.Add(selected);
2785
                ViewerDataModel.Instance.MarkupControls_USER.Remove(selected);
2786
2787
                Control_Style(selected);
2788
                UndoData.Markup_List.Add(multi_Undo_Data);
2789
                multi_Undo_Data = new Multi_Undo_data();
2790
2791
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
2792
                {
2793
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2794
                });
2795
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2796
2797
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2798
                SelectLayer.Children.Add(final);
2799
            }
2800
        }
2801
2802 787a4489 KangIngu
        private void ApplyDragSelectionRect()
2803
        {
2804
            multi_Undo_Data = new Multi_Undo_data();
2805
2806
            UndoData = new Undo_data()
2807
            {
2808
                IsUndo = false,
2809
                Event = Event_Type.Select,
2810
                EventTime = DateTime.Now,
2811
                Markup_List = new List<Multi_Undo_data>()
2812
            };
2813
2814
            dragSelectionBorder.Visibility = Visibility.Collapsed;
2815
2816
            double x = Canvas.GetLeft(dragSelectionBorder);
2817
            double y = Canvas.GetTop(dragSelectionBorder);
2818
            double width = dragSelectionBorder.Width;
2819
            double height = dragSelectionBorder.Height;
2820
            Rect dragRect = new Rect(x, y, width, height);
2821
            Boolean Flag = false;
2822
            dragRect.Inflate(width / 10, height / 10);
2823
            List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2824
            var Items = ViewerDataModel.Instance.MarkupControls_USER.ToList();
2825
2826
            dragRect = new Rect(x, y, width, height);
2827
            dragRect.Inflate(width / 10, height / 10);
2828
2829
            foreach (var item in Items)
2830
            {
2831
                Flag = move.control_Select(item, dragRect);
2832
2833
                if (Flag)
2834
                {
2835
                    adornerSet.Add(item);
2836
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(item);
2837
2838
                    Control_Style(item);
2839
                    UndoData.Markup_List.Add(multi_Undo_Data);
2840
                    multi_Undo_Data = new Multi_Undo_data();
2841
                }
2842
            }
2843
            if (adornerSet.Count > 0)
2844
            {
2845
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
2846
                {
2847
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2848
                });
2849
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2850
2851
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2852
                SelectLayer.Children.Add(final);
2853
            }
2854
        }
2855
2856
        private void InitDragSelectionRect(Point pt1, Point pt2)
2857
        {
2858 9f473fb7 KangIngu
            //캡쳐 중
2859
            if (mouseHandlingMode == MouseHandlingMode.Capture)
2860
            {
2861
                dragCaptureBorder.Visibility = Visibility.Visible;
2862
            }
2863 787a4489 KangIngu
            //선택 중
2864 9f473fb7 KangIngu
            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
2865 787a4489 KangIngu
            {
2866 e54660e8 KangIngu
2867 787a4489 KangIngu
                dragSelectionBorder.Visibility = Visibility.Visible;
2868
            }
2869
            else
2870
            {
2871 9f473fb7 KangIngu
                dragZoomBorder.Visibility = Visibility.Visible;
2872 787a4489 KangIngu
            }
2873
            UpdateDragSelectionRect(pt1, pt2);
2874
        }
2875
2876
        /// <summary>
2877
        /// Update the position and size of the rectangle used for drag selection.
2878
        /// </summary>
2879
        private void UpdateDragSelectionRect(Point pt1, Point pt2)
2880
        {
2881
            double x, y, width, height;
2882
2883
            //
2884
            // Determine x,y,width and height of the rect inverting the points if necessary.
2885
            // 
2886
2887
            if (pt2.X < pt1.X)
2888
            {
2889
                x = pt2.X;
2890
                width = pt1.X - pt2.X;
2891
            }
2892
            else
2893
            {
2894
                x = pt1.X;
2895
                width = pt2.X - pt1.X;
2896
            }
2897
2898
            if (pt2.Y < pt1.Y)
2899
            {
2900
                y = pt2.Y;
2901
                height = pt1.Y - pt2.Y;
2902
            }
2903
            else
2904
            {
2905
                y = pt1.Y;
2906
                height = pt2.Y - pt1.Y;
2907
            }
2908
2909
            //
2910
            // Update the coordinates of the rectangle used for drag selection.
2911
            //
2912 9f473fb7 KangIngu
            //캡쳐 중
2913
            if (mouseHandlingMode == MouseHandlingMode.Capture)
2914
            {
2915
                Canvas.SetLeft(dragCaptureBorder, x);
2916
                Canvas.SetTop(dragCaptureBorder, y);
2917
                dragCaptureBorder.Width = width;
2918
                dragCaptureBorder.Height = height;
2919
            }
2920 787a4489 KangIngu
            //선택 중
2921 a1716fa5 KangIngu
            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
2922 787a4489 KangIngu
            {
2923
                Canvas.SetLeft(dragSelectionBorder, x);
2924
                Canvas.SetTop(dragSelectionBorder, y);
2925
                dragSelectionBorder.Width = width;
2926
                dragSelectionBorder.Height = height;
2927
            }
2928
            else
2929
            {
2930 9f473fb7 KangIngu
                Canvas.SetLeft(dragZoomBorder, x);
2931
                Canvas.SetTop(dragZoomBorder, y);
2932
                dragZoomBorder.Width = width;
2933
                dragZoomBorder.Height = height;
2934 787a4489 KangIngu
            }
2935
        }
2936
2937
        public bool IsSelectionControl(Rect dragRect, Rect controlRect, Geometry OverViewPathData, ControlType type)
2938
        {
2939
            //// X, Y, WIDTH, HEIGHT 형태로 RECT를 만든다.
2940
2941
            bool result = false;
2942
            if (dragRect.Contains(controlRect))
2943
            {
2944
                result = true;
2945
                //잡은 객체들을 담은 리스트
2946
                try
2947
                {
2948
                    selected_item.Add(OverViewPathData, type.ToString());
2949
                }
2950
                catch (Exception)
2951
                {
2952
2953
                }
2954
            }
2955
            return result;
2956
        }
2957
2958
        private void drawingPannelRotate(double angle)
2959
        {
2960
            rotate.Angle = angle;
2961
            var rotationNum = Math.Abs((rotate.Angle / 90));
2962
2963
            if (angle == 90 || angle == 270)
2964
            {
2965
                double emptySize = zoomAndPanCanvas.Width;
2966
                zoomAndPanCanvas.Width = zoomAndPanCanvas.Height;
2967
                zoomAndPanCanvas.Height = emptySize;
2968
            }
2969
            if (angle == 0)
2970
            {
2971
                translate.X = 0;
2972
                translate.Y = 0;
2973
            }
2974
            else if (angle == 90)
2975
            {
2976
                translate.X = zoomAndPanCanvas.Width;
2977
                translate.Y = 0;
2978
            }
2979
            else if (angle == 180)
2980
            {
2981
                translate.X = zoomAndPanCanvas.Width;
2982
                translate.Y = zoomAndPanCanvas.Height;
2983
            }
2984
            else
2985
            {
2986
                translate.X = 0;
2987
                translate.Y = zoomAndPanCanvas.Height;
2988
            }
2989
2990
            zoomAndPanControl.RotationAngle = rotate.Angle;
2991
2992
2993
            if (!testPanel2.IsHidden)
2994
            {
2995
                zoomAndPanControl2.RotationAngle = rotate.Angle;
2996
                zoomAndPanCanvas2.Width = zoomAndPanCanvas.Width;
2997
                zoomAndPanCanvas2.Height = zoomAndPanCanvas.Height;
2998
            }
2999
3000
            ViewerDataModel.Instance.ContentWidth = zoomAndPanCanvas.Width;
3001
            ViewerDataModel.Instance.ContentHeight = zoomAndPanCanvas.Height;
3002
            ViewerDataModel.Instance.AngleOffsetX = translate.X;
3003
            ViewerDataModel.Instance.AngleOffsetY = translate.Y;
3004
            ViewerDataModel.Instance.Angle = rotate.Angle;
3005
        }
3006
3007
        private void zoomAndPanControl_MouseDown(object sender, MouseButtonEventArgs e)
3008
        {
3009 992a98b4 KangIngu
            var set_option = this.ParentOfType<MainWindow>().dzTopMenu.Parent.ChildrenOfType<RadNumericUpDown>().Where(item => item.IsKeyboardFocusWithin).FirstOrDefault();
3010 be04d12c djkim
            if (set_option != null && !string.IsNullOrEmpty(set_option.ContentText))
3011 992a98b4 KangIngu
            {
3012
                set_option.Value = double.Parse(set_option.ContentText);
3013
            }
3014
3015 787a4489 KangIngu
            InkControl_Convert();
3016
3017
            var text_item = ViewerDataModel.Instance.MarkupControls_USER.Where(data =>
3018
            (data as TextControl) != null && (data as TextControl).Text == "" || (data as ArrowTextControl) != null && (data as ArrowTextControl).ArrowText == "").FirstOrDefault();
3019
3020 a1716fa5 KangIngu
            if (text_item != null && (currentControl as ArrowTextControl) == null)
3021 787a4489 KangIngu
            {
3022
                ViewerDataModel.Instance.MarkupControls_USER.Remove(text_item);
3023
            }
3024
3025
            foreach (var arrow_text in ViewerDataModel.Instance.MarkupControls_USER)
3026
            {
3027
                if (arrow_text as ArrowTextControl != null)
3028
                {
3029
                    (arrow_text as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3030
                }
3031
            }
3032
3033 32e95118 KangIngu
            mouseButtonDown = e.ChangedButton;
3034
            /// complete drawing text control when user click mouse right button - 2018.05.14 added by humkyung
3035 e54660e8 KangIngu
3036 49b217ad humkyung
            //if (currentControl != null)
3037 787a4489 KangIngu
            {
3038
                var text_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as TextControl) != null && (data as TextControl).Base_TextBox.Visibility == Visibility.Visible).FirstOrDefault();
3039
                if (text_item_ != null)
3040
                {
3041
                    (text_item_ as TextControl).Base_TextBlock.Visibility = Visibility.Visible;
3042
                    (text_item_ as TextControl).Base_TextBox.Visibility = Visibility.Collapsed;
3043
                    (text_item_ as TextControl).IsEditing = false;
3044
                    (text_item_ as TextControl).EnableEditing = false;
3045 49b217ad humkyung
                    currentControl = null;
3046 787a4489 KangIngu
                }
3047
3048
                var Arrowtext_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as ArrowTextControl) != null && (data as ArrowTextControl).IsEditingMode == true).FirstOrDefault();
3049 49b217ad humkyung
                if (Arrowtext_item_ != null && ((Arrowtext_item_ as ArrowTextControl).IsNew == false))
3050 787a4489 KangIngu
                {
3051
                    (Arrowtext_item_ as ArrowTextControl).IsEditingMode = false;
3052
                    (Arrowtext_item_ as ArrowTextControl).Base_TextBox.Focusable = false;
3053 49b217ad humkyung
                    currentControl = null;
3054 787a4489 KangIngu
                }
3055
            }
3056
3057 ca40e004 ljiyeon
            double Ang = 0;                                          
3058 787a4489 KangIngu
            if (rotate.Angle != 0)
3059
            {
3060
                Ang = 360 - rotate.Angle;
3061
            }
3062
            move = new Move();
3063
3064
            if (e.OriginalSource is System.Windows.Controls.Image)
3065
            {
3066
                (e.OriginalSource as System.Windows.Controls.Image).Focus();
3067
            }
3068 e54660e8 KangIngu
3069 787a4489 KangIngu
            if (mouseButtonDown == MouseButton.Left)
3070
            {
3071
                canvasDrawingMouseDownPoint = e.GetPosition(drawingRotateCanvas);
3072
                canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
3073
3074
                this.cursor = Cursors.Arrow;
3075
                SetCursor();
3076
3077
                if (!ViewerDataModel.Instance.IsPressCtrl)
3078
                {
3079
                    ReleaseAdorner();
3080
                }
3081
            }
3082
            if (mouseButtonDown == MouseButton.Middle)
3083
            {
3084
                canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
3085
                cursor = Cursors.SizeAll;
3086
                SetCursor();
3087
            }
3088
            if (mouseButtonDown == MouseButton.Right)
3089
            {
3090
                canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
3091
                cursor = Cursors.SizeAll;
3092
                SetCursor();
3093
            }
3094
            else if (mouseButtonDown == MouseButton.XButton1)
3095
            {
3096
                if (this.pageNavigator.CurrentPage.PageNumber + 1 <= this.pageNavigator.PageCount)
3097
                {
3098
                    this.pageNavigator.GotoPage(this.pageNavigator._NextPage.PageNumber + 1);
3099
                }
3100
3101
                this.pageNavigator.GotoPage(this.pageNavigator._NextPage.PageNumber);
3102
3103
            }
3104
            else if (mouseButtonDown == MouseButton.XButton2)
3105
            {
3106
                if (this.pageNavigator.CurrentPage.PageNumber > 1)
3107
                {
3108
                    this.pageNavigator.GotoPage(this.pageNavigator.CurrentPage.PageNumber - 1);
3109
                }
3110
            }
3111
3112 9f473fb7 KangIngu
            //if (mouseButtonDown == MouseButton.Left && ViewerDataModel.Instance.MarkupControls_USER.Count > 0 && mouseHandlingMode != MouseHandlingMode.Drawing && currentControl == null)
3113
            if (mouseButtonDown == MouseButton.Left && mouseHandlingMode != MouseHandlingMode.Drawing && currentControl == null)
3114 787a4489 KangIngu
            {
3115
                if (mouseHandlingMode == MouseHandlingMode.Selecting)
3116
                {
3117
                    if (SelectLayer.Children.Count == 0)
3118
                    {
3119
                        isLeftMouseButtonDownOnWindow = true;
3120
                        mouseHandlingMode = MouseHandlingMode.Selecting;
3121
                    }
3122
3123
                    if (controlType == ControlType.None)
3124
                    {
3125
                        isLeftMouseButtonDownOnWindow = true;
3126
                    }
3127
                }
3128
3129 9f473fb7 KangIngu
                //캡쳐 모드 설정
3130
                if (mouseHandlingMode == MouseHandlingMode.Capture)
3131
                {
3132
                    dragCaptureBorder.Visibility = Visibility.Visible;
3133
                    isLeftMouseButtonDownOnWindow = true;
3134
                }
3135
3136
                //줌 모드 설정
3137
                if (mouseHandlingMode == MouseHandlingMode.DragZoom)
3138
                {
3139
                    //dragSelectionBorder.Visibility = Visibility.Visible;
3140
                    isLeftMouseButtonDownOnWindow = true;
3141 6707a5c7 ljiyeon
                }               
3142 787a4489 KangIngu
3143
                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
3144
                if (control != null)
3145
                {
3146
                    //강인구 추가 컨트롤 누르고 멀티 선택(다시확인필요)
3147
                    AdornerFinal final;
3148
                    List<Point> p_set = new List<Point>();
3149
                    List<CommentUserInfo> comment = new List<CommentUserInfo>();
3150
                    ViewerDataModel.Instance.MarkupControls.Remove(control);
3151
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(control);
3152
                    multi_Undo_Data = new Multi_Undo_data();
3153
3154
                    //강인구 Undo/Redo 보류
3155
                    UndoData = new Undo_data()
3156
                    {
3157
                        IsUndo = false,
3158
                        Event = Event_Type.Select,
3159
                        EventTime = DateTime.Now,
3160
                        Markup_List = new List<Multi_Undo_data>()
3161
                    };
3162
3163
                    if (!ViewerDataModel.Instance.IsPressCtrl)
3164
                    {
3165
                        ReleaseAdorner();
3166
                        final = new AdornerFinal(control);
3167
                        //단일 컨트롤 언두 저장
3168
3169
                        Control_Style(control);
3170
                        UndoData.Markup_List.Add(multi_Undo_Data);
3171
3172
                        if ((control as IPath) != null)
3173
                        {
3174
                            if ((control as IPath).LineSize != 0)
3175
                            {
3176
                                ViewerDataModel.Instance.LineSize = (control as IPath).LineSize;
3177
                            }
3178
                        }
3179
                        if ((control as IShapeControl) != null)
3180
                        {
3181
                            if ((control as IShapeControl).Paint == PaintSet.Hatch)
3182
                            {
3183
                                ViewerDataModel.Instance.checkHatchShape = true;
3184
                            }
3185
                            else if ((control as IShapeControl).Paint == PaintSet.Fill)
3186
                            {
3187
                                ViewerDataModel.Instance.checkFillShape = true;
3188
                            }
3189
                            else
3190
                            {
3191
                                ViewerDataModel.Instance.checkHatchShape = false;
3192
                                ViewerDataModel.Instance.checkFillShape = false;
3193
                            }
3194
                            ViewerDataModel.Instance.paintSet = (control as IShapeControl).Paint;
3195
                        }
3196 9f473fb7 KangIngu
3197 787a4489 KangIngu
                        ViewerDataModel.Instance.ControlOpacity = control.Opacity;
3198 d4b0c723 KangIngu
3199
                        if ((control as TextControl) != null)
3200
                        {
3201
                            if ((control as TextControl).TextStyle == FontStyles.Italic)
3202
                            {
3203
                                ViewerDataModel.Instance.checkTextStyle = true;
3204
                            }
3205
                            else
3206
                            {
3207
                                ViewerDataModel.Instance.checkTextStyle = false;
3208
                            }
3209
3210
                            if ((control as TextControl).TextStyle == FontStyles.Italic)
3211
                            {
3212
                                ViewerDataModel.Instance.checkTextStyle = true;
3213
                            }
3214
                            else
3215
                            {
3216
                                ViewerDataModel.Instance.checkTextStyle = false;
3217
                            }
3218
                            if ((control as TextControl).TextWeight == FontWeights.Bold)
3219
                            {
3220
                                ViewerDataModel.Instance.checkTextWeight = true;
3221
                            }
3222
                            else
3223
                            {
3224
                                ViewerDataModel.Instance.checkTextWeight = false;
3225
                            }
3226
                            if ((control as TextControl).UnderLine == TextDecorations.Underline)
3227
                            {
3228
                                ViewerDataModel.Instance.checkUnderLine = true;
3229
                            }
3230
                            else
3231
                            {
3232
                                ViewerDataModel.Instance.checkUnderLine = false;
3233
                            }
3234
                            ViewerDataModel.Instance.TextSize = (control as TextControl).TextSize;
3235
                            ViewerDataModel.Instance.checkHighlight = (control as TextControl).IsHighLight;
3236 e54660e8 KangIngu
3237 d4b0c723 KangIngu
                        }
3238
                        else if ((control as ArrowTextControl) != null)
3239
                        {
3240 e17af42b KangIngu
                            if ((control as ArrowTextControl).TextStyle == FontStyles.Italic)
3241 d4b0c723 KangIngu
                            {
3242 e17af42b KangIngu
                                ViewerDataModel.Instance.checkTextStyle = true;
3243
                            }
3244
                            else
3245
                            {
3246
                                ViewerDataModel.Instance.checkTextStyle = false;
3247
                            }
3248
3249
                            if ((control as ArrowTextControl).TextStyle == FontStyles.Italic)
3250
                            {
3251
                                ViewerDataModel.Instance.checkTextStyle = true;
3252 d4b0c723 KangIngu
                            }
3253 e17af42b KangIngu
                            else
3254 d4b0c723 KangIngu
                            {
3255 e17af42b KangIngu
                                ViewerDataModel.Instance.checkTextStyle = false;
3256 d4b0c723 KangIngu
                            }
3257 e17af42b KangIngu
                            if ((control as ArrowTextControl).TextWeight == FontWeights.Bold)
3258 d4b0c723 KangIngu
                            {
3259 e17af42b KangIngu
                                ViewerDataModel.Instance.checkTextWeight = true;
3260
                            }
3261
                            else
3262
                            {
3263
                                ViewerDataModel.Instance.checkTextWeight = false;
3264
                            }
3265
                            if ((control as ArrowTextControl).UnderLine == TextDecorations.Underline)
3266
                            {
3267
                                ViewerDataModel.Instance.checkUnderLine = true;
3268
                            }
3269
                            else
3270
                            {
3271
                                ViewerDataModel.Instance.checkUnderLine = false;
3272 d4b0c723 KangIngu
                            }
3273
                            ViewerDataModel.Instance.checkHighlight = (control as ArrowTextControl).isHighLight;
3274
                            ViewerDataModel.Instance.TextSize = (control as ArrowTextControl).TextSize;
3275
                        }
3276 9f473fb7 KangIngu
                        else if ((control as RectCloudControl) != null)
3277
                        {
3278
                            ViewerDataModel.Instance.ArcLength = (control as RectCloudControl).ArcLength;
3279
                        }
3280
                        else if ((control as CloudControl) != null)
3281
                        {
3282
                            ViewerDataModel.Instance.ArcLength = (control as CloudControl).ArcLength;
3283
                        }
3284 d4b0c723 KangIngu
3285 787a4489 KangIngu
                    }
3286
                    else
3287
                    {
3288
                        comment = AddAdorner();
3289
                        comment.Add(control);
3290
3291
                        Control_Style(control);
3292
                        UndoData.Markup_List.Add(multi_Undo_Data);
3293
3294
                        final = new AdornerFinal(comment);
3295
                        //다중 컨트롤 언두 저장
3296
                    }
3297
3298
                    ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
3299
                    {
3300
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
3301
                    });
3302
3303
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
3304
3305
                    SelectLayer.Children.Add(final);
3306 6707a5c7 ljiyeon
                }              
3307 787a4489 KangIngu
            }
3308
            else if (mouseHandlingMode == MouseHandlingMode.Drawing)
3309 6707a5c7 ljiyeon
            {               
3310 787a4489 KangIngu
                init();
3311
                //강인구 추가(우 클릭 일 경우 커서 변경 하지 않음)
3312
                if (cursor != Cursors.SizeAll)
3313
                {
3314
                    cursor = Cursors.Cross;
3315
                    SetCursor();
3316
                }
3317
                bool init_user = false;
3318
                foreach (var user in gridViewMarkup.Items)
3319
                {
3320
                    if ((user as MarkupInfoItem).UserID == App.ViewInfo.UserID)
3321
                    {
3322
                        init_user = true;
3323
                    }
3324
                }
3325
                if (init_user && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null && e.LeftButton == MouseButtonState.Pressed)
3326
                {
3327
                    RadWindow.Alert(new DialogParameters
3328
                    {
3329
                        Theme = new VisualStudio2013Theme(),
3330
                        Header = "안내",
3331
                        Content = "기존의 코멘트가 존재합니다. 사용자 리스트에서 먼저 선택해주세요",
3332
                    });
3333
                    return;
3334
                }
3335
                else
3336
                {
3337
                    var item = gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() as MarkupInfoItem;
3338
                    if (item != null)
3339
                    {
3340
                        App.Custom_ViewInfoId = item.MarkupInfoID;
3341
                    }
3342
                }
3343
3344
                multi_Undo_Data = new Multi_Undo_data();
3345
                //강인구 Undo/Redo 보류
3346
                UndoData = new Undo_data()
3347
                {
3348
                    IsUndo = false,
3349
                    Event = Event_Type.Create,
3350
                    EventTime = DateTime.Now,
3351
                    Markup_List = new List<Multi_Undo_data>()
3352
                };
3353
3354 ca40e004 ljiyeon
                 switch (controlType)
3355 787a4489 KangIngu
                {
3356
                    case ControlType.Rectangle:
3357
                        {
3358
                            if (mouseButtonDown == MouseButton.Left)
3359
                            {
3360 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3361
                                //{
3362 787a4489 KangIngu
                                    if (currentControl is RectangleControl)
3363
                                    {
3364 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
3365
                                        if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3366 e66f22eb KangIngu
                                        {
3367
                                            return;
3368
                                        }
3369
3370 787a4489 KangIngu
                                        CreateControl();
3371
3372
                                        (currentControl as RectangleControl).ApplyOverViewData();
3373
                                        currentControl = null;
3374
                                        this.cursor = Cursors.Arrow;
3375
                                    }
3376
                                    else
3377
                                    {
3378
                                        currentControl = new RectangleControl
3379
                                        {
3380
                                            Background = new SolidColorBrush(Colors.Black),
3381
                                            ControlType = ControlType.Rectangle
3382
                                        };
3383
3384
                                        currentControl.CommentID = Save.shortGuid();
3385
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3386
                                        currentControl.IsNew = true;
3387
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3388
3389
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3390
                                    }
3391 e66f22eb KangIngu
                                //}
3392 787a4489 KangIngu
                            }
3393
                        }
3394
                        break;
3395
                    case ControlType.RectCloud:
3396
                        {
3397
                            if (mouseButtonDown == MouseButton.Left)
3398
                            {
3399 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3400
                                //{
3401 787a4489 KangIngu
                                    if (currentControl is RectCloudControl)
3402
                                    {
3403 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
3404
                                        if (IsGetoutpoint((currentControl as RectCloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3405 e66f22eb KangIngu
                                        {
3406
                                            return;
3407
                                        }
3408
3409 787a4489 KangIngu
                                        CreateControl();
3410
3411
                                        (currentControl as RectCloudControl).ApplyOverViewData();
3412
                                        currentControl = null;
3413
                                        this.cursor = Cursors.Arrow;
3414
                                    }
3415
                                    else
3416
                                    {
3417
                                        currentControl = new RectCloudControl
3418
                                        {
3419
                                            Background = new SolidColorBrush(Colors.Black)
3420
                                        };
3421
3422
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3423
                                        currentControl.CommentID = Save.shortGuid();
3424
                                        currentControl.IsNew = true;
3425
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3426
                                    }
3427 e66f22eb KangIngu
                                //}
3428 787a4489 KangIngu
                            }
3429
                        }
3430
                        break;
3431
                    case ControlType.Circle:
3432
                        {
3433
                            if (mouseButtonDown == MouseButton.Left)
3434
                            {
3435 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3436
                                //{
3437 787a4489 KangIngu
                                    if (currentControl is CircleControl)
3438
                                    {
3439 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
3440
                                        if (IsGetoutpoint((currentControl as CircleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3441 e66f22eb KangIngu
                                        {
3442
                                            return;
3443
                                        }
3444
3445 787a4489 KangIngu
                                        CreateControl();
3446
3447
                                        (currentControl as CircleControl).ApplyOverViewData();
3448
                                        currentControl = null;
3449
                                    }
3450
                                    else
3451
                                    {
3452
                                        currentControl = new CircleControl
3453
                                        {
3454
                                            Background = new SolidColorBrush(Colors.Black)
3455
                                        };
3456
3457
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3458
                                        currentControl.CommentID = Save.shortGuid();
3459
                                        currentControl.IsNew = true;
3460
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3461
                                    }
3462 e66f22eb KangIngu
                                //}
3463 787a4489 KangIngu
                            }
3464
                        }
3465
                        break;
3466
                    case ControlType.Triangle:
3467
                        {
3468
                            if (mouseButtonDown == MouseButton.Left)
3469
                            {
3470 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3471
                                //{
3472 787a4489 KangIngu
                                    if (currentControl is TriControl)
3473
                                    {
3474
                                        var content = currentControl as TriControl;
3475
                                        if (content.MidPoint == new Point(0, 0))
3476
                                        {
3477
                                            content.MidPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
3478
                                        }
3479
                                        else
3480
                                        {
3481 ca40e004 ljiyeon
                                            //20180906 LJY TEST IsRotationDrawingEnable
3482
                                            if (IsGetoutpoint((currentControl as TriControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3483 e66f22eb KangIngu
                                            {
3484
                                                return;
3485
                                            }
3486
3487 787a4489 KangIngu
                                            CreateControl();
3488
3489
                                            (currentControl as TriControl).ApplyOverViewData();
3490
                                            currentControl = null;
3491
                                        }
3492
                                    }
3493
                                    else
3494
                                    {
3495
                                        currentControl = new TriControl
3496
                                        {
3497
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3498
                                            Background = new SolidColorBrush(Colors.Black),
3499
                                        };
3500
3501
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3502
                                        currentControl.CommentID = Save.shortGuid();
3503
                                        currentControl.IsNew = true;
3504
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3505
                                    }
3506 e66f22eb KangIngu
                                //}
3507 787a4489 KangIngu
                            }
3508
                        }
3509
                        break;
3510
                    case ControlType.SingleLine:
3511
                        {
3512
                            if (mouseButtonDown == MouseButton.Left)
3513
                            {
3514 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3515
                                //{
3516 787a4489 KangIngu
                                    if (currentControl is LineControl)
3517
                                    {
3518 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
3519
                                        if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3520 e66f22eb KangIngu
                                        {
3521
                                            return;
3522
                                        }
3523
3524 787a4489 KangIngu
                                        CreateControl();
3525
3526
                                        (currentControl as LineControl).ApplyOverViewData();
3527
                                        currentControl = null;
3528 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3529 787a4489 KangIngu
                                    }
3530
                                    else
3531
                                    {
3532
                                        currentControl = new LineControl
3533
                                        {
3534
                                            Background = new SolidColorBrush(Colors.Black)
3535
                                        };
3536
3537
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3538
                                        currentControl.CommentID = Save.shortGuid();
3539
                                        currentControl.IsNew = true;
3540
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3541 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Visible;
3542 787a4489 KangIngu
                                    }
3543 e66f22eb KangIngu
                                //}
3544 787a4489 KangIngu
                            }
3545
                        }
3546
                        break;
3547
                    case ControlType.CancelLine:
3548
                        {
3549
                            if (mouseButtonDown == MouseButton.Left)
3550
                            {
3551 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3552
                                //{
3553 787a4489 KangIngu
                                    if (currentControl is LineControl)
3554
                                    {
3555 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
3556
                                        if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3557 e66f22eb KangIngu
                                        {
3558
                                            return;
3559
                                        }
3560
3561 787a4489 KangIngu
                                        CreateControl();
3562
3563
                                        (currentControl as LineControl).ApplyOverViewData();
3564
                                        currentControl = null;
3565 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3566 787a4489 KangIngu
                                    }
3567
                                    else
3568
                                    {
3569
                                        currentControl = new LineControl
3570
                                        {
3571
                                            Background = new SolidColorBrush(Colors.Black)
3572
                                        };
3573
3574
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3575
                                        currentControl.CommentID = Save.shortGuid();
3576
                                        currentControl.IsNew = true;
3577
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3578 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Visible;
3579 787a4489 KangIngu
                                    }
3580 e66f22eb KangIngu
                                //}
3581 787a4489 KangIngu
                            }
3582
                        }
3583
                        break;
3584
                    case ControlType.ArrowLine:
3585
                        {
3586
                            if (mouseButtonDown == MouseButton.Left)
3587
                            {
3588 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3589
                                //{
3590 787a4489 KangIngu
                                    if (currentControl is LineControl)
3591
                                    {
3592 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
3593
                                        if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3594 e66f22eb KangIngu
                                        {
3595
                                            return;
3596
                                        }
3597
3598 787a4489 KangIngu
                                        CreateControl();
3599
3600
                                        (currentControl as LineControl).ApplyOverViewData();
3601
                                        currentControl = null;
3602 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3603 787a4489 KangIngu
                                    }
3604
                                    else
3605
                                    {
3606
                                        currentControl = new LineControl
3607
                                        {
3608
                                            Background = new SolidColorBrush(Colors.Black)
3609
                                        };
3610
3611
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3612
                                        currentControl.CommentID = Save.shortGuid();
3613
                                        currentControl.IsNew = true;
3614
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3615 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Visible;
3616 787a4489 KangIngu
                                    }
3617 e66f22eb KangIngu
                                //}
3618 787a4489 KangIngu
                            }
3619
                        }
3620
                        break;
3621
                    case ControlType.TwinLine:
3622
                        {
3623
                            if (mouseButtonDown == MouseButton.Left)
3624
                            {
3625 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3626
                                //{
3627 787a4489 KangIngu
                                    if (currentControl is LineControl)
3628
                                    {
3629 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
3630
                                        if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3631 e66f22eb KangIngu
                                        {
3632
                                            return;
3633
                                        }
3634
3635 787a4489 KangIngu
                                        CreateControl();
3636
3637
                                        (currentControl as LineControl).ApplyOverViewData();
3638
                                        currentControl = null;
3639 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3640 787a4489 KangIngu
                                    }
3641
                                    else
3642
                                    {
3643
                                        currentControl = new LineControl
3644
                                        {
3645
                                            Background = new SolidColorBrush(Colors.Black)
3646
                                        };
3647
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3648
                                        currentControl.CommentID = Save.shortGuid();
3649
                                        currentControl.IsNew = true;
3650
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3651 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Visible;
3652 787a4489 KangIngu
                                    }
3653 e66f22eb KangIngu
                                //}
3654 787a4489 KangIngu
                            }
3655
                        }
3656
                        break;
3657
                    case ControlType.DimLine:
3658
                        {
3659
                            if (mouseButtonDown == MouseButton.Left)
3660
                            {
3661 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3662
                                //{
3663 787a4489 KangIngu
                                    if (currentControl is LineControl)
3664
                                    {
3665 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
3666
                                        if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3667 e66f22eb KangIngu
                                        {
3668
                                            return;
3669
                                        }
3670 787a4489 KangIngu
                                        CreateControl();
3671
3672
                                        (currentControl as LineControl).ApplyOverViewData();
3673
                                        currentControl = null;
3674 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3675 787a4489 KangIngu
                                    }
3676
                                    else
3677
                                    {
3678
                                        currentControl = new LineControl
3679
                                        {
3680
                                            Background = new SolidColorBrush(Colors.Black)
3681
                                        };
3682
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3683
                                        currentControl.CommentID = Save.shortGuid();
3684
                                        currentControl.IsNew = true;
3685
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3686 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Visible;
3687 787a4489 KangIngu
                                    }
3688 e66f22eb KangIngu
                                //}
3689 787a4489 KangIngu
                            }
3690
                        }
3691
                        break;
3692
                    case ControlType.ChainLine:
3693
                        {
3694
                            if (currentControl is PolygonControl)
3695
                            {
3696
                                var control = currentControl as PolygonControl;
3697
3698
                                if (mouseButtonDown == MouseButton.Right)
3699
                                {
3700 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
3701
                                    if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3702 e66f22eb KangIngu
                                    {
3703
                                        return;
3704
                                    }
3705
3706 787a4489 KangIngu
                                    CreateControl();
3707
3708
                                    (currentControl as PolygonControl).ApplyOverViewData();
3709
                                    currentControl = null;
3710 2eac4f76 KangIngu
                                    this.MainAngle.Visibility = Visibility.Collapsed;
3711 787a4489 KangIngu
                                    return;
3712
                                }
3713
3714
                                if (!control.IsCompleted)
3715
                                {
3716
                                    control.PointSet.Add(control.EndPoint);
3717 2eac4f76 KangIngu
                                    this.MainAngle.Visibility = Visibility.Visible;
3718 787a4489 KangIngu
                                }
3719
                            }
3720
                            else
3721
                            {
3722
                                if (mouseButtonDown == MouseButton.Left)
3723
                                {
3724 2eac4f76 KangIngu
                                    MainAngle.Visibility = Visibility.Visible;
3725 787a4489 KangIngu
                                    currentControl = new PolygonControl
3726
                                    {
3727
                                        PointSet = new List<Point>(),
3728
                                        //강인구 추가(ChainLine일때는 채우기 스타일을 주지 않기 위해 설정)
3729
                                        ControlType = ControlType.ChainLine,
3730
                                        DashSize = ViewerDataModel.Instance.DashSize,
3731
                                        LineSize = ViewerDataModel.Instance.LineSize,
3732
                                        //PointC = new StylusPointSet()
3733
                                    };
3734
3735 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3736
                                    //{
3737 787a4489 KangIngu
                                        var polygonControl = (currentControl as PolygonControl);
3738
                                        currentControl.CommentID = Save.shortGuid();
3739
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3740
                                        currentControl.IsNew = true;
3741
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3742
                                        //currentControl.OnApplyTemplate();
3743
                                        //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint);
3744
                                        //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint);
3745
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3746
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3747 e66f22eb KangIngu
                                    //}
3748 787a4489 KangIngu
                                }
3749
                            }
3750
                        }
3751
                        break;
3752
                    case ControlType.ArcLine:
3753
                        {
3754
                            if (mouseButtonDown == MouseButton.Left)
3755
                            {
3756 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3757
                                //{
3758 787a4489 KangIngu
                                    if (currentControl is ArcControl)
3759
                                    {
3760 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
3761
                                        if (IsGetoutpoint((currentControl as ArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3762 e66f22eb KangIngu
                                        {
3763
                                            return;
3764
                                        }
3765
3766 787a4489 KangIngu
                                        CreateControl();
3767
3768
                                        (currentControl as ArcControl).ApplyOverViewData();
3769
                                        currentControl = null;
3770 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3771 787a4489 KangIngu
                                    }
3772
                                    else
3773
                                    {
3774
                                        currentControl = new ArcControl
3775
                                        {
3776
                                            Background = new SolidColorBrush(Colors.Black)
3777
                                        };
3778
                                        currentControl.CommentID = Save.shortGuid();
3779
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3780
                                        currentControl.IsNew = true;
3781
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3782 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Visible;
3783 787a4489 KangIngu
                                    }
3784 e66f22eb KangIngu
                                //}
3785 787a4489 KangIngu
                            }
3786
                            else if (mouseButtonDown == MouseButton.Right)
3787
                            {
3788
                                if (currentControl != null)
3789
                                {
3790
                                    (currentControl as ArcControl).setClock();
3791 05f4d127 KangIngu
                                    (currentControl as ArcControl).MidPoint = new Point(0, 0);
3792
                                    //(currentControl as ArcControl).ApplyTemplate();
3793 787a4489 KangIngu
                                }
3794
                            }
3795
                        }
3796
                        break;
3797
                    case ControlType.ArcArrow:
3798
                        {
3799
                            if (mouseButtonDown == MouseButton.Left)
3800
                            {
3801 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3802
                                //{
3803 787a4489 KangIngu
                                    if (currentControl is ArcControl)
3804
                                    {
3805 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
3806
                                        if (IsGetoutpoint((currentControl as ArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3807 e66f22eb KangIngu
                                        {
3808
                                            return;
3809
                                        }
3810
3811 787a4489 KangIngu
                                        CreateControl();
3812
3813
                                        (currentControl as ArcControl).ApplyOverViewData();
3814
                                        currentControl = null;
3815 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3816 787a4489 KangIngu
                                    }
3817
                                    else
3818
                                    {
3819
                                        currentControl = new ArcControl
3820
                                        {
3821
                                            Background = new SolidColorBrush(Colors.Red),
3822
                                        };
3823
                                        currentControl.CommentID = Save.shortGuid();
3824
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3825
                                        currentControl.IsNew = true;
3826
                                        (currentControl as IMarkupCommonData).ControlType = ControlType.ArcArrow;
3827
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3828 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Visible;
3829 787a4489 KangIngu
                                    }
3830 e66f22eb KangIngu
                                //}
3831 787a4489 KangIngu
                            }
3832
                            else if (mouseButtonDown == MouseButton.Right)
3833
                            {
3834
                                (currentControl as ArcControl).setClock();
3835
                            }
3836
                        }
3837
                        break;
3838
                    case ControlType.ArrowMultiLine:
3839
                        {
3840
                            if (mouseButtonDown == MouseButton.Left)
3841
                            {
3842 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3843
                                //{
3844 787a4489 KangIngu
3845
                                    if (currentControl is ArrowControl_Multi)
3846
                                    {
3847
                                        var content = currentControl as ArrowControl_Multi;
3848
                                        if (content.MiddlePoint == new Point(0, 0))
3849
                                        {
3850 2eac4f76 KangIngu
                                            if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
3851
                                            {
3852
                                                content.MiddlePoint = content.EndPoint;
3853
                                            }
3854
                                            else
3855
                                            {
3856
                                                content.MiddlePoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
3857
                                            }
3858 787a4489 KangIngu
                                        }
3859
                                        else
3860
                                        {
3861 ca40e004 ljiyeon
                                            //20180906 LJY TEST IsRotationDrawingEnable
3862
                                            if (IsGetoutpoint((currentControl as ArrowControl_Multi).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3863 e66f22eb KangIngu
                                            {
3864
                                                return;
3865
                                            }
3866
3867 787a4489 KangIngu
                                            CreateControl();
3868
3869
                                            (currentControl as ArrowControl_Multi).ApplyOverViewData();
3870
                                            currentControl = null;
3871 5ce56a3a KangIngu
                                            this.MainAngle.Visibility = Visibility.Collapsed;
3872 787a4489 KangIngu
                                        }
3873
                                    }
3874
                                    else
3875
                                    {
3876
                                        currentControl = new ArrowControl_Multi
3877
                                        {
3878
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3879
                                            Background = new SolidColorBrush(Colors.Black)
3880
                                        };
3881
                                        currentControl.CommentID = Save.shortGuid();
3882
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3883
                                        currentControl.IsNew = true;
3884
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3885 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Visible;
3886 787a4489 KangIngu
                                    }
3887 e66f22eb KangIngu
                                //}
3888 787a4489 KangIngu
                            }
3889
                        }
3890
                        break;
3891
                    case ControlType.PolygonCloud:
3892
                        {
3893
                            if (currentControl is CloudControl)
3894
                            {
3895
                                var control = currentControl as CloudControl;
3896
                                if (mouseButtonDown == MouseButton.Right)
3897
                                {
3898
                                    control.IsCompleted = true;
3899
                                }
3900
3901
                                if (!control.IsCompleted)
3902
                                {
3903
                                    control.PointSet.Add(control.EndPoint);
3904
                                }
3905
                                else
3906
                                {
3907 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
3908
                                    if (IsGetoutpoint((currentControl as CloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3909 e66f22eb KangIngu
                                    {
3910
                                        return;
3911
                                    }
3912
3913 787a4489 KangIngu
                                    CreateControl();
3914
3915
                                    control.isTransOn = true;
3916
                                    var firstPoint = control.PointSet.First();
3917
3918
                                    control.PointSet.Add(firstPoint);
3919
                                    control.DrawingCloud();
3920
                                    control.ApplyOverViewData();
3921
3922
                                    currentControl = null;
3923
                                }
3924
                            }
3925
                            else
3926
                            {
3927
                                if (mouseButtonDown == MouseButton.Left)
3928
                                {
3929
                                    currentControl = new CloudControl
3930
                                    {
3931
                                        PointSet = new List<Point>(),
3932
                                        PointC = new StylusPointSet()
3933
                                    };
3934
3935 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3936
                                    //{
3937 787a4489 KangIngu
                                        var polygonControl = (currentControl as CloudControl);
3938
                                        currentControl.CommentID = Save.shortGuid();
3939
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3940
                                        currentControl.IsNew = true;
3941
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3942
3943
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3944
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3945 e66f22eb KangIngu
                                    //}
3946 787a4489 KangIngu
                                }
3947
                            }
3948
                        }
3949
                        break;
3950
                    case ControlType.ImgControl:
3951
                        {
3952
                            if (mouseButtonDown == MouseButton.Left)
3953
                            {
3954 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3955
                                //{
3956 787a4489 KangIngu
                                    if (currentControl is ImgControl)
3957
                                    {
3958 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
3959
                                        if (IsGetoutpoint((currentControl as ImgControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3960 e66f22eb KangIngu
                                        {
3961
                                            return;
3962
                                        }
3963
3964 787a4489 KangIngu
                                        CreateControl();
3965
                                        (currentControl as ImgControl).ApplyOverViewData();
3966
3967
                                        currentControl = null;
3968
                                    }
3969
                                    else
3970
                                    {
3971
                                        string extension = System.IO.Path.GetExtension(filename).ToUpper();
3972
                                        if (extension == ".PNG" || extension == ".JPEG" || extension == ".GIF" || extension == ".BMP" || extension == ".JPG")
3973
                                        {
3974
                                            Image img = new Image();
3975
                                            img.Source = new BitmapImage(new Uri(filename));
3976
3977
                                            currentControl = new ImgControl
3978
                                            {
3979
                                                Background = new SolidColorBrush(Colors.Black),
3980
                                                PointSet = new List<Point>(),
3981
                                                FilePath = filename,
3982
                                                ImageData = img.Source,
3983
                                                StartPoint = canvasDrawingMouseDownPoint,
3984
                                                EndPoint = new Point(canvasDrawingMouseDownPoint.X + 100, canvasDrawingMouseDownPoint.Y + 100),
3985
                                                TopRightPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y + 100),
3986
                                                LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X + 100, canvasDrawingMouseDownPoint.Y)
3987
                                            };
3988
3989
                                            currentControl.CommentID = Save.shortGuid();
3990
                                            currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3991
                                            currentControl.IsNew = true;
3992
                                            ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3993 ca40e004 ljiyeon
3994
                                            //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
3995
                                            (currentControl as ImgControl).Angle -= rotate.Angle;
3996
                                    }
3997 787a4489 KangIngu
                                    }
3998 e66f22eb KangIngu
                                //}
3999 787a4489 KangIngu
                            }
4000
                        }
4001
                        break;
4002
                    case ControlType.Date:
4003
                        {
4004
                            if (mouseButtonDown == MouseButton.Left)
4005
                            {
4006 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4007
                                //{
4008 787a4489 KangIngu
                                    if (currentControl is DateControl)
4009
                                    {
4010 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
4011
                                        if (IsGetoutpoint((currentControl as DateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4012 e66f22eb KangIngu
                                        {
4013
                                            return;
4014
                                        }
4015
4016 787a4489 KangIngu
                                        CreateControl();
4017
                                        (currentControl as DateControl).ApplyOverViewData();
4018
                                        currentControl = null;
4019
4020
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
4021
                                        {
4022
                                            controlType = ControlType.None;
4023
                                            IsSwingMode = false;
4024
                                            Common.ViewerDataModel.Instance.SelectedControl = "";
4025
                                            Common.ViewerDataModel.Instance.ControlTag = null;
4026
                                            mouseHandlingMode = MouseHandlingMode.None;
4027
                                            this.ParentOfType<MainWindow>().dzTopMenu.btn_Batch.IsChecked = false;
4028
                                            txtBatch.Visibility = Visibility.Collapsed;
4029
4030
                                        }
4031
                                    }
4032
                                    else
4033
                                    {
4034
                                        currentControl = new DateControl
4035
                                        {
4036
                                            Background = new SolidColorBrush(Colors.Black)
4037
                                        };
4038
                                        currentControl.CommentID = Save.shortGuid();
4039
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4040
                                        currentControl.IsNew = true;
4041
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4042 ca40e004 ljiyeon
4043
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
4044
                                        (currentControl as DateControl).Angle -= rotate.Angle;
4045
                                }
4046 e66f22eb KangIngu
                                //}
4047 787a4489 KangIngu
                            }
4048
                        }
4049
                        break;
4050
                    case ControlType.TextControl:
4051
                        {
4052
                            if (mouseButtonDown == MouseButton.Left)
4053
                            {
4054
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4055
                                {
4056
                                    currentControl = new TextControl
4057
                                    {
4058
                                        ControlType = controlType
4059
                                    };
4060 610a4b86 KangIngu
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
4061 8742caa5 humkyung
                                    currentControl.CommentID = Save.shortGuid();
4062
                                    currentControl.IsNew = true;
4063
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4064
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4065
                                    currentControl.SetValue(Canvas.ZIndexProperty, 2);
4066
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
4067
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);
4068
                                    currentControl.Focus();
4069
                                    (currentControl as TextControl).ApplyOverViewData();
4070
                                    (currentControl as TextControl).ControlType_No = 0;
4071
                                    (currentControl as TextControl).Angle -= rotate.Angle;
4072
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
4073 787a4489 KangIngu
4074 8742caa5 humkyung
                                    CreateControl();
4075 787a4489 KangIngu
4076 49b217ad humkyung
                                    //currentControl = null;
4077 787a4489 KangIngu
                                }
4078
                            }
4079
                        }
4080
                        break;
4081
                    case ControlType.TextBorder:
4082
                        {
4083
                            if (mouseButtonDown == MouseButton.Left)
4084
                            {
4085
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4086
                                {
4087
                                    currentControl = new TextControl
4088
                                    {
4089
                                        ControlType = controlType
4090
                                    };
4091
4092 610a4b86 KangIngu
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
4093 787a4489 KangIngu
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4094
                                    currentControl.CommentID = Save.shortGuid();
4095
                                    currentControl.IsNew = true;
4096
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4097
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
4098
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
4099
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);
4100
                                    currentControl.Focus();
4101
                                    (currentControl as TextControl).ControlType_No = 1;
4102
                                    (currentControl as TextControl).Angle = Ang;
4103
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
4104
                                    CreateControl();
4105
4106 49b217ad humkyung
                                    //currentControl = null;
4107 787a4489 KangIngu
                                }
4108
                            }
4109
                        }
4110
                        break;
4111
                    case ControlType.TextCloud:
4112
                        {
4113
                            if (mouseButtonDown == MouseButton.Left)
4114
                            {
4115
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4116
                                {
4117
                                    currentControl = new TextControl
4118
                                    {
4119
                                        ControlType = controlType
4120
                                    };
4121 610a4b86 KangIngu
4122
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
4123 787a4489 KangIngu
                                    currentControl.CommentID = Save.shortGuid();
4124
                                    currentControl.IsNew = true;
4125
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4126
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4127
4128
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
4129
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
4130
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);
4131
                                    currentControl.Focus();
4132
4133
                                    (currentControl as TextControl).Angle = Ang;
4134
                                    (currentControl as TextControl).ControlType_No = 2;
4135
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
4136
4137
                                    CreateControl();
4138 49b217ad humkyung
                                    //currentControl = null;
4139 787a4489 KangIngu
                                }
4140
                            }
4141
                        }
4142
                        break;
4143
                    case ControlType.ArrowTextControl:
4144 ca40e004 ljiyeon
                         {
4145 787a4489 KangIngu
                            if (mouseButtonDown == MouseButton.Left)
4146
                            {
4147
                                if (currentControl is ArrowTextControl)
4148
                                {
4149 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
4150
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4151 e66f22eb KangIngu
                                    {
4152
                                        return;
4153 ca40e004 ljiyeon
                                    }                                    
4154 e66f22eb KangIngu
4155 787a4489 KangIngu
                                    CreateControl();
4156
4157
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4158
                                    (currentControl as ArrowTextControl).IsEditing = false;
4159
                                    (currentControl as ArrowTextControl).EnableEditing = false;
4160 49b217ad humkyung
                                    (currentControl as ArrowTextControl).IsNew = false;
4161 787a4489 KangIngu
                                    currentControl = null;
4162
                                }
4163
                                else
4164
                                {
4165 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4166
                                    //{
4167 787a4489 KangIngu
                                        currentControl = new ArrowTextControl();
4168
                                        currentControl.CommentID = Save.shortGuid();
4169
                                        currentControl.IsNew = true;
4170
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4171
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4172
4173
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4174
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4175
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);
4176 610a4b86 KangIngu
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4177 787a4489 KangIngu
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4178
4179 ca40e004 ljiyeon
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
4180
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
4181 787a4489 KangIngu
4182 ca40e004 ljiyeon
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4183 787a4489 KangIngu
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4184 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Visible;
4185 ca40e004 ljiyeon
4186
                                    
4187 e66f22eb KangIngu
                                    //}
4188 787a4489 KangIngu
                                }
4189
                            }
4190
                        }
4191
                        break;
4192
                    case ControlType.ArrowTransTextControl:
4193
                        {
4194
                            if (mouseButtonDown == MouseButton.Left)
4195
                            {
4196
                                if (currentControl is ArrowTextControl)
4197
                                {
4198 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
4199
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4200 e66f22eb KangIngu
                                    {
4201
                                        return;
4202 ca40e004 ljiyeon
                                    }                                    
4203 e66f22eb KangIngu
4204 787a4489 KangIngu
                                    CreateControl();
4205
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4206 49b217ad humkyung
                                    currentControl.IsNew = false;
4207 787a4489 KangIngu
                                    currentControl = null;
4208 5ce56a3a KangIngu
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4209 787a4489 KangIngu
                                }
4210
                                else
4211
                                {
4212 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4213
                                    //{
4214 ca40e004 ljiyeon
                                         currentControl = new ArrowTextControl();
4215 787a4489 KangIngu
                                        currentControl.CommentID = Save.shortGuid();
4216
                                        currentControl.IsNew = true;
4217
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4218
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4219
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4220
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4221 ca40e004 ljiyeon
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                  
4222 610a4b86 KangIngu
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4223 787a4489 KangIngu
                                        (currentControl as ArrowTextControl).isFixed = true;
4224
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4225
4226 ca40e004 ljiyeon
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
4227
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
4228
4229
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4230 787a4489 KangIngu
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4231 ca40e004 ljiyeon
                                        (currentControl as ArrowTextControl).isTrans = true;
4232 787a4489 KangIngu
                                }
4233
                            }
4234
                        }
4235
                        break;
4236
                    case ControlType.ArrowTextBorderControl:
4237 ca40e004 ljiyeon
                         {
4238 787a4489 KangIngu
                            if (mouseButtonDown == MouseButton.Left)
4239
                            {
4240
                                if (currentControl is ArrowTextControl)
4241
                                {
4242 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
4243
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4244 e66f22eb KangIngu
                                    {
4245
                                        return;
4246
                                    }
4247
4248 787a4489 KangIngu
                                    CreateControl();
4249
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4250 49b217ad humkyung
                                    currentControl.IsNew = false;
4251 787a4489 KangIngu
                                    currentControl = null;
4252 5ce56a3a KangIngu
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4253 787a4489 KangIngu
                                }
4254
                                else
4255
                                {
4256 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4257
                                    //{
4258 787a4489 KangIngu
                                        currentControl = new ArrowTextControl()
4259
                                        {
4260
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect
4261
                                        };
4262
                                        currentControl.CommentID = Save.shortGuid();
4263
                                        currentControl.IsNew = true;
4264
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4265
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4266
4267
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4268
4269
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4270
4271
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);
4272
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4273 610a4b86 KangIngu
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4274 787a4489 KangIngu
4275 ca40e004 ljiyeon
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
4276
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
4277
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4278 787a4489 KangIngu
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4279 ca40e004 ljiyeon
                                        this.MainAngle.Visibility = Visibility.Visible;                                    
4280 e66f22eb KangIngu
                                    //}
4281 787a4489 KangIngu
                                }
4282
                            }
4283
                        }
4284
                        break;
4285
                    case ControlType.ArrowTransTextBorderControl:
4286
                        {
4287
                            if (mouseButtonDown == MouseButton.Left)
4288
                            {
4289
                                if (currentControl is ArrowTextControl)
4290
                                {
4291 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
4292
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4293 e66f22eb KangIngu
                                    {
4294
                                        return;
4295
                                    }
4296 787a4489 KangIngu
                                    CreateControl();
4297
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4298 49b217ad humkyung
                                    currentControl.IsNew = false;
4299 787a4489 KangIngu
                                    currentControl = null;
4300 5ce56a3a KangIngu
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4301 787a4489 KangIngu
                                }
4302
                                else
4303
                                {
4304 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4305
                                    //{
4306 ca40e004 ljiyeon
                                    
4307
4308
                                    currentControl = new ArrowTextControl()
4309 787a4489 KangIngu
                                        {
4310
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect
4311
                                        };
4312
                                        currentControl.CommentID = Save.shortGuid();
4313
                                        currentControl.IsNew = true;
4314
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4315
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4316
4317
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4318
4319
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4320 ca40e004 ljiyeon
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                                    
4321 610a4b86 KangIngu
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4322 787a4489 KangIngu
                                        (currentControl as ArrowTextControl).isFixed = true;
4323
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4324 ca40e004 ljiyeon
                                     
4325
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
4326
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
4327 787a4489 KangIngu
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4328
4329 ca40e004 ljiyeon
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();                                 
4330 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Visible;
4331 ca40e004 ljiyeon
                                    
4332
                                    //20180911 LJY
4333
                                        (currentControl as ArrowTextControl).isTrans = true;
4334
                                    
4335
4336 e66f22eb KangIngu
                                    //}
4337 787a4489 KangIngu
                                }
4338
                            }
4339
                        }
4340
                        break;
4341
                    case ControlType.ArrowTextCloudControl:
4342
                        {
4343
                            if (mouseButtonDown == MouseButton.Left)
4344
                            {
4345
                                if (currentControl is ArrowTextControl)
4346
                                {
4347 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
4348
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4349 e66f22eb KangIngu
                                    {
4350
                                        return;
4351
                                    }
4352 787a4489 KangIngu
                                    CreateControl();
4353
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4354 49b217ad humkyung
                                    currentControl.IsNew = false;
4355 787a4489 KangIngu
                                    currentControl = null;
4356 5ce56a3a KangIngu
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4357 787a4489 KangIngu
                                }
4358
                                else
4359
                                {
4360 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4361
                                    //{
4362 787a4489 KangIngu
                                        currentControl = new ArrowTextControl()
4363
                                        {
4364
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud
4365
                                        };
4366
                                        currentControl.CommentID = Save.shortGuid();
4367
                                        currentControl.IsNew = true;
4368
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4369
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4370
4371
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4372
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4373 ca40e004 ljiyeon
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                                 
4374 610a4b86 KangIngu
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4375 787a4489 KangIngu
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4376
4377 ca40e004 ljiyeon
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
4378
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
4379
                                    
4380
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4381 787a4489 KangIngu
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4382 ca40e004 ljiyeon
                                        this.MainAngle.Visibility = Visibility.Visible;                                        
4383 e66f22eb KangIngu
                                    //}
4384 787a4489 KangIngu
                                }
4385
                            }
4386
                        }
4387
                        break;
4388
                    case ControlType.ArrowTransTextCloudControl:
4389
                        {
4390
                            if (mouseButtonDown == MouseButton.Left)
4391
                            {
4392
                                if (currentControl is ArrowTextControl)
4393
                                {
4394 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
4395
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4396 e66f22eb KangIngu
                                    {
4397
                                        return;
4398
                                    }
4399 787a4489 KangIngu
                                    CreateControl();
4400
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4401 49b217ad humkyung
                                    currentControl.IsNew = false;
4402 787a4489 KangIngu
                                    currentControl = null;
4403 5ce56a3a KangIngu
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4404 787a4489 KangIngu
                                }
4405
                                else
4406
                                {
4407 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4408
                                    //{
4409 787a4489 KangIngu
                                        currentControl = new ArrowTextControl()
4410
                                        {
4411
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud
4412
                                        };
4413
                                        currentControl.CommentID = Save.shortGuid();
4414 ca40e004 ljiyeon
                                        currentControl.IsNew = true; 
4415 787a4489 KangIngu
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4416
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4417
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4418
4419
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4420 ca40e004 ljiyeon
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                                        
4421 610a4b86 KangIngu
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4422 787a4489 KangIngu
                                        (currentControl as ArrowTextControl).isFixed = true;
4423
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4424
4425 ca40e004 ljiyeon
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
4426
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
4427 787a4489 KangIngu
4428 ca40e004 ljiyeon
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4429 787a4489 KangIngu
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4430 ca40e004 ljiyeon
                                        this.MainAngle.Visibility = Visibility.Visible;  
4431
                                    
4432
                                    //20180911 LJY
4433
                                        (currentControl as ArrowTextControl).isTrans = true;
4434 e66f22eb KangIngu
                                    //}
4435 787a4489 KangIngu
                                }
4436
                            }
4437
                        }
4438
                        break;
4439
                    case ControlType.PolygonControl:
4440
                        {
4441
                            if (currentControl is PolygonControl)
4442
                            {
4443
                                var control = currentControl as PolygonControl;
4444
4445
                                if (mouseButtonDown == MouseButton.Right)
4446
                                {
4447
                                    control.IsCompleted = true;
4448
                                }
4449
4450
                                if (!control.IsCompleted)
4451
                                {
4452
                                    control.PointSet.Add(control.EndPoint);
4453
                                }
4454
                                else
4455
                                {
4456 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
4457
                                    if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4458 e66f22eb KangIngu
                                    {
4459
                                        return;
4460
                                    }
4461
4462 787a4489 KangIngu
                                    var firstPoint = control.PointSet.First();
4463
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
4464
                                    control.LineSize = ViewerDataModel.Instance.LineSize;
4465
                                    control.PointSet.Add(firstPoint);
4466
4467
                                    control.SetPolyPath();
4468
4469
                                    control.ApplyOverViewData();
4470
4471
                                    CreateControl();
4472
4473
                                    currentControl = null;
4474
                                }
4475
                            }
4476
                            else
4477
                            {
4478
                                if (mouseButtonDown == MouseButton.Left)
4479
                                {
4480
                                    currentControl = new PolygonControl
4481
                                    {
4482
                                        PointSet = new List<Point>(),
4483
                                        //PointC = new StylusPointSet()
4484
                                    };
4485
4486 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4487
                                    //{
4488 787a4489 KangIngu
                                        var polygonControl = (currentControl as PolygonControl);
4489
                                        currentControl.CommentID = Save.shortGuid();
4490
                                        currentControl.IsNew = true;
4491
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4492
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4493
                                        //currentControl.OnApplyTemplate();
4494
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
4495
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
4496 e66f22eb KangIngu
                                    //}
4497 787a4489 KangIngu
                                }
4498
                            }
4499
                        }
4500
                        break;
4501
                    //강인구 추가
4502
                    case ControlType.Sign:
4503
                        {
4504
                            if (mouseButtonDown == MouseButton.Left)
4505
                            {
4506 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4507
                                //{
4508 992a98b4 KangIngu
                                    GetUserSign getUser = new GetUserSign();
4509
                                    var _sign = getUser.GetSign(App.ViewInfo.UserID, App.ViewInfo.ProjectNO);
4510
4511
                                    if (_sign == null)
4512
                                    {
4513
                                        txtBatch.Visibility = Visibility.Collapsed;
4514
                                        mouseHandlingMode = IKCOM.MouseHandlingMode.None;
4515
                                        controlType = ControlType.None;
4516
4517
                                        this.ParentOfType<MainWindow>().DialogMessage_Alert("등록된 Sign이 없습니다.", "Alert");
4518
                                        this.ParentOfType<MainWindow>().ChildrenOfType<RadToggleButton>().Where(data => data.IsChecked == true).FirstOrDefault().IsChecked = false;
4519
                                        return;
4520
                                    }
4521
4522 787a4489 KangIngu
                                    if (currentControl is SignControl)
4523
                                    {
4524 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
4525
                                        if (IsGetoutpoint((currentControl as SignControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4526 e66f22eb KangIngu
                                        {
4527
                                            return;
4528
                                        }
4529
4530 787a4489 KangIngu
                                        CreateControl();
4531
                                        currentControl = null;
4532
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
4533
                                        {
4534 999c9e40 humkyung
                                            txtBatch.Text = "Place Date";
4535 787a4489 KangIngu
                                            controlType = ControlType.Date;
4536
                                        }
4537
                                    }
4538
                                    else
4539
                                    {
4540
                                        currentControl = new SignControl
4541
                                        {
4542
                                            Background = new SolidColorBrush(Colors.Black),
4543
                                            UserNumber = App.ViewInfo.UserID,
4544
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
4545
                                            EndPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
4546
                                            ControlType = ControlType.Sign
4547
                                        };
4548
4549
                                        currentControl.CommentID = Save.shortGuid();
4550
                                        currentControl.IsNew = true;
4551
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4552
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4553 ca40e004 ljiyeon
4554
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
4555
                                        (currentControl as SignControl).Angle -= rotate.Angle;                                    
4556
                                }
4557 e66f22eb KangIngu
                                //}
4558 787a4489 KangIngu
                            }
4559
                        }
4560
                        break;
4561
                    case ControlType.Mark:
4562
                        {
4563
                            if (mouseButtonDown == MouseButton.Left)
4564
                            {
4565 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4566
                                //{
4567 787a4489 KangIngu
                                    if (currentControl is RectangleControl)
4568
                                    {
4569 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
4570
                                        if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4571 e66f22eb KangIngu
                                        {
4572
                                            return;
4573
                                        }
4574
4575 787a4489 KangIngu
                                        CreateControl();
4576
                                        (currentControl as RectangleControl).ApplyOverViewData();
4577
                                        currentControl = null;
4578
                                        this.cursor = Cursors.Arrow;
4579
4580
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
4581
                                        {
4582 999c9e40 humkyung
                                            txtBatch.Text = "Place Signature";
4583 787a4489 KangIngu
                                            controlType = ControlType.Sign;
4584
                                        }
4585
                                    }
4586
                                    else
4587
                                    {
4588
                                        currentControl = new RectangleControl
4589
                                        {
4590
                                            Background = new SolidColorBrush(Colors.Black),
4591
                                            Paint = PaintSet.Fill
4592
                                        };
4593
4594
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4595
                                        currentControl.CommentID = Save.shortGuid();
4596
                                        currentControl.IsNew = true;
4597
                                        (currentControl as RectangleControl).DashSize = ViewerDataModel.Instance.DashSize;
4598
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4599
                                    }
4600 e66f22eb KangIngu
                                //}
4601 787a4489 KangIngu
                            }
4602
                        }
4603
                        break;
4604
                    case ControlType.Symbol:
4605
                        {
4606
                            if (mouseButtonDown == MouseButton.Left)
4607
                            {
4608 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4609
                                //{
4610 787a4489 KangIngu
                                    if (currentControl is SymControl)
4611
                                    {
4612 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
4613
                                        if (IsGetoutpoint((currentControl as SymControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4614 e66f22eb KangIngu
                                        {
4615
                                            return;
4616
                                        }
4617 787a4489 KangIngu
                                        CreateControl();
4618
                                        currentControl = null;
4619
                                        this.cursor = Cursors.Arrow;
4620
                                    }
4621
                                    else
4622
                                    {
4623
                                        currentControl = new SymControl
4624
                                        {
4625
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
4626
                                            Background = new SolidColorBrush(Colors.Black),
4627
                                            ControlType = ControlType.Symbol
4628
                                        };
4629
4630
                                        currentControl.IsNew = true;
4631
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4632
                                        currentControl.CommentID = Save.shortGuid();
4633
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4634 ca40e004 ljiyeon
4635
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
4636
                                        (currentControl as SymControl).Angle -= rotate.Angle;
4637
                                }
4638 e66f22eb KangIngu
                                //}
4639 787a4489 KangIngu
                            }
4640
                        }
4641
                        break;
4642
                    case ControlType.Stamp:
4643
                        {
4644
                            if (mouseButtonDown == MouseButton.Left)
4645
                            {
4646 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4647
                                //{
4648 787a4489 KangIngu
                                    if (currentControl is SymControlN)
4649
                                    {
4650 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
4651
                                        if (IsGetoutpoint((currentControl as SymControlN).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4652 e66f22eb KangIngu
                                        {
4653
                                            return;
4654
                                        }
4655
4656 787a4489 KangIngu
                                        CreateControl();
4657
                                        currentControl = null;
4658
                                        this.cursor = Cursors.Arrow;
4659
                                    }
4660
                                    else
4661
                                    {
4662
                                        currentControl = new SymControlN
4663
                                        {
4664
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
4665
                                            Background = new SolidColorBrush(Colors.Black),
4666
                                            ControlType = ControlType.Stamp
4667
                                        };
4668
4669
                                        currentControl.IsNew = true;
4670
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4671
                                        currentControl.CommentID = Save.shortGuid();
4672
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4673 ca40e004 ljiyeon
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
4674
                                        (currentControl as SymControlN).Angle -= rotate.Angle;
4675
                                }                                    
4676 e66f22eb KangIngu
                                //}
4677 787a4489 KangIngu
                            }
4678
                        }
4679
                        break;
4680
                    case ControlType.PenControl:
4681
                        {
4682
                            if (inkBoard.Tag.ToString() == "Ink")
4683
                            {
4684
                                inkBoard.IsEnabled = true;
4685
                                StartNewStroke(canvasDrawingMouseDownPoint);
4686
                            }
4687
                            else if (inkBoard.Tag.ToString() == "EraseByPoint")
4688
                            {
4689
                                RemovePointStroke(canvasDrawingMouseDownPoint);
4690
                            }
4691
                            else if (inkBoard.Tag.ToString() == "EraseByStroke")
4692
                            {
4693
                                RemoveLineStroke(canvasDrawingMouseDownPoint);
4694
                            }
4695
                            IsDrawing = true;
4696
                            return;
4697
                        }
4698
                    default:
4699
                        if (currentControl != null)
4700
                        {
4701
                            currentControl.CommentID = null;
4702
                            currentControl.IsNew = false;
4703
                        }
4704
                        break;
4705
                }
4706
            }
4707
            if (mouseHandlingMode != MouseHandlingMode.None && mouseButtonDown == MouseButton.Left)
4708
            {
4709
                if (mouseHandlingMode == MouseHandlingMode.Adorner && SelectLayer.Children.Count > 0)
4710
                {
4711
                    bool mouseOff = false;
4712
                    foreach (var item in SelectLayer.Children)
4713
                    {
4714
                        if (item is AdornerFinal)
4715
                        {
4716
4717
                            var over = (item as AdornerFinal).MemberSet.Where(data => data.DrawingData.IsMouseOver).FirstOrDefault();
4718
                            if (over != null)
4719
                            {
4720
                                mouseOff = true;
4721
                            }
4722
                        }
4723
                    }
4724
4725
                    if (!mouseOff)
4726
                    {
4727
                        ReleaseAdorner();
4728
                    }
4729
                }
4730
                zoomAndPanControl.CaptureMouse();
4731
                e.Handled = true;
4732
            }
4733
        }
4734 e54660e8 KangIngu
4735 a1716fa5 KangIngu
        private void zoomAndPanControl2_MouseDown(object sender, MouseButtonEventArgs e)
4736
        {
4737
            mouseButtonDown = e.ChangedButton;
4738
            canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas2);
4739
        }
4740
4741 787a4489 KangIngu
        private void RemoveLineStroke(Point P)
4742
        {
4743
            var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
4744
            if (control != null)
4745
            {
4746
                UndoData = new Undo_data()
4747
                {
4748
                    IsUndo = false,
4749
                    Event = Event_Type.Delete,
4750
                    EventTime = DateTime.Now,
4751
                    Markup_List = new List<Multi_Undo_data>()
4752
                };
4753
4754
4755
                multi_Undo_Data.Markup = control as MarkupToPDF.Common.CommentUserInfo;
4756
                UndoData.Markup_List.Add(multi_Undo_Data);
4757
                multi_Undo_Data = new Multi_Undo_data();
4758
4759
                ViewerDataModel.Instance.MarkupControls_USER.Remove(control);
4760
                var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (control as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault();
4761
                ViewerDataModel.Instance.MarkupList_USER.Remove(Item_);
4762 6707a5c7 ljiyeon
                
4763
                //임시파일에서도 삭제한다.
4764
                temp.DelTemp((control as MarkupToPDF.Common.CommentUserInfo).CommentID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString());
4765
                
4766 787a4489 KangIngu
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
4767
                {
4768
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
4769
                });
4770
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
4771 e54660e8 KangIngu
4772 787a4489 KangIngu
            }
4773
        }
4774
4775
        private void RemovePointStroke(Point P)
4776
        {
4777
            foreach (Stroke hits in inkBoard.Strokes)
4778
            {
4779
                foreach (StylusPoint sty in hits.StylusPoints)
4780
                {
4781
4782
                }
4783
                if (hits.HitTest(P))
4784
                {
4785
                    inkBoard.Strokes.Remove(hits);
4786
                    return;
4787
                }
4788
            }
4789
        }
4790
4791
        private void StartNewStroke(Point P)
4792
        {
4793
            strokePoints = new StylusPointCollection();
4794
            StylusPoint segment1Start = new StylusPoint(P.X, P.Y);
4795
            strokePoints.Add(segment1Start);
4796
            stroke = new Stroke(strokePoints);
4797
4798
            stroke.DrawingAttributes.Color = Colors.Red;
4799
            stroke.DrawingAttributes.Width = 4;
4800
            stroke.DrawingAttributes.Height = 4;
4801
4802
            inkBoard.Strokes.Add(stroke);
4803
4804
        }
4805
4806
        private void btnConsolidate_Click(object sender, RoutedEventArgs e)
4807
        {
4808
            ConsolidationMethod();
4809
        }
4810
4811 04a7385a djkim
        public void TeamConsolidationMethod()
4812
        {
4813
            ChangeCommentReact();
4814
            if (this.gridViewMarkup.SelectedItems.Count == 0)
4815
            {
4816
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
4817
            }
4818
            else
4819
            {
4820
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
4821
                {
4822
                    if (!this.userData.DEPARTMENT.Equals(item.Depatment))
4823
                    {
4824
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at your department", "Alert");
4825
                        return;
4826
                    }                    
4827
                }
4828
                ViewerDataModel.Instance.IsConsolidate = true;
4829
                this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
4830
                List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>();
4831
4832
                string project_no = App.ViewInfo.ProjectNO;
4833
                string doc_id = _DocInfo.ID;
4834
                string user_id = App.ViewInfo.UserID;
4835
                List<MarkupInfoItem> markupInfoItems = new List<MarkupInfoItem>();
4836
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
4837
                {                    
4838
                    markupInfoItems.Add(item);
4839
                }
4840 0f065e57 ljiyeon
                Logger.sendReqLog("TeamConsolidate", project_no + "," + user_id + "," + doc_id + "," + markupInfoItems, 1);
4841
                Logger.sendResLog("TeamConsolidate", this.BaseClient.TeamConsolidate(project_no, user_id, doc_id, markupInfoItems).ToString(), 1);
4842
                //this.BaseClient.TeamConsolidate(project_no, user_id, doc_id, markupInfoItems);
4843 04a7385a djkim
4844 0f065e57 ljiyeon
                Logger.sendReqLog("GetMarkupInfoItemsAsync", App.ViewInfo.ProjectNO + "," + _DocInfo.ID, 1);  
4845 04a7385a djkim
                this.BaseClient.GetMarkupInfoItemsAsync(App.ViewInfo.ProjectNO, _DocInfo.ID);
4846
            }
4847
        }
4848 787a4489 KangIngu
        public void ConsolidationMethod()
4849
        {
4850
            ChangeCommentReact();
4851
4852
            if (this.gridViewMarkup.SelectedItems.Count == 0)
4853
            {
4854
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
4855
            }
4856
            else
4857 6c781c0c djkim
            {                                
4858 787a4489 KangIngu
                ViewerDataModel.Instance.IsConsolidate = true;
4859 7b312426 KangIngu
                this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
4860 787a4489 KangIngu
                List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>();
4861
4862 6c781c0c djkim
                string project_no = App.ViewInfo.ProjectNO;
4863
                string doc_id = _DocInfo.ID;
4864
                string user_id = App.ViewInfo.UserID;
4865
                List<MarkupInfoItem> markupInfoItems = new List<MarkupInfoItem>();
4866
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
4867
                {
4868
                    markupInfoItems.Add(item);
4869 787a4489 KangIngu
                }
4870 0f065e57 ljiyeon
                Logger.sendReqLog("Consolidate", project_no + "," + user_id + "," + doc_id + "," + markupInfoItems, 1);
4871
                Logger.sendResLog("Consolidate", this.BaseClient.Consolidate(project_no, user_id, doc_id, markupInfoItems).ToString(), 1);
4872
                //this.BaseClient.Consolidate(project_no, user_id, doc_id, markupInfoItems);
4873
4874
                Logger.sendReqLog("GetMarkupInfoItemsAsync", App.ViewInfo.ProjectNO + "," + _DocInfo.ID, 1);
4875 6c781c0c djkim
                this.BaseClient.GetMarkupInfoItemsAsync(App.ViewInfo.ProjectNO, _DocInfo.ID);
4876
                
4877 787a4489 KangIngu
            }
4878
        }
4879
4880
        private void btnConsolidate_Loaded(object sender, RoutedEventArgs e)
4881
        {
4882
            if (App.ViewInfo != null)
4883
            {
4884
                btnConsolidate = (sender as RadRibbonButton);
4885
                if (!App.ViewInfo.NewCommentPermission)
4886
                {
4887
                    (sender as RadRibbonButton).Visibility = System.Windows.Visibility.Collapsed;
4888
                }
4889
            }
4890
        }
4891
4892
        private void btnTeamConsolidate_Click(object sender, RoutedEventArgs e)
4893
        {
4894 04a7385a djkim
            TeamConsolidationMethod();
4895 787a4489 KangIngu
        }
4896
4897
        private void btnTeamConsolidate_Loaded(object sender, RoutedEventArgs e)
4898
        {
4899
            btnTeamConsolidate = sender as RadRibbonButton;
4900
            if (App.ViewInfo != null)
4901
            {
4902
                if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면
4903
                {
4904
                    if (btnConsolidate != null)
4905
                    {
4906
                        btnConsolidate.Visibility = Visibility.Collapsed;
4907
                    }
4908
4909
                    if (!App.ViewInfo.NewCommentPermission)
4910
                    {
4911
                        btnTeamConsolidate.Visibility = Visibility.Collapsed;
4912
                    }
4913
                }
4914
                else
4915
                {
4916
                    btnTeamConsolidate.Visibility = Visibility.Collapsed;
4917
                }
4918
            }
4919
        }
4920
4921
        private void FinalPDFEvent(object sender, RoutedEventArgs e)
4922
        {
4923
            var item = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault();
4924
            if (item != null)
4925
            {
4926 0f065e57 ljiyeon
                Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item.MarkupInfoID + "," + _ViewInfo.UserID, 1);              
4927
4928 787a4489 KangIngu
                BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item.MarkupInfoID, _ViewInfo.UserID);
4929
            }
4930
            else
4931
            {
4932
                DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내");
4933
            }
4934
        }
4935
4936
        private void btnFinalPDF_Loaded(object sender, RoutedEventArgs e)
4937
        {
4938
            btnFinalPDF = sender as RadRibbonButton;
4939
            if (App.ViewInfo != null)
4940
            {
4941
                if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면
4942
                {
4943
                    btnFinalPDF.Visibility = System.Windows.Visibility.Collapsed;
4944
                    if (btnConsolidate != null)
4945
                    {
4946
                        btnConsolidate.Visibility = Visibility.Collapsed;
4947
                    }
4948
                }
4949
            }
4950
        }
4951
4952
        private void SyncCompare_Click(object sender, RoutedEventArgs e)
4953
        {
4954
            if (CompareMode.IsChecked)
4955
            {
4956
                if (ViewerDataModel.Instance.PageBalanceMode && ViewerDataModel.Instance.PageBalanceNumber == 0)
4957
                {
4958
                    ViewerDataModel.Instance.PageBalanceNumber = 1;
4959
                }
4960
                if (ViewerDataModel.Instance.PageNumber == 0)
4961
                {
4962
                    ViewerDataModel.Instance.PageNumber = 1;
4963
                }
4964
4965 0f065e57 ljiyeon
                Logger.sendReqLog("GetCompareRectAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID + "," + CurrentRev.DOCUMENT_ID + 
4966
                    "," + pageNavigator.CurrentPage.PageNumber.ToString() + "," + ViewerDataModel.Instance.PageNumber.ToString() + "," +
4967
                    userData.COMPANY != "EXT" ? "true" : "false" , 1);
4968
4969 d9cf7d6e djkim
                BaseClient.GetCompareRectAsync(_ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber.ToString(), ViewerDataModel.Instance.PageNumber.ToString(), userData.COMPANY != "EXT" ? "true" : "false");
4970 787a4489 KangIngu
            }
4971
            else
4972
            {
4973
                da.From = 1;
4974
                da.To = 1;
4975
                da.Duration = new Duration(TimeSpan.FromSeconds(9999));
4976
                da.AutoReverse = false;
4977
                canvas_compareBorder.Children.Clear();
4978
                canvas_compareBorder.BeginAnimation(OpacityProperty, da);
4979
            }
4980
        }
4981
4982 9cd2865b KangIngu
        private void Sync_Click(object sender, RoutedEventArgs e)
4983
        {
4984 a1716fa5 KangIngu
            if (Sync.IsChecked)
4985 9cd2865b KangIngu
            {
4986
                ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
4987
                ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
4988
                ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
4989
            }
4990
        }
4991
4992 787a4489 KangIngu
        private void SyncUserListExpender_Click(object sender, RoutedEventArgs e)
4993
        {
4994
            if (UserList.IsChecked)
4995
            {
4996
                this.gridViewRevMarkup.Visibility = Visibility.Visible;
4997
            }
4998
            else
4999
            {
5000
                this.gridViewRevMarkup.Visibility = Visibility.Collapsed;
5001
            }
5002
        }
5003
5004
        private void SyncPageBalance_Click(object sender, RoutedEventArgs e)
5005
        {
5006
5007
            if (BalanceMode.IsChecked)
5008
            {
5009
                ViewerDataModel.Instance.PageBalanceMode = true;
5010
            }
5011
            else
5012
            {
5013
                ViewerDataModel.Instance.PageBalanceMode = false;
5014
                ViewerDataModel.Instance.PageBalanceNumber = 0;
5015
            }
5016
        }
5017
5018
        private void SyncExit_Click(object sender, RoutedEventArgs e)
5019
        {
5020
            //초기화
5021
            testPanel2.IsHidden = true;
5022
            ViewerDataModel.Instance.PageBalanceMode = false;
5023
            ViewerDataModel.Instance.PageBalanceNumber = 0;
5024
            ViewerDataModel.Instance.PageNumber = 0;
5025
            ViewerDataModel.Instance.MarkupControls_Sync.Clear();
5026
            this.gridViewRevMarkup.Visibility = Visibility.Collapsed;
5027
            UserList.IsChecked = false;
5028
            BalanceMode.IsChecked = false;
5029
        }
5030
5031
        private void SyncPageChange_Click(object sender, RoutedEventArgs e)
5032
        {
5033
            if ((sender as System.Windows.Controls.Control).Tag != null)
5034
            {
5035
                //Compare 초기화
5036
                CompareMode.IsChecked = false;
5037
                var balancePoint = Convert.ToInt32((sender as System.Windows.Controls.Control).Tag);
5038
5039
                if (ViewerDataModel.Instance.PageNumber == 0)
5040
                {
5041
                    ViewerDataModel.Instance.PageNumber = 1;
5042
                }
5043
5044
                if (ViewerDataModel.Instance.PageBalanceNumber == pageNavigator.PageCount)
5045
                {
5046
                }
5047
                else
5048
                {
5049
                    ViewerDataModel.Instance.PageBalanceNumber += balancePoint;
5050
                }
5051
5052
                if (ViewerDataModel.Instance.PageNumber == pageNavigator.PageCount && balancePoint > 0)
5053
                {
5054
5055
                }
5056
                else if ((ViewerDataModel.Instance.PageNumber + balancePoint) >= 1)
5057
                {
5058
                    ViewerDataModel.Instance.PageNumber += balancePoint;
5059
                }
5060
5061
                if (!testPanel2.IsHidden)
5062
                {
5063
                    if (IsSyncPDFMode)
5064
                    {
5065
                        Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
5066
                        var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber)));
5067
5068
                        if (pdfpath.IsDownloading)
5069
                        {
5070
                            pdfpath.DownloadCompleted += (ex, arg) =>
5071
                            {
5072
                                ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5073
                                ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5074
                                ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5075
                                zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5076
                                zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5077
                            };
5078
                        }
5079
                        else
5080
                        {
5081
                            ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5082
                            ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5083
                            ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5084
5085
                            zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5086
                            zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5087
                        }
5088
5089
                    }
5090
                    else
5091
                    {
5092 a874198d humkyung
                        string uri = "";
5093
5094
                        if (userData.COMPANY != "EXT")
5095
                        {
5096
                            uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber);
5097
                        }
5098
                        else
5099
                        {
5100
                            uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber);
5101
                        }
5102 787a4489 KangIngu
5103
                        var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
5104
5105
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5106
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5107
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5108
5109
                        zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
5110
                        zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
5111
5112
                        if (defaultBitmapImage_Compare.IsDownloading)
5113
                        {
5114
                            defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
5115
                            {
5116
                                ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5117
                                ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5118
                                ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5119
5120
                                zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
5121
                                zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
5122
                            };
5123
                        }
5124
                    }
5125
5126
                    //강인구 추가(페이지 이동시 코멘트 재 호출)
5127
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
5128
                    List<MarkupInfoItem> gridSelectionRevItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList();
5129
5130
                    foreach (var item in gridSelectionRevItem)
5131
                    {
5132
                        item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageNumber).ToList().ForEach(delegate (MarkupItem markupitem)
5133
                        {
5134
                            layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID);
5135
                        });
5136
                    }
5137 e54660e8 KangIngu
5138 787a4489 KangIngu
                    //강인구 추가
5139
                    zoomAndPanControl2.ZoomTo(new Rect
5140
                    {
5141
                        X = 0,
5142
                        Y = 0,
5143
                        Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width),
5144
                        Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height),
5145
                    });
5146 ae56d52d KangIngu
5147 787a4489 KangIngu
                    tlSyncPageNum.Text = String.Format("Current Page : {0}", ViewerDataModel.Instance.PageNumber);
5148
5149
                }
5150
            }
5151
        }
5152
5153
        private void SyncChange_Click(object sender, RoutedEventArgs e)
5154
        {
5155
            if (MarkupMode.IsChecked)
5156
            {
5157
                IsSyncPDFMode = true;
5158
5159
                var uri = CurrentRev.TO_VENDOR;
5160 ae56d52d KangIngu
5161 787a4489 KangIngu
                if (ViewerDataModel.Instance.PageNumber == 0)
5162
                {
5163
                    ViewerDataModel.Instance.PageNumber = 1;
5164
                }
5165
5166
                //PDF모드 잠시 대기(강인구)
5167
                Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
5168
                var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber)));
5169
5170
                if (pdfpath.IsDownloading)
5171
                {
5172
                    pdfpath.DownloadCompleted += (ex, arg) =>
5173
                    {
5174
                        ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5175
                        ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5176
                        ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5177
                        zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5178
                        zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5179
                    };
5180
                }
5181
                else
5182
                {
5183
                    ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5184
                    ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5185
                    ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5186
5187
                    zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5188
                    zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5189
                }
5190
            }
5191
            else
5192
            {
5193
                IsSyncPDFMode = false;
5194 a874198d humkyung
                string uri = "";
5195
                if (userData.COMPANY != "EXT")
5196
                {
5197
                    uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5198
                }
5199
                else
5200
                {
5201
                    uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5202
                }
5203 787a4489 KangIngu
5204
                var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
5205
5206
                ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5207
                ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5208
                ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5209
5210
                if (defaultBitmapImage_Compare.IsDownloading)
5211
                {
5212
                    defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
5213
                    {
5214
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5215
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5216
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5217
                    };
5218
                }
5219
                zoomAndPanControl2.ApplyTemplate();
5220
                zoomAndPanControl2.UpdateLayout();
5221
                zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
5222
                zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
5223
            }
5224
        }
5225
5226
        private void RadButton_Click(object sender, RoutedEventArgs e)
5227
        {
5228
            gridViewHistory_Busy.IsBusy = true;
5229
5230
            RadButton instance = sender as RadButton;
5231
            if (instance.CommandParameter != null)
5232
            {
5233
                CurrentRev = instance.CommandParameter as VPRevision;
5234
                BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) =>
5235
                {
5236
                    if (ea.Error == null && ea.Result != null)
5237
                    {
5238
                        testPanel2.IsHidden = false;
5239
5240
                        ViewerDataModel.Instance._markupInfoRevList = SetDisplayColor(ea.Result, _ViewInfo.UserID);
5241
                        gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList;
5242
5243 a874198d humkyung
                        string uri = "";
5244
                        if (userData.COMPANY != "EXT")
5245
                        {
5246
                            uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5247
                        }
5248
                        else
5249
                        {
5250
                            uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5251
                        }
5252 787a4489 KangIngu
5253
                        Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY);
5254
5255
                        var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
5256
5257
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5258
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5259
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5260
5261
                        if (defaultBitmapImage_Compare.IsDownloading)
5262
                        {
5263
                            defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
5264
                            {
5265
                                ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5266
                                ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5267
                                ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5268
                            };
5269
                        }
5270
5271
                        zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
5272
                        zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
5273
                        zoomAndPanControl2.RotationAngle = zoomAndPanControl.RotationAngle;
5274
                        zoomAndPanControl2.ApplyTemplate();
5275
                        zoomAndPanControl2.UpdateLayout();
5276
5277
                        if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY))
5278
                        {
5279
                            zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X;
5280
                            zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y;
5281
                        }
5282
5283 9cd2865b KangIngu
                        ViewerDataModel.Instance.Sync_ContentOffsetX = Sync_Offset_Point.X;
5284
                        ViewerDataModel.Instance.Sync_ContentOffsetY = Sync_Offset_Point.Y;
5285
                        ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
5286
5287 787a4489 KangIngu
                        tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo);
5288
                        tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber);
5289
                        gridViewHistory_Busy.IsBusy = false;
5290
                    }
5291 0f065e57 ljiyeon
5292
                    Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1);
5293
                };                
5294 787a4489 KangIngu
                BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID);
5295 0f065e57 ljiyeon
                Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1);
5296 787a4489 KangIngu
            }
5297
        }
5298
5299
        public void Sync_Event(VPRevision Currnet_Rev)
5300
        {
5301
            CurrentRev = Currnet_Rev;
5302
5303
            BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) =>
5304
            {
5305
                if (ea.Error == null && ea.Result != null)
5306
                {
5307
                    testPanel2.IsHidden = false;
5308
5309
                    ViewerDataModel.Instance._markupInfoRevList = SetDisplayColor(ea.Result, _ViewInfo.UserID);
5310
                    gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList;
5311
5312 a874198d humkyung
                    string uri = "";
5313 a1716fa5 KangIngu
                    if (userData.COMPANY != "EXT")
5314 a874198d humkyung
                    {
5315
                        uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5316
                    }
5317
                    else
5318
                    {
5319
                        uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5320
                    }
5321 787a4489 KangIngu
5322
                    Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY);
5323
5324
                    var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
5325
5326
                    ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5327
                    ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5328
                    ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5329
5330
                    if (defaultBitmapImage_Compare.IsDownloading)
5331
                    {
5332
                        defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
5333
                        {
5334
                            ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5335
                            ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5336
                            ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5337
                        };
5338
                    }
5339 d7548b21 ljiyeon
                    
5340
                    
5341 787a4489 KangIngu
                    zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
5342
                    zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
5343
                    zoomAndPanControl2.ApplyTemplate();
5344
                    zoomAndPanControl2.UpdateLayout();
5345
5346
                    if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY))
5347
                    {
5348
                        zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X;
5349
                        zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y;
5350
                    }
5351
                    //}
5352
5353
                    tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo);
5354
                    tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber);
5355 0f065e57 ljiyeon
                    gridViewHistory_Busy.IsBusy = false;                    
5356 787a4489 KangIngu
                }
5357 0f065e57 ljiyeon
                Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1);
5358
                
5359 787a4489 KangIngu
            };
5360 0f065e57 ljiyeon
            Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1);
5361
            BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID);           
5362 787a4489 KangIngu
        }
5363
5364
        private void PdfLink_ButtonDown(object sender, MouseButtonEventArgs e)
5365
        {
5366
            if (sender is Image)
5367
            {
5368
                if ((sender as Image).Tag != null)
5369
                {
5370
                    var pdfUrl = (sender as Image).Tag.ToString();
5371
                    System.Diagnostics.Process.Start(pdfUrl);
5372
                }
5373
                else
5374
                {
5375
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("문서 정보가 잘못 되었습니다", "안내");
5376
                }
5377
            }
5378
        }
5379
5380
        private void Create_Symbol(object sender, RoutedEventArgs e)
5381
        {
5382
            MarkupToPDF.Controls.Parsing.LayerControl.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.LayerControl.MarkupReturn();
5383
            MarkupToPDF.Controls.Parsing.LayerControl layer = new MarkupToPDF.Controls.Parsing.LayerControl();
5384
5385
            if (SelectLayer.Children.Count < 1) //선택된 것이 없으면
5386
            {
5387
                DialogMessage_Alert("Please Select Controls", "Alert");
5388
            }
5389
            else //선택된 것이 있으면
5390
            {
5391
                string MarkupData = "";
5392
                adorner_ = new AdornerFinal();
5393
5394
                foreach (var item in SelectLayer.Children)
5395
                {
5396
                    if (item.GetType().Name == "AdornerFinal")
5397
                    {
5398
                        adorner_ = (item as Controls.AdornerFinal);
5399
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
5400
                        {
5401
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
5402
                            {
5403
                                markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
5404
                                MarkupData += markupReturn.ConvertData;
5405
                            }
5406
                        }
5407
                    }
5408
                }
5409
                DialogParameters parameters = new DialogParameters()
5410
                {
5411
                    Closed = (obj, args) => this.MarkupNamePromptClose(MarkupData, args),
5412
                    DefaultPromptResultValue = "Custom State",
5413
                    Content = "Name :",
5414
                    Header = "Insert Custom Symbol Name",
5415
                    Theme = new VisualStudio2013Theme(),
5416
                    ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
5417
                };
5418
                RadWindow.Prompt(parameters);
5419
            }
5420
5421
        }
5422
5423
        private void MarkupNamePromptClose(string data, WindowClosedEventArgs args)
5424
        {
5425
            Save save = new Save();
5426
5427
            if (args.DialogResult.Value)
5428
            {
5429
                PngBitmapEncoder _Encoder = symImage(data);
5430
5431
                System.IO.MemoryStream fs = new System.IO.MemoryStream();
5432
                _Encoder.Save(fs);
5433
                System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs);
5434
5435
                byte[] Img_byte = fs.ToArray();
5436
5437
                kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
5438
                filename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Save.shortGuid() + ".png", Img_byte);
5439
5440
                save.SymbolSave(args.PromptResult, filename, data);
5441
            }
5442
        }
5443
5444
        public PngBitmapEncoder symImage(string data)
5445
        {
5446
5447
            Canvas _canvas = new Canvas();
5448
            _canvas.Background = Brushes.White;
5449
            _canvas.Width = adorner_.BorderSize.Width;
5450
            _canvas.Height = adorner_.BorderSize.Height;
5451
            layerControl.markupParse(data, _canvas, "#FFFF0000", "");
5452
5453
            BitmapEncoder encoder = new PngBitmapEncoder();
5454
5455
5456
            RenderTargetBitmap renderBitmap = new RenderTargetBitmap((int)_canvas.Width + 50, (int)_canvas.Height + 50, 96d, 96d, PixelFormats.Pbgra32);
5457
5458
            DrawingVisual dv = new DrawingVisual();
5459
5460
            _canvas.Measure(new System.Windows.Size(adorner_.BorderSize.Width + 50, adorner_.BorderSize.Height + 50));
5461
            _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)));
5462
5463
            using (DrawingContext ctx = dv.RenderOpen())
5464
            {
5465
                VisualBrush vb = new VisualBrush(_canvas);
5466
                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)));
5467
            }
5468
5469
            try
5470
            {
5471
                renderBitmap.Render(dv);
5472
5473
                GC.Collect();
5474
                GC.WaitForPendingFinalizers();
5475
                GC.Collect();
5476
                // encode png data
5477
                PngBitmapEncoder pngEncoder = new PngBitmapEncoder();
5478
                // puch rendered bitmap into it
5479
                pngEncoder.Interlace = PngInterlaceOption.Off;
5480
                pngEncoder.Frames.Add(BitmapFrame.Create(renderBitmap));
5481
                return pngEncoder;
5482
5483
            }
5484
            catch (Exception ex)
5485
            {
5486
                return null;
5487
            }
5488
5489
        }
5490
5491
        public void DialogMessage_Alert(string content, string header)
5492
        {
5493
            var box = new TextBlock();
5494
            box.MinWidth = 400;
5495
            box.FontSize = 11;
5496
            //box.FontSize = 12;
5497
            box.Text = content;
5498
            box.TextWrapping = System.Windows.TextWrapping.Wrap;
5499
5500
            DialogParameters parameters = new DialogParameters()
5501
            {
5502
                Content = box,
5503
                Header = header,
5504
                Theme = new VisualStudio2013Theme(),
5505
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
5506
            };
5507
            RadWindow.Alert(parameters);
5508
        }
5509
5510
        #region 캡쳐 기능
5511
5512
        public BitmapSource CutAreaToImage(int x, int y, int width, int height)
5513
        {
5514
            if (x < 0)
5515
            {
5516
                width += x;
5517
                x = 0;
5518
            }
5519
            if (y < 0)
5520
            {
5521
                height += y;
5522
                y = 0;
5523
5524
                width = (int)zoomAndPanCanvas.ActualWidth - x;
5525
            }
5526
            if (x + width > zoomAndPanCanvas.ActualWidth)
5527
            {
5528
                width = (int)zoomAndPanCanvas.ActualWidth - x;
5529
            }
5530
            if (y + height > zoomAndPanCanvas.ActualHeight)
5531
            {
5532
                height = (int)zoomAndPanCanvas.ActualHeight - y;
5533
            }
5534
5535
            byte[] pixels = CopyPixels(x, y, width, height);
5536
5537
            int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8;
5538
5539
            return BitmapSource.Create(width, height, 96, 96, PixelFormats.Pbgra32, null, pixels, stride);
5540
        }
5541
5542
        public byte[] CopyPixels(int x, int y, int width, int height)
5543
        {
5544
            byte[] pixels = new byte[width * height * 4];
5545
            int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8;
5546
5547
            // Canvas 이미지에서 객체 역역만큼 픽셀로 복사
5548
            canvasImage.CopyPixels(new Int32Rect(x, y, width, height), pixels, stride, 0);
5549
5550
            return pixels;
5551
        }
5552
5553
        public RenderTargetBitmap ConverterBitmapImage(FrameworkElement element)
5554
        {
5555
            DrawingVisual drawingVisual = new DrawingVisual();
5556
            DrawingContext drawingContext = drawingVisual.RenderOpen();
5557
5558
            // 해당 객체의 그래픽요소로 사각형의 그림을 그립니다.
5559
            drawingContext.DrawRectangle(new VisualBrush(element), null,
5560
                new Rect(new Point(0, 0), new Point(element.ActualWidth, element.ActualHeight)));
5561
            drawingContext.Close();
5562
5563
            // 비트맵으로 변환합니다.
5564
            RenderTargetBitmap target =
5565
                new RenderTargetBitmap((int)element.ActualWidth, (int)element.ActualHeight,
5566
                96, 96, System.Windows.Media.PixelFormats.Pbgra32);
5567
5568
            target.Render(drawingVisual);
5569
            return target;
5570
        }
5571
5572
        public void Save_Capture(BitmapSource source, int x, int y, int width, int height)
5573
        {
5574
            KCOM.Common.Converter.FileStreamToBase64 streamToBase64 = new Common.Converter.FileStreamToBase64();
5575
            KCOMDataModel.DataModel.CHECK_LIST check_;
5576
            string Result = streamToBase64.ImageToBase64(source);
5577
            KCOMDataModel.DataModel.CHECK_LIST Item = new KCOMDataModel.DataModel.CHECK_LIST();
5578 6c781c0c djkim
            string projectno = App.ViewInfo.ProjectNO;
5579
            string checklist_id = ViewerDataModel.Instance.CheckList_ID;
5580 0f065e57 ljiyeon
5581
            Logger.sendReqLog("GetCheckList", projectno + "," + checklist_id, 1);
5582 6c781c0c djkim
            Item = this.BaseClient.GetCheckList(projectno, checklist_id);
5583 0f065e57 ljiyeon
            if(Item != null)
5584
            {
5585
                Logger.sendResLog("GetCheckList", "TRUE", 1);
5586
            }
5587
            else
5588
            {
5589
                Logger.sendResLog("GetCheckList", "FALSE", 1);
5590
            }
5591
            
5592 6c781c0c djkim
            if (Item == null)
5593 787a4489 KangIngu
            {
5594 6c781c0c djkim
                check_ = new KCOMDataModel.DataModel.CHECK_LIST
5595 787a4489 KangIngu
                {
5596 6c781c0c djkim
                    ID = Save.shortGuid(),
5597
                    USER_ID = App.ViewInfo.UserID,
5598
                    IMAGE_URL = Result,
5599
                    IMAGE_ANCHOR = x + "," + y + "," + width + "," + height,
5600
                    PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber,
5601
                    REVISION = ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision,
5602
                    DOCUMENT_ID = App.ViewInfo.DocumentItemID,
5603
                    PROJECT_NO = App.ViewInfo.ProjectNO,
5604
                    STATUS = "False",
5605
                    CREATE_TIME = DateTime.Now,
5606
                    UPDATE_TIME = DateTime.Now,
5607
                    DOCUMENT_NO = _DocItem.DOCUMENT_NO,
5608
                    STATUS_DESC_OPEN = "Vendor 반영 필요",
5609
                };
5610 0f065e57 ljiyeon
                Logger.sendReqLog("AddCheckList", projectno + "," + check_, 1);
5611
                Logger.sendResLog("AddCheckList", this.BaseClient.AddCheckList(projectno, check_).ToString(), 1);
5612
                //this.BaseClient.AddCheckList(projectno, check_);
5613 787a4489 KangIngu
            }
5614 6c781c0c djkim
            else
5615
            {
5616
                Item.IMAGE_URL = Result;
5617
                Item.IMAGE_ANCHOR = x + "," + y + "," + width + "," + height;
5618 0f065e57 ljiyeon
                Item.PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber;          
5619
                Logger.sendReqLog("SaveCheckList", projectno + "," + checklist_id + "," + Item, 1);
5620
                Logger.sendResLog("SaveCheckList", this.BaseClient.SaveCheckList(projectno, checklist_id, Item).ToString(), 1);
5621
                //this.BaseClient.SaveCheckList(projectno, checklist_id, Item);
5622 6c781c0c djkim
            }
5623
            
5624 787a4489 KangIngu
        }
5625
5626
        public void Set_Capture()
5627 6c781c0c djkim
        {            
5628 787a4489 KangIngu
            double x = canvasDrawingMouseDownPoint.X;
5629
            double y = canvasDrawingMouseDownPoint.Y;
5630
            double width = dragCaptureBorder.Width;
5631
            double height = dragCaptureBorder.Height;
5632
5633
            if (width > 5 || height > 5)
5634
            {
5635
                canvasImage = ConverterBitmapImage(zoomAndPanCanvas);
5636
                BitmapSource source = CutAreaToImage((int)x, (int)y, (int)width, (int)height);
5637
                Save_Capture(source, (int)x, (int)y, (int)width, (int)height);
5638
            }
5639
        }
5640
        #endregion
5641
5642 7cee8c20 ljiyeon
        TempFile temp = new TempFile();
5643 d7548b21 ljiyeon
        //MarkupInfoItem
5644 787a4489 KangIngu
        public void CreateControl()
5645
        {
5646 d7548b21 ljiyeon
            
5647 787a4489 KangIngu
            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
5648
            {
5649
                ViewerDataModel.Instance.UndoDataList.Remove(i);
5650
            });
5651
            multi_Undo_Data.Markup = currentControl;
5652
            UndoData.Markup_List.Add(multi_Undo_Data);
5653 d7548b21 ljiyeon
           
5654 787a4489 KangIngu
            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
5655 d7548b21 ljiyeon
5656
            //List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList();
5657 787a4489 KangIngu
        }
5658 d7548b21 ljiyeon
        
5659 787a4489 KangIngu
        public Multi_Undo_data Control_Style(CommentUserInfo control)
5660
        {
5661
            multi_Undo_Data = new Multi_Undo_data();
5662
5663
            multi_Undo_Data.Markup = control;
5664
5665
            if ((control as IShapeControl) != null)
5666
            {
5667
                multi_Undo_Data.paint = (control as IShapeControl).Paint;
5668
            }
5669
            if ((control as IDashControl) != null)
5670
            {
5671
                multi_Undo_Data.DashSize = (control as IDashControl).DashSize;
5672
            }
5673
            if ((control as IPath) != null)
5674
            {
5675
                multi_Undo_Data.LineSize = (control as IPath).LineSize;
5676
            }
5677
            if ((control as UIElement) != null)
5678
            {
5679
                multi_Undo_Data.Opacity = (control as UIElement).Opacity;
5680
            }
5681
5682
            return multi_Undo_Data;
5683
        }
5684
5685
        public void Undo()
5686
        {
5687 4c8bb207 djkim
            if (ViewerDataModel.Instance.IsPressCtrl)
5688
            {
5689
                ViewerDataModel.Instance.IsPressCtrl = false;
5690
            }
5691 787a4489 KangIngu
            Undo_data undo = new Undo_data();
5692
            AdornerFinal final;
5693
            ReleaseAdorner();
5694
5695
            undo = ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == false).ToList().OrderByDescending(order => order.EventTime).FirstOrDefault();
5696
            if (undo == null)
5697
                return;
5698
5699 d7548b21 ljiyeon
            
5700
5701 787a4489 KangIngu
            switch (undo.Event)
5702
            {
5703
                case (Event_Type.Create):
5704
                    {
5705
                        foreach (var item in undo.Markup_List)
5706
                        {
5707
                            ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup));
5708
                        }
5709
                    }
5710
                    break;
5711
                case (Event_Type.Delete):
5712
                    {
5713
                        foreach (var item in undo.Markup_List)
5714
                        {
5715
                            ViewerDataModel.Instance.MarkupControls_USER.Add(item.Markup);
5716
                        }
5717
                    }
5718
                    break;
5719
                case (Event_Type.Thumb):
5720
                    {
5721
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
5722
5723
                        foreach (var item in undo.Markup_List)
5724
                        {
5725
                            ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup));
5726
5727
                            if ((item.Markup as IViewBox) != null)
5728
                            {
5729
                                (item.Markup as IViewBox).Angle = item.Angle;
5730
                            }
5731
                            if ((item.Markup as TextControl) != null)
5732
                            {
5733
                                (item.Markup as TextControl).Angle = item.Angle;
5734
                                Canvas.SetLeft((item.Markup as TextControl), item.PointSet[0].X);
5735
                                Canvas.SetTop((item.Markup as TextControl), item.PointSet[0].Y);
5736
                            }
5737
                            else
5738
                            {
5739
                                (item.Markup as IPath).PointSet = item.PointSet;
5740
                                (item.Markup as IPath).updateControl();
5741
                            }
5742
5743
                            comment.Add(item.Markup);
5744
                        }
5745
                        final = new AdornerFinal(comment);
5746
                        SelectLayer.Children.Add(final);
5747
                        ReleaseAdorner();
5748
                    }
5749
                    break;
5750
                case (Event_Type.Select):
5751
                    {
5752
                        ReleaseAdorner();
5753
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
5754
5755
                        foreach (var item in undo.Markup_List)
5756
                        {
5757
                            ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup));
5758
5759
                            if ((item.Markup as IPath) != null)
5760
                            {
5761
                                (item.Markup as IPath).LineSize = item.LineSize;
5762
                            }
5763
                            if ((item.Markup as UIElement) != null)
5764
                            {
5765
                                (item.Markup as UIElement).Opacity = item.Opacity;
5766
                            }
5767
                            if ((item.Markup as IDashControl) != null)
5768
                            {
5769
                                (item.Markup as IDashControl).DashSize = item.DashSize;
5770
                            }
5771
                            if ((item.Markup as IShapeControl) != null)
5772
                            {
5773
                                (item.Markup as IShapeControl).Paint = item.paint;
5774
                            }
5775
5776
                            comment.Add(item.Markup);
5777
                        }
5778
5779
                        final = new AdornerFinal(comment);
5780
                        SelectLayer.Children.Add(final);
5781
                    }
5782
                    break;
5783
                case (Event_Type.Option):
5784
                    {
5785
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
5786
5787
                        foreach (var item in undo.Markup_List)
5788
                        {
5789
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup);
5790
5791
                            if (undo.LineSize != 0 && item.Markup as IPath != null)
5792
                            {
5793
                                (item.Markup as IPath).LineSize = undo.LineSize;
5794
                            }
5795
                            else if (undo.Opacity != 0 && item.Markup as UIElement != null)
5796
                            {
5797
                                (item.Markup as UIElement).Opacity = undo.Opacity;
5798
                            }
5799
                            else if (undo.DashSize != null && item.Markup as IDashControl != null)
5800
                            {
5801
                                (item.Markup as IDashControl).DashSize = undo.DashSize;
5802
                            }
5803 5ce56a3a KangIngu
                            else if (undo.Interval != 0 && item.Markup as LineControl != null)
5804
                            {
5805
                                (item.Markup as LineControl).Interval = undo.Interval;
5806
                            }
5807 787a4489 KangIngu
                            else if (item.Markup as IShapeControl != null)
5808
                            {
5809
                                (item.Markup as IShapeControl).Paint = undo.paint;
5810
                            }
5811
                            comment.Add(item.Markup);
5812
                        }
5813
                        final = new AdornerFinal(comment);
5814
                        SelectLayer.Children.Add(final);
5815
                    }
5816
                    break;
5817
            }
5818
            ViewerDataModel.Instance.UndoDataList.Where(data => data.EventTime == undo.EventTime).ToList().OrderByDescending(order => order.EventTime).ToList().ForEach(i =>
5819
           {
5820
               i.IsUndo = true;
5821
           });
5822
        }
5823
5824 6707a5c7 ljiyeon
5825
        
5826 787a4489 KangIngu
        public void Redo()
5827
        {
5828 4c8bb207 djkim
            if (ViewerDataModel.Instance.IsPressCtrl)
5829
            {
5830
                ViewerDataModel.Instance.IsPressCtrl = false;
5831
            }
5832 787a4489 KangIngu
            AdornerFinal final;
5833
            Undo_data redo = new Undo_data();
5834
            redo = ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().OrderBy(order => order.EventTime).FirstOrDefault();
5835
            ReleaseAdorner();
5836
            if (redo == null)
5837
                return;
5838
5839
            switch (redo.Event)
5840
            {
5841
                case (Event_Type.Create):
5842
                    {
5843
                        foreach (var item in redo.Markup_List)
5844
                        {
5845
                            ViewerDataModel.Instance.MarkupControls_USER.Add(item.Markup);
5846 6707a5c7 ljiyeon
                            //temp.AddTemp(redo, pageNavigator.CurrentPage.PageNumber, 0, 0);
5847 787a4489 KangIngu
                        }
5848
                    }
5849
                    break;
5850
                case (Event_Type.Delete):
5851
                    {
5852
                        foreach (var item in redo.Markup_List)
5853
                        {
5854
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup);
5855
                        }
5856
                    }
5857
                    break;
5858
                case (Event_Type.Thumb):
5859
                    {
5860
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
5861
5862
                        foreach (var item in redo.Markup_List)
5863
                        {
5864
                            ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup as CommentUserInfo));
5865
5866
                            if ((item.Markup as IViewBox) != null)
5867
                            {
5868
                                (item.Markup as IViewBox).Angle = item.Angle;
5869
                            }
5870
                            if ((item.Markup as TextControl) != null)
5871
                            {
5872
                                (item.Markup as TextControl).Angle = item.Angle;
5873
5874
                                Canvas.SetLeft((item.Markup as TextControl), item.PointSet[0].X);
5875
                                Canvas.SetTop((item.Markup as TextControl), item.PointSet[0].Y);
5876
                            }
5877
                            else
5878
                            {
5879
                                (item.Markup as IPath).PointSet = item.PointSet;
5880
                                (item.Markup as IPath).updateControl();
5881
                            }
5882
                            comment.Add(item.Markup);
5883
                        }
5884
                        final = new AdornerFinal(comment);
5885
                        SelectLayer.Children.Add(final);
5886
                        ReleaseAdorner();
5887
                    }
5888
                    break;
5889
                case (Event_Type.Select):
5890
                    {
5891
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
5892
5893
                        foreach (var item in redo.Markup_List)
5894
                        {
5895
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup);
5896
5897
                            if ((item.Markup as IPath) != null)
5898
                            {
5899
                                (item.Markup as IPath).LineSize = item.LineSize;
5900
                            }
5901
                            if ((item.Markup as UIElement) != null)
5902
                            {
5903
                                (item.Markup as UIElement).Opacity = item.Opacity;
5904
                            }
5905
                            if ((item.Markup as IDashControl) != null)
5906
                            {
5907
                                (item.Markup as IDashControl).DashSize = item.DashSize;
5908
                            }
5909
                            if ((item.Markup as IShapeControl) != null)
5910
                            {
5911
                                (item.Markup as IShapeControl).Paint = item.paint;
5912
                            }
5913
5914
                            comment.Add(item.Markup);
5915
                        }
5916
                        final = new AdornerFinal(comment);
5917
                        SelectLayer.Children.Add(final);
5918
                    }
5919
                    break;
5920
                case (Event_Type.Option):
5921
                    {
5922
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
5923
5924
                        foreach (var item in redo.Markup_List)
5925
                        {
5926
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup);
5927
                            if (redo.LineSize != 0 && item.Markup as IPath != null)
5928
                            {
5929
                                (item.Markup as IPath).LineSize = redo.LineSize;
5930
                            }
5931
                            else if (redo.Opacity != 0 && item.Markup as UIElement != null)
5932
                            {
5933
                                (item.Markup as UIElement).Opacity = redo.Opacity;
5934
                            }
5935
                            else if (redo.DashSize != null && item.Markup as IDashControl != null)
5936
                            {
5937
                                (item.Markup as IDashControl).DashSize = redo.DashSize;
5938
                            }
5939 a1716fa5 KangIngu
                            else if (redo.Interval != 0 && item.Markup as LineControl != null)
5940 5ce56a3a KangIngu
                            {
5941
                                (item.Markup as LineControl).Interval = redo.Interval;
5942
                            }
5943 787a4489 KangIngu
                            else if (item.Markup as IShapeControl != null)
5944
                            {
5945
                                (item.Markup as IShapeControl).Paint = redo.paint;
5946
                            }
5947
                            comment.Add(item.Markup);
5948
                        }
5949
                        final = new AdornerFinal(comment);
5950
                        SelectLayer.Children.Add(final);
5951
                    }
5952
                    break;
5953
            }
5954
5955
            ViewerDataModel.Instance.UndoDataList.Where(data => data.EventTime == redo.EventTime).ToList().OrderByDescending(order => order.EventTime).ToList().ForEach(i =>
5956
            {
5957
                i.IsUndo = false;
5958
            });
5959
        }
5960
5961
        private void Comment_Move(object sender, MouseButtonEventArgs e)
5962
        {
5963
            string Select_ID = (((e.Source as Telerik.Windows.Controls.RadButton).DataContext) as IKCOM.MarkupInfoItem).UserID;
5964
            foreach (var items in ViewerDataModel.Instance._markupInfoRevList)
5965
            {
5966
                if (items.UserID == Select_ID)
5967
                {
5968
                    foreach (var item in items.MarkupList)
5969
                    {
5970
                        if (item.PageNumber == pageNavigator.CurrentPage.PageNumber)
5971
                        {
5972
                            layerControl.markupParseEx(item.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, "#FFFF0000", "", items.MarkupInfoID, Save.shortGuid());
5973
                        }
5974
                    }
5975
                }
5976
            }
5977
        }
5978 23a96932 djkim
        public void EmptyControlCheck()
5979
        {
5980
            for (var j = 0; j < (Common.ViewerDataModel.Instance.MarkupControls_USER).Count; j++)
5981
            {
5982
                if (((Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).GetType().Name == "TextControl")
5983
                {
5984
                    if (((MarkupToPDF.Controls.Text.TextControl)(Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).Text == null
5985
                    || ((MarkupToPDF.Controls.Text.TextControl)(Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).Text == "")
5986
                    {
5987
                        Common.ViewerDataModel.Instance.MarkupControls_USER.RemoveAt(j);
5988
                    }
5989
                }
5990
                else if (((Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).GetType().Name == "ArrowTextControl")
5991
                {
5992
                    if (((MarkupToPDF.Controls.Text.ArrowTextControl)(Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).Base_TextBox.Text == null
5993
                    || ((MarkupToPDF.Controls.Text.ArrowTextControl)(Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).Base_TextBox.Text == "")
5994
                    {
5995
                        Common.ViewerDataModel.Instance.MarkupControls_USER.RemoveAt(j);
5996
                    }
5997
                }
5998
            }
5999
        }
6000 787a4489 KangIngu
        public void InkControl_Convert()
6001
        {
6002
            if (inkBoard.Strokes.Count > 0)
6003
            {
6004
                inkBoard.Strokes.ToList().ForEach(stroke =>
6005
                {
6006
                    List<Stroke> removingStroke = new List<Stroke>();
6007
                    StrokeCollection stC = new StrokeCollection();
6008
6009
                    removingStroke.Add(stroke);
6010
6011
                    InkToPath ip = new InkToPath();
6012
                    List<Point> inkPointSet = new List<Point>();
6013
                    PolygonControl pc = null;
6014
                    pc = new PolygonControl()
6015
                    {
6016
                        Angle = 0,
6017
                        PointSet = new List<Point>(),
6018
                        ControlType = ControlType.Ink
6019
                    };
6020
                    foreach (var item in removingStroke)
6021
                    {
6022
                        inkPointSet.AddRange(ip.StrokeGetPointsPlus(item));
6023
                        inkBoard.Strokes.Remove(item);
6024
                    }
6025
                    if (inkPointSet.Count != 0)
6026
                    {
6027
                        //강인구 추가(PenControl Undo Redo 추가)
6028
                        UndoData = new Undo_data()
6029
                        {
6030
                            IsUndo = false,
6031
                            Event = Event_Type.Create,
6032
                            EventTime = DateTime.Now,
6033
                            Markup_List = new List<Multi_Undo_data>()
6034
                        };
6035
6036
                        pc.StartPoint = inkPointSet[0];
6037
                        pc.EndPoint = inkPointSet[inkPointSet.Count - 1];
6038
                        pc.PointSet = inkPointSet;
6039
                        pc.LineSize = 3;
6040
                        pc.CommentID = Save.shortGuid();
6041
                        pc.StrokeColor = new SolidColorBrush(Colors.Red);
6042
                        ViewerDataModel.Instance.MarkupControls_USER.Add(pc);
6043
                        pc.SetPolyPath();
6044
6045
                        ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
6046
                        {
6047
                            ViewerDataModel.Instance.UndoDataList.Remove(i);
6048
                        });
6049
                        multi_Undo_Data.Markup = pc as CommentUserInfo;
6050
                        UndoData.Markup_List.Add(multi_Undo_Data);
6051
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);
6052
                    }
6053
                });
6054
            }
6055
        }
6056 17a22987 KangIngu
6057 4318fdeb KangIngu
        /// <summary>
6058
        /// 정원, 정사각형, 정삼각형을 그리기 위한 EndPoint계산
6059
        /// </summary>
6060
        /// <param name="StartP">StartPoint</param>
6061
        /// <param name="EndP">EndPoint</param>
6062
        /// <returns>Return_EndPoint</returns>
6063
        private Point GetSquareEndPoint(Point StartP, Point EndP)
6064 17a22987 KangIngu
        {
6065 ae56d52d KangIngu
            Point Return_Point = new Point();
6066 17a22987 KangIngu
6067 4318fdeb KangIngu
            double dx = EndP.X - StartP.X;
6068
            double dy = EndP.Y - StartP.Y;
6069
            double length;
6070 17a22987 KangIngu
6071 4318fdeb KangIngu
            switch (controlType)
6072
            {
6073
                case ControlType.Triangle:
6074
                    {
6075
                        //삼각형의 StartPoint기준으로 반지름 만큼 증가하기 때문에 곱하기2 필요
6076
                        length = Math.Max(Math.Abs(dx) * 2, Math.Abs(dy));
6077
                        Return_Point = (dy < 0) ? new Point(StartP.X + length / 2, StartP.Y - length) : new Point(StartP.X + length / 2, StartP.Y + length);
6078
                    }
6079
                    break;
6080
                default:
6081
                    {
6082
                        length = Math.Max(Math.Abs(dx), Math.Abs(dy));
6083
                        Return_Point.X = (dx > 0) ? StartP.X + length : StartP.X - length;
6084
                        Return_Point.Y = (dy > 0) ? StartP.Y + length : StartP.Y - length;
6085
                    }
6086
                    break;
6087
            }
6088 17a22987 KangIngu
6089
            return Return_Point;
6090
        }
6091 e753423e humkyung
6092
        /// <summary>
6093
        /// 정삼각형을 그리기위한 두 포인트를 계산하여 넘겨줌
6094
        /// </summary>
6095
        /// <author>humkyung</author>
6096
        /// <date>2018.04.26</date>
6097
        /// <param name="StartP"></param>
6098
        /// <param name="EndP"></param>
6099
        /// <returns></returns>
6100 32e95118 KangIngu
        /// <history>humkyung 2018.05.11 apply axis lock</history>
6101 e54660e8 KangIngu
        private List<Point> GetRegularTrianglePoints(Point StartP, Point EndP, bool bCheckAxis = false)
6102 e753423e humkyung
        {
6103
            List<Point> res = new List<Point>();
6104
6105
            double dx = EndP.X - StartP.X;
6106
            double dy = EndP.Y - StartP.Y;
6107
            double length = Math.Sqrt(dx * dx + dy * dy);
6108 e54660e8 KangIngu
            double baseLength = length * Math.Tan(30.0 * Math.PI / 180.0);
6109 e753423e humkyung
            dx /= length;
6110
            dy /= length;
6111
            double tmp = dx;
6112
            dx = -dy; dy = tmp; /// rotate by 90 degree
6113
6114
            res.Add(new Point(EndP.X + dx * baseLength, EndP.Y + dy * baseLength));
6115
            res.Add(new Point(EndP.X - dx * baseLength, EndP.Y - dy * baseLength));
6116
6117
            return res;
6118
        }
6119 a1716fa5 KangIngu
6120 e66f22eb KangIngu
        /// <summary>
6121
        /// 캔버스에 그릴때 모든 포인트가 캔버스를 벗어 났는지 체크하여 넘겨줌
6122
        /// </summary>
6123
        /// <author>ingu</author>
6124
        /// <date>2018.06.05</date>
6125
        /// <param name="getPoint"></param>
6126
        /// <returns></returns>
6127
        private bool IsGetoutpoint(Point getPoint)
6128 670a4be2 humkyung
        {
6129 e66f22eb KangIngu
            if (getPoint == new Point())
6130 670a4be2 humkyung
            {
6131 e66f22eb KangIngu
                ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl);
6132
                currentControl = null;
6133
                return true;
6134 670a4be2 humkyung
            }
6135
6136 e66f22eb KangIngu
            return false;
6137 670a4be2 humkyung
        }
6138 e66f22eb KangIngu
6139 5b46312f djkim
        private void zoomAndPanControl_DragOver(object sender, DragEventArgs e)
6140
        {
6141
            e.Effects = DragDropEffects.Copy;
6142
        }
6143
6144
        private void zoomAndPanControl_DragEnter(object sender, DragEventArgs e)
6145
        {
6146
            e.Effects = DragDropEffects.Copy;
6147
        }
6148
6149
        private void zoomAndPanControl_DragLeave(object sender, DragEventArgs e)
6150
        {
6151
            e.Effects = DragDropEffects.None;
6152
        }
6153
6154
        private void zoomAndPanControl_Drop(object sender, DragEventArgs e)
6155
        {
6156
            if (e.Data.GetDataPresent(typeof(string)))
6157
            {
6158
                this.getCurrentPoint = e.GetPosition(drawingRotateCanvas);
6159
                string dragData = e.Data.GetData(typeof(string)) as string;
6160
                Move_Symbol(sender, dragData);
6161
            }
6162
        }
6163
6164
        private void Move_Symbol(object sender, string dragData)
6165
        {
6166
            if (dragData.Contains("|DZ|"))
6167
            {
6168
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
6169
6170
                string[] delimiterChars = { "|DZ|" };
6171
                string[] data = dragData.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
6172
6173
                this.ParentOfType<MainWindow>().dzMainMenu.ReleaseAdorner();
6174
6175
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
6176
6177
                //강인구 Undo/Redo 보류
6178
                UndoData = new Undo_data()
6179
                {
6180
                    IsUndo = false,
6181
                    Event = Event_Type.Create,
6182
                    EventTime = DateTime.Now,
6183
                    Markup_List = new List<Multi_Undo_data>()
6184
                };
6185
6186
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
6187
                {
6188
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
6189
                });
6190
6191
                foreach (string parse in data)
6192
                {
6193
                    if (parse != "")
6194
                    {
6195
                        System.Windows.Controls.Control item = this.layerControl.markupParse_Paste(parse, ViewerDataModel.Instance.MarkupControls_USER);
6196
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid();
6197
6198
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
6199
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
6200
6201
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
6202
6203
                        multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo);
6204
6205
                        UndoData.Markup_List.Add(multi_Undo_Data);
6206
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);
6207
                    }
6208
                }
6209
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
6210
6211
                /// move symbol to current mouse point
6212
                double realPointX = this.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
6213
                double realPointY = this.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
6214
                final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
6215
6216
                if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
6217
                {
6218
                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
6219
                }
6220
                /// up to here
6221 6707a5c7 ljiyeon
6222 5b46312f djkim
                ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Add(final);
6223
            }
6224
        }
6225 787a4489 KangIngu
    }
6226 5a6a5dd1 humkyung
}
클립보드 이미지 추가 (최대 크기: 500 MB)