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