프로젝트

일반

사용자정보

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

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

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

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

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

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

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

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

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

    
46
        #endregion
47

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

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

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

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

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

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

    
87
        }
88

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

    
93
            this.IsEditingMode = false;
94

    
95
            ApplyOverViewData();
96
        }
97

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

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

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

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

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

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

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

    
143

    
144
        #endregion
145

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

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

    
175

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

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

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

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

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

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

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

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

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

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

    
269

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

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

    
288

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
418
                OnPropertyChanged("OverViewPathData");
419

    
420
            }
421
        }
422

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

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

    
449
        public string OverViewArrowText
450
        {
451

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

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

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

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

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

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

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

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

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

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

    
570

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

    
581
                    OnPropertyChanged("IsEditing");
582

    
583
                }
584
            }
585
        }
586

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

    
600
        #endregion
601

    
602
        #region Dependency Properties
603

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
695

    
696

    
697
        //, new PropertyChangedCallback(TextChanged)
698

    
699

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

    
704

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

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

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

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

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

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

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

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

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

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

    
736
        #endregion
737

    
738
        #endregion
739

    
740
        #region CallBack Method
741

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

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

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

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

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

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

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

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

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

    
799

    
800

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

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

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

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

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

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

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

    
859
        #region Internal Method
860

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

    
867

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

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

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

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

    
887

    
888
        #region 주석
889

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

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

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

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

    
905

    
906

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1008
        //                #region 보정치
1009

    
1010

    
1011
        //                //enP는 그 점
1012

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

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

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

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

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

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

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

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

    
1080
        //            Base_ArrowSubPath.Data = instanceSubGroup;
1081

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

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

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

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

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

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

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

    
1136
        //        } 
1137

    
1138
        #endregion
1139

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

    
1144
            connectorSMGeometry.StartPoint = this.StartPoint;
1145
            connectorSMGeometry.EndPoint = this.MidPoint;
1146
            connectorMEGeometry.StartPoint = this.MidPoint; //핵심
1147
            //Canvas.SetLeft(Base_TextBox, this.EndPoint.X - BoxWidth / 2);
1148
            //Canvas.SetTop(Base_TextBox, this.EndPoint.Y - BoxHeight / 2);
1149

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

    
1160
            #region 정밀도 추가
1161
            //ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //상단
1162
            //ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth, Canvas.GetTop(Base_TextBox))); //상단
1163
            //ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxHeight)); //좌단
1164
            //ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth, Canvas.GetTop(Base_TextBox) + this.BoxHeight)); //상단 
1165
            #endregion
1166

    
1167

    
1168

    
1169

    
1170
            //ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth, Canvas.GetTop(Base_TextBox)));
1171
            //ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)));
1172
            //ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxHeight));
1173
            //ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth, Canvas.GetTop(Base_TextBox) + this.BoxHeight));
1174

    
1175
            if (isTrans)
1176
            {
1177
                switch (Math.Abs(this.Angle).ToString())
1178
                {
1179
                    case "90":
1180
                        {
1181
                            ps.Clear();
1182
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽
1183
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth / 2)); // 위 중간
1184
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth)); // 위 오른쪽
1185

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

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

    
1192
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) - this.BoxWidth)); //오른쪽 중간
1193
                        }
1194
                        break;
1195
                    case "270":
1196
                        {
1197

    
1198
                            ps.Clear();
1199
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽
1200
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth / 2)); // 위 중간
1201
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth)); // 위 오른쪽
1202

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

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

    
1209
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) + this.BoxWidth)); //오른쪽 중간
1210
                        }
1211
                        break;
1212
                    default:
1213
                        break;
1214
                }
1215

    
1216
                
1217
                var endP = MathSet.getNearPoint(ps, this.MidPoint);
1218

    
1219
                
1220

    
1221
                //20180911 LJY 꺾이는 부분 수정
1222
                Point testP = endP;                
1223
                switch (Math.Abs(this.Angle).ToString())
1224
                {
1225
                    case "90":
1226
                        testP = new Point(endP.X + 50, endP.Y);
1227
                        break;
1228
                    case "270":
1229
                        testP = new Point(endP.X - 50, endP.Y);
1230
                        break;
1231
                }                
1232

    
1233
                //20180910 LJY 각도에 따라.
1234
                switch (Math.Abs(this.Angle).ToString())
1235
                {
1236
                    case "90":
1237
                        if (isFixed)
1238
                        {
1239
                            if (ps[0] == endP) //상단
1240
                            {
1241
                                testP = new Point(endP.X , endP.Y + 50);
1242
                                //System.Diagnostics.Debug.WriteLine("상단"+ testP);
1243
                            }
1244
                            else if (ps[1] == endP) //하단
1245
                            {
1246
                                testP = new Point(endP.X , endP.Y - 50);
1247
                                //System.Diagnostics.Debug.WriteLine("하단"+ testP);
1248
                            }
1249
                            else if (ps[2] == endP) //좌단
1250
                            {
1251
                                testP = new Point(endP.X - 50, endP.Y);
1252
                                //System.Diagnostics.Debug.WriteLine("좌단"+ testP);
1253
                            }
1254
                            else if (ps[3] == endP) //우단
1255
                            {
1256
                                testP = new Point(endP.X + 50, endP.Y);
1257
                                //System.Diagnostics.Debug.WriteLine("우단"+ testP);
1258
                            }
1259
                        }
1260
                        break;
1261
                    case "270":
1262
                        if (isFixed)
1263
                        {
1264
                            if (ps[0] == endP) //상단
1265
                            {
1266
                                testP = new Point(endP.X , endP.Y - 50);
1267
                                //System.Diagnostics.Debug.WriteLine("상단" + testP);
1268
                            }
1269
                            else if (ps[1] == endP) //하단
1270
                            {
1271
                                testP = new Point(endP.X, endP.Y + 50);
1272
                                //System.Diagnostics.Debug.WriteLine("하단" + testP);
1273
                            }
1274
                            else if (ps[2] == endP) //좌단
1275
                            {
1276
                                testP = new Point(endP.X + 50, endP.Y);
1277
                                //System.Diagnostics.Debug.WriteLine("좌단" + testP);
1278
                            }
1279
                            else if (ps[3] == endP) //우단
1280
                            {
1281
                                testP = new Point(endP.X - 50, endP.Y);
1282
                                //System.Diagnostics.Debug.WriteLine("우단" + testP);
1283
                            }
1284
                        }
1285
                        break;
1286
                    default:
1287
                        if (isFixed)
1288
                        {
1289
                            if (ps[0] == endP) //상단
1290
                            {
1291
                                testP = new Point(endP.X, endP.Y - 50);
1292
                                //System.Diagnostics.Debug.WriteLine("상단");
1293
                            }
1294
                            else if (ps[1] == endP) //하단
1295
                            {
1296
                                testP = new Point(endP.X, endP.Y + 50);
1297
                                //System.Diagnostics.Debug.WriteLine("하단");
1298
                            }
1299
                            else if (ps[2] == endP) //좌단
1300
                            {
1301
                                testP = new Point(endP.X - 50, endP.Y);
1302
                                //System.Diagnostics.Debug.WriteLine("좌단");
1303
                            }
1304
                            else if (ps[3] == endP) //우단
1305
                            {
1306
                                testP = new Point(endP.X + 50, endP.Y);
1307
                                //System.Diagnostics.Debug.WriteLine("우단");
1308
                            }
1309
                        }
1310
                        break;
1311
                }
1312
                connectorMEGeometry.EndPoint = endP;
1313
                connectorSMGeometry.EndPoint = testP;
1314
                connectorMEGeometry.StartPoint = testP;
1315
                
1316
                //20180910 LJY 각도에 따라.
1317
                this.MidPoint = testP;
1318
                //instanceGroup.Children.Add(SingleAllow(this.MidPoint, this.StartPoint, this.LineSize));
1319
                instanceGroup.Children.Add(DrawSet.DrawArrow(testP, this.StartPoint, this.LineSize));
1320
            }
1321
            else
1322
            {
1323
                switch (Math.Abs(this.Angle).ToString())
1324
                {
1325
                    case "90":
1326
                        {
1327
                            ps.Clear();
1328

    
1329
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽
1330
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth / 2)); // 위 중간
1331
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth)); // 위 오른쪽
1332

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

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

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

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

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

    
1362

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

    
1373
                Point testP = endP;
1374
                
1375
                
1376
                //Point testP = new Point(endP.X, endP.Y - 50);
1377

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

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

    
1485
                connectorSMGeometry.EndPoint = testP;
1486
                connectorMEGeometry.StartPoint = testP;
1487
                //connectorSMGeometry.EndPoint = endP;
1488
                //connectorMEGeometry.StartPoint = endP;
1489
                instanceGroup.Children.Add(DrawSet.DrawArrow(testP, this.StartPoint, this.LineSize));
1490
                #endregion
1491
            }
1492

    
1493
            switch (this.ArrowTextStyle)
1494
            {
1495
                case ArrowTextStyleSet.Normal:
1496
                    this.BorderSize = new Thickness(0);
1497
                    break;
1498
                case ArrowTextStyleSet.Cloud:
1499
                    this.BorderSize = new Thickness(0);
1500
                    DrawingCloud();
1501
                    break;
1502
                default:
1503
                    {
1504
                        this.BorderSize = new Thickness(LineSize); //올라
1505
                        DrawingRect();
1506
                    }
1507

    
1508
                    break;
1509
            }
1510

    
1511
            if (isHighLight)
1512
            {
1513
                SubPathFill = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B));
1514
                BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B));
1515

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

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

    
1527
                //Base_ArrowSubPath.Fill = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1528
                //Base_TextBox.Background = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1529
            }
1530

    
1531
            instanceGroup.Children.Add(connectorSMGeometry);
1532
            instanceGroup.Children.Add(connectorMEGeometry);
1533

    
1534
            //이미 바인딩 되어있음
1535
            //this.Base_ArrowPath.Stroke = this.StrokeColor;
1536

    
1537
            this.PathData = instanceGroup;
1538
            OverViewPathData = PathData;
1539
            OverViewArrowText = ArrowText;
1540
            OverViewEndPoint = connectorMEGeometry.EndPoint;
1541
            OverViewStartPoint = connectorSMGeometry.StartPoint;
1542
            //OverViewText = Text;
1543

    
1544
            //Base_ArrowSubPath.Data = instanceSubGroup;
1545
            //Angle = Math.Abs(this.Angle);
1546
            var tempAngle = Math.Abs(this.Angle);
1547

    
1548
            if (tempAngle == Convert.ToDouble(90) || tempAngle == Convert.ToDouble(270))
1549
            {
1550
                ////this.Angle = 90;
1551

    
1552
                this.RenderTransformOrigin = new Point(0.5, 0.5);
1553
                this.Base_ArrowPath.RenderTransformOrigin = new Point(0, 0);
1554
                this.Base_ArrowSubPath.RenderTransformOrigin = new Point(0, 0);
1555

    
1556
                Base_TextBox.RenderTransformOrigin = new Point(0, 0);
1557

    
1558
            }
1559

    
1560
            Base_ArrowSubPath.RenderTransform = new RotateTransform
1561
            {
1562
                Angle = this.Angle,
1563
                CenterX = this.EndPoint.X,
1564
                CenterY = this.EndPoint.Y,
1565
            };
1566

    
1567
            //Base_ArrowPath.StrokeThickness = 3;
1568
            //Base_ArrowSubPath.StrokeThickness = 3;
1569

    
1570
        }
1571

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

    
1601
    #else
1602
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1603
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight), //왼쪽 아래
1604
                    new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth, Canvas.GetTop(Base_TextBox) + BoxHeight),
1605
                    new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth, Canvas.GetTop(Base_TextBox)),
1606
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1607

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

    
1621
        }
1622

    
1623
        private void DrawingRect()
1624
        {
1625
            //20180906 LJY Textbox guide
1626

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

    
1662
    #else
1663
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1664
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight), //왼쪽 아래
1665
                    new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth, Canvas.GetTop(Base_TextBox) + BoxHeight),
1666
                    new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth, Canvas.GetTop(Base_TextBox)),
1667
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1668

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

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

    
1689
        public void ApplyOverViewData()
1690
        {
1691
            this.OverViewPathData = this.PathData;
1692
            if (ArrowText == "")
1693
                this.ArrowText = this.OverViewArrowText;
1694
            else
1695
                this.OverViewArrowText = this.ArrowText;
1696
            this.OverViewStartPoint = this.StartPoint;
1697
            this.OverViewEndPoint = this.EndPoint;
1698
        }
1699

    
1700
        #endregion
1701

    
1702
        public static PathFigure GenerateLineWithCloud(Point p1, Point p2, double arcLength_, bool reverse)
1703
        {
1704
            PathFigure pathFigure = new PathFigure();
1705
            pathFigure.StartPoint = p1;
1706

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

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

    
1743
            return pathFigure;
1744
        }
1745

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

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

    
1772
            PathFigure pathFigur2 = new PathFigure();
1773
            pathFigur2.StartPoint = pData[0];
1774

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

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

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

    
1787
            LineSegment lineSegment3 = new LineSegment();
1788
            lineSegment3.Point = pData[3];
1789
            pathFigur2.Segments.Add(lineSegment3);
1790

    
1791

    
1792
            pathFigur2.IsClosed = true;
1793
            pathFigur2.IsFilled = true;
1794
            _pathGeometry.Figures.Add(pathFigur2);           
1795

    
1796
            return _pathGeometry;
1797
        }
1798

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

    
1807
            PathFigure pathFigur2 = new PathFigure();
1808
            pathFigur2.StartPoint = pData[0];
1809

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

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

    
1818
            LineSegment lineSegment2 = new LineSegment();
1819
            lineSegment2.Point = pData[2];
1820
            pathFigur2.Segments.Add(lineSegment2);
1821

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

    
1843
            pathFigur2.IsClosed = true;
1844
            pathFigur2.IsFilled = true;
1845
            _pathGeometry.Figures.Add(pathFigur2);
1846

    
1847
            return _pathGeometry;
1848
        }
1849

    
1850
        /// <summary>
1851
        /// return ArrowTextControl's area
1852
        /// </summary>
1853
        /// <author>humkyung</author>
1854
        /// <date>2019.06.13</date>
1855
        public override Rect ItemRect
1856
        {
1857
            get
1858
            {
1859
                double dMinX = Math.Min(this.StartPoint.X, this.EndPoint.X);
1860
                double dMinY = Math.Min(this.StartPoint.Y, this.EndPoint.Y);
1861
                double dMaxX = Math.Max(this.StartPoint.X, this.EndPoint.X);
1862
                double dMaxY = Math.Max(this.StartPoint.Y, this.EndPoint.Y);
1863

    
1864
                return new Rect(new Point(dMinX, dMinY), new Point(dMaxX, dMaxY));
1865
            }
1866
        }
1867

    
1868
        /// <summary>
1869
        /// Serialize this
1870
        /// </summary>
1871
        /// <param name="sUserId"></param>
1872
        /// <returns></returns>
1873
        public override string Serialize()
1874
        {
1875
            using (S_ArrowTextControl STemp = new S_ArrowTextControl())
1876
            {
1877
                STemp.TransformPoint = "0|0";
1878
                STemp.PointSet = this.PointSet;
1879
                STemp.SizeSet = String.Format("{0}", this.LineSize);
1880
                STemp.StrokeColor = this.StrokeColor.Color.ToString();
1881
                STemp.StartPoint = this.StartPoint;
1882
                STemp.ArrowStyle = this.ArrowTextStyle;
1883
                //STemp.StrokeColor = "#FF00FF00";
1884
                STemp.UserID = this.UserID;
1885
                STemp.ArrowText = this.Base_TextBox.Text;
1886
                STemp.BorderSize = this.BorderSize;
1887
                STemp.isHighLight = this.isHighLight;
1888
                STemp.BoxHeight = this.BoxHeight;
1889
                STemp.BoxWidth = this.BoxWidth;
1890
                STemp.Opac = this.Opacity;
1891
                STemp.EndPoint = this.EndPoint;
1892
                STemp.isFixed = this.isFixed;
1893
                //STemp.DashSize = this.DashSize;
1894
                STemp.Name = this.GetType().Name.ToString();
1895
                STemp.isTrans = this.isTrans;
1896
                STemp.MidPoint = this.MidPoint;
1897
                STemp.Angle = this.Angle;
1898
                STemp.fontConfig = new List<string>()
1899
                            {
1900
                                this.TextFamily.ToString(),
1901
                                this.TextStyle.ToString(),
1902
                                this.TextWeight.ToString(),
1903
                                this.TextSize.ToString(),
1904
                            };
1905

    
1906
                if (this.UnderLine != null)
1907
                {
1908
                    STemp.fontConfig.Add("true");
1909
                }
1910

    
1911
                ///강인구 추가(2017.11.02)
1912
                ///Memo 추가
1913
                STemp.Memo = this.Memo;
1914
                STemp.BorderSize = this.BorderSize;
1915
                return "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize()));
1916
            };
1917
        }
1918

    
1919
        /// <summary>
1920
        /// create a arrowtextcontrol from given string
1921
        /// </summary>
1922
        /// <param name="str"></param>
1923
        /// <returns></returns>
1924
        public static ArrowTextControl FromString(string str, SolidColorBrush brush, string sProjectNo)
1925
        {
1926
            ArrowTextControl instance = null;
1927
            using (S_ArrowTextControl s = JsonSerializerHelper.JsonDeserialize<S_ArrowTextControl>(str))
1928
            {
1929
                string[] data2 = s.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
1930
                instance = new ArrowTextControl();
1931
                instance.LineSize = Convert.ToDouble(data2.First());
1932
                instance.PointSet = s.PointSet;
1933
                instance.StartPoint = s.StartPoint;
1934
                instance.EndPoint = s.EndPoint;
1935
                instance.StrokeColor = brush;
1936
                //instance.DashSize = s.DashSize;
1937
                instance.ArrowTextStyle = s.ArrowStyle;
1938
                instance.isHighLight = s.isHighLight;
1939
                instance.ArrowText = s.ArrowText;
1940
                instance.Opacity = s.Opac;
1941
                instance.BorderSize = s.BorderSize;
1942
                instance.BoxWidth = s.BoxWidth;
1943
                instance.BoxHeight = s.BoxHeight;
1944
                instance.isFixed = s.isFixed;
1945
                instance.Angle = s.Angle;
1946
                instance.UserID = s.UserID;
1947
                instance.isTrans = s.isTrans;
1948
                instance.MidPoint = s.MidPoint;
1949
                instance.Memo = s.Memo;
1950
                if (s.fontConfig == null || s.fontConfig.ToList().Count == 0)
1951
                {
1952
                    s.fontConfig = new List<string>();
1953

    
1954
                    s.fontConfig.Add("Arial");
1955
                    s.fontConfig.Add("Normal");
1956
                    s.fontConfig.Add("Normal");
1957
                    s.fontConfig.Add("30");
1958
                }
1959
                instance.TextFamily = new FontFamily(s.fontConfig[0]);
1960
                //인구 추가(2018.04.17)
1961
                instance.TextStyle = StringToFont.ConFontStyle(s.fontConfig[1]);
1962
                instance.TextWeight = StringToFont.ConFontWeight(s.fontConfig[2]);
1963
                instance.TextSize = Convert.ToDouble(s.fontConfig[3]);
1964

    
1965
                if (s.fontConfig.Count() == 5)
1966
                {
1967
                    instance.UnderLine = TextDecorations.Underline;
1968
                }
1969
            }
1970

    
1971
            return instance;
1972
        }
1973

    
1974
        #region Dispose
1975
        public void Dispose()
1976
        {
1977
            GC.Collect();
1978
            GC.SuppressFinalize(this);
1979
        } 
1980
        #endregion
1981

    
1982
        #region INotifyPropertyChanged
1983
        private void OnPropertyChanged(string name)
1984
        {
1985
            if (PropertyChanged != null)
1986
            {
1987
                PropertyChanged(this, new PropertyChangedEventArgs(name));
1988
            }
1989
        }
1990

    
1991
        public event PropertyChangedEventHandler PropertyChanged; 
1992
        #endregion
1993
    }
1994
}
클립보드 이미지 추가 (최대 크기: 500 MB)