프로젝트

일반

사용자정보

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

markus / MarkupToPDF / Controls / Text / TextControl.cs @ 666bb823

이력 | 보기 | 이력해설 | 다운로드 (47.5 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.Text;
10
using System.Threading.Tasks;
11
using System.Windows;
12
using System.Windows.Controls;
13
using System.Windows.Media;
14
using System.Windows.Shapes;
15
using Markus.Fonts;
16
using System.Windows.Markup;
17

    
18
namespace MarkupToPDF.Controls.Text
19
{    
20
    public class TextControl : CommentUserInfo, IDisposable, INotifyPropertyChanged, ITextControl, IMarkupControlData
21
    {
22
        public event PropertyChangedEventHandler PropertyChanged;
23

    
24
        private const string PART_Grid = "PART_Grid";
25
        private const string PART_Border = "PART_Border";
26
        private const string PART_TextBox = "PART_TextBox";
27
        private const string PART_TextPath = "PART_TextPath";
28
        private const string PART_TextBlock = "PART_TextBlock";
29
        private const string PART_Canvas = "PART_TextControlCanvas";
30
        private const string PART_BaseTextbox_Caret = "Caret";
31
        
32
        //private const string PART_TextPrefix = "PART_TextPrefix";
33
      
34
        public Path Base_TextPath = null;
35
        public Grid Base_Grid = null;
36
        public Border Base_Border = null;
37
        public Canvas Base_Canvas = null;
38
        //public TextBlock Base_TextPrefixBlock = null;
39
        public TextBlock Base_TextBlock = null;
40
        public TextBox Base_TextBox = null;
41
        public Border BaseTextbox_Caret = null;
42

    
43
        public RotateTransform _rotation = null;
44
        public TranslateTransform _translation = null;
45
        public ScaleTransform _scale = null;
46

    
47
        private const double _CloudArcDepth = 0.8;  /// 2018.05.14 added by humkyung
48

    
49
        public override bool IsSelected
50
        {
51
            get
52
            {
53
                return (bool)GetValue(IsSelectedProperty);
54
            }
55
            set
56
            {
57
                SetValue(IsSelectedProperty, value);
58
                OnPropertyChanged("IsSelected");
59
            }
60
        }
61

    
62
        #region Internal Method
63

    
64
        public TextControl()
65
        {
66
            //this.DefaultStyleKey = typeof(TextControl);
67
        }
68

    
69
        static TextControl()
70
        {
71
            DefaultStyleKeyProperty.OverrideMetadata(typeof(TextControl), new FrameworkPropertyMetadata(typeof(TextControl)));
72
            //ResourceDictionary dictionary = new ResourceDictionary();
73
            //dictionary.Source = new Uri("/MarkupToPDF;component/Themes/generic.xaml", UriKind.RelativeOrAbsolute);
74
            //if (!Application.Current.Resources.MergedDictionaries.Any(x => x.Source == dictionary.Source))
75
            //    Application.Current.Resources.MergedDictionaries.Add(dictionary);
76

    
77
        }
78

    
79
        public override void Copy(CommentUserInfo lhs)
80
        {
81
            if(lhs is TextControl item)
82
            {
83
                Text = item.Text;
84
                StartPoint = new Point(item.StartPoint.X, item.StartPoint.Y);
85
                EndPoint = new Point(item.EndPoint.X, item.EndPoint.Y);
86
                CanvasX = item.CanvasX;
87
                CanvasY = item.CanvasY;
88
                BoxWidth = item.BoxWidth;
89
                BoxHeight = item.BoxHeight;
90
                ControlType_No = item.ControlType_No;
91
                LineSize = item.LineSize;
92
                TextSize = item.TextSize;
93
                StrokeColor = item.StrokeColor;
94
                ArcLength = item.ArcLength;
95
                FontSize = item.FontSize;
96
                UserID = item.UserID;
97
                IsHighLight = item.IsHighLight;
98
                CommentAngle = item.CommentAngle;
99
                PointSet = item.PointSet.ConvertAll(x => new Point(x.X, x.Y));
100
                Opacity = item.Opacity;
101
                TextFamily = item.FontFamily;
102
                TextStyle = item.TextStyle;
103
                TextWeight = item.TextWeight;
104
                UnderLine = item.UnderLine;
105
            }
106
        }
107

    
108
        public override CommentUserInfo Clone()
109
        {
110
            var clone = new TextControl();
111
            clone.Copy(this);
112
            return clone;
113
        }
114

    
115
        public override void OnApplyTemplate()
116
        {
117
            base.OnApplyTemplate();
118

    
119
            Base_TextPath = GetTemplateChild(PART_TextPath) as Path;
120
            Base_TextBox = GetTemplateChild(PART_TextBox) as TextBox;
121
            Base_TextBlock = GetTemplateChild(PART_TextBlock) as TextBlock;
122
            Base_Grid = GetTemplateChild(PART_Grid) as Grid;
123
            Base_Border = GetTemplateChild(PART_Border) as Border;
124
            Base_Canvas = GetTemplateChild(PART_Canvas) as Canvas;
125
            BaseTextbox_Caret = GetTemplateChild(PART_BaseTextbox_Caret) as Border;
126
            //BaseTextbox_Caret.Height = this.Base_TextBox.FontSize;
127
            this.Base_TextBox.Text = this.Text;
128
            this.Base_TextBox.CaretIndex = this.Base_TextBox.Text.Length;
129
            this.Base_TextBox.CaretBrush = new SolidColorBrush(Colors.Transparent);
130
            this.Base_TextBox.ApplyTemplate();
131
            MoveCustomCaret();
132
            if(this.Base_TextBox.FontSize > this.BaseTextbox_Caret.Height)
133
            {
134
                BaseTextbox_Caret.Height = this.Base_TextBox.FontSize;
135
            }
136
            //BaseTextbox_Caret.Height = Base_TextBox.ActualHeight - 5;
137

    
138
            this.Base_TextBox.SizeChanged += new SizeChangedEventHandler(Base_TextBox_SizeChanged);
139
            this.Base_TextBox.TextChanged += new TextChangedEventHandler(Base_TextBox_TextChanged);
140
            this.Base_TextBlock.SizeChanged += new SizeChangedEventHandler(Base_TextBlock_SizeChanged);
141
            this.Base_TextBox.GotFocus += new RoutedEventHandler(Base_TextBox_GotFocus);
142
            this.Base_TextBox.LostFocus += new RoutedEventHandler(Base_TextBox_LostFocus);            
143
            this.Base_TextBox.SelectionChanged += (sender, e) => MoveCustomCaret();
144

    
145
            if (Base_TextPath != null)
146
            {
147
                Base_TextPath.StrokeThickness = LineSize.Left;
148
            }
149

    
150
            //if (string.IsNullOrEmpty(this.Base_TextBox.Text))
151
            //{
152
            //    Base_TextPath.StrokeThickness = 20;
153
            //    LineSize = new Thickness(20, 20, 20, 20);
154
            //    //if (Base_TextPath != null)
155
            //    //{
156
            //    //    Base_TextPath.StrokeThickness = LineSize.Left;
157
            //    //}
158
            //}
159
            //else
160
            //{
161
            //    Base_TextPath.StrokeThickness = LineSize.Left;
162
            //}
163

    
164
            SetText();
165
            DrawingCloud();
166
        }
167

    
168
        public void SetFontFamily(FontFamily fontFamily)
169
        {
170
            
171
            if (this.Base_TextBlock != null) {
172
                this.Base_TextBlock.FontFamily = fontFamily;
173
            }
174

    
175
            if (this.Base_TextBox != null) {
176
                this.Base_TextBox.FontFamily = fontFamily;
177
            }
178
            this.FontFamily = fontFamily;
179
            this.TextFamily = fontFamily;
180
        }
181

    
182

    
183
        /// <summary>
184
        /// Moves the custom caret on the canvas.
185
        /// </summary>
186
        public void MoveCustomCaret()
187
        {
188

    
189
            var caretLocation = this.Base_TextBox.GetRectFromCharacterIndex(this.Base_TextBox.CaretIndex).Location;
190

    
191
            if (!double.IsInfinity(caretLocation.X)) {
192
                Canvas.SetLeft(this.BaseTextbox_Caret, caretLocation.X);
193
            }
194

    
195
            if (!double.IsInfinity(caretLocation.Y)) {
196
                Canvas.SetTop(this.BaseTextbox_Caret, caretLocation.Y);
197
                //Canvas.SetTop(this.BaseTextbox_Caret, (LineSize.Top - caretLocation.Y));
198
            }
199
        }
200

    
201
        
202

    
203
        public override void ApplyOverViewData()
204
        {
205
            this.OverViewPathData = this.PathData;
206
            if (Text == "")
207
                this.Text = this.OverViewText;
208
            else
209
                this.OverViewText = this.Text;
210
            
211
            this.OverViewPaint = this.Paint;
212

    
213
        }        
214

    
215
        void Base_TextBox_SizeChanged(object sender, SizeChangedEventArgs e)
216
        {
217
            BoxWidth = e.NewSize.Width;
218
            BoxHeight = e.NewSize.Height;
219

    
220
            DrawingCloud();
221
        }
222
        private void Base_TextBlock_SizeChanged(object sender, SizeChangedEventArgs e)
223
        {
224
            BoxWidth = e.NewSize.Width;
225
            BoxHeight = e.NewSize.Height;
226

    
227
            DrawingCloud();
228
        }
229
        private void Base_TextBox_TextChanged(object sender, TextChangedEventArgs e)
230
        {
231
            if (IsEditingMode)
232
            {
233
                if (Base_TextBox.Text.Contains("|OR||DZ|"))
234
                {
235
                    Base_TextBox.Text = this.Text;
236
                }
237

    
238
                this.Text = Base_TextBox.Text;
239

    
240
            }            
241
            DrawingCloud();
242
        }
243
        void Base_TextBox_GotFocus(object sender, RoutedEventArgs e)
244
        {
245
            this.BaseTextbox_Caret.Visibility = Visibility.Visible;
246
            MoveCustomCaret();
247
            Base_TextBox.Focus();
248
            this.IsEditingMode = true;
249
        }
250

    
251
        void Base_TextBox_LostFocus(object sender, RoutedEventArgs e)
252
        {
253
            this.Text = Base_TextBox.Text;
254
            this.BaseTextbox_Caret.Visibility = Visibility.Collapsed;
255
            this.IsEditingMode = false;
256
            ApplyOverViewData();
257
        }
258

    
259
        //void TextControl_GotFocus(object sender, RoutedEventArgs e)
260
        //{
261
        //    Base_TextBox.Visibility = Visibility.Visible;
262
        //    Base_TextBlock.Visibility = Visibility.Collapsed;
263
        //    this.Base_TextBox.BorderThickness = new Thickness(1);
264
        //    if (UnderLine != null)
265
        //    {
266
        //        Base_TextBlock.TextDecorations = UnderLine;
267
        //    }
268
        //    if (this.Text != null)
269
        //    {
270
        //        Base_TextBox.Text = this.Text;
271
        //    }
272
        //    IsEditing = true;
273
        //}
274
        //void TextControl_LostFocus(object sender, RoutedEventArgs e)
275
        //{
276
        //    Base_TextBox.Visibility = Visibility.Collapsed;
277
        //    Base_TextBlock.Visibility = Visibility.Visible;
278
        //    this.Text = Base_TextBox.Text;
279
        //    if (UnderLine != null)
280
        //    {
281
        //        Base_TextBlock.TextDecorations = UnderLine;
282
        //    }
283
        //    Base_TextBlock.Margin =
284
        //       new Thickness(Base_TextBox.Margin.Left + 4, Base_TextBox.Margin.Top + 4, Base_TextBox.Margin.Right + 4, Base_TextBox.Margin.Bottom + 4);
285
        //    IsEditing = false;
286
        //}
287
        public void EditingMode()
288
        {            
289
            TextBoxVisibility = Visibility.Visible;
290
            TextBlockVisibility = Visibility.Collapsed;
291
            this.BaseTextbox_Caret.Visibility = Visibility.Visible;
292

    
293
            if (UnderLine != null)
294
                Base_TextBlock.TextDecorations = UnderLine;
295

    
296
        }
297

    
298
        public void UnEditingMode()
299
        {            
300
            TextBoxVisibility = Visibility.Collapsed;         
301
            TextBlockVisibility = Visibility.Visible; 
302
            this.BaseTextbox_Caret.Visibility = Visibility.Collapsed;
303

    
304
            if (UnderLine != null)
305
                Base_TextBlock.TextDecorations = UnderLine;
306

    
307
            
308
        }
309

    
310

    
311
        public void SetText()
312
        {
313
            if (IsHighLight)
314
            {
315
                this.BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6),
316
                    Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B));
317
                this.BackColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.1),
318
                    Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B));
319
            }
320
            else
321
            {
322
                //this.BackInnerColor = new SolidColorBrush(Color.FromArgb(0x003, 0xFF, 0xFF, 0xFF));
323
                //this.BackColor = new SolidColorBrush(Color.FromArgb(0x003, 0xFF, 0xFF, 0xFF));
324

    
325
                this.BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6),
326
                    Colors.White.R, Colors.White.G, Colors.White.B));
327

    
328
                this.BackColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.1),
329
                    Colors.White.R, Colors.White.G, Colors.White.B));
330
            }
331
            //if (Base_TextPath != null)
332
            //{
333
            //    Base_TextPath.StrokeThickness = LineSize.Left;
334
            //}
335
        }
336

    
337
        public void DrawingCloud()
338
        {
339
            List<Point> pCloud = new List<Point>
340
            {
341
                new Point(-LineSize.Left * 0.5, -LineSize.Left * 0.5),
342
                new Point(-LineSize.Left * 0.5, BoxHeight + LineSize.Left * 0.5),
343
                new Point(BoxWidth + LineSize.Left * 0.5, BoxHeight + LineSize.Left * 0.5),
344
                new Point(BoxWidth + LineSize.Left * 0.5 ,-LineSize.Left * 0.5)
345
            };
346
            if (this.ArcLength == 0) this.ArcLength = 10;
347
            //this.Base_TextBox.Select(Base_TextBox.Text.Length, 0);
348
            if (Base_TextPath != null)
349
            {
350
                switch (ControlType_No)
351
                {
352
                    case 0:
353
                        {
354
                            PathData = new PathGeometry();
355
                            PathDataInner = (GenerateInner(pCloud));
356
                        }
357
                        break;
358
                    case 1:
359
                        {
360
                            PathData = (Generate_Rect(pCloud));                         
361
                            PathDataInner = (GenerateInner(pCloud));
362
                        }
363
                        break;
364
                    case 2:
365
                        {
366
                            List<Point> pCloud2 = new List<Point>
367
                            {
368
                                new Point(-LineSize.Left* 2 , -LineSize.Left* 2 ),
369
                                new Point(-LineSize.Left* 2 , BoxHeight + LineSize.Left * 2 ),
370
                                new Point(BoxWidth + LineSize.Left* 2 , BoxHeight + LineSize.Left * 2 ),
371
                                new Point(BoxWidth + LineSize.Left* 2  ,-LineSize.Left* 2 )
372
                            };
373
                            PathData = (Generate(pCloud, this.ArcLength, this.LineSize.Left));
374
                            PathDataInner = (GenerateInner(pCloud));
375
                        }
376
                        break;
377
                }
378
            }
379
        }
380
        #endregion Internal Method
381

    
382
        public void Dispose()
383
        {
384
            //GC.Collect();
385
            ////GC.SuppressFinalize(this);
386
            this.Base_Border = null;
387
            this.Base_Canvas = null;
388
            this.Base_Grid = null;
389
            this.Base_TextBlock = null;
390
            this.Base_TextBox = null;
391
        }
392

    
393
        public override void UpdateControl()
394
        {
395
            if (this.PointSet.Count > 1)
396
            {
397
                this.StartPoint = new Point(this.PointSet[0].X, this.PointSet[0].Y);
398
                this.EndPoint = new Point(this.PointSet[1].X, this.PointSet[1].Y);
399
            }
400
        }
401

    
402
        #region Drawing Cloud Method
403
        public static PathGeometry Generate_Rect(List<Point> pData)
404
        {
405
            PathFigure pathFigure = new PathFigure();
406
            pathFigure.StartPoint = pData[0];
407

    
408
            PolyLineSegment polyline = new PolyLineSegment(pData, true);
409
            pathFigure.Segments.Add(polyline);
410

    
411
            PathGeometry rectPathGeometry = new PathGeometry();
412
            rectPathGeometry.Figures = new PathFigureCollection();
413
            pathFigure.IsClosed = true;
414
            pathFigure.IsFilled = false;
415
            rectPathGeometry.Figures.Add(pathFigure);
416

    
417

    
418
            return rectPathGeometry;
419
        }
420

    
421
        public static PathGeometry Generate(List<Point> pData, double _ArcLength = 20, double _LineSize = 20)
422
        {
423
            var _pathGeometry = new PathGeometry();
424
            double area = MathSet.AreaOf(pData);
425
            bool reverse = (area > 0);
426
            int count = pData.Count;
427
            for (int i = 0; i < count; i++)
428
            {
429
                PathFigure pathFigure = Polygon.CloudControl.GenerateLineWithCloud(pData[i % count], pData[(i + 1) % count], _ArcLength, reverse, _LineSize);
430
                pathFigure.IsClosed = false;
431
                pathFigure.IsFilled = true;
432
                
433
                _pathGeometry.Figures.Add(pathFigure);
434
            }
435

    
436
            return _pathGeometry;
437
        }
438

    
439

    
440
        public static PathGeometry GenerateInner(List<Point> pData)
441
        {
442
            var _pathGeometry = new PathGeometry();
443
            double area = MathSet.AreaOf(pData);
444
            bool reverse = (area > 0);
445
            int count = pData.Count;
446

    
447
            PathFigure pathFigur2 = new PathFigure();
448
            pathFigur2.StartPoint = pData[0];
449

    
450
            PolyLineSegment polyline = new PolyLineSegment(pData, true);
451
            pathFigur2.Segments.Add(polyline);
452

    
453
            pathFigur2.IsClosed = true;
454
            pathFigur2.IsFilled = true;
455
            _pathGeometry.Figures.Add(pathFigur2);
456

    
457
            return _pathGeometry;
458
        }
459
        #endregion
460

    
461
        #region Dependency Properties
462
        public static readonly DependencyProperty ControlTypeProperty =
463
        DependencyProperty.Register("ControlType", typeof(ControlType), typeof(TextControl), new FrameworkPropertyMetadata(ControlType.TextControl));
464

    
465
        public static readonly DependencyProperty ControlType_NoProperty =
466
        DependencyProperty.Register("ControlType_No", typeof(int), typeof(TextControl), new FrameworkPropertyMetadata(0));
467

    
468
        public static readonly DependencyProperty IsSelectedProperty = DependencyProperty.Register(
469
            "IsSelected", typeof(bool), typeof(TextControl), new FrameworkPropertyMetadata(false, IsSelectedChanged));
470

    
471
        public static readonly DependencyProperty PathGeometryProperty = DependencyProperty.Register(
472
            "PathGeometry", typeof(PathGeometry), typeof(TextControl), new PropertyMetadata(null, SetPathGeometryChanged));
473

    
474
        public static readonly DependencyProperty TextProperty = DependencyProperty.Register(
475
            "Text", typeof(string), typeof(TextControl), new PropertyMetadata(null));
476

    
477
        public static readonly DependencyProperty OverViewTextProperty = DependencyProperty.Register(
478
            "OverViewText", typeof(string), typeof(TextControl), new PropertyMetadata(null, new PropertyChangedCallback(TextChanged)));
479

    
480
        public static readonly DependencyProperty UserIDProperty = DependencyProperty.Register(
481
            "UserID", typeof(string), typeof(TextControl), new PropertyMetadata(null));
482

    
483
        /*public static readonly DependencyProperty FontColorProperty = DependencyProperty.Register(
484
            "FontColor", typeof(SolidColorBrush), typeof(TextControl), new PropertyMetadata(new SolidColorBrush(Colors.Red)));*/
485

    
486
        public static readonly DependencyProperty StrokeColorProperty = DependencyProperty.Register(
487
            "StrokeColor", typeof(SolidColorBrush), typeof(TextControl), new PropertyMetadata(new SolidColorBrush(Colors.Red)));
488

    
489
        public static readonly DependencyProperty ArcLengthProperty = DependencyProperty.Register(
490
            "ArcLength", typeof(double), typeof(TextControl), new PropertyMetadata((Double)10, PointValueChanged));
491

    
492
        //강인구 추가
493
        public static readonly DependencyProperty IsHighlightProperty = DependencyProperty.Register(
494
            "IsHighLight", typeof(bool), typeof(TextControl), new PropertyMetadata(false, PointValueChanged));
495

    
496
        public static readonly DependencyProperty BackColorProperty = DependencyProperty.Register(
497
            "BackColor", typeof(SolidColorBrush), typeof(TextControl), new PropertyMetadata(new SolidColorBrush(Colors.White)));
498

    
499
        public static readonly DependencyProperty BackInnerColorProperty = DependencyProperty.Register(
500
            "BackInnerColor", typeof(SolidColorBrush), typeof(TextControl), new PropertyMetadata(new SolidColorBrush(Colors.White)));
501

    
502
        public static readonly DependencyProperty UnderLineProperty = DependencyProperty.Register(
503
            "UnderLine", typeof(TextDecorationCollection), typeof(TextControl), new PropertyMetadata(null));
504

    
505
        public static readonly DependencyProperty LineSizeProperty = DependencyProperty.Register(
506
            "LineSize", typeof(Thickness), typeof(TextControl), new PropertyMetadata(new Thickness(4), PointValueChanged)); //여기만 4인지 모르겠지만 4 그대로 두겠음
507

    
508
        public static readonly DependencyProperty PointSetProperty = DependencyProperty.Register(
509
            "PointSet", typeof(List<Point>), typeof(TextControl), new PropertyMetadata(new List<Point>()));
510

    
511
        public static readonly DependencyProperty PathDataProperty = DependencyProperty.Register(
512
            "PathData", typeof(Geometry), typeof(TextControl), null);
513

    
514
        public static readonly DependencyProperty PathDataInnerProperty = DependencyProperty.Register(
515
            "PathDataInner", typeof(Geometry), typeof(TextControl), null);
516

    
517
        public static readonly DependencyProperty OverViewPathDataProperty = DependencyProperty.Register(
518
            "OverViewPathDataProperty", typeof(Geometry), typeof(TextControl), null);
519

    
520
        public static readonly DependencyProperty TextStyleProperty = DependencyProperty.Register(
521
            "TextStyle", typeof(FontStyle), typeof(TextControl), new PropertyMetadata(FontStyles.Normal));
522

    
523
        public static readonly DependencyProperty TextFamilyProperty = DependencyProperty.Register(
524
            "TextFamily", typeof(FontFamily), typeof(TextControl), 
525
                        new PropertyMetadata(new PropertyChangedCallback(TextFamilyPropertyChanged)));
526

    
527
        public static readonly DependencyProperty TextWeightProperty = DependencyProperty.Register(
528
            "TextWeight", typeof(FontWeight), typeof(TextControl), new PropertyMetadata(FontWeights.Normal));
529

    
530
        public static readonly DependencyProperty CenterXProperty = DependencyProperty.Register(
531
            "CenterX", typeof(double), typeof(TextControl), new PropertyMetadata((double)0, OnCenterXYChanged));
532

    
533
        public static readonly DependencyProperty CenterYProperty = DependencyProperty.Register(
534
            "CenterY", typeof(double), typeof(TextControl), new PropertyMetadata((double)0, OnCenterXYChanged));
535

    
536
        public static readonly DependencyProperty CanvasXProperty = DependencyProperty.Register(
537
           "CanvasX", typeof(double), typeof(TextControl), new PropertyMetadata((double)0, OnSetCansvasChanged));
538

    
539
        public static readonly DependencyProperty CanvasYProperty = DependencyProperty.Register(
540
            "CanvasY", typeof(double), typeof(TextControl), new PropertyMetadata((double)0, OnSetCansvasChanged));
541

    
542
        public static readonly DependencyProperty StartPointProperty = DependencyProperty.Register(
543
            "StartPoint", typeof(Point), typeof(TextControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
544

    
545
        public static readonly DependencyProperty EndPointProperty = DependencyProperty.Register(
546
            "EndPoint", typeof(Point), typeof(TextControl), new PropertyMetadata(new Point(100, 100), PointValueChanged));
547

    
548
        public static readonly DependencyProperty TextSizeProperty = DependencyProperty.Register(
549
            "TextSize", typeof(Double), typeof(TextControl), new PropertyMetadata((Double)30, PointValueChanged));
550

    
551
        public static readonly DependencyProperty PaintProperty = DependencyProperty.Register(
552
            "Paint", typeof(PaintSet), typeof(TextControl), new PropertyMetadata((PaintSet.None), PointValueChanged));
553

    
554
        public static readonly DependencyProperty OverViewPaintProperty = DependencyProperty.Register(
555
            "OverViewPaint", typeof(PaintSet), typeof(TextControl), new PropertyMetadata((PaintSet.None), PointValueChanged));
556

    
557
        public static readonly DependencyProperty AngleProperty = DependencyProperty.Register(
558
            "Angle", typeof(double), typeof(TextControl), new PropertyMetadata((double)0.0, new PropertyChangedCallback(AngleValueChanged)));
559

    
560
        public static readonly DependencyProperty EnableEditingProperty = DependencyProperty.Register(
561
           "EnableEditing", typeof(bool), typeof(TextControl), new PropertyMetadata((true), new PropertyChangedCallback(OnIsEditingChanged)));
562

    
563
        public static readonly DependencyProperty TextBoxVisibilityProperty = DependencyProperty.Register(
564
            "TextBoxVisibility", typeof(Visibility), typeof(TextControl), new PropertyMetadata((Visibility.Visible), OnTextBoxVisibilityChanged));
565

    
566
        public static readonly DependencyProperty TextBlockVisibilityProperty = DependencyProperty.Register(
567
            "TextBlockVisibility", typeof(Visibility), typeof(TextControl), new PropertyMetadata((Visibility.Collapsed), OnTextBlockVisibilityChanged));
568

    
569
        #endregion Dependency Properties
570

    
571
        #region dp Properties
572

    
573

    
574
        public override SolidColorBrush StrokeColor
575
        {
576
            get { return (SolidColorBrush)GetValue(StrokeColorProperty); }
577
            set
578
            {
579
                if (this.StrokeColor != value)
580
                {
581
                    SetValue(StrokeColorProperty, value);
582
                }
583
            }
584
        }
585

    
586
        public Double ArcLength
587
        {
588
            get { return (Double)GetValue(ArcLengthProperty); }
589
            set
590
            {
591
                if (this.ArcLength != value)
592
                {
593
                    SetValue(ArcLengthProperty, value);
594
                    OnPropertyChanged("ArcLength");
595
                }
596
            }
597
        }
598

    
599
        public bool EnableEditing
600
        {
601
            get { return (bool)GetValue(EnableEditingProperty); }
602
            set
603
            {
604
                if (this.EnableEditing != value)
605
                {
606
                    SetValue(EnableEditingProperty, value);
607
                    OnPropertyChanged("EnableEditing");
608
                }
609
            }
610
        }
611

    
612
        public Thickness LineSize
613
        {
614
            get
615
            {
616
                return (Thickness)GetValue(LineSizeProperty);
617
            }
618
            set
619
            {
620
                if (this.LineSize != value)
621
                {
622
                    SetValue(LineSizeProperty, value);
623
                    OnPropertyChanged("LineSize");
624
                }
625
            }
626
        }
627

    
628
        public override ControlType ControlType
629
        {
630
            get
631
            {
632
                return (ControlType)GetValue(ControlTypeProperty);
633
            }
634
            set
635
            {
636
                SetValue(ControlTypeProperty, value);
637
            }
638
        }
639
        public int ControlType_No
640
        {
641
            get
642
            {
643
                return (int)GetValue(ControlType_NoProperty);
644
            }
645
            set
646
            {
647
                SetValue(ControlType_NoProperty, value);
648
            }
649
        }
650

    
651
        public string UserID
652
        {
653
            get { return (string)GetValue(UserIDProperty); }
654
            set
655
            {
656
                if (this.UserID != value)
657
                {
658
                    SetValue(UserIDProperty, value);
659
                    OnPropertyChanged("UserID");
660
                }
661
            }
662
        }
663

    
664
        public double CenterX
665
        {
666
            get { return (double)GetValue(CenterXProperty); }
667
            set
668
            {
669
                SetValue(CenterXProperty, value);
670
                OnPropertyChanged("CenterX");
671

    
672
            }
673
        }
674

    
675
        public double CenterY
676
        {
677
            get { return (double)GetValue(CenterYProperty); }
678
            set
679
            {
680
                SetValue(CenterYProperty, value);
681
                OnPropertyChanged("CenterY");
682
            }
683
        }
684

    
685
        public string Text
686
        {
687
            get { return (string)GetValue(TextProperty); }
688
            set
689
            {
690
                if (this.Text != value)
691
                {
692
                    SetValue(TextProperty, value);
693
                    OnPropertyChanged("Text");
694
                }
695
            }
696
        }
697

    
698
        public string OverViewText
699
        {
700
            get { return (string)GetValue(OverViewTextProperty); }
701
            set
702
            {
703
                if (this.OverViewText != value)
704
                {
705
                    SetValue(OverViewTextProperty, value);
706
                    OnPropertyChanged("OverViewText");
707
                }
708
            }
709
        }
710

    
711
        public Geometry OverViewPathData
712
        {
713
            get { return (Geometry)GetValue(OverViewPathDataProperty); }
714
            set
715
            {
716
                if (this.OverViewPathData != value)
717
                {
718
                    SetValue(OverViewPathDataProperty, value);
719
                    OnPropertyChanged("OverViewPathData");
720
                }
721
            }
722
        }
723

    
724
        public Visibility TextBoxVisibility
725
        {
726
            get { return (Visibility)GetValue(TextBoxVisibilityProperty); }
727
            set
728
            {
729
                if (this.TextBoxVisibility != value)
730
                {
731
                    SetValue(TextBoxVisibilityProperty, value);
732
                    OnPropertyChanged("TextBoxVisibility");
733
                }
734
            }
735
        }
736

    
737

    
738
        public Visibility TextBlockVisibility
739
        {
740
            get { return (Visibility)GetValue(TextBlockVisibilityProperty); }
741
            set
742
            {
743
                if (this.TextBlockVisibility != value)
744
                {
745
                    SetValue(TextBlockVisibilityProperty, value);
746
                    OnPropertyChanged("TextBlockVisibility");
747
                }
748
            }
749
        }
750

    
751
        public Double TextSize
752
        {
753
            get { return (Double)GetValue(TextSizeProperty); }
754
            set
755
            {
756
                if (this.TextSize != value)
757
                {
758
                    SetValue(TextSizeProperty, value);
759
                    OnPropertyChanged("TextSize");
760
                }
761
            }
762
        }
763
        /*
764
        public SolidColorBrush FontColor
765
        {
766
            get { return (SolidColorBrush)GetValue(FontColorProperty); }
767
            set
768
            {
769
                if (this.FontColor != value)
770
                {
771
                    SetValue(FontColorProperty, value);
772
                    OnPropertyChanged("FontColor");
773
                }
774
            }
775
        }*/
776

    
777
        public SolidColorBrush BackColor
778
        {
779
            get { return (SolidColorBrush)GetValue(BackColorProperty); }
780
            set
781
            {
782
                if (this.BackColor != value)
783
                {
784
                    SetValue(BackColorProperty, value);
785
                    OnPropertyChanged("BackColor");
786
                }
787
            }
788
        }
789

    
790
        public SolidColorBrush BackInnerColor
791
        {
792
            get { return (SolidColorBrush)GetValue(BackInnerColorProperty); }
793
            set
794
            {
795
                if (this.BackInnerColor != value)
796
                {
797
                    SetValue(BackInnerColorProperty, value);
798
                    OnPropertyChanged("BackInnerColor");
799
                }
800
            }
801
        }
802

    
803

    
804

    
805
        public TextDecorationCollection UnderLine
806
        {
807
            get
808
            {
809
                return (TextDecorationCollection)GetValue(UnderLineProperty);
810
            }
811
            set
812
            {
813
                if (this.UnderLine != value)
814
                {
815
                    SetValue(UnderLineProperty, value);
816
                    OnPropertyChanged("UnderLine");
817
                }
818
            }
819
        }
820

    
821
        public double CanvasX
822
        {
823
            get { return (double)GetValue(CanvasXProperty); }
824
            set
825
            {
826
                if (this.CanvasX != value)
827
                {
828
                    SetValue(CanvasXProperty, value);
829
                    OnPropertyChanged("CanvasX");
830
                }
831
            }
832
        }
833

    
834
        public double CanvasY
835
        {
836
            get { return (double)GetValue(CanvasYProperty); }
837
            set
838
            {
839
                if (this.CanvasY != value)
840
                {
841
                    SetValue(CanvasYProperty, value);
842
                    OnPropertyChanged("CanvasY");
843
                }
844
            }
845
        }
846

    
847
        public Point EndPoint
848
        {
849
            get { return (Point)GetValue(EndPointProperty); }
850
            set
851
            {
852
                if (this.EndPoint != value)
853
                {
854
                    SetValue(EndPointProperty, value);
855
                    OnPropertyChanged("EndPoint");
856
                }
857
            }
858
        }
859

    
860
        public Point StartPoint
861
        {
862
            get { return (Point)GetValue(StartPointProperty); }
863
            set
864
            {
865
                if (this.StartPoint != value)
866
                {
867
                    SetValue(StartPointProperty, value);
868
                    OnPropertyChanged("StartPoint");
869
                }
870
            }
871
        }
872

    
873
        public FontStyle TextStyle
874
        {
875
            get { return (FontStyle)GetValue(TextStyleProperty); }
876
            set
877
            {
878
                if (this.TextStyle != value)
879
                {
880
                    SetValue(TextStyleProperty, value);
881
                    OnPropertyChanged("TextStyle");
882
                }
883
            }
884
        }
885

    
886
        public FontFamily TextFamily
887
        {
888
            get { return (FontFamily)GetValue(TextFamilyProperty); }
889
            set
890
            {
891
                if (this.TextFamily != value)
892
                {
893
                    SetValue(TextFamilyProperty, value);
894
                    OnPropertyChanged("TextFamily");
895
                }
896
            }
897
        }
898

    
899
        public FontWeight TextWeight
900
        {
901
            get { return (FontWeight)GetValue(TextWeightProperty); }
902
            set
903
            {
904
                if (this.TextWeight != value)
905
                {
906
                    SetValue(TextWeightProperty, value);
907
                    OnPropertyChanged("TextWeight");
908
                }
909
            }
910
        }
911

    
912
        public PaintSet Paint
913
        {
914
            get { return (PaintSet)GetValue(PaintProperty); }
915
            set
916
            {
917
                if (this.Paint != value)
918
                {
919
                    SetValue(PaintProperty, value);
920
                    OnPropertyChanged("Paint");
921
                }
922
            }
923
        }
924

    
925
        public PaintSet OverViewPaint
926
        {
927
            get { return (PaintSet)GetValue(OverViewPaintProperty); }
928
            set
929
            {
930
                if (this.OverViewPaint != value)
931
                {
932
                    SetValue(OverViewPaintProperty, value);
933
                    OnPropertyChanged("OverViewPaint");
934
                }
935
            }
936
        }
937

    
938
        double IPath.LineSize
939
        {
940
            get
941
            {
942
                return this.LineSize.Left;
943
            }
944
            set
945
            {
946
                this.LineSize = new Thickness(value);
947
                OnPropertyChanged("LineSize");
948
            }
949
        }
950

    
951

    
952
        public Geometry PathData
953
        {
954
            get { return (Geometry)GetValue(PathDataProperty); }
955
            set
956
            {
957
                SetValue(PathDataProperty, value);
958
                OnPropertyChanged("PathData");
959
            }
960
        }
961

    
962
        public Geometry PathDataInner
963
        {
964
            get { return (Geometry)GetValue(PathDataInnerProperty); }
965
            set
966
            {
967
                SetValue(PathDataInnerProperty, value);
968
                OnPropertyChanged("PathDataInner");
969
            }
970
        }
971

    
972
        public override double CommentAngle
973
        {
974
            get { return (double)GetValue(AngleProperty); }
975
            set
976
            {
977
                if (this.CommentAngle != value)
978
                {
979
                    SetValue(AngleProperty, value);
980

    
981
                    OnPropertyChanged("Angle");
982
                    UpdateLayout();
983
                }
984
            }
985
        }
986

    
987
        public bool IsHighLight
988
        {
989
            get { return (bool)GetValue(IsHighlightProperty); }
990
            set
991
            {
992
                if (this.IsHighLight != value)
993
                {
994
                    SetValue(IsHighlightProperty, value);
995
                    OnPropertyChanged("IsHighLight");
996
                }
997
            }
998
        }
999

    
1000
        public List<Point> PointSet
1001
        {
1002
            get { return (List<Point>)GetValue(PointSetProperty); }
1003
            set
1004
            {
1005
                SetValue(PointSetProperty, value);
1006
                OnPropertyChanged("PointSet");
1007
            }
1008
        }
1009

    
1010
        #endregion Properties
1011

    
1012
        #region Properties
1013

    
1014
        private bool _IsEditingMode;
1015
        public bool IsEditingMode
1016
        {
1017
            get
1018
            {
1019
                return _IsEditingMode;
1020
            }
1021
            set
1022
            {
1023
                _IsEditingMode = value;
1024
                OnPropertyChanged("IsEditingMode");
1025
            }
1026
        }
1027

    
1028
        public PathGeometry PathGeometry
1029
        {
1030
            get { return (PathGeometry)GetValue(PathGeometryProperty); }
1031
            set
1032
            {
1033
                SetValue(PathGeometryProperty, value);
1034
                OnPropertyChanged("PathGeometry");
1035
            }
1036
        }
1037

    
1038
        private double _BoxWidth;
1039
        public double BoxWidth
1040
        {
1041
            get
1042
            {
1043
                return _BoxWidth;
1044
            }
1045
            set
1046
            {
1047
                _BoxWidth = value;
1048
                OnPropertyChanged("BoxWidth");
1049
            }
1050
        }
1051

    
1052
        private double _BoxHeight;
1053
        public double BoxHeight
1054
        {
1055
            get
1056
            {
1057
                return _BoxHeight;
1058
            }
1059
            set
1060
            {
1061
                _BoxHeight = value;
1062
                OnPropertyChanged("BoxHeight");
1063
            }
1064
        }
1065

    
1066
        #endregion
1067

    
1068
        #region CallBack Method
1069

    
1070
        private static void TextFamilyPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
1071
        {
1072
            //var instance = (TextControl)d;
1073

    
1074
            //instance.SetFontFamily(e.NewValue as FontFamily);
1075
        }
1076

    
1077
        public static void SetPathGeometryChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
1078
        {
1079
            var instance = (TextControl)sender;
1080

    
1081
            if (e.OldValue != e.NewValue && instance.Base_TextPath != null)
1082
            {
1083
                instance.SetValue(e.Property, e.NewValue);
1084
            }
1085
        }
1086

    
1087

    
1088
        public static void OnTextBoxVisibilityChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
1089
        {
1090
            var instance = (TextControl)sender;
1091

    
1092
            if (e.OldValue != e.NewValue && instance.Base_TextPath != null)
1093
            {
1094
                instance.SetValue(e.Property, e.NewValue);
1095
            }
1096
        }
1097

    
1098
        public static void OnTextBlockVisibilityChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
1099
        {
1100
            var instance = (TextControl)sender;
1101

    
1102
            if (e.OldValue != e.NewValue && instance.Base_TextPath != null)
1103
            {
1104
                instance.SetValue(e.Property, e.NewValue);
1105
            }
1106
        }
1107

    
1108
        public static void IsSelectedChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
1109
        {
1110
            //var instance = (TextControl)sender;
1111

    
1112
            //if (e.OldValue != e.NewValue && instance.Base_Border != null)
1113
            //{
1114
            //    instance.SetValue(e.Property, e.NewValue);
1115

    
1116
            //    if (instance.IsSelected)
1117
            //    {
1118
            //        instance.StrokeColor = new SolidColorBrush(Colors.Blue);
1119
            //        //instance.Base_Border.BorderBrush = new SolidColorBrush(Colors.Blue);
1120
            //    }
1121
            //    else
1122
            //    {
1123
            //        instance.StrokeColor = new SolidColorBrush(Colors.Red);
1124
            //        //instance.Base_Border.BorderBrush = new SolidColorBrush(Colors.Red);
1125
            //        //instance.FontColor = new SolidColorBrush(Colors.Transparent);
1126
            //        //instance.Base_Border.BorderBrush = new SolidColorBrush(Colors.Transparent);
1127
            //    }
1128

    
1129
            //}
1130
        }
1131

    
1132
        public static void OnSetCansvasChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
1133
        {
1134
            var instance = (TextControl)sender;
1135

    
1136
            if (e.OldValue != e.NewValue && instance != null)
1137
            {
1138
                instance.SetValue(e.Property, e.NewValue);
1139

    
1140
                Canvas.SetLeft(instance, instance.CanvasX);
1141
                Canvas.SetTop(instance, instance.CanvasY);
1142
            }
1143
        }
1144

    
1145
        public static void OnIsEditingChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
1146
        {
1147
            var instance = (TextControl)sender;
1148

    
1149
            if (e.OldValue != e.NewValue && instance.Base_TextBlock != null)
1150
            {
1151
                instance.SetValue(e.Property, e.NewValue);
1152

    
1153
                if (instance.EnableEditing)
1154
                {
1155
                    instance.EditingMode();
1156
                }
1157
                else
1158
                {
1159
                    instance.UnEditingMode();
1160
                }
1161
            }
1162
        }
1163
        public static void TextChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
1164
        {
1165
            var instance = (TextControl)sender;
1166

    
1167
            if (e.OldValue != e.NewValue)
1168
            {
1169
                instance.SetValue(e.Property, e.NewValue);
1170
            }
1171
        }
1172

    
1173
        public static void OnCenterXYChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
1174
        {
1175
            var instance = (TextControl)sender;
1176

    
1177
            if (e.OldValue != e.NewValue && instance.Base_TextBlock != null)
1178
            {
1179
                instance.SetValue(e.Property, e.NewValue);
1180
                //instance.DrawingCloud();
1181
            }
1182
        }
1183

    
1184
        public static void AngleValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
1185
        {
1186
            var instance = (TextControl)sender;
1187
            if (e.OldValue != e.NewValue && instance.Base_TextBlock != null)
1188
            {
1189
                instance.SetValue(e.Property, e.NewValue);
1190
                //instance.DrawingCloud();
1191
            }
1192
        }
1193

    
1194
        public static void PointValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
1195
        {
1196
            var instance = (TextControl)sender;
1197
            
1198
            if (e.OldValue != e.NewValue && instance.Base_TextBox != null)
1199
            {                       
1200
                instance.SetText();
1201
                instance.DrawingCloud();
1202
            }
1203

    
1204
        }
1205

    
1206
        #endregion CallBack Method
1207

    
1208
        protected void OnPropertyChanged(string propName)
1209
        {
1210
            if (PropertyChanged != null)
1211
                PropertyChanged(this, new PropertyChangedEventArgs(propName));
1212

    
1213
            if (propName == "UnderLine" && Base_TextBlock != null)
1214
            {
1215
                Base_TextBlock.TextDecorations = UnderLine;
1216
                //(sender as TextControl).Base_TextBlock.TextDecorations = (sender as TextControl).UnderLine;
1217
            }
1218
        }
1219

    
1220
        /// <summary>
1221
        /// return textcontrols' area
1222
        /// </summary>
1223
        public override Rect ItemRect
1224
        {
1225
            get
1226
            {
1227
                Point start = new Point(this.CanvasX, this.CanvasY);
1228

    
1229
                Point length = new Point();
1230
                double angle = this.CommentAngle * Math.PI / 180;
1231
                double sin = Math.Sin(angle);
1232
                double cos = Math.Cos(angle);
1233

    
1234
                length.X = this.BoxWidth * cos - this.BoxHeight * sin;
1235
                length.Y = this.BoxWidth * sin + this.BoxHeight * cos;
1236

    
1237
                Point end = new Point(start.X + length.X, start.Y + length.Y);
1238
                return new Rect(start, end);
1239
            }
1240
        }
1241

    
1242
        /// <summary>
1243
        /// translate control along given dx,dy
1244
        /// </summary>
1245
        /// <param name="dx"></param>
1246
        /// <param name="dy"></param>
1247
        public override void OnTranslate(double dx, double dy)
1248
        {
1249
            //this.CanvasX = Canvas.GetLeft(this) + dx;
1250
            //this.CanvasY = Canvas.GetTop(this) + dy;
1251
            this.StartPoint = new Point(this.StartPoint.X + dx, this.StartPoint.Y + dy);
1252
            this.EndPoint = new Point(this.EndPoint.X + dx, this.EndPoint.Y + dy);
1253

    
1254
            this.SetValue(TextControl.CanvasXProperty, Canvas.GetLeft(this) + dx);
1255
            this.SetValue(TextControl.CanvasYProperty, Canvas.GetTop(this) + dy);
1256
        }
1257

    
1258
        /// <summary>
1259
        /// Serialize this
1260
        /// </summary>
1261
        /// <param name="sUserId"></param>
1262
        /// <returns></returns>
1263
        public override string Serialize()
1264
        {
1265
            using (S_TextControl STemp = new S_TextControl())
1266
            {
1267
                STemp.TransformPoint = "0|0";
1268
                STemp.SizeSet = String.Format("{0}|{1}", this.LineSize.Left.ToString(), this.TextSize.ToString());
1269
                STemp.Text = this.Text;
1270
                STemp.UserID = this.UserID;
1271
                STemp.FontColor = this.StrokeColor.Color.ToString();
1272
                //STemp.FontColor = "#FFFFFF00";
1273

    
1274
                if (this.StartPoint == new Point())
1275
                    STemp.StartPoint = new Point(this.CanvasX, this.CanvasY);
1276
                else
1277
                    STemp.StartPoint = this.StartPoint;
1278

    
1279
                STemp.EndPoint = this.EndPoint;
1280
                STemp.Opac = this.Opacity;
1281
                STemp.PointSet = this.PointSet;
1282
                STemp.Angle = this.CommentAngle;
1283
                STemp.paintMethod = this.ControlType_No;
1284
                STemp.BoxW = this.BoxWidth;
1285
                STemp.BoxH = this.BoxHeight;
1286
                STemp.isHighLight = this.IsHighLight;
1287
                STemp.Name = this.GetType().Name.ToString();
1288
                STemp.fontConfig = new List<string>()
1289
                            {
1290
                                this.TextFamily.FontName(),
1291
                                this.TextStyle.ToString(),
1292
                                this.TextWeight.ToString(),
1293
                            };
1294
                STemp.ArcLength = this.ArcLength;
1295

    
1296

    
1297
                if (this.UnderLine != null)
1298
                {
1299
                    STemp.fontConfig.Add("true");
1300
                }
1301

    
1302
                ///강인구 추가(2017.11.02)
1303
                ///Memo 추가
1304
                STemp.Memo = this.Memo;
1305

    
1306
                return "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize()));
1307
            }
1308
        }
1309

    
1310
        /// <summary>
1311
        /// create a textcontrol from given string
1312
        /// </summary>
1313
        /// <param name="str"></param>
1314
        /// <returns></returns>
1315
        public static TextControl FromString(string str, SolidColorBrush brush, string sProjectNo)
1316
        {
1317
            using (S_TextControl s = JsonSerializerHelper.JsonDeserialize<S_TextControl>(str))
1318
            {
1319
                string[] data2 = s.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
1320
                TextControl instance = new TextControl()
1321
                {
1322
                    Text = s.Text,
1323
                    StartPoint = s.StartPoint,
1324
                    EndPoint = s.EndPoint,
1325
                    CanvasX = s.StartPoint.X,
1326
                    CanvasY = s.StartPoint.Y,
1327
                    BoxWidth = s.BoxW,
1328
                    BoxHeight = s.BoxH,
1329
                    ControlType_No = s.paintMethod,
1330
                    LineSize = new Thickness(Convert.ToDouble(data2.First())),
1331
                    TextSize = Convert.ToDouble(data2[1]),
1332
                    StrokeColor = brush,
1333
                    FontSize = 10,
1334
                    UserID = s.UserID,
1335
                    IsHighLight = s.isHighLight,
1336
                    CommentAngle = s.Angle,
1337
                    PointSet = s.PointSet,
1338
                    Opacity = s.Opac,
1339
                    
1340
                    TextFamily = Markus.Fonts.FontHelper.GetFontFamily(s.fontConfig[0]),
1341
                    //인구 추가(2018.04.17)
1342
                    TextStyle = StringToFont.ConFontStyle(s.fontConfig[1]),
1343
                    TextWeight = StringToFont.ConFontWeight(s.fontConfig[2]),
1344
                    ArcLength = s.ArcLength
1345
                };
1346

    
1347
                if (s.fontConfig.Count() == 4)
1348
                {
1349
                    instance.UnderLine = TextDecorations.Underline;
1350
                }
1351

    
1352
                return instance;
1353
            }
1354
        }
1355
    }
1356
}
클립보드 이미지 추가 (최대 크기: 500 MB)