프로젝트

일반

사용자정보

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

markus / MarkupToPDF / Controls / Text / ArrowTextControl.cs @ 4913851c

이력 | 보기 | 이력해설 | 다운로드 (82.7 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
        
27
        public Path Base_ArrowPath = null;
28
        public Path Base_ArrowSubPath = null;
29
        public TextBox Base_TextBox = null;
30
        public TextBlock Base_TextBlock = null;
31

    
32
        private const double _CloudArcDepth = 0.8;  /// 2018.05.14 added by humkyung
33

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

    
41
        //안쓰고 있음
42
        //LineGeometry connectorMCEGeometry = new LineGeometry();
43

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

    
46
        #endregion
47

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

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

    
61
        public override void OnApplyTemplate()
62
        {
63
            base.OnApplyTemplate();
64
            Base_ArrowPath = GetTemplateChild(PART_ArrowPath) as Path;
65
            Base_ArrowSubPath = GetTemplateChild(PART_ArrowSubPath) as Path;
66
            Base_TextBox = GetTemplateChild(PART_TextBox) as TextBox;
67
            //Base_TextBlock = GetTemplateChild(PART_TextBlock) as TextBlock;
68

    
69
            //CustomText custom = new CustomText();
70
            //Base_TextBox.Template = custom.T_Box.Template;
71
            //Base_TextBox.Style = custom.T_Box.Style;
72
            ////Base_TextBox.Template = custom.T_Box.Template.Triggers;
73
            ////TextBoxBackground = Brushes.Red;
74
            ////Base_TextBox.Opacity = 0.5;
75

    
76
            Base_TextBox.SizeChanged += new SizeChangedEventHandler(Base_TextBox_SizeChanged);
77
            Base_TextBox.GotFocus += new RoutedEventHandler(Base_TextBox_GotFocus);
78
            Base_TextBox.LostFocus += new RoutedEventHandler(Base_TextBox_LostFocus);
79

    
80
            //Base_TextBlock.SizeChanged += Base_TextBlock_SizeChanged;
81
            SetArrowTextPath();
82
            //Base_ArrowPath.Focus();
83
            //Base_TextBox.Focus();
84
            Base_TextBox.IsTabStop = true;
85
            //Base_TextBox.IsHitTestVisible = false;
86

    
87
        }
88

    
89
        void Base_TextBox_LostFocus(object sender, RoutedEventArgs e)
90
        {
91
            this.ArrowText = Base_TextBox.Text;
92

    
93
            this.IsEditingMode = false;
94

    
95
            ApplyOverViewData();
96
        }
97

    
98
        void Base_TextBox_GotFocus(object sender, RoutedEventArgs e)
99
        {
100
          
101
            this.IsEditingMode = true;
102
        }
103

    
104
        void Base_TextBox_SizeChanged(object sender, SizeChangedEventArgs e)
105
        {
106
            if (Base_TextBox.Text.Contains("|OR||DZ|"))
107
            {
108
                Base_TextBox.Text = this.ArrowText;
109
            }
110

    
111
            this.ArrowText = Base_TextBox.Text;
112
            BoxWidth = e.NewSize.Width;
113
            BoxHeight = e.NewSize.Height;
114
            SetArrowTextPath();
115
        }
116

    
117
        //void Base_TextBlock_SizeChanged(object sender, SizeChangedEventArgs e)
118
        //{
119
        //    Base_TextBlock.Text = Base_TextBox.Text;
120

    
121
        //    BoxWidth = e.NewSize.Width;
122
        //    BoxHeight = e.NewSize.Height;
123

    
124
        //    this.ApplyTemplate();
125
        //    SetArrowTextPath();
126
        //}
127

    
128
        #region Properties
129
        private bool _IsEditingMode;
130
        public bool IsEditingMode
131
        {
132
            get
133
            {
134
                return _IsEditingMode;
135
            }
136
            set
137
            {
138
                _IsEditingMode = value;
139
                OnPropertyChanged("IsEditingMode");
140
            }
141
        }
142

    
143

    
144
        #endregion
145

    
146
        #region dp Properties
147
        //강인구 주석 풀기
148
        public Visibility TextBoxVisibility
149
        {
150
            get { return (Visibility)GetValue(TextBoxVisibilityProperty); }
151
            set
152
            {
153
                if (this.TextBoxVisibility != value)
154
                {
155
                    SetValue(TextBoxVisibilityProperty, value);
156
                    OnPropertyChanged("TextBoxVisibility");
157
                }
158
            }
159
        }
160

    
161
        //강인구 주석 풀기
162
        public Visibility TextBlockVisibility
163
        {
164
            get { return (Visibility)GetValue(TextBlockVisibilityProperty); }
165
            set
166
            {
167
                if (this.TextBlockVisibility != value)
168
                {
169
                    SetValue(TextBlockVisibilityProperty, value);
170
                    OnPropertyChanged("TextBlockVisibility");
171
                }
172
            }
173
        }
174

    
175

    
176
        public override SolidColorBrush StrokeColor
177
        {
178
            get { return (SolidColorBrush)GetValue(StrokeColorProperty); }
179
            set
180
            {
181
                if (this.StrokeColor != value)
182
                {
183
                    SetValue(StrokeColorProperty, value);
184
                }
185
            }
186
        }
187

    
188
        public PathGeometry SubPathData
189
        {
190
            get { return (PathGeometry)GetValue(SubPathDataProperty); }
191
            set
192
            {
193
                if (this.SubPathData != value)
194
                {
195
                    SetValue(SubPathDataProperty, value);
196
                }
197
            }
198
        }
199

    
200
        public string UserID
201
        {
202
            get { return (string)GetValue(UserIDProperty); }
203
            set
204
            {
205
                if (this.UserID != value)
206
                {
207
                    SetValue(UserIDProperty, value);
208
                    OnPropertyChanged("UserID");
209
                }
210
            }
211
        }
212

    
213
        public List<Point> PointSet
214
        {
215
            get { return (List<Point>)GetValue(PointSetProperty); }
216
            set { SetValue(PointSetProperty, value); }
217
        }
218

    
219
        public override bool IsSelected
220
        {
221
            get
222
            {
223
                return (bool)GetValue(IsSelectedProperty);
224
            }
225
            set
226
            {
227
                SetValue(IsSelectedProperty, value);
228
                OnPropertyChanged("IsSelected");
229
            }
230
        }
231

    
232
        public override ControlType ControlType
233
        {
234
            set
235
            {
236
                SetValue(ControlTypeProperty, value);
237
                OnPropertyChanged("ControlType");
238
            }
239
            get
240
            {
241
                return (ControlType)GetValue(ControlTypeProperty);
242
            }
243
        }
244

    
245
        public Point StartPoint
246
        {
247
            get { return (Point)GetValue(StartPointProperty); }
248
            set { SetValue(StartPointProperty, value); }
249
        }
250

    
251
        public Point EndPoint
252
        {
253
            get { return (Point)GetValue(EndPointProperty); }
254
            set { SetValue(EndPointProperty, value); }
255
        }
256

    
257
        public Point OverViewStartPoint
258
        {
259
            get { return (Point)GetValue(OverViewStartPointProperty); }
260
            set { SetValue(OverViewStartPointProperty, value); }
261
        }
262

    
263
        public Point OverViewEndPoint
264
        {
265
            get { return (Point)GetValue(OverViewEndPointProperty); }
266
            set { SetValue(OverViewEndPointProperty, value); }
267
        }
268

    
269

    
270
        public double Angle
271
        {
272
            get { return (double)GetValue(AngleProperty); }
273
            set { SetValue(AngleProperty, value); }
274
        }
275

    
276
        public Thickness BorderSize
277
        {
278
            get { return (Thickness)GetValue(BorderSizeProperty); }
279
            set
280
            {
281
                if (this.BorderSize != value)
282
                {
283
                    SetValue(BorderSizeProperty, value);
284
                }
285
            }
286
        }
287

    
288

    
289
        public Point MidPoint
290
        {
291
            get { return (Point)GetValue(MidPointProperty); }
292
            set { SetValue(MidPointProperty, value); }
293
        }
294

    
295
        public bool isFixed
296
        {
297
            get { return (bool)GetValue(IsFixedProperty); }
298
            set { SetValue(IsFixedProperty, value); }
299
        }
300

    
301
        public bool isTrans
302
        {
303
            get { return (bool)GetValue(TransformerProperty); }
304
            set { SetValue(TransformerProperty, value); }
305
        }
306

    
307
        public bool isHighLight
308
        {
309
            get { return (bool)GetValue(isHighlightProperty); }
310
            set
311
            {
312
                if (this.isHighLight != value)
313
                {
314
                    SetValue(isHighlightProperty, value);
315
                    OnPropertyChanged("isHighLight");
316
                }
317
            }
318
        }
319

    
320
        public FontWeight TextWeight
321
        {
322
            get { return (FontWeight)GetValue(TextWeightProperty); }
323
            set
324
            {
325
                if (this.TextWeight != value)
326
                {
327
                    SetValue(TextWeightProperty, value);
328
                    OnPropertyChanged("TextWeight");
329
                }
330
            }
331
        }
332

    
333
        public Double LineSize
334
        {
335
            get { return (Double)GetValue(LineSizeProperty); }
336
            set
337
            {
338
                if (this.LineSize != value)
339
                {
340
                    SetValue(LineSizeProperty, value);
341
                }
342
            }
343
        }
344

    
345
        public Double BoxWidth
346
        {
347
            get { return (Double)GetValue(BoxWidthProperty); }
348
            set
349
            {
350
                if (this.BoxWidth != value)
351
                {
352
                    SetValue(BoxWidthProperty, value);
353
                }
354
            }
355
        }
356

    
357
        public Double BoxHeight
358
        {
359
            get { return (Double)GetValue(BoxHeightProperty); }
360
            set
361
            {
362
                if (this.BoxHeight != value)
363
                {
364
                    SetValue(BoxHeightProperty, value);
365
                }
366
            }
367
        }
368

    
369
        public ArrowTextStyleSet ArrowTextStyle
370
        {
371
            get { return (ArrowTextStyleSet)GetValue(ArrowTextStyleProperty); }
372
            set
373
            {
374
                if (this.ArrowTextStyle != value)
375
                {
376
                    SetValue(ArrowTextStyleProperty, value);
377
                }
378
            }
379
        }
380

    
381
        public Geometry PathData
382
        {
383
            get { return (Geometry)GetValue(PathDataProperty); }
384
            set { SetValue(PathDataProperty, value);
385

    
386
                OnPropertyChanged("PathData");
387
            }
388
        }
389

    
390
        public SolidColorBrush BackInnerColor
391
        {
392
            get { return (SolidColorBrush)GetValue(BackInnerColorProperty); }
393
            set
394
            {
395
                if (this.BackInnerColor != value)
396
                {
397
                    SetValue(BackInnerColorProperty, value);
398
                    OnPropertyChanged("BackInnerColor");
399
                }
400
            }
401
        }
402

    
403
        public Geometry PathDataInner
404
        {
405
            get { return (Geometry)GetValue(PathDataInnerProperty); }
406
            set
407
            {
408
                SetValue(PathDataInnerProperty, value);
409
                OnPropertyChanged("PathDataInner");
410
            }
411
        }
412

    
413
        public Geometry OverViewPathData
414
        {
415
            get { return (Geometry)GetValue(OverViewPathDataProperty); }
416
            set { SetValue(OverViewPathDataProperty, value);
417

    
418
                OnPropertyChanged("OverViewPathData");
419

    
420
            }
421
        }
422

    
423
        public FontFamily TextFamily
424
        {
425
            get { return (FontFamily)GetValue(TextFamilyProperty); }
426
            set
427
            {
428
                if (this.TextFamily != value)
429
                {
430
                    SetValue(TextFamilyProperty, value);
431
                    OnPropertyChanged("TextFamily");
432
                }
433
            }
434
        }
435

    
436
        public string ArrowText
437
        {
438
            get { return (string)GetValue(ArrowTextProperty); }
439
            set
440
            {
441
                if (this.ArrowText != value)
442
                {
443
                    SetValue(ArrowTextProperty, value);
444
                    OnPropertyChanged("ArrowText");
445
                }
446
            }
447
        }
448

    
449
        public string OverViewArrowText
450
        {
451

    
452
            get { return (string)GetValue(OverViewArrowTextProperty);
453
            }
454
            set
455
            {
456
                if (this.OverViewArrowText != value)
457
                {
458
                    SetValue(OverViewArrowTextProperty, value);
459
                    OnPropertyChanged("OverViewArrowText");
460
                }
461
            }
462
        }
463

    
464
        public Double TextSize
465
        {
466
            get { return (Double)GetValue(TextSizeProperty); }
467
            set
468
            {
469
                if (this.TextSize != value)
470
                {
471
                    SetValue(TextSizeProperty, value);
472
                    OnPropertyChanged("TextSize");
473
                }
474
            }
475
        }
476

    
477
        public FontStyle TextStyle
478
        {
479
            get { return (FontStyle)GetValue(TextStyleProperty); }
480
            set
481
            {
482
                if (this.TextStyle != value)
483
                {
484
                    SetValue(TextStyleProperty, value);
485
                    OnPropertyChanged("TextStyle");
486
                }
487
            }
488
        }
489

    
490
        //강인구 추가
491
        public TextDecorationCollection UnderLine
492
        {
493
            get
494
            {
495
                return (TextDecorationCollection)GetValue(UnderLineProperty);
496
            }
497
            set
498
            {
499
                if (this.UnderLine != value)
500
                {
501
                    SetValue(UnderLineProperty, value);
502
                    OnPropertyChanged("UnderLine");
503
                }
504
            }
505
        }
506

    
507
        public double CanvasX
508
        {
509
            get { return (double)GetValue(CanvasXProperty); }
510
            set
511
            {
512
                if (this.CanvasX != value)
513
                {
514
                    SetValue(CanvasXProperty, value);
515
                    OnPropertyChanged("CanvasX");
516
                }
517
            }
518
        }
519

    
520
        public double CanvasY
521
        {
522
            get { return (double)GetValue(CanvasYProperty); }
523
            set
524
            {
525
                if (this.CanvasY != value)
526
                {
527
                    SetValue(CanvasYProperty, value);
528
                    OnPropertyChanged("CanvasY");
529
                }
530
            }
531
        } 
532

    
533
        public double CenterX
534
        {
535
            get { return (double)GetValue(CenterXProperty); }
536
            set { SetValue(CenterXProperty, value);
537
            OnPropertyChanged("CenterX");
538
            
539
            }
540
        }
541

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

    
550
        public Brush SubPathFill
551
        {
552
            get { return (Brush)GetValue(SubPathFillProperty); }
553
            set
554
            {
555
                SetValue(SubPathFillProperty, value);
556
                OnPropertyChanged("SubPathFill");
557
            }
558
        }
559

    
560
        public Brush TextBoxBackground
561
        {
562
            get { return (Brush)GetValue(TextBoxBackgroundProperty); }
563
            set
564
            {
565
                SetValue(TextBoxBackgroundProperty, value);
566
                OnPropertyChanged("TextBoxBackground");
567
            }
568
        }
569

    
570

    
571
        //강인구 추가 주석풀기
572
        public bool IsEditing
573
        {
574
            get { return (bool)GetValue(IsEditingProperty); }
575
            set
576
            {
577
                if (this.IsEditing != value)
578
                {
579
                    SetValue(IsEditingProperty, value);
580

    
581
                    OnPropertyChanged("IsEditing");
582

    
583
                }
584
            }
585
        }
586

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

    
600
        #endregion
601

    
602
        #region Dependency Properties
603

    
604
        public static readonly DependencyProperty BoxWidthProperty = DependencyProperty.Register(
605
                "BoxWidth", typeof(double), typeof(ArrowTextControl), new PropertyMetadata((Double)20));
606

    
607
        public static readonly DependencyProperty BoxHeightProperty = DependencyProperty.Register(
608
                "BoxHeight", typeof(double), typeof(ArrowTextControl), new PropertyMetadata((Double)20));
609

    
610
        public static readonly DependencyProperty UserIDProperty = DependencyProperty.Register(
611
                "UserID", typeof(string), typeof(ArrowTextControl), new PropertyMetadata(null));
612

    
613
        public static readonly DependencyProperty ArrowTextStyleProperty = DependencyProperty.Register(
614
               "ArrowTextStyle", typeof(ArrowTextStyleSet), typeof(ArrowTextControl), new PropertyMetadata(ArrowTextStyleSet.Normal));
615

    
616
        public static readonly DependencyProperty CenterXProperty = DependencyProperty.Register(
617
                "CenterX", typeof(double), typeof(ArrowTextControl), new PropertyMetadata((double)0, OnCenterXYChanged));
618

    
619
        public static readonly DependencyProperty CenterYProperty = DependencyProperty.Register(
620
                "CenterY", typeof(double), typeof(ArrowTextControl), new PropertyMetadata((double)0, OnCenterXYChanged));
621

    
622
        public static readonly DependencyProperty AngleProperty = DependencyProperty.Register(
623
                "Angle", typeof(double), typeof(ArrowTextControl), new PropertyMetadata((double)0.0, new PropertyChangedCallback(PointValueChanged)));
624
        
625
        public static readonly DependencyProperty CanvasXProperty = DependencyProperty.Register(
626
                "CanvasX", typeof(double), typeof(ArrowTextControl), new PropertyMetadata((double)0, OnSetCansvasChanged));
627

    
628
        public static readonly DependencyProperty CanvasYProperty = DependencyProperty.Register(
629
                "CanvasY", typeof(double), typeof(ArrowTextControl), new PropertyMetadata((double)0, OnSetCansvasChanged));
630

    
631
        public static readonly DependencyProperty PointSetProperty = DependencyProperty.Register(
632
                "PointSet", typeof(List<Point>), typeof(ArrowTextControl), new PropertyMetadata(new List<Point>(), PointValueChanged));
633

    
634
        public static readonly DependencyProperty TextFamilyProperty = DependencyProperty.Register(
635
                "TextFamily", typeof(FontFamily), typeof(ArrowTextControl), new PropertyMetadata(new FontFamily("Arial"), TextChanged));
636

    
637
        public static readonly DependencyProperty PathDataProperty = DependencyProperty.Register(
638
                "PathData", typeof(Geometry), typeof(ArrowTextControl), null);
639

    
640
        //강인구 추가
641
        public static readonly DependencyProperty UnderLineProperty = DependencyProperty.Register(
642
    "UnderLine", typeof(TextDecorationCollection), typeof(ArrowTextControl), new PropertyMetadata(null, PointValueChanged));
643

    
644
        public static readonly DependencyProperty LineSizeProperty = DependencyProperty.Register(
645
               "LineSize", typeof(double), typeof(ArrowTextControl), new PropertyMetadata((Double)3, PointValueChanged));
646

    
647
        public static readonly DependencyProperty TextStyleProperty = DependencyProperty.Register(
648
                "TextStyle", typeof(FontStyle), typeof(ArrowTextControl), new PropertyMetadata(FontStyles.Normal));
649

    
650
        public static readonly DependencyProperty TextSizeProperty = DependencyProperty.Register(
651
                "TextSize", typeof(Double), typeof(ArrowTextControl), new PropertyMetadata((Double)30, PointValueChanged));
652

    
653
        public static readonly DependencyProperty TextWeightProperty = DependencyProperty.Register(
654
                "TextWeight", typeof(FontWeight), typeof(ArrowTextControl), new PropertyMetadata(FontWeights.Normal));
655

    
656
        public static readonly DependencyProperty IsFixedProperty = DependencyProperty.Register(
657
                "isFixed", typeof(bool), typeof(ArrowTextControl), new PropertyMetadata(false, PointValueChanged));
658

    
659
        public static readonly DependencyProperty IsSelectedProperty = DependencyProperty.Register(
660
                "IsSelected", typeof(bool), typeof(ArrowTextControl), new FrameworkPropertyMetadata(false, IsSelectedChanged));
661

    
662
        public static readonly DependencyProperty StrokeColorProperty = DependencyProperty.Register(
663
                "StrokeColor", typeof(SolidColorBrush), typeof(ArrowTextControl), new PropertyMetadata(new SolidColorBrush(Colors.Red)));
664

    
665
        public static readonly DependencyProperty ControlTypeProperty = DependencyProperty.Register(
666
                "ControlType", typeof(ControlType), typeof(ArrowTextControl), new FrameworkPropertyMetadata(ControlType.ArrowTextControl));
667

    
668
        public static readonly DependencyProperty StartPointProperty = DependencyProperty.Register(
669
                "StartPoint", typeof(Point), typeof(ArrowTextControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
670

    
671
        public static readonly DependencyProperty EndPointProperty = DependencyProperty.Register(
672
                "EndPoint", typeof(Point), typeof(ArrowTextControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
673

    
674
        public static readonly DependencyProperty BackInnerColorProperty = DependencyProperty.Register(
675
            "BackInnerColor", typeof(SolidColorBrush), typeof(ArrowTextControl), new PropertyMetadata(new SolidColorBrush(Colors.White)));
676

    
677
        public static readonly DependencyProperty PathDataInnerProperty = DependencyProperty.Register(
678
    "PathDataInner", typeof(Geometry), typeof(ArrowTextControl), null);
679

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

    
683
        public static readonly DependencyProperty MidPointProperty = DependencyProperty.Register(
684
                "MidPoint", typeof(Point), typeof(ArrowTextControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
685

    
686
        public static readonly DependencyProperty TransformerProperty = DependencyProperty.Register(
687
                "isTrans", typeof(bool), typeof(ArrowTextControl), new PropertyMetadata(false, PointValueChanged));
688

    
689
        public static readonly DependencyProperty BorderSizeProperty = DependencyProperty.Register(
690
                "BorderSize", typeof(Thickness), typeof(ArrowTextControl), new PropertyMetadata(new Thickness(0), PointValueChanged));
691
    
692
        public static readonly DependencyProperty ArrowTextProperty = DependencyProperty.Register(
693
              "ArrowText", typeof(string), typeof(ArrowTextControl), new PropertyMetadata(null));
694

    
695

    
696

    
697
        //, new PropertyChangedCallback(TextChanged)
698

    
699

    
700
        #region 추가 사항
701
        public static readonly DependencyProperty SubPathDataProperty = DependencyProperty.Register(
702
                "SubPathData", typeof(Geometry), typeof(ArrowTextControl), null);
703

    
704

    
705
        public static readonly DependencyProperty SubPathFillProperty = DependencyProperty.Register(
706
                "SubPathFill", typeof(Brush), typeof(ArrowTextControl), new PropertyMetadata(null));
707

    
708
        public static readonly DependencyProperty TextBoxBackgroundProperty = DependencyProperty.Register(
709
                "TextBoxBackground", typeof(Brush), typeof(ArrowTextControl), new PropertyMetadata(Brushes.White));
710

    
711
        public static readonly DependencyProperty OverViewArrowTextProperty = DependencyProperty.Register(
712
                "OverViewArrowText", typeof(string), typeof(ArrowTextControl), new PropertyMetadata(null, new PropertyChangedCallback(TextChanged)));
713

    
714
        public static readonly DependencyProperty OverViewPathDataProperty = DependencyProperty.Register(
715
                "OverViewPathData", typeof(Geometry), typeof(ArrowTextControl), null);
716

    
717
        public static readonly DependencyProperty OverViewStartPointProperty = DependencyProperty.Register(
718
                "OverViewStartPoint", typeof(Point), typeof(ArrowTextControl), new PropertyMetadata(null));
719

    
720
        public static readonly DependencyProperty OverViewEndPointProperty = DependencyProperty.Register(
721
                "OverViewEndPoint", typeof(Point), typeof(ArrowTextControl), new PropertyMetadata(null));
722

    
723
        public static readonly DependencyProperty TextBoxVisibilityProperty = DependencyProperty.Register(
724
            "TextBoxVisibility", typeof(Visibility), typeof(ArrowTextControl), new PropertyMetadata((Visibility.Visible), OnTextBoxVisibilityChanged));
725

    
726
        //강인구 추가(주석풀기)
727
        public static readonly DependencyProperty TextBlockVisibilityProperty = DependencyProperty.Register(
728
            "TextBlockVisibility", typeof(Visibility), typeof(ArrowTextControl), new PropertyMetadata((Visibility.Collapsed), OnTextBlockVisibilityChanged));
729

    
730
        public static readonly DependencyProperty IsEditingProperty = DependencyProperty.Register(
731
            "IsEditing", typeof(bool), typeof(ArrowTextControl), new PropertyMetadata((false), new PropertyChangedCallback(OnIsEditingChanged)));
732

    
733
        public static readonly DependencyProperty EnableEditingProperty = DependencyProperty.Register(
734
           "EnableEditing", typeof(bool), typeof(ArrowTextControl), new PropertyMetadata((true)));
735

    
736
        #endregion
737

    
738
        #endregion
739

    
740
        #region CallBack Method
741

    
742
        //강인구 추가(주석풀기)
743
        public static void OnIsEditingChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
744
        {
745
            var instance = (ArrowTextControl)sender;
746

    
747
            if (e.OldValue != e.NewValue && instance.Base_TextBlock != null)
748
            {
749
                instance.SetValue(e.Property, e.NewValue);
750

    
751
                if (instance.EnableEditing)
752
                {
753
                    if (instance.IsEditing)
754
                    {
755
                        instance.EditingMode();
756
                    }
757
                    else
758
                    {
759
                        instance.UnEditingMode();
760
                    }
761
                }
762
                else
763
                {
764
                    instance.UnEditingMode();
765
                }
766
            }
767
        }
768

    
769
        public static void OnTextBoxVisibilityChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
770
        {
771
            var instance = (ArrowTextControl)sender;
772

    
773
            if (e.OldValue != e.NewValue && instance.Base_ArrowPath != null)
774
            {
775
                instance.SetValue(e.Property, e.NewValue);
776
            }
777
        }
778

    
779
        public static void OnTextBlockVisibilityChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
780
        {
781
            var instance = (ArrowTextControl)sender;
782

    
783
            if (e.OldValue != e.NewValue && instance.Base_ArrowPath != null)
784
            {
785
                instance.SetValue(e.Property, e.NewValue);
786
            }
787
        }
788

    
789
        public static void PointValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
790
        {
791
            var instance = (ArrowTextControl)sender;
792

    
793
            if (e.OldValue != e.NewValue && instance.Base_ArrowPath != null)
794
            {
795
                instance.SetArrowTextPath();
796
            }
797
        }
798

    
799

    
800

    
801
        public static void TextChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
802
        {
803
            var instance = (ArrowTextControl)sender;
804
            
805
            if (e.OldValue != e.NewValue)
806
            {
807
                instance.SetValue(e.Property, e.NewValue);
808
                //instance.BoxWidth = instance.Base_TextBox.ActualWidth;
809
                //instance.BoxHeight = instance.Base_TextBox.ActualHeight;
810
            }
811
        }
812

    
813
        public static void OnCenterXYChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
814
        {
815
            var instance = (ArrowTextControl)sender;
816
            if (e.OldValue != e.NewValue && instance.Base_ArrowPath != null)
817
            {
818
                instance.SetValue(e.Property, e.NewValue);
819
                instance.SetArrowTextPath();
820
            }
821
        }
822

    
823
        public static void OnSetCansvasChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
824
        {
825
            var instance = (ArrowTextControl)sender;
826

    
827
            if (e.OldValue != e.NewValue && instance != null)
828
            {
829
                instance.SetValue(e.Property, e.NewValue);
830
                //Canvas.SetLeft(instance, instance.CanvasX);
831
                //Canvas.SetTop(instance, instance.CanvasY);
832
            }
833
        }
834

    
835
        public static void IsSelectedChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
836
        {
837
            //var instance = (ArrowTextControl)sender;
838

    
839
            //if (e.OldValue != e.NewValue)
840
            //{
841
            //    instance.SetValue(e.Property, e.NewValue);
842

    
843
            //    if (instance.IsSelected && instance.Base_TextBox != null)
844
            //    {
845
            //        instance.BorderSize = new Thickness(1);
846
            //        //instance.Base_TextBox.BorderBrush = new SolidColorBrush(Colors.Blue);
847
            //        //instance.Base_ArrowPath.Stroke = new SolidColorBrush(Colors.Blue);
848
            //    }
849
            //    else
850
            //    {
851
            //        instance.BorderSize = new Thickness(0);
852
            //        //instance.Base_TextBox.BorderBrush = new SolidColorBrush(Colors.Transparent);
853
            //        //instance.Base_ArrowPath.Stroke = new SolidColorBrush(Colors.Transparent);
854
            //    }
855
            //}
856
        }
857
        #endregion
858

    
859
        #region Internal Method
860

    
861
        //강인구 주석 풀기
862
        public void EditingMode()
863
        {
864
            TextBoxVisibility = Visibility.Visible;
865
            TextBlockVisibility = Visibility.Collapsed;
866

    
867

    
868
            //강인구 언더라인 추가
869
            if (UnderLine != null)
870
                Base_TextBlock.TextDecorations = UnderLine;
871
        }
872
        //강인구 주석 풀기
873
        public void UnEditingMode()
874
        {
875

    
876
            TextBoxVisibility = Visibility.Collapsed;
877
            TextBlockVisibility = Visibility.Visible;
878

    
879
            if (UnderLine != null)
880
                Base_TextBlock.TextDecorations = UnderLine;
881

    
882
            Base_TextBlock.Margin =
883
                 new Thickness(Base_TextBox.Margin.Left + 4, Base_TextBox.Margin.Top + 4,
884
                     Base_TextBox.Margin.Right + 4, Base_TextBox.Margin.Bottom + 4);
885
        }
886

    
887

    
888
        #region 주석
889

    
890
        //        public void SetArrowTextPath()
891
        //        {
892
        //            instanceGroup.Children.Clear();
893

    
894
        //            instanceSubGroup = new PathGeometry();
895
        //            connectorSMGeometry.StartPoint = this.StartPoint;
896
        //            connectorSMGeometry.EndPoint = this.MidPoint;
897
        //            connectorMEGeometry.StartPoint = this.MidPoint; //핵심
898

    
899
        //            //Canvas.SetLeft(Base_TextBox, this.EndPoint.X - BoxWidth / 2);
900
        //            //Canvas.SetTop(Base_TextBox, this.EndPoint.Y - BoxHeight / 2);
901

    
902
        //            Canvas.SetLeft(Base_TextBox, this.EndPoint.X);
903
        //            Canvas.SetTop(Base_TextBox, this.EndPoint.Y);
904

    
905

    
906

    
907
        //            List<Point> ps = new List<Point>();
908
        //            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth / 2, Canvas.GetTop(Base_TextBox))); //상단
909

    
910
        //            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth / 2, Canvas.GetTop(Base_TextBox) + this.BoxHeight)); // 하단
911

    
912
        //            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxHeight / 2)); //좌단
913

    
914
        //            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth, Canvas.GetTop(Base_TextBox) + this.BoxHeight / 2));  //우단
915

    
916
        //            //ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth, Canvas.GetTop(Base_TextBox)));
917
        //            //ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)));
918
        //            //ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxHeight));
919
        //            //ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth, Canvas.GetTop(Base_TextBox) + this.BoxHeight));
920

    
921
        //            if (isTrans)
922
        //            {
923
        //                switch (Math.Abs(this.Angle).ToString())
924
        //                {
925
        //                    case "90":
926
        //                        {
927
        //                            ps.Clear();
928
        //                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽
929
        //                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth / 2)); // 위 중간
930
        //                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth)); // 위 오른쪽
931

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

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

    
938
        //                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) - this.BoxWidth)); //오른쪽 중간
939
        //                        }
940
        //                        break;
941
        //                    case "270":
942
        //                        {
943
        //                            ps.Clear();
944
        //                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽
945
        //                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth / 2)); // 위 중간
946
        //                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth)); // 위 오른쪽
947

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

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

    
954
        //                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) + this.BoxWidth)); //오른쪽 중간
955
        //                        }
956
        //                        break;
957
        //                    default:
958
        //                        break;
959
        //                }
960
        //                var endP = MathSet.getNearPoint(ps, this.MidPoint);
961

    
962
        //                connectorMEGeometry.EndPoint = endP;
963
        //                instanceGroup.Children.Add(SingleAllow(this.MidPoint, this.StartPoint, this.LineSize));
964
        //            }
965
        //            else
966
        //            {
967
        //                switch (Math.Abs(this.Angle).ToString())
968
        //                {
969
        //                    case "90":
970
        //                        {
971
        //                            ps.Clear();
972
        //                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽
973
        //                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth / 2)); // 위 중간
974
        //                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth)); // 위 오른쪽
975

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

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

    
982
        //                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) - this.BoxWidth)); //오른쪽 중간
983
        //                        }
984
        //                        break;
985
        //                    case "270":
986
        //                        {
987
        //                            ps.Clear();
988
        //                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽
989
        //                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth / 2)); // 위 중간
990
        //                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth)); // 위 오른쪽
991

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

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

    
998
        //                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) + this.BoxWidth)); //오른쪽 중간
999
        //                        }
1000
        //                        break;
1001
        //                    default:
1002
        //                        break;
1003
        //                }
1004

    
1005
        //                var endP = MathSet.getNearPoint(ps, this.MidPoint);
1006
        //                connectorMEGeometry.EndPoint = endP; //최상단
1007

    
1008
        //                #region 보정치
1009

    
1010

    
1011
        //                //enP는 그 점
1012

    
1013
        //                //Point testP = new Point(endP.X-100,endP.Y);
1014
        //                Point testP = endP;
1015

    
1016
        //                if (isFixed)
1017
        //                {
1018
        //                    if (ps[0] == endP) //상단
1019
        //                    {
1020
        //                        testP = new Point(endP.X, endP.Y - 50);
1021
        //                        System.Diagnostics.Debug.WriteLine("상단");
1022
        //                    }
1023
        //                    else if (ps[1] == endP) //하단
1024
        //                    {
1025
        //                        testP = new Point(endP.X, endP.Y + 50);
1026
        //                        System.Diagnostics.Debug.WriteLine("하단");
1027
        //                    }
1028
        //                    else if (ps[2] == endP) //좌단
1029
        //                    {
1030
        //                        testP = new Point(endP.X - 50, endP.Y);
1031
        //                        System.Diagnostics.Debug.WriteLine("좌단");
1032
        //                    }
1033
        //                    else if (ps[3] == endP) //우단
1034
        //                    {
1035
        //                        testP = new Point(endP.X + 50, endP.Y);
1036
        //                        System.Diagnostics.Debug.WriteLine("우단");
1037
        //                    }
1038
        //                }
1039
        //                connectorSMGeometry.EndPoint = testP;
1040
        //                connectorMEGeometry.StartPoint = testP;
1041

    
1042
        //                //connectorSMGeometry.EndPoint = endP;
1043
        //                //connectorMEGeometry.StartPoint = endP;
1044
        //                instanceGroup.Children.Add(SingleAllow(testP, this.StartPoint, this.LineSize));
1045
        //                #endregion
1046
        //            }
1047

    
1048
        //            switch (this.ArrowTextStyle)
1049
        //            {
1050
        //                case ArrowTextStyleSet.Normal:
1051
        //                    this.BorderSize = new Thickness(0);
1052
        //                    break;
1053
        //                case ArrowTextStyleSet.Cloud:
1054
        //                    this.BorderSize = new Thickness(0);
1055
        //                    DrawingCloud();
1056
        //                    break;
1057
        //                default:
1058
        //                    this.BorderSize = new Thickness(3);
1059
        //                    break;
1060
        //            }
1061

    
1062
        //            if (isHighLight)
1063
        //            {
1064
        //                Base_TextBox.Background = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B));
1065
        //                Base_ArrowSubPath.Fill = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B));
1066

    
1067
        //            }
1068
        //            else
1069
        //            {
1070
        //                //Base_ArrowSubPath.Fill = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1071
        //                //Base_TextBox.Background = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1072
        //            }
1073

    
1074
        //            instanceGroup.Children.Add(connectorSMGeometry);
1075
        //            instanceGroup.Children.Add(connectorMEGeometry);
1076

    
1077
        //            this.Base_ArrowPath.Stroke = this.StrokeColor;
1078
        //            this.PathData = instanceGroup;
1079

    
1080
        //            Base_ArrowSubPath.Data = instanceSubGroup;
1081

    
1082
        //            var tempAngle = Math.Abs(this.Angle);
1083

    
1084
        //            if (tempAngle == Convert.ToDouble(90) || tempAngle == Convert.ToDouble(270))
1085
        //            {
1086
        //                this.RenderTransformOrigin = new Point(0.5, 0.5);
1087
        //                this.Base_ArrowPath.RenderTransformOrigin = new Point(0, 0);
1088
        //                this.Base_ArrowSubPath.RenderTransformOrigin = new Point(0, 0);
1089

    
1090
        //                Base_TextBox.RenderTransformOrigin = new Point(0, 0);
1091
        //            }
1092

    
1093
        //            Base_ArrowSubPath.RenderTransform = new RotateTransform
1094
        //            {
1095
        //                Angle = this.Angle,
1096
        //                CenterX = this.EndPoint.X,
1097
        //                CenterY = this.EndPoint.Y,
1098
        //            };
1099
        //        }
1100

    
1101
        //        public void updateControl()
1102
        //        {
1103
        //            this.StartPoint = new Point(this.PointSet[0].X, this.PointSet[0].Y);
1104
        //            this.MidPoint = new Point(this.PointSet[1].X, this.PointSet[1].Y);
1105
        //            this.EndPoint = new Point(this.PointSet[2].X, this.PointSet[2].Y);
1106
        //            //isTrans = true;
1107
        //        }
1108

    
1109
        //        private void DrawingCloud()
1110
        //        {
1111
        //            List<Point> pCloud = new List<Point>()
1112
        //            {
1113
        //#if SILVERLIGHT
1114
        //                new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1115
        //                new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight), //왼쪽 아래
1116
        //                new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth, Canvas.GetTop(Base_TextBox) + BoxHeight),
1117
        //                new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth, Canvas.GetTop(Base_TextBox)),
1118
        //                new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1119
        //#else
1120
        //                new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1121
        //                new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight), //왼쪽 아래
1122
        //                new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth, Canvas.GetTop(Base_TextBox) + BoxHeight),
1123
        //                new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth, Canvas.GetTop(Base_TextBox)),
1124
        //                new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1125

    
1126
        //                //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1127
        //                //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight-4), //왼쪽 아래
1128
        //                //new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth-1, Canvas.GetTop(Base_TextBox) + BoxHeight-4),
1129
        //                //new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth-1, Canvas.GetTop(Base_TextBox)),
1130
        //                //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1131
        //#endif
1132
        //            };
1133
        //            //instanceGroup.Children.Add(Generate(pCloud));
1134
        //            instanceSubGroup = (Generate(pCloud));
1135

    
1136
        //        } 
1137

    
1138
        #endregion
1139

    
1140
        private void SetArrowTextPath()
1141
        {
1142
            instanceGroup.Children.Clear();
1143

    
1144
            connectorSMGeometry.StartPoint = this.StartPoint;
1145
            connectorSMGeometry.EndPoint = this.MidPoint;
1146
            connectorMEGeometry.StartPoint = this.MidPoint; //핵심
1147

    
1148
            Canvas.SetLeft(Base_TextBox, this.EndPoint.X);
1149
            Canvas.SetTop(Base_TextBox, this.EndPoint.Y);
1150
             
1151
            List<Point> ps = new List<Point>();
1152
            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth / 2, Canvas.GetTop(Base_TextBox))); //상단
1153
            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth / 2, Canvas.GetTop(Base_TextBox) + this.BoxHeight)); // 하단
1154
            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxHeight / 2)); //좌단
1155
            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth, Canvas.GetTop(Base_TextBox) + this.BoxHeight / 2));  //우단
1156

    
1157
            if (isTrans)
1158
            {
1159
                switch (Math.Abs(this.Angle).ToString())
1160
                {
1161
                    case "90":
1162
                        {
1163
                            ps.Clear();
1164
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽
1165
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth / 2)); // 위 중간
1166
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth)); // 위 오른쪽
1167

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

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

    
1174
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) - this.BoxWidth)); //오른쪽 중간
1175
                        }
1176
                        break;
1177
                    case "270":
1178
                        {
1179

    
1180
                            ps.Clear();
1181
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽
1182
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth / 2)); // 위 중간
1183
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth)); // 위 오른쪽
1184

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

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

    
1191
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) + this.BoxWidth)); //오른쪽 중간
1192
                        }
1193
                        break;
1194
                    default:
1195
                        break;
1196
                }
1197
                
1198
                var endP = MathSet.getNearPoint(ps, this.MidPoint);
1199

    
1200
                //20180911 LJY 꺾이는 부분 수정
1201
                Point testP = endP;                
1202
                switch (Math.Abs(this.Angle).ToString())
1203
                {
1204
                    case "90":
1205
                        testP = new Point(endP.X + 50, endP.Y);
1206
                        break;
1207
                    case "270":
1208
                        testP = new Point(endP.X - 50, endP.Y);
1209
                        break;
1210
                }                
1211

    
1212
                //20180910 LJY 각도에 따라.
1213
                switch (Math.Abs(this.Angle).ToString())
1214
                {
1215
                    case "90":
1216
                        if (isFixed)
1217
                        {
1218
                            if (ps[0] == endP) //상단
1219
                            {
1220
                                testP = new Point(endP.X , endP.Y + 50);
1221
                                //System.Diagnostics.Debug.WriteLine("상단"+ testP);
1222
                            }
1223
                            else if (ps[1] == endP) //하단
1224
                            {
1225
                                testP = new Point(endP.X , endP.Y - 50);
1226
                                //System.Diagnostics.Debug.WriteLine("하단"+ testP);
1227
                            }
1228
                            else if (ps[2] == endP) //좌단
1229
                            {
1230
                                testP = new Point(endP.X - 50, endP.Y);
1231
                                //System.Diagnostics.Debug.WriteLine("좌단"+ testP);
1232
                            }
1233
                            else if (ps[3] == endP) //우단
1234
                            {
1235
                                testP = new Point(endP.X + 50, endP.Y);
1236
                                //System.Diagnostics.Debug.WriteLine("우단"+ testP);
1237
                            }
1238
                        }
1239
                        break;
1240
                    case "270":
1241
                        if (isFixed)
1242
                        {
1243
                            if (ps[0] == endP) //상단
1244
                            {
1245
                                testP = new Point(endP.X , endP.Y - 50);
1246
                                //System.Diagnostics.Debug.WriteLine("상단" + testP);
1247
                            }
1248
                            else if (ps[1] == endP) //하단
1249
                            {
1250
                                testP = new Point(endP.X, endP.Y + 50);
1251
                                //System.Diagnostics.Debug.WriteLine("하단" + testP);
1252
                            }
1253
                            else if (ps[2] == endP) //좌단
1254
                            {
1255
                                testP = new Point(endP.X + 50, endP.Y);
1256
                                //System.Diagnostics.Debug.WriteLine("좌단" + testP);
1257
                            }
1258
                            else if (ps[3] == endP) //우단
1259
                            {
1260
                                testP = new Point(endP.X - 50, endP.Y);
1261
                                //System.Diagnostics.Debug.WriteLine("우단" + testP);
1262
                            }
1263
                        }
1264
                        break;
1265
                    default:
1266
                        if (isFixed)
1267
                        {
1268
                            if (ps[0] == endP) //상단
1269
                            {
1270
                                testP = new Point(endP.X, endP.Y - 50);
1271
                                //System.Diagnostics.Debug.WriteLine("상단");
1272
                            }
1273
                            else if (ps[1] == endP) //하단
1274
                            {
1275
                                testP = new Point(endP.X, endP.Y + 50);
1276
                                //System.Diagnostics.Debug.WriteLine("하단");
1277
                            }
1278
                            else if (ps[2] == endP) //좌단
1279
                            {
1280
                                testP = new Point(endP.X - 50, endP.Y);
1281
                                //System.Diagnostics.Debug.WriteLine("좌단");
1282
                            }
1283
                            else if (ps[3] == endP) //우단
1284
                            {
1285
                                testP = new Point(endP.X + 50, endP.Y);
1286
                                //System.Diagnostics.Debug.WriteLine("우단");
1287
                            }
1288
                        }
1289
                        break;
1290
                }
1291
                connectorMEGeometry.EndPoint = endP;
1292
                connectorSMGeometry.EndPoint = testP;
1293
                connectorMEGeometry.StartPoint = testP;
1294
                
1295
                //20180910 LJY 각도에 따라.
1296
                this.MidPoint = testP;
1297
                instanceGroup.Children.Add(DrawSet.DrawArrow(testP, this.StartPoint, this.LineSize));
1298
            }
1299
            else
1300
            {
1301
                switch (Math.Abs(this.Angle).ToString())
1302
                {
1303
                    case "90":
1304
                        {
1305
                            ps.Clear();
1306

    
1307
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽
1308
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth / 2)); // 위 중간
1309
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth)); // 위 오른쪽
1310

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

    
1314
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox) - this.BoxWidth / 2)); //중간 하단
1315
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox) - this.BoxWidth)); //오른쪽 하단
1316
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) - this.BoxWidth)); //오른쪽 중간 
1317
                        }
1318
                        break;
1319
                    case "270":
1320
                        {
1321
                            ps.Clear();
1322
                            
1323
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽
1324
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth / 2)); // 위 중간
1325
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth)); // 위 오른쪽
1326

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

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

    
1333
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) + this.BoxWidth)); //오른쪽 중간 
1334
                        }
1335
                        break;
1336
                    default:
1337
                        break;
1338
                }
1339

    
1340

    
1341
                var endP = MathSet.getNearPoint(ps, this.MidPoint);
1342
                connectorMEGeometry.EndPoint = endP; //최상단
1343
                                                     //connectorMEGeometry.EndPoint = this.EndPoint; //핵심
1344
                                                     //this.MidPoint= MathSet.getMiddlePoint(this.StartPoint, endP);
1345
                #region 보정치
1346
                Point testP = endP;
1347

    
1348
                //20180910 LJY 각도에 따라.
1349
                switch (Math.Abs(this.Angle).ToString())
1350
                {
1351
                    case "90":
1352
                        if (isFixed)
1353
                        {
1354
                            if (ps[0] == endP) //상단
1355
                            {
1356
                                testP = new Point(endP.X - 50, endP.Y);
1357
                                //System.Diagnostics.Debug.WriteLine("상단"+ testP);
1358
                            }
1359
                            else if (ps[1] == endP) //하단
1360
                            {
1361
                                testP = new Point(endP.X + 50, endP.Y);
1362
                                //System.Diagnostics.Debug.WriteLine("하단"+ testP);
1363
                            }
1364
                            else if (ps[2] == endP) //좌단
1365
                            {
1366
                                testP = new Point(endP.X - 50, endP.Y);
1367
                                //System.Diagnostics.Debug.WriteLine("좌단"+ testP);
1368
                            }
1369
                            else if (ps[3] == endP) //우단
1370
                            {
1371
                                testP = new Point(endP.X + 50 , endP.Y);
1372
                                //System.Diagnostics.Debug.WriteLine("우단"+ testP);
1373
                            }
1374
                        }
1375
                        break;
1376
                    case "270":
1377
                        if (isFixed)
1378
                        {
1379
                            if (ps[0] == endP) //상단
1380
                            {
1381
                                testP = new Point(endP.X + 50, endP.Y);
1382
                                //System.Diagnostics.Debug.WriteLine("상단" + testP);
1383
                            }
1384
                            else if (ps[1] == endP) //하단
1385
                            {
1386
                                testP = new Point(endP.X - 50, endP.Y);
1387
                                //System.Diagnostics.Debug.WriteLine("하단" + testP);
1388
                            }
1389
                            else if (ps[2] == endP) //좌단
1390
                            {
1391
                                testP = new Point(endP.X + 50, endP.Y);
1392
                                //System.Diagnostics.Debug.WriteLine("좌단" + testP);
1393
                            }
1394
                            else if (ps[3] == endP) //우단
1395
                            {
1396
                                testP = new Point(endP.X + 50, endP.Y );
1397
                                //System.Diagnostics.Debug.WriteLine("우단" + testP);
1398
                            }
1399
                        }
1400
                        break;
1401
                    default:
1402
                        if (isFixed)
1403
                        {
1404
                            if (ps[0] == endP) //상단
1405
                            {
1406
                                testP = new Point(endP.X, endP.Y - 50);
1407
                                //System.Diagnostics.Debug.WriteLine("상단");
1408
                            }
1409
                            else if (ps[1] == endP) //하단
1410
                            {
1411
                                testP = new Point(endP.X, endP.Y + 50);
1412
                                //System.Diagnostics.Debug.WriteLine("하단");
1413
                            }
1414
                            else if (ps[2] == endP) //좌단
1415
                            {
1416
                                testP = new Point(endP.X - 50, endP.Y);
1417
                                //System.Diagnostics.Debug.WriteLine("좌단");
1418
                            }
1419
                            else if (ps[3] == endP) //우단
1420
                            {
1421
                                testP = new Point(endP.X + 50, endP.Y);
1422
                                //System.Diagnostics.Debug.WriteLine("우단");
1423
                            }
1424
                        }
1425
                        break;
1426
                }
1427
                  
1428

    
1429
                connectorSMGeometry.EndPoint = testP;
1430
                connectorMEGeometry.StartPoint = testP;
1431
                instanceGroup.Children.Add(DrawSet.DrawArrow(testP, this.StartPoint, this.LineSize));
1432
                #endregion
1433
            }
1434

    
1435
            switch (this.ArrowTextStyle)
1436
            {
1437
                case ArrowTextStyleSet.Normal:
1438
                    this.BorderSize = new Thickness(0);
1439
                    break;
1440
                case ArrowTextStyleSet.Cloud:
1441
                    this.BorderSize = new Thickness(0);
1442
                    DrawingCloud();
1443
                    break;
1444
                default:
1445
                    {
1446
                        this.BorderSize = new Thickness(LineSize); //올라
1447
                        DrawingRect();
1448
                    }
1449

    
1450
                    break;
1451
            }
1452

    
1453
            if (isHighLight)
1454
            {
1455
                SubPathFill = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B));
1456
                BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B));
1457

    
1458
                TextBoxBackground = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B));
1459
            }
1460
            else
1461
            {
1462
                BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1463
                SubPathFill = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1464
                TextBoxBackground = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.1), Colors.White.R, Colors.White.G, Colors.White.B));
1465
            }
1466

    
1467
            instanceGroup.Children.Add(connectorSMGeometry);
1468
            instanceGroup.Children.Add(connectorMEGeometry);
1469

    
1470
            this.PathData = instanceGroup;
1471
            OverViewPathData = PathData;
1472
            OverViewArrowText = ArrowText;
1473
            OverViewEndPoint = connectorMEGeometry.EndPoint;
1474
            OverViewStartPoint = connectorSMGeometry.StartPoint;
1475

    
1476
            var tempAngle = Math.Abs(this.Angle);
1477

    
1478
            if (tempAngle == Convert.ToDouble(90) || tempAngle == Convert.ToDouble(270))
1479
            {
1480
                this.RenderTransformOrigin = new Point(0.5, 0.5);
1481
                this.Base_ArrowPath.RenderTransformOrigin = new Point(0, 0);
1482
                this.Base_ArrowSubPath.RenderTransformOrigin = new Point(0, 0);
1483

    
1484
                Base_TextBox.RenderTransformOrigin = new Point(0, 0);
1485
            }
1486

    
1487
            Base_ArrowSubPath.RenderTransform = new RotateTransform
1488
            {
1489
                Angle = this.Angle,
1490
                CenterX = this.EndPoint.X,
1491
                CenterY = this.EndPoint.Y,
1492
            };
1493
        }
1494

    
1495
        private void DrawingCloud()
1496
        {
1497
            //20180906 LJY Textbox guide
1498
            string angle = Math.Abs(this.Angle).ToString();
1499
            if (angle == "180")
1500
            {
1501
                List<Point> pCloud = new List<Point>()
1502
                {
1503
                     new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1504
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - BoxHeight), //왼쪽 아래
1505
                    new Point(Canvas.GetLeft(Base_TextBox) - BoxWidth, Canvas.GetTop(Base_TextBox) - BoxHeight),
1506
                    new Point(Canvas.GetLeft(Base_TextBox) - BoxWidth, Canvas.GetTop(Base_TextBox)),
1507
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1508
                };
1509
                SubPathData = (Generate(pCloud));
1510
                PathDataInner = (GenerateInnerCloud(pCloud, angle));
1511
            
1512
            }//20180906 LJY Textbox guide
1513
            else
1514
            {            
1515
                List<Point> pCloud = new List<Point>()
1516
                {
1517
    #if SILVERLIGHT
1518
		            new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1519
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight), //왼쪽 아래
1520
                    new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth, Canvas.GetTop(Base_TextBox) + BoxHeight),
1521
                    new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth, Canvas.GetTop(Base_TextBox)),
1522
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1523

    
1524
    #else
1525
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1526
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight), //왼쪽 아래
1527
                    new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth, Canvas.GetTop(Base_TextBox) + BoxHeight),
1528
                    new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth, Canvas.GetTop(Base_TextBox)),
1529
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1530

    
1531
                    //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1532
                    //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight-4), //왼쪽 아래
1533
                    //new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth-1, Canvas.GetTop(Base_TextBox) + BoxHeight-4),
1534
                    //new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth-1, Canvas.GetTop(Base_TextBox)),
1535
                    //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1536
    #endif
1537
                };
1538
                //instanceGroup.Children.Add(Generate(pCloud));
1539
                SubPathData = (Generate(pCloud));
1540
                PathDataInner = (GenerateInnerCloud(pCloud, angle));
1541
                //   }
1542
            }
1543

    
1544
        }
1545

    
1546
        private void DrawingRect()
1547
        {
1548
            //20180906 LJY Textbox guide
1549

    
1550
            if (Math.Abs(this.Angle).ToString() == "90")
1551
            {
1552
                List<Point> pCloud = new List<Point>()
1553
                {
1554
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1555
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - BoxWidth), //왼쪽 아래
1556
                    new Point(Canvas.GetLeft(Base_TextBox) + BoxHeight, Canvas.GetTop(Base_TextBox) - BoxWidth),
1557
                    new Point(Canvas.GetLeft(Base_TextBox) + BoxHeight, Canvas.GetTop(Base_TextBox)),
1558
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1559
                };
1560
                PathDataInner = (GenerateInner(pCloud));
1561
            }
1562
            else if(Math.Abs(this.Angle).ToString() == "270")
1563
            {
1564
                List<Point> pCloud = new List<Point>()
1565
                {
1566
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1567
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + BoxWidth), //왼쪽 아래
1568
                    new Point(Canvas.GetLeft(Base_TextBox) - BoxHeight, Canvas.GetTop(Base_TextBox) + BoxWidth),
1569
                    new Point(Canvas.GetLeft(Base_TextBox) - BoxHeight, Canvas.GetTop(Base_TextBox)),
1570
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1571
                };
1572
                PathDataInner = (GenerateInner(pCloud));
1573
            }//20180906 LJY Textbox guide
1574
            else
1575
            { 
1576
                List<Point> pCloud = new List<Point>()
1577
                {
1578
    #if SILVERLIGHT
1579
		            new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1580
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight), //왼쪽 아래
1581
                    new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth, Canvas.GetTop(Base_TextBox) + BoxHeight),
1582
                    new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth, Canvas.GetTop(Base_TextBox)),
1583
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1584

    
1585
    #else
1586
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1587
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight), //왼쪽 아래
1588
                    new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth, Canvas.GetTop(Base_TextBox) + BoxHeight),
1589
                    new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth, Canvas.GetTop(Base_TextBox)),
1590
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1591

    
1592
                    //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1593
                    //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight-4), //왼쪽 아래
1594
                    //new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth-1, Canvas.GetTop(Base_TextBox) + BoxHeight-4),
1595
                    //new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth-1, Canvas.GetTop(Base_TextBox)),
1596
                    //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1597
    #endif
1598
                };
1599
                //instanceGroup.Children.Add(Generate(pCloud));
1600
                PathDataInner = (GenerateInner(pCloud));
1601
            }
1602
        }
1603

    
1604
        public void updateControl()
1605
        {
1606
            this.StartPoint = new Point(this.PointSet[0].X, this.PointSet[0].Y);
1607
            this.MidPoint = new Point(this.PointSet[1].X, this.PointSet[1].Y);
1608
            this.EndPoint = new Point(this.PointSet[2].X, this.PointSet[2].Y);
1609
            //isTrans = true;
1610
        }
1611

    
1612
        public void ApplyOverViewData()
1613
        {
1614
            this.OverViewPathData = this.PathData;
1615
            if (ArrowText == "")
1616
                this.ArrowText = this.OverViewArrowText;
1617
            else
1618
                this.OverViewArrowText = this.ArrowText;
1619
            this.OverViewStartPoint = this.StartPoint;
1620
            this.OverViewEndPoint = this.EndPoint;
1621
        }
1622

    
1623
        #endregion
1624

    
1625
        public static PathFigure GenerateLineWithCloud(Point p1, Point p2, double arcLength_, bool reverse)
1626
        {
1627
            PathFigure pathFigure = new PathFigure();
1628
            pathFigure.StartPoint = p1;
1629

    
1630
            double arcLength = arcLength_;
1631
            /// draw arcs which has arcLength between p1 and p2 - 2012.06.21 added by humkyung 
1632
            double dx = p2.X - p1.X;
1633
            double dy = p2.Y - p1.Y;
1634
            double l = MathSet.DistanceTo(p1, p2); /// distance between p1 and p2
1635
            double theta = Math.Atan2(Math.Abs(dy), Math.Abs(dx)) * 180 / Math.PI;
1636
            Point lastPt = new Point(p1.X, p1.Y);
1637
            double count = l / arcLength;
1638
            /// normalize
1639
            dx /= l;
1640
            dy /= l;
1641
            Double j = 1;
1642
            for (j = 1; j < (count - 1); j++) 
1643
            {
1644
                ArcSegment arcSeg = new ArcSegment();
1645
                arcSeg.Size = new Size(arcLength * _CloudArcDepth, arcLength * _CloudArcDepth);						/// x size and y size of arc
1646
                arcSeg.Point = new Point(p1.X + j * dx * arcLength, p1.Y + j * dy * arcLength);	/// end point of arc
1647
                lastPt = arcSeg.Point;  /// save last point
1648
                arcSeg.RotationAngle = theta + 90;
1649
                if (true == reverse) arcSeg.SweepDirection = SweepDirection.Clockwise;
1650
                pathFigure.Segments.Add(arcSeg);
1651
            }
1652

    
1653
            /// draw arc between last point and end point
1654
            if ((count > j) || (count > 0))
1655
            {
1656
                arcLength = MathSet.DistanceTo(lastPt, p2);
1657
                ArcSegment arcSeg = new ArcSegment();
1658
                arcSeg.Size = new Size(arcLength * _CloudArcDepth, arcLength * _CloudArcDepth);	/// x size and y size of arc
1659
                arcSeg.Point = new Point(p2.X, p2.Y);						/// end point of arc
1660
                arcSeg.RotationAngle = theta;
1661
                if (true == reverse) arcSeg.SweepDirection = SweepDirection.Clockwise;
1662
                pathFigure.Segments.Add(arcSeg);
1663
            }
1664
            /// up to here
1665

    
1666
            return pathFigure;
1667
        }
1668

    
1669
        public static PathGeometry Generate(List<Point> pData)
1670
        {
1671
            var _pathGeometry = new PathGeometry();
1672
            
1673
            double area = MathSet.AreaOf(pData);
1674
            bool reverse = (area > 0);
1675
            int count = pData.Count;
1676
            for (int i = 0; i < (count - 1); i++)
1677
            {
1678
                PathFigure pathFigure = GenerateLineWithCloud(pData[i], pData[i + 1], 20, reverse);
1679
                pathFigure.IsClosed = false;
1680
                pathFigure.IsFilled = true;
1681
                _pathGeometry.Figures.Add(pathFigure);
1682
            }
1683
            
1684
            return _pathGeometry;
1685
        }
1686

    
1687
        
1688
        public static PathGeometry GenerateInner(List<Point> pData)
1689
        {
1690
            var _pathGeometry = new PathGeometry();
1691
            double area = MathSet.AreaOf(pData);
1692
            bool reverse = (area > 0);
1693
            int count = pData.Count;
1694

    
1695
            PathFigure pathFigur2 = new PathFigure();
1696
            pathFigur2.StartPoint = pData[0];
1697

    
1698
            LineSegment lineSegment0 = new LineSegment();
1699
            lineSegment0.Point = pData[0];
1700
            pathFigur2.Segments.Add(lineSegment0);
1701

    
1702
            LineSegment lineSegment1 = new LineSegment();
1703
            lineSegment1.Point = pData[1];
1704
            pathFigur2.Segments.Add(lineSegment1);
1705

    
1706
            LineSegment lineSegment2 = new LineSegment();
1707
            lineSegment2.Point = pData[2];
1708
            pathFigur2.Segments.Add(lineSegment2);
1709

    
1710
            LineSegment lineSegment3 = new LineSegment();
1711
            lineSegment3.Point = pData[3];
1712
            pathFigur2.Segments.Add(lineSegment3);
1713

    
1714

    
1715
            pathFigur2.IsClosed = true;
1716
            pathFigur2.IsFilled = true;
1717
            _pathGeometry.Figures.Add(pathFigur2);           
1718

    
1719
            return _pathGeometry;
1720
        }
1721

    
1722
        //20180910 LJY Cloud rotation 추가
1723
        public static PathGeometry GenerateInnerCloud(List<Point> pData, string angle)
1724
        {
1725
            var _pathGeometry = new PathGeometry();
1726
            double area = MathSet.AreaOf(pData);
1727
            bool reverse = (area > 0);
1728
            int count = pData.Count;
1729

    
1730
            PathFigure pathFigur2 = new PathFigure();
1731
            pathFigur2.StartPoint = pData[0];
1732

    
1733
            LineSegment lineSegment0 = new LineSegment();
1734
            lineSegment0.Point = pData[0];
1735
            pathFigur2.Segments.Add(lineSegment0);
1736

    
1737
            LineSegment lineSegment1 = new LineSegment();
1738
            lineSegment1.Point = pData[1];
1739
            pathFigur2.Segments.Add(lineSegment1);
1740

    
1741
            LineSegment lineSegment2 = new LineSegment();
1742
            lineSegment2.Point = pData[2];
1743
            pathFigur2.Segments.Add(lineSegment2);
1744

    
1745
            LineSegment lineSegment3 = new LineSegment();
1746
            lineSegment3.Point = pData[3];
1747
            pathFigur2.Segments.Add(lineSegment3);
1748
            
1749
            RotateTransform transform = new RotateTransform();
1750
            switch (angle)
1751
            {
1752
                case "90":
1753
                    transform.Angle = -90;
1754
                    break;
1755
                case "180":
1756
                    transform.Angle = -180;
1757
                    break;
1758
                case "270":
1759
                    transform.Angle = -270;
1760
                    break;
1761
            }
1762
            transform.CenterX = pData[0].X;
1763
            transform.CenterY = pData[0].Y;
1764
            _pathGeometry.Transform = transform;
1765

    
1766
            pathFigur2.IsClosed = true;
1767
            pathFigur2.IsFilled = true;
1768
            _pathGeometry.Figures.Add(pathFigur2);
1769

    
1770
            return _pathGeometry;
1771
        }
1772

    
1773
        /// <summary>
1774
        /// return ArrowTextControl's area
1775
        /// </summary>
1776
        /// <author>humkyung</author>
1777
        /// <date>2019.06.13</date>
1778
        public override Rect ItemRect
1779
        {
1780
            get
1781
            {
1782
                double dMinX = Math.Min(this.StartPoint.X, this.EndPoint.X);
1783
                double dMinY = Math.Min(this.StartPoint.Y, this.EndPoint.Y);
1784
                double dMaxX = Math.Max(this.StartPoint.X, this.EndPoint.X);
1785
                double dMaxY = Math.Max(this.StartPoint.Y, this.EndPoint.Y);
1786

    
1787
                return new Rect(new Point(dMinX, dMinY), new Point(dMaxX, dMaxY));
1788
            }
1789
        }
1790

    
1791
        /// <summary>
1792
        /// Serialize this
1793
        /// </summary>
1794
        /// <param name="sUserId"></param>
1795
        /// <returns></returns>
1796
        public override string Serialize()
1797
        {
1798
            using (S_ArrowTextControl STemp = new S_ArrowTextControl())
1799
            {
1800
                STemp.TransformPoint = "0|0";
1801
                STemp.PointSet = this.PointSet;
1802
                STemp.SizeSet = String.Format("{0}", this.LineSize);
1803
                STemp.StrokeColor = this.StrokeColor.Color.ToString();
1804
                STemp.StartPoint = this.StartPoint;
1805
                STemp.ArrowStyle = this.ArrowTextStyle;
1806
                //STemp.StrokeColor = "#FF00FF00";
1807
                STemp.UserID = this.UserID;
1808
                STemp.ArrowText = this.Base_TextBox.Text;
1809
                STemp.BorderSize = this.BorderSize;
1810
                STemp.isHighLight = this.isHighLight;
1811
                STemp.BoxHeight = this.BoxHeight;
1812
                STemp.BoxWidth = this.BoxWidth;
1813
                STemp.Opac = this.Opacity;
1814
                STemp.EndPoint = this.EndPoint;
1815
                STemp.isFixed = this.isFixed;
1816
                //STemp.DashSize = this.DashSize;
1817
                STemp.Name = this.GetType().Name.ToString();
1818
                STemp.isTrans = this.isTrans;
1819
                STemp.MidPoint = this.MidPoint;
1820
                STemp.Angle = this.Angle;
1821
                STemp.fontConfig = new List<string>()
1822
                            {
1823
                                this.TextFamily.ToString(),
1824
                                this.TextStyle.ToString(),
1825
                                this.TextWeight.ToString(),
1826
                                this.TextSize.ToString(),
1827
                            };
1828

    
1829
                if (this.UnderLine != null)
1830
                {
1831
                    STemp.fontConfig.Add("true");
1832
                }
1833

    
1834
                ///강인구 추가(2017.11.02)
1835
                ///Memo 추가
1836
                STemp.Memo = this.Memo;
1837
                STemp.BorderSize = this.BorderSize;
1838
                return "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize()));
1839
            };
1840
        }
1841

    
1842
        /// <summary>
1843
        /// create a arrowtextcontrol from given string
1844
        /// </summary>
1845
        /// <param name="str"></param>
1846
        /// <returns></returns>
1847
        public static ArrowTextControl FromString(string str, SolidColorBrush brush, string sProjectNo)
1848
        {
1849
            ArrowTextControl instance = null;
1850
            using (S_ArrowTextControl s = JsonSerializerHelper.JsonDeserialize<S_ArrowTextControl>(str))
1851
            {
1852
                string[] data2 = s.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
1853
                instance = new ArrowTextControl();
1854
                instance.LineSize = Convert.ToDouble(data2.First());
1855
                instance.PointSet = s.PointSet;
1856
                instance.StartPoint = s.StartPoint;
1857
                instance.EndPoint = s.EndPoint;
1858
                instance.StrokeColor = brush;
1859
                //instance.DashSize = s.DashSize;
1860
                instance.ArrowTextStyle = s.ArrowStyle;
1861
                instance.isHighLight = s.isHighLight;
1862
                instance.ArrowText = s.ArrowText;
1863
                instance.Opacity = s.Opac;
1864
                instance.BorderSize = s.BorderSize;
1865
                instance.BoxWidth = s.BoxWidth;
1866
                instance.BoxHeight = s.BoxHeight;
1867
                instance.isFixed = s.isFixed;
1868
                instance.Angle = s.Angle;
1869
                instance.UserID = s.UserID;
1870
                instance.isTrans = s.isTrans;
1871
                instance.MidPoint = s.MidPoint;
1872
                instance.Memo = s.Memo;
1873
                if (s.fontConfig == null || s.fontConfig.ToList().Count == 0)
1874
                {
1875
                    s.fontConfig = new List<string>();
1876

    
1877
                    s.fontConfig.Add("Arial");
1878
                    s.fontConfig.Add("Normal");
1879
                    s.fontConfig.Add("Normal");
1880
                    s.fontConfig.Add("30");
1881
                }
1882
                instance.TextFamily = new FontFamily(s.fontConfig[0]);
1883
                //인구 추가(2018.04.17)
1884
                instance.TextStyle = StringToFont.ConFontStyle(s.fontConfig[1]);
1885
                instance.TextWeight = StringToFont.ConFontWeight(s.fontConfig[2]);
1886
                instance.TextSize = Convert.ToDouble(s.fontConfig[3]);
1887

    
1888
                if (s.fontConfig.Count() == 5)
1889
                {
1890
                    instance.UnderLine = TextDecorations.Underline;
1891
                }
1892
            }
1893

    
1894
            return instance;
1895
        }
1896

    
1897
        #region Dispose
1898
        public void Dispose()
1899
        {
1900
            GC.Collect();
1901
            GC.SuppressFinalize(this);
1902
        } 
1903
        #endregion
1904

    
1905
        #region INotifyPropertyChanged
1906
        private void OnPropertyChanged(string name)
1907
        {
1908
            if (PropertyChanged != null)
1909
            {
1910
                PropertyChanged(this, new PropertyChangedEventArgs(name));
1911
            }
1912
        }
1913

    
1914
        public event PropertyChangedEventHandler PropertyChanged; 
1915
        #endregion
1916
    }
1917
}
클립보드 이미지 추가 (최대 크기: 500 MB)