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