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