프로젝트

일반

사용자정보

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

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

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