프로젝트

일반

사용자정보

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

markus / KCOM / Common / ViewerDataModel.cs @ 19d602e0

이력 | 보기 | 이력해설 | 다운로드 (38.3 KB)

1
using KCOM.Events;
2
using KCOM.Messenger;
3
using KCOMDataModel.DataModel;
4
//using Leadtools;
5
using MarkupToPDF.Common;
6
using Newtonsoft.Json;
7
using System;
8
using System.Collections;
9
using System.Collections.Generic;
10
using System.Collections.ObjectModel;
11
using System.ComponentModel;
12
using System.IO;
13
using System.Linq;
14
using System.Text;
15
using System.Threading.Tasks;
16
using System.Windows;
17
using System.Windows.Controls;
18
using System.Windows.Ink;
19
using System.Windows.Media;
20
using System.Xml;
21
using System.Xml.Serialization;
22
//using IKCOM;
23

    
24
namespace KCOM.Common
25
{
26
    public class ViewerDataModel : INotifyPropertyChanged
27
    {
28

    
29
        System.Threading.CancellationTokenSource PageImageTokenSource;
30
        System.Threading.CancellationTokenSource MarkupTokenSource;
31

    
32
        public System.Threading.CancellationToken? PagImageCancelToken()
33
        {
34
            return PageImageTokenSource?.Token;
35
        }
36

    
37
        public void PagImageCancelDispose()
38
        {
39
            if (PageImageTokenSource != null)
40
            {
41
                PageImageTokenSource.Dispose();
42
                PageImageTokenSource = null;
43
            }
44
        }
45

    
46
        public System.Threading.CancellationToken NewPagImageCancelToken()
47
        {
48
            if (PageImageTokenSource != null)
49
            {
50
                System.Diagnostics.Debug.WriteLine("cancel Token");
51
                PageImageTokenSource.Cancel(true);
52

    
53
                while (!PageImageTokenSource.IsCancellationRequested)
54
                {
55
                    // Do some work, or just wait
56
                    System.Threading.Thread.Sleep(50);
57
                }
58
            }
59

    
60
            PageImageTokenSource = new System.Threading.CancellationTokenSource();
61

    
62
            return PageImageTokenSource.Token;
63
        }
64

    
65
        public System.Threading.CancellationToken MarkupCancelToken()
66
        {
67
            return MarkupTokenSource.Token;
68
        }
69

    
70
        public void MarkupCancelDispose()
71
        {
72
            if (MarkupTokenSource != null)
73
            {
74
                MarkupTokenSource.Dispose();
75
                MarkupTokenSource = null;
76
            }
77
        }
78

    
79
        public System.Threading.CancellationToken NewMarkupCancelToken()
80
        {
81
            if (MarkupTokenSource != null)
82
            {
83
                System.Diagnostics.Debug.WriteLine("cancel Token");
84
                MarkupTokenSource.Cancel(true);
85

    
86
                while (!MarkupTokenSource.IsCancellationRequested)
87
                {
88
                    // Do some work, or just wait
89
                    System.Threading.Thread.Sleep(50);
90
                }
91
            }
92

    
93
            MarkupTokenSource = new System.Threading.CancellationTokenSource();
94

    
95
            return MarkupTokenSource.Token;
96
        }
97

    
98

    
99
        private static DateTime KeyInputTime = DateTime.Now;
100
        private static TimeSpan KeyInputDelay = new TimeSpan(0, 0, 1);
101

    
102
        public bool IsFastKeyInput()
103
        {
104
            if(DateTime.Now - KeyInputTime < KeyInputDelay)
105
            {
106
                return true;
107
            }
108
            else
109
            {
110
                KeyInputTime = DateTime.Now;
111
                return false;
112
            }
113
        }
114

    
115
        #region Data Members
116

    
117
        private static ViewerDataModel instance = new ViewerDataModel();
118

    
119
        //private ObservableCollection<CommentUserInfo> markupControls_Pre = new ObservableCollection<CommentUserInfo>();
120

    
121
        
122
        private ObservableCollection<CommentUserInfo> markupControls_Sync = new ObservableCollection<CommentUserInfo>();
123
        private ObservableCollection<CommentUserInfo> markupControls { get; } = new ObservableCollection<CommentUserInfo>();
124
        /// <summary>
125
        /// 사용자가 작업 중인 markup 데이터
126
        /// </summary>
127
        private ObservableCollection<CommentUserInfo> markupControls_User { get; } = new ObservableCollection<CommentUserInfo>();
128

    
129

    
130
        ////강인구 추가
131
        //private List<Check_Inferface> check_Item = new List<Check_Inferface>();
132
        private ObservableCollection<KCOMDataModel.DataModel.DOCPAGE> document_Info = new ObservableCollection<KCOMDataModel.DataModel.DOCPAGE>();
133
        private ObservableCollection<UndoDataGroup> undoDataList = new ObservableCollection<UndoDataGroup>();
134
        
135
        //public  UndoDataList { get; set; }
136

    
137

    
138
        private ObservableCollection<IKCOM.MarkupInfoItem> markupInfoList = new ObservableCollection<IKCOM.MarkupInfoItem>();
139
        private ObservableCollection<MarkupUserInfo> markupUserList = new ObservableCollection<MarkupUserInfo>();
140
        
141
        private ObservableCollection<IKCOM.MarkupInfoItem> markupInfoRevList = new ObservableCollection<IKCOM.MarkupInfoItem>();
142

    
143
        public List<FAVORITE_DOC> FavoriteSelctedSet = new List<FAVORITE_DOC>();
144
        public List<FAVORITE_DOC> FavoriteSet = new List<FAVORITE_DOC>();
145
        public List<KCOMDataModel.DataModel.DOCPAGE> RotationDocs = new List<KCOMDataModel.DataModel.DOCPAGE>();
146
        //_markupInfoList
147

    
148
        private StrokeCollection markupPens = new StrokeCollection();
149

    
150
        //private ObservableCollection<RectangleData> rectangles = new ObservableCollection<RectangleData>();
151

    
152

    
153
        private double contentScale = 1;
154

    
155
        private double contentOffsetY = 0;
156

    
157
        private double contentOffsetX = 0;
158

    
159
        private double Sync_contentScale = 1;
160

    
161
        private double Sync_contentOffsetY = 0;
162

    
163
        private double Sync_contentOffsetX = 0;
164

    
165
        private double contentViewportHeight = 0;
166

    
167
        private double contentViewportWidth = 0;
168

    
169
        private double contentWidth = 0;
170

    
171
        private MessageCollection _k_talkMessageSet;
172

    
173
        private double contentHeight = 0;
174

    
175
        private double markupAngle = 0;
176

    
177
        private double pageAngle = 0;
178

    
179
        private double angleOffsetX = 0;
180

    
181
        private double angleOffsetY = 0;
182

    
183
        private ImageBrush backgroundImage;
184

    
185
        //private RasterImage _rasterimage;
186

    
187

    
188
        #endregion Data Members
189

    
190
        #region Property Member
191

    
192
        public bool IsWheelPageChanage = false;
193

    
194
        public static ViewerDataModel Instance
195
        {
196
            get
197
            {
198
                return instance;
199
            }
200
        }
201

    
202
        private  bool isMarkupUpdate;
203

    
204
        private bool isDownloadOriginal;
205
        public bool IsDownloadOriginal
206
        {
207
            get => isDownloadOriginal;
208
            set
209
            {
210
                if (isDownloadOriginal != value)
211
                {
212
                    isDownloadOriginal = value;
213
                    OnPropertyChanged("IsDownloadOriginal");
214
                }
215
            }
216
        }
217

    
218
        private bool isAdmin;
219
        public bool IsAdmin
220
        {
221
            //get => true;
222
            get => isAdmin;
223
            set
224
            {
225
                isAdmin = value;
226
                OnPropertyChanged("IsAdmin");
227
            }
228
        }
229

    
230
        private bool isDocumentHistory;
231
        public bool IsDocumentHistory
232
        {
233
            get => isDocumentHistory;
234
            set
235
            {
236
                isDocumentHistory = value;
237
                OnPropertyChanged("IsDocumentHistory");
238
            }
239
        }
240

    
241
        private bool isDownloadCancel;
242
        public bool IsDownloadCancel
243
        {
244
            get => isDownloadCancel;
245
            set
246
            {
247
                if (isDownloadCancel != value)
248
                {
249
                    isDownloadCancel = value;
250
                    OnPropertyChanged("IsDownloadCancel");
251
                }
252
            }
253
        }
254

    
255
        private int downloadFileProgress;
256
        public int DownloadFileProgress
257
        {
258
            get => downloadFileProgress;
259
            set
260
            {
261
                if (downloadFileProgress != value)
262
                {
263
                    downloadFileProgress = value;
264
                    OnPropertyChanged("DownloadFileProgress");
265
                }
266
            }
267
        }
268

    
269
        private string originalTempFile;
270
        public string OriginalTempFile
271
        {
272
            get => originalTempFile;
273
            set
274
            {
275
                if (originalTempFile != value)
276
                {
277
                    originalTempFile = value;
278
                    OnPropertyChanged("OriginalTempFile");
279
                }
280
            }
281
        }
282

    
283
        private List<IKCOM.MarkupItemEx> _MarkupList_MY { get; set; }
284
        public List<IKCOM.MarkupItemEx> MarkupList_MY
285
        {
286
            get
287
            {
288
                if (_MarkupList_MY == null)
289
                {
290
                    _MarkupList_MY = new List<IKCOM.MarkupItemEx>();
291
                }
292

    
293
                return _MarkupList_MY;
294
            }
295
            set
296
            {
297

    
298
                _MarkupList_MY = value;
299
                OnPropertyChanged("MarkupList_MY");
300
            }
301
        }
302

    
303
        private List<IKCOM.MarkupItemEx> _MarkupList_USER { get; set; }
304
        public List<IKCOM.MarkupItemEx> MyMarkupList
305
        {
306
            get
307
            {
308
                if (_MarkupList_USER == null)
309
                {
310
                    _MarkupList_USER = new List<IKCOM.MarkupItemEx>();
311
                }
312

    
313
                return _MarkupList_USER;
314
            }
315
            set
316
            {
317

    
318
                _MarkupList_USER = value;
319
                OnPropertyChanged("_MarkupList_USER");
320
            }
321
        }
322

    
323
        private List<IKCOM.MarkupItemEx> _MarkupList_Pre { get; set; }
324
        public List<IKCOM.MarkupItemEx> MarkupList_Pre
325
        {
326
            get
327
            {
328
                if (_MarkupList_Pre == null)
329
                {
330
                    _MarkupList_Pre = new List<IKCOM.MarkupItemEx>();
331
                }
332

    
333
                return _MarkupList_Pre;
334
            }
335
            set
336
            {
337

    
338
                _MarkupList_Pre = value;
339
                OnPropertyChanged("MarkupList_Pre");
340
            }
341

    
342
        }
343

    
344
        private System.IO.FileInfo _searchPDF { get; set; }
345
        public System.IO.FileInfo searchPDF
346
        {
347
            get
348
            {
349
                return _searchPDF;
350
            }
351
            set
352
            {
353
                _searchPDF = value;
354
                OnPropertyChanged("searchPDF");
355
            }
356
        }
357

    
358

    
359
        /// <summary>
360
        /// 현재 상단 메뉴에서 선택된 컨트롤
361
        /// </summary>
362
        private string _SelectedControl { get; set; }
363
        public string SelectedControl
364
        {
365
            get
366
            {
367
                return _SelectedControl;
368
            }
369
            set
370
            {
371
                _SelectedControl = value;
372
                OnPropertyChanged("SelectedControl");
373
            }
374
        }
375

    
376
        private List<KCOM.Common.MacroItem> _MacroItems;
377

    
378
        public List<KCOM.Common.MacroItem> MacroItems
379
        {
380
            get
381
            {
382
                return _MacroItems;
383
            }
384

    
385
            set
386
            {
387
                _MacroItems = value;
388
            }
389
        }
390

    
391
        private int _MacroCommandIndex;
392

    
393
        public int MacroCommandIndex
394
        {
395
            get
396
            {
397
                return _MacroCommandIndex;
398
            }
399

    
400
            set
401
            {
402
                _MacroCommandIndex = value;
403
            }
404
        }
405

    
406
        private bool _IsMacroCommand;
407

    
408
        public bool IsMacroCommand
409
        {
410
            get
411
            {
412
                return _IsMacroCommand;
413
            }
414

    
415
            set
416
            {
417
                _IsMacroCommand = value;
418
            }
419
        }
420

    
421
        /// <summary>
422
        /// 현재 상단 메뉴의 선 굵기값
423
        /// </summary>
424
        private double _LineSize { get; set; }
425
        public double LineSize
426
        {
427
            get
428
            {
429
                return _LineSize;
430
            }
431
            set
432
            {
433
                _LineSize = value;
434
                OnPropertyChanged("LineSize");
435
            }
436
        }
437

    
438
        private double _Interval { get; set; }
439
        public double Interval
440
        {
441
            get
442
            {
443
                return _Interval;
444
            }
445
            set
446
            {
447
                _Interval = value;
448
                OnPropertyChanged("Interval");
449
            }
450
        }
451
        private double _SaveInterval { get; set; }
452
        public double SaveInterval
453
        {
454
            get
455
            {
456
                return _SaveInterval;
457
            }
458
            set
459
            {
460
                _SaveInterval = value;
461
                OnPropertyChanged("SaveInterval");
462
            }
463
        }
464
        private double _ArcLength { get; set; }
465
        public double ArcLength
466
        {
467
            get
468
            {
469
                return _ArcLength;
470
            }
471
            set
472
            {
473
                _ArcLength = value;
474
                OnPropertyChanged("ArcLength");
475
            }
476
        }
477

    
478
        public bool IsPressShift
479
        {
480
            get
481
            {
482
                return ((System.Windows.Input.Keyboard.Modifiers & System.Windows.Input.ModifierKeys.Shift) == System.Windows.Input.ModifierKeys.Shift);
483
            }
484
        }
485

    
486
        public bool IsPressCtrl
487
        {
488
            get
489
            {
490
                return ((System.Windows.Input.Keyboard.Modifiers & System.Windows.Input.ModifierKeys.Control) == System.Windows.Input.ModifierKeys.Control);
491
            }
492
        }
493

    
494
        /// <summary>
495
        /// Dash 사이즈 
496
        /// </summary>
497
        private DoubleCollection _DashSize { get; set; }
498
        public DoubleCollection DashSize
499
        {
500
            get
501
            {
502
                return _DashSize;
503
            }
504
            set
505
            {
506
                _DashSize = value;
507
                OnPropertyChanged("DashSize");
508
            }
509
        }
510

    
511
        private string _ControlTag { get; set; }
512
        public string ControlTag
513
        {
514
            get
515
            {
516
                return _ControlTag;
517
            }
518
            set
519
            {
520
                _ControlTag = value;
521
                OnPropertyChanged("ControlTag");
522
            }
523
        }
524

    
525
        private string _CheckStatus { get; set; }
526
        public string CheckStatus
527
        {
528
            get
529
            {
530
                return _CheckStatus;
531
            }
532
            set
533
            {
534
                _CheckStatus = value;
535
                OnPropertyChanged("CheckStatus");
536
            }
537
        }
538

    
539

    
540

    
541
        //private bool _IsPageChanged { get; set; }
542
        //public bool IsPageChanged
543
        //{
544
        //    get
545
        //    {
546
        //        return _IsPageChanged;
547
        //    }
548
        //    set
549
        //    {
550
        //        _IsPageChanged = value;
551
        //        OnPropertyChanged("IsPageChanged");
552
        //    }
553
        //}
554

    
555

    
556

    
557
        ///// <summary>
558
        ///// 강인구 추가(Check List관련)
559
        ///// </summary>
560
        //public List<Check_Inferface> Check_Item
561
        //{
562
        //    get
563
        //    {
564
        //        return check_Item;
565
        //    }
566
        //}
567

    
568
        private bool _IsConsolidate { get; set; }
569
        public bool IsConsolidate
570
        {
571
            get
572
            {
573
                return _IsConsolidate;
574
            }
575
            set
576
            {
577
                _IsConsolidate = value;
578
                OnPropertyChanged("IsConsolidate");
579
            }
580
        }
581

    
582
        private bool _IsFinalPDF { get; set; }
583
        public bool IsFinalPDF
584
        {
585
            get
586
            {
587
                return _IsFinalPDF;
588
            }
589
            set
590
            {
591
                _IsFinalPDF = value;
592
                OnPropertyChanged("IsFinalPDF");
593
            }
594
        }
595
        private DateTime _FinalPDFTime { get; set; }
596
        public DateTime FinalPDFTime
597
        {
598
            get
599
            {
600
                return _FinalPDFTime;
601
            }
602
            set
603
            {
604
                _FinalPDFTime = value;
605
                OnPropertyChanged("FinalPDFTime");
606
            }
607
        }
608

    
609
        ////////////////////////////////////////////////
610

    
611

    
612
        #region Angle 관련
613
        private Visibility _MarkupAngleVisibility { get; set; }
614
        public Visibility MarkupAngleVisibility
615
        {
616
            get
617
            {
618
                return _MarkupAngleVisibility;
619
            }
620
            set
621
            {
622
                _MarkupAngleVisibility = value;
623
                OnPropertyChanged("MarkupAngleVisibility");
624
            }
625

    
626
        }
627

    
628
        public double MarkupAngle
629
        {
630
            get
631
            {
632
                return markupAngle;
633
            }
634
            set
635
            {
636
                markupAngle = value;
637
                OnPropertyChanged("MarkupAngle");
638
            }
639
        }
640

    
641
        public double PageAngle
642
        {
643
            get
644
            {
645
                return pageAngle;
646
            }
647
            set
648
            {
649
                pageAngle = value;
650
                OnPropertyChanged("PageAngle");
651
            }
652
        }
653

    
654
        private string _HelperContent { get; set; }
655
        public string HelperContent
656
        {
657
            get
658
            {
659
                return _HelperContent;
660
            }
661
            set
662
            {
663
                _HelperContent = value;
664
                OnPropertyChanged("HelperContent");
665
            }
666
        }
667

    
668
        private string _HelperHeader { get; set; }
669
        public string HelperHeader
670
        {
671
            get
672
            {
673
                return _HelperHeader;
674
            }
675
            set
676
            {
677
                _HelperHeader = value;
678
                OnPropertyChanged("HelperHeader");
679
            }
680
        }
681

    
682
        private bool _HelperExit { get; set; }
683
        public bool HelperExit
684
        {
685
            get
686
            {
687
                return _HelperExit;
688
            }
689
            set
690
            {
691
                _HelperExit = value;
692
                OnPropertyChanged("HelperExit");
693
            }
694
        }
695

    
696
        #endregion
697

    
698
        public event EventHandler<EventArgs> PageLoaded;
699

    
700
        /// <summary>
701
        /// 페이지 변경 후 페이지에 해당하는 마크업을 모두 읽었을때 이벤트를 보내도록 한다.
702
        /// </summary>
703
        public void LoadPageMarkupFinish(Rect rect)
704
        {
705
            if(PageLoaded != null)
706
            {
707
                PageLoaded(this, new EventArgs());
708
            }
709
            else
710
            {
711
                this.SystemMain.dzMainMenu.zoomAndPanControl.ZoomTo(rect);
712
            }
713
        }
714

    
715
        public bool SaveCheck()
716
        {
717
            bool result = false;
718

    
719
            if (ViewerDataModel.Instance.UndoDataList.Count > 0)
720
            {
721
                DateTime undoTime = UndoDataList.OrderByDescending(order => order.EventTime).FirstOrDefault().EventTime;
722
                DateTime updatetime = DateTime.Now.AddDays(-1);
723
                
724
                if (_markupInfoList.Count > 0)
725
                {
726
                    updatetime = _markupInfoList.OrderByDescending(order => order.UpdateTime).FirstOrDefault().UpdateTime;
727
                }
728

    
729
                if (undoTime > updatetime)
730
                {
731
                    result = false;
732
                }
733
                else
734
                {
735
                    result = true;
736
                }
737
            }
738
            else
739
            {
740
                result = true;
741
            }
742

    
743
            return result;
744
        }
745

    
746
        public bool FinalPDFCheck()
747
        {
748
            bool result = false;
749

    
750
            DateTime updatetime = DateTime.Now.AddDays(-1);
751

    
752
            if (_markupInfoList.Count > 0)
753
            {
754
               var consolidateItems = _markupInfoList.Where(x => x.Consolidate == 1 && x.AvoidConsolidate == 0);
755

    
756
                if (consolidateItems.Count() > 0)
757
                {
758
                    updatetime = consolidateItems.OrderByDescending(order => order.UpdateTime).FirstOrDefault().UpdateTime;
759
                }
760
            }
761

    
762
            if (FinalPDFTime > updatetime)
763
            {
764
                result = true;
765
            }
766

    
767
            return result;
768
        }
769

    
770
        public void SetAngleVisible(Visibility visibility)
771
        {
772
            this.MarkupAngleVisibility = visibility;
773
        }
774

    
775

    
776
        public ObservableCollection<CommentUserInfo> MarkupControls
777
        {
778
            get
779
            {
780
                return markupControls;
781
            }
782
        }
783

    
784
        public ObservableCollection<CommentUserInfo> MarkupControls_Sync
785
        {
786
            get
787
            {
788
                return markupControls_Sync;
789
            }
790
        }
791
        public int current_page_commentcnt = 0;
792
        public ObservableCollection<CommentUserInfo> MarkupControls_USER
793
        {
794
            get
795
            {
796
                return markupControls_User;
797
            }
798
        }
799

    
800
        public ObservableCollection<UndoDataGroup> UndoDataList
801
        {
802
            get
803
            {
804
                return undoDataList;
805
            }
806
        }
807
        
808
        public StrokeCollection MarkupPens
809
        {
810
            get
811
            {
812
                return markupPens;
813
            }
814

    
815
        }
816

    
817
        #region 버튼 여부
818

    
819
        /// <summary>
820
        /// 상단 Fill 버튼이 클릭 되어있는지
821
        /// </summary>
822
        private bool _checkFillShape { get; set; }
823
        public bool checkFillShape
824
        {
825
            get
826
            {
827
                return _checkFillShape;
828
            }
829
            set
830
            {
831
                _checkFillShape = value;
832
                OnPropertyChanged("checkFillShape");
833
            }
834
        }
835

    
836
        /// <summary>
837
        /// 상단 Hatch 버튼이 클릭 되어있는지
838
        /// </summary>
839
        private bool _checkHatchShape { get; set; }
840
        public bool checkHatchShape
841
        {
842
            get
843
            {
844
                return _checkHatchShape;
845
            }
846
            set
847
            {
848
                _checkHatchShape = value;
849
                OnPropertyChanged("checkHatchShape");
850
            }
851
        }
852

    
853
        private double _controlOpacity { get; set; }
854
        public double ControlOpacity
855
        {
856
            get
857
            {
858
                return _controlOpacity;
859
            }
860
            set
861
            {
862

    
863
                _controlOpacity = value;
864
                OnPropertyChanged("ControlOpacity");
865
            }
866
        }
867

    
868
        private MarkupToPDF.Controls.Common.PaintSet _paintSet { get; set; }
869
        public MarkupToPDF.Controls.Common.PaintSet paintSet
870
        {
871
            get
872
            {
873
                return _paintSet;
874
            }
875
            set
876
            {
877
                _paintSet = value;
878
                OnPropertyChanged("paintSet");
879
            }
880
        }
881

    
882
        /// <summary>
883
        /// 강인구 추가
884
        /// 상단 TextStyle 버튼이 클릭 되어있는지
885
        /// </summary>
886
        private bool _checkTextStyle { get; set; }
887
        public bool checkTextStyle
888
        {
889
            get
890
            {
891
                return _checkTextStyle;
892
            }
893
            set
894
            {
895
                _checkTextStyle = value;
896
                OnPropertyChanged("checkTextStyle");
897
            }
898
        }
899

    
900
        /// <summary>
901
        /// 강인구 추가
902
        /// 상단 TextWeight 버튼이 클릭 되어있는지
903
        /// </summary>
904
        private bool _checkTextWeight { get; set; }
905
        public bool checkTextWeight
906
        {
907
            get
908
            {
909
                return _checkTextWeight;
910
            }
911
            set
912
            {
913
                _checkTextWeight = value;
914
                OnPropertyChanged("checkTextWeight");
915
            }
916
        }
917

    
918
        /// <summary>
919
        /// 강인구 추가
920
        /// 상단 UnderLine 버튼이 클릭 되어있는지
921
        /// </summary>
922
        private bool _checkUnderLine { get; set; }
923
        public bool checkUnderLine
924
        {
925
            get
926
            {
927
                return _checkUnderLine;
928
            }
929
            set
930
            {
931
                _checkUnderLine = value;
932
                OnPropertyChanged("checkUnderLine");
933
            }
934
        }
935

    
936
        /// <summary>
937
        /// 상단 Hatch 버튼이 클릭 되어있는지
938
        /// </summary>
939
        private bool _checkHighShape { get; set; }
940
        public bool checkHighShape
941
        {
942
            get
943
            {
944
                return _checkHighShape;
945
            }
946
            set
947
            {
948
                _checkHighShape = value;
949
                OnPropertyChanged("checkHighShape");
950
            }
951
        }
952

    
953
        /// <summary>
954
        /// 상단 Axis 버튼이 클릭 되어있는지
955
        /// </summary>
956
        private bool _IsAxisLock { get; set; }
957
        public bool IsAxisLock
958
        {
959
            get
960
            {
961
                return _IsAxisLock;
962
            }
963
            set
964
            {
965
                _IsAxisLock = value;
966
                OnPropertyChanged("IsAxisLock");
967
            }
968
        }
969

    
970
        /// <summary>
971
        /// 상단 Highlight 버튼이 클릭 되어있는지
972
        /// </summary>
973
        private bool _checkHighlight { get; set; }
974
        public bool checkHighlight
975
        {
976
            get
977
            {
978
                return _checkHighlight;
979
            }
980
            set
981
            {
982
                _checkHighlight = value;
983
                OnPropertyChanged("checkHighlight");
984
            }
985
        }
986

    
987
        /// <summary>
988
        /// 강인구 추가
989
        /// 상단 TextWeight 버튼이 클릭 되어있는지
990
        /// </summary>
991
        private double _TextSize { get; set; }
992
        public double TextSize
993
        {
994
            get
995
            {
996
                return _TextSize;
997
            }
998
            set
999
            {
1000
                _TextSize = value;
1001
                OnPropertyChanged("TextSize");
1002
            }
1003
        }
1004
        #endregion
1005

    
1006
        public ImageBrush BackgroundImage
1007
        {
1008
            get
1009
            {
1010
                return backgroundImage;
1011
            }
1012
            set
1013
            {
1014
                backgroundImage = value;
1015
                OnPropertyChanged("BackgroundImage");
1016
            }
1017
        }
1018

    
1019
        public ObservableCollection<KCOMDataModel.DataModel.DOCPAGE> Document_Info
1020
        {
1021
            get
1022
            {
1023
                return document_Info;
1024
            }
1025
        }
1026

    
1027
        public double ContentScale
1028
        {
1029
            get
1030
            {
1031
                return contentScale;
1032
            }
1033
            set
1034
            {
1035
                contentScale = value;
1036

    
1037
                double minOffsetX = 0.0;
1038
                double maxOffsetX = Math.Max(0.0, ContentWidth - ContentViewportWidth);
1039
                contentOffsetX = Math.Min(Math.Max(contentOffsetX, minOffsetX), maxOffsetX);
1040

    
1041
                double minOffsetY = 0.0;
1042
                double maxOffsetY = Math.Max(0.0, ContentHeight - ContentViewportHeight);
1043
                contentOffsetY = Math.Min(Math.Max(contentOffsetY, minOffsetY), maxOffsetY);
1044

    
1045
                OnPropertyChanged("ContentScale");
1046
            }
1047
        }
1048

    
1049
        public double Sync_ContentScale
1050
        {
1051
            get
1052
            {
1053
                return Sync_contentScale;
1054
            }
1055
            set
1056
            {
1057
                Sync_contentScale = value;
1058
                OnPropertyChanged("Sync_ContentScale");
1059
            }
1060
        }
1061

    
1062
        public ObservableCollection<IKCOM.MarkupInfoItem> _markupInfoList
1063
        {
1064
            get
1065
            {
1066
                return markupInfoList;
1067
            }
1068
            set
1069
            {
1070
                markupInfoList = value;
1071
                OnPropertyChanged("_markupInfoList");
1072
            }
1073
        }
1074

    
1075
        public ObservableCollection<MarkupUserInfo> _markupUserList
1076
        {
1077
            get
1078
            {
1079
                return markupUserList;
1080
            }
1081
            set
1082
            {
1083
                markupUserList = value;
1084
                OnPropertyChanged("_markupUserList");
1085
            }
1086
        }
1087

    
1088
        public ObservableCollection<IKCOM.MarkupInfoItem> _markupInfoRevList
1089
        {
1090
            get
1091
            {
1092
                return markupInfoRevList;
1093
            }
1094
            set
1095
            {
1096
                markupInfoRevList = value;
1097
                OnPropertyChanged("_markupInfoRevList");
1098
            }
1099
        }
1100

    
1101
        public double ContentOffsetX
1102
        {
1103
            get
1104
            {
1105
                return contentOffsetX;
1106
            }
1107
            set
1108
            {
1109
                double minOffsetX = 0.0;
1110
                double maxOffsetX = Math.Max(0.0, ContentWidth - ContentViewportWidth);
1111
                contentOffsetX = Math.Min(Math.Max(value, minOffsetX), maxOffsetX);
1112
                OnPropertyChanged("ContentOffsetX");
1113
            }
1114
        }
1115

    
1116
        public double ContentOffsetY
1117
        {
1118
            get
1119
            {
1120
                return contentOffsetY;
1121
            }
1122
            set
1123
            {
1124
                double minOffsetY = 0.0;
1125
                double maxOffsetY = Math.Max(0.0, ContentHeight - ContentViewportHeight);
1126
                contentOffsetY = Math.Min(Math.Max(value, minOffsetY), maxOffsetY);
1127
                OnPropertyChanged("ContentOffsetY");
1128
            }
1129
        }
1130

    
1131
        public double Sync_ContentOffsetX
1132
        {
1133
            get
1134
            {
1135
                return Sync_contentOffsetX;
1136
            }
1137
            set
1138
            {
1139
                Sync_contentOffsetX = value;
1140
                OnPropertyChanged("Sync_ContentOffsetX");
1141
            }
1142
        }
1143

    
1144
        public double Sync_ContentOffsetY
1145
        {
1146
            get
1147
            {
1148
                return Sync_contentOffsetY;
1149
            }
1150
            set
1151
            {
1152
                Sync_contentOffsetY = value;
1153
                OnPropertyChanged("Sync_ContentOffsetY");
1154
            }
1155
        }
1156

    
1157
        public MessageCollection k_talkMessageSet
1158
        {
1159
            get
1160
            {
1161
                if (_k_talkMessageSet == null)
1162
                {
1163
                    _k_talkMessageSet = new MessageCollection();
1164
                }
1165
                return _k_talkMessageSet;
1166
            }
1167
            set
1168
            {
1169
                _k_talkMessageSet = value;
1170
                OnPropertyChanged("k_talkMessageSet");
1171
            }
1172
        }
1173

    
1174
        public double ContentWidth
1175
        {
1176
            get
1177
            {
1178
                return contentWidth;
1179
            }
1180
            set
1181
            {
1182
                contentWidth = value;
1183
                OnPropertyChanged("ContentWidth");
1184
            }
1185
        }
1186

    
1187
        public double ContentHeight
1188
        {
1189
            get
1190
            {
1191
                return contentHeight;
1192
            }
1193
            set
1194
            {
1195
                contentHeight = value;
1196
                OnPropertyChanged("ContentHeight");
1197
            }
1198
        }
1199

    
1200
        public double ContentViewportWidth
1201
        {
1202
            get
1203
            {
1204
                return contentViewportWidth;
1205
            }
1206
            set
1207
            {
1208
                contentViewportWidth = value;
1209
                OnPropertyChanged("ContentViewportWidth");
1210
            }
1211
        }
1212

    
1213
        public double ContentViewportHeight
1214
        {
1215
            get
1216
            {
1217
                return contentViewportHeight;
1218
            }
1219
            set
1220
            {
1221
                contentViewportHeight = value;
1222
                OnPropertyChanged("ContentViewportHeight");
1223
            }
1224
        }
1225

    
1226
        public MainWindow SystemMain { get; set; }
1227

    
1228
        private bool _PageBalanceMode { get; set; }
1229
        public bool PageBalanceMode
1230
        {
1231
            get
1232
            {
1233
                return _PageBalanceMode;
1234
            }
1235
            set
1236
            {
1237
                _PageBalanceMode = value;
1238
                OnPropertyChanged("PageBalanceMode");
1239
            }
1240
        }
1241

    
1242
        private int _PageBalanceNumber { get; set; }
1243
        public int PageBalanceNumber
1244
        {
1245
            get
1246
            {
1247
                return _PageBalanceNumber;
1248
            }
1249
            set
1250
            {
1251
                _PageBalanceNumber = value;
1252
                OnPropertyChanged("PageBalanceNumber");
1253
            }
1254
        }
1255

    
1256
        
1257
        private int _SyncPageNumber { get; set; }
1258

    
1259
        /// <summary>
1260
        /// Sync Page No
1261
        /// </summary>
1262
        public int SyncPageNumber
1263
        {
1264
            get
1265
            {
1266
                return _SyncPageNumber;
1267
            }
1268
            set
1269
            {
1270
                if (_SyncPageNumber != value)
1271
                {
1272
                    _SyncPageNumber = value;
1273
                    OnPropertyChanged("PageNumber");
1274
                }
1275
            }
1276
        }
1277

    
1278
        public double AngleOffsetX
1279
        {
1280
            get
1281
            {
1282
                return angleOffsetX;
1283
            }
1284
            set
1285
            {
1286
                angleOffsetX = value;
1287
                OnPropertyChanged("AngleOffsetX");
1288
            }
1289
        }
1290

    
1291
        public double AngleOffsetY
1292
        {
1293
            get
1294
            {
1295
                return angleOffsetY;
1296
            }
1297
            set
1298
            {
1299
                angleOffsetY = value;
1300
                OnPropertyChanged("AngleOffsetY");
1301
            }
1302
        }
1303

    
1304
        //강인구 추가(체크리스트)
1305
        private string _CheckList_ID { get; set; }
1306
        public string CheckList_ID
1307
        {
1308
            get
1309
            {
1310
                return _CheckList_ID;
1311
            }
1312
            set
1313
            {
1314
                _CheckList_ID = value;
1315
                OnPropertyChanged("CheckList_ID");
1316
            }
1317
        }
1318
        //강인구 추가(캡쳐 모드)
1319
        private double _Capture_Opacity { get; set; }
1320
        public double Capture_Opacity
1321
        {
1322
            get
1323
            {
1324
                return _Capture_Opacity;
1325
            }
1326
            set
1327
            {
1328
                _Capture_Opacity = value;
1329
                OnPropertyChanged("Capture_Opacity");
1330
            }
1331
        }
1332

    
1333
        private Visibility _ViewVisible { get; set; }
1334
        public Visibility ViewVisible
1335
        {
1336
            get
1337
            {
1338
                return _ViewVisible;
1339
            }
1340
            set
1341
            {
1342
                _ViewVisible = value;
1343
                OnPropertyChanged("ViewVisible");
1344
            }
1345
        }
1346

    
1347
        private bool _IsSync { get; set; }
1348
        public bool IsSync
1349
        {
1350
            get
1351
            {
1352
                return _IsSync;
1353
            }
1354
            set
1355
            {
1356
                _IsSync = value;
1357
                OnPropertyChanged("IsSync");
1358
            }
1359
        }
1360

    
1361
        private System.Windows.Media.Imaging.BitmapFrame _ImageViewPath;
1362
        public System.Windows.Media.Imaging.BitmapFrame ImageViewPath
1363
        {
1364
            get
1365
            {
1366
                return _ImageViewPath;
1367
            }
1368
            set
1369
            {
1370
                _ImageViewPath = value;
1371
                OnPropertyChanged("ImageViewPath");
1372
            }
1373
        }
1374
        private double _ImageViewWidth { get; set; }
1375
        public double ImageViewWidth
1376
        {
1377
            get
1378
            {
1379
                return _ImageViewWidth;
1380
            }
1381
            set
1382
            {
1383
                _ImageViewWidth = value;
1384
                OnPropertyChanged("ImageViewWidth");
1385
            }
1386
        }
1387
        private double _ImageViewHeight { get; set; }
1388
        public double ImageViewHeight
1389
        {
1390
            get
1391
            {
1392
                return _ImageViewHeight;
1393
            }
1394
            set
1395
            {
1396
                _ImageViewHeight = value;
1397
                OnPropertyChanged("ImageViewHeight");
1398
            }
1399
        }
1400

    
1401
        private System.Windows.Media.Imaging.BitmapImage _ImageViewPath_C;
1402
        public System.Windows.Media.Imaging.BitmapImage ImageViewPath_C
1403
        {
1404
            get
1405
            {
1406
                return _ImageViewPath_C;
1407
            }
1408
            set
1409
            {
1410
                _ImageViewPath_C = value;
1411
                OnPropertyChanged("ImageViewPath_C");
1412
            }
1413
        }
1414
        private double _ImageViewWidth_C { get; set; }
1415
        public double ImageViewWidth_C
1416
        {
1417
            get
1418
            {
1419
                return _ImageViewWidth_C;
1420
            }
1421
            set
1422
            {
1423
                _ImageViewWidth_C = value;
1424
                OnPropertyChanged("ImageViewWidth_C");
1425
            }
1426
        }
1427
        private double _ImageViewHeight_C { get; set; }
1428
        public double ImageViewHeight_C
1429
        {
1430
            get
1431
            {
1432
                return _ImageViewHeight_C;
1433
            }
1434
            set
1435
            {
1436
                _ImageViewHeight_C = value;
1437
                OnPropertyChanged("ImageViewHeight_C");
1438
            }
1439
        }
1440

    
1441

    
1442
        #endregion Property Member
1443

    
1444
        public System.IO.Stream GetStreamFromUrl(string url)
1445
        {
1446
            byte[] imageData = null;
1447

    
1448
            using (var wc = new System.Net.WebClient())
1449
                imageData = wc.DownloadData(url);
1450

    
1451
            return new System.IO.MemoryStream(imageData);
1452
        }
1453

    
1454
        public ViewerDataModel()
1455
        {
1456
            //rectangles.Add(new RectangleData(50, 50, 80, 150, Colors.Blue));
1457
            //rectangles.Add(new RectangleData(550, 350, 80, 150, Colors.Green));
1458
            //rectangles.Add(new RectangleData(850, 850, 30, 20, Colors.Purple));
1459
            //rectangles.Add(new RectangleData(1850, 1850, 80, 150, Colors.Red));
1460

    
1461
            //RectangleControl rect1 = new RectangleControl();
1462
            //rect1.StartPoint = new Point(50, 50);
1463
            //rect1.LeftBottomPoint = new Point(100, 50);
1464
            //rect1.TopRightPoint = new Point(50, 100);
1465
            //rect1.EndPoint = new Point(100, 100);
1466
            //rect1.FillColor = new SolidColorBrush(Colors.Red);
1467
            //rectangles.Add(rect1);
1468
            //
1469
            // Populate the data model with some example data.
1470
            //
1471
            //rectangles.Add(new RectangleData(50, 50, 80, 150, Colors.Blue));
1472
            //rectangles.Add(new RectangleData(550, 350, 80, 150, Colors.Green));
1473
            //rectangles.Add(new RectangleData(850, 850, 30, 20, Colors.Purple));
1474
            //rectangles.Add(new RectangleData(1850, 1850, 80, 150, Colors.Red));
1475

    
1476
            this.ControlOpacity = 1;
1477

    
1478
            /* Default
1479
             LineSize = 3, TextSize = 30, Interval = 10, ArcLength = 10, SaveInterval = 5
1480
            */            
1481
            this.LineSize = KCOM.Properties.Settings.Default.LineSize;
1482

    
1483
            this.TextSize = KCOM.Properties.Settings.Default.TextSize;
1484

    
1485
            this.Interval = KCOM.Properties.Settings.Default.Interval;
1486

    
1487
            this.ArcLength = KCOM.Properties.Settings.Default.ArcLength;
1488

    
1489
            this.DashSize = new DoubleCollection();
1490

    
1491
            this.SaveInterval = KCOM.Properties.Settings.Default.SaveInterval;
1492
            this.MarkupAngleVisibility = Visibility.Collapsed;
1493
        }
1494

    
1495

    
1496
        public List<IKCOM.MarkupInfoItem> SelectedmarkupInfoItems { get; set; }
1497
        public bool IsMarkupUpdate { get => isMarkupUpdate; set => isMarkupUpdate = value; }
1498

    
1499
        #region INotifyPropertyChanged Event
1500

    
1501
        private void OnPropertyChanged(string name)
1502
        {
1503
            if (PropertyChanged != null)
1504
            {
1505
                PropertyChanged(this, new PropertyChangedEventArgs(name));
1506
            }
1507
        }
1508

    
1509
        public event PropertyChangedEventHandler PropertyChanged;
1510

    
1511
        #endregion
1512
    }
1513
}
클립보드 이미지 추가 (최대 크기: 500 MB)