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