프로젝트

일반

사용자정보

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

markus / KCOM / Views / MainMenu.xaml.cs @ 930c5fee

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