프로젝트

일반

사용자정보

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

markus / MarkupToPDF / Controls / Line / LineControl.cs @ fa48eb85

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

1 787a4489 KangIngu
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 036650a0 humkyung
using MarkupToPDF.Serialize.S_Control;
16
using MarkupToPDF.Serialize.Core;
17 661b7416 humkyung
using System.Linq;
18 787a4489 KangIngu
19
namespace MarkupToPDF.Controls.Line
20
{
21
    [TemplatePart(Name = "PART_LinePath", Type = typeof(Path))]
22
    public class LineControl : CommentUserInfo, IDisposable, INotifyPropertyChanged, IMarkupCommonData, IDashControl
23
    {
24
        public event PropertyChangedEventHandler PropertyChanged;
25
26
        private const string PART_LinePath = "PART_LinePath";
27
        public Path Base_LinePath = null;
28
29
        static LineControl()
30
        {
31
            DefaultStyleKeyProperty.OverrideMetadata(typeof(LineControl), new FrameworkPropertyMetadata(typeof(LineControl)));
32
            //Application.Current.Resources.MergedDictionaries.Add(Application.LoadComponent(new Uri("/MarkupToPDF;Component/Themes/generic.xaml")) as ResourceDictionary);
33 a6f7f9b6 djkim
            //ResourceDictionary dictionary = new ResourceDictionary();
34 787a4489 KangIngu
35 a6f7f9b6 djkim
            //dictionary.Source = new Uri("/MarkupToPDF;component/Themes/generic.xaml", UriKind.RelativeOrAbsolute);
36
            //Application.Current.Resources.MergedDictionaries.Add(dictionary);
37 787a4489 KangIngu
             //System.Diagnostics.Debug.WriteLine("resource Count :" + Application.Current.Resources.MergedDictionaries.Count);
38 a6f7f9b6 djkim
        }
39 787a4489 KangIngu
40
        public double DimSize
41
        {
42
            get { return (double)GetValue(DimSizeProperty); }
43
            set
44
            {
45
                if (this.DimSize != value)
46
                {
47
                    SetValue(DimSizeProperty, value);
48
                    OnPropertyChanged("DimSize");
49
                }
50
            }
51
        }
52
53
        public LineControl()
54
        {
55 a6f7f9b6 djkim
            //this.DefaultStyleKey = typeof(LineControl);
56 787a4489 KangIngu
        }
57
58
        public void Dispose()
59
        {
60 a6f7f9b6 djkim
            //GC.Collect();
61
            //GC.SuppressFinalize(this);
62
            this.Base_LinePath = null;
63 787a4489 KangIngu
        }
64
        protected void OnPropertyChanged(string propName)
65
        {
66
            if (PropertyChanged != null)
67
                PropertyChanged(this, new PropertyChangedEventArgs(propName));
68
        }
69
        #region Dependency Properties
70
71
        public static readonly DependencyProperty IsSelectedProperty =
72
     DependencyProperty.Register("IsSelected", typeof(bool), typeof(LineControl), new FrameworkPropertyMetadata(false, IsSelectedChanged));
73
74
        public static readonly DependencyProperty ControlTypeProperty =
75
    DependencyProperty.Register("ControlType", typeof(ControlType), typeof(LineControl), new FrameworkPropertyMetadata(ControlType.SingleLine));
76
77
        public static readonly DependencyProperty OverViewPathDataProperty = DependencyProperty.Register(
78
                "OverViewPathData", typeof(Geometry), typeof(LineControl), new PropertyMetadata(null));
79
80
        public static readonly DependencyProperty UserIDProperty = DependencyProperty.Register(
81
                "UserID", typeof(string), typeof(LineControl), new PropertyMetadata(null));
82
83
        public static readonly DependencyProperty LineSizeProperty = DependencyProperty.Register(
84 b3fb7321 ljiyeon
                "LineSize", typeof(double), typeof(LineControl), new PropertyMetadata((Double)3, PointValueChanged));
85 787a4489 KangIngu
86
        public static readonly DependencyProperty IntervalProperty = DependencyProperty.Register(
87 5ce56a3a KangIngu
                "Interval", typeof(double), typeof(LineControl), new PropertyMetadata((Double)10, PointValueChanged));
88 787a4489 KangIngu
89
//강인구 추가
90
        public static readonly DependencyProperty DashSizeProperty = DependencyProperty.Register(
91
                "DashSize", typeof(DoubleCollection), typeof(LineControl), new PropertyMetadata(new DoubleCollection { 1, 1 }, PointValueChanged));
92
        //public static readonly DependencyProperty DashSizeProperty = DependencyProperty.Register(
93
        //        "DashSize", typeof(DoubleCollection), typeof(LineControl), new PropertyMetadata(new DoubleCollection { 1, 1 }));
94
95
        public static readonly DependencyProperty StrokeColorProperty = DependencyProperty.Register(
96
               "StrokeColor", typeof(SolidColorBrush), typeof(LineControl), new PropertyMetadata(new SolidColorBrush(Colors.Red)));
97
98
        public static readonly DependencyProperty PathDataProperty = DependencyProperty.Register(
99
              "PathData", typeof(Geometry), typeof(LineControl), null);
100
101
        public static readonly DependencyProperty LineStyleProperty = DependencyProperty.Register(
102
               "LineStyleSet", typeof(LineStyleSet), typeof(LineControl), new PropertyMetadata(LineStyleSet.SingleLine));
103
104
        public static readonly DependencyProperty StartPointProperty = DependencyProperty.Register(
105
               "StartPoint", typeof(Point), typeof(LineControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
106
107
        public static readonly DependencyProperty EndPointProperty = DependencyProperty.Register(
108
               "EndPoint", typeof(Point), typeof(LineControl), new PropertyMetadata(new Point(100, 100), PointValueChanged));
109
110
        public static readonly DependencyProperty PointSetProperty = DependencyProperty.Register(
111
                "PointSet", typeof(List<Point>), typeof(LineControl), new PropertyMetadata(new List<Point>(), PointValueChanged));
112
        
113
        
114
        public static readonly DependencyProperty MiddlePointProperty = DependencyProperty.Register(
115
                "MiddlePoint", typeof(Point), typeof(LineControl), new PropertyMetadata(new Point(0, 0)));
116
        public static readonly DependencyProperty DimSizeProperty = DependencyProperty.Register(
117
                "DimSize", typeof(double), typeof(LineControl), new PropertyMetadata((double)5));
118
119
        public static readonly DependencyProperty AngleProperty =
120
            DependencyProperty.Register("AngleValue", typeof(double), typeof(LineControl), new PropertyMetadata((double)0.0, new PropertyChangedCallback(AngleValueChanged)));
121
122
        public static readonly DependencyProperty CenterXProperty =
123
            DependencyProperty.Register("CenterX", typeof(double), typeof(LineControl), new PropertyMetadata((double)0, OnCenterXYChanged));
124
125
        public static readonly DependencyProperty CenterYProperty =
126
            DependencyProperty.Register("CenterY", typeof(double), typeof(LineControl), new PropertyMetadata((double)0, OnCenterXYChanged));
127
        #endregion
128
        #region PropertyChanged Method
129
130
        public static void IsSelectedChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
131
        {
132
            //var instance = (LineControl)sender;
133
134
            //if (e.OldValue != e.NewValue && instance.Base_LinePath != null)
135
            //{
136
137
            //    instance.SetValue(e.Property, e.NewValue);
138
139
            //    if (instance.IsSelected)
140
            //    {
141
            //        instance.Base_LinePath.Stroke = new SolidColorBrush(Colors.Blue);
142
            //    }
143
            //    else
144
            //    {
145
            //        instance.Base_LinePath.Stroke = new SolidColorBrush(Colors.Red); 
146
            //    }
147
            //}
148
        }
149
150
        public static void PointValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
151
        {
152
            var instance = (LineControl)sender;
153
            if (e.OldValue != e.NewValue && instance.Base_LinePath != null)
154
            {
155
                instance.SetValue(e.Property, e.NewValue);
156
                instance.SetLinePath();
157
            }
158
        }
159
        public static void AngleValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
160
        {
161
            var instance = (LineControl)sender;
162
            if (e.OldValue != e.NewValue && instance.Base_LinePath != null)
163
            {
164
                instance.SetValue(e.Property, e.NewValue);
165
                instance.SetLinePath();
166
            }
167
        }
168
        public static void OnCenterXYChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
169
        {
170
            var instance = (LineControl)sender;
171
            if (e.OldValue != e.NewValue && instance.Base_LinePath != null)
172
            {
173
                instance.SetValue(e.Property, e.NewValue);
174
                instance.SetLinePath();
175
            }
176
        }
177
178
        #endregion
179
        #region Properties
180
        public string UserID
181
        {
182
            get { return (string)GetValue(UserIDProperty); }
183
            set
184
            {
185
                if (this.UserID != value)
186
                {
187
                    SetValue(UserIDProperty, value);
188
                    OnPropertyChanged("UserID");
189
                }
190
            }
191
        }
192
193 5ce56a3a KangIngu
        public Double Interval
194 787a4489 KangIngu
        {
195 5ce56a3a KangIngu
            get { return (Double)GetValue(IntervalProperty); }
196 787a4489 KangIngu
            set
197
            {
198
                if (this.Interval != value)
199
                {
200
                    SetValue(IntervalProperty, value);
201
                    OnPropertyChanged("Interval");
202
                }
203
            }
204
        }
205
        public Double LineSize
206
        {
207
            get { return (Double)GetValue(LineSizeProperty); }
208
            set
209
            {
210
                if (this.LineSize != value)
211
                {
212
                    SetValue(LineSizeProperty, value);
213
                }
214
            }
215
        }
216
        public DoubleCollection DashSize
217
        {
218
            get { return (DoubleCollection)GetValue(DashSizeProperty); }
219
            set
220
            {
221
                if (this.DashSize != value)
222
                {
223
                    SetValue(DashSizeProperty, value);
224
                }
225
            }
226
        }
227
        public List<Point> PointSet
228
        {
229
            get { return (List<Point>)GetValue(PointSetProperty); }
230
            set { SetValue(PointSetProperty, value); }
231
        }
232
        public double CenterX
233
        {
234
            get { return (double)GetValue(CenterXProperty); }
235
            set { SetValue(CenterXProperty, value); }
236
        }
237
        public double CenterY
238
        {
239
            get { return (double)GetValue(CenterYProperty); }
240
            set { SetValue(CenterYProperty, value); }
241
        }
242 4913851c humkyung
        public override SolidColorBrush StrokeColor
243 787a4489 KangIngu
        {
244
            get { return (SolidColorBrush)GetValue(StrokeColorProperty); }
245
            set
246
            {
247
                if (this.StrokeColor != value)
248
                {
249
                    SetValue(StrokeColorProperty, value);
250
                }
251
            }
252
        }
253
254
255
        public Geometry PathData
256
        {
257
            get { return (Geometry)GetValue(PathDataProperty); }
258
            set
259
            {
260
                SetValue(PathDataProperty, value);
261
                OnPropertyChanged("PathData");
262
            }
263
        }
264
265
266
267
        public Geometry OverViewPathData
268
        {
269
            get
270
            {
271
                return (Geometry)GetValue(OverViewPathDataProperty);
272
            }
273
            set
274
            {
275
                SetValue(OverViewPathDataProperty, value);
276
                OnPropertyChanged("OverViewPathData");
277
            }
278
        }
279
280 959b3ef2 humkyung
        public override bool IsSelected
281 787a4489 KangIngu
        {
282
            get
283
            {
284
                return (bool)GetValue(IsSelectedProperty);
285
            }
286
            set
287
            {
288
                SetValue(IsSelectedProperty, value);
289
            }
290
        }
291
292
        public LineStyleSet LineStyleSet
293
        {
294
            get
295
            {
296
                return (LineStyleSet)GetValue(LineStyleProperty);
297
            }
298
            set
299
            {
300
                SetValue(LineStyleProperty, value);
301
            }
302
        }
303
304 5529d2a2 humkyung
        public override ControlType ControlType
305 787a4489 KangIngu
        {
306
            get
307
            {
308
                return (ControlType)GetValue(ControlTypeProperty);
309
            }
310
            set
311
            {
312
                SetValue(ControlTypeProperty, value);
313
            }
314
        }
315
316
        public double AngleValue
317
        {
318
            get { return (double)GetValue(AngleProperty); }
319
            set { SetValue(AngleProperty, value); }
320
        }
321 168f8027 taeseongkim
        //public double Angle
322
        //{
323
        //    get { return (double)GetValue(AngleProperty); }
324
        //    set
325
        //    {
326
        //        if (this.Angle != value)
327
        //        {
328
        //            SetValue(AngleProperty, value);
329
        //        }
330
        //    }
331
        //}
332 787a4489 KangIngu
        public Point EndPoint
333
        {
334
            get { return (Point)GetValue(EndPointProperty); }
335
            set
336
            {
337
                SetValue(EndPointProperty, value);
338
                OnPropertyChanged("EndPoint");
339
            }
340
        }
341
        public Point StartPoint
342
        {
343
            get { return (Point)GetValue(StartPointProperty); }
344
            set
345
            {
346
                SetValue(StartPointProperty, value);
347
                OnPropertyChanged("StartPoint");
348
            }
349
        }
350
        GeometryGroup instanceGroup = new GeometryGroup();
351
        LineGeometry connectorGeometry = new LineGeometry();
352
353
        #endregion
354
        public override void OnApplyTemplate()
355
        {
356
            base.OnApplyTemplate();
357
            Base_LinePath = GetTemplateChild("PART_LinePath") as Path;
358
            SetLinePath();
359
        }
360 661b7416 humkyung
361 0d00f9c8 humkyung
        public override void UpdateControl()
362 787a4489 KangIngu
        {
363
            this.StartPoint = new Point(this.PointSet[0].X, this.PointSet[0].Y);
364
            this.EndPoint = new Point(this.PointSet[1].X, this.PointSet[1].Y);
365
        }
366
367
        public static List<LineGeometry> DimAllow(Point p1, Point p2, Double lineSize, double DimSize)
368
        {
369
            //lineSize = 2;
370
            List<LineGeometry> GeometrySet = new List<LineGeometry>();
371
            double theta = Math.Atan2((p2.Y - p1.Y), (p2.X - p1.X)) * 180 / Math.PI;
372
373
374
            LineGeometry ld = new LineGeometry();
375
            //ld.StartPoint = new Point(p2.X + lineSize, p2.Y - lineSize * 4 - DimSize);
376
            //ld.EndPoint = new Point(p2.X + lineSize, p2.Y + lineSize * 4 + DimSize);
377
            ld.StartPoint = new Point(p2.X + lineSize, p2.Y - lineSize * 4);
378
            ld.EndPoint = new Point(p2.X + lineSize, p2.Y + lineSize * 4 + DimSize);
379
380
            RotateTransform transform3 = new RotateTransform();
381
            transform3.Angle = theta;
382
            transform3.CenterX = p2.X;
383
            transform3.CenterY = p2.Y;
384
            ld.Transform = transform3;
385
            GeometrySet.Add(ld);
386
387
            LineGeometry ld1 = new LineGeometry();
388
            //ld1.StartPoint = new Point(p1.X - lineSize, p1.Y - lineSize * 4 - DimSize);
389
            //ld1.EndPoint = new Point(p1.X - lineSize, p1.Y + lineSize * 4 + DimSize);
390
            ld1.StartPoint = new Point(p1.X - lineSize, p1.Y - lineSize * 4);
391
            ld1.EndPoint = new Point(p1.X - lineSize, p1.Y + lineSize * 4 + DimSize);
392
393
            RotateTransform transform4 = new RotateTransform();
394
            transform4.Angle = theta;
395
            transform4.CenterX = p1.X;
396
            transform4.CenterY = p1.Y;
397
            ld1.Transform = transform4;
398
            GeometrySet.Add(ld1);
399
            return GeometrySet;
400
        }
401
402
403 f513c215 humkyung
        public override void ApplyOverViewData()
404 787a4489 KangIngu
        {
405
            this.OverViewPathData = this.PathData;
406
        }
407
408 661b7416 humkyung
        private void SetLinePath()
409 787a4489 KangIngu
        {
410
            this.ApplyTemplate();           
411
            if (this.DashSize != null)
412
            {
413
                Base_LinePath.StrokeDashArray.Clear();
414
                foreach (var item in this.DashSize)
415
                {
416
                    Base_LinePath.StrokeDashArray.Add(item);
417
                }
418
                Base_LinePath.StrokeDashCap = PenLineCap.Square;
419
            }
420
421
            PathFigure pathFigure = new PathFigure(); 
422
            pathFigure.StartPoint = this.StartPoint;
423
            LineSegment lineSegment0 = new LineSegment();
424
            lineSegment0.Point = this.EndPoint;
425
            pathFigure.Segments.Add(lineSegment0);
426
            PathGeometry pathGeometry = new PathGeometry();
427
            pathGeometry.Figures = new PathFigureCollection();
428
            pathGeometry.Figures.Add(pathFigure);
429
430
            
431
432
            instanceGroup.Children.Clear();
433
            switch (LineStyleSet)
434
            {
435
                case LineStyleSet.ArrowLine:
436 d251456f humkyung
                    instanceGroup.Children.Add(DrawSet.DrawArrow(this.StartPoint, this.EndPoint, this.LineSize));
437 787a4489 KangIngu
                    break;
438
                case LineStyleSet.TwinLine:
439 d251456f humkyung
                    instanceGroup.Children.Add(DrawSet.DrawArrow(this.StartPoint, this.EndPoint, this.LineSize));
440
                    instanceGroup.Children.Add(DrawSet.DrawArrow(this.EndPoint, this.StartPoint, this.LineSize));
441 787a4489 KangIngu
                    break;
442
                case LineStyleSet.DimLine:
443
                    List<LineGeometry> metrySet = DimAllow(this.StartPoint, this.EndPoint, this.LineSize, this.DimSize);
444
                    instanceGroup.Children.Add(metrySet[0]);
445
                    instanceGroup.Children.Add(metrySet[1]);
446 d251456f humkyung
                    instanceGroup.Children.Add(DrawSet.DrawArrow(this.StartPoint, this.EndPoint, this.LineSize));
447
                    instanceGroup.Children.Add(DrawSet.DrawArrow(this.EndPoint, this.StartPoint, this.LineSize));
448 787a4489 KangIngu
                    break;
449
                case LineStyleSet.CancelLine:
450
                    PathFigure pathFigure_Multi = new PathFigure();
451
                    LineSegment lineSegment1 = new LineSegment();
452
453
                    var x = Math.Abs((Math.Abs(this.StartPoint.X) - Math.Abs(this.EndPoint.X)));
454
                    var y = Math.Abs((Math.Abs(this.StartPoint.Y) - Math.Abs(this.EndPoint.Y)));
455
456
                    if (x > y)
457
                    {
458
                        pathFigure_Multi.StartPoint = new Point(this.StartPoint.X, this.StartPoint.Y + (this.Interval));
459
                        lineSegment1.Point = new Point(this.EndPoint.X, this.EndPoint.Y + (this.Interval));
460
                    }
461
                    else
462
                    {
463
                        pathFigure_Multi.StartPoint = new Point(this.StartPoint.X + (this.Interval), this.StartPoint.Y);
464
                        lineSegment1.Point = new Point(this.EndPoint.X + (this.Interval), this.EndPoint.Y);
465
                    }
466
                    pathFigure_Multi.Segments.Add(lineSegment1);
467
                    pathGeometry.Figures.Add(pathFigure_Multi);
468
469
                    this.PathData = pathGeometry;
470
                    this.OverViewPathData = PathData;
471
472
                    break;
473
                default:
474
                    break;
475
            }
476
            
477
478
            if (PathData != pathGeometry)
479
            {
480
                connectorGeometry.StartPoint = new Point(this.StartPoint.X, this.StartPoint.Y);
481
                connectorGeometry.EndPoint = new Point(this.EndPoint.X, this.EndPoint.Y);
482
483
                instanceGroup.Children.Add(connectorGeometry);
484
485
                this.PathData = instanceGroup;
486
                this.OverViewPathData = PathData;
487
            }
488
        }
489 a6272c57 humkyung
490
        /// <summary>
491
        /// call when mouse is moving while drawing control
492
        /// </summary>
493
        /// <author>humkyung</author>
494
        /// <param name="pt"></param>
495
        /// <param name="bAxisLocked"></param>
496
        public override void OnCreatingMouseMove(Point pt, bool bAxisLocked, bool bShiftKeyPressed)
497
        {
498
            if (this.ControlType == ControlType.DimLine)
499
                this.LineStyleSet = LineStyleSet.DimLine;
500
            else if (this.ControlType == ControlType.TwinLine)
501
                this.LineStyleSet = LineStyleSet.TwinLine;
502
            else if(this.ControlType == ControlType.ArrowLine)
503
                this.LineStyleSet = LineStyleSet.ArrowLine;
504
            else if(this.ControlType == ControlType.CancelLine)
505
                this.LineStyleSet = LineStyleSet.CancelLine;
506
            else if(this.ControlType == ControlType.SingleLine)
507
                this.LineStyleSet = LineStyleSet.SingleLine;
508
509
            this.EndPoint = pt;
510 168f8027 taeseongkim
511
            Point tmp = this.EndPoint;
512 fa48eb85 taeseongkim
            CommentAngle = MathSet.returnAngle(this.StartPoint, ref tmp, bShiftKeyPressed);
513 168f8027 taeseongkim
514 a6272c57 humkyung
            if (bAxisLocked || bShiftKeyPressed)
515
            {
516
                this.EndPoint = tmp;
517
            }
518
519
            this.PointSet = new List<Point>
520
            {
521
                this.StartPoint,
522
                this.EndPoint,
523
            };
524
        }
525 d2114d3b humkyung
526
        /// <summary>
527
        /// move control point has same location of given pt along given delta
528
        /// </summary>
529
        /// <author>humkyung</author>
530
        /// <date>2019.06.20</date>
531
        /// <param name="pt"></param>
532
        /// <param name="dx"></param>
533
        /// <param name="dy"></param>
534
        public override void OnMoveCtrlPoint(Point pt, double dx, double dy)
535
        {
536
            Point selected = MathSet.getNearPoint((this as IPath).PointSet, pt);
537
            selected.X += dx;
538
            selected.Y += dy;
539
            for (int i = 0; i < (this as IPath).PointSet.Count; i++)
540
            {
541
                if (pt.Equals((this as IPath).PointSet[i]))
542
                {
543
                    (this as IPath).PointSet[i] = selected;
544
                }
545
            }
546 0d00f9c8 humkyung
            this.UpdateControl();
547 d2114d3b humkyung
        }
548 036650a0 humkyung
549
        /// <summary>
550 91efe37a humkyung
        /// return linecontrols' area
551
        /// </summary>
552
        /// <author>humkyung</author>
553
        /// <date>2019.06.13</date>
554
        public override Rect ItemRect
555
        {
556
            get
557
            {
558
                double dMinX = Math.Min(this.StartPoint.X, this.EndPoint.X);
559
                double dMinY = Math.Min(this.StartPoint.Y, this.EndPoint.Y);
560
                double dMaxX = Math.Max(this.StartPoint.X, this.EndPoint.X);
561
                double dMaxY = Math.Max(this.StartPoint.Y, this.EndPoint.Y);
562
563
                return new Rect(new Point(dMinX, dMinY), new Point(dMaxX, dMaxY));
564
            }
565
        }
566
567
        /// <summary>
568 036650a0 humkyung
        /// Serialize this
569
        /// </summary>
570
        /// <param name="sUserId"></param>
571
        /// <returns></returns>
572
        public override string Serialize()
573
        {
574
            using (S_LineControl STemp = new S_LineControl())
575
            {
576
                STemp.TransformPoint = "0|0";
577
                STemp.PointSet = this.PointSet;
578
                STemp.SizeSet = String.Format("{0}", this.LineSize);
579
                STemp.LineStyleSet = this.LineStyleSet;
580
                //STemp.StrokeColor = "#FF00FF00";
581
                STemp.StrokeColor = this.StrokeColor.Color.ToString();
582
                STemp.StartPoint = this.StartPoint;
583
                STemp.EndPoint = this.EndPoint;
584
                STemp.UserID = this.UserID;
585
                STemp.Opac = this.Opacity;
586
                STemp.DashSize = this.DashSize;
587
                STemp.Interval = this.Interval;
588
                STemp.DimSize = this.DimSize;
589
                STemp.Name = this.GetType().Name.ToString();
590
591
                ///강인구 추가(2017.11.02)
592
                ///Memo 추가
593
                STemp.Memo = this.Memo;
594
595
                return "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize()));
596
            }
597
        }
598 661b7416 humkyung
599
        /// <summary>
600
        /// create a linecontrol from given string
601
        /// </summary>
602
        /// <param name="str"></param>
603
        /// <returns></returns>
604
        public static LineControl FromString(string str, SolidColorBrush brush, string sProjectNo)
605
        {
606
            LineControl instance = null;
607
            using (S_LineControl s = JsonSerializerHelper.JsonDeserialize<S_LineControl>(str))
608
            {
609
                string[] data2 = s.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
610
                instance = new LineControl()
611
                {
612
                    LineStyleSet = s.LineStyleSet,
613
                    StartPoint = s.StartPoint,
614
                    DimSize = s.DimSize,
615
                    EndPoint = s.EndPoint,
616
                    DashSize = s.DashSize,
617
                    Interval = s.Interval,
618
                    PointSet = s.PointSet,
619
                    Opacity = s.Opac,
620
                    StrokeColor = brush,
621
                    UserID = s.UserID,
622
                    LineSize = Convert.ToDouble(data2.First()),
623
                };
624
            }
625
626
            return instance;
627
        }
628 787a4489 KangIngu
    }
629
}
클립보드 이미지 추가 (최대 크기: 500 MB)