프로젝트

일반

사용자정보

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

markus / KCOM / Views / MainMenu.xaml.cs @ 19391ad3

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