프로젝트

일반

사용자정보

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

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

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