프로젝트

일반

사용자정보

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

markus / MarkupToPDF / Controls / Line / ArcControl.cs @ b2d0f316

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

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.ComponentModel;
12
using System.Collections.Generic;
13
using MarkupToPDF.Controls.Common;
14
using MarkupToPDF.Common;
15
using MarkupToPDF.Serialize.S_Control;
16
using MarkupToPDF.Serialize.Core;
17
using System.Linq;
18

    
19
namespace MarkupToPDF.Controls.Line
20
{
21

    
22
    public class ArcControl : CommentUserInfo, IDisposable, INotifyPropertyChanged, IDashControl
23
    {
24
        #region 초기선언
25
        public event PropertyChangedEventHandler PropertyChanged;
26
        private const string PART_ArcPath = "PART_ArcPath";
27
        public Path Base_ArcPath = null;
28
        #endregion
29
        static ArcControl()
30
        {
31
            DefaultStyleKeyProperty.OverrideMetadata(typeof(ArcControl), new FrameworkPropertyMetadata(typeof(ArcControl)));
32
            //Application.Current.Resources.MergedDictionaries.Add(Application.LoadComponent(new Uri("/MarkupToPDF;Component/Themes/generic.xaml")) as ResourceDictionary);
33
            //ResourceDictionary dictionary = new ResourceDictionary();
34
            //dictionary.Source = new Uri("/MarkupToPDF;component/themes/generic.xaml", UriKind.RelativeOrAbsolute);
35
            //Application.Current.Resources.MergedDictionaries.Add(dictionary);
36
             //System.Diagnostics.Debug.WriteLine("resource Count :" + Application.Current.Resources.MergedDictionaries.Count);
37
        }
38

    
39
        public ArcControl()
40
        {
41
            //this.DefaultStyleKey = typeof(ArcControl);
42
        }
43

    
44
        public override void Copy(CommentUserInfo lhs)
45
        {
46
            if (lhs is ArcControl ArcCtrl)
47
            {
48
                this.StartPoint = new Point(ArcCtrl.StartPoint.X, ArcCtrl.StartPoint.Y);
49
                this.EndPoint = new Point(ArcCtrl.EndPoint.X, ArcCtrl.EndPoint.Y);
50
                this.DashSize = ArcCtrl.DashSize;
51
                this.PointSet = ArcCtrl.PointSet.ConvertAll(x => new Point(x.X, x.Y));
52
                this.isTransOn = ArcCtrl.isTransOn;
53
                this.MidPoint = new Point(ArcCtrl.MidPoint.X, ArcCtrl.MidPoint.Y);
54
                this.StrokeColor = ArcCtrl.StrokeColor;
55
                this.Opacity = ArcCtrl.Opacity;
56
                this.Clock = ArcCtrl.Clock;
57
                this.LineSize = ArcCtrl.LineSize;
58
                this.UserID = ArcCtrl.UserID;
59
                this.Memo = ArcCtrl.Memo;
60
            }
61
        }
62

    
63
        public override CommentUserInfo Clone()
64
        {
65
            var clone = new ArcControl();
66
            clone.Copy(this);
67
            return clone;
68
        }
69

    
70
        public void Dispose()
71
        {
72
            //GC.Collect();
73
            ////GC.SuppressFinalize(this);
74
            //Control control = new Control();
75
            this.Base_ArcPath = null;
76
        }
77
        protected void OnPropertyChanged(string propName)
78
        {
79
            if (PropertyChanged != null)
80
                PropertyChanged(this, new PropertyChangedEventArgs(propName));
81
        }
82

    
83
        #region Dependency Properties
84

    
85
        
86

    
87
        public static readonly DependencyProperty IsSelectedProperty =
88
    DependencyProperty.Register("IsSelected", typeof(bool), typeof(ArcControl), new FrameworkPropertyMetadata(false, IsSelectedChanged));
89

    
90
        public static readonly DependencyProperty ControlTypeProperty =
91
    DependencyProperty.Register("ControlType", typeof(ControlType), typeof(ArcControl), new FrameworkPropertyMetadata(ControlType.ArcLine));
92

    
93
        public static readonly DependencyProperty OverViewPathDataProperty = DependencyProperty.Register(
94
                "OverViewPathData", typeof(Geometry), typeof(ArcControl), new PropertyMetadata(null));
95

    
96
        public static readonly DependencyProperty UserIDProperty = DependencyProperty.Register(
97
                "UserID", typeof(string), typeof(ArcControl), new PropertyMetadata(null));
98
        public static readonly DependencyProperty LineSizeProperty = DependencyProperty.Register(
99
              "LineSize", typeof(double), typeof(ArcControl), new PropertyMetadata((Double)3));
100

    
101
//강인구 추가
102
        public static readonly DependencyProperty DashSizeProperty = DependencyProperty.Register(
103
              "DashSize", typeof(DoubleCollection), typeof(ArcControl), new PropertyMetadata(new DoubleCollection { 99999999 }, PointValueChanged));
104

    
105
        public static readonly DependencyProperty StrokeColorProperty = DependencyProperty.Register(
106
               "StrokeColor", typeof(SolidColorBrush), typeof(ArcControl), new PropertyMetadata(new SolidColorBrush(Colors.Red)));
107

    
108
        public static readonly DependencyProperty PathDataProperty = DependencyProperty.Register(
109
              "PathData", typeof(Geometry), typeof(ArcControl), null);
110

    
111
        //public static readonly DependencyProperty ClockProperty = DependencyProperty.Register(
112
        //       "Clock", typeof(SweepDirection), typeof(ArcControl), new PropertyMetadata(SweepDirection.Clockwise));
113
        public static readonly DependencyProperty ClockProperty = DependencyProperty.Register(
114
               "Clock", typeof(bool), typeof(ArcControl), new PropertyMetadata(false));
115

    
116
        public static readonly DependencyProperty StartPointProperty = DependencyProperty.Register(
117
               "StartPoint", typeof(Point), typeof(ArcControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
118
        public static readonly DependencyProperty MidPointProperty = DependencyProperty.Register(
119
               "MidPoint", typeof(Point), typeof(ArcControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
120

    
121
        public static readonly DependencyProperty EndPointProperty = DependencyProperty.Register(
122
               "EndPoint", typeof(Point), typeof(ArcControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
123
        
124
        public static readonly DependencyProperty PointSetProperty = DependencyProperty.Register(
125
                "PointSet", typeof(List<Point>), typeof(ArcControl), new PropertyMetadata(new List<Point>(), PointValueChanged));
126

    
127
        public static readonly DependencyProperty isTransOnProperty = DependencyProperty.Register(
128
                "isTransOn", typeof(bool), typeof(ArcControl), new PropertyMetadata(false));
129

    
130
        public static readonly DependencyProperty AngleProperty =
131
            DependencyProperty.Register("AngleValue", typeof(double), typeof(ArcControl), new PropertyMetadata((double)0.0, new PropertyChangedCallback
132
                (AngleValueChanged)));
133

    
134
        public static readonly DependencyProperty CenterXProperty =
135
            DependencyProperty.Register("CenterX", typeof(double), typeof(ArcControl), new PropertyMetadata((double)0, OnCenterXYChanged));
136

    
137
        public static readonly DependencyProperty CenterYProperty =
138
            DependencyProperty.Register("CenterY", typeof(double), typeof(ArcControl), new PropertyMetadata((double)0, OnCenterXYChanged));
139
        #endregion
140
        #region PropertyChanged Method
141
        
142
        public static void IsSelectedChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
143
        {
144
            //var instance = (ArcControl)sender;
145

    
146
            //if (e.OldValue != e.NewValue && instance.Base_ArcPath != null)
147
            //{
148

    
149
            //    instance.SetValue(e.Property, e.NewValue);
150

    
151
            //    if (instance.IsSelected)
152
            //    {
153
            //        instance.Base_ArcPath.Stroke = new SolidColorBrush(Colors.Blue);
154
            //    }
155
            //    else
156
            //    {
157
            //        instance.Base_ArcPath.Stroke = new SolidColorBrush(Colors.Red);
158
            //    }
159
            //}
160
        }
161

    
162

    
163
        public static void PointValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
164
        {
165
            var instance = (ArcControl)sender;
166
            if (e.OldValue != e.NewValue && instance.Base_ArcPath != null)
167
            {
168
                instance.SetValue(e.Property, e.NewValue);
169
                instance.SetArcPath();
170
            }
171
        }
172
        public static void AngleValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
173
        {
174
            var instance = (ArcControl)sender;
175
            if (e.OldValue != e.NewValue && instance.Base_ArcPath != null)
176
            {
177
                instance.SetValue(e.Property, e.NewValue);
178
                instance.SetArcPath();
179
            }
180
        }
181
        public static void OnCenterXYChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
182
        {
183
            var instance = (ArcControl)sender;
184
            if (e.OldValue != e.NewValue && instance.Base_ArcPath != null)
185
            {
186
                instance.SetValue(e.Property, e.NewValue);
187
                instance.SetArcPath();
188
            }
189
        }
190

    
191
      
192

    
193
        #endregion
194
        #region Properties
195
        public string UserID
196
        {
197
            get { return (string)GetValue(UserIDProperty); }
198
            set
199
            {
200
                if (this.UserID != value)
201
                {
202
                    SetValue(UserIDProperty, value);
203
                    OnPropertyChanged("UserID");
204
                }
205
            }
206
        }
207
        public Double LineSize
208
        {
209
            get { return (Double)GetValue(LineSizeProperty); }
210
            set
211
            {
212
                if (this.LineSize != value)
213
                {
214
                    SetValue(LineSizeProperty, value);
215
                }
216
            }
217
        }
218

    
219

    
220
        public bool Clock
221
        {
222
            get { return (bool)GetValue(ClockProperty); }
223
            set
224
            {
225
                if (this.Clock != value)
226
                {
227
                    SetValue(ClockProperty, value);
228
                    OnPropertyChanged("Clock");
229
                }
230
            }
231
        }
232

    
233
        //public SweepDirection Clock
234
        //{
235
        //    get { return (SweepDirection)GetValue(ClockProperty); }
236
        //    set
237
        //    {
238
        //        if (this.Clock != value)
239
        //        {
240
        //            SetValue(ClockProperty, value);
241
        //            OnPropertyChanged("Clock");
242
        //        }
243
        //    }
244
        //}
245
        public DoubleCollection DashSize
246
        {
247
            get { return (DoubleCollection)GetValue(DashSizeProperty); }
248
            set
249
            {
250
                if (this.DashSize != value)
251
                {
252
                    SetValue(DashSizeProperty, value);
253
                }
254
            }
255
        }
256
        public List<Point> PointSet
257
        {
258
            get { return (List<Point>)GetValue(PointSetProperty); }
259
            set { SetValue(PointSetProperty, value); }
260
        }
261
        public double CenterX
262
        {
263
            get { return (double)GetValue(CenterXProperty); }
264
            set { SetValue(CenterXProperty, value); }
265
        }
266
        public double CenterY
267
        {
268
            get { return (double)GetValue(CenterYProperty); }
269
            set { SetValue(CenterYProperty, value); }
270
        }
271
        public override SolidColorBrush StrokeColor
272
        {
273
            get { return (SolidColorBrush)GetValue(StrokeColorProperty); }
274
            set
275
            {
276
                if (this.StrokeColor != value)
277
                {
278
                    SetValue(StrokeColorProperty, value);
279
                }
280
            }
281
        }
282

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

    
296
        public Geometry PathData
297
        {
298
            get { return (Geometry)GetValue(PathDataProperty); }
299
            set
300
            {
301
                SetValue(PathDataProperty, value);
302
                OnPropertyChanged("PathData");
303
            }
304
        }
305
        public override bool IsSelected
306
        {
307
            get
308
            {
309
                return (bool)GetValue(IsSelectedProperty);
310
            }
311
            set
312
            {
313
                SetValue(IsSelectedProperty, value);
314
            }
315
        }
316

    
317
        public override ControlType ControlType
318
        {
319
            get
320
            {
321
                return (ControlType)GetValue(ControlTypeProperty);
322
            }
323
            set
324
            {
325
                SetValue(ControlTypeProperty, value);
326
                OnPropertyChanged("ControlType");
327
            }
328
        }
329
        public double AngleValue
330
        {
331
            get { return (double)GetValue(AngleProperty); }
332
            set { SetValue(AngleProperty, value); }
333
        }
334

    
335

    
336
        // CommentUserInfo에서 상속받기때문에 제거.
337

    
338
        //public double Angle
339
        //{
340
        //    get { return (double)GetValue(AngleProperty); }
341
        //    set
342
        //    {
343
        //        if (this.Angle != value)
344
        //        {
345
        //            SetValue(AngleProperty, value);
346
        //        }
347
        //    }
348
        //}
349

    
350
        public Point EndPoint
351
        {
352
            get { return (Point)GetValue(EndPointProperty); }
353
            set
354
            {
355
                SetValue(EndPointProperty, value);
356
                OnPropertyChanged("EndPoint");
357
            }
358
        }
359
        public Point StartPoint
360
        {
361
            get { return (Point)GetValue(StartPointProperty); }
362
            set
363
            {
364
                SetValue(StartPointProperty, value);
365
                OnPropertyChanged("StartPoint");
366
            }
367
        }
368
        public Point MidPoint
369
        {
370
            get { return (Point)GetValue(MidPointProperty); }
371
            set
372
            {
373
                SetValue(MidPointProperty, value);
374
                OnPropertyChanged("MidPoint");
375
            }
376
        }
377
        public bool isTransOn
378
        {
379
            get { return (bool)GetValue(isTransOnProperty); }
380
            set
381
            {
382
                SetValue(isTransOnProperty, value);
383
                OnPropertyChanged("isTransOn");
384
            }
385
        }
386

    
387
        #endregion
388
        #region Object & Variable
389
        PathGeometry pathGeometry = new PathGeometry();
390
        GeometryGroup instanceGroup = new GeometryGroup();
391
        #endregion
392
        public override void OnApplyTemplate()
393
        {
394
            base.OnApplyTemplate();
395
            Base_ArcPath = GetTemplateChild(PART_ArcPath) as Path;
396
            SetArcPath();
397
        }
398

    
399
        public override void UpdateControl()
400
        {
401
            this.StartPoint = new Point(this.PointSet[0].X, this.PointSet[0].Y);
402
            this.MidPoint = new Point(this.PointSet[1].X, this.PointSet[1].Y);
403
            this.EndPoint = new Point(this.PointSet[2].X, this.PointSet[2].Y);
404
        }
405

    
406
        public void setClock()
407
        {
408
            if (Clock)
409
            {
410
                this.Clock = false;
411
            }
412
            else
413
            {
414
                this.Clock = true;
415
            }
416
        }
417

    
418
        //public void setClock()
419
        //{
420
        //    if(this.Clock == SweepDirection.Clockwise)
421
        //    {
422
        //        this.Clock = SweepDirection.Counterclockwise;
423
        //    }
424
        //    else
425
        //    {
426
        //        this.Clock =SweepDirection.Clockwise;
427
        //    }
428
        //}
429
        private void SetArcPath()
430
        {
431
            this.ApplyTemplate();
432

    
433

    
434
            //강인구 추가
435
            Base_ArcPath.StrokeDashArray.Clear();
436
            foreach (var item in this.DashSize)
437
            {
438
                Base_ArcPath.StrokeDashArray.Add(item);
439
            }
440
            instanceGroup.Children.Clear();
441

    
442

    
443
            PathFigure pathFigure = new PathFigure();
444

    
445
            pathFigure.StartPoint = this.StartPoint;
446
            QuadraticBezierSegment qb = new QuadraticBezierSegment();
447

    
448

    
449
          
450

    
451

    
452
            
453
            
454

    
455

    
456
            if (MidPoint != null)
457
            {
458
                if (MidPoint == new Point(0,0))
459
                {
460
                    double xSharp = 0;
461
                    double ySharp = 0;
462

    
463
                    //Point t_start = new Point(0, 0);
464
                    //Point t_end = new Point(30, 10);
465

    
466
                    var midP = MathSet.getMiddlePoint(StartPoint, EndPoint);
467
                    Point normalV = MathSet.GetNormVectorBetween(StartPoint, EndPoint);
468
                    var dis = MathSet.DistanceTo(StartPoint, EndPoint);
469

    
470
                    if (!this.Clock)
471
                    {
472
                        xSharp = -normalV.Y;
473
                        ySharp = normalV.X;
474
                    }
475
                    else
476
                    {
477
                        xSharp = normalV.Y;
478
                        ySharp = -normalV.X;
479
                    }
480

    
481
                    var pointN = new Point(xSharp * dis, ySharp * dis);
482
                    MidPoint = new Point(pointN.X + midP.X, pointN.Y + midP.Y);
483
                }
484
                ////System.Diagnostics.Debug.WriteLine(this.MidPoint.ToString());
485
                //qb.Point1 = new Point(200, 200);
486
                //qb.Point1 = this.MidPoint;
487
                qb.Point1 = this.MidPoint;
488
            }
489

    
490
            qb.Point2 = this.EndPoint;
491
            pathFigure.Segments.Add(qb);
492
            pathGeometry.Figures = new PathFigureCollection();
493
            pathGeometry.Figures.Add(pathFigure);
494
            pathFigure.IsFilled = false;
495
            pathFigure.IsClosed = false;
496
            instanceGroup.Children.Add(pathGeometry);
497

    
498
            //Arc Arrow
499
            //if(ControlType == ControlType.ArcArrow)
500
            if (isTransOn)
501
            {
502
                //isTransOn = true;
503
                instanceGroup.Children.Add(DrawSet.DrawArrow(this.MidPoint, this.StartPoint, this.LineSize));
504
                instanceGroup.Children.Add(DrawSet.DrawArrow(this.EndPoint, this.MidPoint, this.LineSize));
505
                this.Base_ArcPath.Fill = this.StrokeColor;
506
            }
507
            //Base_ArcPath.StrokeThickness = 3;
508

    
509
            instanceGroup.FillRule = FillRule.Nonzero;
510
            this.PathData = instanceGroup;
511
            this.OverViewPathData = PathData;
512

    
513
        }
514

    
515
        public static PathGeometry ConverseAllow(Point p2, Point p1, double lineSize)
516
        {
517
            double theta = Math.Atan2((p2.Y - p1.Y), (p2.X - p1.X)) * 180 / Math.PI;
518
            PathGeometry pathGeometry2 = new PathGeometry();
519
            PathFigure pathFigure2 = new PathFigure();
520
            pathFigure2.StartPoint = p2;
521

    
522
            Point lpoint2 = new Point(p2.X + lineSize * 2, p2.Y + lineSize * 4);
523
            Point rpoint2 = new Point(p2.X - lineSize * 2, p2.Y + lineSize * 4);
524
            LineSegment seg1_1 = new LineSegment();
525
            seg1_1.Point = lpoint2;
526
            pathFigure2.Segments.Add(seg1_1);
527

    
528
            LineSegment seg2_1 = new LineSegment();
529
            seg2_1.Point = rpoint2;
530
            pathFigure2.Segments.Add(seg2_1);
531

    
532
            LineSegment seg3_1 = new LineSegment();
533
            seg3_1.Point = p2;
534
            pathFigure2.Segments.Add(seg3_1);
535

    
536
            LineSegment seg4_1 = new LineSegment();
537

    
538
            seg4_1.Point = new Point(lpoint2.X, lpoint2.Y);
539
            pathFigure2.Segments.Add(seg4_1);
540

    
541
            //pathFigure2.IsFilled = true;
542
            //pathFigure2.IsClosed = true;
543

    
544
            RotateTransform transform2 = new RotateTransform();
545
            transform2.Angle = theta + 90;
546
            transform2.CenterX = p2.X;
547
            transform2.CenterY = p2.Y;
548
            pathGeometry2.Figures.Add(pathFigure2);
549
            pathGeometry2.Transform = transform2;
550
            return pathGeometry2;
551
        }
552

    
553
        public override void ApplyOverViewData()
554
        {
555
            this.OverViewPathData = this.PathData;
556
        }
557

    
558
        /// <summary>
559
        /// call when mouse is moving while drawing control
560
        /// </summary>
561
        /// <author>humkyung</author>
562
        /// <param name="pt"></param>
563
        /// <param name="bAxisLocked"></param>
564
        public override void OnCreatingMouseMove(Point pt, bool bAxisLocked)
565
        {
566
            this.isTransOn = false;
567
            this.EndPoint = pt;
568
            this.MidPoint = new Point(0, 0);
569

    
570
            Point tmp = this.EndPoint;
571
            CommentAngle = MathSet.returnAngle(this.StartPoint, ref tmp, bAxisLocked);
572

    
573
            if (bAxisLocked)
574
            {
575
                this.EndPoint = tmp;
576
            }
577

    
578
            this.PointSet = new List<Point>
579
            {
580
                this.StartPoint,
581
                this.MidPoint,
582
                this.EndPoint,
583
            };
584
        }
585

    
586
        /// <summary>
587
        /// move control point has same location of given pt along given delta
588
        /// </summary>
589
        /// <author>humkyung</author>
590
        /// <date>2019.06.20</date>
591
        /// <param name="pt"></param>
592
        /// <param name="dx"></param>
593
        /// <param name="dy"></param>
594
        public override void OnMoveCtrlPoint(Point pt, double dx, double dy, bool bAxisLocked = false)
595
        {
596
            Point selected = MathSet.getNearPoint((this as IPath).PointSet, pt);
597

    
598
            var tmpPointSet = (this as IPath).PointSet.Where(x => !x.Equals(selected));
599
            Point NearStartpoint = MathSet.getNearPoint(tmpPointSet.ToList(), pt);
600

    
601
            selected.X += dx;
602
            selected.Y += dy;
603

    
604
            Point tmp = selected;
605

    
606
            CommentAngle = MathSet.returnAngle(NearStartpoint, ref tmp, bAxisLocked);
607

    
608
            if (bAxisLocked)
609
            {
610
                selected = tmp;
611
            }
612

    
613
            for (int i = 0; i < (this as IPath).PointSet.Count; i++)
614
            {
615
                if (pt.Equals((this as IPath).PointSet[i]))
616
                {
617
                    (this as IPath).PointSet[i] = selected;
618
                }
619
            }
620
            this.UpdateControl();
621
        }
622

    
623
        /// <summary>
624
        /// return Arc's area
625
        /// </summary>
626
        /// <author>humkyung</author>
627
        /// <date>2019.06.13</date>
628
        public override Rect ItemRect
629
        {
630
            get
631
            {
632
                double dMinX = Math.Min(this.StartPoint.X, this.EndPoint.X);
633
                dMinX = Math.Min(this.MidPoint.X, dMinX);
634
                double dMinY = Math.Min(this.StartPoint.Y, this.EndPoint.Y);
635
                dMinY = Math.Min(this.MidPoint.Y, dMinY);
636
                double dMaxX = Math.Max(this.StartPoint.X, this.EndPoint.X);
637
                dMaxX = Math.Max(this.MidPoint.X, dMaxX);
638
                double dMaxY = Math.Max(this.StartPoint.Y, this.EndPoint.Y);
639
                dMaxY = Math.Max(this.MidPoint.Y, dMaxY);
640

    
641
                return new Rect(new Point(dMinX, dMinY), new Point(dMaxX, dMaxY));
642
            }
643
        }
644

    
645
        /// <summary>
646
        /// Serialize this
647
        /// </summary>
648
        /// <param name="sUserId"></param>
649
        /// <returns></returns>
650
        public override string Serialize()
651
        {
652
            using (S_ArcControl ctrl = new S_ArcControl())
653
            {
654
                ctrl.TransformPoint = "0|0";
655
                ctrl.PointSet = this.PointSet;
656
                ctrl.SizeSet = String.Format("{0}", this.LineSize);
657
                //ctrl.StrokeColor = "#FF000FFF";
658
                ctrl.StrokeColor = this.StrokeColor.Color.ToString();
659
                ctrl.StartPoint = this.StartPoint;
660
                ctrl.UserID = this.UserID;
661
                ctrl.Opac = this.Opacity;
662
                ctrl.MidPoint = this.MidPoint;
663
                ctrl.EndPoint = this.EndPoint;
664
                ctrl.IsTransOn = this.isTransOn;
665
                ctrl.DashSize = this.DashSize;
666
                ctrl.Clock = this.Clock;
667
                //ctrl.ArcStyleSet = instance.ControlType;
668
                ctrl.Name = this.GetType().Name.ToString();
669

    
670
                ///강인구 추가(2017.11.02)
671
                ///Memo 추가
672
                ctrl.Memo = this.Memo;
673

    
674
                ctrl.ZIndex = this.ZIndex;
675

    
676
                return "|DZ|" + JsonSerializerHelper.CompressString((ctrl.JsonSerialize()));
677
            }
678
        }
679

    
680
        /// <summary>
681
        /// create a arccontrol from given string
682
        /// </summary>
683
        /// <param name="str"></param>
684
        /// <returns></returns>
685
        public static ArcControl FromString(string str, SolidColorBrush brush, string sProjectNo)
686
        {
687
            ArcControl instance = null;
688
            using (S_ArcControl s = JsonSerializerHelper.JsonDeserialize<S_ArcControl>(str))
689
            {
690
                string[] data2 = s.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
691
                instance = new ArcControl()
692
                {
693
                    StartPoint = s.StartPoint,
694
                    EndPoint = s.EndPoint,
695
                    DashSize = s.DashSize,
696
                    PointSet = s.PointSet,
697
                    isTransOn = s.IsTransOn,
698
                    MidPoint = s.MidPoint,
699
                    StrokeColor = brush,
700
                    Opacity = s.Opac,
701
                    Clock = s.Clock,
702
                    LineSize = Convert.ToDouble(data2.First()),
703
                    UserID = s.UserID,
704
                    Memo = s.Memo,
705
                    ZIndex = s.ZIndex
706
                };
707
            }
708

    
709
            return instance;
710
        }
711
    }
712
}
클립보드 이미지 추가 (최대 크기: 500 MB)