프로젝트

일반

사용자정보

개정판 77aed3c3

ID77aed3c3f852a706ccc06033c9fd434b1c6fbd73
상위 7fd49eab
하위 d686f306

백흠경이(가) 11달 전에 추가함

...

Change-Id: Ica771b240b3c5a4d6b105bba9c9bdc85e4222554

차이점 보기:

MarkupToPDF/Controls/Polygon/CloudControl.cs.bak
1
using System;
2
using System.Net;
3
using System.Windows;
4
using System.Windows.Controls;
5
using System.Windows.Documents;
6
using System.Windows.Ink;
7
using System.Windows.Input;
8
using System.Windows.Media;
9
using System.Windows.Media.Animation;
10
using System.Windows.Shapes;
11
using System.Collections.Generic;
12
using System.ComponentModel;
13
using MarkupToPDF.Controls.Common;
14
using MarkupToPDF.Common;
15

  
16
namespace MarkupToPDF.Controls.Polygon
17
{
18
    public class CloudControl : CommentUserInfo, IDisposable, INotifyPropertyChanged, IPath, IShapeControl, ICloudControl, IDashControl
19
    {
20
        private const string PART_CloudPath = "PART_CloudPath";
21
        private const string PART_CloudSubPath = "PART_CloudSubPath";
22

  
23
        public Path Base_CloudPath = null;
24
        public Path Base_CloudSubPath = null;
25

  
26
        static CloudControl()
27
        {
28
            DefaultStyleKeyProperty.OverrideMetadata(typeof(CloudControl), new FrameworkPropertyMetadata(typeof(CloudControl)));
29
            //Application.Current.Resources.MergedDictionaries.Add(Application.LoadComponent(new Uri("/MarkupToPDF;Component/Themes/generic.xaml")) as ResourceDictionary);
30
            ResourceDictionary dictionary = new ResourceDictionary();
31
            dictionary.Source = new Uri("/MarkupToPDF;component/themes/generic.xaml", UriKind.RelativeOrAbsolute);
32
            Application.Current.Resources.MergedDictionaries.Add(dictionary);
33
        }
34
        public CloudControl()
35
        {
36
            this.DefaultStyleKey = typeof(CloudControl);
37
        }
38

  
39
        #region Dependency Properties
40
        public static readonly DependencyProperty UserIDProperty = DependencyProperty.Register(
41
                "UserID", typeof(string), typeof(CloudControl), new PropertyMetadata(null));
42
        public static readonly DependencyProperty LineSizeProperty = DependencyProperty.Register(
43
                "LineSize", typeof(double), typeof(CloudControl), new PropertyMetadata((Double)3));
44
        public static readonly DependencyProperty DashSizeProperty = DependencyProperty.Register(
45
                 "DashSize", typeof(DoubleCollection), typeof(CloudControl), new PropertyMetadata(new DoubleCollection {7,7,1,7 }));
46
        public static readonly DependencyProperty FillColorProperty = DependencyProperty.Register(
47
                "FillColor", typeof(SolidColorBrush), typeof(CloudControl), new PropertyMetadata(new SolidColorBrush(Colors.Red)));
48

  
49
        public static readonly DependencyProperty IsCompletedProperty = DependencyProperty.Register(
50
                "IsCompleted", typeof(bool), typeof(CloudControl), null);
51

  
52
        public static readonly DependencyProperty PaintProperty = DependencyProperty.Register(
53
                "Paint", typeof(PaintSet), typeof(CloudControl), new PropertyMetadata(PaintSet.None));
54

  
55
        public static readonly DependencyProperty StrokeColorProperty = DependencyProperty.Register(
56
                "StrokeColor", typeof(SolidColorBrush), typeof(CloudControl), new PropertyMetadata(new SolidColorBrush(Colors.Red)));
57

  
58
        public static readonly DependencyProperty PathDataProperty = DependencyProperty.Register(
59
                "PathData", typeof(Geometry), typeof(CloudControl), null);
60

  
61
        public static readonly DependencyProperty PathSubDataProperty = DependencyProperty.Register(
62
                "PathSubData", typeof(Geometry), typeof(CloudControl), null);
63

  
64
        public static readonly DependencyProperty EndPointProperty = DependencyProperty.Register(
65
                "EndPoint", typeof(Point), typeof(CloudControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
66

  
67
        public static readonly DependencyProperty StartPointProperty = DependencyProperty.Register(
68
                "StartPoint", typeof(Point), typeof(CloudControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
69

  
70
        public static readonly DependencyProperty PointSetProperty = DependencyProperty.Register(
71
                "PointSet", typeof(List<Point>), typeof(CloudControl), new PropertyMetadata(new List<Point>(), PointValueChanged));
72
        public static readonly DependencyProperty isTransOnProperty = DependencyProperty.Register(
73
                "isTransOn", typeof(bool), typeof(CloudControl), new PropertyMetadata(false));
74
        public static readonly DependencyProperty isChainProperty = DependencyProperty.Register(
75
                "isChain", typeof(bool), typeof(CloudControl), new PropertyMetadata(false));
76
       
77
        /// <summary>
78
        /// StylusPointSet을 List<Point>로 대체하면 PointValueChanged가 작동안한다.
79
        /// </summary>
80
        public static readonly DependencyProperty StylusPointSetProperty = DependencyProperty.Register(
81
               "PointC", typeof(StylusPointSet), typeof(CloudControl), new PropertyMetadata(new StylusPointSet(), PointValueChanged));
82

  
83
        public static readonly DependencyProperty AngleProperty = DependencyProperty.Register("AngleValue", typeof(double), typeof(CloudControl),
84
            new PropertyMetadata((double)0.0, new PropertyChangedCallback(AngleValueChanged)));
85

  
86
        public static readonly DependencyProperty CenterXProperty = DependencyProperty.Register("CenterX", typeof(double), typeof(CloudControl),
87
            new PropertyMetadata((double)0, OnCenterXYChanged));
88

  
89
        public static readonly DependencyProperty CenterYProperty = DependencyProperty.Register("CenterY", typeof(double), typeof(CloudControl),
90
            new PropertyMetadata((double)0, OnCenterXYChanged));
91

  
92
        public static readonly DependencyProperty IsSelectedProperty =
93
    DependencyProperty.Register("IsSelected", typeof(bool), typeof(CloudControl), new FrameworkPropertyMetadata(false, IsSelectedChanged));
94

  
95
        public static readonly DependencyProperty ControlTypeProperty =
96
            DependencyProperty.Register("ControlType", typeof(ControlType), typeof(CloudControl), new FrameworkPropertyMetadata(ControlType.PolygonCloud));
97

  
98
        public static readonly DependencyProperty OverViewPathDataProperty = DependencyProperty.Register(
99
        "OverViewPathData", typeof(Geometry), typeof(ControlType), null);
100

  
101

  
102
        public static readonly DependencyProperty CanvasXProperty = DependencyProperty.Register(
103
                "CanvasX", typeof(double), typeof(CloudControl), new PropertyMetadata((double)0, OnSetCansvasChanged));
104

  
105
        public static readonly DependencyProperty CanvasYProperty = DependencyProperty.Register(
106
                "CanvasY", typeof(double), typeof(CloudControl), new PropertyMetadata((double)0, OnSetCansvasChanged));
107

  
108

  
109
        #endregion
110
        #region PropertyChanged Method
111

  
112
        public static void OnSetCansvasChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
113
        {
114
            var instance = (CloudControl)sender;
115

  
116
            if (e.OldValue != e.NewValue && instance != null)
117
            {
118
                instance.SetValue(e.Property, e.NewValue);
119
            }
120
        }
121

  
122
        public static void PointValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
123
        {
124
            var instance = (CloudControl)sender;
125
            if (e.OldValue != e.NewValue && instance.Base_CloudPath != null)
126
            {
127
                instance.SetValue(e.Property, e.NewValue);
128
                //instance.SetCloud(); 주석처리
129
            }
130
        }
131
        public static void IsSelectedChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
132
        {
133
            //var instance = (CloudControl)sender;
134

  
135
            //if (e.OldValue != e.NewValue && instance.Base_CloudPath != null)
136
            //{
137

  
138
            //    instance.SetValue(e.Property, e.NewValue);
139

  
140
            //    if (instance.IsSelected)
141
            //    {
142
            //        instance.Base_CloudPath.Stroke = new SolidColorBrush(Colors.Blue);
143
            //    }
144
            //    else
145
            //    {
146
            //        instance.Base_CloudPath.Stroke = new SolidColorBrush(Colors.Red);
147
            //    }
148
            //}
149
        }
150

  
151
        public static void OnCenterXYChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
152
        {
153
            var instance = (CloudControl)sender;
154
            if (e.OldValue != e.NewValue && instance.Base_CloudPath != null)
155
            {
156
                instance.SetValue(e.Property, e.NewValue);
157
                instance.DrawingCloud();
158
            }
159
        }
160
        public static void AngleValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
161
        {
162
            var instance = (CloudControl)sender;
163
            if (e.OldValue != e.NewValue && instance.Base_CloudPath != null)
164
            {
165
                instance.SetValue(e.Property, e.NewValue);
166
                instance.DrawingCloud();
167
            }
168
        }
169
        #endregion
170
        #region Properties
171

  
172

  
173
        public bool IsCompleted
174
        {
175
            get { return (bool)GetValue(IsCompletedProperty); }
176
            set
177
            {
178
                SetValue(IsCompletedProperty, value);
179
            }
180
        }
181

  
182
        public Geometry OverViewPathData
183
        {
184
            get { return (Geometry)GetValue(OverViewPathDataProperty); }
185
            set
186
            {
187
                SetValue(OverViewPathDataProperty, value);
188
                OnPropertyChanged("OverViewPathData");
189
            }
190
        }
191

  
192
        public double CanvasX
193
        {
194
            get { return (double)GetValue(CanvasXProperty); }
195
            set
196
            {
197
                if (this.CanvasX != value)
198
                {
199
                    SetValue(CanvasXProperty, value);
200
                }
201
            }
202
        }
203

  
204
        public double CanvasY
205
        {
206
            get { return (double)GetValue(CanvasYProperty); }
207
            set
208
            {
209
                if (this.CanvasY != value)
210
                {
211
                    SetValue(CanvasYProperty, value);
212
                }
213
            }
214
        }
215

  
216
        public bool IsSelected
217
        {
218
            get
219
            {
220
                return (bool)GetValue(IsSelectedProperty);
221
            }
222
            set
223
            {
224
                SetValue(IsSelectedProperty, value);
225
            }
226
        }
227

  
228
        public ControlType ControlType
229
        {
230
            set
231
            {
232
                SetValue(ControlTypeProperty, value);
233
            }
234
            get
235
            {
236
                return (ControlType)GetValue(ControlTypeProperty);
237
            }
238
        }
239

  
240
        public Double LineSize
241
        {
242
            get { return (Double)GetValue(LineSizeProperty); }
243
            set
244
            {
245
                if (this.LineSize != value)
246
                {
247
                    SetValue(LineSizeProperty, value);
248
                }
249
            }
250
        }
251
        public bool isChain
252
        {
253
            get { return (bool)GetValue(isChainProperty); }
254
            set
255
            {
256
                SetValue(isChainProperty, value);
257
                OnPropertyChanged("isChain");
258
            }
259
        }
260
        public bool isTransOn
261
        {
262
            get { return (bool)GetValue(isTransOnProperty); }
263
            set
264
            {
265
                SetValue(isTransOnProperty, value);
266
                OnPropertyChanged("isTransOn");
267
            }
268
        }
269
        public DoubleCollection DashSize
270
        {
271
            get { return (DoubleCollection)GetValue(DashSizeProperty); }
272
            set
273
            {
274
                if (this.DashSize != value)
275
                {
276
                    SetValue(DashSizeProperty, value);
277
                    OnPropertyChanged("DashSize");
278
                }
279
            }
280
        }
281
        public string UserID
282
        {
283
            get { return (string)GetValue(UserIDProperty); }
284
            set
285
            {
286
                if (this.UserID != value)
287
                {
288
                    SetValue(UserIDProperty, value);
289
                    OnPropertyChanged("UserID");
290
                }
291
            }
292
        }
293
        public PaintSet Paint
294
        {
295
            get { return (PaintSet)GetValue(PaintProperty); }
296
            set
297
            {
298
                if (this.Paint != value)
299
                {
300
                    SetValue(PaintProperty, value);
301
                    OnPropertyChanged("Paint");
302
                }
303
            }
304
        }
305

  
306
        public SolidColorBrush FillColor
307
        {
308
            get { return (SolidColorBrush)GetValue(FillColorProperty); }
309
            set
310
            {
311
                if (this.FillColor != value)
312
                {
313
                    SetValue(FillColorProperty, value);
314
                    OnPropertyChanged("FillColor");
315
                }
316
            }
317
        }
318
        public SolidColorBrush StrokeColor
319
        {
320
            get { return (SolidColorBrush)GetValue(StrokeColorProperty); }
321
            set
322
            {
323
                if (this.StrokeColor != value)
324
                {
325
                    SetValue(StrokeColorProperty, value);
326
                    OnPropertyChanged("StrokeColor");
327
                }
328
            }
329
        }
330
        public Geometry PathData
331
        {
332
            get 
333
            {
334
                return (Geometry)GetValue(PathDataProperty); 
335
            }
336
            set 
337
            {
338
                SetValue(PathDataProperty, value);
339
                OnPropertyChanged("PathData");
340
            }
341
        }
342
        public Geometry PathSubData
343
        {
344
            get 
345
            {
346
                return (Geometry)GetValue(PathSubDataProperty); 
347
            }
348
            set
349
            {
350
                SetValue(PathSubDataProperty, value);
351
                OnPropertyChanged("PathSubData");
352
            }
353
        }
354
        public Point EndPoint
355
        {
356
            get 
357
            {
358
                return (Point)GetValue(EndPointProperty); 
359
            }
360
            set
361
            {
362
                SetValue(EndPointProperty, value);
363
                OnPropertyChanged("EndPoint");
364
            }
365
        }
366
        public Point StartPoint
367
        {
368
            get 
369
            {
370
                return (Point)GetValue(StartPointProperty); 
371
            }
372
            set
373
            {
374
                SetValue(StartPointProperty, value);
375
                OnPropertyChanged("StartPoint");
376
            }
377
        }
378
        public List<Point> _pointSet;
379

  
380
        public List<Point> PointSet
381
        {
382
            get 
383
            {
384
                return (List<Point>)GetValue(PointSetProperty);
385
            }
386
            set 
387
            {
388
                SetValue(PointSetProperty, value);
389
                OnPropertyChanged("PointSet");
390
            }
391
        }
392

  
393
        public List<Point> pointSet
394
        {
395
            get
396
            {
397
                return _pointSet;
398
            }
399
            set
400
            {
401
                _pointSet = value;
402
                OnPropertyChanged("pointSet");
403
            }
404
        }
405

  
406
        private double _toler = 1;
407
        public double Toler
408
        {
409
            get { return _toler; }
410
            set { _toler = value; }
411
        }
412
        private double _arcLength = 10;
413
        public double ArcLength
414
        {
415
            get { return _arcLength; }
416
            set { _arcLength = value; }
417
        }
418
        private bool _fill = false;
419
        public bool Fill
420
        {
421
            get { return _fill; }
422
            set { _fill = value; }
423
        }
424
        public double Angle
425
        {
426
            get { return (double)GetValue(AngleProperty); }
427
            set
428
            {
429
                if (this.Angle != value)
430
                {
431
                    SetValue(AngleProperty, value);
432
                    OnPropertyChanged("Angle");
433
                }
434
            }
435
        }
436
        public StylusPointSet PointC
437
        {
438
            get { return (StylusPointSet)GetValue(StylusPointSetProperty); }
439
            set
440
            {
441
                SetValue(StylusPointSetProperty, value);
442
                OnPropertyChanged("PointC");
443
            }
444
        }
445
        public double CenterX
446
        {
447
            get
448
            {
449
                return (double)GetValue(CenterXProperty); 
450
            }
451
            set
452
            {
453
                SetValue(CenterXProperty, value);
454
                OnPropertyChanged("CenterX");
455
            }
456
        }
457
        public double CenterY
458
        {
459
            get
460
            { 
461
                return (double)GetValue(CenterYProperty); 
462
            }
463
            set
464
            {
465
                SetValue(CenterYProperty, value);
466
                OnPropertyChanged("CenterY");
467
            }
468
        }
469
        public double AngleValue
470
        {
471
            get 
472
            {
473
                return (double)GetValue(AngleProperty); 
474
            }
475
            set
476
            {
477
                SetValue(AngleProperty, value);
478
                OnPropertyChanged("AngleValue");
479
            }
480
        }
481
        #endregion
482
        #region Data
483
        private PathGeometry _pathGeometry = new PathGeometry();
484
        private PathGeometry _pathSubGeometry = new PathGeometry();
485
        #endregion
486

  
487
        public override void OnApplyTemplate()
488
        {
489
            base.OnApplyTemplate();
490
            Base_CloudPath = GetTemplateChild(PART_CloudPath) as Path;
491
            Base_CloudSubPath = GetTemplateChild(PART_CloudSubPath) as Path;
492
        }
493
        public void SetCloud()
494
        {
495
            //this.Width = this.Base_CloudPath.Width;
496
            //this.Height = this.Base_CloudPath.Height;
497

  
498
            this.ApplyTemplate();
499

  
500
            Generate();
501

  
502
            if (!isChain)
503
            {
504
                //ClosePath();
505
            }
506
        }
507
        public int Generate()
508
        {
509
            this._pathGeometry = null;
510
            this._pathSubGeometry = null;
511
            switch (this.Paint)
512
            {
513
                case PaintSet.None:
514
                    this.FillColor = null;
515
                    if (Base_CloudSubPath != null)
516
                    {
517
                        Base_CloudPath.Fill = null;
518
                        Base_CloudSubPath.Fill = null;
519
                        Base_CloudSubPath.Stroke = new SolidColorBrush(Colors.Transparent);
520
                        //Base_CloudSubPath.StrokeThickness = 3;
521
                    }                    
522
                    break;
523
                case PaintSet.Fill:
524
                    this.FillColor = this.StrokeColor;
525
                    if (Base_CloudSubPath != null)
526
                    {
527
                        if (isChain)
528
                        {
529
                            Base_CloudPath.Fill = null;
530
                            Base_CloudSubPath.Fill = null;
531
                            Base_CloudSubPath.Stroke = new SolidColorBrush(Colors.Transparent);
532
                            //Base_CloudSubPath.StrokeThickness = 3;
533
                        }
534
                        else
535
                        {
536
                            Base_CloudSubPath.Stroke = this.StrokeColor;
537
                            //Base_CloudSubPath.Stroke = new SolidColorBrush(Colors.Transparent);
538
                            Base_CloudSubPath.StrokeThickness = 0.5;
539
                            Base_CloudPath.Stroke = this.StrokeColor;
540
                            //Base_CloudPath.StrokeThickness = 3;
541
                            Base_CloudPath.Fill = this.FillColor;
542
                            Base_CloudSubPath.Fill = this.FillColor;
543
                        }
544
                    }                   
545
                    break;
546
                case PaintSet.Hatch:
547
                    if (Base_CloudSubPath != null && !isChain)
548
                    {
549
                        if (isChain)
550
                        {
551
                            Base_CloudPath.Fill = null;
552
                            Base_CloudSubPath.Fill = null;
553
                            Base_CloudSubPath.Stroke = new SolidColorBrush(Colors.Transparent);
554
                            //Base_CloudSubPath.StrokeThickness = 3;
555
                        }
556
                        else
557
                        {
558
                            Base_CloudPath.Fill = HatchMake.CreateHatchBrush(this.StrokeColor, this.LineSize * 0.1);
559
                            Base_CloudSubPath.Fill = HatchMake.CreateHatchBrush(this.StrokeColor, this.LineSize * 0.1);
560
                            Base_CloudSubPath.Stroke = new SolidColorBrush(Colors.Transparent);
561
                        }
562
                    }
563
                    break;
564
                default:
565
                    break;
566
            }
567

  
568
            //if (Base_CloudPath != null)
569
            //{
570
            //    Base_CloudPath.StrokeDashArray.Clear();
571
            //    Base_CloudSubPath.StrokeDashArray.Clear();
572
            //    foreach (var item in this.DashSize)
573
            //    {
574
            //        Base_CloudPath.StrokeDashArray.Add(item);
575
            //        Base_CloudSubPath.StrokeDashArray.Add(item);
576
            //    }
577
            //}
578
        
579

  
580
            /// set reverse if area is greater 0 - 2012.07.04 added by humkyung
581
            double area = MathSet.AreaOf(this.PointSet);
582
            bool reverse = (area > 0);
583
            /// up to here
584

  
585
            this._pathGeometry = new PathGeometry();
586
            this._pathSubGeometry = new PathGeometry();
587
            int count = this.PointSet.Count;
588

  
589
            if (isTransOn) // true라면 클라우드 컨트롤
590
            {
591
                for (int i = 0; i < (count - 1); i++)
592
                {
593
                    PathFigure pathFigure = CloudControl.GenerateLineWithCloud(this.PointSet[i], this.PointSet[i + 1], this.ArcLength, reverse);
594
                    _pathGeometry.Figures.Add(pathFigure);
595
                }
596
            }
597
            else
598
            {
599
                PathFigure fm = new PathFigure();
600
                fm.StartPoint = this.PointSet[0];
601
                for (int i = 0; i < (count - 1); i++)
602
                {
603
                    fm.Segments.Add(new LineSegment { Point = this.PointSet[i] });
604
                }
605
                _pathGeometry.Figures.Add(fm);
606
            }
607

  
608
            if (this.Paint == PaintSet.Fill || this.Paint == PaintSet.Hatch)
609
            {
610
                PointCollection pd = new PointCollection();
611
                foreach (var item in this.PointSet)
612
                {
613
                    pd.Add(item);
614
                }
615
                _pathSubGeometry.Figures.Add(new PathFigure()
616
                {
617
                    Segments = new PathSegmentCollection()
618
                    {
619
                        new PolyLineSegment()
620
                        {
621
                              Points = pd
622
                        },
623
                    },
624
                    StartPoint = this.PointSet[0]
625
                });
626

  
627
                this.PathSubData = _pathSubGeometry;
628
            }
629

  
630
            
631
            StartPoint = PointSet[0];
632
            this.PathData = this._pathGeometry;
633
            this.OverViewPathData = PathData;
634
            this.StrokeColor = StrokeColor;
635
            this.LineSize = LineSize;
636

  
637
            return 0;
638
        }
639

  
640
        /// <summary>
641
        /// draw arcs between p1 and p2
642
        /// </summary>
643
        /// <author>humkyung</author>
644
        /// <param name="p1"></param>
645
        /// <param name="p2"></param>
646
        /// <param name="reverse"></param>
647
        /// <returns></returns>
648
        public static PathFigure GenerateLineWithCloud(Point p1, Point p2, double arcLength_, bool reverse)
649
        {
650
            PathFigure pathFigure = new PathFigure();
651
            pathFigure.StartPoint = p1;
652

  
653
            double arcLength = arcLength_;
654
            /// draw arcs which has arcLength between p1 and p2 - 2012.06.21 added by humkyung 
655
            double dx = p2.X - p1.X;
656
            double dy = p2.Y - p1.Y;
657
            double l = MathSet.DistanceTo(p1, p2); /// distance between p1 and p2
658
            double theta = Math.Atan2(Math.Abs(dy), Math.Abs(dx)) * 180 / Math.PI;
659
            Point lastPt = new Point(p1.X, p1.Y);
660
            double count = l / arcLength;
661
            /// normalize
662
            dx /= l;
663
            dy /= l;
664
            Double j = 1;
665
            for (j = 1; j < (count - 1); j++)
666
            {
667
                ArcSegment arcSeg = new ArcSegment();
668
                arcSeg.Size = new Size(arcLength * 0.8, arcLength * 0.8);						/// x size and y size of arc
669
                arcSeg.Point = new Point(p1.X + j * dx * arcLength, p1.Y + j * dy * arcLength);	/// end point of arc
670
                lastPt = arcSeg.Point;  /// save last point
671
                arcSeg.RotationAngle = theta + 90;
672
                if (true == reverse) arcSeg.SweepDirection = SweepDirection.Clockwise;
673
                pathFigure.Segments.Add(arcSeg);
674
            }
675

  
676
            /// draw arc between last point and end point
677
            if ((count > j) || (count > 0))
678
            {
679
                arcLength = MathSet.DistanceTo(lastPt, p2);
680
                ArcSegment arcSeg = new ArcSegment();
681
                arcSeg.Size = new Size(arcLength * 0.8, arcLength * 0.8);	/// x size and y size of arc
682
                arcSeg.Point = new Point(p2.X, p2.Y);						/// end point of arc
683
                arcSeg.RotationAngle = theta;
684
                if (true == reverse) arcSeg.SweepDirection = SweepDirection.Clockwise;
685
                pathFigure.Segments.Add(arcSeg);
686

  
687
            }
688

  
689
            pathFigure.IsFilled = true;    
690
            return pathFigure;
691
        }
692

  
693
        /// <summary>
694
        /// close path if it's open
695
        /// </summary>
696
        /// <author>humkyung</author>
697
        /// <returns></returns>
698
        public int ClosePath()
699
        {
700
            if (this.PointSet.Count > 1)
701
            {
702
                double d = MathSet.DistanceTo(this.PointSet[0], this.PointSet[this.PointSet.Count - 1]);
703
                if (d > _toler)
704
                {
705
                    /// set reverse if area is greater 0 - 2012.07.04 added by humkyung
706
                    double area = MathSet.AreaOf(this.PointSet);
707
                    bool reverse = (area > 0);
708
                    /// up to here
709

  
710
                    int count = this.PointSet.Count;
711

  
712

  
713

  
714
                    if (isTransOn) // true라면 클라우드 컨트롤
715
                    {
716
                        PathFigure pathFigure = CloudControl.GenerateLineWithCloud(this.PointSet[count - 1], this.PointSet[0], this.ArcLength - 5, reverse);
717
                        
718
                        if (this.Paint == PaintSet.Fill)
719
                        {
720
                            pathFigure.IsClosed = true;
721
                        }
722

  
723
                        _pathGeometry.Figures.Add(pathFigure);
724
                        
725
                    }
726
                    else
727
                    {
728

  
729
                        PathFigure fm = new PathFigure();
730
                        fm.StartPoint = this.PointSet[count - 1];
731
                        
732
                        //for (int i = 0; i < (count - 1); i++)
733
                        //{
734
                            _pathGeometry.Figures[_pathGeometry.Figures.Count - 1].Segments.Add(new LineSegment { Point = this.PointSet[0] });
735
                            _pathGeometry.Figures[_pathGeometry.Figures.Count - 1].Segments.Add(new LineSegment { Point = this.PointSet[1] });
736
                            //fm.Segments.Add(new LineSegment { Point = this.PointSet[0] });
737
                        //}
738
                    }                 
739
                }
740
            }
741

  
742
            return 0;
743
        }
744
        public void DrawingCloud()
745
        {
746
            AnotherSetCloud();
747
            if (!isChain)
748
            {
749
                //ClosePath();
750
            }
751
        }
752
        public void AnotherSetCloud()
753
        {
754
            this.StrokeColor = StrokeColor;
755
            this.LineSize = LineSize;
756
            this.SetCloud();
757
            //Generate();
758
            this.Width = this.Base_CloudPath.Width;
759
            this.Height = this.Base_CloudPath.Height;
760
        }
761
        public void Dispose()
762
        {
763
            GC.Collect();
764
            GC.SuppressFinalize(this);
765
        }
766
        public event PropertyChangedEventHandler PropertyChanged;
767
        protected void OnPropertyChanged(string propName)
768
        {
769
            if (PropertyChanged != null)
770
                PropertyChanged(this, new PropertyChangedEventArgs(propName));
771
        }
772
        public void updateControl()
773
        {
774

  
775
            var lastIndex = this.PointSet.Count - 1;
776
            //this.StartPoint = this.PointSet[0];
777
            //this.EndPoint = this.PointSet[lastIndex];
778
            CenterX = MathSet.getMiddlePoint(this.PointSet[0], this.PointSet[lastIndex]).X;
779
            CenterY = MathSet.getMiddlePoint(this.PointSet[0], this.PointSet[lastIndex]).Y;
780
        }
781
        public void ChangePaint(PaintSet state)
782
        {
783
            this.Paint = state;
784
            this.SetCloud();
785
            
786
        }
787
        #region Method
788
        public void ApplyOverViewData()
789
        {
790
            this.OverViewPathData = this.PathData;
791
        }
792
        #endregion
793
    }
794

  
795
}
MarkupToPDF/Controls/Polygon/InkControl.cs.bak
1
using MarkupToPDF.Common;
2
using MarkupToPDF.Controls.Common;
3
using System;
4
using System.Collections.Generic;
5
using System.ComponentModel;
6
using System.Linq;
7
using System.Text;
8
using System.Threading.Tasks;
9
using System.Windows;
10
using System.Windows.Controls;
11
using System.Windows.Media;
12
using System.Windows.Shapes;
13

  
14
namespace MarkupToPDF.Controls.Polygon
15
{
16
    public class InkControl : CommentUserInfo, IDisposable, INotifyPropertyChanged, IShapeControl, IMarkupControlData, IPath
17
    {
18
        #region Constructure
19

  
20
        static InkControl()
21
        {
22
            DefaultStyleKeyProperty.OverrideMetadata(typeof(InkControl), new FrameworkPropertyMetadata(typeof(InkControl)));
23
            ResourceDictionary dictionary = new ResourceDictionary();
24
            dictionary.Source = new Uri("/MarkupToPDF;component/themes/generic.xaml", UriKind.RelativeOrAbsolute);
25
            Application.Current.Resources.MergedDictionaries.Add(dictionary);
26
        }
27

  
28
        public InkControl()
29
        {
30
            this.DefaultStyleKey = typeof(InkControl);
31
        }
32

  
33
        #endregion
34

  
35
        #region Variable
36
        private const string PART_PolyPath = "PART_PolyPath";
37

  
38
        public Path Base_PolyPath = null;
39

  
40
        #endregion
41

  
42
        #region Internal Method
43
        public override void OnApplyTemplate()
44
        {
45
            base.OnApplyTemplate();
46

  
47
            Base_PolyPath = GetTemplateChild(PART_PolyPath) as Path;
48

  
49
            if (Base_PolyPath == null)
50
                return;
51

  
52
            this.SetPolyPath();
53
        }
54

  
55

  
56
        #endregion
57

  
58
        #region Method
59

  
60
        public void ApplyOverViewData()
61
        {
62
            this.OverViewPathData = this.PathData;
63
        }
64

  
65
        #endregion
66

  
67
        #region Dependency Properties
68

  
69
        public static readonly DependencyProperty UserIDProperty = DependencyProperty.Register(
70
                "UserID", typeof(string), typeof(InkControl), new PropertyMetadata(null));
71

  
72
        public static readonly DependencyProperty LineSizeProperty = DependencyProperty.Register(
73
              "LineSize", typeof(double), typeof(InkControl), new PropertyMetadata((Double)3));
74

  
75
        public static readonly DependencyProperty StrokeColorProperty = DependencyProperty.Register(
76
               "StrokeColor", typeof(SolidColorBrush), typeof(InkControl),
77
               new PropertyMetadata(new SolidColorBrush(Colors.Red)));
78

  
79
        public static readonly DependencyProperty PathDataProperty = DependencyProperty.Register(
80
                "PathData", typeof(Geometry), typeof(InkControl), null);
81

  
82
        //강인구 추가
83
        public static readonly DependencyProperty DashSizeProperty = DependencyProperty.Register(
84
                "DashSize", typeof(DoubleCollection), typeof(InkControl), new PropertyMetadata(new DoubleCollection { 99999999 }, PointValueChanged));
85

  
86
        public static readonly DependencyProperty OverViewPathDataProperty = DependencyProperty.Register(
87
                "OverViewPathData", typeof(Geometry), typeof(InkControl), null);
88
        //강인구 추가
89
        public static readonly DependencyProperty PaintProperty = DependencyProperty.Register(
90
        "Paint", typeof(PaintSet), typeof(InkControl), new PropertyMetadata(PaintSet.None, PointValueChanged));
91

  
92
        public static readonly DependencyProperty IsCompletedProperty = DependencyProperty.Register(
93
               "IsCompleted", typeof(bool), typeof(InkControl), null);
94

  
95
        public static readonly DependencyProperty StartPointProperty = DependencyProperty.Register(
96
               "StartPoint", typeof(Point), typeof(InkControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
97

  
98
        public static readonly DependencyProperty EndPointProperty = DependencyProperty.Register(
99
               "EndPoint", typeof(Point), typeof(InkControl), new PropertyMetadata(new Point(100, 100), PointValueChanged));
100

  
101
        public static readonly DependencyProperty PointSetProperty = DependencyProperty.Register(
102
                "PointSet", typeof(List<Point>), typeof(InkControl), new PropertyMetadata(new List<Point>(), PointValueChanged));
103

  
104
        /// <summary>
105
        /// StylusPointSet을 List<Point>로 대체하면 PointValueChanged가 작동안한다.
106
        /// </summary>
107
        /// 강인구 추가 Ink Control
108
        public static readonly DependencyProperty StylusPointSetProperty = DependencyProperty.Register(
109
                "PointC", typeof(List<StylusPointSet>), typeof(InkControl), new PropertyMetadata(new List<StylusPointSet>(), PointValueChanged));
110

  
111
        public static readonly DependencyProperty AngleProperty =
112
            DependencyProperty.Register("Angle", typeof(double), typeof(InkControl), new PropertyMetadata((double)0.0, new PropertyChangedCallback
113
                (AngleValueChanged)));
114

  
115
        public static readonly DependencyProperty CenterXProperty =
116
            DependencyProperty.Register("CenterX", typeof(double), typeof(InkControl), new PropertyMetadata((double)0, OnCenterXYChanged));
117

  
118
        public static readonly DependencyProperty CenterYProperty =
119
            DependencyProperty.Register("CenterY", typeof(double), typeof(InkControl), new PropertyMetadata((double)0, OnCenterXYChanged));
120

  
121
        public static readonly DependencyProperty IsSelectedProperty =
122
            DependencyProperty.Register("IsSelected", typeof(bool), typeof(InkControl), new FrameworkPropertyMetadata(false, IsSelectedChanged));
123

  
124
        public static readonly DependencyProperty ControlTypeProperty =
125
            DependencyProperty.Register("ControlType", typeof(ControlType), typeof(InkControl), new FrameworkPropertyMetadata(ControlType.Ink));
126

  
127
        public static readonly DependencyProperty CanvasXProperty = DependencyProperty.Register(
128
                "CanvasX", typeof(double), typeof(InkControl), new PropertyMetadata((double)0, OnSetCansvasChanged));
129

  
130
        public static readonly DependencyProperty CanvasYProperty = DependencyProperty.Register(
131
                "CanvasY", typeof(double), typeof(InkControl), new PropertyMetadata((double)0, OnSetCansvasChanged));
132

  
133
        #endregion
134

  
135
        #region PropertyChanged Method
136
        public static void OnSetCansvasChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
137
        {
138
            var instance = (InkControl)sender;
139

  
140
            if (e.OldValue != e.NewValue && instance != null)
141
            {
142
                instance.SetValue(e.Property, e.NewValue);
143
                //Canvas.SetLeft(instance, instance.CanvasX);
144
                //Canvas.SetTop(instance, instance.CanvasY);
145
            }
146
        }
147

  
148
        public static void PointValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
149
        {
150
            var instance = (InkControl)sender;
151

  
152
            if (e.OldValue != e.NewValue && instance != null)
153
            {
154
                instance.SetValue(e.Property, e.NewValue);
155
                //강인구 추가
156
                instance.SetPolyPath();
157
                //instance.SetPolyPath(); 주석처리
158

  
159
            }
160
        }
161
        public static void AngleValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
162
        {
163
            var instance = (InkControl)sender;
164

  
165
            if (e.OldValue != e.NewValue && instance != null)
166
            {
167
                instance.SetValue(e.Property, e.NewValue);
168
                instance.SetPolyPath();
169
            }
170
        }
171
        public static void OnCenterXYChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
172
        {
173
            var instance = (InkControl)sender;
174
            if (e.OldValue != e.NewValue && instance != null)
175
            {
176
                instance.SetValue(e.Property, e.NewValue);
177
                instance.SetPolyPath();
178
            }
179
        }
180

  
181
        public static void IsSelectedChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
182
        {
183
            //var instance = (InkControl)sender;
184

  
185
            //if (e.OldValue != e.NewValue && instance.Base_PolyPath != null)
186
            //{
187
            //    instance.SetValue(e.Property, e.NewValue);
188

  
189
            //    if (instance.IsSelected)
190
            //    {
191
            //        instance.Base_PolyPath.Stroke = new SolidColorBrush(Colors.Blue);
192
            //    }
193
            //    else
194
            //    {
195
            //        instance.Base_PolyPath.Stroke = new SolidColorBrush(Colors.Transparent);
196
            //    }
197
            //}
198
        }
199

  
200
        #endregion
201

  
202
        #region Properties
203

  
204

  
205
        public bool IsCompleted
206
        {
207
            get { return (bool)GetValue(IsCompletedProperty); }
208
            set
209
            {
210
                SetValue(IsCompletedProperty, value);
211
                OnPropertyChanged("IsCompleted");
212
            }
213
        }
214

  
215

  
216
        public Geometry OverViewPathData
217
        {
218
            get { return (Geometry)GetValue(OverViewPathDataProperty); }
219
            set
220
            {
221
                SetValue(OverViewPathDataProperty, value);
222
                OnPropertyChanged("OverViewPathData");
223
            }
224
        }
225

  
226
        public double CanvasX
227
        {
228
            get { return (double)GetValue(CanvasXProperty); }
229
            set
230
            {
231
                if (this.CanvasX != value)
232
                {
233
                    SetValue(CanvasXProperty, value);
234
                    OnPropertyChanged("CanvasX");
235
                }
236
            }
237
        }
238

  
239
        public double CanvasY
240
        {
241
            get { return (double)GetValue(CanvasYProperty); }
242
            set
243
            {
244
                if (this.CanvasY != value)
245
                {
246
                    SetValue(CanvasYProperty, value);
247
                    OnPropertyChanged("CanvasY");
248
                }
249
            }
250
        }
251

  
252
        public bool IsSelected
253
        {
254
            get
255
            {
256
                return (bool)GetValue(IsSelectedProperty);
257
            }
258
            set
259
            {
260
                SetValue(IsSelectedProperty, value);
261
                OnPropertyChanged("IsSelected");
262
            }
263
        }
264

  
265
        public PaintSet Paint
266
        {
267
            get { return (PaintSet)GetValue(PaintProperty); }
268
            set
269
            {
270
                if (this.Paint != value)
271
                {
272
                    SetValue(PaintProperty, value);
273
                    OnPropertyChanged("Paint");
274
                }
275
            }
276
        }
277

  
278
        public ControlType ControlType
279
        {
280
            set
281
            {
282
                SetValue(ControlTypeProperty, value);
283
                OnPropertyChanged("ControlType");
284
            }
285
            get
286
            {
287
                return (ControlType)GetValue(ControlTypeProperty);
288
            }
289
        }
290

  
291
        public Double LineSize
292
        {
293
            get { return (Double)GetValue(LineSizeProperty); }
294
            set
295
            {
296
                if (this.LineSize != value)
297
                {
298
                    SetValue(LineSizeProperty, value);
299
                    OnPropertyChanged("LineSize");
300
                }
301
            }
302
        }
303

  
304
        public DoubleCollection DashSize
305
        {
306
            get { return (DoubleCollection)GetValue(DashSizeProperty); }
307
            set
308
            {
309
                if (this.DashSize != value)
310
                {
311
                    SetValue(DashSizeProperty, value);
312
                    OnPropertyChanged("DashSize");
313
                }
314
            }
315
        }
316
        public string UserID
317
        {
318
            get { return (string)GetValue(UserIDProperty); }
319
            set
320
            {
321
                if (this.UserID != value)
322
                {
323
                    SetValue(UserIDProperty, value);
324
                    OnPropertyChanged("UserID");
325
                }
326
            }
327
        }
328
        public List<Point> PointSet
329
        {
330
            get { return (List<Point>)GetValue(PointSetProperty); }
331
            set
332
            {
333
                SetValue(PointSetProperty, value);
334
                OnPropertyChanged("PointSet");
335
            }
336
        }
337
        //강인구 추가 InkControl
338
        public List<StylusPointSet> PointC
339
        {
340
            get { return (List<StylusPointSet>)GetValue(StylusPointSetProperty); }
341
            set
342
            {
343
                SetValue(StylusPointSetProperty, value);
344
                OnPropertyChanged("PointC");
345
            }
346
        }
347

  
348

  
349
        public double CenterX
350
        {
351
            get { return (double)GetValue(CenterXProperty); }
352
            set
353
            {
354
                SetValue(CenterXProperty, value);
355
                OnPropertyChanged("CenterX");
356
            }
357
        }
358
        public double CenterY
359
        {
360
            get
361
            {
362
                return (double)GetValue(CenterYProperty);
363
            }
364
            set
365
            {
366
                SetValue(CenterYProperty, value);
367
                OnPropertyChanged("CenterY");
368
            }
369
        }
370
        public SolidColorBrush StrokeColor
371
        {
372
            get { return (SolidColorBrush)GetValue(StrokeColorProperty); }
373
            set
374
            {
375
                if (this.StrokeColor != value)
376
                {
377
                    SetValue(StrokeColorProperty, value);
378
                    OnPropertyChanged("StrokeColor");
379
                }
380
            }
381
        }
382
        public Geometry PathData
383
        {
384
            get { return (Geometry)GetValue(PathDataProperty); }
385
            set
386
            {
387
                SetValue(PathDataProperty, value);
388
                OnPropertyChanged("PathData");
389
            }
390
        }
391

  
392
        public double Angle
393
        {
394
            get { return (double)GetValue(AngleProperty); }
395
            set
396
            {
397
                if (this.Angle != value)
398
                {
399
                    SetValue(AngleProperty, value);
400
                    OnPropertyChanged("Angle");
401
                }
402
            }
403
        }
404

  
405
        public Point EndPoint
406
        {
407
            get { return (Point)GetValue(EndPointProperty); }
408
            set
409
            {
410
                SetValue(EndPointProperty, value);
411
                OnPropertyChanged("EndPoint");
412
            }
413
        }
414
        public Point StartPoint
415
        {
416
            get { return (Point)GetValue(StartPointProperty); }
417
            set
418
            {
419
                SetValue(StartPointProperty, value);
420
                OnPropertyChanged("StartPoint");
421
            }
422
        }
423
        #endregion
424

  
425
        public void updateControl()
426
        {
427
            this.PointSet = new List<Point>();
428

  
429
            //this.PointSet.Clear();
430

  
431
            //this.PointSet.AddRange(PointC.pointSet);
432
            //this.PointSet.AddRange(PointSet);
433

  
434
            //강인구 추가(Ink Control)
435

  
436

  
437
            foreach (var item in PointC)
438
            {
439
                PointSet.AddRange(item.pointSet);
440
            }
441

  
442
            ////////////////////////////////////////
443

  
444
            this.StartPoint = new Point(this.PointSet[0].X, this.PointSet[0].Y);
445

  
446
            this.EndPoint = new Point(this.PointSet[this.PointSet.Count - 1].X, this.PointSet[this.PointSet.Count - 1].Y);
447

  
448
            //SetPolyPath();
449
        }
450

  
451
        public void SetPolyPath()
452
        {
453
            this.ApplyTemplate();
454

  
455
            if (Base_PolyPath != null)
456
            {
457
                Base_PolyPath.StrokeDashArray.Clear();
458

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

  
467
                PathGeometry pathGeometry = new PathGeometry();
468
                if (PointC != null && PointC.Count > 0)
469
                {
470
                    foreach (var item in PointC)
471
                    {
472
                        PathFigure pathFigure_ = new PathFigure();
473
                        pathFigure_.StartPoint = item.pointSet[0];
474
                        System.Diagnostics.Debug.WriteLine("SP : " + pathFigure_.StartPoint);
475
                        PolyLineSegment instance_ = new PolyLineSegment();
476
                        foreach (var Inneritem in item.pointSet)
477
                        {
478
                            instance_.Points.Add(Inneritem);
479
                        }
480
                        pathFigure_.Segments.Add(instance_);
481
                        pathGeometry.Figures.Add(pathFigure_);
482
                    }
483
                    this.PathData = pathGeometry;
484
                    return;
485
                }
486

  
487
                PathFigure pathFigure = new PathFigure();
488
                PolyLineSegment instance = new PolyLineSegment();
489

  
490

  
491
                foreach (var Inneritem in PointSet)
492
                {
493
                    instance.Points.Add(Inneritem);
494
                }
495

  
496

  
497
                StartPoint = instance.Points.First();
498
                pathFigure.StartPoint = StartPoint;
499
                EndPoint = instance.Points.Last();
500
                pathFigure.Segments.Add(instance);
501
                pathGeometry.Figures.Add(pathFigure);
502

  
503
                //강인구 추가(Chain이 아닌 Polygon일때만 채우기 및 빗금 하기)
504
                if (ControlType == ControlType.Ink)
505
                {
506
                    switch (this.Paint)
507
                    {
508
                        case PaintSet.None:
509
                            {
510
                                //강인구 추가
511
                                Base_PolyPath.Fill = null;
512
                            }
513
                            break;
514
                        case PaintSet.Fill:
515
                            {
516
                                Base_PolyPath.Fill = this.StrokeColor;
517
                            }
518
                            break;
519
                        case PaintSet.Hatch:
520
                            {
521
                                Base_PolyPath.Fill = HatchMake.CreateHatchBrush(this.StrokeColor, this.LineSize * 0.1);
522
                            }
523
                            break;
524
                        default:
525
                            break;
526
                    }
527
                }
528

  
529
                this.PathData = pathGeometry;
530
                this.OverViewPathData = PathData;
531
            }
532
        }
533

  
534
        public void ChangePaint(PaintSet state)
535
        {
536

  
537
        }
538

  
539
        //public PaintSet Paint { get; set; }
540

  
541

  
542
        #region Dispose
543
        public void Dispose()
544
        {
545
            GC.Collect();
546
            GC.SuppressFinalize(this);
547
        }
548
        #endregion
549

  
550
        #region INotifyPropertyChanged
551
        private void OnPropertyChanged(string name)
552
        {
553
            if (PropertyChanged != null)
554
            {
555
                PropertyChanged(this, new PropertyChangedEventArgs(name));
556
            }
557
        }
558

  
559
        public event PropertyChangedEventHandler PropertyChanged;
560
        #endregion
561
    }
562

  
563
    //public class StylusPointSet : INotifyPropertyChanged
564
    //{
565
    //    public StylusPointSet()
566
    //    {
567
    //        if (pointSet == null)
568
    //            pointSet = new List<Point>();
569
    //    }
570

  
571
    //    public List<Point> _pointSet;
572

  
573
    //    public List<Point> pointSet
574
    //    {
575
    //        get
576
    //        {
577
    //            return _pointSet;
578
    //        }
579
    //        set
580
    //        {
581
    //            _pointSet = value;
582
    //            OnPropertyChanged("pointSet");
583
    //        }
584
    //    }
585

  
586
    //    #region INotifyPropertyChanged
587
    //    private void OnPropertyChanged(string name)
588
    //    {
589
    //        if (PropertyChanged != null)
590
    //        {
591
    //            PropertyChanged(this, new PropertyChangedEventArgs(name));
592
    //        }
593
    //    }
594

  
595
    //    public event PropertyChangedEventHandler PropertyChanged;
596
    //    #endregion
597
    //}
598
}
MarkupToPDF/Controls/Polygon/PolygonControl.cs.bak
1
using MarkupToPDF.Common;
2
using MarkupToPDF.Controls.Common;
3
using System;
4
using System.Collections.Generic;
5
using System.ComponentModel;
6
using System.Linq;
7
using System.Text;
8
using System.Threading.Tasks;
9
using System.Windows;
10
using System.Windows.Controls;
11
using System.Windows.Media;
12
using System.Windows.Shapes;
13

  
14
namespace MarkupToPDF.Controls.Polygon
15
{
16
     public class PolygonControl : CommentUserInfo, IDisposable, INotifyPropertyChanged, IShapeControl, IMarkupControlData, IPath
17
    {
18
        #region Constructure
19

  
20
        static PolygonControl()
21
        {
22
            DefaultStyleKeyProperty.OverrideMetadata(typeof(PolygonControl), new FrameworkPropertyMetadata(typeof(PolygonControl)));
23
            ResourceDictionary dictionary = new ResourceDictionary();
24
            dictionary.Source = new Uri("/MarkupToPDF;component/themes/generic.xaml", UriKind.RelativeOrAbsolute);
25
            Application.Current.Resources.MergedDictionaries.Add(dictionary);
26
        }
27

  
28
        public PolygonControl()
29
        {
30
            this.DefaultStyleKey = typeof(PolygonControl);
31
        }
32
        
33
        #endregion
34

  
35
        #region Variable
36
        private const string PART_PolyPath = "PART_PolyPath";
37

  
38
        public Path Base_PolyPath = null;
39

  
40
        #endregion
41

  
42
        #region Internal Method
43
        public override void OnApplyTemplate()
44
        {   
45
            base.OnApplyTemplate();
46

  
47
            Base_PolyPath = GetTemplateChild(PART_PolyPath) as Path;
48

  
49
            if (Base_PolyPath == null)
50
                return;
51

  
52
            this.SetPolyPath();
53
        }
54

  
55

  
56
        #endregion
57

  
58
        #region Method
59

  
60
        public void ApplyOverViewData()
61
        {
62
            this.OverViewPathData = this.PathData;
63
        }
64

  
65
        #endregion
66

  
67
        #region Dependency Properties
68

  
69
        public static readonly DependencyProperty UserIDProperty = DependencyProperty.Register(
70
                "UserID", typeof(string), typeof(PolygonControl), new PropertyMetadata(null));
71

  
72
        public static readonly DependencyProperty LineSizeProperty = DependencyProperty.Register(
73
              "LineSize", typeof(double), typeof(PolygonControl), new PropertyMetadata((Double)3));
74

  
75
        public static readonly DependencyProperty StrokeColorProperty = DependencyProperty.Register(
76
               "StrokeColor", typeof(SolidColorBrush), typeof(PolygonControl), 
77
               new PropertyMetadata(new SolidColorBrush(Colors.Red)));
78

  
79
        public static readonly DependencyProperty PathDataProperty = DependencyProperty.Register(
80
                "PathData", typeof(Geometry), typeof(PolygonControl), null);
81

  
... 이 차이점은 표시할 수 있는 최대 줄수를 초과해서 이 차이점은 잘렸습니다.

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)