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