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