프로젝트

일반

사용자정보

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

markus / MarkupToPDF / Controls / Text / ArrowTextControl.cs @ 8898253f

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

1
using MarkupToPDF.Controls.Common;
2
using System;
3
using System.Collections.Generic;
4
using System.ComponentModel;
5
using System.Linq;
6
using System.Text;
7
using System.Threading.Tasks;
8
using System.Windows;
9
using System.Windows.Controls;
10
using System.Windows.Media;
11
using System.Windows.Shapes;
12
using MarkupToPDF.Controls.Custom;
13
using MarkupToPDF.Common;
14
using MarkupToPDF.Serialize.Core;
15
using MarkupToPDF.Serialize.S_Control;
16

    
17
namespace MarkupToPDF.Controls.Text
18
{
19
    public class ArrowTextControl : CommentUserInfo, IDisposable, INotifyPropertyChanged, IPath, ITextControl, IMarkupControlData
20
    {
21
        private const string PART_ArrowPath = "PART_ArrowPath";
22
        private const string PART_TextBox = "PART_ArrowTextBox";
23
        //private const string PART_TextBlock = "PART_ArrowTextBlock";
24
        private const string PART_ArrowSubPath = "PART_ArrowSubPath";
25
        private const string PART_Border = "PART_Border";
26
        private const string PART_BaseTextbox_Caret = "Caret";
27

    
28
        public Path Base_ArrowPath = null;
29
        public Path Base_ArrowSubPath = null;
30
        public TextBox Base_TextBox = null;
31
        public TextBlock Base_TextBlock = null;
32
        public Border BaseTextbox_Caret = null;
33

    
34
        private const double _CloudArcDepth = 0.8;  /// 2018.05.14 added by humkyung
35

    
36
        #region Object & Variable
37
        GeometryGroup instanceGroup = new GeometryGroup();
38
        
39
        Path Cemy = new Path();
40
        LineGeometry connectorSMGeometry = new LineGeometry();
41
        LineGeometry connectorMEGeometry = new LineGeometry();
42

    
43
        public enum ArrowTextStyleSet { Normal, Cloud, Rect };
44

    
45
        #endregion
46

    
47
        static ArrowTextControl()
48
        {
49
            DefaultStyleKeyProperty.OverrideMetadata(typeof(ArrowTextControl), new FrameworkPropertyMetadata(typeof(ArrowTextControl)));
50
            ResourceDictionary dictionary = new ResourceDictionary();
51
            dictionary.Source = new Uri("/MarkupToPDF;component/themes/generic.xaml", UriKind.RelativeOrAbsolute);
52
            Application.Current.Resources.MergedDictionaries.Add(dictionary);
53
        }
54

    
55
        public ArrowTextControl()
56
        {
57
            this.DefaultStyleKey = typeof(ArrowTextControl);
58
        }
59

    
60
        public override void OnApplyTemplate()
61
        {
62
            base.OnApplyTemplate();
63
            Base_ArrowPath = GetTemplateChild(PART_ArrowPath) as Path;
64
            Base_ArrowSubPath = GetTemplateChild(PART_ArrowSubPath) as Path;
65
            Base_TextBox = GetTemplateChild(PART_TextBox) as TextBox;
66
            BaseTextbox_Caret = GetTemplateChild(PART_BaseTextbox_Caret) as Border;
67
            Base_TextBox.Text = this.ArrowText;
68
           
69
            this.Base_TextBox.CaretIndex = this.Base_TextBox.Text.Length;
70
            this.Base_TextBox.CaretBrush = new SolidColorBrush(Colors.Transparent);
71
            this.Base_TextBox.ApplyTemplate();
72
            MoveCustomCaret();
73

    
74
            Base_TextBox.SizeChanged += new SizeChangedEventHandler(Base_TextBox_SizeChanged);
75
            Base_TextBox.GotFocus += new RoutedEventHandler(Base_TextBox_GotFocus);
76
            Base_TextBox.LostFocus += new RoutedEventHandler(Base_TextBox_LostFocus);
77
            Base_TextBox.SelectionChanged += (sender, e) => MoveCustomCaret();
78

    
79
            SetArrowTextPath();
80
            Base_TextBox.IsTabStop = true;
81
        }
82

    
83
        /// <summary>
84
        /// Moves the custom caret on the canvas.
85
        /// </summary>
86
        public void MoveCustomCaret()
87
        {
88

    
89
            var caretLocation = this.Base_TextBox.GetRectFromCharacterIndex(this.Base_TextBox.CaretIndex).Location;
90

    
91
            if (!double.IsInfinity(caretLocation.X))
92
            {
93
                
94
                Canvas.SetLeft(this.BaseTextbox_Caret, this.EndPoint.X + caretLocation.X);
95
            }
96

    
97
            if (!double.IsInfinity(caretLocation.Y))
98
            {
99
                Canvas.SetTop(this.BaseTextbox_Caret, this.EndPoint.Y + caretLocation.Y);
100
            }
101
        }
102

    
103

    
104
        void Base_TextBox_LostFocus(object sender, RoutedEventArgs e)
105
        {
106
            
107
            this.ArrowText = Base_TextBox.Text;
108
            this.BaseTextbox_Caret.Visibility = Visibility.Collapsed;
109
            this.IsEditingMode = false;
110
            ApplyOverViewData();
111
        }
112

    
113
        void Base_TextBox_GotFocus(object sender, RoutedEventArgs e)
114
        {
115
            this.BaseTextbox_Caret.Visibility = Visibility.Visible;
116
            this.IsEditingMode = true;
117
        }
118

    
119
        void Base_TextBox_SizeChanged(object sender, SizeChangedEventArgs e)
120
        {
121
            if(this.IsEditingMode)
122
            {
123
                if (Base_TextBox.Text.Contains("|OR||DZ|"))
124
                {
125
                    Base_TextBox.Text = this.ArrowText;
126
                }
127

    
128
                this.ArrowText = Base_TextBox.Text;
129
                
130
            }
131
            BoxWidth = e.NewSize.Width;
132
            BoxHeight = e.NewSize.Height;
133
            SetArrowTextPath();
134
        }
135

    
136
        #region Properties
137
        private bool _IsEditingMode;
138
        public bool IsEditingMode
139
        {
140
            get
141
            {
142
                return _IsEditingMode;
143
            }
144
            set
145
            {
146
                _IsEditingMode = value;
147
                OnPropertyChanged("IsEditingMode");
148
            }
149
        }
150

    
151

    
152
        #endregion
153

    
154
        #region dp Properties
155
        //강인구 주석 풀기
156
        public Visibility TextBoxVisibility
157
        {
158
            get { return (Visibility)GetValue(TextBoxVisibilityProperty); }
159
            set
160
            {
161
                if (this.TextBoxVisibility != value)
162
                {
163
                    SetValue(TextBoxVisibilityProperty, value);
164
                    OnPropertyChanged("TextBoxVisibility");
165
                }
166
            }
167
        }
168

    
169
        //강인구 주석 풀기
170
        public Visibility TextBlockVisibility
171
        {
172
            get { return (Visibility)GetValue(TextBlockVisibilityProperty); }
173
            set
174
            {
175
                if (this.TextBlockVisibility != value)
176
                {
177
                    SetValue(TextBlockVisibilityProperty, value);
178
                    OnPropertyChanged("TextBlockVisibility");
179
                }
180
            }
181
        }
182

    
183

    
184
        public override SolidColorBrush StrokeColor
185
        {
186
            get { return (SolidColorBrush)GetValue(StrokeColorProperty); }
187
            set
188
            {
189
                if (this.StrokeColor != value)
190
                {
191
                    SetValue(StrokeColorProperty, value);
192
                }
193
            }
194
        }
195

    
196
        public PathGeometry SubPathData
197
        {
198
            get { return (PathGeometry)GetValue(SubPathDataProperty); }
199
            set
200
            {
201
                if (this.SubPathData != value)
202
                {
203
                    SetValue(SubPathDataProperty, value);
204
                }
205
            }
206
        }
207

    
208
        public string UserID
209
        {
210
            get { return (string)GetValue(UserIDProperty); }
211
            set
212
            {
213
                if (this.UserID != value)
214
                {
215
                    SetValue(UserIDProperty, value);
216
                    OnPropertyChanged("UserID");
217
                }
218
            }
219
        }
220

    
221
        public List<Point> PointSet
222
        {
223
            get { return (List<Point>)GetValue(PointSetProperty); }
224
            set { SetValue(PointSetProperty, value); }
225
        }
226

    
227
        public override bool IsSelected
228
        {
229
            get
230
            {
231
                return (bool)GetValue(IsSelectedProperty);
232
            }
233
            set
234
            {
235
                SetValue(IsSelectedProperty, value);
236
                OnPropertyChanged("IsSelected");
237
            }
238
        }
239

    
240
        public override ControlType ControlType
241
        {
242
            set
243
            {
244
                SetValue(ControlTypeProperty, value);
245
                OnPropertyChanged("ControlType");
246
            }
247
            get
248
            {
249
                return (ControlType)GetValue(ControlTypeProperty);
250
            }
251
        }
252

    
253
        public Point StartPoint
254
        {
255
            get { return (Point)GetValue(StartPointProperty); }
256
            set { SetValue(StartPointProperty, value); }
257
        }
258

    
259
        public Point EndPoint
260
        {
261
            get { return (Point)GetValue(EndPointProperty); }
262
            set { SetValue(EndPointProperty, value); }
263
        }
264

    
265
        public Point OverViewStartPoint
266
        {
267
            get { return (Point)GetValue(OverViewStartPointProperty); }
268
            set { SetValue(OverViewStartPointProperty, value); }
269
        }
270

    
271
        public Point OverViewEndPoint
272
        {
273
            get { return (Point)GetValue(OverViewEndPointProperty); }
274
            set { SetValue(OverViewEndPointProperty, value); }
275
        }
276

    
277

    
278
        public double Angle
279
        {
280
            get { return (double)GetValue(AngleProperty); }
281
            set { SetValue(AngleProperty, value); }
282
        }
283

    
284
        public Thickness BorderSize
285
        {
286
            get { return (Thickness)GetValue(BorderSizeProperty); }
287
            set
288
            {
289
                if (this.BorderSize != value)
290
                {
291
                    SetValue(BorderSizeProperty, value);
292
                }
293
            }
294
        }
295

    
296

    
297
        public Point MidPoint
298
        {
299
            get { return (Point)GetValue(MidPointProperty); }
300
            set { SetValue(MidPointProperty, value); }
301
        }
302

    
303
        public bool isFixed
304
        {
305
            get { return (bool)GetValue(IsFixedProperty); }
306
            set { SetValue(IsFixedProperty, value); }
307
        }
308

    
309
        public bool isTrans
310
        {
311
            get { return (bool)GetValue(TransformerProperty); }
312
            set { SetValue(TransformerProperty, value); }
313
        }
314

    
315
        public bool isHighLight
316
        {
317
            get { return (bool)GetValue(isHighlightProperty); }
318
            set
319
            {
320
                if (this.isHighLight != value)
321
                {
322
                    SetValue(isHighlightProperty, value);
323
                    OnPropertyChanged("isHighLight");
324
                }
325
            }
326
        }
327

    
328
        public FontWeight TextWeight
329
        {
330
            get { return (FontWeight)GetValue(TextWeightProperty); }
331
            set
332
            {
333
                if (this.TextWeight != value)
334
                {
335
                    SetValue(TextWeightProperty, value);
336
                    OnPropertyChanged("TextWeight");
337
                }
338
            }
339
        }
340

    
341
        public Double LineSize
342
        {
343
            get { return (Double)GetValue(LineSizeProperty); }
344
            set
345
            {
346
                if (this.LineSize != value)
347
                {
348
                    SetValue(LineSizeProperty, value);
349
                }
350
            }
351
        }
352

    
353
        public Double BoxWidth
354
        {
355
            get { return (Double)GetValue(BoxWidthProperty); }
356
            set
357
            {
358
                if (this.BoxWidth != value)
359
                {
360
                    SetValue(BoxWidthProperty, value);
361
                }
362
            }
363
        }
364

    
365
        public Double BoxHeight
366
        {
367
            get { return (Double)GetValue(BoxHeightProperty); }
368
            set
369
            {
370
                if (this.BoxHeight != value)
371
                {
372
                    SetValue(BoxHeightProperty, value);
373
                }
374
            }
375
        }
376

    
377
        public ArrowTextStyleSet ArrowTextStyle
378
        {
379
            get { return (ArrowTextStyleSet)GetValue(ArrowTextStyleProperty); }
380
            set
381
            {
382
                if (this.ArrowTextStyle != value)
383
                {
384
                    SetValue(ArrowTextStyleProperty, value);
385
                }
386
            }
387
        }
388

    
389
        public Geometry PathData
390
        {
391
            get { return (Geometry)GetValue(PathDataProperty); }
392
            set { SetValue(PathDataProperty, value);
393

    
394
                OnPropertyChanged("PathData");
395
            }
396
        }
397

    
398
        public SolidColorBrush BackInnerColor
399
        {
400
            get { return (SolidColorBrush)GetValue(BackInnerColorProperty); }
401
            set
402
            {
403
                if (this.BackInnerColor != value)
404
                {
405
                    SetValue(BackInnerColorProperty, value);
406
                    OnPropertyChanged("BackInnerColor");
407
                }
408
            }
409
        }
410

    
411
        public Geometry PathDataInner
412
        {
413
            get { return (Geometry)GetValue(PathDataInnerProperty); }
414
            set
415
            {
416
                SetValue(PathDataInnerProperty, value);
417
                OnPropertyChanged("PathDataInner");
418
            }
419
        }
420

    
421
        public Geometry OverViewPathData
422
        {
423
            get { return (Geometry)GetValue(OverViewPathDataProperty); }
424
            set { SetValue(OverViewPathDataProperty, value);
425

    
426
                OnPropertyChanged("OverViewPathData");
427

    
428
            }
429
        }
430

    
431
        public FontFamily TextFamily
432
        {
433
            get { return (FontFamily)GetValue(TextFamilyProperty); }
434
            set
435
            {
436
                if (this.TextFamily != value)
437
                {
438
                    SetValue(TextFamilyProperty, value);
439
                    OnPropertyChanged("TextFamily");
440
                }
441
            }
442
        }
443

    
444
        public string ArrowText
445
        {
446
            get { return (string)GetValue(ArrowTextProperty); }
447
            set
448
            {
449
                if (this.ArrowText != value)
450
                {
451
                    SetValue(ArrowTextProperty, value);
452
                    OnPropertyChanged("ArrowText");
453
                }
454
            }
455
        }
456

    
457
        public string OverViewArrowText
458
        {
459

    
460
            get { return (string)GetValue(OverViewArrowTextProperty);
461
            }
462
            set
463
            {
464
                if (this.OverViewArrowText != value)
465
                {
466
                    SetValue(OverViewArrowTextProperty, value);
467
                    OnPropertyChanged("OverViewArrowText");
468
                }
469
            }
470
        }
471

    
472
        public Double TextSize
473
        {
474
            get { return (Double)GetValue(TextSizeProperty); }
475
            set
476
            {
477
                if (this.TextSize != value)
478
                {
479
                    SetValue(TextSizeProperty, value);
480
                    OnPropertyChanged("TextSize");
481
                }
482
            }
483
        }
484

    
485
        public FontStyle TextStyle
486
        {
487
            get { return (FontStyle)GetValue(TextStyleProperty); }
488
            set
489
            {
490
                if (this.TextStyle != value)
491
                {
492
                    SetValue(TextStyleProperty, value);
493
                    OnPropertyChanged("TextStyle");
494
                }
495
            }
496
        }
497

    
498
        //강인구 추가
499
        public TextDecorationCollection UnderLine
500
        {
501
            get
502
            {
503
                return (TextDecorationCollection)GetValue(UnderLineProperty);
504
            }
505
            set
506
            {
507
                if (this.UnderLine != value)
508
                {
509
                    SetValue(UnderLineProperty, value);
510
                    OnPropertyChanged("UnderLine");
511
                }
512
            }
513
        }
514

    
515
        public double CanvasX
516
        {
517
            get { return (double)GetValue(CanvasXProperty); }
518
            set
519
            {
520
                if (this.CanvasX != value)
521
                {
522
                    SetValue(CanvasXProperty, value);
523
                    OnPropertyChanged("CanvasX");
524
                }
525
            }
526
        }
527

    
528
        public double CanvasY
529
        {
530
            get { return (double)GetValue(CanvasYProperty); }
531
            set
532
            {
533
                if (this.CanvasY != value)
534
                {
535
                    SetValue(CanvasYProperty, value);
536
                    OnPropertyChanged("CanvasY");
537
                }
538
            }
539
        } 
540

    
541
        public double CenterX
542
        {
543
            get { return (double)GetValue(CenterXProperty); }
544
            set { SetValue(CenterXProperty, value);
545
            OnPropertyChanged("CenterX");
546
            
547
            }
548
        }
549

    
550
        public double CenterY
551
        {
552
            get { return (double)GetValue(CenterYProperty); }
553
            set { SetValue(CenterYProperty, value);
554
            OnPropertyChanged("CenterY");
555
            }
556
        }
557

    
558
        public Brush SubPathFill
559
        {
560
            get { return (Brush)GetValue(SubPathFillProperty); }
561
            set
562
            {
563
                SetValue(SubPathFillProperty, value);
564
                OnPropertyChanged("SubPathFill");
565
            }
566
        }
567

    
568
        public Brush TextBoxBackground
569
        {
570
            get { return (Brush)GetValue(TextBoxBackgroundProperty); }
571
            set
572
            {
573
                SetValue(TextBoxBackgroundProperty, value);
574
                OnPropertyChanged("TextBoxBackground");
575
            }
576
        }
577

    
578

    
579
        //강인구 추가 주석풀기
580
       
581

    
582
        public bool EnableEditing
583
        {
584
            get { return (bool)GetValue(EnableEditingProperty); }
585
            set
586
            {
587
                if (this.EnableEditing != value)
588
                {
589
                    SetValue(EnableEditingProperty, value);
590
                    OnPropertyChanged("EnableEditing");
591
                }
592
            }
593
        }
594

    
595
        #endregion
596

    
597
        #region Dependency Properties
598

    
599
        public static readonly DependencyProperty BoxWidthProperty = DependencyProperty.Register(
600
                "BoxWidth", typeof(double), typeof(ArrowTextControl), new PropertyMetadata((Double)20));
601

    
602
        public static readonly DependencyProperty BoxHeightProperty = DependencyProperty.Register(
603
                "BoxHeight", typeof(double), typeof(ArrowTextControl), new PropertyMetadata((Double)20));
604

    
605
        public static readonly DependencyProperty UserIDProperty = DependencyProperty.Register(
606
                "UserID", typeof(string), typeof(ArrowTextControl), new PropertyMetadata(null));
607

    
608
        public static readonly DependencyProperty ArrowTextStyleProperty = DependencyProperty.Register(
609
               "ArrowTextStyle", typeof(ArrowTextStyleSet), typeof(ArrowTextControl), new PropertyMetadata(ArrowTextStyleSet.Normal));
610

    
611
        public static readonly DependencyProperty CenterXProperty = DependencyProperty.Register(
612
                "CenterX", typeof(double), typeof(ArrowTextControl), new PropertyMetadata((double)0, OnCenterXYChanged));
613

    
614
        public static readonly DependencyProperty CenterYProperty = DependencyProperty.Register(
615
                "CenterY", typeof(double), typeof(ArrowTextControl), new PropertyMetadata((double)0, OnCenterXYChanged));
616

    
617
        public static readonly DependencyProperty AngleProperty = DependencyProperty.Register(
618
                "Angle", typeof(double), typeof(ArrowTextControl), new PropertyMetadata((double)0.0, new PropertyChangedCallback(PointValueChanged)));
619
        
620
        public static readonly DependencyProperty CanvasXProperty = DependencyProperty.Register(
621
                "CanvasX", typeof(double), typeof(ArrowTextControl), new PropertyMetadata((double)0, OnSetCansvasChanged));
622

    
623
        public static readonly DependencyProperty CanvasYProperty = DependencyProperty.Register(
624
                "CanvasY", typeof(double), typeof(ArrowTextControl), new PropertyMetadata((double)0, OnSetCansvasChanged));
625

    
626
        public static readonly DependencyProperty PointSetProperty = DependencyProperty.Register(
627
                "PointSet", typeof(List<Point>), typeof(ArrowTextControl), new PropertyMetadata(new List<Point>(), PointValueChanged));
628

    
629
        public static readonly DependencyProperty TextFamilyProperty = DependencyProperty.Register(
630
                "TextFamily", typeof(FontFamily), typeof(ArrowTextControl), new PropertyMetadata(new FontFamily("Arial"), TextChanged));
631

    
632
        public static readonly DependencyProperty PathDataProperty = DependencyProperty.Register(
633
                "PathData", typeof(Geometry), typeof(ArrowTextControl), null);
634

    
635
        //강인구 추가
636
        public static readonly DependencyProperty UnderLineProperty = DependencyProperty.Register(
637
    "UnderLine", typeof(TextDecorationCollection), typeof(ArrowTextControl), new PropertyMetadata(null, PointValueChanged));
638

    
639
        public static readonly DependencyProperty LineSizeProperty = DependencyProperty.Register(
640
               "LineSize", typeof(double), typeof(ArrowTextControl), new PropertyMetadata((Double)3, PointValueChanged));
641

    
642
        public static readonly DependencyProperty TextStyleProperty = DependencyProperty.Register(
643
                "TextStyle", typeof(FontStyle), typeof(ArrowTextControl), new PropertyMetadata(FontStyles.Normal));
644

    
645
        public static readonly DependencyProperty TextSizeProperty = DependencyProperty.Register(
646
                "TextSize", typeof(Double), typeof(ArrowTextControl), new PropertyMetadata((Double)30, PointValueChanged));
647

    
648
        public static readonly DependencyProperty TextWeightProperty = DependencyProperty.Register(
649
                "TextWeight", typeof(FontWeight), typeof(ArrowTextControl), new PropertyMetadata(FontWeights.Normal));
650

    
651
        public static readonly DependencyProperty IsFixedProperty = DependencyProperty.Register(
652
                "isFixed", typeof(bool), typeof(ArrowTextControl), new PropertyMetadata(false, PointValueChanged));
653

    
654
        public static readonly DependencyProperty IsSelectedProperty = DependencyProperty.Register(
655
                "IsSelected", typeof(bool), typeof(ArrowTextControl), new FrameworkPropertyMetadata(false, IsSelectedChanged));
656

    
657
        public static readonly DependencyProperty StrokeColorProperty = DependencyProperty.Register(
658
                "StrokeColor", typeof(SolidColorBrush), typeof(ArrowTextControl), new PropertyMetadata(new SolidColorBrush(Colors.Red)));
659

    
660
        public static readonly DependencyProperty ControlTypeProperty = DependencyProperty.Register(
661
                "ControlType", typeof(ControlType), typeof(ArrowTextControl), new FrameworkPropertyMetadata(ControlType.ArrowTextControl));
662

    
663
        public static readonly DependencyProperty StartPointProperty = DependencyProperty.Register(
664
                "StartPoint", typeof(Point), typeof(ArrowTextControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
665

    
666
        public static readonly DependencyProperty EndPointProperty = DependencyProperty.Register(
667
                "EndPoint", typeof(Point), typeof(ArrowTextControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
668

    
669
        public static readonly DependencyProperty BackInnerColorProperty = DependencyProperty.Register(
670
            "BackInnerColor", typeof(SolidColorBrush), typeof(ArrowTextControl), new PropertyMetadata(new SolidColorBrush(Colors.White)));
671

    
672
        public static readonly DependencyProperty PathDataInnerProperty = DependencyProperty.Register(
673
    "PathDataInner", typeof(Geometry), typeof(ArrowTextControl), null);
674

    
675
        public static readonly DependencyProperty isHighlightProperty = DependencyProperty.Register(
676
                "isHighlight", typeof(bool), typeof(ArrowTextControl), new PropertyMetadata(false, PointValueChanged));
677

    
678
        public static readonly DependencyProperty MidPointProperty = DependencyProperty.Register(
679
                "MidPoint", typeof(Point), typeof(ArrowTextControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
680

    
681
        public static readonly DependencyProperty TransformerProperty = DependencyProperty.Register(
682
                "isTrans", typeof(bool), typeof(ArrowTextControl), new PropertyMetadata(false, PointValueChanged));
683

    
684
        public static readonly DependencyProperty BorderSizeProperty = DependencyProperty.Register(
685
                "BorderSize", typeof(Thickness), typeof(ArrowTextControl), new PropertyMetadata(new Thickness(0), PointValueChanged));
686
    
687
        public static readonly DependencyProperty ArrowTextProperty = DependencyProperty.Register(
688
              "ArrowText", typeof(string), typeof(ArrowTextControl), new PropertyMetadata(null));
689

    
690

    
691

    
692
        //, new PropertyChangedCallback(TextChanged)
693

    
694

    
695
        #region 추가 사항
696
        public static readonly DependencyProperty SubPathDataProperty = DependencyProperty.Register(
697
                "SubPathData", typeof(Geometry), typeof(ArrowTextControl), null);
698

    
699

    
700
        public static readonly DependencyProperty SubPathFillProperty = DependencyProperty.Register(
701
                "SubPathFill", typeof(Brush), typeof(ArrowTextControl), new PropertyMetadata(null));
702

    
703
        public static readonly DependencyProperty TextBoxBackgroundProperty = DependencyProperty.Register(
704
                "TextBoxBackground", typeof(Brush), typeof(ArrowTextControl), new PropertyMetadata(Brushes.White));
705

    
706
        public static readonly DependencyProperty OverViewArrowTextProperty = DependencyProperty.Register(
707
                "OverViewArrowText", typeof(string), typeof(ArrowTextControl), new PropertyMetadata(null, new PropertyChangedCallback(TextChanged)));
708

    
709
        public static readonly DependencyProperty OverViewPathDataProperty = DependencyProperty.Register(
710
                "OverViewPathData", typeof(Geometry), typeof(ArrowTextControl), null);
711

    
712
        public static readonly DependencyProperty OverViewStartPointProperty = DependencyProperty.Register(
713
                "OverViewStartPoint", typeof(Point), typeof(ArrowTextControl), new PropertyMetadata(null));
714

    
715
        public static readonly DependencyProperty OverViewEndPointProperty = DependencyProperty.Register(
716
                "OverViewEndPoint", typeof(Point), typeof(ArrowTextControl), new PropertyMetadata(null));
717

    
718
        public static readonly DependencyProperty TextBoxVisibilityProperty = DependencyProperty.Register(
719
            "TextBoxVisibility", typeof(Visibility), typeof(ArrowTextControl), new PropertyMetadata((Visibility.Visible), OnTextBoxVisibilityChanged));
720

    
721
        //강인구 추가(주석풀기)
722
        public static readonly DependencyProperty TextBlockVisibilityProperty = DependencyProperty.Register(
723
            "TextBlockVisibility", typeof(Visibility), typeof(ArrowTextControl), new PropertyMetadata((Visibility.Collapsed), OnTextBlockVisibilityChanged));
724

    
725
        public static readonly DependencyProperty EnableEditingProperty = DependencyProperty.Register(
726
           "EnableEditing", typeof(bool), typeof(ArrowTextControl), new PropertyMetadata((true), new PropertyChangedCallback(OnIsEditingChanged)));
727

    
728
        #endregion
729

    
730
        #endregion
731

    
732
        #region CallBack Method
733

    
734
        //강인구 추가(주석풀기)
735
        public static void OnIsEditingChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
736
        {
737
            var instance = (ArrowTextControl)sender;
738

    
739
            if (e.OldValue != e.NewValue && instance.Base_TextBlock != null)
740
            {
741
                instance.SetValue(e.Property, e.NewValue);
742

    
743
                if (instance.EnableEditing)
744
                {
745
                    instance.EditingMode();
746
                }
747
                else
748
                {
749
                    instance.UnEditingMode();
750
                }
751
            }
752
        }
753

    
754
        public static void OnTextBoxVisibilityChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
755
        {
756
            var instance = (ArrowTextControl)sender;
757

    
758
            if (e.OldValue != e.NewValue && instance.Base_ArrowPath != null)
759
            {
760
                instance.SetValue(e.Property, e.NewValue);
761
            }
762
        }
763

    
764
        public static void OnTextBlockVisibilityChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
765
        {
766
            var instance = (ArrowTextControl)sender;
767

    
768
            if (e.OldValue != e.NewValue && instance.Base_ArrowPath != null)
769
            {
770
                instance.SetValue(e.Property, e.NewValue);
771
            }
772
        }
773

    
774
        public static void PointValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
775
        {
776
            var instance = (ArrowTextControl)sender;
777

    
778
            if (e.OldValue != e.NewValue && instance.Base_ArrowPath != null)
779
            {
780
                instance.SetArrowTextPath();
781
            }
782
        }
783

    
784

    
785

    
786
        public static void TextChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
787
        {
788
            var instance = (ArrowTextControl)sender;
789
            
790
            if (e.OldValue != e.NewValue)
791
            {
792
                instance.SetValue(e.Property, e.NewValue);
793
                //instance.BoxWidth = instance.Base_TextBox.ActualWidth;
794
                //instance.BoxHeight = instance.Base_TextBox.ActualHeight;
795
            }
796
        }
797

    
798
        public static void OnCenterXYChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
799
        {
800
            var instance = (ArrowTextControl)sender;
801
            if (e.OldValue != e.NewValue && instance.Base_ArrowPath != null)
802
            {
803
                instance.SetValue(e.Property, e.NewValue);
804
                instance.SetArrowTextPath();
805
            }
806
        }
807

    
808
        public static void OnSetCansvasChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
809
        {
810
            var instance = (ArrowTextControl)sender;
811

    
812
            if (e.OldValue != e.NewValue && instance != null)
813
            {
814
                instance.SetValue(e.Property, e.NewValue);
815
                //Canvas.SetLeft(instance, instance.CanvasX);
816
                //Canvas.SetTop(instance, instance.CanvasY);
817
            }
818
        }
819

    
820
        public static void IsSelectedChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
821
        {
822
            //var instance = (ArrowTextControl)sender;
823

    
824
            //if (e.OldValue != e.NewValue)
825
            //{
826
            //    instance.SetValue(e.Property, e.NewValue);
827

    
828
            //    if (instance.IsSelected && instance.Base_TextBox != null)
829
            //    {
830
            //        instance.BorderSize = new Thickness(1);
831
            //        //instance.Base_TextBox.BorderBrush = new SolidColorBrush(Colors.Blue);
832
            //        //instance.Base_ArrowPath.Stroke = new SolidColorBrush(Colors.Blue);
833
            //    }
834
            //    else
835
            //    {
836
            //        instance.BorderSize = new Thickness(0);
837
            //        //instance.Base_TextBox.BorderBrush = new SolidColorBrush(Colors.Transparent);
838
            //        //instance.Base_ArrowPath.Stroke = new SolidColorBrush(Colors.Transparent);
839
            //    }
840
            //}
841
        }
842
        #endregion
843

    
844
        #region Internal Method
845

    
846
        //강인구 주석 풀기
847
        public void EditingMode()
848
        {
849
            TextBoxVisibility = Visibility.Visible;
850
            TextBlockVisibility = Visibility.Collapsed;
851

    
852

    
853
            //강인구 언더라인 추가
854
            if (UnderLine != null)
855
                Base_TextBlock.TextDecorations = UnderLine;
856
        }
857
        //강인구 주석 풀기
858
        public void UnEditingMode()
859
        {
860

    
861
            TextBoxVisibility = Visibility.Collapsed;
862
            TextBlockVisibility = Visibility.Visible;
863

    
864
            if (UnderLine != null)
865
                Base_TextBlock.TextDecorations = UnderLine;
866

    
867
            Base_TextBlock.Margin =
868
                 new Thickness(Base_TextBox.Margin.Left + 4, Base_TextBox.Margin.Top + 4,
869
                     Base_TextBox.Margin.Right + 4, Base_TextBox.Margin.Bottom + 4);
870
        }
871

    
872
        private void SetArrowTextPath()
873
        {
874
            instanceGroup.Children.Clear();
875

    
876
            connectorSMGeometry.StartPoint = this.StartPoint;
877
            connectorSMGeometry.EndPoint = this.MidPoint;
878
            connectorMEGeometry.StartPoint = this.MidPoint; //핵심
879

    
880
            Canvas.SetLeft(Base_TextBox, this.EndPoint.X);
881
            Canvas.SetTop(Base_TextBox, this.EndPoint.Y);
882
             
883
            List<Point> ps = new List<Point>();
884
            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth / 2, Canvas.GetTop(Base_TextBox))); //상단
885
            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth / 2, Canvas.GetTop(Base_TextBox) + this.BoxHeight)); // 하단
886
            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxHeight / 2)); //좌단
887
            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth, Canvas.GetTop(Base_TextBox) + this.BoxHeight / 2));  //우단
888

    
889
            if (isTrans)
890
            {
891
                switch (Math.Abs(this.Angle).ToString())
892
                {
893
                    case "90":
894
                        {
895
                            ps.Clear();
896
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽
897
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth / 2)); // 위 중간
898
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth)); // 위 오른쪽
899

    
900
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight / 2, Canvas.GetTop(Base_TextBox))); //왼쪽 중간
901
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox))); //왼쪽 하단
902

    
903
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox) - this.BoxWidth / 2)); //중간 하단
904
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox) - this.BoxWidth)); //오른쪽 하단
905

    
906
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) - this.BoxWidth)); //오른쪽 중간
907
                        }
908
                        break;
909
                    case "270":
910
                        {
911
                            ps.Clear();
912
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽
913
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth / 2)); // 위 중간
914
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth)); // 위 오른쪽
915

    
916
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight / 2, Canvas.GetTop(Base_TextBox))); //왼쪽 중간
917
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight, Canvas.GetTop(Base_TextBox))); //왼쪽 하단
918

    
919
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight, Canvas.GetTop(Base_TextBox) + this.BoxWidth / 2)); //중간 하단
920
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight, Canvas.GetTop(Base_TextBox) + this.BoxWidth)); //오른쪽 하단
921

    
922
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) + this.BoxWidth)); //오른쪽 중간
923
                        }
924
                        break;
925
                    default:
926
                        break;
927
                }
928
                
929
                var endP = MathSet.getNearPoint(ps, this.MidPoint);
930

    
931
                //20180911 LJY 꺾이는 부분 수정
932
                Point testP = endP;                
933
                switch (Math.Abs(this.Angle).ToString())
934
                {
935
                    case "90":
936
                        testP = new Point(endP.X + 50, endP.Y);
937
                        break;
938
                    case "270":
939
                        testP = new Point(endP.X - 50, endP.Y);
940
                        break;
941
                }                
942

    
943
                //20180910 LJY 각도에 따라.
944
                switch (Math.Abs(this.Angle).ToString())
945
                {
946
                    case "90":
947
                        if (isFixed)
948
                        {
949
                            if (ps[0] == endP) //상단
950
                            {
951
                                testP = new Point(endP.X , endP.Y + 50);
952
                                //System.Diagnostics.Debug.WriteLine("상단"+ testP);
953
                            }
954
                            else if (ps[1] == endP) //하단
955
                            {
956
                                testP = new Point(endP.X , endP.Y - 50);
957
                                //System.Diagnostics.Debug.WriteLine("하단"+ testP);
958
                            }
959
                            else if (ps[2] == endP) //좌단
960
                            {
961
                                testP = new Point(endP.X - 50, endP.Y);
962
                                //System.Diagnostics.Debug.WriteLine("좌단"+ testP);
963
                            }
964
                            else if (ps[3] == endP) //우단
965
                            {
966
                                testP = new Point(endP.X + 50, endP.Y);
967
                                //System.Diagnostics.Debug.WriteLine("우단"+ testP);
968
                            }
969
                        }
970
                        break;
971
                    case "270":
972
                        if (isFixed)
973
                        {
974
                            if (ps[0] == endP) //상단
975
                            {
976
                                testP = new Point(endP.X , endP.Y - 50);
977
                                //System.Diagnostics.Debug.WriteLine("상단" + testP);
978
                            }
979
                            else if (ps[1] == endP) //하단
980
                            {
981
                                testP = new Point(endP.X, endP.Y + 50);
982
                                //System.Diagnostics.Debug.WriteLine("하단" + testP);
983
                            }
984
                            else if (ps[2] == endP) //좌단
985
                            {
986
                                testP = new Point(endP.X + 50, endP.Y);
987
                                //System.Diagnostics.Debug.WriteLine("좌단" + testP);
988
                            }
989
                            else if (ps[3] == endP) //우단
990
                            {
991
                                testP = new Point(endP.X - 50, endP.Y);
992
                                //System.Diagnostics.Debug.WriteLine("우단" + testP);
993
                            }
994
                        }
995
                        break;
996
                    default:
997
                        if (isFixed)
998
                        {
999
                            if (ps[0] == endP) //상단
1000
                            {
1001
                                testP = new Point(endP.X, endP.Y - 50);
1002
                                //System.Diagnostics.Debug.WriteLine("상단");
1003
                            }
1004
                            else if (ps[1] == endP) //하단
1005
                            {
1006
                                testP = new Point(endP.X, endP.Y + 50);
1007
                                //System.Diagnostics.Debug.WriteLine("하단");
1008
                            }
1009
                            else if (ps[2] == endP) //좌단
1010
                            {
1011
                                testP = new Point(endP.X - 50, endP.Y);
1012
                                //System.Diagnostics.Debug.WriteLine("좌단");
1013
                            }
1014
                            else if (ps[3] == endP) //우단
1015
                            {
1016
                                testP = new Point(endP.X + 50, endP.Y);
1017
                                //System.Diagnostics.Debug.WriteLine("우단");
1018
                            }
1019
                        }
1020
                        break;
1021
                }
1022
                connectorMEGeometry.EndPoint = endP;
1023
                connectorSMGeometry.EndPoint = testP;
1024
                connectorMEGeometry.StartPoint = testP;
1025
                
1026
                //20180910 LJY 각도에 따라.
1027
                this.MidPoint = testP;
1028
                instanceGroup.Children.Add(DrawSet.DrawArrow(testP, this.StartPoint, this.LineSize));
1029
                instanceGroup.FillRule = FillRule.Nonzero;
1030
                this.Base_ArrowPath.Fill = this.StrokeColor;
1031
                this.Base_ArrowSubPath.Fill = this.StrokeColor;
1032
            }
1033
            else
1034
            {
1035
                switch (Math.Abs(this.Angle).ToString())
1036
                {
1037
                    case "90":
1038
                        {
1039
                            ps.Clear();
1040

    
1041
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽
1042
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth / 2)); // 위 중간
1043
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth)); // 위 오른쪽
1044

    
1045
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight / 2, Canvas.GetTop(Base_TextBox))); //왼쪽 중간
1046
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox))); //왼쪽 하단
1047

    
1048
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox) - this.BoxWidth / 2)); //중간 하단
1049
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox) - this.BoxWidth)); //오른쪽 하단
1050
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) - this.BoxWidth)); //오른쪽 중간 
1051
                        }
1052
                        break;
1053
                    case "270":
1054
                        {
1055
                            ps.Clear();
1056
                            
1057
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽
1058
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth / 2)); // 위 중간
1059
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth)); // 위 오른쪽
1060

    
1061
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight / 2, Canvas.GetTop(Base_TextBox))); //왼쪽 중간
1062
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight, Canvas.GetTop(Base_TextBox))); //왼쪽 하단
1063

    
1064
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight, Canvas.GetTop(Base_TextBox) + this.BoxWidth / 2)); //중간 하단
1065
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight, Canvas.GetTop(Base_TextBox) + this.BoxWidth)); //오른쪽 하단
1066

    
1067
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) + this.BoxWidth)); //오른쪽 중간 
1068
                        }
1069
                        break;
1070
                    default:
1071
                        break;
1072
                }
1073

    
1074

    
1075
                var endP = MathSet.getNearPoint(ps, this.MidPoint);
1076
                connectorMEGeometry.EndPoint = endP; //최상단
1077
                                                     //connectorMEGeometry.EndPoint = this.EndPoint; //핵심
1078
                                                     //this.MidPoint= MathSet.getMiddlePoint(this.StartPoint, endP);
1079
                #region 보정치
1080
                Point testP = endP;
1081

    
1082
                //20180910 LJY 각도에 따라.
1083
                switch (Math.Abs(this.Angle).ToString())
1084
                {
1085
                    case "90":
1086
                        if (isFixed)
1087
                        {
1088
                            if (ps[0] == endP) //상단
1089
                            {
1090
                                testP = new Point(endP.X - 50, endP.Y);
1091
                                //System.Diagnostics.Debug.WriteLine("상단"+ testP);
1092
                            }
1093
                            else if (ps[1] == endP) //하단
1094
                            {
1095
                                testP = new Point(endP.X + 50, endP.Y);
1096
                                //System.Diagnostics.Debug.WriteLine("하단"+ testP);
1097
                            }
1098
                            else if (ps[2] == endP) //좌단
1099
                            {
1100
                                testP = new Point(endP.X - 50, endP.Y);
1101
                                //System.Diagnostics.Debug.WriteLine("좌단"+ testP);
1102
                            }
1103
                            else if (ps[3] == endP) //우단
1104
                            {
1105
                                testP = new Point(endP.X + 50 , endP.Y);
1106
                                //System.Diagnostics.Debug.WriteLine("우단"+ testP);
1107
                            }
1108
                        }
1109
                        break;
1110
                    case "270":
1111
                        if (isFixed)
1112
                        {
1113
                            if (ps[0] == endP) //상단
1114
                            {
1115
                                testP = new Point(endP.X + 50, endP.Y);
1116
                                //System.Diagnostics.Debug.WriteLine("상단" + testP);
1117
                            }
1118
                            else if (ps[1] == endP) //하단
1119
                            {
1120
                                testP = new Point(endP.X - 50, endP.Y);
1121
                                //System.Diagnostics.Debug.WriteLine("하단" + testP);
1122
                            }
1123
                            else if (ps[2] == endP) //좌단
1124
                            {
1125
                                testP = new Point(endP.X + 50, endP.Y);
1126
                                //System.Diagnostics.Debug.WriteLine("좌단" + testP);
1127
                            }
1128
                            else if (ps[3] == endP) //우단
1129
                            {
1130
                                testP = new Point(endP.X + 50, endP.Y );
1131
                                //System.Diagnostics.Debug.WriteLine("우단" + testP);
1132
                            }
1133
                        }
1134
                        break;
1135
                    default:
1136
                        if (isFixed)
1137
                        {
1138
                            if (ps[0] == endP) //상단
1139
                            {
1140
                                testP = new Point(endP.X, endP.Y - 50);
1141
                                //System.Diagnostics.Debug.WriteLine("상단");
1142
                            }
1143
                            else if (ps[1] == endP) //하단
1144
                            {
1145
                                testP = new Point(endP.X, endP.Y + 50);
1146
                                //System.Diagnostics.Debug.WriteLine("하단");
1147
                            }
1148
                            else if (ps[2] == endP) //좌단
1149
                            {
1150
                                testP = new Point(endP.X - 50, endP.Y);
1151
                                //System.Diagnostics.Debug.WriteLine("좌단");
1152
                            }
1153
                            else if (ps[3] == endP) //우단
1154
                            {
1155
                                testP = new Point(endP.X + 50, endP.Y);
1156
                                //System.Diagnostics.Debug.WriteLine("우단");
1157
                            }
1158
                        }
1159
                        break;
1160
                }
1161
                  
1162

    
1163
                connectorSMGeometry.EndPoint = testP;
1164
                connectorMEGeometry.StartPoint = testP;
1165
                instanceGroup.Children.Add(DrawSet.DrawArrow(testP, this.StartPoint, this.LineSize));
1166
                instanceGroup.FillRule = FillRule.Nonzero;
1167
                this.Base_ArrowPath.Fill = this.StrokeColor;
1168
                this.Base_ArrowSubPath.Fill = this.StrokeColor;
1169
                #endregion
1170
            }
1171

    
1172
            switch (this.ArrowTextStyle)
1173
            {
1174
                case ArrowTextStyleSet.Normal:
1175
                    this.BorderSize = new Thickness(0);
1176
                    DrawingRect();
1177
                    break;
1178
                case ArrowTextStyleSet.Cloud:
1179
                    this.BorderSize = new Thickness(0);
1180
                    DrawingCloud();
1181
                    break;
1182
                default:
1183
                    {
1184
                        this.BorderSize = new Thickness(LineSize); //올라
1185
                        DrawingRect();
1186
                    }
1187

    
1188
                    break;
1189
            }
1190

    
1191
            if (isHighLight)
1192
            {
1193
                SubPathFill = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B));
1194
                BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B));
1195

    
1196
                TextBoxBackground = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B));
1197
            }
1198
            else
1199
            {
1200
                BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1201
                SubPathFill = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1202
                TextBoxBackground = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.1), Colors.White.R, Colors.White.G, Colors.White.B));
1203
            }
1204

    
1205
            instanceGroup.Children.Add(connectorSMGeometry);
1206
            instanceGroup.Children.Add(connectorMEGeometry);
1207

    
1208
            this.PathData = instanceGroup;
1209
            OverViewPathData = PathData;
1210
            OverViewArrowText = ArrowText;
1211
            OverViewEndPoint = connectorMEGeometry.EndPoint;
1212
            OverViewStartPoint = connectorSMGeometry.StartPoint;
1213

    
1214
            var tempAngle = Math.Abs(this.Angle);
1215

    
1216
            if (tempAngle == Convert.ToDouble(90) || tempAngle == Convert.ToDouble(270))
1217
            {
1218
                this.RenderTransformOrigin = new Point(0.5, 0.5);
1219
                this.Base_ArrowPath.RenderTransformOrigin = new Point(0, 0);
1220
                this.Base_ArrowSubPath.RenderTransformOrigin = new Point(0, 0);
1221

    
1222
                Base_TextBox.RenderTransformOrigin = new Point(0, 0);
1223
            }
1224

    
1225
            Base_ArrowSubPath.RenderTransform = new RotateTransform
1226
            {
1227
                Angle = this.Angle,
1228
                CenterX = this.EndPoint.X,
1229
                CenterY = this.EndPoint.Y,
1230
            };
1231
            MoveCustomCaret();
1232
        }
1233

    
1234
        private void DrawingCloud()
1235
        {
1236
            //20180906 LJY Textbox guide
1237
            string angle = Math.Abs(this.Angle).ToString();
1238
            if (angle == "180")
1239
            {
1240
                List<Point> pCloud = new List<Point>()
1241
                {
1242
                     new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1243
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - BoxHeight), //왼쪽 아래
1244
                    new Point(Canvas.GetLeft(Base_TextBox) - BoxWidth, Canvas.GetTop(Base_TextBox) - BoxHeight),
1245
                    new Point(Canvas.GetLeft(Base_TextBox) - BoxWidth, Canvas.GetTop(Base_TextBox)),
1246
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1247
                };
1248
                SubPathData = (Generate(pCloud));
1249
                PathDataInner = (GenerateInnerCloud(pCloud, angle));
1250
            
1251
            }//20180906 LJY Textbox guide
1252
            else
1253
            {            
1254
                List<Point> pCloud = new List<Point>()
1255
                {
1256
    #if SILVERLIGHT
1257
		            new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1258
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight), //왼쪽 아래
1259
                    new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth, Canvas.GetTop(Base_TextBox) + BoxHeight),
1260
                    new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth, Canvas.GetTop(Base_TextBox)),
1261
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1262

    
1263
    #else
1264
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1265
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight), //왼쪽 아래
1266
                    new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth, Canvas.GetTop(Base_TextBox) + BoxHeight),
1267
                    new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth, Canvas.GetTop(Base_TextBox)),
1268
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1269

    
1270
                    //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1271
                    //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight-4), //왼쪽 아래
1272
                    //new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth-1, Canvas.GetTop(Base_TextBox) + BoxHeight-4),
1273
                    //new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth-1, Canvas.GetTop(Base_TextBox)),
1274
                    //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1275
    #endif
1276
                };
1277
                //instanceGroup.Children.Add(Generate(pCloud));
1278
                SubPathData = (Generate(pCloud));
1279
                PathDataInner = (GenerateInnerCloud(pCloud, angle));
1280
                //   }
1281
            }
1282

    
1283
        }
1284

    
1285
        private void DrawingRect()
1286
        {
1287
            //20180906 LJY Textbox guide
1288
            if(this.ArrowTextStyle == ArrowTextStyleSet.Normal)
1289
            {
1290
                this.Base_TextBox.BorderBrush = Brushes.Transparent;
1291
            }
1292
            if (Math.Abs(this.Angle).ToString() == "90")
1293
            {
1294
                List<Point> pCloud = new List<Point>()
1295
                {
1296
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1297
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - BoxWidth), //왼쪽 아래
1298
                    new Point(Canvas.GetLeft(Base_TextBox) + BoxHeight, Canvas.GetTop(Base_TextBox) - BoxWidth),
1299
                    new Point(Canvas.GetLeft(Base_TextBox) + BoxHeight, Canvas.GetTop(Base_TextBox)),
1300
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1301
                };
1302
                PathDataInner = (GenerateInner(pCloud));
1303
            }
1304
            else if(Math.Abs(this.Angle).ToString() == "270")
1305
            {
1306
                List<Point> pCloud = new List<Point>()
1307
                {
1308
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1309
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + BoxWidth), //왼쪽 아래
1310
                    new Point(Canvas.GetLeft(Base_TextBox) - BoxHeight, Canvas.GetTop(Base_TextBox) + BoxWidth),
1311
                    new Point(Canvas.GetLeft(Base_TextBox) - BoxHeight, Canvas.GetTop(Base_TextBox)),
1312
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1313
                };
1314
                PathDataInner = (GenerateInner(pCloud));
1315
            }//20180906 LJY Textbox guide
1316
            else
1317
            { 
1318
                List<Point> pCloud = new List<Point>()
1319
                {
1320
    #if SILVERLIGHT
1321
		            new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1322
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight), //왼쪽 아래
1323
                    new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth, Canvas.GetTop(Base_TextBox) + BoxHeight),
1324
                    new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth, Canvas.GetTop(Base_TextBox)),
1325
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1326

    
1327
    #else
1328
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1329
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight), //왼쪽 아래
1330
                    new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth, Canvas.GetTop(Base_TextBox) + BoxHeight),
1331
                    new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth, Canvas.GetTop(Base_TextBox)),
1332
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1333

    
1334
                    //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1335
                    //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight-4), //왼쪽 아래
1336
                    //new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth-1, Canvas.GetTop(Base_TextBox) + BoxHeight-4),
1337
                    //new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth-1, Canvas.GetTop(Base_TextBox)),
1338
                    //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1339
    #endif
1340
                };
1341
                //instanceGroup.Children.Add(Generate(pCloud));
1342
                PathDataInner = (GenerateInner(pCloud));
1343
            }
1344
        }
1345

    
1346
        public override void UpdateControl()
1347
        {
1348
            this.StartPoint = new Point(this.PointSet[0].X, this.PointSet[0].Y);
1349
            this.MidPoint = new Point(this.PointSet[1].X, this.PointSet[1].Y);
1350
            this.EndPoint = new Point(this.PointSet[2].X, this.PointSet[2].Y);
1351
        }
1352

    
1353
        public override void ApplyOverViewData()
1354
        {
1355
            this.OverViewPathData = this.PathData;
1356
            if (ArrowText == "")
1357
                this.ArrowText = this.OverViewArrowText;
1358
            else
1359
                this.OverViewArrowText = this.ArrowText;
1360
            this.OverViewStartPoint = this.StartPoint;
1361
            this.OverViewEndPoint = this.EndPoint;
1362
        }
1363

    
1364
        #endregion
1365

    
1366
        public static PathFigure GenerateLineWithCloud(Point p1, Point p2, double arcLength_, bool reverse)
1367
        {
1368
            PathFigure pathFigure = new PathFigure();
1369
            pathFigure.StartPoint = p1;
1370

    
1371
            double arcLength = arcLength_;
1372
            /// draw arcs which has arcLength between p1 and p2 - 2012.06.21 added by humkyung 
1373
            double dx = p2.X - p1.X;
1374
            double dy = p2.Y - p1.Y;
1375
            double l = MathSet.DistanceTo(p1, p2); /// distance between p1 and p2
1376
            double theta = Math.Atan2(Math.Abs(dy), Math.Abs(dx)) * 180 / Math.PI;
1377
            Point lastPt = new Point(p1.X, p1.Y);
1378
            double count = l / arcLength;
1379
            /// normalize
1380
            dx /= l;
1381
            dy /= l;
1382
            Double j = 1;
1383
            for (j = 1; j < (count - 1); j++) 
1384
            {
1385
                ArcSegment arcSeg = new ArcSegment();
1386
                arcSeg.Size = new Size(arcLength * _CloudArcDepth, arcLength * _CloudArcDepth);						/// x size and y size of arc
1387
                arcSeg.Point = new Point(p1.X + j * dx * arcLength, p1.Y + j * dy * arcLength);	/// end point of arc
1388
                lastPt = arcSeg.Point;  /// save last point
1389
                arcSeg.RotationAngle = theta + 90;
1390
                if (true == reverse) arcSeg.SweepDirection = SweepDirection.Clockwise;
1391
                pathFigure.Segments.Add(arcSeg);
1392
            }
1393

    
1394
            /// draw arc between last point and end point
1395
            if ((count > j) || (count > 0))
1396
            {
1397
                arcLength = MathSet.DistanceTo(lastPt, p2);
1398
                ArcSegment arcSeg = new ArcSegment();
1399
                arcSeg.Size = new Size(arcLength * _CloudArcDepth, arcLength * _CloudArcDepth);	/// x size and y size of arc
1400
                arcSeg.Point = new Point(p2.X, p2.Y);						/// end point of arc
1401
                arcSeg.RotationAngle = theta;
1402
                if (true == reverse) arcSeg.SweepDirection = SweepDirection.Clockwise;
1403
                pathFigure.Segments.Add(arcSeg);
1404
            }
1405
            /// up to here
1406

    
1407
            return pathFigure;
1408
        }
1409

    
1410
        public static PathGeometry Generate(List<Point> pData)
1411
        {
1412
            var _pathGeometry = new PathGeometry();
1413
            
1414
            double area = MathSet.AreaOf(pData);
1415
            bool reverse = (area > 0);
1416
            int count = pData.Count;
1417
            for (int i = 0; i < (count - 1); i++)
1418
            {
1419
                PathFigure pathFigure = GenerateLineWithCloud(pData[i], pData[i + 1], 20, reverse);
1420
                pathFigure.IsClosed = false;
1421
                pathFigure.IsFilled = true;
1422
                _pathGeometry.Figures.Add(pathFigure);
1423
            }
1424
            
1425
            return _pathGeometry;
1426
        }
1427

    
1428
        
1429
        public static PathGeometry GenerateInner(List<Point> pData)
1430
        {
1431
            var _pathGeometry = new PathGeometry();
1432
            double area = MathSet.AreaOf(pData);
1433
            bool reverse = (area > 0);
1434
            int count = pData.Count;
1435

    
1436
            PathFigure pathFigur2 = new PathFigure();
1437
            pathFigur2.StartPoint = pData[0];
1438

    
1439
            LineSegment lineSegment0 = new LineSegment();
1440
            lineSegment0.Point = pData[0];
1441
            pathFigur2.Segments.Add(lineSegment0);
1442

    
1443
            LineSegment lineSegment1 = new LineSegment();
1444
            lineSegment1.Point = pData[1];
1445
            pathFigur2.Segments.Add(lineSegment1);
1446

    
1447
            LineSegment lineSegment2 = new LineSegment();
1448
            lineSegment2.Point = pData[2];
1449
            pathFigur2.Segments.Add(lineSegment2);
1450

    
1451
            LineSegment lineSegment3 = new LineSegment();
1452
            lineSegment3.Point = pData[3];
1453
            pathFigur2.Segments.Add(lineSegment3);
1454

    
1455

    
1456
            pathFigur2.IsClosed = true;
1457
            pathFigur2.IsFilled = true;
1458
            _pathGeometry.Figures.Add(pathFigur2);           
1459

    
1460
            return _pathGeometry;
1461
        }
1462

    
1463
        //20180910 LJY Cloud rotation 추가
1464
        public static PathGeometry GenerateInnerCloud(List<Point> pData, string angle)
1465
        {
1466
            var _pathGeometry = new PathGeometry();
1467
            double area = MathSet.AreaOf(pData);
1468
            bool reverse = (area > 0);
1469
            int count = pData.Count;
1470

    
1471
            PathFigure pathFigur2 = new PathFigure();
1472
            pathFigur2.StartPoint = pData[0];
1473

    
1474
            LineSegment lineSegment0 = new LineSegment();
1475
            lineSegment0.Point = pData[0];
1476
            pathFigur2.Segments.Add(lineSegment0);
1477

    
1478
            LineSegment lineSegment1 = new LineSegment();
1479
            lineSegment1.Point = pData[1];
1480
            pathFigur2.Segments.Add(lineSegment1);
1481

    
1482
            LineSegment lineSegment2 = new LineSegment();
1483
            lineSegment2.Point = pData[2];
1484
            pathFigur2.Segments.Add(lineSegment2);
1485

    
1486
            LineSegment lineSegment3 = new LineSegment();
1487
            lineSegment3.Point = pData[3];
1488
            pathFigur2.Segments.Add(lineSegment3);
1489
            
1490
            RotateTransform transform = new RotateTransform();
1491
            switch (angle)
1492
            {
1493
                case "90":
1494
                    transform.Angle = -90;
1495
                    break;
1496
                case "180":
1497
                    transform.Angle = -180;
1498
                    break;
1499
                case "270":
1500
                    transform.Angle = -270;
1501
                    break;
1502
            }
1503
            transform.CenterX = pData[0].X;
1504
            transform.CenterY = pData[0].Y;
1505
            _pathGeometry.Transform = transform;
1506

    
1507
            pathFigur2.IsClosed = true;
1508
            pathFigur2.IsFilled = true;
1509
            _pathGeometry.Figures.Add(pathFigur2);
1510

    
1511
            return _pathGeometry;
1512
        }
1513

    
1514
        /// <summary>
1515
        /// call when mouse is moving while drawing control
1516
        /// </summary>
1517
        /// <author>humkyung</author>
1518
        /// <param name="pt"></param>
1519
        /// <param name="bAxisLocked"></param>
1520
        public override void OnCreatingMouseMove(Point pt, bool bAxisLocked, bool bShiftKeyPressed)
1521
        {
1522
            this.EndPoint = pt;
1523

    
1524
            if (bAxisLocked || bShiftKeyPressed)
1525
            {
1526
                Point tempPoint = this.EndPoint;
1527
                string angle = MathSet.returnAngleString(this.StartPoint, ref tempPoint, true);
1528
                this.EndPoint = tempPoint;
1529
            }
1530

    
1531
            this.MidPoint = MathSet.getMiddlePoint(this.StartPoint, this.EndPoint);
1532
            this.isFixed = (this.ControlType == ControlType.ArrowTransTextControl) || 
1533
                (this.ControlType == ControlType.ArrowTransTextBorderControl) || (this.ControlType == ControlType.ArrowTransTextCloudControl);
1534

    
1535
            this.PointSet = new List<Point>
1536
            {
1537
                this.StartPoint,
1538
                this.MidPoint,
1539
                this.EndPoint,
1540
            };
1541
        }
1542

    
1543
        /// <summary>
1544
        /// move control point has same location of given pt along given delta
1545
        /// </summary>
1546
        /// <author>humkyung</author>
1547
        /// <date>2019.06.20</date>
1548
        /// <param name="pt"></param>
1549
        /// <param name="dx"></param>
1550
        /// <param name="dy"></param>
1551
        public override void OnMoveCtrlPoint(Point pt, double dx, double dy)
1552
        {
1553
            IPath path = (this as IPath);
1554

    
1555
            Point selected = MathSet.getNearPoint(path.PointSet, pt);
1556
            selected.X += dx;
1557
            selected.Y += dy;
1558
            int i = 0;
1559
            for (i = 0; i < (this as IPath).PointSet.Count; i++)
1560
            {
1561
                if (pt.Equals((this as IPath).PointSet[i])) break;
1562
            }
1563

    
1564
            List<Point> pts = path.PointSet;
1565
            if ((pts[0].X > pts[1].X && dx > 0) || (pts[0].X < pts[1].X && dx < 0))
1566
            {
1567
                pts[1] = new Point(pts[1].X + dx, pts[1].Y);
1568
            }
1569
            if ((pts[0].Y > pts[1].Y && dy > 0) || (pts[0].Y < pts[1].Y && dy < 0))
1570
            {
1571
                pts[1] = new Point(pts[1].X, pts[1].Y + dy);
1572
            }
1573
            path.PointSet[1] = pts[1];
1574
            path.PointSet[i] = selected;
1575

    
1576
            this.UpdateControl();
1577
        }
1578

    
1579
        /// <summary>
1580
        /// return ArrowTextControl's area
1581
        /// </summary>
1582
        /// <author>humkyung</author>
1583
        /// <date>2019.06.13</date>
1584
        public override Rect ItemRect
1585
        {
1586
            get
1587
            {
1588
                double dMinX = Math.Min(this.StartPoint.X, this.EndPoint.X);
1589
                double dMinY = Math.Min(this.StartPoint.Y, this.EndPoint.Y);
1590
                double dMaxX = Math.Max(this.StartPoint.X, this.EndPoint.X);
1591
                double dMaxY = Math.Max(this.StartPoint.Y, this.EndPoint.Y);
1592

    
1593
                return new Rect(new Point(dMinX, dMinY), new Point(dMaxX, dMaxY));
1594
            }
1595
        }
1596

    
1597
        /// <summary>
1598
        /// Serialize this
1599
        /// </summary>
1600
        /// <param name="sUserId"></param>
1601
        /// <returns></returns>
1602
        public override string Serialize()
1603
        {
1604
            using (S_ArrowTextControl STemp = new S_ArrowTextControl())
1605
            {
1606
                STemp.TransformPoint = "0|0";
1607
                STemp.PointSet = this.PointSet;
1608
                STemp.SizeSet = String.Format("{0}", this.LineSize);
1609
                STemp.StrokeColor = this.StrokeColor.Color.ToString();
1610
                STemp.StartPoint = this.StartPoint;
1611
                STemp.ArrowStyle = this.ArrowTextStyle;
1612
                //STemp.StrokeColor = "#FF00FF00";
1613
                STemp.UserID = this.UserID;
1614
                STemp.ArrowText = this.Base_TextBox.Text;
1615
                STemp.BorderSize = this.BorderSize;
1616
                STemp.isHighLight = this.isHighLight;
1617
                STemp.BoxHeight = this.BoxHeight;
1618
                STemp.BoxWidth = this.BoxWidth;
1619
                STemp.Opac = this.Opacity;
1620
                STemp.EndPoint = this.EndPoint;
1621
                STemp.isFixed = this.isFixed;
1622
                //STemp.DashSize = this.DashSize;
1623
                STemp.Name = this.GetType().Name.ToString();
1624
                STemp.isTrans = this.isTrans;
1625
                STemp.MidPoint = this.MidPoint;
1626
                STemp.Angle = this.Angle;
1627
                STemp.fontConfig = new List<string>()
1628
                            {
1629
                                this.TextFamily.ToString(),
1630
                                this.TextStyle.ToString(),
1631
                                this.TextWeight.ToString(),
1632
                                this.TextSize.ToString(),
1633
                            };
1634

    
1635
                if (this.UnderLine != null)
1636
                {
1637
                    STemp.fontConfig.Add("true");
1638
                }
1639

    
1640
                ///강인구 추가(2017.11.02)
1641
                ///Memo 추가
1642
                STemp.Memo = this.Memo;
1643
                STemp.BorderSize = this.BorderSize;
1644
                return "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize()));
1645
            };
1646
        }
1647

    
1648
        /// <summary>
1649
        /// create a arrowtextcontrol from given string
1650
        /// </summary>
1651
        /// <param name="str"></param>
1652
        /// <returns></returns>
1653
        public static ArrowTextControl FromString(string str, SolidColorBrush brush, string sProjectNo)
1654
        {
1655
            ArrowTextControl instance = null;
1656
            using (S_ArrowTextControl s = JsonSerializerHelper.JsonDeserialize<S_ArrowTextControl>(str))
1657
            {
1658
                string[] data2 = s.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
1659
                instance = new ArrowTextControl();
1660
                instance.LineSize = Convert.ToDouble(data2.First());
1661
                instance.PointSet = s.PointSet;
1662
                instance.StartPoint = s.StartPoint;
1663
                instance.EndPoint = s.EndPoint;
1664
                instance.StrokeColor = brush;
1665
                //instance.DashSize = s.DashSize;
1666
                instance.ArrowTextStyle = s.ArrowStyle;
1667
                instance.isHighLight = s.isHighLight;
1668
                instance.ArrowText = s.ArrowText;
1669
                instance.Opacity = s.Opac;
1670
                instance.BorderSize = s.BorderSize;
1671
                instance.BoxWidth = s.BoxWidth;
1672
                instance.BoxHeight = s.BoxHeight;
1673
                instance.isFixed = s.isFixed;
1674
                instance.Angle = s.Angle;
1675
                instance.UserID = s.UserID;
1676
                instance.isTrans = s.isTrans;
1677
                instance.MidPoint = s.MidPoint;
1678
                instance.Memo = s.Memo;
1679
                if (s.fontConfig == null || s.fontConfig.ToList().Count == 0)
1680
                {
1681
                    s.fontConfig = new List<string>();
1682

    
1683
                    s.fontConfig.Add("Arial");
1684
                    s.fontConfig.Add("Normal");
1685
                    s.fontConfig.Add("Normal");
1686
                    s.fontConfig.Add("30");
1687
                }
1688
                instance.TextFamily = new FontFamily(s.fontConfig[0]);
1689
                //인구 추가(2018.04.17)
1690
                instance.TextStyle = StringToFont.ConFontStyle(s.fontConfig[1]);
1691
                instance.TextWeight = StringToFont.ConFontWeight(s.fontConfig[2]);
1692
                instance.TextSize = Convert.ToDouble(s.fontConfig[3]);
1693

    
1694
                if (s.fontConfig.Count() == 5)
1695
                {
1696
                    instance.UnderLine = TextDecorations.Underline;
1697
                }
1698
            }
1699

    
1700
            return instance;
1701
        }
1702

    
1703
        #region Dispose
1704
        public void Dispose()
1705
        {
1706
            GC.Collect();
1707
            GC.SuppressFinalize(this);
1708
        } 
1709
        #endregion
1710

    
1711
        #region INotifyPropertyChanged
1712
        private void OnPropertyChanged(string name)
1713
        {
1714
            if (PropertyChanged != null)
1715
            {
1716
                PropertyChanged(this, new PropertyChangedEventArgs(name));
1717
            }
1718
        }
1719

    
1720
        public event PropertyChangedEventHandler PropertyChanged; 
1721
        #endregion
1722
    }
1723
}
클립보드 이미지 추가 (최대 크기: 500 MB)