프로젝트

일반

사용자정보

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

markus / MarkupToPDF / Controls / Text / ArrowTextControl.cs @ ca40e004

이력 | 보기 | 이력해설 | 다운로드 (82.3 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

    
15
namespace MarkupToPDF.Controls.Text
16
{
17
    public class ArrowTextControl : CommentUserInfo, IDisposable, INotifyPropertyChanged, IPath, ITextControl, IMarkupControlData
18
    {
19
        private const string PART_ArrowPath = "PART_ArrowPath";
20
        private const string PART_TextBox = "PART_ArrowTextBox";
21
        //private const string PART_TextBlock = "PART_ArrowTextBlock";
22
        private const string PART_ArrowSubPath = "PART_ArrowSubPath";
23
        private const string PART_Border = "PART_Border";
24
        
25
        public Path Base_ArrowPath = null;
26
        public Path Base_ArrowSubPath = null;
27
        public TextBox Base_TextBox = null;
28
        public TextBlock Base_TextBlock = null;
29

    
30
        private const double _CloudArcDepth = 0.8;  /// 2018.05.14 added by humkyung
31

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

    
39
        //안쓰고 있음
40
        //LineGeometry connectorMCEGeometry = new LineGeometry();
41

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

    
44
        #endregion
45

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

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

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

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

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

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

    
85
        }
86

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

    
91
            this.IsEditingMode = false;
92

    
93
            ApplyOverViewData();
94
        }
95

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

    
102
        void Base_TextBox_SizeChanged(object sender, SizeChangedEventArgs e)
103
        {
104
            this.ArrowText = Base_TextBox.Text;
105
            BoxWidth = e.NewSize.Width;
106
            BoxHeight = e.NewSize.Height;
107
            SetArrowTextPath();
108
        }
109

    
110
        //void Base_TextBlock_SizeChanged(object sender, SizeChangedEventArgs e)
111
        //{
112
        //    Base_TextBlock.Text = Base_TextBox.Text;
113

    
114
        //    BoxWidth = e.NewSize.Width;
115
        //    BoxHeight = e.NewSize.Height;
116

    
117
        //    this.ApplyTemplate();
118
        //    SetArrowTextPath();
119
        //}
120

    
121
        #region Properties
122
        private bool _IsEditingMode;
123
        public bool IsEditingMode
124
        {
125
            get
126
            {
127
                return _IsEditingMode;
128
            }
129
            set
130
            {
131
                _IsEditingMode = value;
132
                OnPropertyChanged("IsEditingMode");
133
            }
134
        }
135

    
136

    
137
        #endregion
138

    
139
        #region dp Properties
140
        //강인구 주석 풀기
141
        public Visibility TextBoxVisibility
142
        {
143
            get { return (Visibility)GetValue(TextBoxVisibilityProperty); }
144
            set
145
            {
146
                if (this.TextBoxVisibility != value)
147
                {
148
                    SetValue(TextBoxVisibilityProperty, value);
149
                    OnPropertyChanged("TextBoxVisibility");
150
                }
151
            }
152
        }
153

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

    
168

    
169
        public SolidColorBrush StrokeColor
170
        {
171
            get { return (SolidColorBrush)GetValue(StrokeColorProperty); }
172
            set
173
            {
174
                if (this.StrokeColor != value)
175
                {
176
                    SetValue(StrokeColorProperty, value);
177
                }
178
            }
179
        }
180

    
181
        public PathGeometry SubPathData
182
        {
183
            get { return (PathGeometry)GetValue(SubPathDataProperty); }
184
            set
185
            {
186
                if (this.SubPathData != value)
187
                {
188
                    SetValue(SubPathDataProperty, value);
189
                }
190
            }
191
        }
192

    
193
        public string UserID
194
        {
195
            get { return (string)GetValue(UserIDProperty); }
196
            set
197
            {
198
                if (this.UserID != value)
199
                {
200
                    SetValue(UserIDProperty, value);
201
                    OnPropertyChanged("UserID");
202
                }
203
            }
204
        }
205

    
206
        public List<Point> PointSet
207
        {
208
            get { return (List<Point>)GetValue(PointSetProperty); }
209
            set { SetValue(PointSetProperty, value); }
210
        }
211

    
212
        public bool IsSelected
213
        {
214
            get
215
            {
216
                return (bool)GetValue(IsSelectedProperty);
217
            }
218
            set
219
            {
220
                SetValue(IsSelectedProperty, value);
221
                OnPropertyChanged("IsSelected");
222
            }
223
        }
224

    
225
        public ControlType ControlType
226
        {
227
            set
228
            {
229
                SetValue(ControlTypeProperty, value);
230
                OnPropertyChanged("ControlType");
231
            }
232
            get
233
            {
234
                return (ControlType)GetValue(ControlTypeProperty);
235
            }
236
        }
237

    
238
        public Point StartPoint
239
        {
240
            get { return (Point)GetValue(StartPointProperty); }
241
            set { SetValue(StartPointProperty, value); }
242
        }
243

    
244
        public Point EndPoint
245
        {
246
            get { return (Point)GetValue(EndPointProperty); }
247
            set { SetValue(EndPointProperty, value); }
248
        }
249

    
250
        public Point OverViewStartPoint
251
        {
252
            get { return (Point)GetValue(OverViewStartPointProperty); }
253
            set { SetValue(OverViewStartPointProperty, value); }
254
        }
255

    
256
        public Point OverViewEndPoint
257
        {
258
            get { return (Point)GetValue(OverViewEndPointProperty); }
259
            set { SetValue(OverViewEndPointProperty, value); }
260
        }
261

    
262

    
263
        public double Angle
264
        {
265
            get { return (double)GetValue(AngleProperty); }
266
            set { SetValue(AngleProperty, value); }
267
        }
268

    
269
        public Thickness BorderSize
270
        {
271
            get { return (Thickness)GetValue(BorderSizeProperty); }
272
            set
273
            {
274
                if (this.BorderSize != value)
275
                {
276
                    SetValue(BorderSizeProperty, value);
277
                }
278
            }
279
        }
280

    
281

    
282
        public Point MidPoint
283
        {
284
            get { return (Point)GetValue(MidPointProperty); }
285
            set { SetValue(MidPointProperty, value); }
286
        }
287

    
288
        public bool isFixed
289
        {
290
            get { return (bool)GetValue(IsFixedProperty); }
291
            set { SetValue(IsFixedProperty, value); }
292
        }
293

    
294
        public bool isTrans
295
        {
296
            get { return (bool)GetValue(TransformerProperty); }
297
            set { SetValue(TransformerProperty, value); }
298
        }
299

    
300
        public bool isHighLight
301
        {
302
            get { return (bool)GetValue(isHighlightProperty); }
303
            set
304
            {
305
                if (this.isHighLight != value)
306
                {
307
                    SetValue(isHighlightProperty, value);
308
                    OnPropertyChanged("isHighLight");
309
                }
310
            }
311
        }
312

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

    
326
        public Double LineSize
327
        {
328
            get { return (Double)GetValue(LineSizeProperty); }
329
            set
330
            {
331
                if (this.LineSize != value)
332
                {
333
                    SetValue(LineSizeProperty, value);
334
                }
335
            }
336
        }
337

    
338
        public Double BoxWidth
339
        {
340
            get { return (Double)GetValue(BoxWidthProperty); }
341
            set
342
            {
343
                if (this.BoxWidth != value)
344
                {
345
                    SetValue(BoxWidthProperty, value);
346
                }
347
            }
348
        }
349

    
350
        public Double BoxHeight
351
        {
352
            get { return (Double)GetValue(BoxHeightProperty); }
353
            set
354
            {
355
                if (this.BoxHeight != value)
356
                {
357
                    SetValue(BoxHeightProperty, value);
358
                }
359
            }
360
        }
361

    
362
        public ArrowTextStyleSet ArrowTextStyle
363
        {
364
            get { return (ArrowTextStyleSet)GetValue(ArrowTextStyleProperty); }
365
            set
366
            {
367
                if (this.ArrowTextStyle != value)
368
                {
369
                    SetValue(ArrowTextStyleProperty, value);
370
                }
371
            }
372
        }
373

    
374
        public Geometry PathData
375
        {
376
            get { return (Geometry)GetValue(PathDataProperty); }
377
            set { SetValue(PathDataProperty, value);
378

    
379
                OnPropertyChanged("PathData");
380
            }
381
        }
382

    
383
        public SolidColorBrush BackInnerColor
384
        {
385
            get { return (SolidColorBrush)GetValue(BackInnerColorProperty); }
386
            set
387
            {
388
                if (this.BackInnerColor != value)
389
                {
390
                    SetValue(BackInnerColorProperty, value);
391
                    OnPropertyChanged("BackInnerColor");
392
                }
393
            }
394
        }
395

    
396
        public Geometry PathDataInner
397
        {
398
            get { return (Geometry)GetValue(PathDataInnerProperty); }
399
            set
400
            {
401
                SetValue(PathDataInnerProperty, value);
402
                OnPropertyChanged("PathDataInner");
403
            }
404
        }
405

    
406
        public Geometry OverViewPathData
407
        {
408
            get { return (Geometry)GetValue(OverViewPathDataProperty); }
409
            set { SetValue(OverViewPathDataProperty, value);
410

    
411
                OnPropertyChanged("OverViewPathData");
412

    
413
            }
414
        }
415

    
416
        public FontFamily TextFamily
417
        {
418
            get { return (FontFamily)GetValue(TextFamilyProperty); }
419
            set
420
            {
421
                if (this.TextFamily != value)
422
                {
423
                    SetValue(TextFamilyProperty, value);
424
                    OnPropertyChanged("TextFamily");
425
                }
426
            }
427
        }
428

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

    
442
        public string OverViewArrowText
443
        {
444

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

    
457
        public Double TextSize
458
        {
459
            get { return (Double)GetValue(TextSizeProperty); }
460
            set
461
            {
462
                if (this.TextSize != value)
463
                {
464
                    SetValue(TextSizeProperty, value);
465
                    OnPropertyChanged("TextSize");
466
                }
467
            }
468
        }
469

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

    
483
        //강인구 추가
484
        public TextDecorationCollection UnderLine
485
        {
486
            get
487
            {
488
                return (TextDecorationCollection)GetValue(UnderLineProperty);
489
            }
490
            set
491
            {
492
                if (this.UnderLine != value)
493
                {
494
                    SetValue(UnderLineProperty, value);
495
                    OnPropertyChanged("UnderLine");
496
                }
497
            }
498
        }
499

    
500
        public double CanvasX
501
        {
502
            get { return (double)GetValue(CanvasXProperty); }
503
            set
504
            {
505
                if (this.CanvasX != value)
506
                {
507
                    SetValue(CanvasXProperty, value);
508
                    OnPropertyChanged("CanvasX");
509
                }
510
            }
511
        }
512

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

    
526
        public double CenterX
527
        {
528
            get { return (double)GetValue(CenterXProperty); }
529
            set { SetValue(CenterXProperty, value);
530
            OnPropertyChanged("CenterX");
531
            
532
            }
533
        }
534

    
535
        public double CenterY
536
        {
537
            get { return (double)GetValue(CenterYProperty); }
538
            set { SetValue(CenterYProperty, value);
539
            OnPropertyChanged("CenterY");
540
            }
541
        }
542

    
543
        public Brush SubPathFill
544
        {
545
            get { return (Brush)GetValue(SubPathFillProperty); }
546
            set
547
            {
548
                SetValue(SubPathFillProperty, value);
549
                OnPropertyChanged("SubPathFill");
550
            }
551
        }
552

    
553
        public Brush TextBoxBackground
554
        {
555
            get { return (Brush)GetValue(TextBoxBackgroundProperty); }
556
            set
557
            {
558
                SetValue(TextBoxBackgroundProperty, value);
559
                OnPropertyChanged("TextBoxBackground");
560
            }
561
        }
562

    
563

    
564
        //강인구 추가 주석풀기
565
        public bool IsEditing
566
        {
567
            get { return (bool)GetValue(IsEditingProperty); }
568
            set
569
            {
570
                if (this.IsEditing != value)
571
                {
572
                    SetValue(IsEditingProperty, value);
573

    
574
                    OnPropertyChanged("IsEditing");
575

    
576
                }
577
            }
578
        }
579

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

    
593
        #endregion
594

    
595
        #region Dependency Properties
596

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
688

    
689

    
690
        //, new PropertyChangedCallback(TextChanged)
691

    
692

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

    
697

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

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

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

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

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

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

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

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

    
723
        public static readonly DependencyProperty IsEditingProperty = DependencyProperty.Register(
724
            "IsEditing", typeof(bool), typeof(ArrowTextControl), new PropertyMetadata((false), new PropertyChangedCallback(OnIsEditingChanged)));
725

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

    
729
        #endregion
730

    
731
        #endregion
732

    
733
        #region CallBack Method
734

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

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

    
744
                if (instance.EnableEditing)
745
                {
746
                    if (instance.IsEditing)
747
                    {
748
                        instance.EditingMode();
749
                    }
750
                    else
751
                    {
752
                        instance.UnEditingMode();
753
                    }
754
                }
755
                else
756
                {
757
                    instance.UnEditingMode();
758
                }
759
            }
760
        }
761

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

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

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

    
776
            if (e.OldValue != e.NewValue && instance.Base_ArrowPath != null)
777
            {
778
                instance.SetValue(e.Property, e.NewValue);
779
            }
780
        }
781

    
782
        public static void PointValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
783
        {
784
            var instance = (ArrowTextControl)sender;
785

    
786
            if (e.OldValue != e.NewValue && instance.Base_ArrowPath != null)
787
            {
788
                instance.SetArrowTextPath();
789
            }
790
        }
791

    
792

    
793

    
794
        public static void TextChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
795
        {
796
            var instance = (ArrowTextControl)sender;
797
            
798
            if (e.OldValue != e.NewValue)
799
            {
800
                instance.SetValue(e.Property, e.NewValue);
801
                //instance.BoxWidth = instance.Base_TextBox.ActualWidth;
802
                //instance.BoxHeight = instance.Base_TextBox.ActualHeight;
803
            }
804
        }
805

    
806
        public static void OnCenterXYChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
807
        {
808
            var instance = (ArrowTextControl)sender;
809
            if (e.OldValue != e.NewValue && instance.Base_ArrowPath != null)
810
            {
811
                instance.SetValue(e.Property, e.NewValue);
812
                instance.SetArrowTextPath();
813
            }
814
        }
815

    
816
        public static void OnSetCansvasChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
817
        {
818
            var instance = (ArrowTextControl)sender;
819

    
820
            if (e.OldValue != e.NewValue && instance != null)
821
            {
822
                instance.SetValue(e.Property, e.NewValue);
823
                //Canvas.SetLeft(instance, instance.CanvasX);
824
                //Canvas.SetTop(instance, instance.CanvasY);
825
            }
826
        }
827

    
828
        public static void IsSelectedChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
829
        {
830
            //var instance = (ArrowTextControl)sender;
831

    
832
            //if (e.OldValue != e.NewValue)
833
            //{
834
            //    instance.SetValue(e.Property, e.NewValue);
835

    
836
            //    if (instance.IsSelected && instance.Base_TextBox != null)
837
            //    {
838
            //        instance.BorderSize = new Thickness(1);
839
            //        //instance.Base_TextBox.BorderBrush = new SolidColorBrush(Colors.Blue);
840
            //        //instance.Base_ArrowPath.Stroke = new SolidColorBrush(Colors.Blue);
841
            //    }
842
            //    else
843
            //    {
844
            //        instance.BorderSize = new Thickness(0);
845
            //        //instance.Base_TextBox.BorderBrush = new SolidColorBrush(Colors.Transparent);
846
            //        //instance.Base_ArrowPath.Stroke = new SolidColorBrush(Colors.Transparent);
847
            //    }
848
            //}
849
        }
850
        #endregion
851

    
852
        #region Internal Method
853

    
854
        //강인구 주석 풀기
855
        public void EditingMode()
856
        {
857
            TextBoxVisibility = Visibility.Visible;
858
            TextBlockVisibility = Visibility.Collapsed;
859

    
860

    
861
            //강인구 언더라인 추가
862
            if (UnderLine != null)
863
                Base_TextBlock.TextDecorations = UnderLine;
864
        }
865
        //강인구 주석 풀기
866
        public void UnEditingMode()
867
        {
868

    
869
            TextBoxVisibility = Visibility.Collapsed;
870
            TextBlockVisibility = Visibility.Visible;
871

    
872
            if (UnderLine != null)
873
                Base_TextBlock.TextDecorations = UnderLine;
874

    
875
            Base_TextBlock.Margin =
876
                 new Thickness(Base_TextBox.Margin.Left + 4, Base_TextBox.Margin.Top + 4,
877
                     Base_TextBox.Margin.Right + 4, Base_TextBox.Margin.Bottom + 4);
878
        }
879

    
880

    
881
        #region 주석
882

    
883
        //        public void SetArrowTextPath()
884
        //        {
885
        //            instanceGroup.Children.Clear();
886

    
887
        //            instanceSubGroup = new PathGeometry();
888
        //            connectorSMGeometry.StartPoint = this.StartPoint;
889
        //            connectorSMGeometry.EndPoint = this.MidPoint;
890
        //            connectorMEGeometry.StartPoint = this.MidPoint; //핵심
891

    
892
        //            //Canvas.SetLeft(Base_TextBox, this.EndPoint.X - BoxWidth / 2);
893
        //            //Canvas.SetTop(Base_TextBox, this.EndPoint.Y - BoxHeight / 2);
894

    
895
        //            Canvas.SetLeft(Base_TextBox, this.EndPoint.X);
896
        //            Canvas.SetTop(Base_TextBox, this.EndPoint.Y);
897

    
898

    
899

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

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

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

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

    
909
        //            //ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth, Canvas.GetTop(Base_TextBox)));
910
        //            //ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)));
911
        //            //ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxHeight));
912
        //            //ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth, Canvas.GetTop(Base_TextBox) + this.BoxHeight));
913

    
914
        //            if (isTrans)
915
        //            {
916
        //                switch (Math.Abs(this.Angle).ToString())
917
        //                {
918
        //                    case "90":
919
        //                        {
920
        //                            ps.Clear();
921
        //                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽
922
        //                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth / 2)); // 위 중간
923
        //                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth)); // 위 오른쪽
924

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

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

    
931
        //                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) - this.BoxWidth)); //오른쪽 중간
932
        //                        }
933
        //                        break;
934
        //                    case "270":
935
        //                        {
936
        //                            ps.Clear();
937
        //                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽
938
        //                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth / 2)); // 위 중간
939
        //                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth)); // 위 오른쪽
940

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

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

    
947
        //                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) + this.BoxWidth)); //오른쪽 중간
948
        //                        }
949
        //                        break;
950
        //                    default:
951
        //                        break;
952
        //                }
953
        //                var endP = MathSet.getNearPoint(ps, this.MidPoint);
954

    
955
        //                connectorMEGeometry.EndPoint = endP;
956
        //                instanceGroup.Children.Add(SingleAllow(this.MidPoint, this.StartPoint, this.LineSize));
957
        //            }
958
        //            else
959
        //            {
960
        //                switch (Math.Abs(this.Angle).ToString())
961
        //                {
962
        //                    case "90":
963
        //                        {
964
        //                            ps.Clear();
965
        //                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽
966
        //                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth / 2)); // 위 중간
967
        //                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth)); // 위 오른쪽
968

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

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

    
975
        //                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) - this.BoxWidth)); //오른쪽 중간
976
        //                        }
977
        //                        break;
978
        //                    case "270":
979
        //                        {
980
        //                            ps.Clear();
981
        //                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽
982
        //                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth / 2)); // 위 중간
983
        //                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth)); // 위 오른쪽
984

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

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

    
991
        //                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) + this.BoxWidth)); //오른쪽 중간
992
        //                        }
993
        //                        break;
994
        //                    default:
995
        //                        break;
996
        //                }
997

    
998
        //                var endP = MathSet.getNearPoint(ps, this.MidPoint);
999
        //                connectorMEGeometry.EndPoint = endP; //최상단
1000

    
1001
        //                #region 보정치
1002

    
1003

    
1004
        //                //enP는 그 점
1005

    
1006
        //                //Point testP = new Point(endP.X-100,endP.Y);
1007
        //                Point testP = endP;
1008

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

    
1035
        //                //connectorSMGeometry.EndPoint = endP;
1036
        //                //connectorMEGeometry.StartPoint = endP;
1037
        //                instanceGroup.Children.Add(SingleAllow(testP, this.StartPoint, this.LineSize));
1038
        //                #endregion
1039
        //            }
1040

    
1041
        //            switch (this.ArrowTextStyle)
1042
        //            {
1043
        //                case ArrowTextStyleSet.Normal:
1044
        //                    this.BorderSize = new Thickness(0);
1045
        //                    break;
1046
        //                case ArrowTextStyleSet.Cloud:
1047
        //                    this.BorderSize = new Thickness(0);
1048
        //                    DrawingCloud();
1049
        //                    break;
1050
        //                default:
1051
        //                    this.BorderSize = new Thickness(3);
1052
        //                    break;
1053
        //            }
1054

    
1055
        //            if (isHighLight)
1056
        //            {
1057
        //                Base_TextBox.Background = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B));
1058
        //                Base_ArrowSubPath.Fill = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B));
1059

    
1060
        //            }
1061
        //            else
1062
        //            {
1063
        //                //Base_ArrowSubPath.Fill = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1064
        //                //Base_TextBox.Background = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1065
        //            }
1066

    
1067
        //            instanceGroup.Children.Add(connectorSMGeometry);
1068
        //            instanceGroup.Children.Add(connectorMEGeometry);
1069

    
1070
        //            this.Base_ArrowPath.Stroke = this.StrokeColor;
1071
        //            this.PathData = instanceGroup;
1072

    
1073
        //            Base_ArrowSubPath.Data = instanceSubGroup;
1074

    
1075
        //            var tempAngle = Math.Abs(this.Angle);
1076

    
1077
        //            if (tempAngle == Convert.ToDouble(90) || tempAngle == Convert.ToDouble(270))
1078
        //            {
1079
        //                this.RenderTransformOrigin = new Point(0.5, 0.5);
1080
        //                this.Base_ArrowPath.RenderTransformOrigin = new Point(0, 0);
1081
        //                this.Base_ArrowSubPath.RenderTransformOrigin = new Point(0, 0);
1082

    
1083
        //                Base_TextBox.RenderTransformOrigin = new Point(0, 0);
1084
        //            }
1085

    
1086
        //            Base_ArrowSubPath.RenderTransform = new RotateTransform
1087
        //            {
1088
        //                Angle = this.Angle,
1089
        //                CenterX = this.EndPoint.X,
1090
        //                CenterY = this.EndPoint.Y,
1091
        //            };
1092
        //        }
1093

    
1094
        //        public void updateControl()
1095
        //        {
1096
        //            this.StartPoint = new Point(this.PointSet[0].X, this.PointSet[0].Y);
1097
        //            this.MidPoint = new Point(this.PointSet[1].X, this.PointSet[1].Y);
1098
        //            this.EndPoint = new Point(this.PointSet[2].X, this.PointSet[2].Y);
1099
        //            //isTrans = true;
1100
        //        }
1101

    
1102
        //        private void DrawingCloud()
1103
        //        {
1104
        //            List<Point> pCloud = new List<Point>()
1105
        //            {
1106
        //#if SILVERLIGHT
1107
        //                new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1108
        //                new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight), //왼쪽 아래
1109
        //                new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth, Canvas.GetTop(Base_TextBox) + BoxHeight),
1110
        //                new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth, Canvas.GetTop(Base_TextBox)),
1111
        //                new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1112
        //#else
1113
        //                new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1114
        //                new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight), //왼쪽 아래
1115
        //                new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth, Canvas.GetTop(Base_TextBox) + BoxHeight),
1116
        //                new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth, Canvas.GetTop(Base_TextBox)),
1117
        //                new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1118

    
1119
        //                //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1120
        //                //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight-4), //왼쪽 아래
1121
        //                //new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth-1, Canvas.GetTop(Base_TextBox) + BoxHeight-4),
1122
        //                //new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth-1, Canvas.GetTop(Base_TextBox)),
1123
        //                //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1124
        //#endif
1125
        //            };
1126
        //            //instanceGroup.Children.Add(Generate(pCloud));
1127
        //            instanceSubGroup = (Generate(pCloud));
1128

    
1129
        //        } 
1130

    
1131
        #endregion
1132

    
1133
        public void SetArrowTextPath()
1134
        {
1135
            instanceGroup.Children.Clear();
1136

    
1137
            connectorSMGeometry.StartPoint = this.StartPoint;
1138
            connectorSMGeometry.EndPoint = this.MidPoint;
1139
            connectorMEGeometry.StartPoint = this.MidPoint; //핵심
1140
            //Canvas.SetLeft(Base_TextBox, this.EndPoint.X - BoxWidth / 2);
1141
            //Canvas.SetTop(Base_TextBox, this.EndPoint.Y - BoxHeight / 2);
1142

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

    
1153
            #region 정밀도 추가
1154
            //ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //상단
1155
            //ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth, Canvas.GetTop(Base_TextBox))); //상단
1156
            //ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxHeight)); //좌단
1157
            //ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth, Canvas.GetTop(Base_TextBox) + this.BoxHeight)); //상단 
1158
            #endregion
1159

    
1160

    
1161

    
1162

    
1163
            //ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth, Canvas.GetTop(Base_TextBox)));
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.BoxHeight));
1166
            //ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth, Canvas.GetTop(Base_TextBox) + this.BoxHeight));
1167

    
1168
            if (isTrans)
1169
            {
1170
                switch (Math.Abs(this.Angle).ToString())
1171
                {
1172
                    case "90":
1173
                        {
1174
                            ps.Clear();
1175
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽
1176
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth / 2)); // 위 중간
1177
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth)); // 위 오른쪽
1178

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

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

    
1185
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) - this.BoxWidth)); //오른쪽 중간
1186
                        }
1187
                        break;
1188
                    case "270":
1189
                        {
1190

    
1191
                            ps.Clear();
1192
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽
1193
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth / 2)); // 위 중간
1194
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth)); // 위 오른쪽
1195

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

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

    
1202
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) + this.BoxWidth)); //오른쪽 중간
1203
                        }
1204
                        break;
1205
                    default:
1206
                        break;
1207
                }
1208

    
1209
                
1210
                var endP = MathSet.getNearPoint(ps, this.MidPoint);
1211

    
1212
                connectorMEGeometry.EndPoint = endP;
1213

    
1214
                //20180911 LJY 꺾이는 부분 수정
1215
                Point testP = endP;
1216
                if (this.ArrowTextStyle == ArrowTextStyleSet.Cloud || this.ArrowTextStyle == ArrowTextStyleSet.Rect)
1217
                {
1218
                    switch (Math.Abs(this.Angle).ToString())
1219
                    {
1220
                        case "90":
1221
                            testP = new Point(endP.X + 50, endP.Y);
1222
                            break;
1223
                        case "270":
1224
                            testP = new Point(endP.X - 50, endP.Y);
1225
                            break;
1226
                    }
1227
                }
1228

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

    
1309

    
1310
                connectorSMGeometry.EndPoint = testP;
1311
                connectorMEGeometry.StartPoint = testP;
1312
                //20180910 LJY 각도에 따라.
1313

    
1314
                //instanceGroup.Children.Add(SingleAllow(this.MidPoint, this.StartPoint, this.LineSize));
1315
                instanceGroup.Children.Add(SingleAllow(testP, this.StartPoint, this.LineSize));
1316
            }
1317
            else
1318
            {
1319
                switch (Math.Abs(this.Angle).ToString())
1320
                {
1321
                    case "90":
1322
                        {
1323
                            ps.Clear();
1324

    
1325
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽
1326
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth / 2)); // 위 중간
1327
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth)); // 위 오른쪽
1328

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

    
1332
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox) - this.BoxWidth / 2)); //중간 하단
1333
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox) - this.BoxWidth)); //오른쪽 하단
1334
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) - this.BoxWidth)); //오른쪽 중간 
1335
                        }
1336
                        break;
1337
                    case "270":
1338
                        {
1339
                            ps.Clear();
1340
                            
1341
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽
1342
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth / 2)); // 위 중간
1343
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth)); // 위 오른쪽
1344

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

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

    
1351
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) + this.BoxWidth)); //오른쪽 중간 
1352
                        }
1353
                        break;
1354
                    default:
1355
                        break;
1356
                }
1357

    
1358

    
1359
                var endP = MathSet.getNearPoint(ps, this.MidPoint);
1360
                //connectorMEGeometry.EndPoint = endP;
1361
                //connectorMEGeometry.EndPoint = endP;
1362
                connectorMEGeometry.EndPoint = endP; //최상단
1363
                                                     //connectorMEGeometry.EndPoint = this.EndPoint; //핵심
1364
                                                     //this.MidPoint= MathSet.getMiddlePoint(this.StartPoint, endP);
1365
                #region 보정치
1366
                //enP는 그 점
1367
                //Point testP = new Point(endP.X-100,endP.Y);
1368

    
1369
                Point testP = endP;
1370
                
1371
                
1372
                //Point testP = new Point(endP.X, endP.Y - 50);
1373

    
1374
                /* 20180910 LJY TEST 주석
1375
                if (isFixed)
1376
                {
1377
                    if (ps[0] == endP) //상단
1378
                    {
1379
                        testP = new Point(endP.X, endP.Y - 50);
1380
                        //System.Diagnostics.Debug.WriteLine("상단");
1381
                    }
1382
                    else if (ps[1] == endP) //하단
1383
                    {
1384
                        testP = new Point(endP.X, endP.Y + 50);
1385
                        //System.Diagnostics.Debug.WriteLine("하단");
1386
                    }
1387
                    else if (ps[2] == endP) //좌단
1388
                    {
1389
                        testP = new Point(endP.X - 50, endP.Y);
1390
                        //System.Diagnostics.Debug.WriteLine("좌단");
1391
                    }
1392
                    else if (ps[3] == endP) //우단
1393
                    {
1394
                        testP = new Point(endP.X + 50, endP.Y);
1395
                        //System.Diagnostics.Debug.WriteLine("우단");
1396
                    }
1397
                }
1398
                */
1399

    
1400
                //20180910 LJY 각도에 따라.
1401
                switch (Math.Abs(this.Angle).ToString())
1402
                {
1403
                    case "90":
1404
                        if (isFixed)
1405
                        {
1406
                            if (ps[0] == endP) //상단
1407
                            {
1408
                                testP = new Point(endP.X - 50, endP.Y);
1409
                                //System.Diagnostics.Debug.WriteLine("상단"+ testP);
1410
                            }
1411
                            else if (ps[1] == endP) //하단
1412
                            {
1413
                                testP = new Point(endP.X + 50, endP.Y);
1414
                                //System.Diagnostics.Debug.WriteLine("하단"+ testP);
1415
                            }
1416
                            else if (ps[2] == endP) //좌단
1417
                            {
1418
                                testP = new Point(endP.X - 50, endP.Y);
1419
                                //System.Diagnostics.Debug.WriteLine("좌단"+ testP);
1420
                            }
1421
                            else if (ps[3] == endP) //우단
1422
                            {
1423
                                testP = new Point(endP.X + 50 , endP.Y);
1424
                                //System.Diagnostics.Debug.WriteLine("우단"+ testP);
1425
                            }
1426
                        }
1427
                        break;
1428
                    case "270":
1429
                        if (isFixed)
1430
                        {
1431
                            if (ps[0] == endP) //상단
1432
                            {
1433
                                testP = new Point(endP.X + 50, endP.Y);
1434
                                //System.Diagnostics.Debug.WriteLine("상단" + testP);
1435
                            }
1436
                            else if (ps[1] == endP) //하단
1437
                            {
1438
                                testP = new Point(endP.X - 50, endP.Y);
1439
                                //System.Diagnostics.Debug.WriteLine("하단" + testP);
1440
                            }
1441
                            else if (ps[2] == endP) //좌단
1442
                            {
1443
                                testP = new Point(endP.X + 50, endP.Y);
1444
                                //System.Diagnostics.Debug.WriteLine("좌단" + testP);
1445
                            }
1446
                            else if (ps[3] == endP) //우단
1447
                            {
1448
                                testP = new Point(endP.X + 50, endP.Y );
1449
                                //System.Diagnostics.Debug.WriteLine("우단" + testP);
1450
                            }
1451
                        }
1452
                        break;
1453
                    default:
1454
                        if (isFixed)
1455
                        {
1456
                            if (ps[0] == endP) //상단
1457
                            {
1458
                                testP = new Point(endP.X, endP.Y - 50);
1459
                                //System.Diagnostics.Debug.WriteLine("상단");
1460
                            }
1461
                            else if (ps[1] == endP) //하단
1462
                            {
1463
                                testP = new Point(endP.X, endP.Y + 50);
1464
                                //System.Diagnostics.Debug.WriteLine("하단");
1465
                            }
1466
                            else if (ps[2] == endP) //좌단
1467
                            {
1468
                                testP = new Point(endP.X - 50, endP.Y);
1469
                                //System.Diagnostics.Debug.WriteLine("좌단");
1470
                            }
1471
                            else if (ps[3] == endP) //우단
1472
                            {
1473
                                testP = new Point(endP.X + 50, endP.Y);
1474
                                //System.Diagnostics.Debug.WriteLine("우단");
1475
                            }
1476
                        }
1477
                        break;
1478
                }
1479
                  
1480

    
1481
                connectorSMGeometry.EndPoint = testP;
1482
                connectorMEGeometry.StartPoint = testP;
1483
                //connectorSMGeometry.EndPoint = endP;
1484
                //connectorMEGeometry.StartPoint = endP;
1485
                instanceGroup.Children.Add(SingleAllow(testP, this.StartPoint, this.LineSize));
1486
                #endregion
1487
            }
1488

    
1489
            switch (this.ArrowTextStyle)
1490
            {
1491
                case ArrowTextStyleSet.Normal:
1492
                    this.BorderSize = new Thickness(0);
1493
                    break;
1494
                case ArrowTextStyleSet.Cloud:
1495
                    this.BorderSize = new Thickness(0);
1496
                    DrawingCloud();
1497
                    break;
1498
                default:
1499
                    {
1500
                        this.BorderSize = new Thickness(3); //올라
1501
                        DrawingRect();
1502
                    }
1503

    
1504
                    break;
1505
            }
1506

    
1507
            if (isHighLight)
1508
            {
1509
                SubPathFill = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B));
1510
                BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B));
1511

    
1512
                //Base_ArrowSubPath.Fill = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B));
1513

    
1514
                TextBoxBackground = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B));
1515
                //Base_TextBox.Background = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B));
1516
            }
1517
            else
1518
            {
1519
                BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1520
                SubPathFill = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1521
                TextBoxBackground = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.1), Colors.White.R, Colors.White.G, Colors.White.B));
1522

    
1523
                //Base_ArrowSubPath.Fill = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1524
                //Base_TextBox.Background = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1525
            }
1526

    
1527
            instanceGroup.Children.Add(connectorSMGeometry);
1528
            instanceGroup.Children.Add(connectorMEGeometry);
1529

    
1530
            //이미 바인딩 되어있음
1531
            //this.Base_ArrowPath.Stroke = this.StrokeColor;
1532

    
1533
            this.PathData = instanceGroup;
1534
            OverViewPathData = PathData;
1535
            OverViewArrowText = ArrowText;
1536
            OverViewEndPoint = connectorMEGeometry.EndPoint;
1537
            OverViewStartPoint = connectorSMGeometry.StartPoint;
1538
            //OverViewText = Text;
1539

    
1540
            //Base_ArrowSubPath.Data = instanceSubGroup;
1541
            //Angle = Math.Abs(this.Angle);
1542
            var tempAngle = Math.Abs(this.Angle);
1543

    
1544
            if (tempAngle == Convert.ToDouble(90) || tempAngle == Convert.ToDouble(270))
1545
            {
1546
                ////this.Angle = 90;
1547

    
1548
                this.RenderTransformOrigin = new Point(0.5, 0.5);
1549
                this.Base_ArrowPath.RenderTransformOrigin = new Point(0, 0);
1550
                this.Base_ArrowSubPath.RenderTransformOrigin = new Point(0, 0);
1551

    
1552
                Base_TextBox.RenderTransformOrigin = new Point(0, 0);
1553

    
1554
            }
1555

    
1556
            Base_ArrowSubPath.RenderTransform = new RotateTransform
1557
            {
1558
                Angle = this.Angle,
1559
                CenterX = this.EndPoint.X,
1560
                CenterY = this.EndPoint.Y,
1561
            };
1562

    
1563
            //Base_ArrowPath.StrokeThickness = 3;
1564
            //Base_ArrowSubPath.StrokeThickness = 3;
1565

    
1566
        }
1567

    
1568
        private void DrawingCloud()
1569
        {
1570
            //20180906 LJY Textbox guide
1571
            string angle = Math.Abs(this.Angle).ToString();
1572
            if (angle == "180")
1573
            {
1574
                List<Point> pCloud = new List<Point>()
1575
                {
1576
                     new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1577
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - BoxHeight), //왼쪽 아래
1578
                    new Point(Canvas.GetLeft(Base_TextBox) - BoxWidth, Canvas.GetTop(Base_TextBox) - BoxHeight),
1579
                    new Point(Canvas.GetLeft(Base_TextBox) - BoxWidth, Canvas.GetTop(Base_TextBox)),
1580
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1581
                };
1582
                SubPathData = (Generate(pCloud));
1583
                PathDataInner = (GenerateInnerCloud(pCloud, angle));
1584
            
1585
            }//20180906 LJY Textbox guide
1586
            else
1587
            {            
1588
                List<Point> pCloud = new List<Point>()
1589
                {
1590
    #if SILVERLIGHT
1591
		            new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1592
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight), //왼쪽 아래
1593
                    new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth, Canvas.GetTop(Base_TextBox) + BoxHeight),
1594
                    new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth, Canvas.GetTop(Base_TextBox)),
1595
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1596

    
1597
    #else
1598
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1599
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight), //왼쪽 아래
1600
                    new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth, Canvas.GetTop(Base_TextBox) + BoxHeight),
1601
                    new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth, Canvas.GetTop(Base_TextBox)),
1602
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1603

    
1604
                    //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1605
                    //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight-4), //왼쪽 아래
1606
                    //new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth-1, Canvas.GetTop(Base_TextBox) + BoxHeight-4),
1607
                    //new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth-1, Canvas.GetTop(Base_TextBox)),
1608
                    //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1609
    #endif
1610
                };
1611
                //instanceGroup.Children.Add(Generate(pCloud));
1612
                SubPathData = (Generate(pCloud));
1613
                PathDataInner = (GenerateInnerCloud(pCloud, angle));
1614
                //   }
1615
            }
1616

    
1617
        }
1618

    
1619
        private void DrawingRect()
1620
        {
1621
            //20180906 LJY Textbox guide
1622

    
1623
            if (Math.Abs(this.Angle).ToString() == "90")
1624
            {
1625
                List<Point> pCloud = new List<Point>()
1626
                {
1627
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1628
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - BoxWidth), //왼쪽 아래
1629
                    new Point(Canvas.GetLeft(Base_TextBox) + BoxHeight, Canvas.GetTop(Base_TextBox) - BoxWidth),
1630
                    new Point(Canvas.GetLeft(Base_TextBox) + BoxHeight, Canvas.GetTop(Base_TextBox)),
1631
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1632
                };
1633
                PathDataInner = (GenerateInner(pCloud));
1634
            }
1635
            else if(Math.Abs(this.Angle).ToString() == "270")
1636
            {
1637
                List<Point> pCloud = new List<Point>()
1638
                {
1639
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1640
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + BoxWidth), //왼쪽 아래
1641
                    new Point(Canvas.GetLeft(Base_TextBox) - BoxHeight, Canvas.GetTop(Base_TextBox) + BoxWidth),
1642
                    new Point(Canvas.GetLeft(Base_TextBox) - BoxHeight, Canvas.GetTop(Base_TextBox)),
1643
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1644
                };
1645
                PathDataInner = (GenerateInner(pCloud));
1646
            }//20180906 LJY Textbox guide
1647
            else
1648
            { 
1649
                List<Point> pCloud = new List<Point>()
1650
                {
1651
    #if SILVERLIGHT
1652
		            new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1653
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight), //왼쪽 아래
1654
                    new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth, Canvas.GetTop(Base_TextBox) + BoxHeight),
1655
                    new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth, Canvas.GetTop(Base_TextBox)),
1656
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1657

    
1658
    #else
1659
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1660
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight), //왼쪽 아래
1661
                    new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth, Canvas.GetTop(Base_TextBox) + BoxHeight),
1662
                    new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth, Canvas.GetTop(Base_TextBox)),
1663
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1664

    
1665
                    //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1666
                    //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight-4), //왼쪽 아래
1667
                    //new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth-1, Canvas.GetTop(Base_TextBox) + BoxHeight-4),
1668
                    //new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth-1, Canvas.GetTop(Base_TextBox)),
1669
                    //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1670
    #endif
1671
                };
1672
                //instanceGroup.Children.Add(Generate(pCloud));
1673
                PathDataInner = (GenerateInner(pCloud));
1674
            }
1675
        }
1676

    
1677
        public void updateControl()
1678
        {
1679
            this.StartPoint = new Point(this.PointSet[0].X, this.PointSet[0].Y);
1680
            this.MidPoint = new Point(this.PointSet[1].X, this.PointSet[1].Y);
1681
            this.EndPoint = new Point(this.PointSet[2].X, this.PointSet[2].Y);
1682
            //isTrans = true;
1683
        }
1684

    
1685
        public void ApplyOverViewData()
1686
        {
1687
            this.OverViewPathData = this.PathData;
1688
            if (ArrowText == "")
1689
                this.ArrowText = this.OverViewArrowText;
1690
            else
1691
                this.OverViewArrowText = this.ArrowText;
1692
            this.OverViewStartPoint = this.StartPoint;
1693
            this.OverViewEndPoint = this.EndPoint;
1694
        }
1695

    
1696
        #endregion
1697

    
1698
        public static PathFigure GenerateLineWithCloud(Point p1, Point p2, double arcLength_, bool reverse)
1699
        {
1700
            PathFigure pathFigure = new PathFigure();
1701
            pathFigure.StartPoint = p1;
1702

    
1703
            double arcLength = arcLength_;
1704
            /// draw arcs which has arcLength between p1 and p2 - 2012.06.21 added by humkyung 
1705
            double dx = p2.X - p1.X;
1706
            double dy = p2.Y - p1.Y;
1707
            double l = MathSet.DistanceTo(p1, p2); /// distance between p1 and p2
1708
            double theta = Math.Atan2(Math.Abs(dy), Math.Abs(dx)) * 180 / Math.PI;
1709
            Point lastPt = new Point(p1.X, p1.Y);
1710
            double count = l / arcLength;
1711
            /// normalize
1712
            dx /= l;
1713
            dy /= l;
1714
            Double j = 1;
1715
            for (j = 1; j < (count - 1); j++) 
1716
            {
1717
                ArcSegment arcSeg = new ArcSegment();
1718
                arcSeg.Size = new Size(arcLength * _CloudArcDepth, arcLength * _CloudArcDepth);						/// x size and y size of arc
1719
                arcSeg.Point = new Point(p1.X + j * dx * arcLength, p1.Y + j * dy * arcLength);	/// end point of arc
1720
                lastPt = arcSeg.Point;  /// save last point
1721
                arcSeg.RotationAngle = theta + 90;
1722
                if (true == reverse) arcSeg.SweepDirection = SweepDirection.Clockwise;
1723
                pathFigure.Segments.Add(arcSeg);
1724
            }
1725

    
1726
            /// draw arc between last point and end point
1727
            if ((count > j) || (count > 0))
1728
            {
1729
                arcLength = MathSet.DistanceTo(lastPt, p2);
1730
                ArcSegment arcSeg = new ArcSegment();
1731
                arcSeg.Size = new Size(arcLength * _CloudArcDepth, arcLength * _CloudArcDepth);	/// x size and y size of arc
1732
                arcSeg.Point = new Point(p2.X, p2.Y);						/// end point of arc
1733
                arcSeg.RotationAngle = theta;
1734
                if (true == reverse) arcSeg.SweepDirection = SweepDirection.Clockwise;
1735
                pathFigure.Segments.Add(arcSeg);
1736
            }
1737
            /// up to here
1738

    
1739
            return pathFigure;
1740
        }
1741

    
1742
        public static PathGeometry Generate(List<Point> pData)
1743
        {
1744
            var _pathGeometry = new PathGeometry();
1745
            
1746
            double area = MathSet.AreaOf(pData);
1747
            bool reverse = (area > 0);
1748
            int count = pData.Count;
1749
            for (int i = 0; i < (count - 1); i++)
1750
            {
1751
                PathFigure pathFigure = GenerateLineWithCloud(pData[i], pData[i + 1], 20, reverse);
1752
                pathFigure.IsClosed = false;
1753
                pathFigure.IsFilled = true;
1754
                _pathGeometry.Figures.Add(pathFigure);
1755
            }
1756
            
1757
            return _pathGeometry;
1758
        }
1759

    
1760
        
1761
        public static PathGeometry GenerateInner(List<Point> pData)
1762
        {
1763
            var _pathGeometry = new PathGeometry();
1764
            double area = MathSet.AreaOf(pData);
1765
            bool reverse = (area > 0);
1766
            int count = pData.Count;
1767

    
1768
            PathFigure pathFigur2 = new PathFigure();
1769
            pathFigur2.StartPoint = pData[0];
1770

    
1771
            LineSegment lineSegment0 = new LineSegment();
1772
            lineSegment0.Point = pData[0];
1773
            pathFigur2.Segments.Add(lineSegment0);
1774

    
1775
            LineSegment lineSegment1 = new LineSegment();
1776
            lineSegment1.Point = pData[1];
1777
            pathFigur2.Segments.Add(lineSegment1);
1778

    
1779
            LineSegment lineSegment2 = new LineSegment();
1780
            lineSegment2.Point = pData[2];
1781
            pathFigur2.Segments.Add(lineSegment2);
1782

    
1783
            LineSegment lineSegment3 = new LineSegment();
1784
            lineSegment3.Point = pData[3];
1785
            pathFigur2.Segments.Add(lineSegment3);
1786

    
1787

    
1788
            pathFigur2.IsClosed = true;
1789
            pathFigur2.IsFilled = true;
1790
            _pathGeometry.Figures.Add(pathFigur2);           
1791

    
1792
            return _pathGeometry;
1793
        }
1794

    
1795
        //20180910 LJY Cloud rotation 추가
1796
        public static PathGeometry GenerateInnerCloud(List<Point> pData, string angle)
1797
        {
1798
            var _pathGeometry = new PathGeometry();
1799
            double area = MathSet.AreaOf(pData);
1800
            bool reverse = (area > 0);
1801
            int count = pData.Count;
1802

    
1803
            PathFigure pathFigur2 = new PathFigure();
1804
            pathFigur2.StartPoint = pData[0];
1805

    
1806
            LineSegment lineSegment0 = new LineSegment();
1807
            lineSegment0.Point = pData[0];
1808
            pathFigur2.Segments.Add(lineSegment0);
1809

    
1810
            LineSegment lineSegment1 = new LineSegment();
1811
            lineSegment1.Point = pData[1];
1812
            pathFigur2.Segments.Add(lineSegment1);
1813

    
1814
            LineSegment lineSegment2 = new LineSegment();
1815
            lineSegment2.Point = pData[2];
1816
            pathFigur2.Segments.Add(lineSegment2);
1817

    
1818
            LineSegment lineSegment3 = new LineSegment();
1819
            lineSegment3.Point = pData[3];
1820
            pathFigur2.Segments.Add(lineSegment3);
1821
            
1822
            RotateTransform transform = new RotateTransform();
1823
            switch (angle)
1824
            {
1825
                case "90":
1826
                    transform.Angle = -90;
1827
                    break;
1828
                case "180":
1829
                    transform.Angle = -180;
1830
                    break;
1831
                case "270":
1832
                    transform.Angle = -270;
1833
                    break;
1834
            }
1835
            transform.CenterX = pData[0].X;
1836
            transform.CenterY = pData[0].Y;
1837
            _pathGeometry.Transform = transform;
1838

    
1839
            pathFigur2.IsClosed = true;
1840
            pathFigur2.IsFilled = true;
1841
            _pathGeometry.Figures.Add(pathFigur2);
1842

    
1843
            return _pathGeometry;
1844
        }
1845
        public static PathGeometry SingleAllow(Point p2, Point p1, double lineSize)
1846
        {
1847
            double theta = Math.Atan2((p2.Y - p1.Y), (p2.X - p1.X)) * 180 / Math.PI;
1848
            PathGeometry pathGeometry = new PathGeometry();
1849
            PathFigure pathFigure = new PathFigure();
1850
            pathFigure.StartPoint = p1;
1851

    
1852
            Point lpoint = new Point(p1.X + lineSize * 2, p1.Y + lineSize * 4);
1853
            Point rpoint = new Point(p1.X - lineSize * 2, p1.Y + lineSize * 4);
1854

    
1855
            LineSegment seg1 = new LineSegment();
1856
            seg1.Point = lpoint;
1857
            pathFigure.Segments.Add(seg1);
1858

    
1859
            LineSegment seg2 = new LineSegment();
1860
            seg2.Point = rpoint;
1861
            pathFigure.Segments.Add(seg2);
1862

    
1863
            LineSegment seg3 = new LineSegment();
1864
            seg3.Point = p1;
1865
            pathFigure.Segments.Add(seg3);
1866

    
1867
            pathFigure.IsClosed = true;
1868
            pathFigure.IsFilled = true;
1869

    
1870
            pathGeometry.Figures.Add(pathFigure);
1871
            pathGeometry.FillRule = FillRule.Nonzero;
1872
            RotateTransform transform = new RotateTransform();
1873
            transform.Angle = theta - 90;
1874
            transform.CenterX = p1.X;
1875
            transform.CenterY = p1.Y;
1876
            pathGeometry.Transform = transform;
1877
            return pathGeometry;
1878
        }
1879

    
1880
        #region Dispose
1881
        public void Dispose()
1882
        {
1883
            GC.Collect();
1884
            GC.SuppressFinalize(this);
1885
        } 
1886
        #endregion
1887

    
1888
        #region INotifyPropertyChanged
1889
        private void OnPropertyChanged(string name)
1890
        {
1891
            if (PropertyChanged != null)
1892
            {
1893
                PropertyChanged(this, new PropertyChangedEventArgs(name));
1894
            }
1895
        }
1896

    
1897
        public event PropertyChangedEventHandler PropertyChanged; 
1898
        #endregion
1899
    }
1900
}
클립보드 이미지 추가 (최대 크기: 500 MB)