프로젝트

일반

사용자정보

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

markus / MarkupToPDF / Controls / Shape / CircleControl.cs @ 3b797b23

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

1
using MarkupToPDF.Common;
2
using MarkupToPDF.Controls.Common;
3
using MarkupToPDF.Serialize.Core;
4
using MarkupToPDF.Serialize.S_Control;
5
using System;
6
using System.Collections.Generic;
7
using System.ComponentModel;
8
using System.Linq;
9
using System.Windows;
10
using System.Windows.Media;
11
using System.Windows.Shapes;
12

    
13
namespace MarkupToPDF.Controls.Shape
14
{
15
    [TemplatePart(Name = "PART_CirclePath", Type = typeof(Path))]
16
    public class CircleControl : CommentUserInfo, IDisposable, IPath, INotifyPropertyChanged, IMarkupCommonData, IShapeControl, ICircleControl, IDashControl
17
    {
18
        private const string PART_CirclePath = "PART_CirclePath";
19
        public Path Base_CirclePath = null;
20

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

    
30
        #region Dependency Properties
31

    
32
        public static readonly DependencyProperty IsSelectedProperty =
33
      DependencyProperty.Register("IsSelected", typeof(bool), typeof(CircleControl), new FrameworkPropertyMetadata(false, IsSelectedChanged));
34

    
35
        public static readonly DependencyProperty ControlTypeProperty =
36
    DependencyProperty.Register("ControlType", typeof(ControlType), typeof(CircleControl), new FrameworkPropertyMetadata(ControlType.Circle));
37

    
38

    
39

    
40

    
41
        public static readonly DependencyProperty OverViewPathDataProperty = DependencyProperty.Register(
42
                "OverViewPathData", typeof(Geometry), typeof(CircleControl), new PropertyMetadata(null));
43

    
44
        public static readonly DependencyProperty LineSizeProperty = DependencyProperty.Register(
45
                "LineSize", typeof(double), typeof(CircleControl), new PropertyMetadata((Double)3));
46
        public static readonly DependencyProperty UserIDProperty = DependencyProperty.Register(
47
                "UserID", typeof(string), typeof(CircleControl), new PropertyMetadata(null));
48
				
49
        public static readonly DependencyProperty FillColorProperty = DependencyProperty.Register(
50
                "FillColor", typeof(SolidColorBrush), typeof(CircleControl), new PropertyMetadata(new SolidColorBrush(Colors.Red)));
51

    
52
        public static readonly DependencyProperty StrokeColorProperty = DependencyProperty.Register(
53
                "StrokeColor", typeof(SolidColorBrush), typeof(CircleControl), new PropertyMetadata(new SolidColorBrush(Colors.Red)));
54

    
55
        public static readonly DependencyProperty PathDataProperty = DependencyProperty.Register(
56
                "PathData", typeof(Geometry), typeof(CircleControl), null);
57
        //강인구 추가
58
        public static readonly DependencyProperty PaintProperty = DependencyProperty.Register(
59
                "Paint", typeof(PaintSet), typeof(CircleControl), new PropertyMetadata(PaintSet.None, PointValueChanged));
60

    
61
        public static readonly DependencyProperty EndPointProperty = DependencyProperty.Register(
62
                "EndPoint", typeof(Point), typeof(CircleControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
63

    
64
        //강인구 추가
65
        public static readonly DependencyProperty DashSizeProperty = DependencyProperty.Register(
66
                "DashSize", typeof(DoubleCollection), typeof(CircleControl), new PropertyMetadata(new DoubleCollection { 1, 1 }, PointValueChanged));
67

    
68
        public static readonly DependencyProperty TopRightPointProperty = DependencyProperty.Register(
69
              "TopRightPoint", typeof(Point), typeof(CircleControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
70

    
71
        public static readonly DependencyProperty LeftBottomPointProperty = DependencyProperty.Register(
72
                 "LeftBottomPoint", typeof(Point), typeof(CircleControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
73

    
74
        public static readonly DependencyProperty StartPointProperty = DependencyProperty.Register(
75
                "StartPoint", typeof(Point), typeof(CircleControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
76
        public static readonly DependencyProperty PointSetProperty = DependencyProperty.Register(
77
                 "PointSet", typeof(List<Point>), typeof(CircleControl), new PropertyMetadata(new List<Point>()));
78
        public static readonly DependencyProperty AngleProperty = DependencyProperty.Register("Angle", typeof(double), typeof(CircleControl),
79
            new PropertyMetadata((double)0.0, new PropertyChangedCallback(AngleValueChanged)));
80
        public static readonly DependencyProperty CenterXProperty = DependencyProperty.Register("CenterX", typeof(double), typeof(CircleControl),
81
            new PropertyMetadata((double)0, OnCenterXYChanged));
82
        public static readonly DependencyProperty CenterYProperty = DependencyProperty.Register("CenterY", typeof(double), typeof(CircleControl),
83
            new PropertyMetadata((double)0, OnCenterXYChanged));
84
        public static readonly DependencyProperty mousemodeProperty =
85
                        DependencyProperty.Register("mousemode", typeof(MouseMode), typeof(CircleControl), new PropertyMetadata(MouseMode.None, PointValueChanged));
86
        #endregion
87
        #region PropertyChanged Method
88

    
89
         public static void IsSelectedChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
90
        {
91
            //var instance = (CircleControl)sender;
92

    
93
            //if (e.OldValue != e.NewValue && instance.Base_CirclePath != null)
94
            //{
95

    
96
            //    instance.SetValue(e.Property, e.NewValue);
97

    
98
            //    if (instance.IsSelected)
99
            //    {
100
            //        instance.Base_CirclePath.Stroke = new SolidColorBrush(Colors.Blue);
101
            //    }
102
            //    else
103
            //    {
104
            //        instance.Base_CirclePath.Stroke = new SolidColorBrush(Colors.Red);
105
            //    }
106
            //}
107
        }
108

    
109
        public static void PointValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
110
        {
111
            var instance = (CircleControl)sender;
112
            if (e.OldValue != e.NewValue && instance.Base_CirclePath != null)
113
            {
114
                instance.SetValue(e.Property, e.NewValue);
115
                instance.SetCircle();
116
            }
117
        }
118

    
119
        public static void OnCenterXYChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
120
        {
121
            var instance = (CircleControl)sender;
122
            if (e.OldValue != e.NewValue && instance.Base_CirclePath != null)
123
            {
124
                instance.SetValue(e.Property, e.NewValue);
125
                instance.SetCircle();
126
            }
127
        }
128

    
129

    
130
        public static void AngleValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
131
        {
132
            var instance = (CircleControl)sender;
133
            if (e.OldValue != e.NewValue && instance.Base_CirclePath != null)
134
            {
135
                instance.SetValue(e.Property, e.NewValue);
136
                instance.SetCircle();
137
            }
138
        }
139
        #endregion
140
        #region Properties
141
        public string UserID
142
        {
143
            get { return (string)GetValue(UserIDProperty); }
144
            set
145
            {
146
                if (this.UserID != value)
147
                {
148
                    SetValue(UserIDProperty, value);
149
                    OnPropertyChanged("UserID");
150
                }
151
            }
152
        }
153
        public MouseMode mousemode
154
        {
155
            get
156
            {
157
                return (MouseMode)GetValue(mousemodeProperty);
158
            }
159
            set
160
            {
161
                SetValue(mousemodeProperty, value);
162
                OnPropertyChanged("mousemode");
163
            }
164
        }
165

    
166
        public Double LineSize
167
        {
168
            get { return (Double)GetValue(LineSizeProperty); }
169
            set
170
            {
171
                if (this.LineSize != value)
172
                {
173
                    SetValue(LineSizeProperty, value);
174
                }
175
            }
176
        }
177
        public DoubleCollection DashSize
178
        {
179
            get { return (DoubleCollection)GetValue(DashSizeProperty); }
180
            set
181
            {
182
                if (this.DashSize != value)
183
                {
184
                    SetValue(DashSizeProperty, value);
185
                }
186
            }
187
        }
188
        public SolidColorBrush FillColor
189
        {
190
            get { return (SolidColorBrush)GetValue(FillColorProperty); }
191
            set
192
            {
193
                if (this.FillColor != value)
194
                {
195
                    SetValue(FillColorProperty, value);
196
                }
197
            }
198
        }
199
        public Point TopRightPoint
200
        {
201
            get { return (Point)GetValue(TopRightPointProperty); }
202
            set
203
            {
204
                SetValue(TopRightPointProperty, value);
205
                OnPropertyChanged("TopRightPoint");
206
            }
207
        }
208
        public Point LeftBottomPoint
209
        {
210
            get { return (Point)GetValue(LeftBottomPointProperty); }
211
            set
212
            {
213
                SetValue(LeftBottomPointProperty, value);
214
                OnPropertyChanged("LeftBottomPoint");
215
            }
216
        }
217
        public override SolidColorBrush StrokeColor
218
        {
219
            get { return (SolidColorBrush)GetValue(StrokeColorProperty); }
220
            set
221
            {
222
                if (this.StrokeColor != value)
223
                {
224
                    SetValue(StrokeColorProperty, value);
225
                }
226
            }
227
        }
228
        public Geometry PathData
229
        {
230
            get { return (Geometry)GetValue(PathDataProperty); }
231
            set { SetValue(PathDataProperty, value); }
232
        }
233

    
234
        public Geometry OverViewPathData
235
        {
236
            get
237
            {
238
                return (Geometry)GetValue(OverViewPathDataProperty);
239
            }
240
            set
241
            {
242
                SetValue(OverViewPathDataProperty, value);
243
                OnPropertyChanged("OverViewPathData");
244
            }
245
        }
246
        public PaintSet Paint
247
        {
248
            get { return (PaintSet)GetValue(PaintProperty); }
249
            set
250
            {
251
                if (this.Paint != value)
252
                {
253
                    SetValue(PaintProperty, value);
254
                }
255
            }
256
        }
257
        public Point EndPoint
258
        {
259
            get { return (Point)GetValue(EndPointProperty); }
260
            set { SetValue(EndPointProperty, value); }
261
        }
262
        public Point StartPoint
263
        {
264
            get { return (Point)GetValue(StartPointProperty); }
265
            set { SetValue(StartPointProperty, value); }
266
        }
267
        //public double CenterX
268
        //{
269
        //    get { return (double)GetValue(CenterXProperty); }
270
        //    set { SetValue(CenterXProperty, value); }
271
        //}
272
        //public double CenterY
273
        //{
274
        //    get { return (double)GetValue(CenterYProperty); }
275
        //    set { SetValue(CenterYProperty, value); }
276
        //}
277
        public double AngleValue
278
        {
279
            get { return (double)GetValue(AngleProperty); }
280
            set { SetValue(AngleProperty, value); }
281
        }
282
        public override double CommentAngle
283
        {
284
            get { return (double)GetValue(AngleProperty); }
285
            set
286
            {
287
                if (this.CommentAngle != value)
288
                {
289
                    SetValue(AngleProperty, value);
290
                }
291
            }
292
        }
293
        public List<Point> PointSet
294
        {
295
            get { return (List<Point>)GetValue(PointSetProperty); }
296
            set { SetValue(PointSetProperty, value); }
297
        }
298

    
299
        public override bool IsSelected
300
        {
301
            get
302
            {
303
                return (bool)GetValue(IsSelectedProperty);
304
            }
305
            set
306
            {
307
                SetValue(IsSelectedProperty, value);
308
            }
309
        }
310

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

    
323
        public double CenterX
324
        {
325
            get { return (double)GetValue(CenterXProperty); }
326
            set { SetValue(CenterXProperty, value); }
327
        }
328
        public double CenterY
329
        {
330
            get { return (double)GetValue(CenterYProperty); }
331
            set { SetValue(CenterYProperty, value); }
332
        }
333
        #endregion
334
        #region Object & Variable
335
        EllipseGeometry instance = new EllipseGeometry();
336
        GeometryGroup CircleGroup = new GeometryGroup();
337

    
338
        #endregion
339
        public override void OnApplyTemplate()
340
        {
341
            base.OnApplyTemplate();
342
            Base_CirclePath = GetTemplateChild(PART_CirclePath) as Path;
343

    
344
            if (Base_CirclePath == null)
345
            {
346
                return;
347
            }
348
            this.SetCircle();
349
        }
350
        public void Dispose()
351
        {
352
            //GC.Collect();
353
            ////GC.SuppressFinalize(this);
354
            this.Base_CirclePath = null;
355
        }
356

    
357
        public event PropertyChangedEventHandler PropertyChanged;
358
        protected void OnPropertyChanged(string propName)
359
        {
360
            if (PropertyChanged != null)
361
                PropertyChanged(this, new PropertyChangedEventArgs(propName));
362
        }
363
        
364
        /// <summary>
365
        /// Circle을 생성한다.
366
        /// </summary>
367
        private void SetCircle()
368
        {
369
            Base_CirclePath.StrokeDashArray.Clear();
370
            foreach (var item in this.DashSize)
371
            {
372
                Base_CirclePath.StrokeDashArray.Add(item);
373
            }
374
            Base_CirclePath.StrokeDashCap = PenLineCap.Square;
375

    
376
            Point middle = MathSet.getMiddlePoint(this.EndPoint, this.StartPoint);
377

    
378
            instance.RadiusX = (MathSet.DistanceTo(this.LeftBottomPoint, this.EndPoint) * 0.5);
379
            instance.RadiusY = (MathSet.DistanceTo(this.EndPoint, this.TopRightPoint) * 0.5);
380
            instance.Center = middle;
381
            #region 회전 적용
382
            var rot = new RotateTransform(this.CommentAngle, middle.X, middle.Y);
383
            instance.Transform = rot;
384
            #endregion
385

    
386
            switch (this.Paint)
387
            {
388
                case PaintSet.None:
389
                    this.FillColor = null;
390
                    Base_CirclePath.Fill = this.FillColor;
391
                    break;
392
                case PaintSet.Fill:
393
                    this.FillColor = this.StrokeColor;
394
                    Base_CirclePath.Fill = this.FillColor;
395
                    break;
396
                case PaintSet.Hatch:
397
                    Base_CirclePath.Fill = HatchMake.CreateHatchBrush(this.StrokeColor);
398
                    break;
399
                default:
400
                    break;
401
            }
402

    
403
            CircleGroup.Children.Clear();
404
            CircleGroup.FillRule = FillRule.Nonzero;
405
            CircleGroup.Children.Add(instance);
406
            CircleGroup.Children.Add(new LineGeometry(this.StartPoint, this.LeftBottomPoint));
407
            CircleGroup.Children.Add(new LineGeometry(this.LeftBottomPoint, this.EndPoint));
408
            CircleGroup.Children.Add(new LineGeometry(this.EndPoint, this.TopRightPoint));
409
            CircleGroup.Children.Add(new LineGeometry(this.TopRightPoint, this.StartPoint));
410

    
411
            try
412
            {                
413
                this.Width = Math.Abs(this.CircleGroup.Bounds.Right + (this.LineSize * 0.5));
414
                this.Height = Math.Abs(this.CircleGroup.Bounds.Bottom + +(this.LineSize * 0.5)); 
415
            }
416
            catch (Exception)
417
            {
418
                
419
            } 
420

    
421
            CenterX = Math.Abs(this.CircleGroup.Bounds.X / 2);
422
            CenterY = Math.Abs(this.CircleGroup.Bounds.Y / 2);
423
            this.PathData = CircleGroup;
424
            ApplyOverViewData();
425
        }
426

    
427
        public override void UpdateControl()
428
        {
429
            this.StartPoint = new Point(this.PointSet[0].X, this.PointSet[0].Y);
430
            this.LeftBottomPoint = new Point(this.PointSet[1].X, this.PointSet[1].Y);
431
            this.TopRightPoint = new Point(this.PointSet[3].X, this.PointSet[3].Y);
432
            this.EndPoint = new Point(this.PointSet[2].X, this.PointSet[2].Y);
433
        }
434

    
435
        public void SetCenterXY()
436
        {
437
            CenterX = MathSet.getMiddlePoint(this.StartPoint, this.EndPoint).X;
438
            CenterY = MathSet.getMiddlePoint(this.StartPoint, this.EndPoint).Y;
439
        }
440

    
441
        public override void ApplyOverViewData()
442
        {
443
            this.OverViewPathData = this.PathData;
444
        }
445

    
446
        public void ChangePaint(PaintSet state)
447
        {
448
            this.Paint = state;
449
            this.SetCircle();
450
        }
451

    
452
        /// <summary>
453
        /// call when mouse is moving while drawing control
454
        /// </summary>
455
        /// <param name="pt"></param>
456
        /// <param name="bAxisLocked"></param>
457
        public override void OnCreatingMouseMove(Point pt, bool bAxisLocked)
458
        {
459
            this.EndPoint = bAxisLocked ? this.GetSquareEndPoint(this.StartPoint, pt) : pt;
460
            this.LeftBottomPoint = new Point(this.StartPoint.X, this.EndPoint.Y);
461
            this.TopRightPoint = new Point(this.EndPoint.X, this.StartPoint.Y);
462

    
463
            this.PointSet = new List<Point>
464
            {
465
                this.StartPoint,
466
                this.LeftBottomPoint,
467
                this.EndPoint,
468
                this.TopRightPoint,
469
            };
470
        }
471

    
472
        /// <summary>
473
        /// move control point has same location of given pt along given delta
474
        /// </summary>
475
        /// <author>humkyung</author>
476
        /// <date>2019.06.20</date>
477
        /// <param name="pt"></param>
478
        /// <param name="dx"></param>
479
        /// <param name="dy"></param>
480
        public override void OnMoveCtrlPoint(Point pt, double dx, double dy, bool bAxisLocked = false)
481
        {
482
            IPath path = (this as IPath);
483
            Point selected = MathSet.getNearPoint(path.PointSet, pt);
484
            selected.X += dx;
485
            selected.Y += dy;
486
            int i = 0;
487
            for (i = 0; i < (this as IPath).PointSet.Count; i++)
488
            {
489
                if (pt.Equals((this as IPath).PointSet[i]))
490
                {
491
                    (this as IPath).PointSet[i] = selected;
492
                    break;
493
                }
494
            }
495

    
496
            List<Point> newPointSet = new List<Point> { };
497
            Point middle = new Point(path.PathData.Bounds.X + path.PathData.Bounds.Width * 0.5, path.PathData.Bounds.Y + path.PathData.Bounds.Height * 0.5);
498
            foreach (Point _pt in path.PointSet)
499
            {
500
                newPointSet.Add(_pt);
501
            }
502
            var OppositeP = (i + newPointSet.Count / 2) % newPointSet.Count;
503
            var PreviousP = (i + (newPointSet.Count - 1)) % newPointSet.Count;
504
            var NextP = (i + 1) % newPointSet.Count;
505
            if (bAxisLocked)
506
            {
507
                double _dx = path.PointSet[i].X - path.PointSet[OppositeP].X;
508
                double _dy = path.PointSet[i].Y - path.PointSet[OppositeP].Y;
509
                double distance = Math.Max(Math.Abs(_dx), Math.Abs(_dy));
510

    
511
                var PreviousV = path.PointSet[PreviousP] - path.PointSet[OppositeP];
512
                PreviousV.Normalize();
513
                path.PointSet[PreviousP] = path.PointSet[OppositeP] + PreviousV * distance;
514

    
515
                var NextV = path.PointSet[NextP] - path.PointSet[OppositeP];
516
                NextV.Normalize();
517
                path.PointSet[NextP] = path.PointSet[OppositeP] + NextV * distance;
518

    
519
                path.PointSet[i] = path.PointSet[OppositeP] + PreviousV * distance + NextV * distance;
520
            }
521
            else
522
            {
523
                var PreviousV = MathSet.GetNormVectorBetween(newPointSet[OppositeP], newPointSet[PreviousP]);
524
                var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, newPointSet[i].X - newPointSet[OppositeP].X,
525
                    newPointSet[i].Y - newPointSet[OppositeP].Y);
526

    
527
                Point pPrevious = new Point(newPointSet[OppositeP].X + PreviousV.X * l, newPointSet[OppositeP].Y
528
                    + PreviousV.Y * l);
529

    
530
                if (newPointSet.FindAll(x => x.Equals(pPrevious)).Count() == 0)
531
                {
532
                    newPointSet[PreviousP] = pPrevious;
533
                }
534

    
535
                var NextV = MathSet.GetNormVectorBetween(newPointSet[OppositeP], newPointSet[NextP]);
536
                l = MathSet.DotProduct(NextV.X, NextV.Y, newPointSet[i].X - newPointSet[OppositeP].X, newPointSet[i].Y
537
                    - newPointSet[OppositeP].Y);
538

    
539
                Point pNext = new Point(newPointSet[OppositeP].X + NextV.X * l, newPointSet[OppositeP].Y + NextV.Y * l);
540

    
541
                if (newPointSet.FindAll(x => x.Equals(pNext)).Count() == 0)
542
                {
543
                    newPointSet[NextP] = pNext;
544
                }
545

    
546
                path.PointSet = newPointSet;
547
            }
548

    
549
            this.UpdateControl();
550
        }
551

    
552
        /// <summary>
553
        /// return circlecontrols' area
554
        /// </summary>
555
        /// <author>humkyung</author>
556
        /// <date>2019.06.13</date>
557
        public override Rect ItemRect
558
        {
559
            get
560
            {
561
                double dMinX = Math.Min(this.StartPoint.X, this.EndPoint.X);
562
                double dMinY = Math.Min(this.StartPoint.Y, this.EndPoint.Y);
563
                double dMaxX = Math.Max(this.StartPoint.X, this.EndPoint.X);
564
                double dMaxY = Math.Max(this.StartPoint.Y, this.EndPoint.Y);
565

    
566
                return new Rect(new Point(dMinX, dMinY), new Point(dMaxX, dMaxY));
567
            }
568
        }
569

    
570
        /// <summary>
571
        /// Serialize this
572
        /// </summary>
573
        /// <param name="sUserId"></param>
574
        /// <returns></returns>
575
        public override string Serialize()
576
        {
577
            using (S_CircleControl STemp = new S_CircleControl())
578
            {
579
                STemp.TransformPoint = "0|0";
580
                STemp.SizeSet = String.Format("{0}", this.LineSize);
581
                STemp.PaintState = this.Paint;
582
                //STemp.StrokeColor = "#FF00FF00";
583
                STemp.StrokeColor = this.StrokeColor.Color.ToString();
584
                if (this.FillColor != null)
585
                {
586
                    STemp.FillColor = this.FillColor.Color.ToString();
587
                }
588
                STemp.StartPoint = this.StartPoint;
589
                STemp.UserID = this.UserID;
590
                STemp.EndPoint = this.EndPoint;
591
                STemp.TRP = this.TopRightPoint;
592
                STemp.LBP = this.LeftBottomPoint;
593
                STemp.Opac = this.Opacity;
594
                STemp.Angle = this.CommentAngle;
595
                STemp.PointSet = this.PointSet;
596
                STemp.DashSize = this.DashSize;
597
                STemp.Name = this.GetType().Name.ToString();
598
                ///강인구 추가(2017.11.02)
599
                ///Memo 추가
600
                STemp.Memo = this.Memo;
601

    
602
                return "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize()));
603
            };
604
        }
605

    
606
        /// <summary>
607
        /// create a circlecontrol from given string
608
        /// </summary>
609
        /// <param name="str"></param>
610
        /// <returns></returns>
611
        public static CircleControl FromString(string str, SolidColorBrush brush, string sProjectNo)
612
        {
613
            using (S_CircleControl s = JsonSerializerHelper.JsonDeserialize<S_CircleControl>(str))
614
            {
615
                string[] data2 = s.SizeSet.Split(CommentUserInfo.delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
616
                return new CircleControl
617
                {
618
                    LineSize = Convert.ToDouble(data2.First()),
619
                    Paint = s.PaintState,
620
                    StartPoint = s.StartPoint,
621
                    EndPoint = s.EndPoint,
622
                    LeftBottomPoint = s.LBP,
623
                    TopRightPoint = s.TRP,
624
                    Opacity = s.Opac,
625
                    CommentAngle = s.Angle,
626
                    DashSize = s.DashSize,
627
                    PointSet = s.PointSet,
628
                    StrokeColor = brush,
629
                    UserID = s.UserID,
630
                    Memo = s.Memo
631
                };
632
            }
633
        }
634
    }
635
}
클립보드 이미지 추가 (최대 크기: 500 MB)