프로젝트

일반

사용자정보

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

markus / MarkupToPDF / Controls / Etc / SymControlN.cs @ b2d0f316

이력 | 보기 | 이력해설 | 다운로드 (22.9 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.Core;
16
using MarkupToPDF.Serialize.S_Control;
17 787a4489 KangIngu
18
namespace MarkupToPDF.Controls.Etc
19
{
20
    [TemplatePart(Name = "PART_ViewBox", Type = typeof(Viewbox))]
21
22
23
    public class SymControlN : CommentUserInfo, INotifyPropertyChanged , IViewBox, IMarkupCommonData
24
    {
25
        private const string PART_ViewBox = "PART_ViewBox";
26
        public Viewbox Base_ViewBox = null;
27 a6272c57 humkyung
        public string STAMP { get; set; }
28 43e1d368 taeseongkim
        public Dictionary<string,string> STAMP_Contents { get; set; }
29 787a4489 KangIngu
30
        static SymControlN()
31
        {
32
            DefaultStyleKeyProperty.OverrideMetadata(typeof(SymControlN), new FrameworkPropertyMetadata(typeof(SymControlN)));
33
            //Application.Current.Resources.MergedDictionaries.Add(Application.LoadComponent(new Uri("/MarkupToPDF;Component/Themes/generic.xaml")) as ResourceDictionary);
34 a6f7f9b6 djkim
            //ResourceDictionary dictionary = new ResourceDictionary();
35
            //dictionary.Source = new Uri("/MarkupToPDF;component/themes/generic.xaml", UriKind.RelativeOrAbsolute);
36
            //Application.Current.Resources.MergedDictionaries.Add(dictionary);
37
            // System.Diagnostics.Debug.WriteLine("resource Count :" + Application.Current.Resources.MergedDictionaries.Count);
38 787a4489 KangIngu
        }
39
40 7b34fb3a swate0609
        public override void Copy(CommentUserInfo lhs)
41
        {
42
            if (lhs is SymControlN symControlN)
43
            {
44
                this.PointSet = symControlN.PointSet.ConvertAll(x => new Point(x.X, x.Y));
45
                this.StartPoint = new Point(symControlN.StartPoint.X, symControlN.StartPoint.Y);
46 e7334a0c 이지연
                this.TopRightPoint = new Point(symControlN.TopRightPoint.X, symControlN.TopRightPoint.Y);
47 7b34fb3a swate0609
                this.EndPoint = new Point(symControlN.EndPoint.X, symControlN.EndPoint.Y);
48
                this.LeftBottomPoint = new Point(symControlN.LeftBottomPoint.X, symControlN.LeftBottomPoint.Y);
49 e7334a0c 이지연
                this.PointSet = symControlN.PointSet.ConvertAll(x => new Point(x.X, x.Y));
50
                this.CommentAngle = symControlN.CommentAngle;                                
51 7b34fb3a swate0609
                this.Opacity = symControlN.Opacity;
52
                this.PathXathData = symControlN.PathXathData;
53
                this.Memo = symControlN.Memo;
54 b2d0f316 humkyung
                this.ZIndex = symControlN.ZIndex;
55 7b34fb3a swate0609
            }
56
        }
57
58
        public override CommentUserInfo Clone()
59
        {
60
            var clone = new SymControlN();
61
            clone.Copy(this);
62
            return clone;
63
        }
64
65 787a4489 KangIngu
        public event PropertyChangedEventHandler PropertyChanged;
66
        protected void RaisePropertyChanged(string propName)
67
        {
68
            if (PropertyChanged != null)
69
                PropertyChanged(this, new PropertyChangedEventArgs(propName));
70
        }
71
        #region 내장 프로퍼티
72
        public static readonly DependencyProperty UserIDProperty = DependencyProperty.Register(
73
                "UserID", typeof(string), typeof(SymControlN), new PropertyMetadata(null));
74
         public static readonly DependencyProperty PathXathDataProperty = DependencyProperty.Register(
75
                "PathXathData", typeof(string), typeof(SymControlN), new PropertyMetadata(null));
76
        public static readonly DependencyProperty LineSizeProperty = DependencyProperty.Register(
77
                "LineSize", typeof(double), typeof(SymControlN), new PropertyMetadata((Double)1));
78
         public static readonly DependencyProperty EndPointProperty = DependencyProperty.Register(
79
                "EndPoint", typeof(Point), typeof(SymControlN), new PropertyMetadata(new Point(0, 0), PointValueChanged));
80
        public static readonly DependencyProperty StartPointProperty = DependencyProperty.Register(
81
                "StartPoint", typeof(Point), typeof(SymControlN), new PropertyMetadata(new Point(0, 0), PointValueChanged));
82
        public static readonly DependencyProperty TopRightPointProperty = DependencyProperty.Register(
83
                "TopRightPoint", typeof(Point), typeof(SymControlN), new PropertyMetadata(new Point(0, 0), PointValueChanged));
84
        public static readonly DependencyProperty StrokeColorProperty = DependencyProperty.Register(
85
                 "StrokeColor", typeof(SolidColorBrush), typeof(SymControlN), new PropertyMetadata(new SolidColorBrush(Colors.Red)));        
86
        public static readonly DependencyProperty LeftBottomPointProperty = DependencyProperty.Register(
87
                 "LeftBottomPoint", typeof(Point), typeof(SymControlN), new PropertyMetadata(new Point(0, 0), PointValueChanged));
88
        public static readonly DependencyProperty PointSetProperty = DependencyProperty.Register(
89
                 "PointSet", typeof(List<Point>), typeof(SymControlN), new PropertyMetadata(new List<Point>()));
90
        public static readonly DependencyProperty PathDataProperty = DependencyProperty.Register(
91
                 "PathData", typeof(Geometry), typeof(SymControlN), null);
92
        public static readonly DependencyProperty AngleProperty = DependencyProperty.Register("Angle", typeof(double), typeof(SymControlN),
93
          new PropertyMetadata((double)0.0, new PropertyChangedCallback(AngleValueChanged)));
94
        public static readonly DependencyProperty CenterXProperty = DependencyProperty.Register("CenterX", typeof(double), typeof(SymControlN),
95
            new PropertyMetadata((double)0, OnCenterXYChanged));
96
        public static readonly DependencyProperty CenterYProperty = DependencyProperty.Register("CenterY", typeof(double), typeof(SymControlN),
97
            new PropertyMetadata((double)0, OnCenterXYChanged));
98
99
        public static readonly DependencyProperty IsSelectedProperty =
100
     DependencyProperty.Register("IsSelected", typeof(bool), typeof(SymControlN), new FrameworkPropertyMetadata(false, IsSelectedChanged));
101
102
        public static readonly DependencyProperty ControlTypeProperty =
103 d7123191 KangIngu
            DependencyProperty.Register("ControlType", typeof(ControlType), typeof(SymControlN), new FrameworkPropertyMetadata(ControlType.Stamp));
104 787a4489 KangIngu
        #endregion
105
106
        #region PropertyChanged Method
107
108
        public static void IsSelectedChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
109
        {
110
111
        }
112
113
        public static void PointValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
114
        {
115
            var instance = (SymControlN)sender;
116
            if (e.OldValue != e.NewValue && instance.Base_ViewBox != null)
117
            {
118
                instance.SetValue(e.Property, e.NewValue);
119
                instance.SetViewBox();
120
            }
121
        }
122
        public static void OnCenterXYChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
123
        {
124
            var instance = (SymControlN)sender;
125
            if (e.OldValue != e.NewValue && instance.Base_ViewBox != null)
126
            {
127
                instance.SetValue(e.Property, e.NewValue);
128
                instance.SetViewBox();
129
            }
130
        }
131
        public static void AngleValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
132
        {
133
            var instance = (SymControlN)sender;
134
            if (e.OldValue != e.NewValue && instance.Base_ViewBox != null)
135
            {
136
                instance.SetValue(e.Property, e.NewValue);
137
                instance.SetViewBox();
138
            }
139
        }
140
        #endregion
141
142
        #region Properties
143
        public string UserID
144
        {
145
            get { return (string)GetValue(UserIDProperty); }
146
            set
147
            {
148
                if (this.UserID != value)
149
                {
150
                    SetValue(UserIDProperty, value);
151
                    RaisePropertyChanged("UserID");
152
                }
153
            }
154
        }
155
        public SolidColorBrush StrokeColor
156
        {
157
            get { return (SolidColorBrush)GetValue(StrokeColorProperty); }
158
            set
159
            {
160
                if (this.StrokeColor != value)
161
                {
162
                    SetValue(StrokeColorProperty, value);
163
                }
164
            }
165
        }
166
167
        public string PathXathData
168
        {
169
            get
170
            {
171
                return (string)GetValue(PathXathDataProperty);
172
            }
173
            set
174
            {
175
                SetValue(PathXathDataProperty, value);
176
                RaisePropertyChanged("PathXathData");
177
            }
178
            
179
        }
180
        public List<Point> PointSet
181
        {
182
            get { return (List<Point>)GetValue(PointSetProperty); }
183
            set { SetValue(PointSetProperty, value); }
184
        }
185
        public Point TopRightPoint
186
        {
187
            get { return (Point)GetValue(TopRightPointProperty); }
188
            set
189
            {
190
                SetValue(TopRightPointProperty, value);
191
                RaisePropertyChanged("TopRightPoint");
192
            }
193
        }
194
        public Point LeftBottomPoint
195
        {
196
            get { return (Point)GetValue(LeftBottomPointProperty); }
197
            set
198
            {
199
                SetValue(LeftBottomPointProperty, value);
200
                RaisePropertyChanged("LeftBottomPoint");
201
            }
202
        }
203
        public Point EndPoint
204
        {
205
            get { return (Point)GetValue(EndPointProperty); }
206
            set
207
            {
208
                SetValue(EndPointProperty, value);
209
                RaisePropertyChanged("EndPoint");
210
            }
211
        }
212
        public Point StartPoint
213
        {
214
            get { return (Point)GetValue(StartPointProperty); }
215
            set
216
            {
217
                SetValue(StartPointProperty, value);
218
                RaisePropertyChanged("StartPoint");
219
            }
220
        }
221
        #endregion
222
223
        public override void OnApplyTemplate()
224
        {
225
            base.OnApplyTemplate();
226
            Base_ViewBox = GetTemplateChild(PART_ViewBox) as Viewbox;
227
            SetViewBox();
228
        }
229
230
        public void SetViewBox()
231
        {
232
            this.ApplyTemplate();
233
            Point mid = MathSet.FindCentroid(new List<Point>()
234
            {
235
                this.StartPoint,
236
                this.LeftBottomPoint,
237
                this.EndPoint,
238
                this.TopRightPoint,                
239
            });
240 e7334a0c 이지연
            double AngleData = this.CommentAngle * -1;
241 787a4489 KangIngu
242
            PathFigure pathFigure = new PathFigure();
243
            pathFigure.StartPoint = MathSet.RotateAbout(mid, this.StartPoint, AngleData);
244
245
            LineSegment lineSegment0 = new LineSegment();
246
            lineSegment0.Point = MathSet.RotateAbout(mid, this.StartPoint, AngleData);
247
            pathFigure.Segments.Add(lineSegment0);
248
249
            LineSegment lineSegment1 = new LineSegment();
250
            lineSegment1.Point = MathSet.RotateAbout(mid, this.LeftBottomPoint, AngleData);
251
            pathFigure.Segments.Add(lineSegment1);
252
253
            LineSegment lineSegment2 = new LineSegment();
254
            lineSegment2.Point = MathSet.RotateAbout(mid, this.EndPoint, AngleData);
255
            pathFigure.Segments.Add(lineSegment2);
256
257
            LineSegment lineSegment3 = new LineSegment();
258
            lineSegment3.Point = MathSet.RotateAbout(mid, this.TopRightPoint, AngleData);
259
            pathFigure.Segments.Add(lineSegment3);
260
261
            PathGeometry pathGeometry = new PathGeometry();
262
            pathGeometry.Figures = new PathFigureCollection();
263
            pathFigure.IsClosed = true;
264
            pathGeometry.Figures.Add(pathFigure);
265
            this.Base_ViewBox.Width = pathGeometry.Bounds.Width;
266 cd988cd8 djkim
            this.Base_ViewBox.Height = pathGeometry.Bounds.Height;
267 787a4489 KangIngu
            this.Tag = pathGeometry;
268
269
            if(Base_ViewBox.Child == null)
270
            {
271
                SetChild();
272
            }
273
274
            Canvas.SetLeft(this, MathSet.RotateAbout(mid, mid, AngleData).X - this.Base_ViewBox.Width / 2);
275
            Canvas.SetTop(this, MathSet.RotateAbout(mid, mid, AngleData).Y - this.Base_ViewBox.Height / 2);
276
        }
277
278
        public void SetChild()
279 cd988cd8 djkim
        {            
280
            if(this.PathXathData != null)
281
            {
282
                var xamlData = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressStamp(this.PathXathData);
283
                System.IO.MemoryStream stream = new System.IO.MemoryStream();
284
                System.IO.StreamWriter writer = new System.IO.StreamWriter(stream);
285
                writer.Write(xamlData);
286
                writer.Flush();
287
                stream.Position = 0;
288 787a4489 KangIngu
289 cd988cd8 djkim
                object obj = System.Windows.Markup.XamlReader.Load(stream);
290
                UIElement ob = obj as UIElement;
291
                                
292
                Base_ViewBox.Child = ob;
293
            }            
294 787a4489 KangIngu
        }
295
296 959b3ef2 humkyung
        public override bool IsSelected
297 787a4489 KangIngu
        {
298
            get
299
            {
300
                return (bool)GetValue(IsSelectedProperty);
301
            }
302
            set
303
            {
304
                SetValue(IsSelectedProperty, value);
305
            }
306
        }
307
308 5529d2a2 humkyung
        public override ControlType ControlType
309 787a4489 KangIngu
        {
310
            set
311
            {
312
                SetValue(ControlTypeProperty, value);
313
            }
314
            get
315
            {
316
                return (ControlType)GetValue(ControlTypeProperty);
317
            }
318
        }
319
320 fa48eb85 taeseongkim
        public override double CommentAngle
321 787a4489 KangIngu
        {
322
            get { return (double)GetValue(AngleProperty); }
323
            set
324
            {
325 fa48eb85 taeseongkim
                if (this.CommentAngle != value)
326 787a4489 KangIngu
                {
327
                    SetValue(AngleProperty, value);
328
                }
329
            }
330
        }
331
332
333
        public Double LineSize
334
        {
335
            get { return (Double)GetValue(LineSizeProperty); }
336
            set
337
            {
338
                if (this.LineSize != value)
339
                {
340
                    SetValue(LineSizeProperty, value);
341
                }
342
            }
343
        }
344
        public Geometry PathData
345
        {
346
            get { return (Geometry)GetValue(PathDataProperty); }
347
            set
348
            {
349
                SetValue(PathDataProperty, value);
350
                RaisePropertyChanged("PathData");
351
            }
352
        }
353
354 0d00f9c8 humkyung
        public override void UpdateControl()
355 787a4489 KangIngu
        {
356
            this.StartPoint = new Point(this.PointSet[0].X, this.PointSet[0].Y);
357 e7334a0c 이지연
            this.LeftBottomPoint = new Point(this.PointSet[1].X, this.PointSet[1].Y);            
358 787a4489 KangIngu
            this.TopRightPoint = new Point(this.PointSet[3].X, this.PointSet[3].Y);
359 e7334a0c 이지연
            this.EndPoint = new Point(this.PointSet[2].X, this.PointSet[2].Y);
360 787a4489 KangIngu
            this.SetViewBox();
361
        }
362 036650a0 humkyung
363
        /// <summary>
364 a6272c57 humkyung
        /// call when mouse is moving while drawing control
365
        /// </summary>
366
        /// <author>humkyung</author>
367
        /// <param name="pt"></param>
368
        /// <param name="bAxisLocked"></param>
369 233ef333 taeseongkim
        public override void OnCreatingMouseMove(Point pt, bool bAxisLocked)
370 a6272c57 humkyung
        {
371
            if (this.StartPoint == this.EndPoint)
372
            {
373 43e1d368 taeseongkim
                var xamlData = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressStamp(this.STAMP);
374
375
                if (STAMP_Contents?.Count > 0)
376
                {
377
                    foreach (var item in STAMP_Contents)
378
                    {
379
                        xamlData = xamlData.Replace(item.Key, System.Security.SecurityElement.Escape(item.Value));
380
                    }
381
                }
382 a6272c57 humkyung
383
                System.IO.MemoryStream stream = new System.IO.MemoryStream();
384
                System.IO.StreamWriter writer = new System.IO.StreamWriter(stream);
385
                writer.Write(xamlData);
386
                writer.Flush();
387
                stream.Position = 0;
388
389
                this.StrokeColor = new SolidColorBrush(Colors.Red);
390
                object obj = System.Windows.Markup.XamlReader.Load(stream);
391
                UIElement ob = obj as UIElement;
392
393
                this.SetViewBox();
394
                this.PathXathData = this.STAMP;
395
                this.Base_ViewBox.Child = ob;
396
            }
397
398 49a6d7c3 humkyung
            if (bAxisLocked)
399
            {
400
                double _dx = pt.X - this.StartPoint.X;
401
                double _dy = pt.Y - this.StartPoint.Y;
402
                double dist = Math.Max(Math.Abs(_dx), Math.Abs(_dy));
403
                var dir = new Vector(_dx, _dy);
404
                dir.Normalize();
405
406
                this.LeftBottomPoint = new Point(this.StartPoint.X, this.StartPoint.Y + (dir.Y > 0 ? 1 : -1) * dist);
407
                this.TopRightPoint = new Point(this.StartPoint.X + (dir.X > 0 ? 1 : -1) * dist, this.StartPoint.Y);
408
                this.EndPoint = new Point(this.TopRightPoint.X, this.LeftBottomPoint.Y);
409
            }
410
            else
411
            {
412
                this.EndPoint = pt;
413
                this.LeftBottomPoint = new Point(this.StartPoint.X, this.EndPoint.Y);
414
                this.TopRightPoint = new Point(this.EndPoint.X, this.StartPoint.Y);
415
            }
416 a6272c57 humkyung
417
            this.PointSet = new List<Point>
418
            {
419
                this.StartPoint,
420
                this.LeftBottomPoint,
421
                this.EndPoint,
422
                this.TopRightPoint,
423
            };
424
        }
425
426
        /// <summary>
427 d2114d3b humkyung
        /// move control point has same location of given pt along given delta
428
        /// </summary>
429
        /// <author>humkyung</author>
430
        /// <date>2019.06.20</date>
431
        /// <param name="pt"></param>
432
        /// <param name="dx"></param>
433
        /// <param name="dy"></param>
434 233ef333 taeseongkim
        public override void OnMoveCtrlPoint(Point pt, double dx, double dy, bool bAxisLocked = false)
435 d2114d3b humkyung
        {
436
            IPath path = (this as IPath);
437
438
            Point selected = MathSet.getNearPoint(path.PointSet, pt);
439
            selected.X += dx;
440
            selected.Y += dy;
441
442 9005f973 humkyung
            int idx = (this as IPath).PointSet.FindIndex(x => x.Equals(pt));
443
444
            var OppositeP = (idx + path.PointSet.Count / 2) % path.PointSet.Count;
445
            var PreviousP = (idx + (path.PointSet.Count - 1)) % path.PointSet.Count;
446
            var NextP = (idx + 1) % path.PointSet.Count;
447 ab7fe8c0 humkyung
            if (bAxisLocked)
448
            {
449 9005f973 humkyung
                var PrevV = path.PointSet[PreviousP] - path.PointSet[OppositeP];
450
                double PrevLength = PrevV.Length;
451
                PrevV.Normalize();
452 d2114d3b humkyung
453 ab7fe8c0 humkyung
                var NextV = path.PointSet[NextP] - path.PointSet[OppositeP];
454 9005f973 humkyung
                double NextVLength = NextV.Length;
455 ab7fe8c0 humkyung
                NextV.Normalize();
456 d2114d3b humkyung
457 9005f973 humkyung
                double _dx = selected.X - path.PointSet[OppositeP].X;
458
                double _dy = selected.Y - path.PointSet[OppositeP].Y;
459
                var dir = new Vector(_dx, _dy);
460
                if (PrevLength > NextVLength)
461
                {
462
                    double ratio = NextVLength / PrevLength;
463
464
                    double dot = MathSet.DotProduct(PrevV.X, PrevV.Y, dir.X, dir.Y);
465
466
                    path.PointSet[PreviousP] = path.PointSet[OppositeP] + PrevV * dot;
467
                    path.PointSet[NextP] = path.PointSet[OppositeP] + NextV * dot * ratio;
468
                    path.PointSet[idx] = path.PointSet[OppositeP] + PrevV * dot + NextV * dot * ratio;
469
                }
470
                else
471
                {
472
                    double ratio = PrevLength / NextVLength;
473
474
                    double dot = MathSet.DotProduct(NextV.X, NextV.Y, dir.X, dir.Y);
475
476
                    path.PointSet[PreviousP] = path.PointSet[OppositeP] + PrevV * dot * ratio;
477
                    path.PointSet[NextP] = path.PointSet[OppositeP] + NextV * dot;
478
                    path.PointSet[idx] = path.PointSet[OppositeP] + PrevV * dot * ratio + NextV * dot;
479
                }
480 ab7fe8c0 humkyung
            }
481
            else
482
            {
483
                var PreviousV = MathSet.GetNormVectorBetween(path.PointSet[OppositeP], path.PointSet[PreviousP]);
484 9005f973 humkyung
                var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, path.PointSet[idx].X - path.PointSet[OppositeP].X,
485
                    path.PointSet[idx].Y - path.PointSet[OppositeP].Y);
486 ab7fe8c0 humkyung
                path.PointSet[PreviousP] = new Point(path.PointSet[OppositeP].X + PreviousV.X * l, path.PointSet[OppositeP].Y + PreviousV.Y * l);
487
488
                var NextV = MathSet.GetNormVectorBetween(path.PointSet[OppositeP], path.PointSet[NextP]);
489 9005f973 humkyung
                l = MathSet.DotProduct(NextV.X, NextV.Y, path.PointSet[idx].X - path.PointSet[OppositeP].X, path.PointSet
490
                    [idx].Y - path.PointSet[OppositeP].Y);
491 ab7fe8c0 humkyung
                path.PointSet[NextP] = new Point(path.PointSet[OppositeP].X + NextV.X * l, path.PointSet[OppositeP].Y + NextV.Y * l);
492 9005f973 humkyung
493
                path.PointSet[idx] = selected;
494 ab7fe8c0 humkyung
            }
495 d2114d3b humkyung
496 0d00f9c8 humkyung
            this.UpdateControl();
497 d2114d3b humkyung
        }
498
499
        /// <summary>
500 91efe37a humkyung
        /// return SymControlN's area
501
        /// </summary>
502
        /// <author>humkyung</author>
503
        /// <date>2019.06.13</date>
504
        public override Rect ItemRect
505
        {
506
            get
507
            {
508
                double dMinX = Math.Min(this.StartPoint.X, this.EndPoint.X);
509
                double dMinY = Math.Min(this.StartPoint.Y, this.EndPoint.Y);
510
                double dMaxX = Math.Max(this.StartPoint.X, this.EndPoint.X);
511
                double dMaxY = Math.Max(this.StartPoint.Y, this.EndPoint.Y);
512
513
                return new Rect(new Point(dMinX, dMinY), new Point(dMaxX, dMaxY));
514
            }
515
        }
516
517
        /// <summary>
518 036650a0 humkyung
        /// Serialize this
519
        /// </summary>
520
        /// <param name="sUserId"></param>
521
        /// <returns></returns>
522
        public override string Serialize()
523
        {
524 b2d0f316 humkyung
            using (S_SymControlN ctrl = new S_SymControlN())
525 036650a0 humkyung
            {
526 b2d0f316 humkyung
                ctrl.TransformPoint = "0|0";
527
                ctrl.PointSet = this.PointSet;
528
                //ctrl.XamlData = this.PathXathData;
529
                ctrl.UserID = this.UserID;
530
                ctrl.DBData = this.PathXathData;
531
                //ctrl.StrokeColor = this.StrokeColor.Color.ToString();
532
                ctrl.StartPoint = this.StartPoint;
533
                ctrl.Angle = this.CommentAngle;
534
                ctrl.EndPoint = this.EndPoint;
535
                ctrl.LB = this.LeftBottomPoint;
536
                ctrl.TR = this.TopRightPoint;
537
                ctrl.Opac = this.Opacity;
538
                ctrl.Name = this.GetType().Name.ToString();
539
                ctrl.ZIndex = this.ZIndex;
540
541
                return "|DZ|" + JsonSerializerHelper.CompressString((ctrl.JsonSerialize()));
542 036650a0 humkyung
            }
543
        }
544 661b7416 humkyung
545
        /// <summary>
546
        /// create a symcontroln from given string
547
        /// </summary>
548
        /// <param name="str"></param>
549
        /// <returns></returns>
550
        public static SymControlN FromString(string str, SolidColorBrush brush, string sProjectNo)
551
        {
552
            using (S_SymControlN s = JsonSerializerHelper.JsonDeserialize<S_SymControlN>(str))
553
            {
554
                return new SymControlN()
555
                {
556
                    PointSet = s.PointSet,
557
                    StartPoint = s.StartPoint,
558
                    EndPoint = s.EndPoint,
559 fa48eb85 taeseongkim
                    CommentAngle = s.Angle,
560 661b7416 humkyung
                    LeftBottomPoint = s.LB,
561
                    TopRightPoint = s.TR,
562
                    Opacity = s.Opac,
563
                    PathXathData = s.DBData,
564 b2d0f316 humkyung
                    Memo = s.Memo,
565
                    ZIndex = s.ZIndex
566 661b7416 humkyung
                };
567
            }
568
        }
569 787a4489 KangIngu
    }
570
}
571
클립보드 이미지 추가 (최대 크기: 500 MB)