프로젝트

일반

사용자정보

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

markus / KCOM / Common / ViewerDataModel.cs.bak @ 787a4489

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

1
using KCOM.Messenger;
2
using Leadtools;
3
using MarkupToPDF.Common;
4
using System;
5
using System.Collections.Generic;
6
using System.Collections.ObjectModel;
7
using System.ComponentModel;
8
using System.Linq;
9
using System.Text;
10
using System.Windows;
11
using System.Windows.Controls;
12
using System.Windows.Ink;
13
using System.Windows.Media;
14
//using IKCOM;
15

    
16
namespace KCOM.Common
17
{
18
    public class ViewerDataModel : INotifyPropertyChanged
19
    {
20
        #region Data Members
21

    
22
        private static ViewerDataModel instance = new ViewerDataModel();
23

    
24
        //private ObservableCollection<CommentUserInfo> markupControls_Pre = new ObservableCollection<CommentUserInfo>();
25

    
26
        private ObservableCollection<CommentUserInfo> markupControls = new ObservableCollection<CommentUserInfo>();
27
        private ObservableCollection<CommentUserInfo> markupControls_Sync = new ObservableCollection<CommentUserInfo>();
28
        private ObservableCollection<CommentUserInfo> markupControls_User = new ObservableCollection<CommentUserInfo>();
29

    
30

    
31
        ////강인구 추가
32
        //private List<Check_Inferface> check_Item = new List<Check_Inferface>();
33
        private ObservableCollection<KCOMDataModel.DataModel.DOCPAGE> document_Info = new ObservableCollection<KCOMDataModel.DataModel.DOCPAGE>();
34
        
35

    
36
        private ObservableCollection<IKCOM.MarkupInfoItem> markupInfoList = new ObservableCollection<IKCOM.MarkupInfoItem>();
37
        private ObservableCollection<IKCOM.MarkupInfoItem> markupInfoRevList = new ObservableCollection<IKCOM.MarkupInfoItem>();
38

    
39
        
40
        //_markupInfoList
41

    
42
        private StrokeCollection markupPens = new StrokeCollection();
43

    
44
        //private ObservableCollection<RectangleData> rectangles = new ObservableCollection<RectangleData>();
45

    
46

    
47
        private double contentScale = 1;
48

    
49
        private double contentOffsetY = 0;
50

    
51
        private double contentOffsetX = 0;
52

    
53
        private double contentViewportHeight = 0;
54

    
55
        private double contentViewportWidth = 0;
56

    
57
        private double contentWidth = 0;
58

    
59
        private MessageCollection _k_talkMessageSet;
60
        
61
        private double contentHeight = 0;
62

    
63
        private double angle = 0;
64

    
65
        private double angleOffsetX = 0;
66

    
67
        private double angleOffsetY = 0;
68
        
69
        private ImageBrush backgroundImage;
70

    
71
        private RasterImage _rasterimage;
72

    
73

    
74
        #endregion Data Members
75

    
76
        #region Property Member
77

    
78
        public static ViewerDataModel Instance
79
        {
80
            get
81
            {
82
                return instance;
83
            }
84
        }
85

    
86
        private List<IKCOM.MarkupItemEx> _MarkupList_MY { get; set; }
87
        public List<IKCOM.MarkupItemEx> MarkupList_MY
88
        {
89
            get
90
            {
91
                if (_MarkupList_MY == null)
92
                {
93
                    _MarkupList_MY = new List<IKCOM.MarkupItemEx>();
94
                }
95

    
96
                return _MarkupList_MY;
97
            }
98
            set
99
            {
100

    
101
                _MarkupList_MY = value;
102
                OnPropertyChanged("MarkupList_MY");
103
            }
104
        }
105

    
106

    
107

    
108
        private List<IKCOM.MarkupItemEx> _MarkupList_USER { get; set; }
109
        public List<IKCOM.MarkupItemEx> MarkupList_USER
110
        {
111
            get
112
            {
113
                if (_MarkupList_USER == null)
114
                {
115
                    _MarkupList_USER = new List<IKCOM.MarkupItemEx>();
116
                }
117

    
118
                return _MarkupList_USER;
119
            }
120
            set
121
            {
122

    
123
                _MarkupList_USER = value;
124
                OnPropertyChanged("_MarkupList_USER");
125
            }
126
        }
127

    
128
        private List<IKCOM.MarkupItemEx> _MarkupList_Pre { get; set; }
129
        public List<IKCOM.MarkupItemEx> MarkupList_Pre
130
        {
131
            get
132
            {
133
                if (_MarkupList_Pre ==null)
134
                {
135
                    _MarkupList_Pre = new List<IKCOM.MarkupItemEx>();                    
136
                }
137

    
138
                return _MarkupList_Pre;
139
            }
140
            set
141
            {
142
               
143
                    _MarkupList_Pre = value;
144
                OnPropertyChanged("MarkupList_Pre");
145
            }
146

    
147
        }
148

    
149

    
150
        /// <summary>
151
        /// 현재 상단 메뉴에서 선택된 컨트롤
152
        /// </summary>
153
        private string _SelectedControl { get; set; }
154
        public string SelectedControl
155
        {
156
            get
157
            {
158
                return _SelectedControl;
159
            }
160
            set
161
            {
162
                _SelectedControl = value;
163
                OnPropertyChanged("SelectedControl");
164
            }
165
        }
166

    
167

    
168
        /// <summary>
169
        /// 현재 상단 메뉴의 선 굵기값
170
        /// </summary>
171
        private double _LineSize { get; set; }
172
        public double LineSize
173
        {
174
            get
175
            {
176
                return _LineSize;
177
            }
178
            set
179
            {
180
                _LineSize = value;
181
                OnPropertyChanged("LineSize");
182
            }
183
        }
184

    
185
        private bool _IsPressShift { get; set; }
186
        public bool IsPressShift
187
        {
188
            get
189
            {
190
                return _IsPressShift;
191
            }
192
            set
193
            {
194
                _IsPressShift = value;
195
                OnPropertyChanged("IsPressShift");
196
            }
197
        }
198

    
199
        //강인구 추가
200
        private bool _IsPressCtrl { get; set; }
201
        public bool IsPressCtrl
202
        {
203
            get
204
            {
205
                return _IsPressCtrl;
206
            }
207
            set
208
            {
209
                _IsPressCtrl = value;
210
                OnPropertyChanged("IsPressCtrl");
211
            }
212
        }
213

    
214
        /// <summary>
215
        /// Dash 사이즈 
216
        /// </summary>
217
        private DoubleCollection _DashSize { get; set; }
218
        public DoubleCollection DashSize
219
        {
220
            get
221
            {
222
                return _DashSize;
223
            }
224
            set
225
            {
226
                _DashSize = value;
227
                OnPropertyChanged("DashSize");
228
            }
229
        }
230

    
231
        private string _ControlTag { get; set; }
232
        public string ControlTag
233
        {
234
            get
235
            {
236
                return _ControlTag;
237
            }
238
            set
239
            {
240
                _ControlTag = value;
241
                OnPropertyChanged("ControlTag");
242
            }
243
        }
244

    
245
        //private bool _IsPageChanged { get; set; }
246
        //public bool IsPageChanged
247
        //{
248
        //    get
249
        //    {
250
        //        return _IsPageChanged;
251
        //    }
252
        //    set
253
        //    {
254
        //        _IsPageChanged = value;
255
        //        OnPropertyChanged("IsPageChanged");
256
        //    }
257
        //}
258

    
259

    
260

    
261
        ///// <summary>
262
        ///// 강인구 추가(Check List관련)
263
        ///// </summary>
264
        //public List<Check_Inferface> Check_Item
265
        //{
266
        //    get
267
        //    {
268
        //        return check_Item;
269
        //    }
270
        //}
271

    
272
        private bool _IsConsolidate { get; set; }
273
        public bool IsConsolidate
274
        {
275
            get
276
            {
277
                return _IsConsolidate;
278
            }
279
            set
280
            {
281
                _IsConsolidate = value;
282
                OnPropertyChanged("IsConsolidate");
283
            }
284
        }
285

    
286
        ////////////////////////////////////////////////
287

    
288

    
289
        #region Angle 관련
290
        private Visibility _AngleVisibility { get; set; }
291
        public Visibility AngleVisibility
292
        {
293
            get
294
            {
295
                return _AngleVisibility;
296
            }
297
            set
298
            {
299
                _AngleVisibility = value;
300
                OnPropertyChanged("AngleVisibility");
301
            }
302

    
303
        }
304
        private string _AngleValue { get; set; }
305
        public string AngleValue
306
        {
307
            get
308
            {
309
                return _AngleValue;
310
            }
311
            set
312
            {
313
                _AngleValue = value;
314
                OnPropertyChanged("AngleValue");
315
            }
316
        }
317

    
318
        private string _HelperContent { get; set; }
319
        public string HelperContent
320
        {
321
            get
322
            {
323
                return _HelperContent;
324
            }
325
            set
326
            {
327
                _HelperContent = value;
328
                OnPropertyChanged("HelperContent");
329
            }
330
        }
331

    
332
        private string _HelperHeader { get; set; }
333
        public string HelperHeader
334
        {
335
            get
336
            {
337
                return _HelperHeader;
338
            }
339
            set
340
            {
341
                _HelperHeader = value;
342
                OnPropertyChanged("HelperHeader");
343
            }
344
        }
345

    
346
        private bool _HelperExit { get; set; }
347
        public bool HelperExit
348
        {
349
            get
350
            {
351
                return _HelperExit;
352
            }
353
            set
354
            {
355
                _HelperExit = value;
356
                OnPropertyChanged("HelperExit");
357
            }
358
        }
359

    
360
        #endregion
361

    
362
        public ObservableCollection<CommentUserInfo> MarkupControls
363
        {
364
            get
365
            {
366
                return markupControls;
367
            }
368
        }
369

    
370
        public ObservableCollection<CommentUserInfo> MarkupControls_Sync
371
        {
372
            get
373
            {
374
                return markupControls_Sync;
375
            }
376
        }
377

    
378
        public ObservableCollection<CommentUserInfo> MarkupControls_USER
379
        {
380
            get
381
            {
382
                return markupControls_User;
383
            }
384
        }
385

    
386
        public StrokeCollection MarkupPens
387
        {
388
            get
389
            {
390
                return markupPens;
391
            }
392

    
393
        }
394
        #region 버튼 여부
395

    
396
        /// <summary>
397
        /// 상단 Fill 버튼이 클릭 되어있는지
398
        /// </summary>
399
        private bool _checkFillShape { get; set; }
400
        public bool checkFillShape
401
        {
402
            get
403
            {
404
                return _checkFillShape;
405
            }
406
            set
407
            {
408
                _checkFillShape = value;
409
                OnPropertyChanged("checkFillShape");
410
            }
411
        }
412

    
413
        /// <summary>
414
        /// 상단 Hatch 버튼이 클릭 되어있는지
415
        /// </summary>
416
        private bool _checkHatchShape { get; set; }
417
        public bool checkHatchShape
418
        {
419
            get
420
            {
421
                return _checkHatchShape;
422
            }
423
            set
424
            {
425
                _checkHatchShape = value;
426
                OnPropertyChanged("checkHatchShape");
427
            }
428
        }
429

    
430
        private double _controlOpacity { get; set; }
431
        public double ControlOpacity
432
        {
433
            get
434
            {
435
                return _controlOpacity;
436
            }
437
            set
438
            {
439
               
440
                _controlOpacity = value;               
441
                OnPropertyChanged("ControlOpacity");
442
            }
443
        }
444

    
445
        private MarkupToPDF.Controls.Common.PaintSet _paintSet { get; set; }
446
        public MarkupToPDF.Controls.Common.PaintSet paintSet
447
        {
448
            get
449
            {
450
                return _paintSet;
451
            }
452
            set
453
            {
454
                _paintSet = value;
455
                OnPropertyChanged("paintSet");
456
            }
457
        }
458

    
459
        /// <summary>
460
        /// 강인구 추가
461
        /// 상단 TextStyle 버튼이 클릭 되어있는지
462
        /// </summary>
463
        private bool _checkTextStyle { get; set; }
464
        public bool checkTextStyle
465
        {
466
            get
467
            {
468
                return _checkTextStyle;
469
            }
470
            set
471
            {
472
                _checkTextStyle = value;
473
                OnPropertyChanged("checkTextStyle");
474
            }
475
        }
476

    
477
        /// <summary>
478
        /// 강인구 추가
479
        /// 상단 TextWeight 버튼이 클릭 되어있는지
480
        /// </summary>
481
        private bool _checkTextWeight { get; set; }
482
        public bool checkTextWeight
483
        {
484
            get
485
            {
486
                return _checkTextWeight;
487
            }
488
            set
489
            {
490
                _checkTextWeight = value;
491
                OnPropertyChanged("checkTextWeight");
492
            }
493
        }
494

    
495
        /// <summary>
496
        /// 강인구 추가
497
        /// 상단 UnderLine 버튼이 클릭 되어있는지
498
        /// </summary>
499
        private bool _checkUnderLine { get; set; }
500
        public bool checkUnderLine
501
        {
502
            get
503
            {
504
                return _checkUnderLine;
505
            }
506
            set
507
            {
508
                _checkUnderLine = value;
509
                OnPropertyChanged("checkUnderLine");
510
            }
511
        }
512

    
513
        /// <summary>
514
        /// 상단 Hatch 버튼이 클릭 되어있는지
515
        /// </summary>
516
        private bool _checkHighShape { get; set; }
517
        public bool checkHighShape
518
        {
519
            get
520
            {
521
                return _checkHighShape;
522
            }
523
            set
524
            {
525
                _checkHighShape = value;
526
                OnPropertyChanged("checkHighShape");
527
            }
528
        }
529

    
530
        /// <summary>
531
        /// 상단 Axis 버튼이 클릭 되어있는지
532
        /// </summary>
533
        private bool _checkAxis { get; set; }
534
        public bool checkAxis
535
        {
536
            get
537
            {
538
                return _checkAxis;
539
            }
540
            set
541
            {
542
                _checkAxis = value;
543
                OnPropertyChanged("checkAxis");
544
            }
545
        }
546
        #endregion
547

    
548
        public ImageBrush BackgroundImage
549
        {
550
            get
551
            {
552
                return backgroundImage;
553
            }
554
            set
555
            {
556
                backgroundImage = value;
557
                OnPropertyChanged("BackgroundImage");
558
            }
559
        }
560

    
561
        public RasterImage rasterimage
562
        {
563
            get
564
            {
565
                return _rasterimage;
566
            }
567
            set
568
            {
569
                _rasterimage = value;
570
                OnPropertyChanged("rasterimage");
571
            }
572
        }
573

    
574

    
575
        public ObservableCollection<KCOMDataModel.DataModel.DOCPAGE> Document_Info
576
        {
577
            get
578
            {
579
                return document_Info;
580
            }
581
        }
582

    
583

    
584
        public double ContentScale
585
        {
586
            get
587
            {
588
                return contentScale;
589
            }
590
            set
591
            {
592
                contentScale = value;
593

    
594
                double minOffsetX = 0.0;
595
                double maxOffsetX = Math.Max(0.0, ContentWidth - ContentViewportWidth);
596
                contentOffsetX = Math.Min(Math.Max(contentOffsetX, minOffsetX), maxOffsetX);
597

    
598
                double minOffsetY = 0.0;
599
                double maxOffsetY = Math.Max(0.0, ContentHeight - ContentViewportHeight);
600
                contentOffsetY = Math.Min(Math.Max(contentOffsetY, minOffsetY), maxOffsetY);
601

    
602
                OnPropertyChanged("ContentScale");
603
            }
604
        }
605
        public ObservableCollection<IKCOM.MarkupInfoItem> _markupInfoList
606
        {
607
            get
608
            {
609
                return markupInfoList;
610
            }
611
            set
612
            {
613
                markupInfoList = value;
614
                OnPropertyChanged("_markupInfoList");
615
            }
616
        }
617

    
618
        public ObservableCollection<IKCOM.MarkupInfoItem> _markupInfoRevList
619
        {
620
            get
621
            {
622
                return markupInfoRevList;
623
            }
624
            set
625
            {
626
                markupInfoRevList = value;
627
                OnPropertyChanged("_markupInfoRevList");
628
            }
629
        }
630

    
631

    
632
        public double ContentOffsetX
633
        {
634
            get
635
            {
636
                return contentOffsetX;
637
            }
638
            set
639
            {
640
                double minOffsetX = 0.0;
641
                double maxOffsetX = Math.Max(0.0, ContentWidth - ContentViewportWidth);
642
                contentOffsetX = Math.Min(Math.Max(value, minOffsetX), maxOffsetX);
643
                OnPropertyChanged("ContentOffsetX");
644
            }
645
        }
646

    
647
        public double ContentOffsetY
648
        {
649
            get
650
            {
651
                return contentOffsetY;
652
            }
653
            set
654
            {
655
                double minOffsetY = 0.0;
656
                double maxOffsetY = Math.Max(0.0, ContentHeight - ContentViewportHeight);
657
                contentOffsetY = Math.Min(Math.Max(value, minOffsetY), maxOffsetY);
658
                OnPropertyChanged("ContentOffsetY");
659
            }
660
        }
661

    
662
        public MessageCollection k_talkMessageSet
663
        {
664
            get
665
            {
666
                if (_k_talkMessageSet ==null)
667
                {
668
                    _k_talkMessageSet = new MessageCollection();
669
                }
670
                return _k_talkMessageSet;
671
            }
672
            set
673
            {
674
                _k_talkMessageSet = value;
675
                OnPropertyChanged("k_talkMessageSet");
676
            }
677
        }
678

    
679
        public double ContentWidth
680
        {
681
            get
682
            {
683
                return contentWidth;
684
            }
685
            set
686
            {
687
                contentWidth = value;
688
                OnPropertyChanged("ContentWidth");
689
            }
690
        }
691

    
692
        public double ContentHeight
693
        {
694
            get
695
            {
696
                return contentHeight;
697
            }
698
            set
699
            {
700
                contentHeight = value;
701
                OnPropertyChanged("ContentHeight");
702
            }
703
        }
704

    
705
        public double ContentViewportWidth
706
        {
707
            get
708
            {
709
                return contentViewportWidth;
710
            }
711
            set
712
            {
713
                contentViewportWidth = value;
714
                OnPropertyChanged("ContentViewportWidth");
715
            }
716
        }
717

    
718
        public double ContentViewportHeight
719
        {
720
            get
721
            {
722
                return contentViewportHeight;
723
            }
724
            set
725
            {
726
                contentViewportHeight = value;
727
                OnPropertyChanged("ContentViewportHeight");
728
            }
729
        }
730

    
731
        public MainWindow SystemMain { get; set; }
732

    
733
        public double Angle
734
        {
735
            get
736
            {
737
                return angle;
738
            }
739
            set
740
            {
741
                angle = value;
742
                OnPropertyChanged("Angle");
743
            }
744
        }
745

    
746
        private bool _PageBalanceMode { get; set; }
747
        public bool PageBalanceMode
748
        {
749
            get
750
            {
751
                return _PageBalanceMode;
752
            }
753
            set
754
            {
755
                _PageBalanceMode = value;
756
                OnPropertyChanged("PageBalanceMode");
757
            }
758
        }
759

    
760
        private int _PageBalanceNumber { get; set; }
761
        public int PageBalanceNumber
762
        {
763
            get
764
            {
765
                return _PageBalanceNumber;
766
            }
767
            set
768
            {
769
                _PageBalanceNumber = value;
770
                OnPropertyChanged("PageBalanceNumber");
771
            }
772
        }
773

    
774
        private int _PageNumber { get; set; }
775
        public int PageNumber
776
        {
777
            get
778
            {
779
                return _PageNumber;
780
            }
781
            set
782
            {
783
                _PageNumber = value;
784
                OnPropertyChanged("PageNumber");
785
            }
786
        }
787

    
788
        public double AngleOffsetX
789
        {
790
            get
791
            {
792
                return angleOffsetX;
793
            }
794
            set
795
            {
796
                angleOffsetX = value;
797
                OnPropertyChanged("AngleOffsetX");
798
            }
799
        }
800

    
801
        public double AngleOffsetY
802
        {
803
            get
804
            {
805
                return angleOffsetY;
806
            }
807
            set
808
            {
809
                angleOffsetY = value;
810
                OnPropertyChanged("AngleOffsetY");
811
            }
812
        }
813

    
814
        //강인구 추가(체크리스트)
815
        private string _CheckList_ID { get; set; }
816
        public string CheckList_ID
817
        {
818
            get
819
            {
820
                return _CheckList_ID;
821
            }
822
            set
823
            {
824
                _CheckList_ID = value;
825
                OnPropertyChanged("CheckList_ID");
826
            }
827
        }
828
        //강인구 추가(캡쳐 모드)
829
        private double _Capture_Opacity { get; set; }
830
        public double Capture_Opacity
831
        {
832
            get
833
            {
834
                return _Capture_Opacity;
835
            }
836
            set
837
            {
838
                _Capture_Opacity = value;
839
                OnPropertyChanged("Capture_Opacity");
840
            }
841
        }
842

    
843
        private Visibility _ViewVisible { get; set; }
844
        public Visibility ViewVisible
845
        {
846
            get
847
            {
848
                return _ViewVisible;
849
            }
850
            set
851
            {
852
                _ViewVisible = value;
853
                OnPropertyChanged("ViewVisible");
854
            }
855
        }
856
        private bool _IsSync { get; set; }
857
        public bool IsSync
858
        {
859
            get
860
            {
861
                return _IsSync;
862
            }
863
            set
864
            {
865
                _IsSync = value;
866
                OnPropertyChanged("IsSync");
867
            }
868
        }
869

    
870

    
871

    
872
        #endregion Property Member
873

    
874
        public System.IO.Stream GetStreamFromUrl(string url)
875
        {
876
            byte[] imageData = null;
877

    
878
            using (var wc = new System.Net.WebClient())
879
                imageData = wc.DownloadData(url);
880

    
881
            return new System.IO.MemoryStream(imageData);
882
        }
883

    
884
        public ViewerDataModel()
885
        {
886
            //rectangles.Add(new RectangleData(50, 50, 80, 150, Colors.Blue));
887
            //rectangles.Add(new RectangleData(550, 350, 80, 150, Colors.Green));
888
            //rectangles.Add(new RectangleData(850, 850, 30, 20, Colors.Purple));
889
            //rectangles.Add(new RectangleData(1850, 1850, 80, 150, Colors.Red));
890

    
891
            //RectangleControl rect1 = new RectangleControl();
892
            //rect1.StartPoint = new Point(50, 50);
893
            //rect1.LeftBottomPoint = new Point(100, 50);
894
            //rect1.TopRightPoint = new Point(50, 100);
895
            //rect1.EndPoint = new Point(100, 100);
896
            //rect1.FillColor = new SolidColorBrush(Colors.Red);
897
            //rectangles.Add(rect1);
898
            //
899
            // Populate the data model with some example data.
900
            //
901
            //rectangles.Add(new RectangleData(50, 50, 80, 150, Colors.Blue));
902
            //rectangles.Add(new RectangleData(550, 350, 80, 150, Colors.Green));
903
            //rectangles.Add(new RectangleData(850, 850, 30, 20, Colors.Purple));
904
            //rectangles.Add(new RectangleData(1850, 1850, 80, 150, Colors.Red));
905

    
906
            this.ControlOpacity = 1;
907
            //강인구 추가
908
            
909
            this.LineSize = 3;
910

    
911
            this.DashSize = new DoubleCollection(99999999);
912
        }
913

    
914
        #region INotifyPropertyChanged Event
915

    
916
        private void OnPropertyChanged(string name)
917
        {
918
            if (PropertyChanged != null)
919
            {
920
                PropertyChanged(this, new PropertyChangedEventArgs(name));
921
            }
922
        }
923

    
924
        public event PropertyChangedEventHandler PropertyChanged;
925

    
926
        #endregion
927
    }
928
}
클립보드 이미지 추가 (최대 크기: 500 MB)