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