1
|
using MarkupToPDF.Controls.Common;
|
2
|
using System;
|
3
|
using System.Collections.Generic;
|
4
|
using System.ComponentModel;
|
5
|
using System.Linq;
|
6
|
using System.Text;
|
7
|
using System.Threading.Tasks;
|
8
|
using System.Windows;
|
9
|
using System.Windows.Controls;
|
10
|
using System.Windows.Media;
|
11
|
using System.Windows.Shapes;
|
12
|
using MarkupToPDF.Controls.Custom;
|
13
|
using MarkupToPDF.Common;
|
14
|
using MarkupToPDF.Serialize.Core;
|
15
|
using MarkupToPDF.Serialize.S_Control;
|
16
|
|
17
|
namespace MarkupToPDF.Controls.Text
|
18
|
{
|
19
|
public class ArrowTextControl : CommentUserInfo, IDisposable, INotifyPropertyChanged, IPath, ITextControl, IMarkupControlData
|
20
|
{
|
21
|
private const string PART_ArrowPath = "PART_ArrowPath";
|
22
|
private const string PART_TextBox = "PART_ArrowTextBox";
|
23
|
//private const string PART_TextBlock = "PART_ArrowTextBlock";
|
24
|
private const string PART_ArrowSubPath = "PART_ArrowSubPath";
|
25
|
private const string PART_Border = "PART_Border";
|
26
|
|
27
|
public Path Base_ArrowPath = null;
|
28
|
public Path Base_ArrowSubPath = null;
|
29
|
public TextBox Base_TextBox = null;
|
30
|
public TextBlock Base_TextBlock = null;
|
31
|
|
32
|
private const double _CloudArcDepth = 0.8; /// 2018.05.14 added by humkyung
|
33
|
|
34
|
#region Object & Variable
|
35
|
GeometryGroup instanceGroup = new GeometryGroup();
|
36
|
|
37
|
Path Cemy = new Path();
|
38
|
LineGeometry connectorSMGeometry = new LineGeometry();
|
39
|
LineGeometry connectorMEGeometry = new LineGeometry();
|
40
|
|
41
|
public enum ArrowTextStyleSet { Normal, Cloud, Rect };
|
42
|
|
43
|
#endregion
|
44
|
|
45
|
static ArrowTextControl()
|
46
|
{
|
47
|
DefaultStyleKeyProperty.OverrideMetadata(typeof(ArrowTextControl), new FrameworkPropertyMetadata(typeof(ArrowTextControl)));
|
48
|
ResourceDictionary dictionary = new ResourceDictionary();
|
49
|
dictionary.Source = new Uri("/MarkupToPDF;component/themes/generic.xaml", UriKind.RelativeOrAbsolute);
|
50
|
Application.Current.Resources.MergedDictionaries.Add(dictionary);
|
51
|
}
|
52
|
|
53
|
public ArrowTextControl()
|
54
|
{
|
55
|
this.DefaultStyleKey = typeof(ArrowTextControl);
|
56
|
}
|
57
|
|
58
|
public override void OnApplyTemplate()
|
59
|
{
|
60
|
base.OnApplyTemplate();
|
61
|
Base_ArrowPath = GetTemplateChild(PART_ArrowPath) as Path;
|
62
|
Base_ArrowSubPath = GetTemplateChild(PART_ArrowSubPath) as Path;
|
63
|
Base_TextBox = GetTemplateChild(PART_TextBox) as TextBox;
|
64
|
|
65
|
Base_TextBox.SizeChanged += new SizeChangedEventHandler(Base_TextBox_SizeChanged);
|
66
|
Base_TextBox.GotFocus += new RoutedEventHandler(Base_TextBox_GotFocus);
|
67
|
Base_TextBox.LostFocus += new RoutedEventHandler(Base_TextBox_LostFocus);
|
68
|
|
69
|
SetArrowTextPath();
|
70
|
Base_TextBox.IsTabStop = true;
|
71
|
}
|
72
|
|
73
|
void Base_TextBox_LostFocus(object sender, RoutedEventArgs e)
|
74
|
{
|
75
|
this.ArrowText = Base_TextBox.Text;
|
76
|
|
77
|
this.IsEditingMode = false;
|
78
|
|
79
|
ApplyOverViewData();
|
80
|
}
|
81
|
|
82
|
void Base_TextBox_GotFocus(object sender, RoutedEventArgs e)
|
83
|
{
|
84
|
|
85
|
this.IsEditingMode = true;
|
86
|
}
|
87
|
|
88
|
void Base_TextBox_SizeChanged(object sender, SizeChangedEventArgs e)
|
89
|
{
|
90
|
if (Base_TextBox.Text.Contains("|OR||DZ|"))
|
91
|
{
|
92
|
Base_TextBox.Text = this.ArrowText;
|
93
|
}
|
94
|
|
95
|
this.ArrowText = Base_TextBox.Text;
|
96
|
BoxWidth = e.NewSize.Width;
|
97
|
BoxHeight = e.NewSize.Height;
|
98
|
SetArrowTextPath();
|
99
|
}
|
100
|
|
101
|
#region Properties
|
102
|
private bool _IsEditingMode;
|
103
|
public bool IsEditingMode
|
104
|
{
|
105
|
get
|
106
|
{
|
107
|
return _IsEditingMode;
|
108
|
}
|
109
|
set
|
110
|
{
|
111
|
_IsEditingMode = value;
|
112
|
OnPropertyChanged("IsEditingMode");
|
113
|
}
|
114
|
}
|
115
|
|
116
|
|
117
|
#endregion
|
118
|
|
119
|
#region dp Properties
|
120
|
//강인구 주석 풀기
|
121
|
public Visibility TextBoxVisibility
|
122
|
{
|
123
|
get { return (Visibility)GetValue(TextBoxVisibilityProperty); }
|
124
|
set
|
125
|
{
|
126
|
if (this.TextBoxVisibility != value)
|
127
|
{
|
128
|
SetValue(TextBoxVisibilityProperty, value);
|
129
|
OnPropertyChanged("TextBoxVisibility");
|
130
|
}
|
131
|
}
|
132
|
}
|
133
|
|
134
|
//강인구 주석 풀기
|
135
|
public Visibility TextBlockVisibility
|
136
|
{
|
137
|
get { return (Visibility)GetValue(TextBlockVisibilityProperty); }
|
138
|
set
|
139
|
{
|
140
|
if (this.TextBlockVisibility != value)
|
141
|
{
|
142
|
SetValue(TextBlockVisibilityProperty, value);
|
143
|
OnPropertyChanged("TextBlockVisibility");
|
144
|
}
|
145
|
}
|
146
|
}
|
147
|
|
148
|
|
149
|
public override SolidColorBrush StrokeColor
|
150
|
{
|
151
|
get { return (SolidColorBrush)GetValue(StrokeColorProperty); }
|
152
|
set
|
153
|
{
|
154
|
if (this.StrokeColor != value)
|
155
|
{
|
156
|
SetValue(StrokeColorProperty, value);
|
157
|
}
|
158
|
}
|
159
|
}
|
160
|
|
161
|
public PathGeometry SubPathData
|
162
|
{
|
163
|
get { return (PathGeometry)GetValue(SubPathDataProperty); }
|
164
|
set
|
165
|
{
|
166
|
if (this.SubPathData != value)
|
167
|
{
|
168
|
SetValue(SubPathDataProperty, value);
|
169
|
}
|
170
|
}
|
171
|
}
|
172
|
|
173
|
public string UserID
|
174
|
{
|
175
|
get { return (string)GetValue(UserIDProperty); }
|
176
|
set
|
177
|
{
|
178
|
if (this.UserID != value)
|
179
|
{
|
180
|
SetValue(UserIDProperty, value);
|
181
|
OnPropertyChanged("UserID");
|
182
|
}
|
183
|
}
|
184
|
}
|
185
|
|
186
|
public List<Point> PointSet
|
187
|
{
|
188
|
get { return (List<Point>)GetValue(PointSetProperty); }
|
189
|
set { SetValue(PointSetProperty, value); }
|
190
|
}
|
191
|
|
192
|
public override bool IsSelected
|
193
|
{
|
194
|
get
|
195
|
{
|
196
|
return (bool)GetValue(IsSelectedProperty);
|
197
|
}
|
198
|
set
|
199
|
{
|
200
|
SetValue(IsSelectedProperty, value);
|
201
|
OnPropertyChanged("IsSelected");
|
202
|
}
|
203
|
}
|
204
|
|
205
|
public override ControlType ControlType
|
206
|
{
|
207
|
set
|
208
|
{
|
209
|
SetValue(ControlTypeProperty, value);
|
210
|
OnPropertyChanged("ControlType");
|
211
|
}
|
212
|
get
|
213
|
{
|
214
|
return (ControlType)GetValue(ControlTypeProperty);
|
215
|
}
|
216
|
}
|
217
|
|
218
|
public Point StartPoint
|
219
|
{
|
220
|
get { return (Point)GetValue(StartPointProperty); }
|
221
|
set { SetValue(StartPointProperty, value); }
|
222
|
}
|
223
|
|
224
|
public Point EndPoint
|
225
|
{
|
226
|
get { return (Point)GetValue(EndPointProperty); }
|
227
|
set { SetValue(EndPointProperty, value); }
|
228
|
}
|
229
|
|
230
|
public Point OverViewStartPoint
|
231
|
{
|
232
|
get { return (Point)GetValue(OverViewStartPointProperty); }
|
233
|
set { SetValue(OverViewStartPointProperty, value); }
|
234
|
}
|
235
|
|
236
|
public Point OverViewEndPoint
|
237
|
{
|
238
|
get { return (Point)GetValue(OverViewEndPointProperty); }
|
239
|
set { SetValue(OverViewEndPointProperty, value); }
|
240
|
}
|
241
|
|
242
|
|
243
|
public double Angle
|
244
|
{
|
245
|
get { return (double)GetValue(AngleProperty); }
|
246
|
set { SetValue(AngleProperty, value); }
|
247
|
}
|
248
|
|
249
|
public Thickness BorderSize
|
250
|
{
|
251
|
get { return (Thickness)GetValue(BorderSizeProperty); }
|
252
|
set
|
253
|
{
|
254
|
if (this.BorderSize != value)
|
255
|
{
|
256
|
SetValue(BorderSizeProperty, value);
|
257
|
}
|
258
|
}
|
259
|
}
|
260
|
|
261
|
|
262
|
public Point MidPoint
|
263
|
{
|
264
|
get { return (Point)GetValue(MidPointProperty); }
|
265
|
set { SetValue(MidPointProperty, value); }
|
266
|
}
|
267
|
|
268
|
public bool isFixed
|
269
|
{
|
270
|
get { return (bool)GetValue(IsFixedProperty); }
|
271
|
set { SetValue(IsFixedProperty, value); }
|
272
|
}
|
273
|
|
274
|
public bool isTrans
|
275
|
{
|
276
|
get { return (bool)GetValue(TransformerProperty); }
|
277
|
set { SetValue(TransformerProperty, value); }
|
278
|
}
|
279
|
|
280
|
public bool isHighLight
|
281
|
{
|
282
|
get { return (bool)GetValue(isHighlightProperty); }
|
283
|
set
|
284
|
{
|
285
|
if (this.isHighLight != value)
|
286
|
{
|
287
|
SetValue(isHighlightProperty, value);
|
288
|
OnPropertyChanged("isHighLight");
|
289
|
}
|
290
|
}
|
291
|
}
|
292
|
|
293
|
public FontWeight TextWeight
|
294
|
{
|
295
|
get { return (FontWeight)GetValue(TextWeightProperty); }
|
296
|
set
|
297
|
{
|
298
|
if (this.TextWeight != value)
|
299
|
{
|
300
|
SetValue(TextWeightProperty, value);
|
301
|
OnPropertyChanged("TextWeight");
|
302
|
}
|
303
|
}
|
304
|
}
|
305
|
|
306
|
public Double LineSize
|
307
|
{
|
308
|
get { return (Double)GetValue(LineSizeProperty); }
|
309
|
set
|
310
|
{
|
311
|
if (this.LineSize != value)
|
312
|
{
|
313
|
SetValue(LineSizeProperty, value);
|
314
|
}
|
315
|
}
|
316
|
}
|
317
|
|
318
|
public Double BoxWidth
|
319
|
{
|
320
|
get { return (Double)GetValue(BoxWidthProperty); }
|
321
|
set
|
322
|
{
|
323
|
if (this.BoxWidth != value)
|
324
|
{
|
325
|
SetValue(BoxWidthProperty, value);
|
326
|
}
|
327
|
}
|
328
|
}
|
329
|
|
330
|
public Double BoxHeight
|
331
|
{
|
332
|
get { return (Double)GetValue(BoxHeightProperty); }
|
333
|
set
|
334
|
{
|
335
|
if (this.BoxHeight != value)
|
336
|
{
|
337
|
SetValue(BoxHeightProperty, value);
|
338
|
}
|
339
|
}
|
340
|
}
|
341
|
|
342
|
public ArrowTextStyleSet ArrowTextStyle
|
343
|
{
|
344
|
get { return (ArrowTextStyleSet)GetValue(ArrowTextStyleProperty); }
|
345
|
set
|
346
|
{
|
347
|
if (this.ArrowTextStyle != value)
|
348
|
{
|
349
|
SetValue(ArrowTextStyleProperty, value);
|
350
|
}
|
351
|
}
|
352
|
}
|
353
|
|
354
|
public Geometry PathData
|
355
|
{
|
356
|
get { return (Geometry)GetValue(PathDataProperty); }
|
357
|
set { SetValue(PathDataProperty, value);
|
358
|
|
359
|
OnPropertyChanged("PathData");
|
360
|
}
|
361
|
}
|
362
|
|
363
|
public SolidColorBrush BackInnerColor
|
364
|
{
|
365
|
get { return (SolidColorBrush)GetValue(BackInnerColorProperty); }
|
366
|
set
|
367
|
{
|
368
|
if (this.BackInnerColor != value)
|
369
|
{
|
370
|
SetValue(BackInnerColorProperty, value);
|
371
|
OnPropertyChanged("BackInnerColor");
|
372
|
}
|
373
|
}
|
374
|
}
|
375
|
|
376
|
public Geometry PathDataInner
|
377
|
{
|
378
|
get { return (Geometry)GetValue(PathDataInnerProperty); }
|
379
|
set
|
380
|
{
|
381
|
SetValue(PathDataInnerProperty, value);
|
382
|
OnPropertyChanged("PathDataInner");
|
383
|
}
|
384
|
}
|
385
|
|
386
|
public Geometry OverViewPathData
|
387
|
{
|
388
|
get { return (Geometry)GetValue(OverViewPathDataProperty); }
|
389
|
set { SetValue(OverViewPathDataProperty, value);
|
390
|
|
391
|
OnPropertyChanged("OverViewPathData");
|
392
|
|
393
|
}
|
394
|
}
|
395
|
|
396
|
public FontFamily TextFamily
|
397
|
{
|
398
|
get { return (FontFamily)GetValue(TextFamilyProperty); }
|
399
|
set
|
400
|
{
|
401
|
if (this.TextFamily != value)
|
402
|
{
|
403
|
SetValue(TextFamilyProperty, value);
|
404
|
OnPropertyChanged("TextFamily");
|
405
|
}
|
406
|
}
|
407
|
}
|
408
|
|
409
|
public string ArrowText
|
410
|
{
|
411
|
get { return (string)GetValue(ArrowTextProperty); }
|
412
|
set
|
413
|
{
|
414
|
if (this.ArrowText != value)
|
415
|
{
|
416
|
SetValue(ArrowTextProperty, value);
|
417
|
OnPropertyChanged("ArrowText");
|
418
|
}
|
419
|
}
|
420
|
}
|
421
|
|
422
|
public string OverViewArrowText
|
423
|
{
|
424
|
|
425
|
get { return (string)GetValue(OverViewArrowTextProperty);
|
426
|
}
|
427
|
set
|
428
|
{
|
429
|
if (this.OverViewArrowText != value)
|
430
|
{
|
431
|
SetValue(OverViewArrowTextProperty, value);
|
432
|
OnPropertyChanged("OverViewArrowText");
|
433
|
}
|
434
|
}
|
435
|
}
|
436
|
|
437
|
public Double TextSize
|
438
|
{
|
439
|
get { return (Double)GetValue(TextSizeProperty); }
|
440
|
set
|
441
|
{
|
442
|
if (this.TextSize != value)
|
443
|
{
|
444
|
SetValue(TextSizeProperty, value);
|
445
|
OnPropertyChanged("TextSize");
|
446
|
}
|
447
|
}
|
448
|
}
|
449
|
|
450
|
public FontStyle TextStyle
|
451
|
{
|
452
|
get { return (FontStyle)GetValue(TextStyleProperty); }
|
453
|
set
|
454
|
{
|
455
|
if (this.TextStyle != value)
|
456
|
{
|
457
|
SetValue(TextStyleProperty, value);
|
458
|
OnPropertyChanged("TextStyle");
|
459
|
}
|
460
|
}
|
461
|
}
|
462
|
|
463
|
//강인구 추가
|
464
|
public TextDecorationCollection UnderLine
|
465
|
{
|
466
|
get
|
467
|
{
|
468
|
return (TextDecorationCollection)GetValue(UnderLineProperty);
|
469
|
}
|
470
|
set
|
471
|
{
|
472
|
if (this.UnderLine != value)
|
473
|
{
|
474
|
SetValue(UnderLineProperty, value);
|
475
|
OnPropertyChanged("UnderLine");
|
476
|
}
|
477
|
}
|
478
|
}
|
479
|
|
480
|
public double CanvasX
|
481
|
{
|
482
|
get { return (double)GetValue(CanvasXProperty); }
|
483
|
set
|
484
|
{
|
485
|
if (this.CanvasX != value)
|
486
|
{
|
487
|
SetValue(CanvasXProperty, value);
|
488
|
OnPropertyChanged("CanvasX");
|
489
|
}
|
490
|
}
|
491
|
}
|
492
|
|
493
|
public double CanvasY
|
494
|
{
|
495
|
get { return (double)GetValue(CanvasYProperty); }
|
496
|
set
|
497
|
{
|
498
|
if (this.CanvasY != value)
|
499
|
{
|
500
|
SetValue(CanvasYProperty, value);
|
501
|
OnPropertyChanged("CanvasY");
|
502
|
}
|
503
|
}
|
504
|
}
|
505
|
|
506
|
public double CenterX
|
507
|
{
|
508
|
get { return (double)GetValue(CenterXProperty); }
|
509
|
set { SetValue(CenterXProperty, value);
|
510
|
OnPropertyChanged("CenterX");
|
511
|
|
512
|
}
|
513
|
}
|
514
|
|
515
|
public double CenterY
|
516
|
{
|
517
|
get { return (double)GetValue(CenterYProperty); }
|
518
|
set { SetValue(CenterYProperty, value);
|
519
|
OnPropertyChanged("CenterY");
|
520
|
}
|
521
|
}
|
522
|
|
523
|
public Brush SubPathFill
|
524
|
{
|
525
|
get { return (Brush)GetValue(SubPathFillProperty); }
|
526
|
set
|
527
|
{
|
528
|
SetValue(SubPathFillProperty, value);
|
529
|
OnPropertyChanged("SubPathFill");
|
530
|
}
|
531
|
}
|
532
|
|
533
|
public Brush TextBoxBackground
|
534
|
{
|
535
|
get { return (Brush)GetValue(TextBoxBackgroundProperty); }
|
536
|
set
|
537
|
{
|
538
|
SetValue(TextBoxBackgroundProperty, value);
|
539
|
OnPropertyChanged("TextBoxBackground");
|
540
|
}
|
541
|
}
|
542
|
|
543
|
|
544
|
//강인구 추가 주석풀기
|
545
|
public bool IsEditing
|
546
|
{
|
547
|
get { return (bool)GetValue(IsEditingProperty); }
|
548
|
set
|
549
|
{
|
550
|
if (this.IsEditing != value)
|
551
|
{
|
552
|
SetValue(IsEditingProperty, value);
|
553
|
|
554
|
OnPropertyChanged("IsEditing");
|
555
|
|
556
|
}
|
557
|
}
|
558
|
}
|
559
|
|
560
|
public bool EnableEditing
|
561
|
{
|
562
|
get { return (bool)GetValue(EnableEditingProperty); }
|
563
|
set
|
564
|
{
|
565
|
if (this.EnableEditing != value)
|
566
|
{
|
567
|
SetValue(EnableEditingProperty, value);
|
568
|
OnPropertyChanged("EnableEditing");
|
569
|
}
|
570
|
}
|
571
|
}
|
572
|
|
573
|
#endregion
|
574
|
|
575
|
#region Dependency Properties
|
576
|
|
577
|
public static readonly DependencyProperty BoxWidthProperty = DependencyProperty.Register(
|
578
|
"BoxWidth", typeof(double), typeof(ArrowTextControl), new PropertyMetadata((Double)20));
|
579
|
|
580
|
public static readonly DependencyProperty BoxHeightProperty = DependencyProperty.Register(
|
581
|
"BoxHeight", typeof(double), typeof(ArrowTextControl), new PropertyMetadata((Double)20));
|
582
|
|
583
|
public static readonly DependencyProperty UserIDProperty = DependencyProperty.Register(
|
584
|
"UserID", typeof(string), typeof(ArrowTextControl), new PropertyMetadata(null));
|
585
|
|
586
|
public static readonly DependencyProperty ArrowTextStyleProperty = DependencyProperty.Register(
|
587
|
"ArrowTextStyle", typeof(ArrowTextStyleSet), typeof(ArrowTextControl), new PropertyMetadata(ArrowTextStyleSet.Normal));
|
588
|
|
589
|
public static readonly DependencyProperty CenterXProperty = DependencyProperty.Register(
|
590
|
"CenterX", typeof(double), typeof(ArrowTextControl), new PropertyMetadata((double)0, OnCenterXYChanged));
|
591
|
|
592
|
public static readonly DependencyProperty CenterYProperty = DependencyProperty.Register(
|
593
|
"CenterY", typeof(double), typeof(ArrowTextControl), new PropertyMetadata((double)0, OnCenterXYChanged));
|
594
|
|
595
|
public static readonly DependencyProperty AngleProperty = DependencyProperty.Register(
|
596
|
"Angle", typeof(double), typeof(ArrowTextControl), new PropertyMetadata((double)0.0, new PropertyChangedCallback(PointValueChanged)));
|
597
|
|
598
|
public static readonly DependencyProperty CanvasXProperty = DependencyProperty.Register(
|
599
|
"CanvasX", typeof(double), typeof(ArrowTextControl), new PropertyMetadata((double)0, OnSetCansvasChanged));
|
600
|
|
601
|
public static readonly DependencyProperty CanvasYProperty = DependencyProperty.Register(
|
602
|
"CanvasY", typeof(double), typeof(ArrowTextControl), new PropertyMetadata((double)0, OnSetCansvasChanged));
|
603
|
|
604
|
public static readonly DependencyProperty PointSetProperty = DependencyProperty.Register(
|
605
|
"PointSet", typeof(List<Point>), typeof(ArrowTextControl), new PropertyMetadata(new List<Point>(), PointValueChanged));
|
606
|
|
607
|
public static readonly DependencyProperty TextFamilyProperty = DependencyProperty.Register(
|
608
|
"TextFamily", typeof(FontFamily), typeof(ArrowTextControl), new PropertyMetadata(new FontFamily("Arial"), TextChanged));
|
609
|
|
610
|
public static readonly DependencyProperty PathDataProperty = DependencyProperty.Register(
|
611
|
"PathData", typeof(Geometry), typeof(ArrowTextControl), null);
|
612
|
|
613
|
//강인구 추가
|
614
|
public static readonly DependencyProperty UnderLineProperty = DependencyProperty.Register(
|
615
|
"UnderLine", typeof(TextDecorationCollection), typeof(ArrowTextControl), new PropertyMetadata(null, PointValueChanged));
|
616
|
|
617
|
public static readonly DependencyProperty LineSizeProperty = DependencyProperty.Register(
|
618
|
"LineSize", typeof(double), typeof(ArrowTextControl), new PropertyMetadata((Double)3, PointValueChanged));
|
619
|
|
620
|
public static readonly DependencyProperty TextStyleProperty = DependencyProperty.Register(
|
621
|
"TextStyle", typeof(FontStyle), typeof(ArrowTextControl), new PropertyMetadata(FontStyles.Normal));
|
622
|
|
623
|
public static readonly DependencyProperty TextSizeProperty = DependencyProperty.Register(
|
624
|
"TextSize", typeof(Double), typeof(ArrowTextControl), new PropertyMetadata((Double)30, PointValueChanged));
|
625
|
|
626
|
public static readonly DependencyProperty TextWeightProperty = DependencyProperty.Register(
|
627
|
"TextWeight", typeof(FontWeight), typeof(ArrowTextControl), new PropertyMetadata(FontWeights.Normal));
|
628
|
|
629
|
public static readonly DependencyProperty IsFixedProperty = DependencyProperty.Register(
|
630
|
"isFixed", typeof(bool), typeof(ArrowTextControl), new PropertyMetadata(false, PointValueChanged));
|
631
|
|
632
|
public static readonly DependencyProperty IsSelectedProperty = DependencyProperty.Register(
|
633
|
"IsSelected", typeof(bool), typeof(ArrowTextControl), new FrameworkPropertyMetadata(false, IsSelectedChanged));
|
634
|
|
635
|
public static readonly DependencyProperty StrokeColorProperty = DependencyProperty.Register(
|
636
|
"StrokeColor", typeof(SolidColorBrush), typeof(ArrowTextControl), new PropertyMetadata(new SolidColorBrush(Colors.Red)));
|
637
|
|
638
|
public static readonly DependencyProperty ControlTypeProperty = DependencyProperty.Register(
|
639
|
"ControlType", typeof(ControlType), typeof(ArrowTextControl), new FrameworkPropertyMetadata(ControlType.ArrowTextControl));
|
640
|
|
641
|
public static readonly DependencyProperty StartPointProperty = DependencyProperty.Register(
|
642
|
"StartPoint", typeof(Point), typeof(ArrowTextControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
|
643
|
|
644
|
public static readonly DependencyProperty EndPointProperty = DependencyProperty.Register(
|
645
|
"EndPoint", typeof(Point), typeof(ArrowTextControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
|
646
|
|
647
|
public static readonly DependencyProperty BackInnerColorProperty = DependencyProperty.Register(
|
648
|
"BackInnerColor", typeof(SolidColorBrush), typeof(ArrowTextControl), new PropertyMetadata(new SolidColorBrush(Colors.White)));
|
649
|
|
650
|
public static readonly DependencyProperty PathDataInnerProperty = DependencyProperty.Register(
|
651
|
"PathDataInner", typeof(Geometry), typeof(ArrowTextControl), null);
|
652
|
|
653
|
public static readonly DependencyProperty isHighlightProperty = DependencyProperty.Register(
|
654
|
"isHighlight", typeof(bool), typeof(ArrowTextControl), new PropertyMetadata(false, PointValueChanged));
|
655
|
|
656
|
public static readonly DependencyProperty MidPointProperty = DependencyProperty.Register(
|
657
|
"MidPoint", typeof(Point), typeof(ArrowTextControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
|
658
|
|
659
|
public static readonly DependencyProperty TransformerProperty = DependencyProperty.Register(
|
660
|
"isTrans", typeof(bool), typeof(ArrowTextControl), new PropertyMetadata(false, PointValueChanged));
|
661
|
|
662
|
public static readonly DependencyProperty BorderSizeProperty = DependencyProperty.Register(
|
663
|
"BorderSize", typeof(Thickness), typeof(ArrowTextControl), new PropertyMetadata(new Thickness(0), PointValueChanged));
|
664
|
|
665
|
public static readonly DependencyProperty ArrowTextProperty = DependencyProperty.Register(
|
666
|
"ArrowText", typeof(string), typeof(ArrowTextControl), new PropertyMetadata(null));
|
667
|
|
668
|
|
669
|
|
670
|
//, new PropertyChangedCallback(TextChanged)
|
671
|
|
672
|
|
673
|
#region 추가 사항
|
674
|
public static readonly DependencyProperty SubPathDataProperty = DependencyProperty.Register(
|
675
|
"SubPathData", typeof(Geometry), typeof(ArrowTextControl), null);
|
676
|
|
677
|
|
678
|
public static readonly DependencyProperty SubPathFillProperty = DependencyProperty.Register(
|
679
|
"SubPathFill", typeof(Brush), typeof(ArrowTextControl), new PropertyMetadata(null));
|
680
|
|
681
|
public static readonly DependencyProperty TextBoxBackgroundProperty = DependencyProperty.Register(
|
682
|
"TextBoxBackground", typeof(Brush), typeof(ArrowTextControl), new PropertyMetadata(Brushes.White));
|
683
|
|
684
|
public static readonly DependencyProperty OverViewArrowTextProperty = DependencyProperty.Register(
|
685
|
"OverViewArrowText", typeof(string), typeof(ArrowTextControl), new PropertyMetadata(null, new PropertyChangedCallback(TextChanged)));
|
686
|
|
687
|
public static readonly DependencyProperty OverViewPathDataProperty = DependencyProperty.Register(
|
688
|
"OverViewPathData", typeof(Geometry), typeof(ArrowTextControl), null);
|
689
|
|
690
|
public static readonly DependencyProperty OverViewStartPointProperty = DependencyProperty.Register(
|
691
|
"OverViewStartPoint", typeof(Point), typeof(ArrowTextControl), new PropertyMetadata(null));
|
692
|
|
693
|
public static readonly DependencyProperty OverViewEndPointProperty = DependencyProperty.Register(
|
694
|
"OverViewEndPoint", typeof(Point), typeof(ArrowTextControl), new PropertyMetadata(null));
|
695
|
|
696
|
public static readonly DependencyProperty TextBoxVisibilityProperty = DependencyProperty.Register(
|
697
|
"TextBoxVisibility", typeof(Visibility), typeof(ArrowTextControl), new PropertyMetadata((Visibility.Visible), OnTextBoxVisibilityChanged));
|
698
|
|
699
|
//강인구 추가(주석풀기)
|
700
|
public static readonly DependencyProperty TextBlockVisibilityProperty = DependencyProperty.Register(
|
701
|
"TextBlockVisibility", typeof(Visibility), typeof(ArrowTextControl), new PropertyMetadata((Visibility.Collapsed), OnTextBlockVisibilityChanged));
|
702
|
|
703
|
public static readonly DependencyProperty IsEditingProperty = DependencyProperty.Register(
|
704
|
"IsEditing", typeof(bool), typeof(ArrowTextControl), new PropertyMetadata((false), new PropertyChangedCallback(OnIsEditingChanged)));
|
705
|
|
706
|
public static readonly DependencyProperty EnableEditingProperty = DependencyProperty.Register(
|
707
|
"EnableEditing", typeof(bool), typeof(ArrowTextControl), new PropertyMetadata((true)));
|
708
|
|
709
|
#endregion
|
710
|
|
711
|
#endregion
|
712
|
|
713
|
#region CallBack Method
|
714
|
|
715
|
//강인구 추가(주석풀기)
|
716
|
public static void OnIsEditingChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
|
717
|
{
|
718
|
var instance = (ArrowTextControl)sender;
|
719
|
|
720
|
if (e.OldValue != e.NewValue && instance.Base_TextBlock != null)
|
721
|
{
|
722
|
instance.SetValue(e.Property, e.NewValue);
|
723
|
|
724
|
if (instance.EnableEditing)
|
725
|
{
|
726
|
if (instance.IsEditing)
|
727
|
{
|
728
|
instance.EditingMode();
|
729
|
}
|
730
|
else
|
731
|
{
|
732
|
instance.UnEditingMode();
|
733
|
}
|
734
|
}
|
735
|
else
|
736
|
{
|
737
|
instance.UnEditingMode();
|
738
|
}
|
739
|
}
|
740
|
}
|
741
|
|
742
|
public static void OnTextBoxVisibilityChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
|
743
|
{
|
744
|
var instance = (ArrowTextControl)sender;
|
745
|
|
746
|
if (e.OldValue != e.NewValue && instance.Base_ArrowPath != null)
|
747
|
{
|
748
|
instance.SetValue(e.Property, e.NewValue);
|
749
|
}
|
750
|
}
|
751
|
|
752
|
public static void OnTextBlockVisibilityChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
|
753
|
{
|
754
|
var instance = (ArrowTextControl)sender;
|
755
|
|
756
|
if (e.OldValue != e.NewValue && instance.Base_ArrowPath != null)
|
757
|
{
|
758
|
instance.SetValue(e.Property, e.NewValue);
|
759
|
}
|
760
|
}
|
761
|
|
762
|
public static void PointValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
|
763
|
{
|
764
|
var instance = (ArrowTextControl)sender;
|
765
|
|
766
|
if (e.OldValue != e.NewValue && instance.Base_ArrowPath != null)
|
767
|
{
|
768
|
instance.SetArrowTextPath();
|
769
|
}
|
770
|
}
|
771
|
|
772
|
|
773
|
|
774
|
public static void TextChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
|
775
|
{
|
776
|
var instance = (ArrowTextControl)sender;
|
777
|
|
778
|
if (e.OldValue != e.NewValue)
|
779
|
{
|
780
|
instance.SetValue(e.Property, e.NewValue);
|
781
|
//instance.BoxWidth = instance.Base_TextBox.ActualWidth;
|
782
|
//instance.BoxHeight = instance.Base_TextBox.ActualHeight;
|
783
|
}
|
784
|
}
|
785
|
|
786
|
public static void OnCenterXYChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
|
787
|
{
|
788
|
var instance = (ArrowTextControl)sender;
|
789
|
if (e.OldValue != e.NewValue && instance.Base_ArrowPath != null)
|
790
|
{
|
791
|
instance.SetValue(e.Property, e.NewValue);
|
792
|
instance.SetArrowTextPath();
|
793
|
}
|
794
|
}
|
795
|
|
796
|
public static void OnSetCansvasChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
|
797
|
{
|
798
|
var instance = (ArrowTextControl)sender;
|
799
|
|
800
|
if (e.OldValue != e.NewValue && instance != null)
|
801
|
{
|
802
|
instance.SetValue(e.Property, e.NewValue);
|
803
|
//Canvas.SetLeft(instance, instance.CanvasX);
|
804
|
//Canvas.SetTop(instance, instance.CanvasY);
|
805
|
}
|
806
|
}
|
807
|
|
808
|
public static void IsSelectedChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
|
809
|
{
|
810
|
//var instance = (ArrowTextControl)sender;
|
811
|
|
812
|
//if (e.OldValue != e.NewValue)
|
813
|
//{
|
814
|
// instance.SetValue(e.Property, e.NewValue);
|
815
|
|
816
|
// if (instance.IsSelected && instance.Base_TextBox != null)
|
817
|
// {
|
818
|
// instance.BorderSize = new Thickness(1);
|
819
|
// //instance.Base_TextBox.BorderBrush = new SolidColorBrush(Colors.Blue);
|
820
|
// //instance.Base_ArrowPath.Stroke = new SolidColorBrush(Colors.Blue);
|
821
|
// }
|
822
|
// else
|
823
|
// {
|
824
|
// instance.BorderSize = new Thickness(0);
|
825
|
// //instance.Base_TextBox.BorderBrush = new SolidColorBrush(Colors.Transparent);
|
826
|
// //instance.Base_ArrowPath.Stroke = new SolidColorBrush(Colors.Transparent);
|
827
|
// }
|
828
|
//}
|
829
|
}
|
830
|
#endregion
|
831
|
|
832
|
#region Internal Method
|
833
|
|
834
|
//강인구 주석 풀기
|
835
|
public void EditingMode()
|
836
|
{
|
837
|
TextBoxVisibility = Visibility.Visible;
|
838
|
TextBlockVisibility = Visibility.Collapsed;
|
839
|
|
840
|
|
841
|
//강인구 언더라인 추가
|
842
|
if (UnderLine != null)
|
843
|
Base_TextBlock.TextDecorations = UnderLine;
|
844
|
}
|
845
|
//강인구 주석 풀기
|
846
|
public void UnEditingMode()
|
847
|
{
|
848
|
|
849
|
TextBoxVisibility = Visibility.Collapsed;
|
850
|
TextBlockVisibility = Visibility.Visible;
|
851
|
|
852
|
if (UnderLine != null)
|
853
|
Base_TextBlock.TextDecorations = UnderLine;
|
854
|
|
855
|
Base_TextBlock.Margin =
|
856
|
new Thickness(Base_TextBox.Margin.Left + 4, Base_TextBox.Margin.Top + 4,
|
857
|
Base_TextBox.Margin.Right + 4, Base_TextBox.Margin.Bottom + 4);
|
858
|
}
|
859
|
|
860
|
private void SetArrowTextPath()
|
861
|
{
|
862
|
instanceGroup.Children.Clear();
|
863
|
|
864
|
connectorSMGeometry.StartPoint = this.StartPoint;
|
865
|
connectorSMGeometry.EndPoint = this.MidPoint;
|
866
|
connectorMEGeometry.StartPoint = this.MidPoint; //핵심
|
867
|
|
868
|
Canvas.SetLeft(Base_TextBox, this.EndPoint.X);
|
869
|
Canvas.SetTop(Base_TextBox, this.EndPoint.Y);
|
870
|
|
871
|
List<Point> ps = new List<Point>();
|
872
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth / 2, Canvas.GetTop(Base_TextBox))); //상단
|
873
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth / 2, Canvas.GetTop(Base_TextBox) + this.BoxHeight)); // 하단
|
874
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxHeight / 2)); //좌단
|
875
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth, Canvas.GetTop(Base_TextBox) + this.BoxHeight / 2)); //우단
|
876
|
|
877
|
if (isTrans)
|
878
|
{
|
879
|
switch (Math.Abs(this.Angle).ToString())
|
880
|
{
|
881
|
case "90":
|
882
|
{
|
883
|
ps.Clear();
|
884
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽
|
885
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth / 2)); // 위 중간
|
886
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth)); // 위 오른쪽
|
887
|
|
888
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight / 2, Canvas.GetTop(Base_TextBox))); //왼쪽 중간
|
889
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox))); //왼쪽 하단
|
890
|
|
891
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox) - this.BoxWidth / 2)); //중간 하단
|
892
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox) - this.BoxWidth)); //오른쪽 하단
|
893
|
|
894
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) - this.BoxWidth)); //오른쪽 중간
|
895
|
}
|
896
|
break;
|
897
|
case "270":
|
898
|
{
|
899
|
ps.Clear();
|
900
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽
|
901
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth / 2)); // 위 중간
|
902
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth)); // 위 오른쪽
|
903
|
|
904
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight / 2, Canvas.GetTop(Base_TextBox))); //왼쪽 중간
|
905
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight, Canvas.GetTop(Base_TextBox))); //왼쪽 하단
|
906
|
|
907
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight, Canvas.GetTop(Base_TextBox) + this.BoxWidth / 2)); //중간 하단
|
908
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight, Canvas.GetTop(Base_TextBox) + this.BoxWidth)); //오른쪽 하단
|
909
|
|
910
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) + this.BoxWidth)); //오른쪽 중간
|
911
|
}
|
912
|
break;
|
913
|
default:
|
914
|
break;
|
915
|
}
|
916
|
|
917
|
var endP = MathSet.getNearPoint(ps, this.MidPoint);
|
918
|
|
919
|
//20180911 LJY 꺾이는 부분 수정
|
920
|
Point testP = endP;
|
921
|
switch (Math.Abs(this.Angle).ToString())
|
922
|
{
|
923
|
case "90":
|
924
|
testP = new Point(endP.X + 50, endP.Y);
|
925
|
break;
|
926
|
case "270":
|
927
|
testP = new Point(endP.X - 50, endP.Y);
|
928
|
break;
|
929
|
}
|
930
|
|
931
|
//20180910 LJY 각도에 따라.
|
932
|
switch (Math.Abs(this.Angle).ToString())
|
933
|
{
|
934
|
case "90":
|
935
|
if (isFixed)
|
936
|
{
|
937
|
if (ps[0] == endP) //상단
|
938
|
{
|
939
|
testP = new Point(endP.X , endP.Y + 50);
|
940
|
//System.Diagnostics.Debug.WriteLine("상단"+ testP);
|
941
|
}
|
942
|
else if (ps[1] == endP) //하단
|
943
|
{
|
944
|
testP = new Point(endP.X , endP.Y - 50);
|
945
|
//System.Diagnostics.Debug.WriteLine("하단"+ testP);
|
946
|
}
|
947
|
else if (ps[2] == endP) //좌단
|
948
|
{
|
949
|
testP = new Point(endP.X - 50, endP.Y);
|
950
|
//System.Diagnostics.Debug.WriteLine("좌단"+ testP);
|
951
|
}
|
952
|
else if (ps[3] == endP) //우단
|
953
|
{
|
954
|
testP = new Point(endP.X + 50, endP.Y);
|
955
|
//System.Diagnostics.Debug.WriteLine("우단"+ testP);
|
956
|
}
|
957
|
}
|
958
|
break;
|
959
|
case "270":
|
960
|
if (isFixed)
|
961
|
{
|
962
|
if (ps[0] == endP) //상단
|
963
|
{
|
964
|
testP = new Point(endP.X , endP.Y - 50);
|
965
|
//System.Diagnostics.Debug.WriteLine("상단" + testP);
|
966
|
}
|
967
|
else if (ps[1] == endP) //하단
|
968
|
{
|
969
|
testP = new Point(endP.X, endP.Y + 50);
|
970
|
//System.Diagnostics.Debug.WriteLine("하단" + testP);
|
971
|
}
|
972
|
else if (ps[2] == endP) //좌단
|
973
|
{
|
974
|
testP = new Point(endP.X + 50, endP.Y);
|
975
|
//System.Diagnostics.Debug.WriteLine("좌단" + testP);
|
976
|
}
|
977
|
else if (ps[3] == endP) //우단
|
978
|
{
|
979
|
testP = new Point(endP.X - 50, endP.Y);
|
980
|
//System.Diagnostics.Debug.WriteLine("우단" + testP);
|
981
|
}
|
982
|
}
|
983
|
break;
|
984
|
default:
|
985
|
if (isFixed)
|
986
|
{
|
987
|
if (ps[0] == endP) //상단
|
988
|
{
|
989
|
testP = new Point(endP.X, endP.Y - 50);
|
990
|
//System.Diagnostics.Debug.WriteLine("상단");
|
991
|
}
|
992
|
else if (ps[1] == endP) //하단
|
993
|
{
|
994
|
testP = new Point(endP.X, endP.Y + 50);
|
995
|
//System.Diagnostics.Debug.WriteLine("하단");
|
996
|
}
|
997
|
else if (ps[2] == endP) //좌단
|
998
|
{
|
999
|
testP = new Point(endP.X - 50, endP.Y);
|
1000
|
//System.Diagnostics.Debug.WriteLine("좌단");
|
1001
|
}
|
1002
|
else if (ps[3] == endP) //우단
|
1003
|
{
|
1004
|
testP = new Point(endP.X + 50, endP.Y);
|
1005
|
//System.Diagnostics.Debug.WriteLine("우단");
|
1006
|
}
|
1007
|
}
|
1008
|
break;
|
1009
|
}
|
1010
|
connectorMEGeometry.EndPoint = endP;
|
1011
|
connectorSMGeometry.EndPoint = testP;
|
1012
|
connectorMEGeometry.StartPoint = testP;
|
1013
|
|
1014
|
//20180910 LJY 각도에 따라.
|
1015
|
this.MidPoint = testP;
|
1016
|
instanceGroup.Children.Add(DrawSet.DrawArrow(testP, this.StartPoint, this.LineSize));
|
1017
|
instanceGroup.FillRule = FillRule.Nonzero;
|
1018
|
this.Base_ArrowPath.Fill = this.StrokeColor;
|
1019
|
this.Base_ArrowSubPath.Fill = this.StrokeColor;
|
1020
|
}
|
1021
|
else
|
1022
|
{
|
1023
|
switch (Math.Abs(this.Angle).ToString())
|
1024
|
{
|
1025
|
case "90":
|
1026
|
{
|
1027
|
ps.Clear();
|
1028
|
|
1029
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽
|
1030
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth / 2)); // 위 중간
|
1031
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth)); // 위 오른쪽
|
1032
|
|
1033
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight / 2, Canvas.GetTop(Base_TextBox))); //왼쪽 중간
|
1034
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox))); //왼쪽 하단
|
1035
|
|
1036
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox) - this.BoxWidth / 2)); //중간 하단
|
1037
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox) - this.BoxWidth)); //오른쪽 하단
|
1038
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) - this.BoxWidth)); //오른쪽 중간
|
1039
|
}
|
1040
|
break;
|
1041
|
case "270":
|
1042
|
{
|
1043
|
ps.Clear();
|
1044
|
|
1045
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽
|
1046
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth / 2)); // 위 중간
|
1047
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth)); // 위 오른쪽
|
1048
|
|
1049
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight / 2, Canvas.GetTop(Base_TextBox))); //왼쪽 중간
|
1050
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight, Canvas.GetTop(Base_TextBox))); //왼쪽 하단
|
1051
|
|
1052
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight, Canvas.GetTop(Base_TextBox) + this.BoxWidth / 2)); //중간 하단
|
1053
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight, Canvas.GetTop(Base_TextBox) + this.BoxWidth)); //오른쪽 하단
|
1054
|
|
1055
|
ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) + this.BoxWidth)); //오른쪽 중간
|
1056
|
}
|
1057
|
break;
|
1058
|
default:
|
1059
|
break;
|
1060
|
}
|
1061
|
|
1062
|
|
1063
|
var endP = MathSet.getNearPoint(ps, this.MidPoint);
|
1064
|
connectorMEGeometry.EndPoint = endP; //최상단
|
1065
|
//connectorMEGeometry.EndPoint = this.EndPoint; //핵심
|
1066
|
//this.MidPoint= MathSet.getMiddlePoint(this.StartPoint, endP);
|
1067
|
#region 보정치
|
1068
|
Point testP = endP;
|
1069
|
|
1070
|
//20180910 LJY 각도에 따라.
|
1071
|
switch (Math.Abs(this.Angle).ToString())
|
1072
|
{
|
1073
|
case "90":
|
1074
|
if (isFixed)
|
1075
|
{
|
1076
|
if (ps[0] == endP) //상단
|
1077
|
{
|
1078
|
testP = new Point(endP.X - 50, endP.Y);
|
1079
|
//System.Diagnostics.Debug.WriteLine("상단"+ testP);
|
1080
|
}
|
1081
|
else if (ps[1] == endP) //하단
|
1082
|
{
|
1083
|
testP = new Point(endP.X + 50, endP.Y);
|
1084
|
//System.Diagnostics.Debug.WriteLine("하단"+ testP);
|
1085
|
}
|
1086
|
else if (ps[2] == endP) //좌단
|
1087
|
{
|
1088
|
testP = new Point(endP.X - 50, endP.Y);
|
1089
|
//System.Diagnostics.Debug.WriteLine("좌단"+ testP);
|
1090
|
}
|
1091
|
else if (ps[3] == endP) //우단
|
1092
|
{
|
1093
|
testP = new Point(endP.X + 50 , endP.Y);
|
1094
|
//System.Diagnostics.Debug.WriteLine("우단"+ testP);
|
1095
|
}
|
1096
|
}
|
1097
|
break;
|
1098
|
case "270":
|
1099
|
if (isFixed)
|
1100
|
{
|
1101
|
if (ps[0] == endP) //상단
|
1102
|
{
|
1103
|
testP = new Point(endP.X + 50, endP.Y);
|
1104
|
//System.Diagnostics.Debug.WriteLine("상단" + testP);
|
1105
|
}
|
1106
|
else if (ps[1] == endP) //하단
|
1107
|
{
|
1108
|
testP = new Point(endP.X - 50, endP.Y);
|
1109
|
//System.Diagnostics.Debug.WriteLine("하단" + testP);
|
1110
|
}
|
1111
|
else if (ps[2] == endP) //좌단
|
1112
|
{
|
1113
|
testP = new Point(endP.X + 50, endP.Y);
|
1114
|
//System.Diagnostics.Debug.WriteLine("좌단" + testP);
|
1115
|
}
|
1116
|
else if (ps[3] == endP) //우단
|
1117
|
{
|
1118
|
testP = new Point(endP.X + 50, endP.Y );
|
1119
|
//System.Diagnostics.Debug.WriteLine("우단" + testP);
|
1120
|
}
|
1121
|
}
|
1122
|
break;
|
1123
|
default:
|
1124
|
if (isFixed)
|
1125
|
{
|
1126
|
if (ps[0] == endP) //상단
|
1127
|
{
|
1128
|
testP = new Point(endP.X, endP.Y - 50);
|
1129
|
//System.Diagnostics.Debug.WriteLine("상단");
|
1130
|
}
|
1131
|
else if (ps[1] == endP) //하단
|
1132
|
{
|
1133
|
testP = new Point(endP.X, endP.Y + 50);
|
1134
|
//System.Diagnostics.Debug.WriteLine("하단");
|
1135
|
}
|
1136
|
else if (ps[2] == endP) //좌단
|
1137
|
{
|
1138
|
testP = new Point(endP.X - 50, endP.Y);
|
1139
|
//System.Diagnostics.Debug.WriteLine("좌단");
|
1140
|
}
|
1141
|
else if (ps[3] == endP) //우단
|
1142
|
{
|
1143
|
testP = new Point(endP.X + 50, endP.Y);
|
1144
|
//System.Diagnostics.Debug.WriteLine("우단");
|
1145
|
}
|
1146
|
}
|
1147
|
break;
|
1148
|
}
|
1149
|
|
1150
|
|
1151
|
connectorSMGeometry.EndPoint = testP;
|
1152
|
connectorMEGeometry.StartPoint = testP;
|
1153
|
instanceGroup.Children.Add(DrawSet.DrawArrow(testP, this.StartPoint, this.LineSize));
|
1154
|
instanceGroup.FillRule = FillRule.Nonzero;
|
1155
|
this.Base_ArrowPath.Fill = this.StrokeColor;
|
1156
|
this.Base_ArrowSubPath.Fill = this.StrokeColor;
|
1157
|
#endregion
|
1158
|
}
|
1159
|
|
1160
|
switch (this.ArrowTextStyle)
|
1161
|
{
|
1162
|
case ArrowTextStyleSet.Normal:
|
1163
|
this.BorderSize = new Thickness(0);
|
1164
|
DrawingRect();
|
1165
|
break;
|
1166
|
case ArrowTextStyleSet.Cloud:
|
1167
|
this.BorderSize = new Thickness(0);
|
1168
|
DrawingCloud();
|
1169
|
break;
|
1170
|
default:
|
1171
|
{
|
1172
|
this.BorderSize = new Thickness(LineSize); //올라
|
1173
|
DrawingRect();
|
1174
|
}
|
1175
|
|
1176
|
break;
|
1177
|
}
|
1178
|
|
1179
|
if (isHighLight)
|
1180
|
{
|
1181
|
SubPathFill = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B));
|
1182
|
BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B));
|
1183
|
|
1184
|
TextBoxBackground = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B));
|
1185
|
}
|
1186
|
else
|
1187
|
{
|
1188
|
BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
|
1189
|
SubPathFill = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B));
|
1190
|
TextBoxBackground = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.1), Colors.White.R, Colors.White.G, Colors.White.B));
|
1191
|
}
|
1192
|
|
1193
|
instanceGroup.Children.Add(connectorSMGeometry);
|
1194
|
instanceGroup.Children.Add(connectorMEGeometry);
|
1195
|
|
1196
|
this.PathData = instanceGroup;
|
1197
|
OverViewPathData = PathData;
|
1198
|
OverViewArrowText = ArrowText;
|
1199
|
OverViewEndPoint = connectorMEGeometry.EndPoint;
|
1200
|
OverViewStartPoint = connectorSMGeometry.StartPoint;
|
1201
|
|
1202
|
var tempAngle = Math.Abs(this.Angle);
|
1203
|
|
1204
|
if (tempAngle == Convert.ToDouble(90) || tempAngle == Convert.ToDouble(270))
|
1205
|
{
|
1206
|
this.RenderTransformOrigin = new Point(0.5, 0.5);
|
1207
|
this.Base_ArrowPath.RenderTransformOrigin = new Point(0, 0);
|
1208
|
this.Base_ArrowSubPath.RenderTransformOrigin = new Point(0, 0);
|
1209
|
|
1210
|
Base_TextBox.RenderTransformOrigin = new Point(0, 0);
|
1211
|
}
|
1212
|
|
1213
|
Base_ArrowSubPath.RenderTransform = new RotateTransform
|
1214
|
{
|
1215
|
Angle = this.Angle,
|
1216
|
CenterX = this.EndPoint.X,
|
1217
|
CenterY = this.EndPoint.Y,
|
1218
|
};
|
1219
|
}
|
1220
|
|
1221
|
private void DrawingCloud()
|
1222
|
{
|
1223
|
//20180906 LJY Textbox guide
|
1224
|
string angle = Math.Abs(this.Angle).ToString();
|
1225
|
if (angle == "180")
|
1226
|
{
|
1227
|
List<Point> pCloud = new List<Point>()
|
1228
|
{
|
1229
|
new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
|
1230
|
new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - BoxHeight), //왼쪽 아래
|
1231
|
new Point(Canvas.GetLeft(Base_TextBox) - BoxWidth, Canvas.GetTop(Base_TextBox) - BoxHeight),
|
1232
|
new Point(Canvas.GetLeft(Base_TextBox) - BoxWidth, Canvas.GetTop(Base_TextBox)),
|
1233
|
new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
|
1234
|
};
|
1235
|
SubPathData = (Generate(pCloud));
|
1236
|
PathDataInner = (GenerateInnerCloud(pCloud, angle));
|
1237
|
|
1238
|
}//20180906 LJY Textbox guide
|
1239
|
else
|
1240
|
{
|
1241
|
List<Point> pCloud = new List<Point>()
|
1242
|
{
|
1243
|
#if SILVERLIGHT
|
1244
|
new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
|
1245
|
new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight), //왼쪽 아래
|
1246
|
new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth, Canvas.GetTop(Base_TextBox) + BoxHeight),
|
1247
|
new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth, Canvas.GetTop(Base_TextBox)),
|
1248
|
new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
|
1249
|
|
1250
|
#else
|
1251
|
new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
|
1252
|
new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight), //왼쪽 아래
|
1253
|
new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth, Canvas.GetTop(Base_TextBox) + BoxHeight),
|
1254
|
new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth, Canvas.GetTop(Base_TextBox)),
|
1255
|
new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
|
1256
|
|
1257
|
//new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
|
1258
|
//new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight-4), //왼쪽 아래
|
1259
|
//new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth-1, Canvas.GetTop(Base_TextBox) + BoxHeight-4),
|
1260
|
//new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth-1, Canvas.GetTop(Base_TextBox)),
|
1261
|
//new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
|
1262
|
#endif
|
1263
|
};
|
1264
|
//instanceGroup.Children.Add(Generate(pCloud));
|
1265
|
SubPathData = (Generate(pCloud));
|
1266
|
PathDataInner = (GenerateInnerCloud(pCloud, angle));
|
1267
|
// }
|
1268
|
}
|
1269
|
|
1270
|
}
|
1271
|
|
1272
|
private void DrawingRect()
|
1273
|
{
|
1274
|
//20180906 LJY Textbox guide
|
1275
|
if(this.ArrowTextStyle == ArrowTextStyleSet.Normal)
|
1276
|
{
|
1277
|
this.Base_TextBox.BorderBrush = Brushes.Transparent;
|
1278
|
}
|
1279
|
if (Math.Abs(this.Angle).ToString() == "90")
|
1280
|
{
|
1281
|
List<Point> pCloud = new List<Point>()
|
1282
|
{
|
1283
|
new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
|
1284
|
new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - BoxWidth), //왼쪽 아래
|
1285
|
new Point(Canvas.GetLeft(Base_TextBox) + BoxHeight, Canvas.GetTop(Base_TextBox) - BoxWidth),
|
1286
|
new Point(Canvas.GetLeft(Base_TextBox) + BoxHeight, Canvas.GetTop(Base_TextBox)),
|
1287
|
new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
|
1288
|
};
|
1289
|
PathDataInner = (GenerateInner(pCloud));
|
1290
|
}
|
1291
|
else if(Math.Abs(this.Angle).ToString() == "270")
|
1292
|
{
|
1293
|
List<Point> pCloud = new List<Point>()
|
1294
|
{
|
1295
|
new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
|
1296
|
new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + BoxWidth), //왼쪽 아래
|
1297
|
new Point(Canvas.GetLeft(Base_TextBox) - BoxHeight, Canvas.GetTop(Base_TextBox) + BoxWidth),
|
1298
|
new Point(Canvas.GetLeft(Base_TextBox) - BoxHeight, Canvas.GetTop(Base_TextBox)),
|
1299
|
new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
|
1300
|
};
|
1301
|
PathDataInner = (GenerateInner(pCloud));
|
1302
|
}//20180906 LJY Textbox guide
|
1303
|
else
|
1304
|
{
|
1305
|
List<Point> pCloud = new List<Point>()
|
1306
|
{
|
1307
|
#if SILVERLIGHT
|
1308
|
new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
|
1309
|
new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight), //왼쪽 아래
|
1310
|
new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth, Canvas.GetTop(Base_TextBox) + BoxHeight),
|
1311
|
new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth, Canvas.GetTop(Base_TextBox)),
|
1312
|
new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
|
1313
|
|
1314
|
#else
|
1315
|
new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
|
1316
|
new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight), //왼쪽 아래
|
1317
|
new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth, Canvas.GetTop(Base_TextBox) + BoxHeight),
|
1318
|
new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth, Canvas.GetTop(Base_TextBox)),
|
1319
|
new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
|
1320
|
|
1321
|
//new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
|
1322
|
//new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight-4), //왼쪽 아래
|
1323
|
//new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth-1, Canvas.GetTop(Base_TextBox) + BoxHeight-4),
|
1324
|
//new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth-1, Canvas.GetTop(Base_TextBox)),
|
1325
|
//new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위
|
1326
|
#endif
|
1327
|
};
|
1328
|
//instanceGroup.Children.Add(Generate(pCloud));
|
1329
|
PathDataInner = (GenerateInner(pCloud));
|
1330
|
}
|
1331
|
}
|
1332
|
|
1333
|
public void updateControl()
|
1334
|
{
|
1335
|
this.StartPoint = new Point(this.PointSet[0].X, this.PointSet[0].Y);
|
1336
|
this.MidPoint = new Point(this.PointSet[1].X, this.PointSet[1].Y);
|
1337
|
this.EndPoint = new Point(this.PointSet[2].X, this.PointSet[2].Y);
|
1338
|
}
|
1339
|
|
1340
|
public override void ApplyOverViewData()
|
1341
|
{
|
1342
|
this.OverViewPathData = this.PathData;
|
1343
|
if (ArrowText == "")
|
1344
|
this.ArrowText = this.OverViewArrowText;
|
1345
|
else
|
1346
|
this.OverViewArrowText = this.ArrowText;
|
1347
|
this.OverViewStartPoint = this.StartPoint;
|
1348
|
this.OverViewEndPoint = this.EndPoint;
|
1349
|
}
|
1350
|
|
1351
|
#endregion
|
1352
|
|
1353
|
public static PathFigure GenerateLineWithCloud(Point p1, Point p2, double arcLength_, bool reverse)
|
1354
|
{
|
1355
|
PathFigure pathFigure = new PathFigure();
|
1356
|
pathFigure.StartPoint = p1;
|
1357
|
|
1358
|
double arcLength = arcLength_;
|
1359
|
/// draw arcs which has arcLength between p1 and p2 - 2012.06.21 added by humkyung
|
1360
|
double dx = p2.X - p1.X;
|
1361
|
double dy = p2.Y - p1.Y;
|
1362
|
double l = MathSet.DistanceTo(p1, p2); /// distance between p1 and p2
|
1363
|
double theta = Math.Atan2(Math.Abs(dy), Math.Abs(dx)) * 180 / Math.PI;
|
1364
|
Point lastPt = new Point(p1.X, p1.Y);
|
1365
|
double count = l / arcLength;
|
1366
|
/// normalize
|
1367
|
dx /= l;
|
1368
|
dy /= l;
|
1369
|
Double j = 1;
|
1370
|
for (j = 1; j < (count - 1); j++)
|
1371
|
{
|
1372
|
ArcSegment arcSeg = new ArcSegment();
|
1373
|
arcSeg.Size = new Size(arcLength * _CloudArcDepth, arcLength * _CloudArcDepth); /// x size and y size of arc
|
1374
|
arcSeg.Point = new Point(p1.X + j * dx * arcLength, p1.Y + j * dy * arcLength); /// end point of arc
|
1375
|
lastPt = arcSeg.Point; /// save last point
|
1376
|
arcSeg.RotationAngle = theta + 90;
|
1377
|
if (true == reverse) arcSeg.SweepDirection = SweepDirection.Clockwise;
|
1378
|
pathFigure.Segments.Add(arcSeg);
|
1379
|
}
|
1380
|
|
1381
|
/// draw arc between last point and end point
|
1382
|
if ((count > j) || (count > 0))
|
1383
|
{
|
1384
|
arcLength = MathSet.DistanceTo(lastPt, p2);
|
1385
|
ArcSegment arcSeg = new ArcSegment();
|
1386
|
arcSeg.Size = new Size(arcLength * _CloudArcDepth, arcLength * _CloudArcDepth); /// x size and y size of arc
|
1387
|
arcSeg.Point = new Point(p2.X, p2.Y); /// end point of arc
|
1388
|
arcSeg.RotationAngle = theta;
|
1389
|
if (true == reverse) arcSeg.SweepDirection = SweepDirection.Clockwise;
|
1390
|
pathFigure.Segments.Add(arcSeg);
|
1391
|
}
|
1392
|
/// up to here
|
1393
|
|
1394
|
return pathFigure;
|
1395
|
}
|
1396
|
|
1397
|
public static PathGeometry Generate(List<Point> pData)
|
1398
|
{
|
1399
|
var _pathGeometry = new PathGeometry();
|
1400
|
|
1401
|
double area = MathSet.AreaOf(pData);
|
1402
|
bool reverse = (area > 0);
|
1403
|
int count = pData.Count;
|
1404
|
for (int i = 0; i < (count - 1); i++)
|
1405
|
{
|
1406
|
PathFigure pathFigure = GenerateLineWithCloud(pData[i], pData[i + 1], 20, reverse);
|
1407
|
pathFigure.IsClosed = false;
|
1408
|
pathFigure.IsFilled = true;
|
1409
|
_pathGeometry.Figures.Add(pathFigure);
|
1410
|
}
|
1411
|
|
1412
|
return _pathGeometry;
|
1413
|
}
|
1414
|
|
1415
|
|
1416
|
public static PathGeometry GenerateInner(List<Point> pData)
|
1417
|
{
|
1418
|
var _pathGeometry = new PathGeometry();
|
1419
|
double area = MathSet.AreaOf(pData);
|
1420
|
bool reverse = (area > 0);
|
1421
|
int count = pData.Count;
|
1422
|
|
1423
|
PathFigure pathFigur2 = new PathFigure();
|
1424
|
pathFigur2.StartPoint = pData[0];
|
1425
|
|
1426
|
LineSegment lineSegment0 = new LineSegment();
|
1427
|
lineSegment0.Point = pData[0];
|
1428
|
pathFigur2.Segments.Add(lineSegment0);
|
1429
|
|
1430
|
LineSegment lineSegment1 = new LineSegment();
|
1431
|
lineSegment1.Point = pData[1];
|
1432
|
pathFigur2.Segments.Add(lineSegment1);
|
1433
|
|
1434
|
LineSegment lineSegment2 = new LineSegment();
|
1435
|
lineSegment2.Point = pData[2];
|
1436
|
pathFigur2.Segments.Add(lineSegment2);
|
1437
|
|
1438
|
LineSegment lineSegment3 = new LineSegment();
|
1439
|
lineSegment3.Point = pData[3];
|
1440
|
pathFigur2.Segments.Add(lineSegment3);
|
1441
|
|
1442
|
|
1443
|
pathFigur2.IsClosed = true;
|
1444
|
pathFigur2.IsFilled = true;
|
1445
|
_pathGeometry.Figures.Add(pathFigur2);
|
1446
|
|
1447
|
return _pathGeometry;
|
1448
|
}
|
1449
|
|
1450
|
//20180910 LJY Cloud rotation 추가
|
1451
|
public static PathGeometry GenerateInnerCloud(List<Point> pData, string angle)
|
1452
|
{
|
1453
|
var _pathGeometry = new PathGeometry();
|
1454
|
double area = MathSet.AreaOf(pData);
|
1455
|
bool reverse = (area > 0);
|
1456
|
int count = pData.Count;
|
1457
|
|
1458
|
PathFigure pathFigur2 = new PathFigure();
|
1459
|
pathFigur2.StartPoint = pData[0];
|
1460
|
|
1461
|
LineSegment lineSegment0 = new LineSegment();
|
1462
|
lineSegment0.Point = pData[0];
|
1463
|
pathFigur2.Segments.Add(lineSegment0);
|
1464
|
|
1465
|
LineSegment lineSegment1 = new LineSegment();
|
1466
|
lineSegment1.Point = pData[1];
|
1467
|
pathFigur2.Segments.Add(lineSegment1);
|
1468
|
|
1469
|
LineSegment lineSegment2 = new LineSegment();
|
1470
|
lineSegment2.Point = pData[2];
|
1471
|
pathFigur2.Segments.Add(lineSegment2);
|
1472
|
|
1473
|
LineSegment lineSegment3 = new LineSegment();
|
1474
|
lineSegment3.Point = pData[3];
|
1475
|
pathFigur2.Segments.Add(lineSegment3);
|
1476
|
|
1477
|
RotateTransform transform = new RotateTransform();
|
1478
|
switch (angle)
|
1479
|
{
|
1480
|
case "90":
|
1481
|
transform.Angle = -90;
|
1482
|
break;
|
1483
|
case "180":
|
1484
|
transform.Angle = -180;
|
1485
|
break;
|
1486
|
case "270":
|
1487
|
transform.Angle = -270;
|
1488
|
break;
|
1489
|
}
|
1490
|
transform.CenterX = pData[0].X;
|
1491
|
transform.CenterY = pData[0].Y;
|
1492
|
_pathGeometry.Transform = transform;
|
1493
|
|
1494
|
pathFigur2.IsClosed = true;
|
1495
|
pathFigur2.IsFilled = true;
|
1496
|
_pathGeometry.Figures.Add(pathFigur2);
|
1497
|
|
1498
|
return _pathGeometry;
|
1499
|
}
|
1500
|
|
1501
|
/// <summary>
|
1502
|
/// return ArrowTextControl's area
|
1503
|
/// </summary>
|
1504
|
/// <author>humkyung</author>
|
1505
|
/// <date>2019.06.13</date>
|
1506
|
public override Rect ItemRect
|
1507
|
{
|
1508
|
get
|
1509
|
{
|
1510
|
double dMinX = Math.Min(this.StartPoint.X, this.EndPoint.X);
|
1511
|
double dMinY = Math.Min(this.StartPoint.Y, this.EndPoint.Y);
|
1512
|
double dMaxX = Math.Max(this.StartPoint.X, this.EndPoint.X);
|
1513
|
double dMaxY = Math.Max(this.StartPoint.Y, this.EndPoint.Y);
|
1514
|
|
1515
|
return new Rect(new Point(dMinX, dMinY), new Point(dMaxX, dMaxY));
|
1516
|
}
|
1517
|
}
|
1518
|
|
1519
|
/// <summary>
|
1520
|
/// Serialize this
|
1521
|
/// </summary>
|
1522
|
/// <param name="sUserId"></param>
|
1523
|
/// <returns></returns>
|
1524
|
public override string Serialize()
|
1525
|
{
|
1526
|
using (S_ArrowTextControl STemp = new S_ArrowTextControl())
|
1527
|
{
|
1528
|
STemp.TransformPoint = "0|0";
|
1529
|
STemp.PointSet = this.PointSet;
|
1530
|
STemp.SizeSet = String.Format("{0}", this.LineSize);
|
1531
|
STemp.StrokeColor = this.StrokeColor.Color.ToString();
|
1532
|
STemp.StartPoint = this.StartPoint;
|
1533
|
STemp.ArrowStyle = this.ArrowTextStyle;
|
1534
|
//STemp.StrokeColor = "#FF00FF00";
|
1535
|
STemp.UserID = this.UserID;
|
1536
|
STemp.ArrowText = this.Base_TextBox.Text;
|
1537
|
STemp.BorderSize = this.BorderSize;
|
1538
|
STemp.isHighLight = this.isHighLight;
|
1539
|
STemp.BoxHeight = this.BoxHeight;
|
1540
|
STemp.BoxWidth = this.BoxWidth;
|
1541
|
STemp.Opac = this.Opacity;
|
1542
|
STemp.EndPoint = this.EndPoint;
|
1543
|
STemp.isFixed = this.isFixed;
|
1544
|
//STemp.DashSize = this.DashSize;
|
1545
|
STemp.Name = this.GetType().Name.ToString();
|
1546
|
STemp.isTrans = this.isTrans;
|
1547
|
STemp.MidPoint = this.MidPoint;
|
1548
|
STemp.Angle = this.Angle;
|
1549
|
STemp.fontConfig = new List<string>()
|
1550
|
{
|
1551
|
this.TextFamily.ToString(),
|
1552
|
this.TextStyle.ToString(),
|
1553
|
this.TextWeight.ToString(),
|
1554
|
this.TextSize.ToString(),
|
1555
|
};
|
1556
|
|
1557
|
if (this.UnderLine != null)
|
1558
|
{
|
1559
|
STemp.fontConfig.Add("true");
|
1560
|
}
|
1561
|
|
1562
|
///강인구 추가(2017.11.02)
|
1563
|
///Memo 추가
|
1564
|
STemp.Memo = this.Memo;
|
1565
|
STemp.BorderSize = this.BorderSize;
|
1566
|
return "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize()));
|
1567
|
};
|
1568
|
}
|
1569
|
|
1570
|
/// <summary>
|
1571
|
/// create a arrowtextcontrol from given string
|
1572
|
/// </summary>
|
1573
|
/// <param name="str"></param>
|
1574
|
/// <returns></returns>
|
1575
|
public static ArrowTextControl FromString(string str, SolidColorBrush brush, string sProjectNo)
|
1576
|
{
|
1577
|
ArrowTextControl instance = null;
|
1578
|
using (S_ArrowTextControl s = JsonSerializerHelper.JsonDeserialize<S_ArrowTextControl>(str))
|
1579
|
{
|
1580
|
string[] data2 = s.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
|
1581
|
instance = new ArrowTextControl();
|
1582
|
instance.LineSize = Convert.ToDouble(data2.First());
|
1583
|
instance.PointSet = s.PointSet;
|
1584
|
instance.StartPoint = s.StartPoint;
|
1585
|
instance.EndPoint = s.EndPoint;
|
1586
|
instance.StrokeColor = brush;
|
1587
|
//instance.DashSize = s.DashSize;
|
1588
|
instance.ArrowTextStyle = s.ArrowStyle;
|
1589
|
instance.isHighLight = s.isHighLight;
|
1590
|
instance.ArrowText = s.ArrowText;
|
1591
|
instance.Opacity = s.Opac;
|
1592
|
instance.BorderSize = s.BorderSize;
|
1593
|
instance.BoxWidth = s.BoxWidth;
|
1594
|
instance.BoxHeight = s.BoxHeight;
|
1595
|
instance.isFixed = s.isFixed;
|
1596
|
instance.Angle = s.Angle;
|
1597
|
instance.UserID = s.UserID;
|
1598
|
instance.isTrans = s.isTrans;
|
1599
|
instance.MidPoint = s.MidPoint;
|
1600
|
instance.Memo = s.Memo;
|
1601
|
if (s.fontConfig == null || s.fontConfig.ToList().Count == 0)
|
1602
|
{
|
1603
|
s.fontConfig = new List<string>();
|
1604
|
|
1605
|
s.fontConfig.Add("Arial");
|
1606
|
s.fontConfig.Add("Normal");
|
1607
|
s.fontConfig.Add("Normal");
|
1608
|
s.fontConfig.Add("30");
|
1609
|
}
|
1610
|
instance.TextFamily = new FontFamily(s.fontConfig[0]);
|
1611
|
//인구 추가(2018.04.17)
|
1612
|
instance.TextStyle = StringToFont.ConFontStyle(s.fontConfig[1]);
|
1613
|
instance.TextWeight = StringToFont.ConFontWeight(s.fontConfig[2]);
|
1614
|
instance.TextSize = Convert.ToDouble(s.fontConfig[3]);
|
1615
|
|
1616
|
if (s.fontConfig.Count() == 5)
|
1617
|
{
|
1618
|
instance.UnderLine = TextDecorations.Underline;
|
1619
|
}
|
1620
|
}
|
1621
|
|
1622
|
return instance;
|
1623
|
}
|
1624
|
|
1625
|
#region Dispose
|
1626
|
public void Dispose()
|
1627
|
{
|
1628
|
GC.Collect();
|
1629
|
GC.SuppressFinalize(this);
|
1630
|
}
|
1631
|
#endregion
|
1632
|
|
1633
|
#region INotifyPropertyChanged
|
1634
|
private void OnPropertyChanged(string name)
|
1635
|
{
|
1636
|
if (PropertyChanged != null)
|
1637
|
{
|
1638
|
PropertyChanged(this, new PropertyChangedEventArgs(name));
|
1639
|
}
|
1640
|
}
|
1641
|
|
1642
|
public event PropertyChangedEventHandler PropertyChanged;
|
1643
|
#endregion
|
1644
|
}
|
1645
|
}
|