프로젝트

일반

사용자정보

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

markus / MarkupToPDF / Controls / Text / ArrowTextControl.cs @ 3c71b3a5

이력 | 보기 | 이력해설 | 다운로드 (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
                BoxWidth = e.NewSize.Width;
130
                BoxHeight = e.NewSize.Height;               
131
                SetArrowTextPath();
132
            }           
133
        }
134

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

    
150

    
151
        #endregion
152

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

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

    
182

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

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

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

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

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

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

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

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

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

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

    
276

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

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

    
295

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
425
                OnPropertyChanged("OverViewPathData");
426

    
427
            }
428
        }
429

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

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

    
456
        public string OverViewArrowText
457
        {
458

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

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

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

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

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

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

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

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

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

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

    
577

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

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

    
594
        #endregion
595

    
596
        #region Dependency Properties
597

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
689

    
690

    
691
        //, new PropertyChangedCallback(TextChanged)
692

    
693

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

    
698

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

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

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

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

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

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

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

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

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

    
727
        #endregion
728

    
729
        #endregion
730

    
731
        #region CallBack Method
732

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

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

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

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

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

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

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

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

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

    
783

    
784

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

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

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

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

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

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

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

    
843
        #region Internal Method
844

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

    
851

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1073

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

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

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

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

    
1187
                    break;
1188
            }
1189

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

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

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

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

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

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

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

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

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

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

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

    
1282
        }
1283

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

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

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

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

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

    
1363
        #endregion
1364

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

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

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

    
1406
            return pathFigure;
1407
        }
1408

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

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

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

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

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

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

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

    
1454

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

    
1459
            return _pathGeometry;
1460
        }
1461

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

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

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

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

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

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

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

    
1510
            return _pathGeometry;
1511
        }
1512

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

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

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

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

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

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

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

    
1575
            this.UpdateControl();
1576
        }
1577

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

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

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

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

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

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

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

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

    
1699
            return instance;
1700
        }
1701

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

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

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