프로젝트

일반

사용자정보

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

markus / KCOM / Views / MainMenu.xaml.cs @ 91efe37a

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