프로젝트

일반

사용자정보

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

markus / KCOM / Views / MainMenu.xaml.cs @ 6dcbe4a7

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