프로젝트

일반

사용자정보

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

markus / MarkupToPDF / Controls / Text / ArrowTextControl.cs @ 05009a0e

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

1 787a4489 KangIngu
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 036650a0 humkyung
using MarkupToPDF.Serialize.Core;
15
using MarkupToPDF.Serialize.S_Control;
16 787a4489 KangIngu
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 53393bae KangIngu
        private const double _CloudArcDepth = 0.8;  /// 2018.05.14 added by humkyung
33
34 787a4489 KangIngu
        #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 b0fb3ad7 ljiyeon
            if (Base_TextBox.Text.Contains("|OR||DZ|"))
107
            {
108
                Base_TextBox.Text = this.ArrowText;
109
            }
110
111 787a4489 KangIngu
            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 4913851c humkyung
        public override SolidColorBrush StrokeColor
177 787a4489 KangIngu
        {
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 959b3ef2 humkyung
        public override bool IsSelected
220 787a4489 KangIngu
        {
221
            get
222
            {
223
                return (bool)GetValue(IsSelectedProperty);
224
            }
225
            set
226
            {
227
                SetValue(IsSelectedProperty, value);
228
                OnPropertyChanged("IsSelected");
229
            }
230
        }
231
232 5529d2a2 humkyung
        public override ControlType ControlType
233 787a4489 KangIngu
        {
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 f8769f8a ljiyeon
                "BorderSize", typeof(Thickness), typeof(ArrowTextControl), new PropertyMetadata(new Thickness(0), PointValueChanged));
691 787a4489 KangIngu
    
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 661b7416 humkyung
        private void SetArrowTextPath()
1141 787a4489 KangIngu
        {
1142
            instanceGroup.Children.Clear();
1143
1144
            connectorSMGeometry.StartPoint = this.StartPoint;
1145
            connectorSMGeometry.EndPoint = this.MidPoint;
1146
            connectorMEGeometry.StartPoint = this.MidPoint; //핵심
1147 ca40e004 ljiyeon
1148 787a4489 KangIngu
            Canvas.SetLeft(Base_TextBox, this.EndPoint.X);
1149
            Canvas.SetTop(Base_TextBox, this.EndPoint.Y);
1150 ca40e004 ljiyeon
             
1151 787a4489 KangIngu
            List<Point> ps = new List<Point>();
1152
            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth / 2, Canvas.GetTop(Base_TextBox))); //상단
1153
            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth / 2, Canvas.GetTop(Base_TextBox) + this.BoxHeight)); // 하단
1154
            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxHeight / 2)); //좌단
1155
            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth, Canvas.GetTop(Base_TextBox) + this.BoxHeight / 2));  //우단
1156
1157
            if (isTrans)
1158
            {
1159
                switch (Math.Abs(this.Angle).ToString())
1160
                {
1161
                    case "90":
1162
                        {
1163
                            ps.Clear();
1164
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽
1165
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth / 2)); // 위 중간
1166
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth)); // 위 오른쪽
1167
1168
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight / 2, Canvas.GetTop(Base_TextBox))); //왼쪽 중간
1169
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox))); //왼쪽 하단
1170
1171
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox) - this.BoxWidth / 2)); //중간 하단
1172
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox) - this.BoxWidth)); //오른쪽 하단
1173
1174
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) - this.BoxWidth)); //오른쪽 중간
1175
                        }
1176
                        break;
1177
                    case "270":
1178
                        {
1179 ca40e004 ljiyeon
1180 787a4489 KangIngu
                            ps.Clear();
1181
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽
1182
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth / 2)); // 위 중간
1183
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth)); // 위 오른쪽
1184
1185
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight / 2, Canvas.GetTop(Base_TextBox))); //왼쪽 중간
1186
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight, Canvas.GetTop(Base_TextBox))); //왼쪽 하단
1187
1188
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight, Canvas.GetTop(Base_TextBox) + this.BoxWidth / 2)); //중간 하단
1189
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight, Canvas.GetTop(Base_TextBox) + this.BoxWidth)); //오른쪽 하단
1190
1191
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) + this.BoxWidth)); //오른쪽 중간
1192
                        }
1193
                        break;
1194
                    default:
1195
                        break;
1196
                }
1197 ca40e004 ljiyeon
                
1198 787a4489 KangIngu
                var endP = MathSet.getNearPoint(ps, this.MidPoint);
1199
1200 ca40e004 ljiyeon
                //20180911 LJY 꺾이는 부분 수정
1201 6c122a60 ljiyeon
                Point testP = endP;                
1202
                switch (Math.Abs(this.Angle).ToString())
1203 ca40e004 ljiyeon
                {
1204 6c122a60 ljiyeon
                    case "90":
1205
                        testP = new Point(endP.X + 50, endP.Y);
1206
                        break;
1207
                    case "270":
1208
                        testP = new Point(endP.X - 50, endP.Y);
1209
                        break;
1210
                }                
1211 ca40e004 ljiyeon
1212
                //20180910 LJY 각도에 따라.
1213
                switch (Math.Abs(this.Angle).ToString())
1214
                {
1215
                    case "90":
1216
                        if (isFixed)
1217
                        {
1218
                            if (ps[0] == endP) //상단
1219
                            {
1220
                                testP = new Point(endP.X , endP.Y + 50);
1221
                                //System.Diagnostics.Debug.WriteLine("상단"+ testP);
1222
                            }
1223
                            else if (ps[1] == endP) //하단
1224
                            {
1225
                                testP = new Point(endP.X , endP.Y - 50);
1226
                                //System.Diagnostics.Debug.WriteLine("하단"+ testP);
1227
                            }
1228
                            else if (ps[2] == endP) //좌단
1229
                            {
1230
                                testP = new Point(endP.X - 50, endP.Y);
1231
                                //System.Diagnostics.Debug.WriteLine("좌단"+ testP);
1232
                            }
1233
                            else if (ps[3] == endP) //우단
1234
                            {
1235
                                testP = new Point(endP.X + 50, endP.Y);
1236
                                //System.Diagnostics.Debug.WriteLine("우단"+ testP);
1237
                            }
1238
                        }
1239
                        break;
1240
                    case "270":
1241
                        if (isFixed)
1242
                        {
1243
                            if (ps[0] == endP) //상단
1244
                            {
1245
                                testP = new Point(endP.X , endP.Y - 50);
1246
                                //System.Diagnostics.Debug.WriteLine("상단" + testP);
1247
                            }
1248
                            else if (ps[1] == endP) //하단
1249
                            {
1250
                                testP = new Point(endP.X, endP.Y + 50);
1251
                                //System.Diagnostics.Debug.WriteLine("하단" + testP);
1252
                            }
1253
                            else if (ps[2] == endP) //좌단
1254
                            {
1255
                                testP = new Point(endP.X + 50, endP.Y);
1256
                                //System.Diagnostics.Debug.WriteLine("좌단" + testP);
1257
                            }
1258
                            else if (ps[3] == endP) //우단
1259
                            {
1260
                                testP = new Point(endP.X - 50, endP.Y);
1261
                                //System.Diagnostics.Debug.WriteLine("우단" + testP);
1262
                            }
1263
                        }
1264
                        break;
1265
                    default:
1266
                        if (isFixed)
1267
                        {
1268
                            if (ps[0] == endP) //상단
1269
                            {
1270
                                testP = new Point(endP.X, endP.Y - 50);
1271
                                //System.Diagnostics.Debug.WriteLine("상단");
1272
                            }
1273
                            else if (ps[1] == endP) //하단
1274
                            {
1275
                                testP = new Point(endP.X, endP.Y + 50);
1276
                                //System.Diagnostics.Debug.WriteLine("하단");
1277
                            }
1278
                            else if (ps[2] == endP) //좌단
1279
                            {
1280
                                testP = new Point(endP.X - 50, endP.Y);
1281
                                //System.Diagnostics.Debug.WriteLine("좌단");
1282
                            }
1283
                            else if (ps[3] == endP) //우단
1284
                            {
1285
                                testP = new Point(endP.X + 50, endP.Y);
1286
                                //System.Diagnostics.Debug.WriteLine("우단");
1287
                            }
1288
                        }
1289
                        break;
1290
                }
1291 f9d42594 djkim
                connectorMEGeometry.EndPoint = endP;
1292 ca40e004 ljiyeon
                connectorSMGeometry.EndPoint = testP;
1293
                connectorMEGeometry.StartPoint = testP;
1294 f9d42594 djkim
                
1295 ca40e004 ljiyeon
                //20180910 LJY 각도에 따라.
1296 f9d42594 djkim
                this.MidPoint = testP;
1297 d251456f humkyung
                instanceGroup.Children.Add(DrawSet.DrawArrow(testP, this.StartPoint, this.LineSize));
1298 787a4489 KangIngu
            }
1299
            else
1300
            {
1301
                switch (Math.Abs(this.Angle).ToString())
1302
                {
1303
                    case "90":
1304
                        {
1305
                            ps.Clear();
1306 ca40e004 ljiyeon
1307 787a4489 KangIngu
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽
1308
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth / 2)); // 위 중간
1309
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth)); // 위 오른쪽
1310
1311
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight / 2, Canvas.GetTop(Base_TextBox))); //왼쪽 중간
1312
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox))); //왼쪽 하단
1313
1314
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox) - this.BoxWidth / 2)); //중간 하단
1315
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox) - this.BoxWidth)); //오른쪽 하단
1316 ca40e004 ljiyeon
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) - this.BoxWidth)); //오른쪽 중간 
1317 787a4489 KangIngu
                        }
1318
                        break;
1319
                    case "270":
1320
                        {
1321
                            ps.Clear();
1322 ca40e004 ljiyeon
                            
1323 787a4489 KangIngu
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽
1324
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth / 2)); // 위 중간
1325
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth)); // 위 오른쪽
1326
1327
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight / 2, Canvas.GetTop(Base_TextBox))); //왼쪽 중간
1328
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight, Canvas.GetTop(Base_TextBox))); //왼쪽 하단
1329
1330
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight, Canvas.GetTop(Base_TextBox) + this.BoxWidth / 2)); //중간 하단
1331
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight, Canvas.GetTop(Base_TextBox) + this.BoxWidth)); //오른쪽 하단
1332
1333 ca40e004 ljiyeon
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) + this.BoxWidth)); //오른쪽 중간 
1334 787a4489 KangIngu
                        }
1335
                        break;
1336
                    default:
1337
                        break;
1338
                }
1339
1340
1341
                var endP = MathSet.getNearPoint(ps, this.MidPoint);
1342
                connectorMEGeometry.EndPoint = endP; //최상단
1343 ca40e004 ljiyeon
                                                     //connectorMEGeometry.EndPoint = this.EndPoint; //핵심
1344
                                                     //this.MidPoint= MathSet.getMiddlePoint(this.StartPoint, endP);
1345 787a4489 KangIngu
                #region 보정치
1346 ca40e004 ljiyeon
                Point testP = endP;
1347
1348
                //20180910 LJY 각도에 따라.
1349
                switch (Math.Abs(this.Angle).ToString())
1350
                {
1351
                    case "90":
1352
                        if (isFixed)
1353
                        {
1354
                            if (ps[0] == endP) //상단
1355
                            {
1356
                                testP = new Point(endP.X - 50, endP.Y);
1357
                                //System.Diagnostics.Debug.WriteLine("상단"+ testP);
1358
                            }
1359
                            else if (ps[1] == endP) //하단
1360
                            {
1361
                                testP = new Point(endP.X + 50, endP.Y);
1362
                                //System.Diagnostics.Debug.WriteLine("하단"+ testP);
1363
                            }
1364
                            else if (ps[2] == endP) //좌단
1365
                            {
1366
                                testP = new Point(endP.X - 50, endP.Y);
1367
                                //System.Diagnostics.Debug.WriteLine("좌단"+ testP);
1368
                            }
1369
                            else if (ps[3] == endP) //우단
1370
                            {
1371
                                testP = new Point(endP.X + 50 , endP.Y);
1372
                                //System.Diagnostics.Debug.WriteLine("우단"+ testP);
1373
                            }
1374
                        }
1375
                        break;
1376
                    case "270":
1377
                        if (isFixed)
1378
                        {
1379
                            if (ps[0] == endP) //상단
1380
                            {
1381
                                testP = new Point(endP.X + 50, endP.Y);
1382
                                //System.Diagnostics.Debug.WriteLine("상단" + testP);
1383
                            }
1384
                            else if (ps[1] == endP) //하단
1385
                            {
1386
                                testP = new Point(endP.X - 50, endP.Y);
1387
                                //System.Diagnostics.Debug.WriteLine("하단" + testP);
1388
                            }
1389
                            else if (ps[2] == endP) //좌단
1390
                            {
1391
                                testP = new Point(endP.X + 50, endP.Y);
1392
                                //System.Diagnostics.Debug.WriteLine("좌단" + testP);
1393
                            }
1394
                            else if (ps[3] == endP) //우단
1395
                            {
1396
                                testP = new Point(endP.X + 50, endP.Y );
1397
                                //System.Diagnostics.Debug.WriteLine("우단" + testP);
1398
                            }
1399
                        }
1400
                        break;
1401
                    default:
1402
                        if (isFixed)
1403
                        {
1404
                            if (ps[0] == endP) //상단
1405
                            {
1406
                                testP = new Point(endP.X, endP.Y - 50);
1407
                                //System.Diagnostics.Debug.WriteLine("상단");
1408
                            }
1409
                            else if (ps[1] == endP) //하단
1410
                            {
1411
                                testP = new Point(endP.X, endP.Y + 50);
1412
                                //System.Diagnostics.Debug.WriteLine("하단");
1413
                            }
1414
                            else if (ps[2] == endP) //좌단
1415
                            {
1416
                                testP = new Point(endP.X - 50, endP.Y);
1417
                                //System.Diagnostics.Debug.WriteLine("좌단");
1418
                            }
1419
                            else if (ps[3] == endP) //우단
1420
                            {
1421
                                testP = new Point(endP.X + 50, endP.Y);
1422
                                //System.Diagnostics.Debug.WriteLine("우단");
1423
                            }
1424
                        }
1425
                        break;
1426
                }
1427
                  
1428
1429 787a4489 KangIngu
                connectorSMGeometry.EndPoint = testP;
1430
                connectorMEGeometry.StartPoint = testP;
1431 d251456f humkyung
                instanceGroup.Children.Add(DrawSet.DrawArrow(testP, this.StartPoint, this.LineSize));
1432 787a4489 KangIngu
                #endregion
1433
            }
1434
1435
            switch (this.ArrowTextStyle)
1436
            {
1437
                case ArrowTextStyleSet.Normal:
1438
                    this.BorderSize = new Thickness(0);
1439 05009a0e ljiyeon
                    DrawingRect();
1440 787a4489 KangIngu
                    break;
1441
                case ArrowTextStyleSet.Cloud:
1442
                    this.BorderSize = new Thickness(0);
1443
                    DrawingCloud();
1444
                    break;
1445
                default:
1446
                    {
1447 f8769f8a ljiyeon
                        this.BorderSize = new Thickness(LineSize); //올라
1448 787a4489 KangIngu
                        DrawingRect();
1449
                    }
1450
1451
                    break;
1452
            }
1453
1454
            if (isHighLight)
1455
            {
1456
                SubPathFill = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B));
1457
                BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B));
1458
1459
                TextBoxBackground = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B));
1460
            }
1461
            else
1462
            {
1463
                BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1464
                SubPathFill = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
1465
                TextBoxBackground = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.1), Colors.White.R, Colors.White.G, Colors.White.B));
1466
            }
1467
1468
            instanceGroup.Children.Add(connectorSMGeometry);
1469
            instanceGroup.Children.Add(connectorMEGeometry);
1470
1471
            this.PathData = instanceGroup;
1472
            OverViewPathData = PathData;
1473
            OverViewArrowText = ArrowText;
1474
            OverViewEndPoint = connectorMEGeometry.EndPoint;
1475
            OverViewStartPoint = connectorSMGeometry.StartPoint;
1476
1477
            var tempAngle = Math.Abs(this.Angle);
1478
1479
            if (tempAngle == Convert.ToDouble(90) || tempAngle == Convert.ToDouble(270))
1480
            {
1481
                this.RenderTransformOrigin = new Point(0.5, 0.5);
1482
                this.Base_ArrowPath.RenderTransformOrigin = new Point(0, 0);
1483
                this.Base_ArrowSubPath.RenderTransformOrigin = new Point(0, 0);
1484
1485
                Base_TextBox.RenderTransformOrigin = new Point(0, 0);
1486
            }
1487
1488
            Base_ArrowSubPath.RenderTransform = new RotateTransform
1489
            {
1490
                Angle = this.Angle,
1491
                CenterX = this.EndPoint.X,
1492
                CenterY = this.EndPoint.Y,
1493
            };
1494
        }
1495
1496
        private void DrawingCloud()
1497
        {
1498 ca40e004 ljiyeon
            //20180906 LJY Textbox guide
1499
            string angle = Math.Abs(this.Angle).ToString();
1500
            if (angle == "180")
1501 787a4489 KangIngu
            {
1502 ca40e004 ljiyeon
                List<Point> pCloud = new List<Point>()
1503
                {
1504
                     new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1505
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - BoxHeight), //왼쪽 아래
1506
                    new Point(Canvas.GetLeft(Base_TextBox) - BoxWidth, Canvas.GetTop(Base_TextBox) - BoxHeight),
1507
                    new Point(Canvas.GetLeft(Base_TextBox) - BoxWidth, Canvas.GetTop(Base_TextBox)),
1508
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1509
                };
1510
                SubPathData = (Generate(pCloud));
1511
                PathDataInner = (GenerateInnerCloud(pCloud, angle));
1512
            
1513
            }//20180906 LJY Textbox guide
1514
            else
1515
            {            
1516
                List<Point> pCloud = new List<Point>()
1517
                {
1518
    #if SILVERLIGHT
1519
		            new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1520
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight), //왼쪽 아래
1521
                    new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth, Canvas.GetTop(Base_TextBox) + BoxHeight),
1522
                    new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth, Canvas.GetTop(Base_TextBox)),
1523
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1524
1525
    #else
1526
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1527
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight), //왼쪽 아래
1528
                    new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth, Canvas.GetTop(Base_TextBox) + BoxHeight),
1529
                    new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth, Canvas.GetTop(Base_TextBox)),
1530
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1531
1532
                    //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1533
                    //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight-4), //왼쪽 아래
1534
                    //new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth-1, Canvas.GetTop(Base_TextBox) + BoxHeight-4),
1535
                    //new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth-1, Canvas.GetTop(Base_TextBox)),
1536
                    //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1537
    #endif
1538
                };
1539
                //instanceGroup.Children.Add(Generate(pCloud));
1540
                SubPathData = (Generate(pCloud));
1541
                PathDataInner = (GenerateInnerCloud(pCloud, angle));
1542
                //   }
1543
            }
1544
1545 787a4489 KangIngu
        }
1546
1547
        private void DrawingRect()
1548
        {
1549 ca40e004 ljiyeon
            //20180906 LJY Textbox guide
1550 05009a0e ljiyeon
            if(this.ArrowTextStyle == ArrowTextStyleSet.Normal)
1551
            {
1552
                this.Base_TextBox.BorderBrush = Brushes.Transparent;
1553
            }
1554 ca40e004 ljiyeon
            if (Math.Abs(this.Angle).ToString() == "90")
1555 787a4489 KangIngu
            {
1556 ca40e004 ljiyeon
                List<Point> pCloud = new List<Point>()
1557
                {
1558
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1559
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - BoxWidth), //왼쪽 아래
1560
                    new Point(Canvas.GetLeft(Base_TextBox) + BoxHeight, Canvas.GetTop(Base_TextBox) - BoxWidth),
1561
                    new Point(Canvas.GetLeft(Base_TextBox) + BoxHeight, Canvas.GetTop(Base_TextBox)),
1562
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1563
                };
1564
                PathDataInner = (GenerateInner(pCloud));
1565
            }
1566
            else if(Math.Abs(this.Angle).ToString() == "270")
1567
            {
1568
                List<Point> pCloud = new List<Point>()
1569
                {
1570
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1571
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + BoxWidth), //왼쪽 아래
1572
                    new Point(Canvas.GetLeft(Base_TextBox) - BoxHeight, Canvas.GetTop(Base_TextBox) + BoxWidth),
1573
                    new Point(Canvas.GetLeft(Base_TextBox) - BoxHeight, Canvas.GetTop(Base_TextBox)),
1574
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1575
                };
1576
                PathDataInner = (GenerateInner(pCloud));
1577
            }//20180906 LJY Textbox guide
1578
            else
1579
            { 
1580
                List<Point> pCloud = new List<Point>()
1581
                {
1582
    #if SILVERLIGHT
1583
		            new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1584
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight), //왼쪽 아래
1585
                    new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth, Canvas.GetTop(Base_TextBox) + BoxHeight),
1586
                    new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth, Canvas.GetTop(Base_TextBox)),
1587
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1588
1589
    #else
1590
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1591
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight), //왼쪽 아래
1592
                    new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth, Canvas.GetTop(Base_TextBox) + BoxHeight),
1593
                    new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth, Canvas.GetTop(Base_TextBox)),
1594
                    new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위  
1595
1596
                    //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1597
                    //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight-4), //왼쪽 아래
1598
                    //new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth-1, Canvas.GetTop(Base_TextBox) + BoxHeight-4),
1599
                    //new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth-1, Canvas.GetTop(Base_TextBox)),
1600
                    //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
1601
    #endif
1602
                };
1603
                //instanceGroup.Children.Add(Generate(pCloud));
1604
                PathDataInner = (GenerateInner(pCloud));
1605
            }
1606 787a4489 KangIngu
        }
1607
1608
        public void updateControl()
1609
        {
1610
            this.StartPoint = new Point(this.PointSet[0].X, this.PointSet[0].Y);
1611
            this.MidPoint = new Point(this.PointSet[1].X, this.PointSet[1].Y);
1612
            this.EndPoint = new Point(this.PointSet[2].X, this.PointSet[2].Y);
1613
            //isTrans = true;
1614
        }
1615
1616
        public void ApplyOverViewData()
1617
        {
1618
            this.OverViewPathData = this.PathData;
1619
            if (ArrowText == "")
1620
                this.ArrowText = this.OverViewArrowText;
1621
            else
1622
                this.OverViewArrowText = this.ArrowText;
1623
            this.OverViewStartPoint = this.StartPoint;
1624
            this.OverViewEndPoint = this.EndPoint;
1625
        }
1626
1627
        #endregion
1628
1629
        public static PathFigure GenerateLineWithCloud(Point p1, Point p2, double arcLength_, bool reverse)
1630
        {
1631
            PathFigure pathFigure = new PathFigure();
1632
            pathFigure.StartPoint = p1;
1633
1634
            double arcLength = arcLength_;
1635
            /// draw arcs which has arcLength between p1 and p2 - 2012.06.21 added by humkyung 
1636
            double dx = p2.X - p1.X;
1637
            double dy = p2.Y - p1.Y;
1638
            double l = MathSet.DistanceTo(p1, p2); /// distance between p1 and p2
1639
            double theta = Math.Atan2(Math.Abs(dy), Math.Abs(dx)) * 180 / Math.PI;
1640
            Point lastPt = new Point(p1.X, p1.Y);
1641
            double count = l / arcLength;
1642
            /// normalize
1643
            dx /= l;
1644
            dy /= l;
1645
            Double j = 1;
1646 ca40e004 ljiyeon
            for (j = 1; j < (count - 1); j++) 
1647 787a4489 KangIngu
            {
1648
                ArcSegment arcSeg = new ArcSegment();
1649 53393bae KangIngu
                arcSeg.Size = new Size(arcLength * _CloudArcDepth, arcLength * _CloudArcDepth);						/// x size and y size of arc
1650 787a4489 KangIngu
                arcSeg.Point = new Point(p1.X + j * dx * arcLength, p1.Y + j * dy * arcLength);	/// end point of arc
1651
                lastPt = arcSeg.Point;  /// save last point
1652
                arcSeg.RotationAngle = theta + 90;
1653
                if (true == reverse) arcSeg.SweepDirection = SweepDirection.Clockwise;
1654
                pathFigure.Segments.Add(arcSeg);
1655
            }
1656
1657
            /// draw arc between last point and end point
1658
            if ((count > j) || (count > 0))
1659
            {
1660
                arcLength = MathSet.DistanceTo(lastPt, p2);
1661
                ArcSegment arcSeg = new ArcSegment();
1662 53393bae KangIngu
                arcSeg.Size = new Size(arcLength * _CloudArcDepth, arcLength * _CloudArcDepth);	/// x size and y size of arc
1663 787a4489 KangIngu
                arcSeg.Point = new Point(p2.X, p2.Y);						/// end point of arc
1664
                arcSeg.RotationAngle = theta;
1665
                if (true == reverse) arcSeg.SweepDirection = SweepDirection.Clockwise;
1666
                pathFigure.Segments.Add(arcSeg);
1667
            }
1668
            /// up to here
1669
1670
            return pathFigure;
1671
        }
1672
1673
        public static PathGeometry Generate(List<Point> pData)
1674
        {
1675
            var _pathGeometry = new PathGeometry();
1676 ca40e004 ljiyeon
            
1677 787a4489 KangIngu
            double area = MathSet.AreaOf(pData);
1678
            bool reverse = (area > 0);
1679
            int count = pData.Count;
1680
            for (int i = 0; i < (count - 1); i++)
1681
            {
1682
                PathFigure pathFigure = GenerateLineWithCloud(pData[i], pData[i + 1], 20, reverse);
1683
                pathFigure.IsClosed = false;
1684
                pathFigure.IsFilled = true;
1685
                _pathGeometry.Figures.Add(pathFigure);
1686
            }
1687 ca40e004 ljiyeon
            
1688 787a4489 KangIngu
            return _pathGeometry;
1689
        }
1690 ca40e004 ljiyeon
1691
        
1692 787a4489 KangIngu
        public static PathGeometry GenerateInner(List<Point> pData)
1693
        {
1694
            var _pathGeometry = new PathGeometry();
1695
            double area = MathSet.AreaOf(pData);
1696
            bool reverse = (area > 0);
1697
            int count = pData.Count;
1698
1699
            PathFigure pathFigur2 = new PathFigure();
1700
            pathFigur2.StartPoint = pData[0];
1701
1702
            LineSegment lineSegment0 = new LineSegment();
1703
            lineSegment0.Point = pData[0];
1704
            pathFigur2.Segments.Add(lineSegment0);
1705
1706
            LineSegment lineSegment1 = new LineSegment();
1707
            lineSegment1.Point = pData[1];
1708
            pathFigur2.Segments.Add(lineSegment1);
1709
1710
            LineSegment lineSegment2 = new LineSegment();
1711
            lineSegment2.Point = pData[2];
1712
            pathFigur2.Segments.Add(lineSegment2);
1713
1714
            LineSegment lineSegment3 = new LineSegment();
1715
            lineSegment3.Point = pData[3];
1716
            pathFigur2.Segments.Add(lineSegment3);
1717
1718
1719
            pathFigur2.IsClosed = true;
1720
            pathFigur2.IsFilled = true;
1721 ca40e004 ljiyeon
            _pathGeometry.Figures.Add(pathFigur2);           
1722 787a4489 KangIngu
1723
            return _pathGeometry;
1724
        }
1725
1726 ca40e004 ljiyeon
        //20180910 LJY Cloud rotation 추가
1727
        public static PathGeometry GenerateInnerCloud(List<Point> pData, string angle)
1728
        {
1729
            var _pathGeometry = new PathGeometry();
1730
            double area = MathSet.AreaOf(pData);
1731
            bool reverse = (area > 0);
1732
            int count = pData.Count;
1733
1734
            PathFigure pathFigur2 = new PathFigure();
1735
            pathFigur2.StartPoint = pData[0];
1736
1737
            LineSegment lineSegment0 = new LineSegment();
1738
            lineSegment0.Point = pData[0];
1739
            pathFigur2.Segments.Add(lineSegment0);
1740
1741
            LineSegment lineSegment1 = new LineSegment();
1742
            lineSegment1.Point = pData[1];
1743
            pathFigur2.Segments.Add(lineSegment1);
1744
1745
            LineSegment lineSegment2 = new LineSegment();
1746
            lineSegment2.Point = pData[2];
1747
            pathFigur2.Segments.Add(lineSegment2);
1748
1749
            LineSegment lineSegment3 = new LineSegment();
1750
            lineSegment3.Point = pData[3];
1751
            pathFigur2.Segments.Add(lineSegment3);
1752
            
1753
            RotateTransform transform = new RotateTransform();
1754
            switch (angle)
1755
            {
1756
                case "90":
1757
                    transform.Angle = -90;
1758
                    break;
1759
                case "180":
1760
                    transform.Angle = -180;
1761
                    break;
1762
                case "270":
1763
                    transform.Angle = -270;
1764
                    break;
1765
            }
1766
            transform.CenterX = pData[0].X;
1767
            transform.CenterY = pData[0].Y;
1768
            _pathGeometry.Transform = transform;
1769
1770
            pathFigur2.IsClosed = true;
1771
            pathFigur2.IsFilled = true;
1772
            _pathGeometry.Figures.Add(pathFigur2);
1773
1774
            return _pathGeometry;
1775 91efe37a humkyung
        }
1776
1777
        /// <summary>
1778
        /// return ArrowTextControl's area
1779
        /// </summary>
1780
        /// <author>humkyung</author>
1781
        /// <date>2019.06.13</date>
1782
        public override Rect ItemRect
1783
        {
1784
            get
1785
            {
1786
                double dMinX = Math.Min(this.StartPoint.X, this.EndPoint.X);
1787
                double dMinY = Math.Min(this.StartPoint.Y, this.EndPoint.Y);
1788
                double dMaxX = Math.Max(this.StartPoint.X, this.EndPoint.X);
1789
                double dMaxY = Math.Max(this.StartPoint.Y, this.EndPoint.Y);
1790
1791
                return new Rect(new Point(dMinX, dMinY), new Point(dMaxX, dMaxY));
1792
            }
1793 ca40e004 ljiyeon
        }
1794 787a4489 KangIngu
1795 036650a0 humkyung
        /// <summary>
1796
        /// Serialize this
1797
        /// </summary>
1798
        /// <param name="sUserId"></param>
1799
        /// <returns></returns>
1800
        public override string Serialize()
1801
        {
1802
            using (S_ArrowTextControl STemp = new S_ArrowTextControl())
1803
            {
1804
                STemp.TransformPoint = "0|0";
1805
                STemp.PointSet = this.PointSet;
1806
                STemp.SizeSet = String.Format("{0}", this.LineSize);
1807
                STemp.StrokeColor = this.StrokeColor.Color.ToString();
1808
                STemp.StartPoint = this.StartPoint;
1809
                STemp.ArrowStyle = this.ArrowTextStyle;
1810
                //STemp.StrokeColor = "#FF00FF00";
1811
                STemp.UserID = this.UserID;
1812
                STemp.ArrowText = this.Base_TextBox.Text;
1813
                STemp.BorderSize = this.BorderSize;
1814
                STemp.isHighLight = this.isHighLight;
1815
                STemp.BoxHeight = this.BoxHeight;
1816
                STemp.BoxWidth = this.BoxWidth;
1817
                STemp.Opac = this.Opacity;
1818
                STemp.EndPoint = this.EndPoint;
1819
                STemp.isFixed = this.isFixed;
1820
                //STemp.DashSize = this.DashSize;
1821
                STemp.Name = this.GetType().Name.ToString();
1822
                STemp.isTrans = this.isTrans;
1823
                STemp.MidPoint = this.MidPoint;
1824
                STemp.Angle = this.Angle;
1825
                STemp.fontConfig = new List<string>()
1826
                            {
1827
                                this.TextFamily.ToString(),
1828
                                this.TextStyle.ToString(),
1829
                                this.TextWeight.ToString(),
1830
                                this.TextSize.ToString(),
1831
                            };
1832
1833
                if (this.UnderLine != null)
1834
                {
1835
                    STemp.fontConfig.Add("true");
1836
                }
1837
1838
                ///강인구 추가(2017.11.02)
1839
                ///Memo 추가
1840
                STemp.Memo = this.Memo;
1841
                STemp.BorderSize = this.BorderSize;
1842
                return "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize()));
1843
            };
1844
        }
1845
1846 661b7416 humkyung
        /// <summary>
1847
        /// create a arrowtextcontrol from given string
1848
        /// </summary>
1849
        /// <param name="str"></param>
1850
        /// <returns></returns>
1851
        public static ArrowTextControl FromString(string str, SolidColorBrush brush, string sProjectNo)
1852
        {
1853
            ArrowTextControl instance = null;
1854
            using (S_ArrowTextControl s = JsonSerializerHelper.JsonDeserialize<S_ArrowTextControl>(str))
1855
            {
1856
                string[] data2 = s.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
1857
                instance = new ArrowTextControl();
1858
                instance.LineSize = Convert.ToDouble(data2.First());
1859
                instance.PointSet = s.PointSet;
1860
                instance.StartPoint = s.StartPoint;
1861
                instance.EndPoint = s.EndPoint;
1862
                instance.StrokeColor = brush;
1863
                //instance.DashSize = s.DashSize;
1864
                instance.ArrowTextStyle = s.ArrowStyle;
1865
                instance.isHighLight = s.isHighLight;
1866
                instance.ArrowText = s.ArrowText;
1867
                instance.Opacity = s.Opac;
1868
                instance.BorderSize = s.BorderSize;
1869
                instance.BoxWidth = s.BoxWidth;
1870
                instance.BoxHeight = s.BoxHeight;
1871
                instance.isFixed = s.isFixed;
1872
                instance.Angle = s.Angle;
1873
                instance.UserID = s.UserID;
1874
                instance.isTrans = s.isTrans;
1875
                instance.MidPoint = s.MidPoint;
1876
                instance.Memo = s.Memo;
1877
                if (s.fontConfig == null || s.fontConfig.ToList().Count == 0)
1878
                {
1879
                    s.fontConfig = new List<string>();
1880
1881
                    s.fontConfig.Add("Arial");
1882
                    s.fontConfig.Add("Normal");
1883
                    s.fontConfig.Add("Normal");
1884
                    s.fontConfig.Add("30");
1885
                }
1886
                instance.TextFamily = new FontFamily(s.fontConfig[0]);
1887
                //인구 추가(2018.04.17)
1888
                instance.TextStyle = StringToFont.ConFontStyle(s.fontConfig[1]);
1889
                instance.TextWeight = StringToFont.ConFontWeight(s.fontConfig[2]);
1890
                instance.TextSize = Convert.ToDouble(s.fontConfig[3]);
1891
1892
                if (s.fontConfig.Count() == 5)
1893
                {
1894
                    instance.UnderLine = TextDecorations.Underline;
1895
                }
1896
            }
1897
1898
            return instance;
1899
        }
1900
1901 787a4489 KangIngu
        #region Dispose
1902
        public void Dispose()
1903
        {
1904
            GC.Collect();
1905
            GC.SuppressFinalize(this);
1906
        } 
1907
        #endregion
1908
1909
        #region INotifyPropertyChanged
1910
        private void OnPropertyChanged(string name)
1911
        {
1912
            if (PropertyChanged != null)
1913
            {
1914
                PropertyChanged(this, new PropertyChangedEventArgs(name));
1915
            }
1916
        }
1917
1918
        public event PropertyChangedEventHandler PropertyChanged; 
1919
        #endregion
1920
    }
1921
}
클립보드 이미지 추가 (최대 크기: 500 MB)