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