프로젝트

일반

사용자정보

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

markus / KCOM / Views / MainMenu.xaml.cs @ 05009a0e

이력 | 보기 | 이력해설 | 다운로드 (317 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
                uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToInt32(_ViewInfo.DocumentItemID) / 100).ToString(), _ViewInfo.DocumentItemID, e.PageNumber);
542
            }
543
            else
544
            {
545
                uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, e.PageNumber);
546
            }
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
                        uri2 = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, BalancePoint);
624
                    }
625
                    else
626
                    {
627
                        uri2 = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, BalancePoint);
628
                    }
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
                //ToolTip tool = new System.Windows.Controls.ToolTip();
1146
                //tool.Content = "ToolTip";
1147
                //panel.ToolTip = tool;
1148
            }
1149
1150
            if (mouseHandlingMode != MouseHandlingMode.Drawing)
1151
            {
1152
                #region 마우스 오버 시 색상 변경
1153 4913851c humkyung
                /*
1154
                var firstCondition = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
1155
                Color TempColor = MarkupToPDF.Controls.Common.ValueConverter.StringToColorConverter.Parse("FF07B4FF");
1156 787a4489 KangIngu
1157 4913851c humkyung
                if (firstCondition != null)
1158
                {
1159
                    firstCondition.MouseLeave += new System.Windows.Input.MouseEventHandler(firstCondition_MouseLeave);
1160 787a4489 KangIngu
1161 4913851c humkyung
                    if (firstCondition.GetType().Name == "TextControl")
1162
                    {
1163
                        (firstCondition as TextControl).BackInnerColor = new SolidColorBrush(TempColor);
1164
                        return;
1165
                    }
1166
                    else if (firstCondition.GetType().Name == "ArrowTextControl")
1167
                    {
1168
                        (firstCondition as ArrowTextControl).BackInnerColor = new SolidColorBrush(TempColor);
1169
                        return;
1170
                    }
1171 787a4489 KangIngu
1172 4913851c humkyung
                    if (L_Size == 0)
1173
                    {
1174
                        L_Size = (firstCondition as IPath).LineSize;
1175
                        (firstCondition as IPath).LineSize *= 4;
1176
                    }
1177
                    switch (firstCondition.GetType().Name)
1178
                    {
1179
                        case "RectangleControl":
1180
                            {
1181
                                (firstCondition as RectangleControl).StrokeColor = new SolidColorBrush(TempColor);
1182
                            }
1183
                            break;
1184
                        case "CircleControl":
1185
                            {
1186
                                (firstCondition as CircleControl).StrokeColor = new SolidColorBrush(TempColor);
1187
                            }
1188
                            break;
1189
                        case "TriControl":
1190
                            {
1191
                                (firstCondition as TriControl).StrokeColor = new SolidColorBrush(TempColor);
1192
                            }
1193
                            break;
1194
                        case "RectCloudControl":
1195
                            {
1196
                                (firstCondition as RectCloudControl).StrokeColor = new SolidColorBrush(TempColor);
1197
                            }
1198
                            break;
1199
                        case "CloudControl":
1200
                            {
1201
                                (firstCondition as CloudControl).StrokeColor = new SolidColorBrush(TempColor);
1202
                            }
1203
                            break;
1204
                        case "PolygonControl":
1205
                            {
1206
                                (firstCondition as PolygonControl).StrokeColor = new SolidColorBrush(TempColor);
1207
                            }
1208
                            break;
1209
                        case "ArcControl":
1210
                            {
1211
                                (firstCondition as ArcControl).StrokeColor = new SolidColorBrush(TempColor);
1212
                            }
1213
                            break;
1214
                        case "LineControl":
1215
                            {
1216
                                (firstCondition as LineControl).StrokeColor = new SolidColorBrush(TempColor);
1217
                            }
1218
                            break;
1219
                        case "ArrowControl_Multi":
1220
                            {
1221
                                (firstCondition as ArrowControl_Multi).StrokeColor = new SolidColorBrush(TempColor);
1222
                            }
1223
                            break;
1224
1225
                        default:
1226
                            {
1227
1228
                            }
1229
                            break;
1230
                    }
1231
                }
1232
                */
1233 787a4489 KangIngu
                #endregion
1234
            }
1235
1236
            getCurrentPoint = e.GetPosition(drawingRotateCanvas);
1237 a36a37c3 humkyung
            
1238 e6a9ddaf humkyung
            if ((e.MiddleButton == MouseButtonState.Pressed) || (e.RightButton == MouseButtonState.Pressed))
1239 787a4489 KangIngu
            {
1240 e54660e8 KangIngu
                SetCursor();
1241 787a4489 KangIngu
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1242
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1243
1244
                Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
1245
                zoomAndPanControl.ContentOffsetX -= dragOffset.X;
1246
                zoomAndPanControl.ContentOffsetY -= dragOffset.Y;
1247 9cd2865b KangIngu
1248 a1716fa5 KangIngu
                if (Sync.IsChecked)
1249 9cd2865b KangIngu
                {
1250
                    ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
1251
                    ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
1252
                }
1253 787a4489 KangIngu
            }
1254 992a98b4 KangIngu
1255 e6a9ddaf humkyung
            if (mouseHandlingMode == MouseHandlingMode.Drawing && currentControl != null)
1256 787a4489 KangIngu
            {
1257
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
1258
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
1259
                SetCursor();
1260
1261
                if (currentControl != null)
1262
                {
1263
                    double moveX = currentCanvasDrawingMouseMovePoint.X - canvasDrawingMouseDownPoint.X;
1264
                    double moveY = currentCanvasDrawingMouseMovePoint.Y - canvasDrawingMouseDownPoint.Y;
1265
                    //강인구 추가
1266
                    currentControl.Opacity = ViewerDataModel.Instance.ControlOpacity;
1267
1268
                    if ((currentControl as IPath) != null)
1269
                    {
1270
                        (currentControl as IPath).LineSize = ViewerDataModel.Instance.LineSize;
1271
                    }
1272 5ce56a3a KangIngu
                    if ((currentControl as LineControl) != null)
1273
                    {
1274
                        (currentControl as LineControl).Interval = ViewerDataModel.Instance.Interval;
1275
                    }
1276
1277 787a4489 KangIngu
                    if ((currentControl as IShapeControl) != null)
1278
                    {
1279
                        (currentControl as IShapeControl).Paint = ViewerDataModel.Instance.paintSet;
1280
                    }
1281
                    if ((currentControl as TextControl) != null)
1282
                    {
1283
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true)
1284
                        {
1285
                            (currentControl as TextControl).TextStyle = FontStyles.Italic;
1286
                        }
1287
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true)
1288
                        {
1289 d4b0c723 KangIngu
                            (currentControl as TextControl).TextWeight = FontWeights.Bold;
1290 787a4489 KangIngu
                        }
1291
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true)
1292
                        {
1293
                            (currentControl as TextControl).UnderLine = TextDecorations.Underline;
1294
                        }
1295
                    }
1296
                    else if ((currentControl as ArrowTextControl) != null)
1297
                    {
1298
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true)
1299
                        {
1300
                            (currentControl as ArrowTextControl).TextStyle = FontStyles.Italic;
1301
                        }
1302
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true)
1303
                        {
1304 d4b0c723 KangIngu
                            (currentControl as ArrowTextControl).TextWeight = FontWeights.Bold;
1305 787a4489 KangIngu
                        }
1306
                        if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true)
1307
                        {
1308
                            (currentControl as ArrowTextControl).UnderLine = TextDecorations.Underline;
1309
                        }
1310
                    }
1311 9f473fb7 KangIngu
                    else if ((currentControl as RectCloudControl) != null)
1312
                    {
1313
                        (currentControl as RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
1314
                    }
1315
                    else if ((currentControl as CloudControl) != null)
1316
                    {
1317
                        (currentControl as CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
1318
                    }
1319 787a4489 KangIngu
1320
                    switch (controlType)
1321
                    {
1322 684ef11c ljiyeon
                        case (ControlType.Coordinate):
1323
                            {
1324
                                var control = currentControl as CoordinateControl;
1325
1326
                                if (control != null)
1327
                                {
1328
                                    if (move.mousemode == MouseMode.Drawing)
1329
                                    {
1330
                                        //move.control_Move(ControlList, true, moveX, moveY);
1331
                                    }
1332
                                    else
1333
                                    {
1334
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1335
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1336
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1337
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1338
1339
1340
                                        if (ViewerDataModel.Instance.IsPressShift)
1341
                                        {
1342
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1343
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1344
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1345
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1346
                                        }
1347
1348
                                        control.PointSet = new List<Point>
1349
                                        {
1350
                                            control.StartPoint,
1351
                                            control.LeftBottomPoint,
1352
                                            control.EndPoint,
1353
                                            control.TopRightPoint,
1354
                                        };
1355
                                        control.updateControl();
1356
                                    }
1357
1358
                                    //강인구 추가
1359
                                    control.ControlType = controlType;
1360
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1361
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1362
                                    //  control.Paint = PaintSet.Fill;
1363
                                }
1364
                            }
1365
                            break;
1366
                        case (ControlType.InsideWhite):
1367
                            {
1368
                                var control = currentControl as InsideWhiteControl;
1369
1370
                                if (control != null)
1371
                                {
1372
                                    if (move.mousemode == MouseMode.Drawing)
1373
                                    {
1374
                                        //move.control_Move(ControlList, true, moveX, moveY);
1375
                                    }
1376
                                    else
1377
                                    {
1378
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1379
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1380
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1381
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1382
1383
1384
                                        if (ViewerDataModel.Instance.IsPressShift)
1385
                                        {
1386
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1387
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1388
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1389
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1390
                                        }
1391
1392
                                        control.PointSet = new List<Point>
1393
                                        {
1394
                                            control.StartPoint,
1395
                                            control.LeftBottomPoint,
1396
                                            control.EndPoint,
1397
                                            control.TopRightPoint,
1398
                                        };
1399
                                        control.updateControl();
1400
                                    }
1401
1402
                                    //강인구 추가
1403
                                    control.ControlType = controlType;
1404
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1405
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1406
                                    control.Paint = PaintSet.Fill;
1407
                                }
1408
                            }
1409
                            break;
1410
                        case (ControlType.OverlapWhite):
1411
                            {
1412
                                var control = currentControl as OverlapWhiteControl;
1413
1414
                                if (control != null)
1415
                                {
1416
                                    if (move.mousemode == MouseMode.Drawing)
1417
                                    {
1418
                                        //move.control_Move(ControlList, true, moveX, moveY);
1419
                                    }
1420
                                    else
1421
                                    {
1422
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1423
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1424
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1425
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1426
1427
1428
                                        if (ViewerDataModel.Instance.IsPressShift)
1429
                                        {
1430
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1431
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1432
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1433
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1434
                                        }
1435
1436
                                        control.PointSet = new List<Point>
1437
                                        {
1438
                                            control.StartPoint,
1439
                                            control.LeftBottomPoint,
1440
                                            control.EndPoint,
1441
                                            control.TopRightPoint,
1442
                                        };
1443
                                        control.updateControl();
1444
                                    }
1445
1446
                                    //강인구 추가
1447
                                    control.ControlType = controlType;
1448
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1449
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1450
                                    control.Paint = PaintSet.Fill;
1451
                                }
1452
                            }
1453
                            break;
1454
                        case (ControlType.ClipWhite):
1455
                            {
1456
                                var control = currentControl as ClipWhiteControl;
1457
1458
                                if (control != null)
1459
                                {
1460
                                    if (move.mousemode == MouseMode.Drawing)
1461
                                    {
1462
                                        //move.control_Move(ControlList, true, moveX, moveY);
1463
                                    }
1464
                                    else
1465
                                    {
1466
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1467
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1468
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1469
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1470
1471
1472
                                        if (ViewerDataModel.Instance.IsPressShift)
1473
                                        {
1474
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1475
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1476
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1477
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1478
                                        }
1479
1480
                                        control.PointSet = new List<Point>
1481
                                        {
1482
                                            control.StartPoint,
1483
                                            control.LeftBottomPoint,
1484
                                            control.EndPoint,
1485
                                            control.TopRightPoint,
1486
                                        };
1487
                                        control.updateControl();
1488
                                    }
1489
1490
                                    //강인구 추가
1491
                                    control.ControlType = controlType;
1492
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1493
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1494
                                    control.Paint = PaintSet.Fill;
1495
                                }
1496
                            }
1497
                            break;
1498 787a4489 KangIngu
                        case ControlType.Rectangle:
1499
                            {
1500
                                var control = currentControl as RectangleControl;
1501
1502
                                if (control != null)
1503
                                {
1504
                                    if (move.mousemode == MouseMode.Drawing)
1505
                                    {
1506
                                        //move.control_Move(ControlList, true, moveX, moveY);
1507
                                    }
1508
                                    else
1509
                                    {
1510 17a22987 KangIngu
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1511
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1512
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1513
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1514 787a4489 KangIngu
1515
1516 17a22987 KangIngu
                                        if (ViewerDataModel.Instance.IsPressShift)
1517
                                        {
1518 4318fdeb KangIngu
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1519 17a22987 KangIngu
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1520
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1521
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1522
                                        }
1523 e54660e8 KangIngu
1524 787a4489 KangIngu
                                        control.PointSet = new List<Point>
1525
                                        {
1526 17a22987 KangIngu
                                            control.StartPoint,
1527
                                            control.LeftBottomPoint,
1528
                                            control.EndPoint,
1529
                                            control.TopRightPoint,
1530 787a4489 KangIngu
                                        };
1531
                                        control.updateControl();
1532
                                    }
1533
1534
                                    //강인구 추가
1535
                                    control.ControlType = controlType;
1536
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1537
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1538
                                }
1539
                            }
1540
                            break;
1541
1542
                        case ControlType.RectCloud:
1543
                            {
1544
                                var control = currentControl as RectCloudControl;
1545
1546
                                if (control != null)
1547
                                {
1548
                                    if (move.mousemode == MouseMode.Drawing)
1549
                                    {
1550
                                        //move.control_Move(ControlList, true, moveX, moveY);
1551
                                    }
1552
                                    else
1553
                                    {
1554
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1555
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1556
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1557
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1558
1559 17a22987 KangIngu
                                        if (ViewerDataModel.Instance.IsPressShift)
1560
                                        {
1561 4318fdeb KangIngu
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1562 17a22987 KangIngu
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1563
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1564
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1565
                                        }
1566
1567 787a4489 KangIngu
                                        control.PointSet = new List<Point>
1568
                                        {
1569
                                            control.StartPoint,
1570
                                            control.LeftBottomPoint,
1571
                                            control.EndPoint,
1572
                                            control.TopRightPoint,
1573
                                        };
1574
                                    }
1575 d71ee575 djkim
1576 787a4489 KangIngu
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1577
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1578
                                }
1579
                            }
1580
                            break;
1581
1582
                        case ControlType.SingleLine:
1583
                            {
1584 d71ee575 djkim
                                var control = currentControl as LineControl;
1585
                                if (control != null)
1586 787a4489 KangIngu
                                {
1587
                                    control.LineStyleSet = LineStyleSet.SingleLine;
1588
                                    control.ControlType = controlType;
1589 d71ee575 djkim
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1590
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1591
                                    Point tempPoint = control.EndPoint;
1592 5ce56a3a KangIngu
1593 d71ee575 djkim
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1594
                                    {
1595
                                        //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1596
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1597
                                        control.EndPoint = tempPoint;
1598
                                    }
1599
                                    else
1600
                                    {
1601
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1602
                                    }
1603 5ce56a3a KangIngu
1604 d71ee575 djkim
                                    control.PointSet = new List<Point>
1605 5ce56a3a KangIngu
                                        {
1606
                                            control.StartPoint,
1607
                                            control.EndPoint,
1608
                                        };
1609 d71ee575 djkim
1610
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1611 787a4489 KangIngu
                                }
1612
1613
                            }
1614
                            break;
1615
1616
                        case ControlType.CancelLine:
1617
                            {
1618 d71ee575 djkim
                                var control = currentControl as LineControl;
1619
                                if (control != null)
1620 787a4489 KangIngu
                                {
1621
                                    control.LineStyleSet = LineStyleSet.CancelLine;
1622
                                    //control.LineStyle = LineControl.LineStyleSet.MultiLine;
1623
                                    control.ControlType = controlType;
1624 d71ee575 djkim
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1625
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1626
                                    Point tempPoint = control.EndPoint;
1627 787a4489 KangIngu
1628 d71ee575 djkim
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1629
                                    {
1630
                                        //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1631
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1632
                                        control.EndPoint = tempPoint;
1633
                                    }
1634
                                    else
1635
                                    {
1636
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1637
                                    }
1638 787a4489 KangIngu
1639
1640 d71ee575 djkim
                                    control.PointSet = new List<Point>
1641 787a4489 KangIngu
                                            {
1642
                                                control.StartPoint,
1643
                                                control.EndPoint,
1644
                                            };
1645
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1646
                                }
1647 d71ee575 djkim
1648
1649 787a4489 KangIngu
                            }
1650
                            break;
1651
1652
                        case ControlType.ArrowLine:
1653
                            {
1654 d71ee575 djkim
                                var control = currentControl as LineControl;
1655
                                if (control != null)
1656 787a4489 KangIngu
                                {
1657
                                    control.LineStyleSet = LineStyleSet.ArrowLine;
1658
                                    control.ControlType = controlType;
1659 d71ee575 djkim
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1660
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1661
                                    Point tempPoint = control.EndPoint;
1662 787a4489 KangIngu
1663 d71ee575 djkim
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1664
                                    {
1665
                                        //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1666
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1667
                                        control.EndPoint = tempPoint;
1668
                                    }
1669
                                    else
1670
                                    {
1671
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1672
                                    }
1673 787a4489 KangIngu
1674
1675 d71ee575 djkim
                                    control.PointSet = new List<Point>
1676 787a4489 KangIngu
                                            {
1677
                                                control.StartPoint,
1678
                                                control.EndPoint,
1679
                                            };
1680
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1681
                                }
1682
                            }
1683
                            break;
1684
1685
                        case ControlType.TwinLine:
1686
                            {
1687 d71ee575 djkim
                                var control = currentControl as LineControl;
1688
                                if (control != null)
1689 787a4489 KangIngu
                                {
1690
                                    control.LineStyleSet = LineStyleSet.TwinLine;
1691
                                    control.ControlType = controlType;
1692 d71ee575 djkim
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1693
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1694
                                    Point tempPoint = control.EndPoint;
1695 787a4489 KangIngu
1696 d71ee575 djkim
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1697
                                    {
1698
                                        //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1699
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1700
                                        control.EndPoint = tempPoint;
1701
                                    }
1702
                                    else
1703
                                    {
1704
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1705
                                    }
1706 787a4489 KangIngu
1707
1708 d71ee575 djkim
                                    control.PointSet = new List<Point>
1709 787a4489 KangIngu
                                            {
1710
                                                control.StartPoint,
1711
                                                control.EndPoint,
1712
                                            };
1713
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1714
                                }
1715
                            }
1716
                            break;
1717
1718
                        case ControlType.DimLine:
1719
                            {
1720 d71ee575 djkim
                                var control = currentControl as LineControl;
1721
                                if (control != null)
1722 787a4489 KangIngu
                                {
1723
                                    control.LineStyleSet = LineStyleSet.DimLine;
1724
                                    control.ControlType = controlType;
1725 d71ee575 djkim
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1726
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1727
                                    Point tempPoint = control.EndPoint;
1728 787a4489 KangIngu
1729 d71ee575 djkim
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1730
                                    {
1731
                                        //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1732
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1733
                                        control.EndPoint = tempPoint;
1734
                                    }
1735
                                    else
1736
                                    {
1737
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1738
                                    }
1739 787a4489 KangIngu
1740 d71ee575 djkim
                                    control.PointSet = new List<Point>
1741 787a4489 KangIngu
                                            {
1742
                                                control.StartPoint,
1743
                                                control.EndPoint,
1744
                                            };
1745
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1746
                                }
1747
                            }
1748
                            break;
1749
1750
                        case ControlType.ArcLine:
1751
                            {
1752 d71ee575 djkim
                                var control = currentControl as ArcControl;
1753
                                if (control != null)
1754 787a4489 KangIngu
                                {
1755
                                    control.isTransOn = false;
1756
                                    control.ControlType = controlType;
1757 d71ee575 djkim
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1758
                                    control.MidPoint = new Point(0, 0);
1759
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1760
                                    Point tempPoint = control.EndPoint;
1761 787a4489 KangIngu
1762 d71ee575 djkim
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1763 787a4489 KangIngu
                                    {
1764 d71ee575 djkim
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1765
                                        control.EndPoint = tempPoint;
1766
                                    }
1767
                                    else
1768
                                    {
1769
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1770
                                    }
1771 787a4489 KangIngu
1772
1773 d71ee575 djkim
                                    control.PointSet = new List<Point>
1774 787a4489 KangIngu
                                            {
1775
                                                control.StartPoint,
1776
                                                control.MidPoint,
1777
                                                control.EndPoint,
1778
                                            };
1779
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1780
                                }
1781
                            }
1782
                            break;
1783
1784
                        case ControlType.ArcArrow:
1785
                            {
1786 40b3ce25 ljiyeon
                                var control = currentControl as ArrowArcControl;
1787 d71ee575 djkim
                                if (control != null)
1788 787a4489 KangIngu
                                {
1789 40b3ce25 ljiyeon
                                    control.isTransOn = false;
1790 787a4489 KangIngu
                                    control.ControlType = controlType;
1791 40b3ce25 ljiyeon
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1792
                                    control.MidPoint = new Point(0, 0);
1793
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1794
                                    Point tempPoint = control.EndPoint;
1795
1796
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1797 787a4489 KangIngu
                                    {
1798 40b3ce25 ljiyeon
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1799
                                        control.EndPoint = tempPoint;
1800 d71ee575 djkim
                                    }
1801
                                    else
1802
                                    {
1803 40b3ce25 ljiyeon
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1804 d71ee575 djkim
                                    }
1805 787a4489 KangIngu
1806 40b3ce25 ljiyeon
1807 d71ee575 djkim
                                    control.PointSet = new List<Point>
1808 787a4489 KangIngu
                                            {
1809
                                                control.StartPoint,
1810
                                                control.MidPoint,
1811
                                                control.EndPoint,
1812
                                            };
1813
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1814
                                }
1815
                            }
1816
                            break;
1817
1818
                        case ControlType.ArrowMultiLine:
1819
                            {
1820 d71ee575 djkim
                                var control = currentControl as ArrowControl_Multi;
1821
                                if (control != null)
1822 787a4489 KangIngu
                                {
1823 d71ee575 djkim
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1824
                                    Point tempPoint = control.EndPoint;
1825
                                    if (control.MiddlePoint == new Point(0, 0))
1826 787a4489 KangIngu
                                    {
1827 d71ee575 djkim
                                        if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1828 787a4489 KangIngu
                                        {
1829 d71ee575 djkim
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1830
                                            //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1831
                                            control.EndPoint = tempPoint;
1832 787a4489 KangIngu
                                        }
1833
                                        else
1834
                                        {
1835 d71ee575 djkim
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
1836
                                        }
1837
                                    }
1838
                                    else
1839
                                    {
1840
                                        if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
1841
                                        {
1842
                                            //var AngleValue = MathSet.returnAngleString(control.MiddlePoint, ref tempPoint, true);
1843
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.MiddlePoint, ref tempPoint, true);
1844
                                            control.EndPoint = tempPoint;
1845
                                        }
1846
                                        else
1847
                                        {
1848
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.MiddlePoint, ref tempPoint, false);
1849 787a4489 KangIngu
                                        }
1850
1851 d71ee575 djkim
                                    }
1852
1853
                                    control.PointSet = new List<Point>
1854 787a4489 KangIngu
                                            {
1855
                                                control.StartPoint,
1856
                                                control.MiddlePoint,
1857
                                                control.EndPoint,
1858
                                            };
1859
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1860
                                }
1861
                            }
1862
                            break;
1863
1864
                        case ControlType.Circle:
1865
                            {
1866
                                var control = currentControl as CircleControl;
1867
1868
                                if (control != null)
1869
                                {
1870
                                    if (move.mousemode == MouseMode.Drawing)
1871
                                    {
1872
                                        //move.control_Move(ControlList, true, moveX, moveY);
1873
                                    }
1874
                                    else
1875
                                    {
1876
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1877
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1878
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1879
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1880
1881 17a22987 KangIngu
                                        if (ViewerDataModel.Instance.IsPressShift)
1882
                                        {
1883 4318fdeb KangIngu
                                            Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint);
1884 17a22987 KangIngu
                                            control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y);
1885
                                            control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y);
1886
                                            control.EndPoint = new Point(setpoint.X, setpoint.Y);
1887
                                        }
1888
1889 787a4489 KangIngu
                                        control.PointSet = new List<Point>
1890
                                        {
1891
                                            control.StartPoint,
1892
                                            control.LeftBottomPoint,
1893
                                            control.EndPoint,
1894
                                            control.TopRightPoint,
1895
                                        };
1896
                                    }
1897 d71ee575 djkim
1898 787a4489 KangIngu
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1899
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1900
1901
                                }
1902
                            }
1903
                            break;
1904
1905
                        case ControlType.PolygonCloud:
1906
                            {
1907
                                var control = currentControl as CloudControl;
1908
1909
                                if (control != null)
1910
                                {
1911
                                    control.isTransOn = true;
1912
                                    control.PointSet.RemoveAt(control.PointSet.Count - 1);
1913
1914
                                    control.PointSet.Add(currentCanvasDrawingMouseMovePoint);
1915
1916
                                    control.SetCloud();
1917
                                    //강인구 추가
1918
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1919
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1920
                                }
1921
                            }
1922
                            break;
1923
1924
                        case ControlType.Triangle:
1925
                            {
1926
                                var control = currentControl as TriControl;
1927
1928
                                if (control != null)
1929
                                {
1930
                                    if (move.mousemode == MouseMode.Drawing)
1931
                                    {
1932
                                        //move.control_Move(ControlList, true, moveX, moveY);
1933
                                    }
1934
                                    else
1935
                                    {
1936
                                        control.Paint = ViewerDataModel.Instance.paintSet;
1937
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1938
1939 992a98b4 KangIngu
                                        if (ViewerDataModel.Instance.checkAxis)
1940
                                        {
1941
                                            Point tempPoint = control.EndPoint;
1942
                                            ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
1943
                                            control.EndPoint = tempPoint;
1944
                                        }
1945
1946 4318fdeb KangIngu
1947
                                        if (ViewerDataModel.Instance.IsPressShift)
1948
                                        {
1949 e753423e humkyung
                                            List<Point> Points = GetRegularTrianglePoints(control.StartPoint, control.EndPoint);
1950
                                            if (2 == Points.Count())
1951
                                            {
1952
                                                control.MidPoint = Points[0];
1953
                                                control.EndPoint = Points[1];
1954
                                            }
1955 4318fdeb KangIngu
                                        }
1956
1957 787a4489 KangIngu
                                        control.PointSet = new List<Point>
1958
                                            {
1959
                                                control.StartPoint,
1960
                                                control.MidPoint,
1961
                                                control.EndPoint,
1962
                                            };
1963
                                    }
1964 d71ee575 djkim
1965 787a4489 KangIngu
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
1966
                                    control.Paint = ViewerDataModel.Instance.paintSet;
1967
                                }
1968
                            }
1969
                            break;
1970
1971
                        case ControlType.ImgControl:
1972
                            {
1973
                                var control = currentControl as ImgControl;
1974
1975
                                if (control != null)
1976
                                {
1977
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
1978
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
1979
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
1980
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
1981
1982
                                    control.PointSet = new List<Point>
1983
                                        {
1984
                                            control.StartPoint,
1985
                                            control.LeftBottomPoint,
1986
                                            control.EndPoint,
1987
                                            control.TopRightPoint,
1988
                                        };
1989
                                }
1990
                            }
1991
                            break;
1992
1993
                        case ControlType.Date:
1994
                            {
1995
                                var control = currentControl as DateControl;
1996
1997
                                if (control != null)
1998
                                {
1999
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2000
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2001
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2002
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2003
                                    //control.Text = DateTime.Now.ToString("yyyy-MM-dd");
2004
2005
                                    control.PointSet = new List<Point>
2006
                                        {
2007
                                            control.StartPoint,
2008
                                            control.LeftBottomPoint,
2009
                                            control.EndPoint,
2010
                                            control.TopRightPoint,
2011
                                        };
2012
                                }
2013
                            }
2014
                            break;
2015
2016
                        case ControlType.ArrowTextControl:
2017
                            {
2018
                                var control = currentControl as ArrowTextControl;
2019
2020
                                if (control != null)
2021
                                {
2022
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2023 5ce56a3a KangIngu
                                    Point tempPoint = control.EndPoint;
2024 9f473fb7 KangIngu
2025
                                    control.MidPoint = new Point(control.EndPoint.X - 100, control.EndPoint.Y - 100);
2026
2027 5ce56a3a KangIngu
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2028
                                    {
2029
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2030
                                        control.EndPoint = tempPoint;
2031
                                    }
2032
                                    else
2033
                                    {
2034
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2035
                                    }
2036 992a98b4 KangIngu
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2037 787a4489 KangIngu
2038
                                    control.PointSet = new List<Point>
2039
                                            {
2040
                                                control.StartPoint,
2041
                                                control.MidPoint,
2042
                                                control.EndPoint,
2043
                                            };
2044
                                }
2045
                            }
2046
                            break;
2047
2048
                        case ControlType.ArrowTransTextControl:
2049
                            {
2050
                                var control = currentControl as ArrowTextControl;
2051
2052
                                if (control != null)
2053
                                {
2054
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2055 5ce56a3a KangIngu
                                    Point tempPoint = control.EndPoint;
2056 01cbc243 KangIngu
                                    //control.MidPoint = currentCanvasDrawingMouseMovePoint;
2057 9f473fb7 KangIngu
2058 5ce56a3a KangIngu
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2059
                                    {
2060
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2061
                                        control.EndPoint = tempPoint;
2062
                                    }
2063
                                    else
2064
                                    {
2065
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2066
                                    }
2067 01cbc243 KangIngu
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2068 787a4489 KangIngu
                                    control.isFixed = true;
2069
2070
                                    control.PointSet = new List<Point>
2071
                                            {
2072
                                                control.StartPoint,
2073
                                                control.MidPoint,
2074
                                                control.EndPoint,
2075
                                            };
2076
                                }
2077
                            }
2078
                            break;
2079
2080
                        case ControlType.ArrowTextBorderControl:
2081
                            {
2082
                                var control = currentControl as ArrowTextControl;
2083
2084
                                if (control != null)
2085
                                {
2086
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2087 5ce56a3a KangIngu
                                    Point tempPoint = control.EndPoint;
2088
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2089
                                    {
2090
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2091
                                        control.EndPoint = tempPoint;
2092
                                    }
2093
                                    else
2094
                                    {
2095
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2096
                                    }
2097 992a98b4 KangIngu
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2098 787a4489 KangIngu
                                    control.PointSet = new List<Point>
2099
                                            {
2100
                                                control.StartPoint,
2101
                                                control.MidPoint,
2102
                                                control.EndPoint,
2103
                                            };
2104
                                }
2105
2106
                            }
2107
                            break;
2108
                        case ControlType.ArrowTransTextBorderControl:
2109
                            {
2110
                                var control = currentControl as ArrowTextControl;
2111
2112
                                if (control != null)
2113
                                {
2114
                                    control.isFixed = true;
2115
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2116 5ce56a3a KangIngu
                                    Point tempPoint = control.EndPoint;
2117
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2118
                                    {
2119
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2120
                                        control.EndPoint = tempPoint;
2121
                                    }
2122
                                    else
2123
                                    {
2124
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2125
                                    }
2126 01cbc243 KangIngu
2127
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2128 787a4489 KangIngu
                                    control.PointSet = new List<Point>
2129
                                            {
2130
                                                control.StartPoint,
2131
                                                control.MidPoint,
2132
                                                control.EndPoint,
2133
                                            };
2134
                                }
2135
2136
                            }
2137
                            break;
2138
                        case ControlType.ArrowTextCloudControl:
2139
                            {
2140
                                var control = currentControl as ArrowTextControl;
2141
2142
                                if (control != null)
2143
                                {
2144
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2145 5ce56a3a KangIngu
                                    Point tempPoint = control.EndPoint;
2146
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2147
                                    {
2148
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2149
                                        control.EndPoint = tempPoint;
2150
                                    }
2151
                                    else
2152
                                    {
2153
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2154
                                    }
2155 992a98b4 KangIngu
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2156 787a4489 KangIngu
                                    control.PointSet = new List<Point>
2157
                                            {
2158
                                                control.StartPoint,
2159
                                                control.MidPoint,
2160
                                                control.EndPoint,
2161
                                            };
2162
                                }
2163
2164
                            }
2165
                            break;
2166
                        case ControlType.ArrowTransTextCloudControl:
2167
                            {
2168
                                var control = currentControl as ArrowTextControl;
2169
2170
                                if (control != null)
2171
                                {
2172
                                    control.isFixed = true;
2173
                                    control.EndPoint = currentCanvasDrawingMouseMovePoint;
2174 5ce56a3a KangIngu
                                    Point tempPoint = control.EndPoint;
2175
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2176
                                    {
2177
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true);
2178
                                        control.EndPoint = tempPoint;
2179
                                    }
2180
                                    else
2181
                                    {
2182
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false);
2183
                                    }
2184 01cbc243 KangIngu
                                    control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint);
2185 787a4489 KangIngu
                                    control.PointSet = new List<Point>
2186
                                            {
2187
                                                control.StartPoint,
2188
                                                control.MidPoint,
2189
                                                control.EndPoint,
2190
                                            };
2191
                                }
2192
2193
                            }
2194
                            break;
2195
                        case ControlType.PolygonControl:
2196 e6a9ddaf humkyung
                        case ControlType.ChainLine:
2197 787a4489 KangIngu
                            {
2198
                                var control = currentControl as PolygonControl;
2199
2200
                                if (control != null)
2201
                                {
2202
                                    control.PointSet.RemoveAt(control.PointSet.Count - 1);
2203 e6a9ddaf humkyung
                                    Point tempPoint = currentCanvasDrawingMouseMovePoint;
2204
                                    if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
2205
                                    {
2206
                                        ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.PointSet[control.PointSet.Count - 1], ref tempPoint, true);
2207
                                    }
2208 787a4489 KangIngu
                                    control.PointSet.Add(currentCanvasDrawingMouseMovePoint);
2209 e6a9ddaf humkyung
2210 787a4489 KangIngu
                                    control.Paint = ViewerDataModel.Instance.paintSet;
2211
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
2212
                                    control.Paint = ViewerDataModel.Instance.paintSet;
2213 b9ce7aee ljiyeon
                                    control.updateControl();
2214 787a4489 KangIngu
                                }
2215
                            }
2216
                            break;
2217
                        //강인구 추가
2218
                        case ControlType.Sign:
2219
                            {
2220
                                var control = currentControl as SignControl;
2221
2222
                                if (control != null)
2223
                                {
2224
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2225
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2226
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2227
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2228
2229
                                    if (control.StartPoint != control.EndPoint && control.SignImage == null)
2230
                                    {
2231 661b7416 humkyung
                                        var _sign = GetUserSign.GetSign(App.ViewInfo.UserID, App.ViewInfo.ProjectNO);
2232 787a4489 KangIngu
                                        byte[] imageBytes = System.Convert.FromBase64String(_sign);
2233
                                        System.IO.MemoryStream stream = new System.IO.MemoryStream();
2234
                                        stream.Write(imageBytes, 0, imageBytes.Length);
2235
                                        stream.Position = 0;
2236
                                        System.Drawing.Image img = System.Drawing.Image.FromStream(stream);
2237
                                        BitmapImage returnImage = new BitmapImage();
2238
                                        returnImage.BeginInit();
2239
                                        System.IO.MemoryStream ms = new System.IO.MemoryStream();
2240
                                        img.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
2241
                                        ms.Seek(0, System.IO.SeekOrigin.Begin);
2242
                                        returnImage.StreamSource = ms;
2243
                                        returnImage.EndInit();
2244
                                        stream.Close();
2245
2246
                                        control.SignImage = returnImage;
2247
                                    }
2248
                                    control.PointSet = new List<Point>
2249
                                        {
2250
                                            control.StartPoint,
2251
                                            control.LeftBottomPoint,
2252
                                            control.EndPoint,
2253
                                            control.TopRightPoint,
2254
                                        };
2255
                                }
2256
                            }
2257
                            break;
2258 5a9353a9 humkyung
                        //TODO: 강인구 추가
2259 787a4489 KangIngu
                        case ControlType.Symbol:
2260
                            {
2261
                                var control = currentControl as SymControl;
2262
2263
                                if (control != null)
2264
                                {
2265
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2266
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2267
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2268
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2269
                                    control.LineSize = ViewerDataModel.Instance.LineSize + 3;
2270
                                    control.StrokeColor = new SolidColorBrush(Colors.Red);
2271
2272
                                    if (control.StartPoint != control.EndPoint)
2273
                                    {
2274
                                        if (control.PathData == null)
2275
                                        {
2276
                                            using (StringToPathConverter Convert = new StringToPathConverter())
2277
                                            {
2278
                                                control.PathData = Convert.Convert("M-5,5L0,0L20,30L40,-20 ");
2279
                                            }
2280
                                        }
2281
                                    }
2282
2283
                                    control.PointSet = new List<Point>
2284
                                        {
2285
                                            control.StartPoint,
2286
                                            control.LeftBottomPoint,
2287
                                            control.EndPoint,
2288
                                            control.TopRightPoint,
2289
                                        };
2290
                                }
2291
                            }
2292
                            break;
2293 5a9353a9 humkyung
                        ///TODO: 
2294 787a4489 KangIngu
                        case ControlType.Stamp:
2295
                            {
2296
                                var control = currentControl as SymControlN;
2297
2298
                                if (control != null)
2299
                                {
2300
2301
                                    if (control.StartPoint == control.EndPoint)
2302
                                    {
2303 53880c83 ljiyeon
                                        //string appovalData = "";
2304 787a4489 KangIngu
2305 9a1ce1db KangIngu
                                        var xamlData = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString_NonPrefix(App.SystemInfo.STAMP);
2306 787a4489 KangIngu
                                        xamlData = xamlData.Replace("daelim", "DAELIM");
2307
2308 a0bab669 KangIngu
2309 787a4489 KangIngu
                                        //object obj = System.Windows.Markup.XamlReader.Load(xamlData);
2310
2311
                                        System.IO.MemoryStream stream = new System.IO.MemoryStream();
2312
                                        System.IO.StreamWriter writer = new System.IO.StreamWriter(stream);
2313
                                        writer.Write(xamlData);
2314
                                        writer.Flush();
2315
                                        stream.Position = 0;
2316
2317
                                        control.StrokeColor = new SolidColorBrush(Colors.Red);
2318
                                        object obj = System.Windows.Markup.XamlReader.Load(stream);
2319
                                        UIElement ob = obj as UIElement;
2320
2321
                                        //control.ApplyTemplate();
2322
2323
                                        control.SetViewBox();
2324 b200de5a KangIngu
                                        control.PathXathData = App.SystemInfo.STAMP;
2325 787a4489 KangIngu
                                        control.Base_ViewBox.Child = ob;
2326
                                    }
2327
2328
                                    control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2329
                                    control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2330
                                    control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2331
                                    control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2332
                                    //control.LineSize = ViewerDataModel.Instance.LineSize + 3;
2333
2334
2335
                                    control.PointSet = new List<Point>
2336
                                    {
2337
                                        control.StartPoint,
2338
                                        control.LeftBottomPoint,
2339
                                        control.EndPoint,
2340
                                        control.TopRightPoint,
2341
                                    };
2342
                                }
2343
                            }
2344
                            break;
2345
                        case ControlType.Mark:
2346
                            {
2347
                                var control = currentControl as RectangleControl;
2348
2349
                                if (control != null)
2350
                                {
2351
                                    if (move.mousemode == MouseMode.Drawing)
2352
                                    {
2353
                                        //move.control_Move(ControlList, true, moveX, moveY);
2354
                                    }
2355
                                    else
2356
                                    {
2357
                                        control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
2358
                                        control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y);
2359
                                        control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y);
2360
                                        control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y);
2361
2362
2363
                                        control.PointSet = new List<Point>
2364
                                    {
2365
                                        control.StartPoint,
2366
                                        control.LeftBottomPoint,
2367
                                        control.EndPoint,
2368
                                        control.TopRightPoint,
2369
                                    };
2370
                                    }
2371
2372
                                    //강인구 추가
2373
                                    control.Paint = PaintSet.Fill;
2374
                                }
2375
                            }
2376
                            break;
2377
                        case ControlType.PenControl:
2378
                            {
2379
                                stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y));
2380
                                //inkBoard.Strokes.Add(stroke);
2381
                            }
2382
                            break;
2383
                        default:
2384
                            break;
2385
                    }
2386
                }
2387
            }
2388 29cf2c0c humkyung
            else if(mouseHandlingMode == MouseHandlingMode.Drawing && e.LeftButton == MouseButtonState.Pressed)
2389
            {
2390
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas);
2391
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas);
2392
                SetCursor();
2393
                if (currentControl == null)
2394
                {
2395
                    switch (controlType)
2396
                    {
2397
                        case ControlType.PenControl:
2398
                            {
2399
                                if (inkBoard.Tag.ToString() == "Ink")
2400
                                {
2401
                                    stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y));
2402
                                }
2403
                                else if (inkBoard.Tag.ToString() == "EraseByPoint")
2404
                                {
2405
                                    RemovePointStroke(currentCanvasDrawingMouseMovePoint);
2406
                                }
2407
                                else if (inkBoard.Tag.ToString() == "EraseByStroke")
2408
                                {
2409
                                    RemoveLineStroke(currentCanvasDrawingMouseMovePoint);
2410
                                }
2411
2412
                                //inkBoard.Strokes.Add(stroke);
2413
                            }
2414
                            break;
2415
                    }
2416
                    return;
2417
                }
2418
            }
2419 e6a9ddaf humkyung
            else if (((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.Selecting) || 
2420
                ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.Capture) || 
2421
                ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.DragZoom))
2422 787a4489 KangIngu
            {
2423
                Point curMouseDownPoint = e.GetPosition(drawingRotateCanvas);
2424
2425
                if (isDraggingSelectionRect)
2426
                {
2427
                    UpdateDragSelectionRect(canvasDrawingMouseDownPoint, curMouseDownPoint);
2428
2429
                    e.Handled = true;
2430
                }
2431
                else if (isLeftMouseButtonDownOnWindow)
2432
                {
2433
                    var dragDelta = curMouseDownPoint - canvasDrawingMouseDownPoint;
2434
                    double dragDistance = Math.Abs(dragDelta.Length);
2435
2436
                    if (dragDistance > DragThreshold)
2437
                    {
2438
                        isDraggingSelectionRect = true;
2439
2440
                        InitDragSelectionRect(canvasDrawingMouseDownPoint, curMouseDownPoint);
2441
                    }
2442
2443
                    e.Handled = true;
2444
                }
2445
2446
2447
                if (canvasDrawingMouseDownPoint == curMouseDownPoint)
2448
                {
2449
                    //SelectionPath = new Path();
2450
                    //PathFigure pathFigure = new PathFigure();
2451
                    //SelectionPath.Fill = new SolidColorBrush(Colors.Yellow);
2452
                    //SelectionPath.Opacity = 0.5;
2453
                    //SelectionPath.StrokeDashArray = new DoubleCollection() { 1 };
2454
                    //SelectionPath.StrokeDashCap = PenLineCap.Round;
2455
                    //SelectionPath.Stroke = new SolidColorBrush(Colors.Black);
2456
                }
2457
                else
2458
                {
2459
                    //List<Stroke> removingStroke = new List<Stroke>();
2460
                    //Rect p1 = new Rect(canvasDrawingMouseDownPoint, curMouseDownPoint);
2461
                    //StrokeCollection stC = new StrokeCollection();
2462
                    //for (int i = 0; i <= inkBoard.Strokes.Count - 1; i++)
2463
                    //{
2464
                    //    Rect p2 = inkBoard.Strokes[i].GetBounds();
2465
                    //    p1.Intersect(p2);
2466
                    //    if (p1.IsEmpty)
2467
                    //    {
2468
2469
2470
                    //        p1 = SelectionPath.Data.Bounds;
2471
                    //        bool intersectCheck = false;
2472
                    //        foreach (var T in inkBoard.Strokes[i].StylusPoints)
2473
                    //        {
2474
                    //            Rect p3 = new Rect(new Point(T.X, T.Y), new Size(10, 10));
2475
                    //            p1.Intersect(p3);
2476
                    //            if (!p1.IsEmpty)
2477
                    //            {
2478
                    //                intersectCheck = true;
2479
                    //            }
2480
                    //        }
2481
                    //        if (intersectCheck)
2482
                    //        {
2483
                    //            removingStroke.Add(inkBoard.Strokes[i]);
2484
                    //        }
2485
2486
                    //    }
2487
                    //    else
2488
                    //    {
2489
                    //        removingStroke.Add(inkBoard.Strokes[i]);
2490
                    //    }
2491
                    //}
2492
2493
                    e.Handled = true;
2494
                }
2495
            }
2496 e6a9ddaf humkyung
            else if ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.DragSymbol)
2497 53880c83 ljiyeon
            { //symbol      
2498
                if(_dragdropWindow != null)
2499
                {
2500
                    Win32Point w32Mouse = new Win32Point();
2501
                    GetCursorPos(ref w32Mouse);
2502
2503
                    this._dragdropWindow.Left = w32Mouse.X - (symbol_img.Width / 2);
2504
                    this._dragdropWindow.Top = w32Mouse.Y - (symbol_img.Height / 2);
2505
                }                
2506
            }
2507 e6a9ddaf humkyung
            else if ((e.LeftButton == MouseButtonState.Released) && (e.MiddleButton == MouseButtonState.Released) && 
2508
                (e.RightButton == MouseButtonState.Released) && ViewerDataModel.Instance.MarkupControls_USER.Count > 0)
2509 787a4489 KangIngu
            {
2510 05009a0e ljiyeon
                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
2511 e6a9ddaf humkyung
                if(control != null)
2512 787a4489 KangIngu
                {
2513
                    this.cursor = Cursors.Hand;
2514
                    SetCursor();
2515
                }
2516
                else
2517
                {
2518 510cbd2a ljiyeon
                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
2519 787a4489 KangIngu
                    SetCursor();
2520
                }
2521
            }
2522
            else
2523
            {
2524
                //var hitRect = new Rect(currentCanvasDrawingMouseMovePoint.X - 10, currentCanvasDrawingMouseMovePoint.Y - 10, 20, 20);
2525
2526
                //VisualTreeHelper.HitTest(this.drawingRotateCanvas, null, MyCallback,
2527
                //    new GeometryHitTestParameters(new RectangleGeometry(hitRect)));
2528
2529
                //if (hitList.Count > 0)
2530
                //{
2531
2532
                //}
2533
2534
                #region 조건 설정 : firstCondition
2535
                //GeneralTransform generalTransform = this.DeepLayer._BaseLayer.TransformToVisual(Application.Current.RootVisual);
2536
                //pnts = generalTransform.Transform(pnts);
2537
                //Rect areaInAbsoluteCoordinates = new Rect(pnts.X - 10, pnts.Y - 10, 20, 20);
2538
                //var firstCondition = (from kkk in VisualTreeHelper.FindElementsInHostCoordinates(areaInAbsoluteCoordinates,
2539
                //                               this.DeepLayer._BaseLayer).ToObservable()
2540
                //                      where String.IsNullOrEmpty((kkk as FrameworkElement).Name)
2541
                //                      select kkk).FirstOrDefault();
2542
2543
                //var canvas = LogicalTreeHelper.FindLogicalNode(this, "drawingRotateCanvas") as Canvas;
2544
                //if (canvas !=null)
2545
                //{
2546
                //    foreach (var item in (canvas.Children[0] as ItemsControl).Items)
2547
                //    {
2548
                //        UIElement uiElement = (UIElement)(canvas.Children[0] as ItemsControl).ItemContainerGenerator.ContainerFromItem(item);
2549
                //        if (uiElement!=null)
2550
                //        {
2551
                //            uiElement.InputHitTest(currentCanvasDrawingMouseMovePoint).
2552
                //        }
2553
                //    }
2554
                //}
2555
2556
                //EllipseGeometry expandedHitTestArea = new EllipseGeometry(currentCanvasDrawingMouseMovePoint, 10.0, 10.0);
2557
                //hitResultsList.Clear();
2558
2559
                #endregion
2560
            }
2561
        }
2562
2563 a1716fa5 KangIngu
        private void zoomAndPanControl2_MouseMove(object sender, MouseEventArgs e)
2564
        {
2565 e6a9ddaf humkyung
            if ((e.MiddleButton == MouseButtonState.Pressed) || (e.RightButton == MouseButtonState.Pressed))
2566 a1716fa5 KangIngu
            {
2567
                SetCursor();
2568
                Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas2);
2569
                Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas2);
2570
2571
                Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint;
2572
2573
                ViewerDataModel.Instance.Sync_ContentOffsetX -= dragOffset.X;
2574
                ViewerDataModel.Instance.Sync_ContentOffsetY -= dragOffset.Y;
2575
2576
                if (Sync.IsChecked)
2577
                {
2578
                    zoomAndPanControl.ContentOffsetX = ViewerDataModel.Instance.Sync_ContentOffsetX;
2579
                    zoomAndPanControl.ContentOffsetY = ViewerDataModel.Instance.Sync_ContentOffsetY;
2580
                }
2581
            }
2582
        }
2583
2584 787a4489 KangIngu
        private List<CommentUserInfo> hitList = new List<CommentUserInfo>();
2585
2586
        private EllipseGeometry hitArea = new EllipseGeometry();
2587
2588
        private void zoomAndPanControl_MouseUp(object sender, MouseButtonEventArgs e)
2589
        {
2590
            IsDrawing = false;
2591
2592
            if (mouseHandlingMode != MouseHandlingMode.None)
2593
            {
2594
                if (mouseHandlingMode == MouseHandlingMode.Drawing)
2595
                {
2596 510cbd2a ljiyeon
                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
2597 787a4489 KangIngu
2598
                    SetCursor();
2599
2600
                    switch (controlType)
2601
                    {
2602
                        case ControlType.None:
2603
                            break;
2604
                        case ControlType.Rectangle:
2605
                            {
2606
2607
                            }
2608
                            break;
2609
                        case ControlType.PenControl:
2610
                            {
2611
2612
                            }
2613
                            break;
2614
                        default:
2615
                            break;
2616
                    }
2617
                }
2618 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)
2619 787a4489 KangIngu
                {
2620
                    if (isLeftMouseButtonDownOnWindow)
2621
                    {
2622
                        bool wasDragSelectionApplied = false;
2623
2624
                        if (isDraggingSelectionRect)
2625
                        {
2626 53880c83 ljiyeon
                            if (mouseHandlingMode == MouseHandlingMode.Capture && controlType == ControlType.ImgControl)
2627
                            {
2628
                                dragCaptureBorder.Visibility = Visibility.Collapsed;
2629
                                mouseHandlingMode = MouseHandlingMode.None;
2630
                                Point endPoint = e.GetPosition(zoomAndPanCanvas);
2631
                                symbolselectindex = symbolPanel_Instance.RadTab.SelectedIndex;
2632
                                Set_Symbol_Capture(endPoint);
2633
                                ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed;
2634
                                ViewerDataModel.Instance.ViewVisible = Visibility.Visible;                                
2635
                                ViewerDataModel.Instance.Capture_Opacity = 0;
2636
                            }
2637
                            else if (mouseHandlingMode == MouseHandlingMode.Capture)
2638 787a4489 KangIngu
                            {
2639
                                dragCaptureBorder.Visibility = Visibility.Collapsed;
2640
                                mouseHandlingMode = MouseHandlingMode.None;
2641
                                Set_Capture();
2642
2643
                                ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed;
2644
                                ViewerDataModel.Instance.ViewVisible = Visibility.Visible;
2645
                                ViewerDataModel.Instance.Capture_Opacity = 0;
2646
                            }
2647 9f473fb7 KangIngu
                            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
2648 787a4489 KangIngu
                            {
2649
                                ApplyDragSelectionRect();
2650
                            }
2651 9f473fb7 KangIngu
                            else
2652
                            {
2653
                                double x = Canvas.GetLeft(dragZoomBorder);
2654
                                double y = Canvas.GetTop(dragZoomBorder);
2655
                                double width = dragZoomBorder.Width;
2656
                                double height = dragZoomBorder.Height;
2657
                                Rect dragRect = new Rect(x, y, width, height);
2658
2659
                                ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.ZoomTo(dragRect);
2660
2661
                                dragZoomBorder.Visibility = Visibility.Collapsed;
2662
                            }
2663 787a4489 KangIngu
2664 9f473fb7 KangIngu
                            isDraggingSelectionRect = false;
2665 787a4489 KangIngu
                            e.Handled = true;
2666
                            wasDragSelectionApplied = true;
2667
                        }
2668
2669
                        if (isLeftMouseButtonDownOnWindow)
2670
                        {
2671
                            isLeftMouseButtonDownOnWindow = false;
2672
                            this.ReleaseMouseCapture();
2673
                            e.Handled = true;
2674
                        }
2675
2676
                        if (!wasDragSelectionApplied)
2677
                        {
2678
                            init();
2679
                        }
2680
                    }
2681
                }
2682 e6a9ddaf humkyung
                else if (e.RightButton == MouseButtonState.Pressed)
2683 787a4489 KangIngu
                {
2684 510cbd2a ljiyeon
                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
2685 787a4489 KangIngu
                    SetCursor();
2686
                }
2687
2688
                zoomAndPanControl.ReleaseMouseCapture();
2689
2690
2691
                e.Handled = true;
2692
            }
2693
            else
2694
            {
2695 510cbd2a ljiyeon
                this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
2696 787a4489 KangIngu
                SetCursor();
2697
            }
2698
2699 e6a9ddaf humkyung
            ///mouseButtonDown = MouseButton.Left;
2700 787a4489 KangIngu
            //controlType = ControlType.SingleLine;
2701
        }
2702
2703 53880c83 ljiyeon
        public void Set_Symbol_Capture(Point endPoint)
2704
        {       
2705
            double x = canvasDrawingMouseDownPoint.X;
2706
            double y = canvasDrawingMouseDownPoint.Y;
2707
            if(x > endPoint.X)
2708
            {
2709
                x = endPoint.X;
2710
                y = endPoint.Y;
2711
            }
2712
2713
            double width = dragCaptureBorder.Width;
2714
            double height = dragCaptureBorder.Height;
2715
2716
            canvasImage = ConverterBitmapImage(zoomAndPanCanvas);
2717
2718
            if (x < 0)
2719
            {
2720
                width += x;
2721
                x = 0;
2722
            }
2723
            if (y < 0)
2724
            {
2725
                height += y;
2726
                y = 0;
2727
2728
                width = (int)canvasImage.PixelWidth - x;
2729
            }
2730
            if (x + width > canvasImage.PixelWidth)
2731
            {
2732
                width = (int)canvasImage.PixelWidth - x;
2733
            }
2734
            if (y + height > canvasImage.PixelHeight)
2735
            {
2736
                height = (int)canvasImage.PixelHeight - y;
2737
            }
2738
            var rect = new Int32Rect((int)x, (int)y, (int)width, (int)height);
2739
2740
            string uri = "";
2741
            if (userData.COMPANY != "EXT")
2742
            {
2743
                uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO,
2744
                    (Convert.ToInt32(_ViewInfo.DocumentItemID) / 100).ToString(), _ViewInfo.DocumentItemID, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber);
2745
            }
2746
            else
2747
            {
2748
                uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, _ViewInfo.DocumentItemID,
2749
                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber);
2750
            }
2751
2752
            var defaultBitmapImage = new BitmapImage();
2753
            defaultBitmapImage.BeginInit();
2754
            defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
2755
            defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
2756
            defaultBitmapImage.UriSource = new Uri(uri);
2757
            defaultBitmapImage.EndInit();
2758
2759 90e7968d ljiyeon
            //GC.Collect();
2760 53880c83 ljiyeon
2761
            if (defaultBitmapImage.IsDownloading)
2762
            {
2763
                defaultBitmapImage.DownloadCompleted += (ex, arg) =>
2764
                {
2765
                    defaultBitmapImage.Freeze();
2766 90e7968d ljiyeon
                    //GC.Collect();
2767 53880c83 ljiyeon
                    BitmapSource bs = new CroppedBitmap(defaultBitmapImage, rect);
2768
                    Save_Symbol_Capture(bs, (int)x, (int)y, (int)width, (int)height);
2769
                };
2770
            }
2771
        }
2772
2773 a1716fa5 KangIngu
        private void zoomAndPanControl2_MouseUp(object sender, MouseButtonEventArgs e)
2774
        {
2775 e6a9ddaf humkyung
            ///mouseButtonDown = MouseButton.Left;
2776 a1716fa5 KangIngu
        }
2777
2778 787a4489 KangIngu
        private void zoomAndPanControl_MouseLeave(object sender, MouseEventArgs e)
2779
        {
2780 e6a9ddaf humkyung
            ///mouseButtonDown = MouseButton.Left;
2781 53880c83 ljiyeon
            //this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
2782 787a4489 KangIngu
        }
2783
2784
        private void zoomAndPanControl_MouseDoubleClick(object sender, MouseButtonEventArgs e)
2785
        {
2786
2787
        }
2788
2789 4804a4fb humkyung
        /// <summary>
2790
        /// select items by dragging
2791
        /// </summary>
2792 787a4489 KangIngu
        private void ApplyDragSelectionRect()
2793
        {
2794
            dragSelectionBorder.Visibility = Visibility.Collapsed;
2795
2796
            double x = Canvas.GetLeft(dragSelectionBorder);
2797
            double y = Canvas.GetTop(dragSelectionBorder);
2798
            double width = dragSelectionBorder.Width;
2799
            double height = dragSelectionBorder.Height;
2800
            Boolean Flag = false;
2801
            List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2802 f87a00b1 ljiyeon
            var Items = ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.Visibility != Visibility.Hidden).ToList();
2803 787a4489 KangIngu
2804 e6a9ddaf humkyung
            Rect dragRect = new Rect(x, y, width, height);
2805
            ///dragRect.Inflate(width / 10, height / 10);
2806 787a4489 KangIngu
2807
            foreach (var item in Items)
2808
            {
2809 91efe37a humkyung
                Flag = SelectionSet.Instance.SelectControl(item, dragRect);
2810 787a4489 KangIngu
2811
                if (Flag)
2812
                {
2813
                    adornerSet.Add(item);
2814 05009a0e ljiyeon
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(item);
2815 787a4489 KangIngu
                    Control_Style(item);
2816
                }
2817
            }
2818
            if (adornerSet.Count > 0)
2819
            {
2820
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2821
                SelectLayer.Children.Add(final);
2822
            }
2823
        }
2824
2825
        private void InitDragSelectionRect(Point pt1, Point pt2)
2826
        {
2827 9f473fb7 KangIngu
            //캡쳐 중
2828
            if (mouseHandlingMode == MouseHandlingMode.Capture)
2829
            {
2830
                dragCaptureBorder.Visibility = Visibility.Visible;
2831
            }
2832 787a4489 KangIngu
            //선택 중
2833 9f473fb7 KangIngu
            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
2834 787a4489 KangIngu
            {
2835 e54660e8 KangIngu
2836 787a4489 KangIngu
                dragSelectionBorder.Visibility = Visibility.Visible;
2837
            }
2838
            else
2839
            {
2840 9f473fb7 KangIngu
                dragZoomBorder.Visibility = Visibility.Visible;
2841 787a4489 KangIngu
            }
2842
            UpdateDragSelectionRect(pt1, pt2);
2843
        }
2844
2845
        /// <summary>
2846
        /// Update the position and size of the rectangle used for drag selection.
2847
        /// </summary>
2848
        private void UpdateDragSelectionRect(Point pt1, Point pt2)
2849
        {
2850
            double x, y, width, height;
2851
2852
            //
2853
            // Determine x,y,width and height of the rect inverting the points if necessary.
2854
            // 
2855
2856
            if (pt2.X < pt1.X)
2857
            {
2858
                x = pt2.X;
2859
                width = pt1.X - pt2.X;
2860
            }
2861
            else
2862
            {
2863
                x = pt1.X;
2864
                width = pt2.X - pt1.X;
2865
            }
2866
2867
            if (pt2.Y < pt1.Y)
2868
            {
2869
                y = pt2.Y;
2870
                height = pt1.Y - pt2.Y;
2871
            }
2872
            else
2873
            {
2874
                y = pt1.Y;
2875
                height = pt2.Y - pt1.Y;
2876
            }
2877
2878
            //
2879
            // Update the coordinates of the rectangle used for drag selection.
2880
            //
2881 9f473fb7 KangIngu
            //캡쳐 중
2882
            if (mouseHandlingMode == MouseHandlingMode.Capture)
2883
            {
2884
                Canvas.SetLeft(dragCaptureBorder, x);
2885
                Canvas.SetTop(dragCaptureBorder, y);
2886
                dragCaptureBorder.Width = width;
2887
                dragCaptureBorder.Height = height;
2888
            }
2889 787a4489 KangIngu
            //선택 중
2890 a1716fa5 KangIngu
            else if (mouseHandlingMode == MouseHandlingMode.Selecting)
2891 787a4489 KangIngu
            {
2892
                Canvas.SetLeft(dragSelectionBorder, x);
2893
                Canvas.SetTop(dragSelectionBorder, y);
2894
                dragSelectionBorder.Width = width;
2895
                dragSelectionBorder.Height = height;
2896
            }
2897
            else
2898
            {
2899 9f473fb7 KangIngu
                Canvas.SetLeft(dragZoomBorder, x);
2900
                Canvas.SetTop(dragZoomBorder, y);
2901
                dragZoomBorder.Width = width;
2902
                dragZoomBorder.Height = height;
2903 787a4489 KangIngu
            }
2904
        }
2905
2906
        private void drawingPannelRotate(double angle)
2907
        {
2908 548c696e ljiyeon
            Logger.sendCheckLog("pageNavigator_PageChanging_drawingPannelRotate Setting", 1);
2909 787a4489 KangIngu
            rotate.Angle = angle;
2910
            var rotationNum = Math.Abs((rotate.Angle / 90));
2911
2912
            if (angle == 90 || angle == 270)
2913
            {
2914
                double emptySize = zoomAndPanCanvas.Width;
2915
                zoomAndPanCanvas.Width = zoomAndPanCanvas.Height;
2916
                zoomAndPanCanvas.Height = emptySize;
2917
            }
2918
            if (angle == 0)
2919
            {
2920
                translate.X = 0;
2921
                translate.Y = 0;
2922
            }
2923
            else if (angle == 90)
2924
            {
2925
                translate.X = zoomAndPanCanvas.Width;
2926
                translate.Y = 0;
2927
            }
2928
            else if (angle == 180)
2929
            {
2930
                translate.X = zoomAndPanCanvas.Width;
2931
                translate.Y = zoomAndPanCanvas.Height;
2932
            }
2933
            else
2934
            {
2935
                translate.X = 0;
2936
                translate.Y = zoomAndPanCanvas.Height;
2937
            }
2938
2939
            zoomAndPanControl.RotationAngle = rotate.Angle;
2940
2941
2942
            if (!testPanel2.IsHidden)
2943
            {
2944
                zoomAndPanControl2.RotationAngle = rotate.Angle;
2945
                zoomAndPanCanvas2.Width = zoomAndPanCanvas.Width;
2946
                zoomAndPanCanvas2.Height = zoomAndPanCanvas.Height;
2947
            }
2948
2949
            ViewerDataModel.Instance.ContentWidth = zoomAndPanCanvas.Width;
2950
            ViewerDataModel.Instance.ContentHeight = zoomAndPanCanvas.Height;
2951
            ViewerDataModel.Instance.AngleOffsetX = translate.X;
2952
            ViewerDataModel.Instance.AngleOffsetY = translate.Y;
2953
            ViewerDataModel.Instance.Angle = rotate.Angle;
2954
        }
2955
2956 53880c83 ljiyeon
        public void PlaceImageSymbol(string id, long group_id, int SelectedIndex, Point canvasZoomPanningMouseDownPoint)
2957 787a4489 KangIngu
        {
2958 53880c83 ljiyeon
            string Data_ = "";
2959
2960
            try
2961
            {
2962
                Logger.sendReqLog("GetSymbolImageURL: ", id + "," + SelectedIndex, 1);
2963
                Data_ = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetSymbolImageURL(id, SelectedIndex);
2964
                if (Data_ != null || Data_ != "")
2965
                {
2966
                    Logger.sendResLog("GetSymbolImageURL", "TRUE", 1);
2967
                }
2968
                else
2969
                {
2970
                    Logger.sendResLog("GetSymbolImageURL", "FALSE", 1);
2971
                }
2972
2973 c0977e97 djkim
                //MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
2974
                //{
2975
                //    SYMBOL_ID = id,//InnerItem.Symbol_ID
2976
                //    STATE = 0,
2977
                //};
2978 53880c83 ljiyeon
                if (Data_ != null)
2979
                {
2980
                    Image img = new Image();
2981
                    //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(Data_));
2982
                    if (Data_.Contains(".svg"))
2983
                    {
2984
                        byte[] imageData = null;
2985
                        DrawingImage image = null;
2986
                        using (System.Net.WebClient web = new System.Net.WebClient())
2987
                        {
2988
                            imageData = web.DownloadData(new Uri(Data_));
2989
                            System.IO.Stream stream = new System.IO.MemoryStream(imageData);
2990
                            image = SvgReader.Load(stream);
2991
                        }
2992
                        img.Source = image;
2993
                    }
2994
                    else
2995
                    {
2996
                        img.Source = new BitmapImage(new Uri(Data_));
2997
                    }
2998
2999
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
3000
                    {
3001
                        PointSet = new List<Point>(),
3002
                        FilePath = Data_,
3003
                        ImageData = img.Source,
3004
                        StartPoint = canvasZoomPanningMouseDownPoint,
3005
                        EndPoint = new Point(canvasZoomPanningMouseDownPoint.X + img.Source.Width, 
3006
                        canvasZoomPanningMouseDownPoint.Y + img.Source.Height),
3007
                        TopRightPoint = new Point(canvasZoomPanningMouseDownPoint.X+img.Source.Width,
3008
                        canvasZoomPanningMouseDownPoint.Y),
3009
                        LeftBottomPoint = new Point(canvasZoomPanningMouseDownPoint.X,
3010
                        canvasZoomPanningMouseDownPoint.Y + img.Source.Height)
3011
                    };
3012
3013
                    currentControl.PointSet = new List<Point>
3014
                                        {
3015
                                            currentControl.StartPoint,
3016
                                            currentControl.LeftBottomPoint,
3017
                                            currentControl.EndPoint,
3018
                                            currentControl.TopRightPoint,
3019
                                        };
3020
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
3021
                    UndoData = new Undo_data()
3022
                    {
3023
                        IsUndo = false,
3024
                        Event = Event_Type.Create,
3025
                        EventTime = DateTime.Now,
3026
                        Markup_List = new List<Multi_Undo_data>()
3027
                    };
3028
                    ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
3029
                    {
3030
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
3031
                    });
3032
3033
                    //multi_Undo_Data = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
3034
                    multi_Undo_Data = Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
3035
                    UndoData.Markup_List.Add(multi_Undo_Data);
3036
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
3037
3038
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
3039 24678e06 humkyung
                    currentControl.CommentID = Commons.shortGuid();
3040 53880c83 ljiyeon
                    currentControl.SymbolID = id;
3041
                    currentControl.GroupID = group_id;
3042
                    currentControl.ApplyTemplate();
3043
                    currentControl.SetImage();
3044
3045
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
3046
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
3047
                    SelectLayer.Children.Add(final);
3048
                }
3049
            }
3050
            catch (Exception ex)
3051
            {
3052
                this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(ex.Message, "Error");
3053
            }
3054
        }
3055
3056
        private void zoomAndPanControl_MouseDown(object sender, MouseButtonEventArgs e)
3057
        {            
3058 992a98b4 KangIngu
            var set_option = this.ParentOfType<MainWindow>().dzTopMenu.Parent.ChildrenOfType<RadNumericUpDown>().Where(item => item.IsKeyboardFocusWithin).FirstOrDefault();
3059 be04d12c djkim
            if (set_option != null && !string.IsNullOrEmpty(set_option.ContentText))
3060 992a98b4 KangIngu
            {
3061
                set_option.Value = double.Parse(set_option.ContentText);
3062
            }
3063
3064 787a4489 KangIngu
            InkControl_Convert();
3065
3066 d62c0439 humkyung
            ///TODO:
3067 787a4489 KangIngu
            var text_item = ViewerDataModel.Instance.MarkupControls_USER.Where(data =>
3068
            (data as TextControl) != null && (data as TextControl).Text == "" || (data as ArrowTextControl) != null && (data as ArrowTextControl).ArrowText == "").FirstOrDefault();
3069
3070 a1716fa5 KangIngu
            if (text_item != null && (currentControl as ArrowTextControl) == null)
3071 787a4489 KangIngu
            {
3072
                ViewerDataModel.Instance.MarkupControls_USER.Remove(text_item);
3073
            }
3074 d62c0439 humkyung
            /// up to here
3075 787a4489 KangIngu
3076
            foreach (var arrow_text in ViewerDataModel.Instance.MarkupControls_USER)
3077
            {
3078
                if (arrow_text as ArrowTextControl != null)
3079
                {
3080
                    (arrow_text as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
3081
                }
3082
            }
3083
3084 e6a9ddaf humkyung
            ///mouseButtonDown = e.ChangedButton;
3085 32e95118 KangIngu
            /// complete drawing text control when user click mouse right button - 2018.05.14 added by humkyung
3086 e54660e8 KangIngu
3087 49b217ad humkyung
            //if (currentControl != null)
3088 787a4489 KangIngu
            {
3089
                var text_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as TextControl) != null && (data as TextControl).Base_TextBox.Visibility == Visibility.Visible).FirstOrDefault();
3090
                if (text_item_ != null)
3091
                {
3092
                    (text_item_ as TextControl).Base_TextBlock.Visibility = Visibility.Visible;
3093
                    (text_item_ as TextControl).Base_TextBox.Visibility = Visibility.Collapsed;
3094
                    (text_item_ as TextControl).IsEditing = false;
3095
                    (text_item_ as TextControl).EnableEditing = false;
3096 49b217ad humkyung
                    currentControl = null;
3097 787a4489 KangIngu
                }
3098
3099
                var Arrowtext_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as ArrowTextControl) != null && (data as ArrowTextControl).IsEditingMode == true).FirstOrDefault();
3100 49b217ad humkyung
                if (Arrowtext_item_ != null && ((Arrowtext_item_ as ArrowTextControl).IsNew == false))
3101 787a4489 KangIngu
                {
3102
                    (Arrowtext_item_ as ArrowTextControl).IsEditingMode = false;
3103
                    (Arrowtext_item_ as ArrowTextControl).Base_TextBox.Focusable = false;
3104 49b217ad humkyung
                    currentControl = null;
3105 787a4489 KangIngu
                }
3106
            }
3107
3108 ca40e004 ljiyeon
            double Ang = 0;                                          
3109 787a4489 KangIngu
            if (rotate.Angle != 0)
3110
            {
3111
                Ang = 360 - rotate.Angle;
3112
            }
3113
3114
            if (e.OriginalSource is System.Windows.Controls.Image)
3115
            {
3116
                (e.OriginalSource as System.Windows.Controls.Image).Focus();
3117
            }
3118 e54660e8 KangIngu
3119 e6a9ddaf humkyung
            if (mouseHandlingMode == MouseHandlingMode.DragSymbol && e.LeftButton == MouseButtonState.Pressed)
3120 53880c83 ljiyeon
            {                
3121
                //this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
3122
                //SetCursor();
3123
3124
                //canvasDrawingMouseDownPoint = e.GetPosition(drawingRotateCanvas);
3125
                canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
3126
                if(symbol_id != null)
3127
                {
3128
                    PlaceImageSymbol(symbol_id, symbol_group_id, symbol_SelectedIndex, canvasZoomPanningMouseDownPoint);
3129
                }                
3130
            }
3131
3132 e6a9ddaf humkyung
            if (mouseHandlingMode == MouseHandlingMode.DragSymbol && e.RightButton == MouseButtonState.Pressed)
3133 53880c83 ljiyeon
            {
3134
                if (this._dragdropWindow != null)
3135
                {
3136
                    this._dragdropWindow.Close();
3137
                    this._dragdropWindow = null;
3138
                    symbol_id = null;
3139
                }
3140
            }
3141
3142 e6a9ddaf humkyung
            if (e.LeftButton == MouseButtonState.Pressed)
3143 787a4489 KangIngu
            {
3144
                canvasDrawingMouseDownPoint = e.GetPosition(drawingRotateCanvas);
3145
                canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
3146
3147 510cbd2a ljiyeon
                this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
3148 787a4489 KangIngu
                SetCursor();
3149
3150
                if (!ViewerDataModel.Instance.IsPressCtrl)
3151
                {
3152 077896be humkyung
                    SelectionSet.Instance.UnSelect(this);
3153 787a4489 KangIngu
                }
3154
            }
3155 e6a9ddaf humkyung
            if (e.MiddleButton == MouseButtonState.Pressed)
3156 787a4489 KangIngu
            {
3157
                canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
3158
                cursor = Cursors.SizeAll;
3159
                SetCursor();
3160
            }
3161 e6a9ddaf humkyung
            if (e.RightButton == MouseButtonState.Pressed)
3162 787a4489 KangIngu
            {
3163
                canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas);
3164
                cursor = Cursors.SizeAll;
3165
                SetCursor();
3166
            }
3167 e6a9ddaf humkyung
            else if (e.XButton1 == MouseButtonState.Pressed)
3168 787a4489 KangIngu
            {
3169
                if (this.pageNavigator.CurrentPage.PageNumber + 1 <= this.pageNavigator.PageCount)
3170
                {
3171
                    this.pageNavigator.GotoPage(this.pageNavigator._NextPage.PageNumber + 1);
3172
                }
3173
3174
                this.pageNavigator.GotoPage(this.pageNavigator._NextPage.PageNumber);
3175
3176
            }
3177 e6a9ddaf humkyung
            else if (e.XButton2 == MouseButtonState.Pressed)
3178 787a4489 KangIngu
            {
3179
                if (this.pageNavigator.CurrentPage.PageNumber > 1)
3180
                {
3181
                    this.pageNavigator.GotoPage(this.pageNavigator.CurrentPage.PageNumber - 1);
3182
                }
3183
            }
3184
3185 9f473fb7 KangIngu
            //if (mouseButtonDown == MouseButton.Left && ViewerDataModel.Instance.MarkupControls_USER.Count > 0 && mouseHandlingMode != MouseHandlingMode.Drawing && currentControl == null)
3186 e6a9ddaf humkyung
            if (e.LeftButton == MouseButtonState.Pressed && mouseHandlingMode != MouseHandlingMode.Drawing && currentControl == null)
3187 787a4489 KangIngu
            {
3188
                if (mouseHandlingMode == MouseHandlingMode.Selecting)
3189
                {
3190
                    if (SelectLayer.Children.Count == 0)
3191
                    {
3192
                        isLeftMouseButtonDownOnWindow = true;
3193
                        mouseHandlingMode = MouseHandlingMode.Selecting;
3194
                    }
3195
3196
                    if (controlType == ControlType.None)
3197
                    {
3198
                        isLeftMouseButtonDownOnWindow = true;
3199
                    }
3200
                }
3201
3202 9f473fb7 KangIngu
                //캡쳐 모드 설정
3203
                if (mouseHandlingMode == MouseHandlingMode.Capture)
3204
                {
3205
                    dragCaptureBorder.Visibility = Visibility.Visible;
3206
                    isLeftMouseButtonDownOnWindow = true;
3207
                }
3208
3209
                //줌 모드 설정
3210
                if (mouseHandlingMode == MouseHandlingMode.DragZoom)
3211
                {
3212
                    //dragSelectionBorder.Visibility = Visibility.Visible;
3213
                    isLeftMouseButtonDownOnWindow = true;
3214 1066bae3 ljiyeon
                }
3215 787a4489 KangIngu
3216 05009a0e ljiyeon
                var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
3217 787a4489 KangIngu
                if (control != null)
3218
                {
3219 d62c0439 humkyung
                    AdornerFinal final = null;
3220 787a4489 KangIngu
3221
                    if (!ViewerDataModel.Instance.IsPressCtrl)
3222
                    {
3223 d62c0439 humkyung
                        /// 기존 selection 해제
3224 077896be humkyung
                        SelectionSet.Instance.UnSelect(this);
3225 d62c0439 humkyung
3226 787a4489 KangIngu
                        final = new AdornerFinal(control);
3227
3228
                        Control_Style(control);
3229
3230
                        if ((control as IPath) != null)
3231
                        {
3232
                            if ((control as IPath).LineSize != 0)
3233
                            {
3234
                                ViewerDataModel.Instance.LineSize = (control as IPath).LineSize;
3235
                            }
3236
                        }
3237
                        if ((control as IShapeControl) != null)
3238
                        {
3239
                            if ((control as IShapeControl).Paint == PaintSet.Hatch)
3240
                            {
3241
                                ViewerDataModel.Instance.checkHatchShape = true;
3242
                            }
3243
                            else if ((control as IShapeControl).Paint == PaintSet.Fill)
3244
                            {
3245
                                ViewerDataModel.Instance.checkFillShape = true;
3246
                            }
3247
                            else
3248
                            {
3249
                                ViewerDataModel.Instance.checkHatchShape = false;
3250
                                ViewerDataModel.Instance.checkFillShape = false;
3251
                            }
3252
                            ViewerDataModel.Instance.paintSet = (control as IShapeControl).Paint;
3253
                        }
3254 9f473fb7 KangIngu
3255 787a4489 KangIngu
                        ViewerDataModel.Instance.ControlOpacity = control.Opacity;
3256 d4b0c723 KangIngu
3257
                        if ((control as TextControl) != null)
3258
                        {
3259
                            if ((control as TextControl).TextStyle == FontStyles.Italic)
3260
                            {
3261
                                ViewerDataModel.Instance.checkTextStyle = true;
3262
                            }
3263
                            else
3264
                            {
3265
                                ViewerDataModel.Instance.checkTextStyle = false;
3266
                            }
3267
3268
                            if ((control as TextControl).TextStyle == FontStyles.Italic)
3269
                            {
3270
                                ViewerDataModel.Instance.checkTextStyle = true;
3271
                            }
3272
                            else
3273
                            {
3274
                                ViewerDataModel.Instance.checkTextStyle = false;
3275
                            }
3276
                            if ((control as TextControl).TextWeight == FontWeights.Bold)
3277
                            {
3278
                                ViewerDataModel.Instance.checkTextWeight = true;
3279
                            }
3280
                            else
3281
                            {
3282
                                ViewerDataModel.Instance.checkTextWeight = false;
3283
                            }
3284
                            if ((control as TextControl).UnderLine == TextDecorations.Underline)
3285
                            {
3286
                                ViewerDataModel.Instance.checkUnderLine = true;
3287
                            }
3288
                            else
3289
                            {
3290
                                ViewerDataModel.Instance.checkUnderLine = false;
3291
                            }
3292
                            ViewerDataModel.Instance.TextSize = (control as TextControl).TextSize;
3293
                            ViewerDataModel.Instance.checkHighlight = (control as TextControl).IsHighLight;
3294 e54660e8 KangIngu
3295 d4b0c723 KangIngu
                        }
3296
                        else if ((control as ArrowTextControl) != null)
3297
                        {
3298 e17af42b KangIngu
                            if ((control as ArrowTextControl).TextStyle == FontStyles.Italic)
3299 d4b0c723 KangIngu
                            {
3300 e17af42b KangIngu
                                ViewerDataModel.Instance.checkTextStyle = true;
3301
                            }
3302
                            else
3303
                            {
3304
                                ViewerDataModel.Instance.checkTextStyle = false;
3305
                            }
3306
3307
                            if ((control as ArrowTextControl).TextStyle == FontStyles.Italic)
3308
                            {
3309
                                ViewerDataModel.Instance.checkTextStyle = true;
3310 d4b0c723 KangIngu
                            }
3311 e17af42b KangIngu
                            else
3312 d4b0c723 KangIngu
                            {
3313 e17af42b KangIngu
                                ViewerDataModel.Instance.checkTextStyle = false;
3314 d4b0c723 KangIngu
                            }
3315 e17af42b KangIngu
                            if ((control as ArrowTextControl).TextWeight == FontWeights.Bold)
3316 d4b0c723 KangIngu
                            {
3317 e17af42b KangIngu
                                ViewerDataModel.Instance.checkTextWeight = true;
3318
                            }
3319
                            else
3320
                            {
3321
                                ViewerDataModel.Instance.checkTextWeight = false;
3322
                            }
3323
                            if ((control as ArrowTextControl).UnderLine == TextDecorations.Underline)
3324
                            {
3325
                                ViewerDataModel.Instance.checkUnderLine = true;
3326
                            }
3327
                            else
3328
                            {
3329
                                ViewerDataModel.Instance.checkUnderLine = false;
3330 d4b0c723 KangIngu
                            }
3331
                            ViewerDataModel.Instance.checkHighlight = (control as ArrowTextControl).isHighLight;
3332
                            ViewerDataModel.Instance.TextSize = (control as ArrowTextControl).TextSize;
3333
                        }
3334 9f473fb7 KangIngu
                        else if ((control as RectCloudControl) != null)
3335
                        {
3336
                            ViewerDataModel.Instance.ArcLength = (control as RectCloudControl).ArcLength;
3337
                        }
3338
                        else if ((control as CloudControl) != null)
3339
                        {
3340
                            ViewerDataModel.Instance.ArcLength = (control as CloudControl).ArcLength;
3341
                        }
3342 787a4489 KangIngu
                    }
3343
                    else
3344
                    {
3345 d62c0439 humkyung
                        List<CommentUserInfo> comment = SelectionSet.Instance.SelectedItems;
3346
                        SelectionSet.Instance.UnSelect(this);
3347 787a4489 KangIngu
                        comment.Add(control);
3348
3349
                        Control_Style(control);
3350
3351
                        final = new AdornerFinal(comment);
3352
                    }
3353
3354 d62c0439 humkyung
                    if(final != null) this.SelectLayer.Children.Add(final);
3355 6707a5c7 ljiyeon
                }              
3356 787a4489 KangIngu
            }
3357
            else if (mouseHandlingMode == MouseHandlingMode.Drawing)
3358 6707a5c7 ljiyeon
            {               
3359 787a4489 KangIngu
                init();
3360
                //강인구 추가(우 클릭 일 경우 커서 변경 하지 않음)
3361
                if (cursor != Cursors.SizeAll)
3362
                {
3363
                    cursor = Cursors.Cross;
3364
                    SetCursor();
3365
                }
3366
                bool init_user = false;
3367
                foreach (var user in gridViewMarkup.Items)
3368
                {
3369
                    if ((user as MarkupInfoItem).UserID == App.ViewInfo.UserID)
3370
                    {
3371
                        init_user = true;
3372
                    }
3373
                }
3374
                if (init_user && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null && e.LeftButton == MouseButtonState.Pressed)
3375
                {
3376
                    RadWindow.Alert(new DialogParameters
3377
                    {
3378 b9b01f8e ljiyeon
                        Owner = Application.Current.MainWindow,
3379 787a4489 KangIngu
                        Theme = new VisualStudio2013Theme(),
3380
                        Header = "안내",
3381
                        Content = "기존의 코멘트가 존재합니다. 사용자 리스트에서 먼저 선택해주세요",
3382
                    });
3383
                    return;
3384
                }
3385
                else
3386
                {
3387
                    var item = gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() as MarkupInfoItem;
3388
                    if (item != null)
3389
                    {
3390
                        App.Custom_ViewInfoId = item.MarkupInfoID;
3391
                    }
3392
                }
3393
3394
                multi_Undo_Data = new Multi_Undo_data();
3395
                //강인구 Undo/Redo 보류
3396
                UndoData = new Undo_data()
3397
                {
3398
                    IsUndo = false,
3399
                    Event = Event_Type.Create,
3400
                    EventTime = DateTime.Now,
3401
                    Markup_List = new List<Multi_Undo_data>()
3402
                };
3403
3404 75448f5e ljiyeon
                switch (controlType)
3405 787a4489 KangIngu
                {
3406 684ef11c ljiyeon
                    case ControlType.Coordinate:
3407
                        {
3408 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3409 684ef11c ljiyeon
                            {
3410
                                if (currentControl is CoordinateControl)
3411
                                {
3412
                                    if (IsGetoutpoint((currentControl as CoordinateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3413
                                    {
3414
                                        return;
3415
                                    }
3416
3417
                                    CreateControl();
3418
3419
                                    (currentControl as CoordinateControl).ApplyOverViewData();
3420
                                    currentControl = null;
3421
                                    this.cursor = Cursors.Arrow;
3422
                                }
3423
                                else
3424
                                {
3425
                                    this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
3426 d62c0439 humkyung
                                    if (ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber
3427 684ef11c ljiyeon
                                     && d.Data_Type == Convert.ToInt32(MarkupToPDF.Controls.Common.ControlType.Coordinate)).Count() > 0)
3428
                                    {
3429
                                        currentControl = null;
3430
                                        this.cursor = Cursors.Arrow;
3431
                                        Common.ViewerDataModel.Instance.SystemMain.DialogMessage_Alert("이미 해당 페이지의 도면 영역을 설정하셨습니다.", "Notice");
3432
                                        return;
3433
                                    }
3434
                                    else
3435
                                    {
3436
                                        currentControl = new CoordinateControl
3437
                                        {
3438
                                            Background = new SolidColorBrush(Colors.Black),
3439
                                            ControlType = ControlType.Coordinate
3440
                                        };
3441
3442 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
3443 684ef11c ljiyeon
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3444
                                        currentControl.IsNew = true;
3445
3446
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3447
3448
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3449
                                    }
3450
                                }
3451
                            }
3452
                        }
3453
                        break;
3454
                    case ControlType.InsideWhite:
3455
                        {
3456 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3457 684ef11c ljiyeon
                            {
3458
                                if (currentControl is InsideWhiteControl)
3459
                                {
3460
                                    if (IsGetoutpoint((currentControl as InsideWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3461
                                    {
3462
                                        return;
3463
                                    }
3464
3465
                                    CreateControl();
3466
3467
                                    (currentControl as InsideWhiteControl).ApplyOverViewData();
3468
                                    currentControl = null;
3469
                                    this.cursor = Cursors.Arrow;
3470
                                }
3471
                                else
3472
                                {
3473
                                    currentControl = new InsideWhiteControl
3474
                                    {
3475
                                        Background = new SolidColorBrush(Colors.Black),
3476
                                        ControlType = ControlType.InsideWhite
3477
                                    };
3478
3479 24678e06 humkyung
                                    currentControl.CommentID = Commons.shortGuid();
3480 684ef11c ljiyeon
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3481
                                    currentControl.IsNew = true;
3482
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3483
3484
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3485
                                }
3486
                            }
3487
                        }
3488
                        break;
3489
                    case ControlType.OverlapWhite:
3490
                        {
3491 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3492 684ef11c ljiyeon
                            {
3493
                                if (currentControl is OverlapWhiteControl)
3494
                                {
3495
                                    if (IsGetoutpoint((currentControl as OverlapWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3496
                                    {
3497
                                        return;
3498
                                    }
3499
3500
                                    CreateControl();
3501
3502
                                    (currentControl as OverlapWhiteControl).ApplyOverViewData();
3503
                                    currentControl = null;
3504
                                    this.cursor = Cursors.Arrow;
3505
                                }
3506
                                else
3507
                                {
3508
                                    currentControl = new OverlapWhiteControl
3509
                                    {
3510
                                        Background = new SolidColorBrush(Colors.Black),
3511
                                        ControlType = ControlType.OverlapWhite
3512
                                    };
3513
3514 24678e06 humkyung
                                    currentControl.CommentID = Commons.shortGuid();
3515 684ef11c ljiyeon
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3516
                                    currentControl.IsNew = true;
3517
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3518
3519
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3520
                                }
3521
                            }
3522
                        }
3523
                        break;
3524
                    case ControlType.ClipWhite:
3525
                        {
3526 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3527 684ef11c ljiyeon
                            {
3528
                                if (currentControl is ClipWhiteControl)
3529
                                {
3530
                                    if (IsGetoutpoint((currentControl as ClipWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3531
                                    {
3532
                                        return;
3533
                                    }
3534
3535
                                    CreateControl();
3536
3537
                                    (currentControl as ClipWhiteControl).ApplyOverViewData();
3538
                                    currentControl = null;
3539
                                    this.cursor = Cursors.Arrow;
3540
                                }
3541
                                else
3542
                                {
3543
                                    currentControl = new ClipWhiteControl
3544
                                    {
3545
                                        Background = new SolidColorBrush(Colors.Black),
3546
                                        ControlType = ControlType.ClipWhite
3547
                                    };
3548
3549 24678e06 humkyung
                                    currentControl.CommentID = Commons.shortGuid();
3550 684ef11c ljiyeon
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3551
                                    currentControl.IsNew = true;
3552
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3553
3554
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
3555
                                }
3556
                            }
3557
                        }
3558
                        break;
3559 787a4489 KangIngu
                    case ControlType.Rectangle:
3560
                        {
3561 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3562 787a4489 KangIngu
                            {
3563 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3564
                                //{
3565 787a4489 KangIngu
                                    if (currentControl is RectangleControl)
3566
                                    {
3567 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
3568
                                        if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3569 e66f22eb KangIngu
                                        {
3570
                                            return;
3571
                                        }
3572
3573 787a4489 KangIngu
                                        CreateControl();
3574
3575
                                        (currentControl as RectangleControl).ApplyOverViewData();
3576
                                        currentControl = null;
3577 510cbd2a ljiyeon
                                    
3578
                                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
3579 787a4489 KangIngu
                                    }
3580
                                    else
3581
                                    {
3582
                                        currentControl = new RectangleControl
3583
                                        {
3584
                                            Background = new SolidColorBrush(Colors.Black),
3585
                                            ControlType = ControlType.Rectangle
3586
                                        };
3587
3588 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
3589 787a4489 KangIngu
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3590
                                        currentControl.IsNew = true;
3591
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3592
3593
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
3594
                                    }
3595 e66f22eb KangIngu
                                //}
3596 787a4489 KangIngu
                            }
3597
                        }
3598
                        break;
3599
                    case ControlType.RectCloud:
3600
                        {
3601 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3602 787a4489 KangIngu
                            {
3603 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3604
                                //{
3605 787a4489 KangIngu
                                    if (currentControl is RectCloudControl)
3606
                                    {
3607 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
3608
                                        if (IsGetoutpoint((currentControl as RectCloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3609 e66f22eb KangIngu
                                        {
3610
                                            return;
3611
                                        }
3612
3613 787a4489 KangIngu
                                        CreateControl();
3614
3615
                                        (currentControl as RectCloudControl).ApplyOverViewData();
3616
                                        currentControl = null;
3617 510cbd2a ljiyeon
                                    
3618
                                        this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
3619 787a4489 KangIngu
                                    }
3620
                                    else
3621
                                    {
3622
                                        currentControl = new RectCloudControl
3623
                                        {
3624
                                            Background = new SolidColorBrush(Colors.Black)
3625
                                        };
3626
3627
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3628 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
3629 787a4489 KangIngu
                                        currentControl.IsNew = true;
3630
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3631
                                    }
3632 e66f22eb KangIngu
                                //}
3633 787a4489 KangIngu
                            }
3634
                        }
3635
                        break;
3636
                    case ControlType.Circle:
3637
                        {
3638 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3639 787a4489 KangIngu
                            {
3640 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3641
                                //{
3642 787a4489 KangIngu
                                    if (currentControl is CircleControl)
3643
                                    {
3644 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
3645
                                        if (IsGetoutpoint((currentControl as CircleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3646 e66f22eb KangIngu
                                        {
3647
                                            return;
3648
                                        }
3649
3650 787a4489 KangIngu
                                        CreateControl();
3651
3652
                                        (currentControl as CircleControl).ApplyOverViewData();
3653
                                        currentControl = null;
3654
                                    }
3655
                                    else
3656
                                    {
3657
                                        currentControl = new CircleControl
3658
                                        {
3659
                                            Background = new SolidColorBrush(Colors.Black)
3660
                                        };
3661
3662
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3663 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
3664 787a4489 KangIngu
                                        currentControl.IsNew = true;
3665
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3666
                                    }
3667 e66f22eb KangIngu
                                //}
3668 787a4489 KangIngu
                            }
3669
                        }
3670
                        break;
3671
                    case ControlType.Triangle:
3672
                        {
3673 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3674 787a4489 KangIngu
                            {
3675 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3676
                                //{
3677 787a4489 KangIngu
                                    if (currentControl is TriControl)
3678
                                    {
3679
                                        var content = currentControl as TriControl;
3680
                                        if (content.MidPoint == new Point(0, 0))
3681
                                        {
3682
                                            content.MidPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
3683
                                        }
3684
                                        else
3685
                                        {
3686 ca40e004 ljiyeon
                                            //20180906 LJY TEST IsRotationDrawingEnable
3687
                                            if (IsGetoutpoint((currentControl as TriControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3688 e66f22eb KangIngu
                                            {
3689
                                                return;
3690
                                            }
3691
3692 787a4489 KangIngu
                                            CreateControl();
3693
3694
                                            (currentControl as TriControl).ApplyOverViewData();
3695
                                            currentControl = null;
3696
                                        }
3697
                                    }
3698
                                    else
3699
                                    {
3700
                                        currentControl = new TriControl
3701
                                        {
3702
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
3703
                                            Background = new SolidColorBrush(Colors.Black),
3704
                                        };
3705
3706
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3707 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
3708 787a4489 KangIngu
                                        currentControl.IsNew = true;
3709
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3710
                                    }
3711 e66f22eb KangIngu
                                //}
3712 787a4489 KangIngu
                            }
3713
                        }
3714
                        break;
3715
                    case ControlType.SingleLine:
3716
                        {
3717 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3718 787a4489 KangIngu
                            {
3719 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3720
                                //{
3721 787a4489 KangIngu
                                    if (currentControl is LineControl)
3722
                                    {
3723 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
3724
                                        if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3725 e66f22eb KangIngu
                                        {
3726
                                            return;
3727
                                        }
3728
3729 787a4489 KangIngu
                                        CreateControl();
3730
3731
                                        (currentControl as LineControl).ApplyOverViewData();
3732
                                        currentControl = null;
3733 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3734 787a4489 KangIngu
                                    }
3735
                                    else
3736
                                    {
3737
                                        currentControl = new LineControl
3738
                                        {
3739
                                            Background = new SolidColorBrush(Colors.Black)
3740
                                        };
3741
3742
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3743 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
3744 787a4489 KangIngu
                                        currentControl.IsNew = true;
3745
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3746 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Visible;
3747 787a4489 KangIngu
                                    }
3748 e66f22eb KangIngu
                                //}
3749 787a4489 KangIngu
                            }
3750
                        }
3751
                        break;
3752
                    case ControlType.CancelLine:
3753
                        {
3754 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3755 787a4489 KangIngu
                            {
3756 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3757
                                //{
3758 787a4489 KangIngu
                                    if (currentControl is LineControl)
3759
                                    {
3760 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
3761
                                        if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3762 e66f22eb KangIngu
                                        {
3763
                                            return;
3764
                                        }
3765
3766 787a4489 KangIngu
                                        CreateControl();
3767
3768
                                        (currentControl as LineControl).ApplyOverViewData();
3769
                                        currentControl = null;
3770 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3771 787a4489 KangIngu
                                    }
3772
                                    else
3773
                                    {
3774
                                        currentControl = new LineControl
3775
                                        {
3776
                                            Background = new SolidColorBrush(Colors.Black)
3777
                                        };
3778
3779
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3780 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
3781 787a4489 KangIngu
                                        currentControl.IsNew = true;
3782
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3783 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Visible;
3784 787a4489 KangIngu
                                    }
3785 e66f22eb KangIngu
                                //}
3786 787a4489 KangIngu
                            }
3787
                        }
3788
                        break;
3789
                    case ControlType.ArrowLine:
3790
                        {
3791 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3792 787a4489 KangIngu
                            {
3793 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3794
                                //{
3795 787a4489 KangIngu
                                    if (currentControl is LineControl)
3796
                                    {
3797 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
3798
                                        if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3799 e66f22eb KangIngu
                                        {
3800
                                            return;
3801
                                        }
3802
3803 787a4489 KangIngu
                                        CreateControl();
3804
3805
                                        (currentControl as LineControl).ApplyOverViewData();
3806
                                        currentControl = null;
3807 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3808 787a4489 KangIngu
                                    }
3809
                                    else
3810
                                    {
3811
                                        currentControl = new LineControl
3812
                                        {
3813
                                            Background = new SolidColorBrush(Colors.Black)
3814
                                        };
3815
3816
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3817 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
3818 787a4489 KangIngu
                                        currentControl.IsNew = true;
3819
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3820 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Visible;
3821 787a4489 KangIngu
                                    }
3822 e66f22eb KangIngu
                                //}
3823 787a4489 KangIngu
                            }
3824
                        }
3825
                        break;
3826
                    case ControlType.TwinLine:
3827
                        {
3828 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3829 787a4489 KangIngu
                            {
3830 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3831
                                //{
3832 787a4489 KangIngu
                                    if (currentControl is LineControl)
3833
                                    {
3834 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
3835
                                        if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3836 e66f22eb KangIngu
                                        {
3837
                                            return;
3838
                                        }
3839
3840 787a4489 KangIngu
                                        CreateControl();
3841
3842
                                        (currentControl as LineControl).ApplyOverViewData();
3843
                                        currentControl = null;
3844 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3845 787a4489 KangIngu
                                    }
3846
                                    else
3847
                                    {
3848
                                        currentControl = new LineControl
3849
                                        {
3850
                                            Background = new SolidColorBrush(Colors.Black)
3851
                                        };
3852
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3853 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
3854 787a4489 KangIngu
                                        currentControl.IsNew = true;
3855
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3856 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Visible;
3857 787a4489 KangIngu
                                    }
3858 e66f22eb KangIngu
                                //}
3859 787a4489 KangIngu
                            }
3860
                        }
3861
                        break;
3862
                    case ControlType.DimLine:
3863
                        {
3864 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3865 787a4489 KangIngu
                            {
3866 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3867
                                //{
3868 787a4489 KangIngu
                                    if (currentControl is LineControl)
3869
                                    {
3870 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
3871
                                        if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3872 e66f22eb KangIngu
                                        {
3873
                                            return;
3874
                                        }
3875 787a4489 KangIngu
                                        CreateControl();
3876
3877
                                        (currentControl as LineControl).ApplyOverViewData();
3878
                                        currentControl = null;
3879 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3880 787a4489 KangIngu
                                    }
3881
                                    else
3882
                                    {
3883
                                        currentControl = new LineControl
3884
                                        {
3885
                                            Background = new SolidColorBrush(Colors.Black)
3886
                                        };
3887
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3888 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
3889 787a4489 KangIngu
                                        currentControl.IsNew = true;
3890
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3891 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Visible;
3892 787a4489 KangIngu
                                    }
3893 e66f22eb KangIngu
                                //}
3894 787a4489 KangIngu
                            }
3895
                        }
3896
                        break;
3897
                    case ControlType.ChainLine:
3898
                        {
3899
                            if (currentControl is PolygonControl)
3900
                            {
3901
                                var control = currentControl as PolygonControl;
3902
3903 e6a9ddaf humkyung
                                if (e.RightButton == MouseButtonState.Pressed)
3904 787a4489 KangIngu
                                {
3905 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
3906
                                    if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3907 e66f22eb KangIngu
                                    {
3908
                                        return;
3909
                                    }
3910
3911 787a4489 KangIngu
                                    CreateControl();
3912
3913
                                    (currentControl as PolygonControl).ApplyOverViewData();
3914
                                    currentControl = null;
3915 2eac4f76 KangIngu
                                    this.MainAngle.Visibility = Visibility.Collapsed;
3916 787a4489 KangIngu
                                    return;
3917
                                }
3918
3919
                                if (!control.IsCompleted)
3920
                                {
3921
                                    control.PointSet.Add(control.EndPoint);
3922 2eac4f76 KangIngu
                                    this.MainAngle.Visibility = Visibility.Visible;
3923 787a4489 KangIngu
                                }
3924
                            }
3925
                            else
3926
                            {
3927 e6a9ddaf humkyung
                                if (e.LeftButton == MouseButtonState.Pressed)
3928 787a4489 KangIngu
                                {
3929 2eac4f76 KangIngu
                                    MainAngle.Visibility = Visibility.Visible;
3930 787a4489 KangIngu
                                    currentControl = new PolygonControl
3931
                                    {
3932
                                        PointSet = new List<Point>(),
3933
                                        //강인구 추가(ChainLine일때는 채우기 스타일을 주지 않기 위해 설정)
3934
                                        ControlType = ControlType.ChainLine,
3935
                                        DashSize = ViewerDataModel.Instance.DashSize,
3936
                                        LineSize = ViewerDataModel.Instance.LineSize,
3937
                                        //PointC = new StylusPointSet()
3938
                                    };
3939
3940 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3941
                                    //{
3942 787a4489 KangIngu
                                        var polygonControl = (currentControl as PolygonControl);
3943 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
3944 787a4489 KangIngu
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3945
                                        currentControl.IsNew = true;
3946
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3947
                                        //currentControl.OnApplyTemplate();
3948
                                        //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint);
3949
                                        //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint);
3950
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3951
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
3952 e66f22eb KangIngu
                                    //}
3953 787a4489 KangIngu
                                }
3954
                            }
3955
                        }
3956
                        break;
3957
                    case ControlType.ArcLine:
3958
                        {
3959 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
3960 787a4489 KangIngu
                            {
3961 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3962
                                //{
3963 787a4489 KangIngu
                                    if (currentControl is ArcControl)
3964
                                    {
3965 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
3966
                                        if (IsGetoutpoint((currentControl as ArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
3967 e66f22eb KangIngu
                                        {
3968
                                            return;
3969
                                        }
3970
3971 787a4489 KangIngu
                                        CreateControl();
3972
3973
                                        (currentControl as ArcControl).ApplyOverViewData();
3974
                                        currentControl = null;
3975 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Collapsed;
3976 787a4489 KangIngu
                                    }
3977
                                    else
3978
                                    {
3979
                                        currentControl = new ArcControl
3980
                                        {
3981
                                            Background = new SolidColorBrush(Colors.Black)
3982
                                        };
3983 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
3984 787a4489 KangIngu
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
3985
                                        currentControl.IsNew = true;
3986
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
3987 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Visible;
3988 787a4489 KangIngu
                                    }
3989 e66f22eb KangIngu
                                //}
3990 787a4489 KangIngu
                            }
3991 e6a9ddaf humkyung
                            else if (e.RightButton == MouseButtonState.Pressed)
3992 787a4489 KangIngu
                            {
3993
                                if (currentControl != null)
3994
                                {
3995
                                    (currentControl as ArcControl).setClock();
3996 05f4d127 KangIngu
                                    (currentControl as ArcControl).MidPoint = new Point(0, 0);
3997
                                    //(currentControl as ArcControl).ApplyTemplate();
3998 787a4489 KangIngu
                                }
3999
                            }
4000
                        }
4001
                        break;
4002
                    case ControlType.ArcArrow:
4003
                        {
4004 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4005 787a4489 KangIngu
                            {
4006 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4007
                                //{
4008 40b3ce25 ljiyeon
                                if (currentControl is ArrowArcControl)
4009
                                {
4010
                                    //20180906 LJY TEST IsRotationDrawingEnable
4011
                                    if (IsGetoutpoint((currentControl as ArrowArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4012 787a4489 KangIngu
                                    {
4013 40b3ce25 ljiyeon
                                        return;
4014
                                    }
4015 e66f22eb KangIngu
4016 40b3ce25 ljiyeon
                                    CreateControl();
4017 787a4489 KangIngu
4018 40b3ce25 ljiyeon
                                    (currentControl as ArrowArcControl).ApplyOverViewData();
4019
                                    currentControl = null;
4020
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4021
                                }
4022
                                else
4023
                                {
4024
                                    currentControl = new ArrowArcControl
4025 787a4489 KangIngu
                                    {
4026 40b3ce25 ljiyeon
                                        Background = new SolidColorBrush(Colors.Black)
4027
                                    };
4028 24678e06 humkyung
                                    currentControl.CommentID = Commons.shortGuid();
4029 40b3ce25 ljiyeon
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4030
                                    currentControl.IsNew = true;
4031
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4032
                                    this.MainAngle.Visibility = Visibility.Visible;
4033
                                }
4034 e66f22eb KangIngu
                                //}
4035 787a4489 KangIngu
                            }
4036 e6a9ddaf humkyung
                            else if (e.RightButton == MouseButtonState.Pressed)
4037 787a4489 KangIngu
                            {
4038 40b3ce25 ljiyeon
                                if (currentControl != null)
4039
                                {
4040
                                    (currentControl as ArrowArcControl).setClock();
4041
                                    (currentControl as ArrowArcControl).MidPoint = new Point(0, 0);
4042
                                    //(currentControl as ArcControl).ApplyTemplate();
4043
                                }
4044 787a4489 KangIngu
                            }
4045
                        }
4046
                        break;
4047
                    case ControlType.ArrowMultiLine:
4048
                        {
4049 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4050 787a4489 KangIngu
                            {
4051 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4052
                                //{
4053 787a4489 KangIngu
4054
                                    if (currentControl is ArrowControl_Multi)
4055
                                    {
4056
                                        var content = currentControl as ArrowControl_Multi;
4057
                                        if (content.MiddlePoint == new Point(0, 0))
4058
                                        {
4059 2eac4f76 KangIngu
                                            if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift)
4060
                                            {
4061
                                                content.MiddlePoint = content.EndPoint;
4062
                                            }
4063
                                            else
4064
                                            {
4065
                                                content.MiddlePoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y);
4066
                                            }
4067 787a4489 KangIngu
                                        }
4068
                                        else
4069
                                        {
4070 ca40e004 ljiyeon
                                            //20180906 LJY TEST IsRotationDrawingEnable
4071
                                            if (IsGetoutpoint((currentControl as ArrowControl_Multi).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4072 e66f22eb KangIngu
                                            {
4073
                                                return;
4074
                                            }
4075
4076 787a4489 KangIngu
                                            CreateControl();
4077
4078
                                            (currentControl as ArrowControl_Multi).ApplyOverViewData();
4079
                                            currentControl = null;
4080 5ce56a3a KangIngu
                                            this.MainAngle.Visibility = Visibility.Collapsed;
4081 787a4489 KangIngu
                                        }
4082
                                    }
4083
                                    else
4084
                                    {
4085
                                        currentControl = new ArrowControl_Multi
4086
                                        {
4087
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
4088
                                            Background = new SolidColorBrush(Colors.Black)
4089
                                        };
4090 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
4091 787a4489 KangIngu
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4092
                                        currentControl.IsNew = true;
4093
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4094 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Visible;
4095 787a4489 KangIngu
                                    }
4096 e66f22eb KangIngu
                                //}
4097 787a4489 KangIngu
                            }
4098
                        }
4099
                        break;
4100
                    case ControlType.PolygonCloud:
4101
                        {
4102
                            if (currentControl is CloudControl)
4103
                            {
4104
                                var control = currentControl as CloudControl;
4105 e6a9ddaf humkyung
                                if (e.RightButton == MouseButtonState.Pressed)
4106 787a4489 KangIngu
                                {
4107
                                    control.IsCompleted = true;
4108
                                }
4109
4110
                                if (!control.IsCompleted)
4111
                                {
4112
                                    control.PointSet.Add(control.EndPoint);
4113
                                }
4114
                                else
4115
                                {
4116 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
4117
                                    if (IsGetoutpoint((currentControl as CloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4118 e66f22eb KangIngu
                                    {
4119
                                        return;
4120
                                    }
4121
4122 787a4489 KangIngu
                                    CreateControl();
4123
4124
                                    control.isTransOn = true;
4125
                                    var firstPoint = control.PointSet.First();
4126
4127
                                    control.PointSet.Add(firstPoint);
4128
                                    control.DrawingCloud();
4129
                                    control.ApplyOverViewData();
4130
4131
                                    currentControl = null;
4132
                                }
4133
                            }
4134
                            else
4135
                            {
4136 e6a9ddaf humkyung
                                if (e.LeftButton == MouseButtonState.Pressed)
4137 787a4489 KangIngu
                                {
4138
                                    currentControl = new CloudControl
4139
                                    {
4140
                                        PointSet = new List<Point>(),
4141
                                        PointC = new StylusPointSet()
4142
                                    };
4143
4144 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4145
                                    //{
4146 787a4489 KangIngu
                                        var polygonControl = (currentControl as CloudControl);
4147 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
4148 787a4489 KangIngu
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4149
                                        currentControl.IsNew = true;
4150
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4151
4152
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
4153
                                        polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
4154 b9ce7aee ljiyeon
                                    
4155 e66f22eb KangIngu
                                    //}
4156 787a4489 KangIngu
                                }
4157
                            }
4158
                        }
4159
                        break;
4160
                    case ControlType.ImgControl:
4161
                        {
4162 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4163 787a4489 KangIngu
                            {
4164 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4165
                                //{
4166 787a4489 KangIngu
                                    if (currentControl is ImgControl)
4167
                                    {
4168 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
4169
                                        if (IsGetoutpoint((currentControl as ImgControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4170 e66f22eb KangIngu
                                        {
4171
                                            return;
4172
                                        }
4173
4174 787a4489 KangIngu
                                        CreateControl();
4175
                                        (currentControl as ImgControl).ApplyOverViewData();
4176 53880c83 ljiyeon
                                        controlType = ControlType.ImgControl;
4177 787a4489 KangIngu
                                        currentControl = null;
4178
                                    }
4179
                                    else
4180
                                    {
4181 c73426a9 ljiyeon
                                        
4182 787a4489 KangIngu
                                        string extension = System.IO.Path.GetExtension(filename).ToUpper();
4183 53880c83 ljiyeon
                                        if (extension == ".PNG" || extension == ".JPEG" || extension == ".GIF" || extension == ".BMP" || extension == ".JPG" || extension == ".SVG")
4184 787a4489 KangIngu
                                        {
4185
                                            Image img = new Image();
4186 53880c83 ljiyeon
                                            //img.Source = new BitmapImage(new Uri(filename));
4187
                                            if (filename.Contains(".svg"))
4188
                                            {
4189
                                                byte[] imageData = null;
4190
                                                DrawingImage image = null;
4191
                                                using (System.Net.WebClient web = new System.Net.WebClient())
4192
                                                {
4193
                                                    imageData = web.DownloadData(new Uri(filename));
4194
                                                    System.IO.Stream stream = new System.IO.MemoryStream(imageData);
4195
                                                    image = SvgReader.Load(stream);
4196
                                                }
4197
                                                img.Source = image;
4198
                                            }
4199
                                            else
4200
                                            {
4201
                                                img.Source = new BitmapImage(new Uri(filename));
4202
                                            }
4203 787a4489 KangIngu
4204
                                            currentControl = new ImgControl
4205
                                            {
4206 53880c83 ljiyeon
                                                    Background = new SolidColorBrush(Colors.Black),
4207
                                                    PointSet = new List<Point>(),
4208
                                                    FilePath = filename,
4209
                                                    ImageData = img.Source,
4210
                                                    StartPoint = canvasDrawingMouseDownPoint,
4211
                                                    EndPoint = new Point(canvasDrawingMouseDownPoint.X + 100, canvasDrawingMouseDownPoint.Y + 100),
4212
                                                    TopRightPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y + 100),
4213
                                                    LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X + 100, canvasDrawingMouseDownPoint.Y),
4214
                                                    ControlType = ControlType.ImgControl
4215
                                                };
4216
4217
                                        
4218 24678e06 humkyung
                                                currentControl.CommentID = Commons.shortGuid();                                            
4219 53880c83 ljiyeon
                                                currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4220
                                                currentControl.IsNew = true;
4221
                                                ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4222
4223
                                                //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
4224
                                                (currentControl as ImgControl).Angle -= rotate.Angle;
4225
                                        }
4226 787a4489 KangIngu
                                    }
4227 e66f22eb KangIngu
                                //}
4228 787a4489 KangIngu
                            }
4229
                        }
4230
                        break;
4231
                    case ControlType.Date:
4232
                        {
4233 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4234 787a4489 KangIngu
                            {
4235 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4236
                                //{
4237 787a4489 KangIngu
                                    if (currentControl is DateControl)
4238
                                    {
4239 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
4240
                                        if (IsGetoutpoint((currentControl as DateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4241 e66f22eb KangIngu
                                        {
4242
                                            return;
4243
                                        }
4244
4245 787a4489 KangIngu
                                        CreateControl();
4246
                                        (currentControl as DateControl).ApplyOverViewData();
4247
                                        currentControl = null;
4248
4249
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
4250
                                        {
4251
                                            controlType = ControlType.None;
4252
                                            IsSwingMode = false;
4253
                                            Common.ViewerDataModel.Instance.SelectedControl = "";
4254
                                            Common.ViewerDataModel.Instance.ControlTag = null;
4255
                                            mouseHandlingMode = MouseHandlingMode.None;
4256
                                            this.ParentOfType<MainWindow>().dzTopMenu.btn_Batch.IsChecked = false;
4257
                                            txtBatch.Visibility = Visibility.Collapsed;
4258
4259
                                        }
4260
                                    }
4261
                                    else
4262
                                    {
4263
                                        currentControl = new DateControl
4264
                                        {
4265
                                            Background = new SolidColorBrush(Colors.Black)
4266
                                        };
4267 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
4268 787a4489 KangIngu
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4269
                                        currentControl.IsNew = true;
4270
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4271 ca40e004 ljiyeon
4272
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
4273
                                        (currentControl as DateControl).Angle -= rotate.Angle;
4274
                                }
4275 e66f22eb KangIngu
                                //}
4276 787a4489 KangIngu
                            }
4277
                        }
4278
                        break;
4279
                    case ControlType.TextControl:
4280
                        {
4281 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4282 787a4489 KangIngu
                            {
4283
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4284
                                {
4285
                                    currentControl = new TextControl
4286
                                    {
4287
                                        ControlType = controlType
4288
                                    };
4289 610a4b86 KangIngu
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
4290 24678e06 humkyung
                                    currentControl.CommentID = Commons.shortGuid();
4291 8742caa5 humkyung
                                    currentControl.IsNew = true;
4292
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4293
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4294 1066bae3 ljiyeon
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
4295
4296 8742caa5 humkyung
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
4297
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);
4298 6b5d33c6 djkim
                                    
4299 8742caa5 humkyung
                                    (currentControl as TextControl).ControlType_No = 0;
4300
                                    (currentControl as TextControl).Angle -= rotate.Angle;
4301
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
4302 6b5d33c6 djkim
                                    (currentControl as TextControl).ApplyTemplate();
4303
                                    (currentControl as TextControl).Base_TextBox.Focus();
4304 787a4489 KangIngu
4305 1066bae3 ljiyeon
                                    //System.Diagnostics.Debug.WriteLine("CanvasX" + (currentControl as TextControl).CanvasX);
4306
                                    //System.Diagnostics.Debug.WriteLine("CanvasY" + (currentControl as TextControl).CanvasY);
4307
4308 8742caa5 humkyung
                                    CreateControl();
4309 787a4489 KangIngu
4310
                                }
4311
                            }
4312
                        }
4313
                        break;
4314
                    case ControlType.TextBorder:
4315
                        {
4316 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4317 787a4489 KangIngu
                            {
4318
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4319
                                {
4320
                                    currentControl = new TextControl
4321
                                    {
4322
                                        ControlType = controlType
4323
                                    };
4324
4325 610a4b86 KangIngu
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
4326 787a4489 KangIngu
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4327 24678e06 humkyung
                                    currentControl.CommentID = Commons.shortGuid();
4328 787a4489 KangIngu
                                    currentControl.IsNew = true;
4329
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4330
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
4331
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
4332
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);
4333 6b5d33c6 djkim
                                    
4334 787a4489 KangIngu
                                    (currentControl as TextControl).ControlType_No = 1;
4335
                                    (currentControl as TextControl).Angle = Ang;
4336
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
4337 6b5d33c6 djkim
                                    (currentControl as TextControl).ApplyTemplate();
4338
                                    (currentControl as TextControl).Base_TextBox.Focus();
4339 787a4489 KangIngu
                                    CreateControl();
4340
4341 49b217ad humkyung
                                    //currentControl = null;
4342 787a4489 KangIngu
                                }
4343
                            }
4344
                        }
4345
                        break;
4346
                    case ControlType.TextCloud:
4347
                        {
4348 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4349 787a4489 KangIngu
                            {
4350
                                if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4351
                                {
4352
                                    currentControl = new TextControl
4353
                                    {
4354
                                        ControlType = controlType
4355
                                    };
4356 610a4b86 KangIngu
4357
                                    (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize;
4358 24678e06 humkyung
                                    currentControl.CommentID = Commons.shortGuid();
4359 787a4489 KangIngu
                                    currentControl.IsNew = true;
4360
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4361
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4362
4363
                                    currentControl.SetValue(Canvas.ZIndexProperty, 3);
4364
                                    currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X);
4365 6b5d33c6 djkim
                                    currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y);                                    
4366 787a4489 KangIngu
4367
                                    (currentControl as TextControl).Angle = Ang;
4368
                                    (currentControl as TextControl).ControlType_No = 2;
4369
                                    (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
4370 6b5d33c6 djkim
                                    (currentControl as TextControl).ApplyTemplate();
4371
                                    (currentControl as TextControl).Base_TextBox.Focus();
4372 787a4489 KangIngu
                                    CreateControl();
4373 49b217ad humkyung
                                    //currentControl = null;
4374 787a4489 KangIngu
                                }
4375
                            }
4376
                        }
4377
                        break;
4378
                    case ControlType.ArrowTextControl:
4379 ca40e004 ljiyeon
                         {
4380 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4381 787a4489 KangIngu
                            {
4382
                                if (currentControl is ArrowTextControl)
4383
                                {
4384 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
4385
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4386 e66f22eb KangIngu
                                    {
4387
                                        return;
4388 ca40e004 ljiyeon
                                    }                                    
4389 e66f22eb KangIngu
4390 787a4489 KangIngu
                                    CreateControl();
4391
4392
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4393
                                    (currentControl as ArrowTextControl).IsEditing = false;
4394
                                    (currentControl as ArrowTextControl).EnableEditing = false;
4395 49b217ad humkyung
                                    (currentControl as ArrowTextControl).IsNew = false;
4396 787a4489 KangIngu
                                    currentControl = null;
4397
                                }
4398
                                else
4399
                                {
4400 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4401
                                    //{
4402 787a4489 KangIngu
                                        currentControl = new ArrowTextControl();
4403 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
4404 787a4489 KangIngu
                                        currentControl.IsNew = true;
4405
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4406
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4407
4408
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4409
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4410
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);
4411 610a4b86 KangIngu
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4412 787a4489 KangIngu
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4413
4414 ca40e004 ljiyeon
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
4415
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
4416 787a4489 KangIngu
4417 ca40e004 ljiyeon
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4418 787a4489 KangIngu
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4419 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Visible;
4420 ca40e004 ljiyeon
4421
                                    
4422 e66f22eb KangIngu
                                    //}
4423 787a4489 KangIngu
                                }
4424
                            }
4425
                        }
4426
                        break;
4427
                    case ControlType.ArrowTransTextControl:
4428
                        {
4429 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4430 787a4489 KangIngu
                            {
4431
                                if (currentControl is ArrowTextControl)
4432
                                {
4433 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
4434
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4435 e66f22eb KangIngu
                                    {
4436
                                        return;
4437 ca40e004 ljiyeon
                                    }                                    
4438 e66f22eb KangIngu
4439 787a4489 KangIngu
                                    CreateControl();
4440
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4441 49b217ad humkyung
                                    currentControl.IsNew = false;
4442 787a4489 KangIngu
                                    currentControl = null;
4443 5ce56a3a KangIngu
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4444 787a4489 KangIngu
                                }
4445
                                else
4446
                                {
4447 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4448
                                    //{
4449 ca40e004 ljiyeon
                                         currentControl = new ArrowTextControl();
4450 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
4451 787a4489 KangIngu
                                        currentControl.IsNew = true;
4452
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4453
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4454
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4455
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4456 ca40e004 ljiyeon
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                  
4457 610a4b86 KangIngu
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4458 787a4489 KangIngu
                                        (currentControl as ArrowTextControl).isFixed = true;
4459
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4460
4461 ca40e004 ljiyeon
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
4462
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
4463
4464
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4465 787a4489 KangIngu
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4466 ca40e004 ljiyeon
                                        (currentControl as ArrowTextControl).isTrans = true;
4467 787a4489 KangIngu
                                }
4468
                            }
4469
                        }
4470
                        break;
4471
                    case ControlType.ArrowTextBorderControl:
4472 ca40e004 ljiyeon
                         {
4473 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4474 787a4489 KangIngu
                            {
4475
                                if (currentControl is ArrowTextControl)
4476
                                {
4477 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
4478
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4479 e66f22eb KangIngu
                                    {
4480
                                        return;
4481
                                    }
4482
4483 787a4489 KangIngu
                                    CreateControl();
4484
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4485 49b217ad humkyung
                                    currentControl.IsNew = false;
4486 787a4489 KangIngu
                                    currentControl = null;
4487 5ce56a3a KangIngu
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4488 787a4489 KangIngu
                                }
4489
                                else
4490
                                {
4491 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4492
                                    //{
4493 787a4489 KangIngu
                                        currentControl = new ArrowTextControl()
4494
                                        {
4495
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect
4496
                                        };
4497 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
4498 787a4489 KangIngu
                                        currentControl.IsNew = true;
4499
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4500
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4501
4502
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4503
4504
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4505
4506
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);
4507
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4508 610a4b86 KangIngu
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4509 787a4489 KangIngu
4510 ca40e004 ljiyeon
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
4511
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
4512
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4513 787a4489 KangIngu
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4514 ca40e004 ljiyeon
                                        this.MainAngle.Visibility = Visibility.Visible;                                    
4515 e66f22eb KangIngu
                                    //}
4516 787a4489 KangIngu
                                }
4517
                            }
4518
                        }
4519
                        break;
4520
                    case ControlType.ArrowTransTextBorderControl:
4521
                        {
4522 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4523 787a4489 KangIngu
                            {
4524
                                if (currentControl is ArrowTextControl)
4525
                                {
4526 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
4527
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4528 e66f22eb KangIngu
                                    {
4529
                                        return;
4530
                                    }
4531 787a4489 KangIngu
                                    CreateControl();
4532
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4533 49b217ad humkyung
                                    currentControl.IsNew = false;
4534 787a4489 KangIngu
                                    currentControl = null;
4535 5ce56a3a KangIngu
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4536 787a4489 KangIngu
                                }
4537
                                else
4538
                                {
4539 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4540
                                    //{
4541 ca40e004 ljiyeon
                                    
4542
4543
                                    currentControl = new ArrowTextControl()
4544 787a4489 KangIngu
                                        {
4545
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect
4546
                                        };
4547 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
4548 787a4489 KangIngu
                                        currentControl.IsNew = true;
4549
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4550
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4551
4552
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4553
4554
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4555 ca40e004 ljiyeon
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                                    
4556 610a4b86 KangIngu
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4557 787a4489 KangIngu
                                        (currentControl as ArrowTextControl).isFixed = true;
4558
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4559 ca40e004 ljiyeon
                                     
4560
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
4561
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
4562 787a4489 KangIngu
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4563
4564 ca40e004 ljiyeon
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();                                 
4565 5ce56a3a KangIngu
                                        this.MainAngle.Visibility = Visibility.Visible;
4566 ca40e004 ljiyeon
                                    
4567
                                    //20180911 LJY
4568
                                        (currentControl as ArrowTextControl).isTrans = true;
4569
                                    
4570
4571 e66f22eb KangIngu
                                    //}
4572 787a4489 KangIngu
                                }
4573
                            }
4574
                        }
4575
                        break;
4576
                    case ControlType.ArrowTextCloudControl:
4577
                        {
4578 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4579 787a4489 KangIngu
                            {
4580
                                if (currentControl is ArrowTextControl)
4581
                                {
4582 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
4583
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4584 e66f22eb KangIngu
                                    {
4585
                                        return;
4586
                                    }
4587 787a4489 KangIngu
                                    CreateControl();
4588
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4589 49b217ad humkyung
                                    currentControl.IsNew = false;
4590 787a4489 KangIngu
                                    currentControl = null;
4591 5ce56a3a KangIngu
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4592 787a4489 KangIngu
                                }
4593
                                else
4594
                                {
4595 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4596
                                    //{
4597 787a4489 KangIngu
                                        currentControl = new ArrowTextControl()
4598
                                        {
4599
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud
4600
                                        };
4601 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
4602 787a4489 KangIngu
                                        currentControl.IsNew = true;
4603
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4604
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4605
4606
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4607
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4608 ca40e004 ljiyeon
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                                 
4609 610a4b86 KangIngu
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4610 787a4489 KangIngu
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4611
4612 ca40e004 ljiyeon
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
4613
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
4614
                                    
4615
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4616 787a4489 KangIngu
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4617 ca40e004 ljiyeon
                                        this.MainAngle.Visibility = Visibility.Visible;                                        
4618 e66f22eb KangIngu
                                    //}
4619 787a4489 KangIngu
                                }
4620
                            }
4621
                        }
4622
                        break;
4623
                    case ControlType.ArrowTransTextCloudControl:
4624
                        {
4625 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4626 787a4489 KangIngu
                            {
4627
                                if (currentControl is ArrowTextControl)
4628
                                {
4629 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
4630
                                    if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4631 e66f22eb KangIngu
                                    {
4632
                                        return;
4633
                                    }
4634 787a4489 KangIngu
                                    CreateControl();
4635
                                    (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
4636 49b217ad humkyung
                                    currentControl.IsNew = false;
4637 787a4489 KangIngu
                                    currentControl = null;
4638 5ce56a3a KangIngu
                                    this.MainAngle.Visibility = Visibility.Collapsed;
4639 787a4489 KangIngu
                                }
4640
                                else
4641
                                {
4642 e66f22eb KangIngu
                                    //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4643
                                    //{
4644 787a4489 KangIngu
                                        currentControl = new ArrowTextControl()
4645
                                        {
4646
                                            ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud
4647
                                        };
4648 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
4649 ca40e004 ljiyeon
                                        currentControl.IsNew = true; 
4650 787a4489 KangIngu
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4651
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4652
                                        currentControl.SetValue(Canvas.ZIndexProperty, 3);
4653
4654
                                        currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint);
4655 ca40e004 ljiyeon
                                        currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint);                                        
4656 610a4b86 KangIngu
                                        (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize;
4657 787a4489 KangIngu
                                        (currentControl as ArrowTextControl).isFixed = true;
4658
                                        (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
4659
4660 ca40e004 ljiyeon
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
4661
                                        (currentControl as ArrowTextControl).Angle -= rotate.Angle;
4662 787a4489 KangIngu
4663 ca40e004 ljiyeon
                                        (currentControl as ArrowTextControl).ApplyTemplate();
4664 787a4489 KangIngu
                                        (currentControl as ArrowTextControl).Base_TextBox.Focus();
4665 ca40e004 ljiyeon
                                        this.MainAngle.Visibility = Visibility.Visible;  
4666
                                    
4667
                                    //20180911 LJY
4668
                                        (currentControl as ArrowTextControl).isTrans = true;
4669 e66f22eb KangIngu
                                    //}
4670 787a4489 KangIngu
                                }
4671
                            }
4672
                        }
4673
                        break;
4674
                    case ControlType.PolygonControl:
4675
                        {
4676
                            if (currentControl is PolygonControl)
4677
                            {
4678
                                var control = currentControl as PolygonControl;
4679
4680 e6a9ddaf humkyung
                                if (e.RightButton == MouseButtonState.Pressed)
4681 787a4489 KangIngu
                                {
4682
                                    control.IsCompleted = true;
4683
                                }
4684
4685
                                if (!control.IsCompleted)
4686
                                {
4687
                                    control.PointSet.Add(control.EndPoint);
4688
                                }
4689
                                else
4690
                                {
4691 ca40e004 ljiyeon
                                    //20180906 LJY TEST IsRotationDrawingEnable
4692
                                    if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4693 e66f22eb KangIngu
                                    {
4694
                                        return;
4695
                                    }
4696
4697 787a4489 KangIngu
                                    var firstPoint = control.PointSet.First();
4698
                                    control.DashSize = ViewerDataModel.Instance.DashSize;
4699
                                    control.LineSize = ViewerDataModel.Instance.LineSize;
4700
                                    control.PointSet.Add(firstPoint);
4701
4702
                                    control.ApplyOverViewData();
4703
4704
                                    CreateControl();
4705 b9ce7aee ljiyeon
                                    control.updateControl();
4706 787a4489 KangIngu
                                    currentControl = null;
4707
                                }
4708
                            }
4709
                            else
4710
                            {
4711 e6a9ddaf humkyung
                                if (e.LeftButton == MouseButtonState.Pressed)
4712 787a4489 KangIngu
                                {
4713
                                    currentControl = new PolygonControl
4714
                                    {
4715
                                        PointSet = new List<Point>(),
4716
                                    };
4717
4718 16a422d1 humkyung
                                    var polygonControl = (currentControl as PolygonControl);
4719
                                    currentControl.CommentID = Commons.shortGuid();
4720
                                    currentControl.IsNew = true;
4721
                                    currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4722 4804a4fb humkyung
                                    polygonControl.StartPoint = canvasDrawingMouseDownPoint;
4723
                                    polygonControl.EndPoint = canvasDrawingMouseDownPoint;
4724 16a422d1 humkyung
                                    polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
4725
                                    polygonControl.PointSet.Add(canvasDrawingMouseDownPoint);
4726 4804a4fb humkyung
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4727 16a422d1 humkyung
                                    polygonControl.ApplyTemplate();
4728
                                    polygonControl.Visibility = Visibility.Visible;
4729 787a4489 KangIngu
                                }
4730
                            }
4731
                        }
4732
                        break;
4733
                    //강인구 추가
4734
                    case ControlType.Sign:
4735
                        {
4736 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4737 787a4489 KangIngu
                            {
4738 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4739
                                //{
4740 661b7416 humkyung
                                    var _sign = GetUserSign.GetSign(App.ViewInfo.UserID, App.ViewInfo.ProjectNO);
4741 992a98b4 KangIngu
4742
                                    if (_sign == null)
4743
                                    {
4744
                                        txtBatch.Visibility = Visibility.Collapsed;
4745
                                        mouseHandlingMode = IKCOM.MouseHandlingMode.None;
4746
                                        controlType = ControlType.None;
4747
4748
                                        this.ParentOfType<MainWindow>().DialogMessage_Alert("등록된 Sign이 없습니다.", "Alert");
4749
                                        this.ParentOfType<MainWindow>().ChildrenOfType<RadToggleButton>().Where(data => data.IsChecked == true).FirstOrDefault().IsChecked = false;
4750
                                        return;
4751
                                    }
4752
4753 787a4489 KangIngu
                                    if (currentControl is SignControl)
4754
                                    {
4755 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
4756
                                        if (IsGetoutpoint((currentControl as SignControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4757 e66f22eb KangIngu
                                        {
4758
                                            return;
4759
                                        }
4760
4761 787a4489 KangIngu
                                        CreateControl();
4762
                                        currentControl = null;
4763
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
4764
                                        {
4765 999c9e40 humkyung
                                            txtBatch.Text = "Place Date";
4766 787a4489 KangIngu
                                            controlType = ControlType.Date;
4767
                                        }
4768
                                    }
4769
                                    else
4770
                                    {
4771
                                        currentControl = new SignControl
4772
                                        {
4773
                                            Background = new SolidColorBrush(Colors.Black),
4774
                                            UserNumber = App.ViewInfo.UserID,
4775
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
4776
                                            EndPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
4777
                                            ControlType = ControlType.Sign
4778
                                        };
4779
4780 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
4781 787a4489 KangIngu
                                        currentControl.IsNew = true;
4782
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4783
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4784 ca40e004 ljiyeon
4785
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 
4786
                                        (currentControl as SignControl).Angle -= rotate.Angle;                                    
4787
                                }
4788 e66f22eb KangIngu
                                //}
4789 787a4489 KangIngu
                            }
4790
                        }
4791
                        break;
4792
                    case ControlType.Mark:
4793
                        {
4794 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4795 787a4489 KangIngu
                            {
4796 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4797
                                //{
4798 787a4489 KangIngu
                                    if (currentControl is RectangleControl)
4799
                                    {
4800 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
4801
                                        if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4802 e66f22eb KangIngu
                                        {
4803
                                            return;
4804
                                        }
4805
4806 787a4489 KangIngu
                                        CreateControl();
4807
                                        (currentControl as RectangleControl).ApplyOverViewData();
4808
                                        currentControl = null;
4809 510cbd2a ljiyeon
                                    
4810
                                        this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
4811 787a4489 KangIngu
4812
                                        if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
4813
                                        {
4814 999c9e40 humkyung
                                            txtBatch.Text = "Place Signature";
4815 787a4489 KangIngu
                                            controlType = ControlType.Sign;
4816
                                        }
4817
                                    }
4818
                                    else
4819
                                    {
4820
                                        currentControl = new RectangleControl
4821
                                        {
4822
                                            Background = new SolidColorBrush(Colors.Black),
4823
                                            Paint = PaintSet.Fill
4824
                                        };
4825
4826
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4827 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
4828 787a4489 KangIngu
                                        currentControl.IsNew = true;
4829
                                        (currentControl as RectangleControl).DashSize = ViewerDataModel.Instance.DashSize;
4830
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4831
                                    }
4832 e66f22eb KangIngu
                                //}
4833 787a4489 KangIngu
                            }
4834
                        }
4835
                        break;
4836
                    case ControlType.Symbol:
4837
                        {
4838 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4839 787a4489 KangIngu
                            {
4840 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4841
                                //{
4842 787a4489 KangIngu
                                    if (currentControl is SymControl)
4843
                                    {
4844 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
4845
                                        if (IsGetoutpoint((currentControl as SymControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4846 e66f22eb KangIngu
                                        {
4847
                                            return;
4848
                                        }
4849 787a4489 KangIngu
                                        CreateControl();
4850
                                        currentControl = null;
4851 510cbd2a ljiyeon
                                    
4852
                                        this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
4853 787a4489 KangIngu
                                    }
4854
                                    else
4855
                                    {
4856
                                        currentControl = new SymControl
4857
                                        {
4858
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
4859
                                            Background = new SolidColorBrush(Colors.Black),
4860
                                            ControlType = ControlType.Symbol
4861
                                        };
4862
4863
                                        currentControl.IsNew = true;
4864
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4865 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
4866 787a4489 KangIngu
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4867 ca40e004 ljiyeon
4868
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
4869
                                        (currentControl as SymControl).Angle -= rotate.Angle;
4870
                                }
4871 e66f22eb KangIngu
                                //}
4872 787a4489 KangIngu
                            }
4873
                        }
4874
                        break;
4875
                    case ControlType.Stamp:
4876
                        {
4877 e6a9ddaf humkyung
                            if (e.LeftButton == MouseButtonState.Pressed)
4878 787a4489 KangIngu
                            {
4879 e66f22eb KangIngu
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
4880
                                //{
4881 787a4489 KangIngu
                                    if (currentControl is SymControlN)
4882
                                    {
4883 ca40e004 ljiyeon
                                        //20180906 LJY TEST IsRotationDrawingEnable
4884
                                        if (IsGetoutpoint((currentControl as SymControlN).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault()))
4885 e66f22eb KangIngu
                                        {
4886
                                            return;
4887
                                        }
4888
4889 787a4489 KangIngu
                                        CreateControl();
4890
                                        currentControl = null;
4891 510cbd2a ljiyeon
                                   
4892
4893
                                    this.cursor = new Cursor(MainWindow.CursorChange().StreamSource);
4894 787a4489 KangIngu
                                    }
4895
                                    else
4896
                                    {
4897
                                        currentControl = new SymControlN
4898
                                        {
4899
                                            StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y),
4900
                                            Background = new SolidColorBrush(Colors.Black),
4901
                                            ControlType = ControlType.Stamp
4902
                                        };
4903
4904
                                        currentControl.IsNew = true;
4905
                                        currentControl.MarkupInfoID = App.Custom_ViewInfoId;
4906 24678e06 humkyung
                                        currentControl.CommentID = Commons.shortGuid();
4907 787a4489 KangIngu
                                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl);
4908 ca40e004 ljiyeon
                                        //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정  
4909
                                        (currentControl as SymControlN).Angle -= rotate.Angle;
4910
                                }                                    
4911 e66f22eb KangIngu
                                //}
4912 787a4489 KangIngu
                            }
4913
                        }
4914
                        break;
4915
                    case ControlType.PenControl:
4916
                        {
4917
                            if (inkBoard.Tag.ToString() == "Ink")
4918
                            {
4919
                                inkBoard.IsEnabled = true;
4920
                                StartNewStroke(canvasDrawingMouseDownPoint);
4921
                            }
4922
                            else if (inkBoard.Tag.ToString() == "EraseByPoint")
4923
                            {
4924
                                RemovePointStroke(canvasDrawingMouseDownPoint);
4925
                            }
4926
                            else if (inkBoard.Tag.ToString() == "EraseByStroke")
4927
                            {
4928
                                RemoveLineStroke(canvasDrawingMouseDownPoint);
4929
                            }
4930
                            IsDrawing = true;
4931
                            return;
4932
                        }
4933
                    default:
4934
                        if (currentControl != null)
4935
                        {
4936
                            currentControl.CommentID = null;
4937
                            currentControl.IsNew = false;
4938
                        }
4939
                        break;
4940
                }
4941
            }
4942 e6a9ddaf humkyung
            if (mouseHandlingMode != MouseHandlingMode.None && e.LeftButton == MouseButtonState.Pressed)
4943 787a4489 KangIngu
            {
4944
                if (mouseHandlingMode == MouseHandlingMode.Adorner && SelectLayer.Children.Count > 0)
4945
                {
4946
                    bool mouseOff = false;
4947
                    foreach (var item in SelectLayer.Children)
4948
                    {
4949
                        if (item is AdornerFinal)
4950
                        {
4951
4952 4913851c humkyung
                            var over = (item as AdornerFinal).Members.Where(data => data.DrawingData.IsMouseOver).FirstOrDefault();
4953 787a4489 KangIngu
                            if (over != null)
4954
                            {
4955
                                mouseOff = true;
4956
                            }
4957
                        }
4958
                    }
4959
4960
                    if (!mouseOff)
4961
                    {
4962 077896be humkyung
                        SelectionSet.Instance.UnSelect(this);
4963 787a4489 KangIngu
                    }
4964
                }
4965
                zoomAndPanControl.CaptureMouse();
4966
                e.Handled = true;
4967
            }
4968
        }
4969 e54660e8 KangIngu
4970 a1716fa5 KangIngu
        private void zoomAndPanControl2_MouseDown(object sender, MouseButtonEventArgs e)
4971
        {
4972 e6a9ddaf humkyung
            ///mouseButtonDown = e.ChangedButton;
4973 a1716fa5 KangIngu
            canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas2);
4974
        }
4975
4976 787a4489 KangIngu
        private void RemoveLineStroke(Point P)
4977
        {
4978 05009a0e ljiyeon
            var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault();
4979 787a4489 KangIngu
            if (control != null)
4980
            {
4981
                UndoData = new Undo_data()
4982
                {
4983
                    IsUndo = false,
4984
                    Event = Event_Type.Delete,
4985
                    EventTime = DateTime.Now,
4986
                    Markup_List = new List<Multi_Undo_data>()
4987
                };
4988
4989
4990
                multi_Undo_Data.Markup = control as MarkupToPDF.Common.CommentUserInfo;
4991
                UndoData.Markup_List.Add(multi_Undo_Data);
4992
                multi_Undo_Data = new Multi_Undo_data();
4993
4994
                ViewerDataModel.Instance.MarkupControls_USER.Remove(control);
4995 d62c0439 humkyung
                var Item_ = ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (control as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault();
4996
                ViewerDataModel.Instance.MyMarkupList.Remove(Item_);
4997 6707a5c7 ljiyeon
                
4998
                //임시파일에서도 삭제한다.
4999 a20d338f ljiyeon
                TempFile.DelTemp((control as MarkupToPDF.Common.CommentUserInfo).CommentID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString());
5000 6707a5c7 ljiyeon
                
5001 787a4489 KangIngu
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
5002
                {
5003
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
5004
                });
5005
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
5006 e54660e8 KangIngu
5007 787a4489 KangIngu
            }
5008
        }
5009
5010
        private void RemovePointStroke(Point P)
5011
        {
5012
            foreach (Stroke hits in inkBoard.Strokes)
5013
            {
5014
                foreach (StylusPoint sty in hits.StylusPoints)
5015
                {
5016
5017
                }
5018
                if (hits.HitTest(P))
5019
                {
5020
                    inkBoard.Strokes.Remove(hits);
5021
                    return;
5022
                }
5023
            }
5024
        }
5025
5026
        private void StartNewStroke(Point P)
5027
        {
5028
            strokePoints = new StylusPointCollection();
5029
            StylusPoint segment1Start = new StylusPoint(P.X, P.Y);
5030
            strokePoints.Add(segment1Start);
5031
            stroke = new Stroke(strokePoints);
5032
5033
            stroke.DrawingAttributes.Color = Colors.Red;
5034
            stroke.DrawingAttributes.Width = 4;
5035
            stroke.DrawingAttributes.Height = 4;
5036
5037
            inkBoard.Strokes.Add(stroke);
5038
5039
        }
5040
5041
        private void btnConsolidate_Click(object sender, RoutedEventArgs e)
5042
        {
5043
            ConsolidationMethod();
5044
        }
5045
5046 102476f6 humkyung
        /// <summary>
5047
        /// execute TeamConsolidationCommand
5048
        /// </summary>
5049 04a7385a djkim
        public void TeamConsolidationMethod()
5050
        {
5051 102476f6 humkyung
            this.UpdateMyMarkupList();
5052 04a7385a djkim
            if (this.gridViewMarkup.SelectedItems.Count == 0)
5053
            {
5054
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
5055
            }
5056
            else
5057
            {
5058 8129f2a5 ljiyeon
5059
                ViewerDataModel.Instance.IsConsolidate = true;
5060
                this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
5061
5062 04a7385a djkim
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
5063
                {
5064
                    if (!this.userData.DEPARTMENT.Equals(item.Depatment))
5065
                    {
5066
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at your department", "Alert");
5067
                        return;
5068
                    }                    
5069
                }
5070 102476f6 humkyung
                List<MarkupInfoItem> MarkupInfoList = new List<MarkupInfoItem>();
5071 04a7385a djkim
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
5072 90e7968d ljiyeon
                {
5073 102476f6 humkyung
                    MarkupInfoList.Add(item);
5074 04a7385a djkim
                }
5075 102476f6 humkyung
                TeamConsolidateCommand.Instance.Execute(MarkupInfoList);
5076 04a7385a djkim
            }
5077
        }
5078 102476f6 humkyung
5079 787a4489 KangIngu
        public void ConsolidationMethod()
5080
        {
5081
            if (this.gridViewMarkup.SelectedItems.Count == 0)
5082
            {
5083
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
5084
            }
5085
            else
5086 90e7968d ljiyeon
            {
5087 35a96e24 humkyung
                List<IKCOM.MarkupInfoItem> MySelectItem = new List<IKCOM.MarkupInfoItem>();
5088
                foreach (var item in this.gridViewMarkup.SelectedItems)
5089
                {
5090
                    MySelectItem.Add(item as IKCOM.MarkupInfoItem);
5091
                }
5092
                int iPageNo = Convert.ToInt32(this.ParentOfType<MainWindow>().dzTopMenu.tlcurrentPage.Text);
5093 8129f2a5 ljiyeon
                
5094 35a96e24 humkyung
                ConsolidateCommand.Instance.Execute(MySelectItem, iPageNo);
5095 787a4489 KangIngu
            }
5096
        }
5097
5098
        private void btnConsolidate_Loaded(object sender, RoutedEventArgs e)
5099
        {
5100
            if (App.ViewInfo != null)
5101
            {
5102
                btnConsolidate = (sender as RadRibbonButton);
5103
                if (!App.ViewInfo.NewCommentPermission)
5104
                {
5105
                    (sender as RadRibbonButton).Visibility = System.Windows.Visibility.Collapsed;
5106
                }
5107
            }
5108
        }
5109
5110
        private void btnTeamConsolidate_Click(object sender, RoutedEventArgs e)
5111
        {
5112 04a7385a djkim
            TeamConsolidationMethod();
5113 787a4489 KangIngu
        }
5114
5115
        private void btnTeamConsolidate_Loaded(object sender, RoutedEventArgs e)
5116
        {
5117
            btnTeamConsolidate = sender as RadRibbonButton;
5118
            if (App.ViewInfo != null)
5119
            {
5120
                if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면
5121
                {
5122
                    if (btnConsolidate != null)
5123
                    {
5124
                        btnConsolidate.Visibility = Visibility.Collapsed;
5125
                    }
5126
5127
                    if (!App.ViewInfo.NewCommentPermission)
5128
                    {
5129
                        btnTeamConsolidate.Visibility = Visibility.Collapsed;
5130
                    }
5131
                }
5132
                else
5133
                {
5134
                    btnTeamConsolidate.Visibility = Visibility.Collapsed;
5135
                }
5136
            }
5137
        }
5138
5139
        private void FinalPDFEvent(object sender, RoutedEventArgs e)
5140
        {
5141
            var item = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault();
5142
            if (item != null)
5143
            {
5144 90e7968d ljiyeon
                Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item.MarkupInfoID + "," + _ViewInfo.UserID, 1);
5145 0f065e57 ljiyeon
5146 787a4489 KangIngu
                BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item.MarkupInfoID, _ViewInfo.UserID);
5147
            }
5148
            else
5149
            {
5150
                DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내");
5151
            }
5152
        }
5153
5154
        private void btnFinalPDF_Loaded(object sender, RoutedEventArgs e)
5155
        {
5156
            btnFinalPDF = sender as RadRibbonButton;
5157
            if (App.ViewInfo != null)
5158
            {
5159
                if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면
5160
                {
5161
                    btnFinalPDF.Visibility = System.Windows.Visibility.Collapsed;
5162
                    if (btnConsolidate != null)
5163
                    {
5164
                        btnConsolidate.Visibility = Visibility.Collapsed;
5165
                    }
5166
                }
5167
            }
5168
        }
5169
5170 80458c15 ljiyeon
        private void ConsolidateFinalPDFEvent(object sender, RoutedEventArgs e)
5171
        {
5172 d62c0439 humkyung
            UpdateMyMarkupList();
5173 80458c15 ljiyeon
5174
            if (this.gridViewMarkup.SelectedItems.Count == 0)
5175
            {
5176
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert");
5177
            }
5178
            else
5179
            {
5180
                ViewerDataModel.Instance.IsConsolidate = true;
5181
                this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
5182
                List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>();
5183
5184
                string project_no = App.ViewInfo.ProjectNO;
5185
                string doc_id = _DocInfo.ID;
5186
                string user_id = App.ViewInfo.UserID;
5187
                List<MarkupInfoItem> markupInfoItems = new List<MarkupInfoItem>();
5188
                foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems)
5189
                {
5190
                    markupInfoItems.Add(item);
5191
                }
5192
                Logger.sendReqLog("Consolidate", project_no + "," + user_id + "," + doc_id + "," + markupInfoItems, 1);
5193
                Logger.sendResLog("Consolidate", this.BaseClient.Consolidate(project_no, user_id, doc_id, markupInfoItems).ToString(), 1);
5194
                Logger.sendReqLog("GetMarkupInfoItemsAsync", App.ViewInfo.ProjectNO + "," + _DocInfo.ID, 1);
5195 1126281e djkim
                var items = this.BaseClient.GetMarkupInfoItems(App.ViewInfo.ProjectNO, _DocInfo.ID);
5196 80458c15 ljiyeon
5197 1126281e djkim
                var item2 = items.Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault();
5198 80458c15 ljiyeon
                if (item2 != null)
5199
                {
5200
                    Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item2.MarkupInfoID + "," + _ViewInfo.UserID, 1);
5201
5202
                    BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item2.MarkupInfoID, _ViewInfo.UserID);
5203 1126281e djkim
                    BaseClient.GetMarkupInfoItemsAsync(App.ViewInfo.ProjectNO, _DocInfo.ID);
5204 80458c15 ljiyeon
                }
5205
                else
5206
                {
5207
                    DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내");
5208
                }
5209 90e7968d ljiyeon
            }
5210 80458c15 ljiyeon
        }
5211
5212
        private void btnConsolidateFinalPDF_Loaded(object sender, RoutedEventArgs e)
5213 90e7968d ljiyeon
        {
5214 80458c15 ljiyeon
            btnConsolidateFinalPDF = (sender as RadRibbonButton);
5215
5216
            if (App.ViewInfo != null)
5217
            {
5218
                if (!App.ViewInfo.NewCommentPermission || !App.ViewInfo.CreateFinalPDFPermission)
5219
                {
5220 90e7968d ljiyeon
                    btnConsolidateFinalPDF.Visibility = System.Windows.Visibility.Collapsed;
5221 80458c15 ljiyeon
                }
5222 90e7968d ljiyeon
            }
5223 80458c15 ljiyeon
        }
5224
5225 787a4489 KangIngu
        private void SyncCompare_Click(object sender, RoutedEventArgs e)
5226
        {
5227
            if (CompareMode.IsChecked)
5228
            {
5229
                if (ViewerDataModel.Instance.PageBalanceMode && ViewerDataModel.Instance.PageBalanceNumber == 0)
5230
                {
5231
                    ViewerDataModel.Instance.PageBalanceNumber = 1;
5232
                }
5233
                if (ViewerDataModel.Instance.PageNumber == 0)
5234
                {
5235
                    ViewerDataModel.Instance.PageNumber = 1;
5236
                }
5237
5238 90e7968d ljiyeon
                Logger.sendReqLog("GetCompareRectAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID + "," + CurrentRev.DOCUMENT_ID +
5239 0f065e57 ljiyeon
                    "," + pageNavigator.CurrentPage.PageNumber.ToString() + "," + ViewerDataModel.Instance.PageNumber.ToString() + "," +
5240 90e7968d ljiyeon
                    userData.COMPANY != "EXT" ? "true" : "false", 1);
5241 0f065e57 ljiyeon
5242 d9cf7d6e djkim
                BaseClient.GetCompareRectAsync(_ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber.ToString(), ViewerDataModel.Instance.PageNumber.ToString(), userData.COMPANY != "EXT" ? "true" : "false");
5243 787a4489 KangIngu
            }
5244
            else
5245
            {
5246
                da.From = 1;
5247
                da.To = 1;
5248
                da.Duration = new Duration(TimeSpan.FromSeconds(9999));
5249
                da.AutoReverse = false;
5250
                canvas_compareBorder.Children.Clear();
5251
                canvas_compareBorder.BeginAnimation(OpacityProperty, da);
5252
            }
5253
        }
5254
5255 9cd2865b KangIngu
        private void Sync_Click(object sender, RoutedEventArgs e)
5256
        {
5257 a1716fa5 KangIngu
            if (Sync.IsChecked)
5258 9cd2865b KangIngu
            {
5259
                ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX;
5260
                ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY;
5261
                ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
5262
            }
5263
        }
5264
5265 787a4489 KangIngu
        private void SyncUserListExpender_Click(object sender, RoutedEventArgs e)
5266
        {
5267
            if (UserList.IsChecked)
5268
            {
5269
                this.gridViewRevMarkup.Visibility = Visibility.Visible;
5270
            }
5271
            else
5272
            {
5273
                this.gridViewRevMarkup.Visibility = Visibility.Collapsed;
5274
            }
5275
        }
5276
5277
        private void SyncPageBalance_Click(object sender, RoutedEventArgs e)
5278
        {
5279
5280
            if (BalanceMode.IsChecked)
5281
            {
5282
                ViewerDataModel.Instance.PageBalanceMode = true;
5283
            }
5284
            else
5285
            {
5286
                ViewerDataModel.Instance.PageBalanceMode = false;
5287
                ViewerDataModel.Instance.PageBalanceNumber = 0;
5288
            }
5289
        }
5290
5291
        private void SyncExit_Click(object sender, RoutedEventArgs e)
5292
        {
5293
            //초기화
5294
            testPanel2.IsHidden = true;
5295
            ViewerDataModel.Instance.PageBalanceMode = false;
5296
            ViewerDataModel.Instance.PageBalanceNumber = 0;
5297
            ViewerDataModel.Instance.PageNumber = 0;
5298
            ViewerDataModel.Instance.MarkupControls_Sync.Clear();
5299
            this.gridViewRevMarkup.Visibility = Visibility.Collapsed;
5300
            UserList.IsChecked = false;
5301
            BalanceMode.IsChecked = false;
5302
        }
5303
5304
        private void SyncPageChange_Click(object sender, RoutedEventArgs e)
5305
        {
5306
            if ((sender as System.Windows.Controls.Control).Tag != null)
5307
            {
5308
                //Compare 초기화
5309
                CompareMode.IsChecked = false;
5310
                var balancePoint = Convert.ToInt32((sender as System.Windows.Controls.Control).Tag);
5311
5312
                if (ViewerDataModel.Instance.PageNumber == 0)
5313
                {
5314
                    ViewerDataModel.Instance.PageNumber = 1;
5315
                }
5316
5317
                if (ViewerDataModel.Instance.PageBalanceNumber == pageNavigator.PageCount)
5318
                {
5319
                }
5320
                else
5321
                {
5322
                    ViewerDataModel.Instance.PageBalanceNumber += balancePoint;
5323
                }
5324
5325
                if (ViewerDataModel.Instance.PageNumber == pageNavigator.PageCount && balancePoint > 0)
5326
                {
5327
5328
                }
5329
                else if ((ViewerDataModel.Instance.PageNumber + balancePoint) >= 1)
5330
                {
5331
                    ViewerDataModel.Instance.PageNumber += balancePoint;
5332
                }
5333
5334
                if (!testPanel2.IsHidden)
5335
                {
5336
                    if (IsSyncPDFMode)
5337
                    {
5338
                        Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
5339
                        var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber)));
5340
5341
                        if (pdfpath.IsDownloading)
5342
                        {
5343
                            pdfpath.DownloadCompleted += (ex, arg) =>
5344
                            {
5345
                                ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5346
                                ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5347
                                ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5348
                                zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5349
                                zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5350
                            };
5351
                        }
5352
                        else
5353
                        {
5354
                            ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5355
                            ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5356
                            ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5357
5358
                            zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5359
                            zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5360
                        }
5361
5362
                    }
5363
                    else
5364
                    {
5365 a874198d humkyung
                        string uri = "";
5366
5367
                        if (userData.COMPANY != "EXT")
5368
                        {
5369 90e7968d ljiyeon
                            uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber);
5370 a874198d humkyung
                        }
5371
                        else
5372
                        {
5373
                            uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber);
5374
                        }
5375 787a4489 KangIngu
5376
                        var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
5377
5378
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5379
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5380
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5381
5382
                        zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
5383
                        zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
5384
5385
                        if (defaultBitmapImage_Compare.IsDownloading)
5386
                        {
5387
                            defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
5388
                            {
5389
                                ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5390
                                ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5391
                                ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5392
5393
                                zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth;
5394
                                zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight;
5395
                            };
5396
                        }
5397
                    }
5398
5399
                    //강인구 추가(페이지 이동시 코멘트 재 호출)
5400
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
5401
                    List<MarkupInfoItem> gridSelectionRevItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList();
5402
5403
                    foreach (var item in gridSelectionRevItem)
5404
                    {
5405
                        item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageNumber).ToList().ForEach(delegate (MarkupItem markupitem)
5406
                        {
5407 661b7416 humkyung
                            MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID);
5408 787a4489 KangIngu
                        });
5409
                    }
5410 e54660e8 KangIngu
5411 787a4489 KangIngu
                    //강인구 추가
5412
                    zoomAndPanControl2.ZoomTo(new Rect
5413
                    {
5414
                        X = 0,
5415
                        Y = 0,
5416
                        Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width),
5417
                        Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height),
5418
                    });
5419 ae56d52d KangIngu
5420 787a4489 KangIngu
                    tlSyncPageNum.Text = String.Format("Current Page : {0}", ViewerDataModel.Instance.PageNumber);
5421
5422
                }
5423
            }
5424
        }
5425
5426
        private void SyncChange_Click(object sender, RoutedEventArgs e)
5427
        {
5428
            if (MarkupMode.IsChecked)
5429
            {
5430
                IsSyncPDFMode = true;
5431
5432
                var uri = CurrentRev.TO_VENDOR;
5433 ae56d52d KangIngu
5434 787a4489 KangIngu
                if (ViewerDataModel.Instance.PageNumber == 0)
5435
                {
5436
                    ViewerDataModel.Instance.PageNumber = 1;
5437
                }
5438
5439
                //PDF모드 잠시 대기(강인구)
5440
                Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage();
5441
                var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber)));
5442
5443
                if (pdfpath.IsDownloading)
5444
                {
5445
                    pdfpath.DownloadCompleted += (ex, arg) =>
5446
                    {
5447
                        ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5448
                        ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5449
                        ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5450
                        zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5451
                        zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5452
                    };
5453
                }
5454
                else
5455
                {
5456
                    ViewerDataModel.Instance.ImageViewPath_C = pdfpath;
5457
                    ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth;
5458
                    ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight;
5459
5460
                    zoomAndPanCanvas2.Width = pdfpath.PixelWidth;
5461
                    zoomAndPanCanvas2.Height = pdfpath.PixelHeight;
5462
                }
5463
            }
5464
            else
5465
            {
5466
                IsSyncPDFMode = false;
5467 a874198d humkyung
                string uri = "";
5468
                if (userData.COMPANY != "EXT")
5469
                {
5470 90e7968d ljiyeon
                    uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5471 a874198d humkyung
                }
5472
                else
5473
                {
5474
                    uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5475
                }
5476 787a4489 KangIngu
5477
                var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
5478
5479
                ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5480
                ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5481
                ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5482
5483
                if (defaultBitmapImage_Compare.IsDownloading)
5484
                {
5485
                    defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
5486
                    {
5487
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5488
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5489
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5490
                    };
5491
                }
5492
                zoomAndPanControl2.ApplyTemplate();
5493
                zoomAndPanControl2.UpdateLayout();
5494
                zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
5495
                zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
5496
            }
5497
        }
5498
5499
        private void RadButton_Click(object sender, RoutedEventArgs e)
5500
        {
5501
            gridViewHistory_Busy.IsBusy = true;
5502
5503
            RadButton instance = sender as RadButton;
5504
            if (instance.CommandParameter != null)
5505
            {
5506
                CurrentRev = instance.CommandParameter as VPRevision;
5507
                BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) =>
5508
                {
5509
                    if (ea.Error == null && ea.Result != null)
5510
                    {
5511
                        testPanel2.IsHidden = false;
5512
5513 d128ceb2 humkyung
                        ViewerDataModel.Instance._markupInfoRevList.Clear();
5514
                        foreach(var info in ea.Result)
5515
                        {
5516
                            if(info.UserID == App.ViewInfo.UserID)
5517
                            {
5518
                                info.userDelete = true;
5519
                                info.DisplayColor = "FFFF0000";
5520
                            }
5521
                            else
5522
                            {
5523
                                info.userDelete = false;
5524
                            }
5525
                            ViewerDataModel.Instance._markupInfoRevList.Add(info);
5526
                        }
5527 787a4489 KangIngu
                        gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList;
5528
5529 a874198d humkyung
                        string uri = "";
5530
                        if (userData.COMPANY != "EXT")
5531
                        {
5532 90e7968d ljiyeon
                            uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5533 a874198d humkyung
                        }
5534
                        else
5535
                        {
5536
                            uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5537
                        }
5538 787a4489 KangIngu
5539
                        Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY);
5540
5541
                        var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
5542
5543
                        ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5544
                        ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5545
                        ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5546
5547
                        if (defaultBitmapImage_Compare.IsDownloading)
5548
                        {
5549
                            defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
5550
                            {
5551
                                ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5552
                                ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5553
                                ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5554
                            };
5555
                        }
5556
5557
                        zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
5558
                        zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
5559
                        zoomAndPanControl2.RotationAngle = zoomAndPanControl.RotationAngle;
5560
                        zoomAndPanControl2.ApplyTemplate();
5561
                        zoomAndPanControl2.UpdateLayout();
5562
5563
                        if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY))
5564
                        {
5565
                            zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X;
5566
                            zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y;
5567
                        }
5568
5569 9cd2865b KangIngu
                        ViewerDataModel.Instance.Sync_ContentOffsetX = Sync_Offset_Point.X;
5570
                        ViewerDataModel.Instance.Sync_ContentOffsetY = Sync_Offset_Point.Y;
5571
                        ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale;
5572
5573 787a4489 KangIngu
                        tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo);
5574
                        tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber);
5575
                        gridViewHistory_Busy.IsBusy = false;
5576
                    }
5577 0f065e57 ljiyeon
5578
                    Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1);
5579 90e7968d ljiyeon
                };
5580 787a4489 KangIngu
                BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID);
5581 0f065e57 ljiyeon
                Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1);
5582 787a4489 KangIngu
            }
5583
        }
5584
5585
        public void Sync_Event(VPRevision Currnet_Rev)
5586
        {
5587
            CurrentRev = Currnet_Rev;
5588
5589
            BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) =>
5590
            {
5591
                if (ea.Error == null && ea.Result != null)
5592
                {
5593
                    testPanel2.IsHidden = false;
5594
5595 d128ceb2 humkyung
                    ViewerDataModel.Instance._markupInfoRevList.Clear();
5596
                    foreach(var info in ea.Result)
5597
                    {
5598
                        if(info.UserID == App.ViewInfo.UserID)
5599
                        {
5600
                            info.userDelete = true;
5601
                            info.DisplayColor = "FFFF0000";
5602
                        }
5603
                        else
5604
                        {
5605
                            info.userDelete = false;
5606
                        }
5607
                        ViewerDataModel.Instance._markupInfoRevList.Add(info);
5608
                    }
5609 787a4489 KangIngu
                    gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList;
5610
5611 a874198d humkyung
                    string uri = "";
5612 a1716fa5 KangIngu
                    if (userData.COMPANY != "EXT")
5613 a874198d humkyung
                    {
5614 90e7968d ljiyeon
                        uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5615 a874198d humkyung
                    }
5616
                    else
5617
                    {
5618
                        uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber);
5619
                    }
5620 787a4489 KangIngu
5621
                    Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY);
5622
5623
                    var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri));
5624
5625
                    ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5626
                    ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5627
                    ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5628
5629
                    if (defaultBitmapImage_Compare.IsDownloading)
5630
                    {
5631
                        defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) =>
5632
                        {
5633
                            ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare;
5634
                            ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth;
5635
                            ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight;
5636
                        };
5637
                    }
5638 90e7968d ljiyeon
5639
5640 787a4489 KangIngu
                    zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth);
5641
                    zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight);
5642
                    zoomAndPanControl2.ApplyTemplate();
5643
                    zoomAndPanControl2.UpdateLayout();
5644
5645
                    if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY))
5646
                    {
5647
                        zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X;
5648
                        zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y;
5649
                    }
5650
                    //}
5651
5652
                    tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo);
5653
                    tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber);
5654 90e7968d ljiyeon
                    gridViewHistory_Busy.IsBusy = false;
5655 787a4489 KangIngu
                }
5656 0f065e57 ljiyeon
                Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1);
5657 90e7968d ljiyeon
5658 787a4489 KangIngu
            };
5659 0f065e57 ljiyeon
            Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1);
5660 90e7968d ljiyeon
            BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID);
5661 787a4489 KangIngu
        }
5662
5663
        private void PdfLink_ButtonDown(object sender, MouseButtonEventArgs e)
5664
        {
5665
            if (sender is Image)
5666
            {
5667
                if ((sender as Image).Tag != null)
5668
                {
5669
                    var pdfUrl = (sender as Image).Tag.ToString();
5670
                    System.Diagnostics.Process.Start(pdfUrl);
5671
                }
5672
                else
5673
                {
5674
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("문서 정보가 잘못 되었습니다", "안내");
5675
                }
5676
            }
5677
        }
5678
5679
        private void Create_Symbol(object sender, RoutedEventArgs e)
5680
        {
5681 5529d2a2 humkyung
            MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn();
5682 787a4489 KangIngu
5683
            if (SelectLayer.Children.Count < 1) //선택된 것이 없으면
5684
            {
5685
                DialogMessage_Alert("Please Select Controls", "Alert");
5686
            }
5687
            else //선택된 것이 있으면
5688
            {
5689
                string MarkupData = "";
5690
                adorner_ = new AdornerFinal();
5691
5692
                foreach (var item in SelectLayer.Children)
5693
                {
5694
                    if (item.GetType().Name == "AdornerFinal")
5695
                    {
5696
                        adorner_ = (item as Controls.AdornerFinal);
5697 4913851c humkyung
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
5698 787a4489 KangIngu
                        {
5699
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
5700
                            {
5701 5529d2a2 humkyung
                                markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
5702 787a4489 KangIngu
                                MarkupData += markupReturn.ConvertData;
5703
                            }
5704
                        }
5705
                    }
5706
                }
5707
                DialogParameters parameters = new DialogParameters()
5708
                {
5709 b9b01f8e ljiyeon
                    Owner = Application.Current.MainWindow,
5710 787a4489 KangIngu
                    Closed = (obj, args) => this.MarkupNamePromptClose(MarkupData, args),
5711
                    DefaultPromptResultValue = "Custom State",
5712
                    Content = "Name :",
5713
                    Header = "Insert Custom Symbol Name",
5714
                    Theme = new VisualStudio2013Theme(),
5715
                    ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
5716
                };
5717
                RadWindow.Prompt(parameters);
5718
            }
5719
5720
        }
5721 53880c83 ljiyeon
        public int symbolselectindex = 0;
5722
        private void SymbolMarkupNamePromptClose(byte[] Img_byte, string data, WindowClosedEventArgs args)
5723
        {
5724
            //Save save = new Save();
5725
            try
5726
            {
5727
                string svgfilename = null;
5728
                if (symbolname != null)
5729
                {
5730
                    if (symbolpng == true || symbolsvg == true)
5731
                    {
5732
                        kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
5733 24678e06 humkyung
                        string guid = Commons.shortGuid();
5734 53880c83 ljiyeon
5735
                        fileUploader.RunAsync(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".png", Img_byte);
5736 c73426a9 ljiyeon
                        //Check_Uri.UriCheck();
5737 53880c83 ljiyeon
                        fileUploader.RunCompleted += (ex, arg) =>
5738
                        {
5739
                            filename = arg.Result;
5740
                            if (symbolpng == true)
5741
                            {
5742
                                if (filename != null)
5743
                                { 
5744
                                    if (symbolselectindex == 0)
5745
                                    {
5746
                                        SymbolSave(symbolname, filename, data);
5747
                                    }
5748
                                    else
5749
                                    {
5750
                                        SymbolSave_Public(symbolname, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
5751
                                    }
5752
                                    DataBind();
5753
                                }                                
5754
                            }
5755
5756
                            if (symbolsvg == true)
5757
                            {
5758 c73426a9 ljiyeon
                                try
5759 53880c83 ljiyeon
                                {
5760 c73426a9 ljiyeon
                                    var defaultBitmapImage = new BitmapImage();
5761
                                    defaultBitmapImage.BeginInit();
5762
                                    defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
5763
                                    defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
5764
                                    Check_Uri.UriCheck(filename);
5765
                                    defaultBitmapImage.UriSource = new Uri(filename);
5766
                                    defaultBitmapImage.EndInit();
5767 53880c83 ljiyeon
5768 c73426a9 ljiyeon
                                    System.Drawing.Bitmap image;
5769 53880c83 ljiyeon
5770 c73426a9 ljiyeon
                                    if (defaultBitmapImage.IsDownloading)
5771
                                    {
5772
                                        defaultBitmapImage.DownloadCompleted += (ex2, arg2) =>
5773 53880c83 ljiyeon
                                        {
5774 c73426a9 ljiyeon
                                            defaultBitmapImage.Freeze();
5775
                                            image = GetBitmap(defaultBitmapImage);
5776
                                            image.Save(@AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
5777
                                            Process potrace = new Process
5778 53880c83 ljiyeon
                                            {
5779 c73426a9 ljiyeon
                                                StartInfo = new ProcessStartInfo
5780
                                                {
5781
                                                    FileName = @AppDomain.CurrentDomain.BaseDirectory + "potrace.exe",
5782
                                                    Arguments = "-b svg " + @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp",
5783
                                                    RedirectStandardInput = true,
5784
                                                    RedirectStandardOutput = true,
5785
                                                    RedirectStandardError = true,
5786
                                                    UseShellExecute = false,
5787
                                                    CreateNoWindow = true,
5788
                                                    WindowStyle = ProcessWindowStyle.Hidden
5789
                                                },
5790
                                            };
5791 53880c83 ljiyeon
5792 c73426a9 ljiyeon
                                            StringBuilder svgBuilder = new StringBuilder();
5793
                                            potrace.OutputDataReceived += (object sender2, DataReceivedEventArgs e2) =>
5794 53880c83 ljiyeon
                                            {
5795 c73426a9 ljiyeon
                                                svgBuilder.AppendLine(e2.Data);
5796
                                            };
5797
5798
                                            potrace.EnableRaisingEvents = true;
5799
                                            potrace.Start();
5800
                                            potrace.Exited += (sender, e) =>
5801 53880c83 ljiyeon
                                            {
5802 c73426a9 ljiyeon
                                                byte[] bytes = System.IO.File.ReadAllBytes(@AppDomain.CurrentDomain.BaseDirectory + "potrace.svg");
5803
                                                svgfilename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".svg", bytes);
5804
                                                Check_Uri.UriCheck(svgfilename);
5805
                                                if (symbolselectindex == 0)
5806
                                                {
5807
                                                    SymbolSave(symbolname, svgfilename, data);
5808
                                                }
5809
                                                else
5810
                                                {
5811
                                                    SymbolSave_Public(symbolname, svgfilename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
5812
                                                }
5813 53880c83 ljiyeon
5814 c73426a9 ljiyeon
                                                DataBind();
5815
                                            };
5816
                                            potrace.WaitForExit();
5817 53880c83 ljiyeon
                                        };
5818 c73426a9 ljiyeon
                                    }
5819
                                    else
5820
                                    {
5821
                                        //GC.Collect();
5822
                                    }
5823 53880c83 ljiyeon
                                }
5824 c73426a9 ljiyeon
                                catch(Exception ee)
5825 90e7968d ljiyeon
                                {
5826 c73426a9 ljiyeon
                                    DialogMessage_Alert("" + ee, "Alert");
5827 90e7968d ljiyeon
                                }
5828 53880c83 ljiyeon
                            }
5829
                        };                                             
5830
                    }
5831
                }
5832
            }
5833
            catch (Exception e)
5834
            {
5835
                //DialogMessage_Alert(e + "", "Alert");
5836
            }            
5837
        }
5838
5839
        public void SymbolSave(string Name, string Url, string Data)
5840
        {
5841
            try
5842
            {
5843
                SYMBOL_PRIVATE symbol_private = new SYMBOL_PRIVATE
5844
                {
5845 24678e06 humkyung
                    ID = Commons.shortGuid(),
5846 53880c83 ljiyeon
                    MEMBER_USER_ID = App.ViewInfo.UserID,
5847
                    NAME = Name,
5848
                    IMAGE_URL = Url,
5849
                    DATA = Data
5850
                };
5851
5852
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolCompleted += BaseClient_SaveSymbolCompleted;
5853
                Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1);
5854
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private);
5855
            }
5856
            catch (Exception)
5857
            {
5858
                throw;
5859
            }
5860
        }
5861
5862
        public void SymbolSave_Public(string Name, string Url, string Data, string Department)
5863
        {
5864
            try
5865
            {
5866
                SYMBOL_PUBLIC symbol_public = new SYMBOL_PUBLIC
5867
                {
5868 24678e06 humkyung
                    ID = Commons.shortGuid(),
5869 53880c83 ljiyeon
                    DEPARTMENT = Department,
5870
                    NAME = Name,
5871
                    IMAGE_URL = Url,
5872
                    DATA = Data
5873
                };
5874
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbolCompleted += BaseClient_AddPublicSymbolCompleted;
5875
                Logger.sendReqLog("AddPublicSymbol: ", symbol_public.ID + "," + symbol_public.DEPARTMENT + "," + symbol_public.NAME + "," + symbol_public.IMAGE_URL + "," + symbol_public.DATA, 1);
5876
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbol(symbol_public);
5877
            }
5878
            catch (Exception)
5879
            {
5880
                throw;
5881
            }
5882
        }
5883
5884
        private void BaseClient_AddPublicSymbolCompleted(object sender, ServiceDeepView.AddPublicSymbolCompletedEventArgs e)
5885
        {           
5886
            Logger.sendResLog("AddPublicSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
5887
            DataBind();
5888
        }
5889
5890
        private void BaseClient_SaveSymbolCompleted(object sender, ServiceDeepView.SaveSymbolCompletedEventArgs e)
5891
        {
5892
            Logger.sendResLog("RenameSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
5893
            DataBind();
5894
        }
5895
        private void DataBind()
5896
        {
5897
            try
5898
            {
5899
                Symbol_Custom Custom = new Symbol_Custom();
5900
                List<Symbol_Custom> Custom_List = new List<Symbol_Custom>();
5901 5928384e djkim
                
5902 bb3a236d ljiyeon
                var symbol_Private = BaseClient.GetSymbolList(App.ViewInfo.UserID);
5903 53880c83 ljiyeon
                foreach (var item in symbol_Private)
5904
                {
5905
                    Custom.Name = item.NAME;
5906
                    Custom.ImageUri = item.IMAGE_URL;
5907
                    Custom.ID = item.ID;
5908
                    Custom_List.Add(Custom);
5909
                    Custom = new Symbol_Custom();
5910
                }
5911
                symbolPanel_Instance.lstSymbolPrivate.ItemsSource = Custom_List;
5912
                
5913
                Custom = new Symbol_Custom();
5914
                Custom_List = new List<Symbol_Custom>();
5915
5916 bb3a236d ljiyeon
                symbolPanel_Instance.deptlist.ItemsSource = BaseClient.GetPublicSymbolDeptList();
5917 53880c83 ljiyeon
5918
                List<SYMBOL_PUBLIC> symbol_Public;
5919 787a4489 KangIngu
5920 53880c83 ljiyeon
                if (symbolPanel_Instance.deptlist.SelectedValue != null)
5921
                {
5922 bb3a236d ljiyeon
                    symbol_Public = BaseClient.GetPublicSymbolList(symbolPanel_Instance.deptlist.SelectedValue.ToString());
5923 53880c83 ljiyeon
                }
5924
                else
5925
                {
5926 bb3a236d ljiyeon
                    symbol_Public = BaseClient.GetPublicSymbolList(null);
5927 53880c83 ljiyeon
                }
5928
                foreach (var item in symbol_Public)
5929
                {
5930
                    Custom.Name = item.NAME;
5931
                    Custom.ImageUri = item.IMAGE_URL;
5932
                    Custom.ID = item.ID;
5933
                    Custom_List.Add(Custom);
5934
                    Custom = new Symbol_Custom();
5935
                }
5936
                symbolPanel_Instance.lstSymbolPublic.ItemsSource = Custom_List;
5937 bb3a236d ljiyeon
                BaseClient.Close();                
5938 53880c83 ljiyeon
            }
5939
            catch(Exception e)
5940
            {
5941
                //DialogMessage_Alert("DataBind", "Alert");
5942
            }
5943
            
5944
        }
5945 787a4489 KangIngu
        private void MarkupNamePromptClose(string data, WindowClosedEventArgs args)
5946
        {
5947 c73426a9 ljiyeon
            try
5948 787a4489 KangIngu
            {
5949 c73426a9 ljiyeon
                if (args.PromptResult != null)
5950 53880c83 ljiyeon
                {
5951 c73426a9 ljiyeon
                    if (args.DialogResult.Value)
5952
                    {
5953
                        PngBitmapEncoder _Encoder = symImage(data);
5954 787a4489 KangIngu
5955 c73426a9 ljiyeon
                        System.IO.MemoryStream fs = new System.IO.MemoryStream();
5956
                        _Encoder.Save(fs);
5957
                        System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs);
5958 787a4489 KangIngu
5959 c73426a9 ljiyeon
                        byte[] Img_byte = fs.ToArray();
5960 787a4489 KangIngu
5961 c73426a9 ljiyeon
                        kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
5962 24678e06 humkyung
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Commons.shortGuid() + ".png", Img_byte);
5963 c73426a9 ljiyeon
                        Check_Uri.UriCheck(filename);
5964
                        if (symbolPanel_Instance.RadTab.SelectedIndex == 0)
5965
                        {
5966 de6499db humkyung
                            SaveCommand.Instance.SymbolSave(args.PromptResult, filename, data);
5967 c73426a9 ljiyeon
                        }
5968
                        else
5969
                        {
5970 de6499db humkyung
                            SaveCommand.Instance.SymbolSave_Public(args.PromptResult, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
5971 c73426a9 ljiyeon
                        }
5972
                        DataBind();
5973 53880c83 ljiyeon
                    }
5974
                }
5975 787a4489 KangIngu
            }
5976 c73426a9 ljiyeon
            catch(Exception ex)
5977
            {
5978
                DialogMessage_Alert("" + ex, "Alert");
5979
            }
5980 787a4489 KangIngu
        }
5981
5982
        public PngBitmapEncoder symImage(string data)
5983
        {
5984
5985
            Canvas _canvas = new Canvas();
5986
            _canvas.Background = Brushes.White;
5987
            _canvas.Width = adorner_.BorderSize.Width;
5988
            _canvas.Height = adorner_.BorderSize.Height;
5989 5529d2a2 humkyung
            MarkupParser.Parse(App.ViewInfo.ProjectNO, data, _canvas, "#FFFF0000", "");
5990 787a4489 KangIngu
5991
            BitmapEncoder encoder = new PngBitmapEncoder();
5992
5993
5994
            RenderTargetBitmap renderBitmap = new RenderTargetBitmap((int)_canvas.Width + 50, (int)_canvas.Height + 50, 96d, 96d, PixelFormats.Pbgra32);
5995
5996
            DrawingVisual dv = new DrawingVisual();
5997
5998
            _canvas.Measure(new System.Windows.Size(adorner_.BorderSize.Width + 50, adorner_.BorderSize.Height + 50));
5999
            _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)));
6000
6001
            using (DrawingContext ctx = dv.RenderOpen())
6002
            {
6003
                VisualBrush vb = new VisualBrush(_canvas);
6004
                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)));
6005
            }
6006
6007
            try
6008
            {
6009
                renderBitmap.Render(dv);
6010
6011 90e7968d ljiyeon
                //GC.Collect();
6012 787a4489 KangIngu
                GC.WaitForPendingFinalizers();
6013 90e7968d ljiyeon
                //GC.Collect();
6014 787a4489 KangIngu
                // encode png data
6015
                PngBitmapEncoder pngEncoder = new PngBitmapEncoder();
6016
                // puch rendered bitmap into it
6017
                pngEncoder.Interlace = PngInterlaceOption.Off;
6018
                pngEncoder.Frames.Add(BitmapFrame.Create(renderBitmap));
6019
                return pngEncoder;
6020
6021
            }
6022 53880c83 ljiyeon
            catch //(Exception ex)
6023 787a4489 KangIngu
            {
6024
                return null;
6025
            }
6026
6027
        }
6028
6029
        public void DialogMessage_Alert(string content, string header)
6030
        {
6031
            var box = new TextBlock();
6032
            box.MinWidth = 400;
6033
            box.FontSize = 11;
6034
            //box.FontSize = 12;
6035
            box.Text = content;
6036
            box.TextWrapping = System.Windows.TextWrapping.Wrap;
6037
6038
            DialogParameters parameters = new DialogParameters()
6039
            {
6040 b9b01f8e ljiyeon
                Owner = Application.Current.MainWindow,
6041 787a4489 KangIngu
                Content = box,
6042
                Header = header,
6043
                Theme = new VisualStudio2013Theme(),
6044
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
6045 90e7968d ljiyeon
            };            
6046 787a4489 KangIngu
            RadWindow.Alert(parameters);
6047
        }
6048
6049
        #region 캡쳐 기능
6050
6051
        public BitmapSource CutAreaToImage(int x, int y, int width, int height)
6052
        {
6053
            if (x < 0)
6054
            {
6055
                width += x;
6056
                x = 0;
6057
            }
6058
            if (y < 0)
6059
            {
6060
                height += y;
6061
                y = 0;
6062
6063
                width = (int)zoomAndPanCanvas.ActualWidth - x;
6064
            }
6065
            if (x + width > zoomAndPanCanvas.ActualWidth)
6066
            {
6067
                width = (int)zoomAndPanCanvas.ActualWidth - x;
6068
            }
6069
            if (y + height > zoomAndPanCanvas.ActualHeight)
6070
            {
6071
                height = (int)zoomAndPanCanvas.ActualHeight - y;
6072
            }
6073
6074
            byte[] pixels = CopyPixels(x, y, width, height);
6075
6076
            int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8;
6077
6078
            return BitmapSource.Create(width, height, 96, 96, PixelFormats.Pbgra32, null, pixels, stride);
6079
        }
6080
6081
        public byte[] CopyPixels(int x, int y, int width, int height)
6082
        {
6083
            byte[] pixels = new byte[width * height * 4];
6084
            int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8;
6085
6086
            // Canvas 이미지에서 객체 역역만큼 픽셀로 복사
6087
            canvasImage.CopyPixels(new Int32Rect(x, y, width, height), pixels, stride, 0);
6088
6089
            return pixels;
6090
        }
6091
6092
        public RenderTargetBitmap ConverterBitmapImage(FrameworkElement element)
6093
        {
6094
            DrawingVisual drawingVisual = new DrawingVisual();
6095
            DrawingContext drawingContext = drawingVisual.RenderOpen();
6096
6097
            // 해당 객체의 그래픽요소로 사각형의 그림을 그립니다.
6098
            drawingContext.DrawRectangle(new VisualBrush(element), null,
6099
                new Rect(new Point(0, 0), new Point(element.ActualWidth, element.ActualHeight)));
6100
            drawingContext.Close();
6101
6102
            // 비트맵으로 변환합니다.
6103
            RenderTargetBitmap target =
6104
                new RenderTargetBitmap((int)element.ActualWidth, (int)element.ActualHeight,
6105
                96, 96, System.Windows.Media.PixelFormats.Pbgra32);
6106
6107
            target.Render(drawingVisual);
6108
            return target;
6109
        }
6110
6111 53880c83 ljiyeon
        System.Drawing.Bitmap GetBitmap(BitmapSource source)
6112
        {
6113
            System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(source.PixelWidth, source.PixelHeight, System.Drawing.Imaging.PixelFormat.Format32bppPArgb);
6114
            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);
6115
            source.CopyPixels(Int32Rect.Empty, data.Scan0, data.Height * data.Stride, data.Stride);
6116
            bmp.UnlockBits(data);
6117
            return bmp;
6118
        }
6119
        public string symbolname = null;
6120
        public bool symbolsvg = true;
6121
        public bool symbolpng = true;
6122
6123
        public void Save_Symbol_Capture(BitmapSource source, int x, int y, int width, int height)
6124
        {
6125
            System.Drawing.Bitmap image = GetBitmap(source);
6126
            //흰색 제거
6127
            //image.MakeTransparent(System.Drawing.Color.White);
6128
6129
            var imageStream = new System.IO.MemoryStream();
6130
            byte[] imageBytes = null;
6131
            using (imageStream)
6132
            {
6133
                image.Save(imageStream, System.Drawing.Imaging.ImageFormat.Png);
6134
                // test.Save(@"E:\test.png", System.Drawing.Imaging.ImageFormat.Png);
6135
                imageStream.Position = 0;
6136
                imageBytes = imageStream.ToArray();
6137
            }
6138
6139
            SymbolPrompt symbolPrompt = new SymbolPrompt();
6140
6141
            RadWindow CheckPop = new RadWindow();
6142
            //Alert check = new Alert(Msg);
6143
6144
            CheckPop = new RadWindow
6145
            {
6146
                MinWidth = 400,
6147
                MinHeight = 100,
6148
               // Closed = (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args),
6149
                Header = "Alert",
6150
                Content = symbolPrompt,
6151
                //DialogResult = 
6152
                ResizeMode = System.Windows.ResizeMode.NoResize,
6153
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
6154
                IsTopmost = true,
6155
            };
6156
            CheckPop.Closed += (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args);
6157
            StyleManager.SetTheme(CheckPop, new Office2013Theme());
6158
            CheckPop.ShowDialog();
6159
6160
            /*
6161
            DialogParameters parameters = new DialogParameters()
6162
            {
6163
                Owner = Application.Current.MainWindow,
6164
                Closed = (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args),
6165
                DefaultPromptResultValue = "Custom State",
6166
                Content = "Name :",
6167
                Header = "Insert Custom Symbol Name",
6168
                Theme = new VisualStudio2013Theme(),
6169
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
6170
            };            
6171
            RadWindow.Prompt(parameters);
6172
            */
6173
        }
6174
6175 787a4489 KangIngu
        public void Save_Capture(BitmapSource source, int x, int y, int width, int height)
6176
        {
6177
            KCOM.Common.Converter.FileStreamToBase64 streamToBase64 = new Common.Converter.FileStreamToBase64();
6178
            KCOMDataModel.DataModel.CHECK_LIST check_;
6179
            string Result = streamToBase64.ImageToBase64(source);
6180
            KCOMDataModel.DataModel.CHECK_LIST Item = new KCOMDataModel.DataModel.CHECK_LIST();
6181 6c781c0c djkim
            string projectno = App.ViewInfo.ProjectNO;
6182
            string checklist_id = ViewerDataModel.Instance.CheckList_ID;
6183 0f065e57 ljiyeon
6184
            Logger.sendReqLog("GetCheckList", projectno + "," + checklist_id, 1);
6185 6c781c0c djkim
            Item = this.BaseClient.GetCheckList(projectno, checklist_id);
6186 90e7968d ljiyeon
            if (Item != null)
6187 0f065e57 ljiyeon
            {
6188
                Logger.sendResLog("GetCheckList", "TRUE", 1);
6189
            }
6190
            else
6191
            {
6192
                Logger.sendResLog("GetCheckList", "FALSE", 1);
6193
            }
6194 90e7968d ljiyeon
6195 6c781c0c djkim
            if (Item == null)
6196 787a4489 KangIngu
            {
6197 6c781c0c djkim
                check_ = new KCOMDataModel.DataModel.CHECK_LIST
6198 787a4489 KangIngu
                {
6199 24678e06 humkyung
                    ID = Commons.shortGuid(),
6200 6c781c0c djkim
                    USER_ID = App.ViewInfo.UserID,
6201
                    IMAGE_URL = Result,
6202
                    IMAGE_ANCHOR = x + "," + y + "," + width + "," + height,
6203
                    PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber,
6204
                    REVISION = ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision,
6205
                    DOCUMENT_ID = App.ViewInfo.DocumentItemID,
6206
                    PROJECT_NO = App.ViewInfo.ProjectNO,
6207
                    STATUS = "False",
6208
                    CREATE_TIME = DateTime.Now,
6209
                    UPDATE_TIME = DateTime.Now,
6210
                    DOCUMENT_NO = _DocItem.DOCUMENT_NO,
6211
                    STATUS_DESC_OPEN = "Vendor 반영 필요",
6212
                };
6213 0f065e57 ljiyeon
                Logger.sendReqLog("AddCheckList", projectno + "," + check_, 1);
6214
                Logger.sendResLog("AddCheckList", this.BaseClient.AddCheckList(projectno, check_).ToString(), 1);
6215
                //this.BaseClient.AddCheckList(projectno, check_);
6216 787a4489 KangIngu
            }
6217 6c781c0c djkim
            else
6218
            {
6219
                Item.IMAGE_URL = Result;
6220
                Item.IMAGE_ANCHOR = x + "," + y + "," + width + "," + height;
6221 90e7968d ljiyeon
                Item.PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber;
6222 0f065e57 ljiyeon
                Logger.sendReqLog("SaveCheckList", projectno + "," + checklist_id + "," + Item, 1);
6223
                Logger.sendResLog("SaveCheckList", this.BaseClient.SaveCheckList(projectno, checklist_id, Item).ToString(), 1);
6224
                //this.BaseClient.SaveCheckList(projectno, checklist_id, Item);
6225 6c781c0c djkim
            }
6226 90e7968d ljiyeon
6227 787a4489 KangIngu
        }
6228
6229
        public void Set_Capture()
6230 90e7968d ljiyeon
        {
6231 787a4489 KangIngu
            double x = canvasDrawingMouseDownPoint.X;
6232
            double y = canvasDrawingMouseDownPoint.Y;
6233
            double width = dragCaptureBorder.Width;
6234
            double height = dragCaptureBorder.Height;
6235
6236
            if (width > 5 || height > 5)
6237
            {
6238
                canvasImage = ConverterBitmapImage(zoomAndPanCanvas);
6239
                BitmapSource source = CutAreaToImage((int)x, (int)y, (int)width, (int)height);
6240
                Save_Capture(source, (int)x, (int)y, (int)width, (int)height);
6241
            }
6242
        }
6243
        #endregion
6244
6245 d7548b21 ljiyeon
        //MarkupInfoItem
6246 787a4489 KangIngu
        public void CreateControl()
6247 90e7968d ljiyeon
        {
6248
6249 787a4489 KangIngu
            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
6250
            {
6251
                ViewerDataModel.Instance.UndoDataList.Remove(i);
6252
            });
6253
            multi_Undo_Data.Markup = currentControl;
6254
            UndoData.Markup_List.Add(multi_Undo_Data);
6255 90e7968d ljiyeon
6256 787a4489 KangIngu
            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
6257 d7548b21 ljiyeon
6258
            //List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList();
6259 787a4489 KangIngu
        }
6260 90e7968d ljiyeon
6261 787a4489 KangIngu
        public Multi_Undo_data Control_Style(CommentUserInfo control)
6262
        {
6263
            multi_Undo_Data = new Multi_Undo_data();
6264
6265
            multi_Undo_Data.Markup = control;
6266
6267
            if ((control as IShapeControl) != null)
6268
            {
6269
                multi_Undo_Data.paint = (control as IShapeControl).Paint;
6270
            }
6271
            if ((control as IDashControl) != null)
6272
            {
6273
                multi_Undo_Data.DashSize = (control as IDashControl).DashSize;
6274
            }
6275
            if ((control as IPath) != null)
6276
            {
6277
                multi_Undo_Data.LineSize = (control as IPath).LineSize;
6278
            }
6279
            if ((control as UIElement) != null)
6280
            {
6281
                multi_Undo_Data.Opacity = (control as UIElement).Opacity;
6282
            }
6283
6284
            return multi_Undo_Data;
6285
        }
6286
6287
        private void Comment_Move(object sender, MouseButtonEventArgs e)
6288
        {
6289
            string Select_ID = (((e.Source as Telerik.Windows.Controls.RadButton).DataContext) as IKCOM.MarkupInfoItem).UserID;
6290
            foreach (var items in ViewerDataModel.Instance._markupInfoRevList)
6291
            {
6292
                if (items.UserID == Select_ID)
6293
                {
6294
                    foreach (var item in items.MarkupList)
6295
                    {
6296
                        if (item.PageNumber == pageNavigator.CurrentPage.PageNumber)
6297
                        {
6298 661b7416 humkyung
                            MarkupParser.ParseEx(App.ViewInfo.ProjectNO, item.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, "#FFFF0000", "", 
6299 24678e06 humkyung
                                items.MarkupInfoID, Commons.shortGuid());
6300 787a4489 KangIngu
                        }
6301
                    }
6302
                }
6303
            }
6304
        }
6305 d62c0439 humkyung
6306 787a4489 KangIngu
        public void InkControl_Convert()
6307
        {
6308 548c696e ljiyeon
            Logger.sendCheckLog("pageNavigator_PageChanging_InkControl_Convert", 1);
6309 787a4489 KangIngu
            if (inkBoard.Strokes.Count > 0)
6310
            {
6311
                inkBoard.Strokes.ToList().ForEach(stroke =>
6312
                {
6313
                    List<Stroke> removingStroke = new List<Stroke>();
6314
                    StrokeCollection stC = new StrokeCollection();
6315
6316
                    removingStroke.Add(stroke);
6317
6318
                    InkToPath ip = new InkToPath();
6319
                    List<Point> inkPointSet = new List<Point>();
6320
                    PolygonControl pc = null;
6321
                    pc = new PolygonControl()
6322
                    {
6323
                        Angle = 0,
6324
                        PointSet = new List<Point>(),
6325
                        ControlType = ControlType.Ink
6326
                    };
6327
                    foreach (var item in removingStroke)
6328
                    {
6329
                        inkPointSet.AddRange(ip.StrokeGetPointsPlus(item));
6330
                        inkBoard.Strokes.Remove(item);
6331
                    }
6332
                    if (inkPointSet.Count != 0)
6333
                    {
6334
                        //강인구 추가(PenControl Undo Redo 추가)
6335
                        UndoData = new Undo_data()
6336
                        {
6337
                            IsUndo = false,
6338
                            Event = Event_Type.Create,
6339
                            EventTime = DateTime.Now,
6340
                            Markup_List = new List<Multi_Undo_data>()
6341
                        };
6342
6343
                        pc.StartPoint = inkPointSet[0];
6344
                        pc.EndPoint = inkPointSet[inkPointSet.Count - 1];
6345
                        pc.PointSet = inkPointSet;
6346
                        pc.LineSize = 3;
6347 24678e06 humkyung
                        pc.CommentID = Commons.shortGuid();
6348 787a4489 KangIngu
                        pc.StrokeColor = new SolidColorBrush(Colors.Red);
6349
                        ViewerDataModel.Instance.MarkupControls_USER.Add(pc);
6350 661b7416 humkyung
                        ///pc.SetPolyPath();
6351 787a4489 KangIngu
6352
                        ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
6353
                        {
6354
                            ViewerDataModel.Instance.UndoDataList.Remove(i);
6355
                        });
6356
                        multi_Undo_Data.Markup = pc as CommentUserInfo;
6357
                        UndoData.Markup_List.Add(multi_Undo_Data);
6358
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);
6359
                    }
6360
                });
6361
            }
6362
        }
6363 17a22987 KangIngu
6364 4318fdeb KangIngu
        /// <summary>
6365
        /// 정원, 정사각형, 정삼각형을 그리기 위한 EndPoint계산
6366
        /// </summary>
6367
        /// <param name="StartP">StartPoint</param>
6368
        /// <param name="EndP">EndPoint</param>
6369
        /// <returns>Return_EndPoint</returns>
6370
        private Point GetSquareEndPoint(Point StartP, Point EndP)
6371 17a22987 KangIngu
        {
6372 ae56d52d KangIngu
            Point Return_Point = new Point();
6373 17a22987 KangIngu
6374 4318fdeb KangIngu
            double dx = EndP.X - StartP.X;
6375
            double dy = EndP.Y - StartP.Y;
6376
            double length;
6377 17a22987 KangIngu
6378 4318fdeb KangIngu
            switch (controlType)
6379
            {
6380
                case ControlType.Triangle:
6381
                    {
6382
                        //삼각형의 StartPoint기준으로 반지름 만큼 증가하기 때문에 곱하기2 필요
6383
                        length = Math.Max(Math.Abs(dx) * 2, Math.Abs(dy));
6384
                        Return_Point = (dy < 0) ? new Point(StartP.X + length / 2, StartP.Y - length) : new Point(StartP.X + length / 2, StartP.Y + length);
6385
                    }
6386
                    break;
6387
                default:
6388
                    {
6389
                        length = Math.Max(Math.Abs(dx), Math.Abs(dy));
6390
                        Return_Point.X = (dx > 0) ? StartP.X + length : StartP.X - length;
6391
                        Return_Point.Y = (dy > 0) ? StartP.Y + length : StartP.Y - length;
6392
                    }
6393
                    break;
6394
            }
6395 17a22987 KangIngu
6396
            return Return_Point;
6397
        }
6398 e753423e humkyung
6399
        /// <summary>
6400
        /// 정삼각형을 그리기위한 두 포인트를 계산하여 넘겨줌
6401
        /// </summary>
6402
        /// <author>humkyung</author>
6403
        /// <date>2018.04.26</date>
6404
        /// <param name="StartP"></param>
6405
        /// <param name="EndP"></param>
6406
        /// <returns></returns>
6407 32e95118 KangIngu
        /// <history>humkyung 2018.05.11 apply axis lock</history>
6408 e54660e8 KangIngu
        private List<Point> GetRegularTrianglePoints(Point StartP, Point EndP, bool bCheckAxis = false)
6409 e753423e humkyung
        {
6410
            List<Point> res = new List<Point>();
6411
6412
            double dx = EndP.X - StartP.X;
6413
            double dy = EndP.Y - StartP.Y;
6414
            double length = Math.Sqrt(dx * dx + dy * dy);
6415 e54660e8 KangIngu
            double baseLength = length * Math.Tan(30.0 * Math.PI / 180.0);
6416 e753423e humkyung
            dx /= length;
6417
            dy /= length;
6418
            double tmp = dx;
6419
            dx = -dy; dy = tmp; /// rotate by 90 degree
6420
6421
            res.Add(new Point(EndP.X + dx * baseLength, EndP.Y + dy * baseLength));
6422
            res.Add(new Point(EndP.X - dx * baseLength, EndP.Y - dy * baseLength));
6423
6424
            return res;
6425
        }
6426 a1716fa5 KangIngu
6427 e66f22eb KangIngu
        /// <summary>
6428
        /// 캔버스에 그릴때 모든 포인트가 캔버스를 벗어 났는지 체크하여 넘겨줌
6429
        /// </summary>
6430
        /// <author>ingu</author>
6431
        /// <date>2018.06.05</date>
6432
        /// <param name="getPoint"></param>
6433
        /// <returns></returns>
6434
        private bool IsGetoutpoint(Point getPoint)
6435 670a4be2 humkyung
        {
6436 e66f22eb KangIngu
            if (getPoint == new Point())
6437 670a4be2 humkyung
            {
6438 e66f22eb KangIngu
                ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl);
6439
                currentControl = null;
6440
                return true;
6441 670a4be2 humkyung
            }
6442
6443 e66f22eb KangIngu
            return false;
6444 670a4be2 humkyung
        }
6445 e66f22eb KangIngu
6446 5b46312f djkim
        private void zoomAndPanControl_DragOver(object sender, DragEventArgs e)
6447
        {
6448
            e.Effects = DragDropEffects.Copy;
6449
        }
6450
6451
        private void zoomAndPanControl_DragEnter(object sender, DragEventArgs e)
6452
        {
6453
            e.Effects = DragDropEffects.Copy;
6454
        }
6455
6456
        private void zoomAndPanControl_DragLeave(object sender, DragEventArgs e)
6457
        {
6458
            e.Effects = DragDropEffects.None;
6459
        }
6460
6461 e6a9ddaf humkyung
        /*
6462 5b46312f djkim
        private void zoomAndPanControl_Drop(object sender, DragEventArgs e)
6463
        {
6464 90e7968d ljiyeon
            try
6465 5b46312f djkim
            {
6466 90e7968d ljiyeon
                if (e.Data.GetDataPresent(typeof(string)))
6467
                {
6468
                    this.getCurrentPoint = e.GetPosition(drawingRotateCanvas);
6469
                    string dragData = e.Data.GetData(typeof(string)) as string;
6470
                    Move_Symbol(sender, dragData);
6471
                }
6472 5b46312f djkim
            }
6473 90e7968d ljiyeon
            catch (Exception ex)
6474
            {
6475
                Logger.sendResLog("zoomAndPanControl_Drop", ex.ToString(), 0);
6476
            }            
6477 5b46312f djkim
        }
6478 e6a9ddaf humkyung
        */
6479 787a4489 KangIngu
    }
6480 5a6a5dd1 humkyung
}
클립보드 이미지 추가 (최대 크기: 500 MB)