프로젝트

일반

사용자정보

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

markus / KCOM / Views / MainMenu.xaml.cs @ 548c696e

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