프로젝트

일반

사용자정보

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

markus / MarkupToPDF / Controls / Polygon / PolygonControl.cs @ b2d0f316

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

1
using iTextSharp.text;
2
using MarkupToPDF.Common;
3
using MarkupToPDF.Controls.Common;
4
using MarkupToPDF.Serialize.Core;
5
using MarkupToPDF.Serialize.S_Control;
6
using System;
7
using System.Collections.Generic;
8
using System.ComponentModel;
9
using System.Linq;
10
using System.Text;
11
using System.Threading.Tasks;
12
using System.Windows;
13
using System.Windows.Controls;
14
using System.Windows.Forms;
15
using System.Windows.Input;
16
using System.Windows.Media;
17
using System.Windows.Shapes;
18

    
19
namespace MarkupToPDF.Controls.Polygon
20
{
21
     public class PolygonControl : CommentUserInfo, IDisposable, INotifyPropertyChanged, IShapeControl, IMarkupControlData
22
    {
23
        #region Constructure
24

    
25
        static PolygonControl()
26
        {
27
            DefaultStyleKeyProperty.OverrideMetadata(typeof(PolygonControl), new FrameworkPropertyMetadata(typeof(PolygonControl)));
28
            //ResourceDictionary dictionary = new ResourceDictionary();
29
            //dictionary.Source = new Uri("/MarkupToPDF;component/themes/generic.xaml", UriKind.RelativeOrAbsolute);
30
            //Application.Current.Resources.MergedDictionaries.Add(dictionary);
31
        }
32

    
33
        public PolygonControl()
34
        {
35
            //this.DefaultStyleKey = typeof(PolygonControl);
36
        }
37

    
38
        public override void Copy(CommentUserInfo lhs)
39
        {
40
            if(lhs is PolygonControl item)
41
            {
42
                this.LineSize = item.LineSize;
43
                this.IsCompleted = item.IsCompleted;
44
                this.Opacity = item.Opacity;
45
                this.StrokeColor = item.StrokeColor;
46
                this.ControlType = item.ControlType;
47
                this.DashSize = item.DashSize;
48
                this.StartPoint = new Point(item.StartPoint.X, item.StartPoint.Y);
49
                this.EndPoint = new Point(item.EndPoint.X, item.EndPoint.Y);
50
                this.PointSet = item.PointSet.ConvertAll(x => new Point(x.X, x.Y));
51
                this.UserID = item.UserID;
52
                this.Paint = item.Paint;
53
                this.Memo = item.Memo;
54
                this.ZIndex = item.ZIndex;
55
            }
56
        }
57

    
58
        public override CommentUserInfo Clone()
59
        {
60
            var clone = new PolygonControl();
61
            clone.Copy(this);
62
            return clone; 
63
        }
64

    
65
        #endregion
66

    
67
        #region Variable
68
        private const string PART_PolyPath = "PART_PolyPath";
69

    
70
        public Path Base_PolyPath = null;
71

    
72
        #endregion
73

    
74
        #region Internal Method
75
        public override void OnApplyTemplate()
76
        {   
77
            base.OnApplyTemplate();
78

    
79
            Base_PolyPath = GetTemplateChild(PART_PolyPath) as Path;
80

    
81
            if (Base_PolyPath == null)
82
                return;
83

    
84
            this.SetPolyPath();
85
        }
86

    
87

    
88
        #endregion
89

    
90
        #region Method
91

    
92
        public override void ApplyOverViewData()
93
        {
94
            this.OverViewPathData = this.PathData;
95
        }
96

    
97
        #endregion
98

    
99
        #region Dependency Properties
100

    
101
        public static readonly DependencyProperty UserIDProperty = DependencyProperty.Register(
102
                "UserID", typeof(string), typeof(PolygonControl), new PropertyMetadata(null));
103

    
104
        public static readonly DependencyProperty LineSizeProperty = DependencyProperty.Register(
105
              "LineSize", typeof(double), typeof(PolygonControl), new PropertyMetadata((Double)3));
106

    
107
        public static readonly DependencyProperty StrokeColorProperty = DependencyProperty.Register(
108
               "StrokeColor", typeof(SolidColorBrush), typeof(PolygonControl), 
109
               new PropertyMetadata(new SolidColorBrush(Colors.Red)));
110

    
111
        public static readonly DependencyProperty PathDataProperty = DependencyProperty.Register(
112
                "PathData", typeof(Geometry), typeof(PolygonControl), null);
113

    
114
        //강인구 추가
115
        public static readonly DependencyProperty DashSizeProperty = DependencyProperty.Register(
116
                "DashSize", typeof(DoubleCollection), typeof(PolygonControl), new PropertyMetadata(new DoubleCollection { 99999999  }, PointValueChanged));
117

    
118
        public static readonly DependencyProperty OverViewPathDataProperty = DependencyProperty.Register(
119
                "OverViewPathData", typeof(Geometry), typeof(PolygonControl), null);
120
        //강인구 추가
121
        public static readonly DependencyProperty PaintProperty = DependencyProperty.Register(
122
        "Paint", typeof(PaintSet), typeof(PolygonControl), new PropertyMetadata(PaintSet.None, PointValueChanged));
123

    
124
        public static readonly DependencyProperty IsCompletedProperty = DependencyProperty.Register(
125
               "IsCompleted", typeof(bool), typeof(PolygonControl), null);
126

    
127
        public static readonly DependencyProperty StartPointProperty = DependencyProperty.Register(
128
               "StartPoint", typeof(Point), typeof(PolygonControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
129

    
130
        public static readonly DependencyProperty EndPointProperty = DependencyProperty.Register(
131
               "EndPoint", typeof(Point), typeof(PolygonControl), new PropertyMetadata(new Point(100, 100), PointValueChanged));
132

    
133
        public static readonly DependencyProperty PointSetProperty = DependencyProperty.Register(
134
                "PointSet", typeof(List<Point>), typeof(PolygonControl), new PropertyMetadata(new List<Point>(), PointValueChanged));
135

    
136
        /// <summary>
137
        /// StylusPointSet을 List<Point>로 대체하면 PointValueChanged가 작동안한다.
138
        /// </summary>
139
        //public static readonly DependencyProperty StylusPointSetProperty = DependencyProperty.Register(
140
        //        "PointC", typeof(StylusPointSet), typeof(PolygonControl), new PropertyMetadata(new StylusPointSet(), PointValueChanged));
141

    
142
        public static readonly DependencyProperty AngleProperty =
143
            DependencyProperty.Register("Angle", typeof(double), typeof(PolygonControl), new PropertyMetadata((double)0.0, new PropertyChangedCallback
144
                (AngleValueChanged)));
145

    
146
        public static readonly DependencyProperty CenterXProperty =
147
            DependencyProperty.Register("CenterX", typeof(double), typeof(PolygonControl), new PropertyMetadata((double)0, OnCenterXYChanged));
148

    
149
        public static readonly DependencyProperty CenterYProperty =
150
            DependencyProperty.Register("CenterY", typeof(double), typeof(PolygonControl), new PropertyMetadata((double)0, OnCenterXYChanged));
151

    
152
        public static readonly DependencyProperty IsSelectedProperty =
153
            DependencyProperty.Register("IsSelected", typeof(bool), typeof(PolygonControl), new FrameworkPropertyMetadata(false, IsSelectedChanged));
154

    
155
        public static readonly DependencyProperty ControlTypeProperty =
156
            DependencyProperty.Register("ControlType", typeof(ControlType), typeof(PolygonControl), new FrameworkPropertyMetadata(ControlType.PolygonControl));
157

    
158
        public static readonly DependencyProperty CanvasXProperty = DependencyProperty.Register(
159
                "CanvasX", typeof(double), typeof(PolygonControl), new PropertyMetadata((double)0, OnSetCansvasChanged));
160

    
161
        public static readonly DependencyProperty CanvasYProperty = DependencyProperty.Register(
162
                "CanvasY", typeof(double), typeof(PolygonControl), new PropertyMetadata((double)0, OnSetCansvasChanged));
163

    
164
        #endregion
165

    
166
        #region PropertyChanged Method
167
        public static void OnSetCansvasChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
168
        {
169
            var instance = (PolygonControl)sender;
170

    
171
            if (e.OldValue != e.NewValue && instance != null)
172
            {
173
                instance.SetValue(e.Property, e.NewValue);
174
                //Canvas.SetLeft(instance, instance.CanvasX);
175
                //Canvas.SetTop(instance, instance.CanvasY);
176
            }
177
        }
178

    
179
        public static void PointValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
180
        {
181
            var instance = (PolygonControl)sender;
182

    
183
            if (e.OldValue != e.NewValue && instance != null)
184
            {
185
                instance.SetValue(e.Property, e.NewValue);
186
                //강인구 추가
187
                instance.SetPolyPath();
188
                //instance.SetPolyPath(); 주석처리
189

    
190
            }
191
        }
192
        public static void AngleValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
193
        {
194
            var instance = (PolygonControl)sender;
195

    
196
            if (e.OldValue != e.NewValue && instance != null)
197
            {
198
                instance.SetValue(e.Property, e.NewValue);
199
                instance.SetPolyPath();
200
            }
201
        }
202
        public static void OnCenterXYChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
203
        {
204
            var instance = (PolygonControl)sender;
205
            if (e.OldValue != e.NewValue && instance != null)
206
            {
207
                instance.SetValue(e.Property, e.NewValue);
208
                instance.SetPolyPath();
209
            }
210
        }
211

    
212
        public static void IsSelectedChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
213
        {
214
            //var instance = (PolygonControl)sender;
215

    
216
            //if (e.OldValue != e.NewValue && instance.Base_PolyPath != null)
217
            //{
218
            //    instance.SetValue(e.Property, e.NewValue);
219

    
220
            //    if (instance.IsSelected)
221
            //    {
222
            //        instance.Base_PolyPath.Stroke = new SolidColorBrush(Colors.Blue);
223
            //    }
224
            //    else
225
            //    {
226
            //        instance.Base_PolyPath.Stroke = new SolidColorBrush(Colors.Transparent);
227
            //    }
228
            //}
229
        }
230

    
231
        #endregion
232

    
233
        #region Properties
234

    
235

    
236
        public bool IsCompleted
237
        {
238
            get { return (bool)GetValue(IsCompletedProperty); }
239
            set
240
            {
241
                SetValue(IsCompletedProperty, value);
242
                OnPropertyChanged("IsCompleted");
243
            }
244
        }
245

    
246

    
247
        public Geometry OverViewPathData
248
        {
249
            get { return (Geometry)GetValue(OverViewPathDataProperty); }
250
            set
251
            {
252
                SetValue(OverViewPathDataProperty, value);
253
                OnPropertyChanged("OverViewPathData");
254
            }
255
        }
256

    
257
        public double CanvasX
258
        {
259
            get { return (double)GetValue(CanvasXProperty); }
260
            set
261
            {
262
                if (this.CanvasX != value)
263
                {
264
                    SetValue(CanvasXProperty, value);
265
                    OnPropertyChanged("CanvasX");
266
                }
267
            }
268
        }
269

    
270
        public double CanvasY
271
        {
272
            get { return (double)GetValue(CanvasYProperty); }
273
            set
274
            {
275
                if (this.CanvasY != value)
276
                {
277
                    SetValue(CanvasYProperty, value);
278
                    OnPropertyChanged("CanvasY");
279
                }
280
            }
281
        } 
282

    
283
        public override bool IsSelected
284
        {
285
            get
286
            {
287
                return (bool)GetValue(IsSelectedProperty);
288
            }
289
            set
290
            {
291
                SetValue(IsSelectedProperty, value);
292
                OnPropertyChanged("IsSelected");
293
            }
294
        }
295

    
296
        public PaintSet Paint
297
        {
298
            get { return (PaintSet)GetValue(PaintProperty); }
299
            set
300
            {
301
                if (this.Paint != value)
302
                {
303
                    SetValue(PaintProperty, value);
304
                    OnPropertyChanged("Paint");
305
                }
306
            }
307
        }
308

    
309
        public override ControlType ControlType
310
        {
311
            set
312
            {
313
                SetValue(ControlTypeProperty, value);
314
                OnPropertyChanged("ControlType");
315
            }
316
            get
317
            {
318
                return (ControlType)GetValue(ControlTypeProperty);
319
            }
320
        }
321

    
322
        public Double LineSize
323
        {
324
            get { return (Double)GetValue(LineSizeProperty); }
325
            set
326
            {
327
                if (this.LineSize != value)
328
                {
329
                    SetValue(LineSizeProperty, value);
330
                    OnPropertyChanged("LineSize");
331
                }
332
            }
333
        }
334

    
335
        public DoubleCollection DashSize
336
        {
337
            get { return (DoubleCollection)GetValue(DashSizeProperty); }
338
            set
339
            {
340
                if (this.DashSize != value)
341
                {
342
                    SetValue(DashSizeProperty, value);
343
                    OnPropertyChanged("DashSize");
344
                }
345
            }
346
        }
347
        public string UserID
348
        {
349
            get { return (string)GetValue(UserIDProperty); }
350
            set
351
            {
352
                if (this.UserID != value)
353
                {
354
                    SetValue(UserIDProperty, value);
355
                    OnPropertyChanged("UserID");
356
                }
357
            }
358
        }
359
        public List<Point> PointSet
360
        {
361
            get { return (List<Point>)GetValue(PointSetProperty); }
362
            set { SetValue(PointSetProperty, value);
363
            OnPropertyChanged("PointSet");
364
            }
365
        }        //public StylusPointSet PointC
366
        //{
367
        //    get { return (StylusPointSet)GetValue(StylusPointSetProperty); }
368
        //    set
369
        //    {
370
        //        SetValue(StylusPointSetProperty, value);
371
        //        OnPropertyChanged("PointC");
372
        //    }
373
        //}
374

    
375

    
376
        public double CenterX
377
        {
378
            get { return (double)GetValue(CenterXProperty); }
379
            set { SetValue(CenterXProperty, value);
380
            OnPropertyChanged("CenterX");
381
            }
382
        }
383
        public double CenterY
384
        {
385
            get
386
            {
387
                return (double)GetValue(CenterYProperty);
388
            }
389
            set
390
            {
391
                SetValue(CenterYProperty, value);
392
                OnPropertyChanged("CenterY");
393
            }
394
        }
395
        public override SolidColorBrush StrokeColor
396
        {
397
            get { return (SolidColorBrush)GetValue(StrokeColorProperty); }
398
            set
399
            {
400
                if (this.StrokeColor != value)
401
                {
402
                    SetValue(StrokeColorProperty, value);
403
                    OnPropertyChanged("StrokeColor");
404
                }
405
            }
406
        }
407
        public Geometry PathData
408
        {
409
            get { return (Geometry)GetValue(PathDataProperty); }
410
            set
411
            {
412
                SetValue(PathDataProperty, value);
413
                OnPropertyChanged("PathData");
414
            }
415
        }
416
     
417
        //public double Angle
418
        //{
419
        //    get { return (double)GetValue(AngleProperty); }
420
        //    set
421
        //    {
422
        //        if (this.Angle != value)
423
        //        {
424
        //            SetValue(AngleProperty, value);
425
        //            OnPropertyChanged("Angle");
426
        //        }
427
        //    }
428
        //}
429

    
430
        public Point EndPoint
431
        {
432
            get { return (Point)GetValue(EndPointProperty); }
433
            set
434
            {
435
                SetValue(EndPointProperty, value);
436
                OnPropertyChanged("EndPoint");
437
            }
438
        }
439
        public Point StartPoint
440
        {
441
            get { return (Point)GetValue(StartPointProperty); }
442
            set
443
            {
444
                SetValue(StartPointProperty, value);
445
                OnPropertyChanged("StartPoint");
446
            }
447
        }
448
        #endregion
449

    
450
        public override void UpdateControl()
451
        {
452
            this.StartPoint = new Point(this.PointSet[0].X, this.PointSet[0].Y);
453
            this.EndPoint = new Point(this.PointSet[this.PointSet.Count - 1].X, this.PointSet[this.PointSet.Count - 1].Y);
454

    
455
            SetPolyPath();
456
        }
457

    
458
        private void SetPolyPath()
459
        {
460
            if (Base_PolyPath != null)
461
            {
462
                Base_PolyPath.StrokeDashArray.Clear();
463
                foreach (var item in this.DashSize)
464
                {
465
                    Base_PolyPath.StrokeDashArray.Add(item);
466
                }
467

    
468
                PathGeometry pathGeometry = new PathGeometry();
469
                PathFigure pathFigure = new PathFigure();
470
                PolyLineSegment instance = new PolyLineSegment(this.PointSet, true);
471
               
472
                StartPoint = instance.Points.First();
473
                pathFigure.StartPoint = StartPoint;
474
                EndPoint = instance.Points.Last();
475
                pathFigure.Segments.Add(instance);
476
                pathGeometry.Figures.Add(pathFigure);
477

    
478
                //강인구 추가(Chain이 아닌 Polygon일때만 채우기 및 빗금 하기)
479
                if (ControlType == ControlType.PolygonControl)
480
                {
481
                    switch (this.Paint)
482
                    {
483
                        case PaintSet.None:
484
                            {
485
                                pathFigure.IsFilled = false;
486
                                //강인구 추가
487
                                Base_PolyPath.Fill = null;
488
                            }
489
                            break;
490
                        case PaintSet.Fill:
491
                            {
492
                                Base_PolyPath.Fill = this.StrokeColor;
493
                            }
494
                            break;
495
                        case PaintSet.Hatch:
496
                            {
497
                                var size = this.LineSize > 5 ? 5 : this.LineSize;
498
                                Base_PolyPath.Fill = HatchMake.CreateHatchBrush(this.StrokeColor, 3 * 0.1);
499
                            }
500
                            break;
501
                        default:
502
                            break;
503
                    }
504
                }
505

    
506
                this.PathData = pathGeometry;
507
                this.ApplyOverViewData();
508
            }
509
        }
510

    
511
        public void ChangePaint(PaintSet state)
512
        {
513

    
514
        }
515

    
516
        /// <summary>
517
        /// call when mouse is moving while drawing control
518
        /// </summary>
519
        /// <author>humkyung</author>
520
        /// <param name="pt"></param>
521
        /// <param name="bAxisLocked"></param>
522
        public override void OnCreatingMouseMove(Point pt, bool bAxisLocked)
523
        {
524
            this.PointSet.RemoveAt(this.PointSet.Count - 1);
525

    
526
            Point tmp = pt;
527

    
528
            if (bAxisLocked)
529
            {
530
                CommentAngle = MathSet.returnAngle(this.PointSet[this.PointSet.Count - 1], ref tmp, bAxisLocked);
531
            }
532

    
533
            if (this.PointSet.Count > 2 && StartPoint == tmp)
534
            {
535
                this.IsCompleted = true;
536

    
537
                //var firstPoint = this.PointSet.First();
538
                //this.PointSet.Add(firstPoint);
539

    
540
                //this.ApplyOverViewData();
541

    
542
                UpdateControl();
543
            }
544
            else
545
            {
546

    
547
                this.PointSet.Add(tmp);
548

    
549
                this.UpdateControl();
550
            }
551
        }
552

    
553
        /// <summary>
554
        /// move control point has same location of given pt along given delta
555
        /// </summary>
556
        /// <author>humkyung</author>
557
        /// <date>2019.06.20</date>
558
        /// <param name="pt"></param>
559
        /// <param name="dx"></param>
560
        /// <param name="dy"></param>
561
        public override void OnMoveCtrlPoint(Point pt, double dx, double dy, bool bAxisLocked = false)
562
        {
563
            var pointSet = (this as IPath).PointSet;
564

    
565
            Point selected = MathSet.getNearPoint(pointSet, pt);
566

    
567
            Point NearStartpoint = MathSet.getNearPoint(pointSet, pt);
568

    
569
            var tmpPointSet = pointSet.Select((x,inx)=> new { x,inx});
570

    
571
            var selectPoint = tmpPointSet.Where(x => x.x.Equals(pt));
572

    
573
            if(selectPoint.Count() > 0)
574
            {
575
                if (tmpPointSet.Count() > selectPoint.First().inx + 1)
576
                {
577
                    NearStartpoint = pointSet[selectPoint.First().inx + 1];
578
                }
579
                else
580
                {
581
                    NearStartpoint = pointSet[selectPoint.First().inx - 1];
582
                }
583
            }
584

    
585
            selected.X += dx;
586
            selected.Y += dy;
587

    
588
            Point tmp = selected;
589

    
590
            CommentAngle = MathSet.returnAngle(NearStartpoint, ref tmp, bAxisLocked);
591

    
592
            if (bAxisLocked)
593
            {
594
                selected = tmp;
595
            }
596

    
597
            for (int i = 0; i < (this as IPath).PointSet.Count; i++)
598
            {
599
                if (pt.Equals((this as IPath).PointSet[i]))
600
                {
601
                    (this as IPath).PointSet[i] = selected;
602
                }
603
            }
604
            this.UpdateControl();
605
        }
606

    
607
        /// <summary>
608
        /// return Polygon's area
609
        /// </summary>
610
        /// <author>humkyung</author>
611
        /// <date>2019.06.13</date>
612
        public override Rect ItemRect
613
        {
614
            get
615
            {
616
                double dMinX = double.MaxValue;
617
                double dMinY = double.MaxValue;
618
                double dMaxX = double.MinValue;
619
                double dMaxY = double.MinValue;
620
                foreach (Point pt in this.PointSet)
621
                {
622
                    dMinX = Math.Min(dMinX, pt.X);
623
                    dMinY = Math.Min(dMinY, pt.Y);
624
                    dMaxX = Math.Max(dMaxX, pt.X);
625
                    dMaxY = Math.Max(dMaxY, pt.Y);
626
                }
627

    
628
                return new Rect(new Point(dMinX, dMinY), new Point(dMaxX, dMaxY));
629
            }
630
        }
631

    
632
        /// <summary>
633
        /// Serialize this
634
        /// </summary>
635
        /// <param name="sUserId"></param>
636
        /// <returns></returns>
637
        public override string Serialize()
638
        {
639
            using (S_PolyControl ctrl = new S_PolyControl())
640
            {
641
                ctrl.TransformPoint = "0|0";
642
                ctrl.SizeSet = String.Format("{0}", this.LineSize);
643
                ctrl.StrokeColor = this.StrokeColor.Color.ToString();
644
                //ctrl.StrokeColor = "#FF000FFF";
645
                ctrl.Name = this.GetType().Name.ToString();
646
                //ctrl.Toler = this.Toler;
647
                ctrl.PaintState = this.Paint;
648
                ctrl.Opac = this.Opacity;
649
                ctrl.UserID = this.UserID;
650
                ctrl.PaintState = this.Paint;
651
                //강인구 추가(Chain인지 Polygon인지 구분)
652
                ctrl.Type = this.ControlType;
653
                //ctrl.IsTrans = this.isTransOn;
654
                //ctrl.IsChain = this.isChain;
655
                ctrl.PointSet = new List<Point>();
656
                ctrl.DashSize = this.DashSize;
657
                ctrl.StartPoint = this.StartPoint;
658
                ctrl.EndPoint = this.EndPoint;
659
                ctrl.IsCompleted = this.IsCompleted;
660
                foreach (var point in this.PointSet)
661
                {
662
                    ctrl.PointSet.Add(point);
663
                }
664
                ///강인구 추가(2017.11.02)
665
                ///Memo 추가
666
                ctrl.Memo = this.Memo;
667

    
668
                ctrl.ZIndex = this.ZIndex;
669

    
670
                return "|DZ|" + JsonSerializerHelper.CompressString((ctrl.JsonSerialize()));
671
            }
672
        }
673

    
674
        /// <summary>
675
        /// create a polygoncontrol from given string
676
        /// </summary>
677
        /// <param name="str"></param>
678
        /// <returns></returns>
679
        public static PolygonControl FromString(string str, SolidColorBrush brush, string sProjectNo)
680
        {
681
            using (S_PolyControl s = JsonSerializerHelper.JsonDeserialize<S_PolyControl>(str))
682
            {
683
                string[] data2 = s.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
684
                return new PolygonControl
685
                {
686
                    LineSize = Convert.ToDouble(data2.First()),
687
                    //Toler = s.Toler,
688
                    IsCompleted = s.IsCompleted,
689
                    //PointSet = new List<Point>(),
690
                    Opacity = s.Opac,
691
                    StrokeColor = brush,
692
                    //강인구 추가(Chain인지 Polygon인지 구분)
693
                    ControlType = s.Type,
694
                    DashSize = s.DashSize,
695
                    StartPoint = s.StartPoint,
696
                    EndPoint = s.EndPoint,
697
                    PointSet = s.PointSet,
698
                    UserID = s.UserID,
699
                    Paint = s.PaintState,
700
                    Memo = s.Memo,
701
                    ZIndex = s.ZIndex
702
                };
703
            }
704
        }
705

    
706

    
707
        #region Dispose
708
        public void Dispose()
709
        {
710
            //GC.Collect();
711
            ////GC.SuppressFinalize(this);
712
            this.Base_PolyPath = null;
713
        }
714
        #endregion
715

    
716
        #region INotifyPropertyChanged
717
        private void OnPropertyChanged(string name)
718
        {
719
            if (PropertyChanged != null)
720
            {
721
                PropertyChanged(this, new PropertyChangedEventArgs(name));
722
            }
723
        }
724

    
725
        public event PropertyChangedEventHandler PropertyChanged;
726
        #endregion
727
    }
728

    
729
    public class StylusPointSet : INotifyPropertyChanged
730
    {
731
        public StylusPointSet()
732
        {
733
            if (pointSet == null)
734
                pointSet = new List<Point>();
735
        }
736

    
737
        public List<Point> _pointSet;
738

    
739
        public List<Point> pointSet
740
        {
741
            get
742
            {
743
                return _pointSet;
744
            }
745
            set
746
            {
747
                _pointSet = value;
748
                OnPropertyChanged("pointSet");
749
            }
750
        }
751

    
752
        #region INotifyPropertyChanged
753
        private void OnPropertyChanged(string name)
754
        {
755
            if (PropertyChanged != null)
756
            {
757
                PropertyChanged(this, new PropertyChangedEventArgs(name));
758
            }
759
        }
760

    
761
        public event PropertyChangedEventHandler PropertyChanged;
762
        #endregion
763
    }
764
}
클립보드 이미지 추가 (최대 크기: 500 MB)