프로젝트

일반

사용자정보

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

markus / KCOM / Views / MainMenu.xaml.cs @ 1066bae3

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