markus / KCOM / Controls / AdornerFinal.xaml.cs @ 285635d3
이력 | 보기 | 이력해설 | 다운로드 (71.4 KB)
1 |
using KCOM.Common; |
---|---|
2 |
using KCOM.Events; |
3 |
using MarkupToPDF.Common; |
4 |
using MarkupToPDF.Controls.Cad; |
5 |
using MarkupToPDF.Controls.Common; |
6 |
using MarkupToPDF.Controls.Etc; |
7 |
using MarkupToPDF.Controls.Line; |
8 |
using MarkupToPDF.Controls.Parsing; |
9 |
using MarkupToPDF.Controls.Polygon; |
10 |
using MarkupToPDF.Controls.Shape; |
11 |
using MarkupToPDF.Controls.Text; |
12 |
using System; |
13 |
using System.Collections.Generic; |
14 |
using System.Diagnostics; |
15 |
using System.Linq; |
16 |
using System.Reactive.Linq; |
17 |
using System.Text; |
18 |
using System.Threading.Tasks; |
19 |
using System.Windows; |
20 |
using System.Windows.Controls; |
21 |
using System.Windows.Controls.Primitives; |
22 |
using System.Windows.Input; |
23 |
using System.Windows.Media; |
24 |
using Telerik.Windows.Controls; |
25 |
|
26 |
namespace KCOM.Controls |
27 |
{ |
28 |
public class MyThumb : Thumb |
29 |
{ |
30 |
public MyThumb() |
31 |
{ |
32 |
this.Opacity = 0.6; |
33 |
this.MouseEnter += MyThumb_MouseEnter; |
34 |
this.MouseLeave += MyThumb_MouseLeave; |
35 |
} |
36 |
|
37 |
/// <summary> |
38 |
/// translate thumb with given delta and angle |
39 |
/// </summary> |
40 |
/// <param name="e"></param> |
41 |
/// <param name="angle"></param> |
42 |
public void Translate(double dx, double dy, double angle) |
43 |
{ |
44 |
double radian = angle * Math.PI / 180; |
45 |
double cos = Math.Cos(radian); |
46 |
double sin = Math.Sin(radian); |
47 |
|
48 |
double _dx = dx * cos - dy * sin; |
49 |
double _dy = dx * sin + dy * cos; |
50 |
Canvas.SetLeft(this, Canvas.GetLeft(this) + _dx); |
51 |
Canvas.SetTop(this, Canvas.GetTop(this) + _dy); |
52 |
} |
53 |
|
54 |
/// <summary> |
55 |
/// </summary> |
56 |
/// <param name="sender"></param> |
57 |
/// <param name="e"></param> |
58 |
private void MyThumb_MouseLeave(object sender, MouseEventArgs e) |
59 |
{ |
60 |
this.Opacity = 0.6; |
61 |
} |
62 |
|
63 |
/// <summary> |
64 |
/// |
65 |
/// </summary> |
66 |
/// <param name="sender"></param> |
67 |
/// <param name="e"></param> |
68 |
private void MyThumb_MouseEnter(object sender, MouseEventArgs e) |
69 |
{ |
70 |
this.Opacity = 1.0; |
71 |
} |
72 |
} |
73 |
|
74 |
/// <summary> |
75 |
/// Interaction logic for AdornerFinal.xaml |
76 |
/// </summary> |
77 |
public class AdornerMember |
78 |
{ |
79 |
public UIElement DrawingData { get; set; } |
80 |
public ControlType Drawingtype { get; set; } |
81 |
public double DrawingAngle { get; set; } |
82 |
public List<MyThumb> ThumbList { get; set; } |
83 |
public string Symbol_ID { get; set; } |
84 |
public long Group_ID { get; set; } |
85 |
|
86 |
/// <summary> |
87 |
/// update thumb |
88 |
/// </summary> |
89 |
public void UpdateThumb() |
90 |
{ |
91 |
var path = this.DrawingData as IPath; |
92 |
for (int i = 0; i < path.PointSet.Count; ++i) |
93 |
{ |
94 |
Canvas.SetLeft(this.ThumbList[i], path.PointSet[i].X); |
95 |
Canvas.SetTop(this.ThumbList[i], path.PointSet[i].Y); |
96 |
} |
97 |
|
98 |
if (this.DrawingData as ArrowTextControl != null) |
99 |
{ |
100 |
if (!(this.DrawingData as ArrowTextControl).isTrans) //trans가 True인경우 |
101 |
{ |
102 |
List<Point> ps = new List<Point>(); |
103 |
|
104 |
var temp = this.DrawingData as ArrowTextControl; |
105 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단 |
106 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단 |
107 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단 |
108 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //우단 |
109 |
|
110 |
if (temp.isFixed) |
111 |
{ |
112 |
var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
113 |
var testP = endP; |
114 |
if (ps[0] == endP) //상단 |
115 |
{ |
116 |
testP = new Point(endP.X, endP.Y - 50); |
117 |
} |
118 |
else if (ps[1] == endP) //하단 |
119 |
{ |
120 |
testP = new Point(endP.X, endP.Y + 50); |
121 |
} |
122 |
else if (ps[2] == endP) //좌단 |
123 |
{ |
124 |
testP = new Point(endP.X - 50, endP.Y); |
125 |
} |
126 |
else if (ps[3] == endP) //우단 |
127 |
{ |
128 |
testP = new Point(endP.X + 50, endP.Y); |
129 |
} |
130 |
Canvas.SetLeft(this.ThumbList[1], testP.X); |
131 |
Canvas.SetTop(this.ThumbList[1], testP.Y); |
132 |
} |
133 |
else |
134 |
{ |
135 |
var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
136 |
var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP); |
137 |
Canvas.SetLeft(this.ThumbList[1], tempP.X); |
138 |
Canvas.SetTop(this.ThumbList[1], tempP.Y); |
139 |
} |
140 |
} |
141 |
} |
142 |
} |
143 |
|
144 |
/// <summary> |
145 |
/// rotate members about given position and angle |
146 |
/// </summary> |
147 |
/// <param name="at"></param> |
148 |
/// <param name="angle">in degree</param> |
149 |
public void RotateAbout(Point at, double angle) |
150 |
{ |
151 |
for (int i = 0; i < (this.DrawingData as IPath).PointSet.Count; i++) |
152 |
{ |
153 |
(this.DrawingData as IPath).PointSet[i] = MathSet.RotateAbout(at, (this.DrawingData as IPath).PointSet[i], angle); |
154 |
} |
155 |
(this.DrawingData as CommentUserInfo).UpdateControl(); |
156 |
|
157 |
this.UpdateThumb(); |
158 |
} |
159 |
} |
160 |
|
161 |
public partial class AdornerFinal : UserControl |
162 |
{ |
163 |
public TextBox editTextBox { get; set; } |
164 |
#region 공용 인스턴스 |
165 |
public List<AdornerMember> Members { get; } = new List<AdornerMember>(); |
166 |
public Dictionary<Thumb, DragData> _dragData = new Dictionary<Thumb, DragData>(); |
167 |
public double AngleValue = 0; |
168 |
public bool IsTextAngle = false; |
169 |
public Rect BorderSize { get; set; } |
170 |
public bool TextCompensation = false; |
171 |
public bool isDragging { get; set; } |
172 |
public Thumb DraggerThumb { get; set; } |
173 |
public RadDropDownButton dropData; |
174 |
public RadCalendar dropCalendar; |
175 |
public Thumb mainDragThumb { get; set; } |
176 |
|
177 |
private bool disposed; |
178 |
|
179 |
public Point reSizePoint { get; set; } |
180 |
private Point rotatePoint { get; set; } /// 2018.05.09 added by humkyung |
181 |
private Point MouseDownPoint = new Point(); |
182 |
private Point CurrentMousePoint = new Point(); |
183 |
#endregion |
184 |
#region 생성자 |
185 |
private void RadDropDownButton_Loaded(object sender, RoutedEventArgs e) |
186 |
{ |
187 |
dropData = sender as RadDropDownButton; |
188 |
} |
189 |
|
190 |
private void Date_Calendar_Loaded(object sender, RoutedEventArgs e) |
191 |
{ |
192 |
dropCalendar = sender as RadCalendar; |
193 |
dropCalendar.SelectionChanged += (sen, ea) => |
194 |
{ |
195 |
dropData.IsOpen = false; |
196 |
if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "DateControl") |
197 |
{ |
198 |
DateControl data = (this.Members.First() as AdornerMember).DrawingData as DateControl; |
199 |
data.Text = dropCalendar.SelectedDate.Value.ToShortDateString(); |
200 |
} |
201 |
}; |
202 |
} |
203 |
|
204 |
public AdornerFinal() |
205 |
{ |
206 |
InitializeComponent(); |
207 |
BorderSize = new Rect(); |
208 |
_dragData.Add(rotateTop, new DragData() { CursorAngle = 0, DragType = DragType.Rotate, RotateIsLeft = true, RotateIsTop = true }); |
209 |
} |
210 |
|
211 |
~AdornerFinal() |
212 |
{ |
213 |
this.Dispose(false); |
214 |
} |
215 |
|
216 |
public void Dispose() |
217 |
{ |
218 |
this.Dispose(true); |
219 |
GC.SuppressFinalize(this); |
220 |
} |
221 |
|
222 |
protected virtual void Dispose(bool disposing) |
223 |
{ |
224 |
if (this.disposed) return; |
225 |
if (disposing) |
226 |
{ |
227 |
foreach (var member in this.Members) |
228 |
{ |
229 |
if(!Common.ViewerDataModel.Instance.MarkupControls_USER.Contains(member.DrawingData)) |
230 |
Common.ViewerDataModel.Instance.MarkupControls_USER.Add(member.DrawingData as CommentUserInfo); |
231 |
} |
232 |
// IDisposable 인터페이스를 구현하는 멤버들을 여기서 정리합니다. |
233 |
} |
234 |
// .NET Framework에 의하여 관리되지 않는 외부 리소스들을 여기서 정리합니다. |
235 |
this.disposed = true; |
236 |
} |
237 |
|
238 |
void DragThumb_Loaded(object sender, RoutedEventArgs e) |
239 |
{ |
240 |
mainDragThumb = DragThumb; |
241 |
} |
242 |
|
243 |
public AdornerFinal(CommentUserInfo objectData) : this() |
244 |
{ |
245 |
InitializeComponent(); |
246 |
objectData.IsHitTestVisible = false; |
247 |
if ((objectData as ArrowTextControl) != null) |
248 |
{ |
249 |
(objectData as ArrowTextControl).Base_TextBox.Focusable = true; |
250 |
} |
251 |
Canvas.SetZIndex(objectData, 84); |
252 |
try |
253 |
{ |
254 |
ViewerDataModel.Instance.MarkupControls_USER.Remove(objectData); |
255 |
this.ContainerContent.Children.Add(objectData); |
256 |
} |
257 |
catch (Exception ex) |
258 |
{ |
259 |
|
260 |
} |
261 |
|
262 |
SetAdornerMember(objectData as CommentUserInfo); |
263 |
this.Focus(); |
264 |
} |
265 |
|
266 |
public AdornerFinal(List<CommentUserInfo> objectData) : this() |
267 |
{ |
268 |
InitializeComponent(); |
269 |
foreach (var item in objectData) |
270 |
{ |
271 |
//item.IsHitTestVisible = false; |
272 |
if ((item as ArrowTextControl) != null) |
273 |
{ |
274 |
(item as ArrowTextControl).Base_TextBox.Focusable = true; |
275 |
} |
276 |
try |
277 |
{ |
278 |
Canvas.SetZIndex(item, 80); |
279 |
ViewerDataModel.Instance.MarkupControls_USER.Remove(item); |
280 |
this.ContainerContent.Children.Add(item); |
281 |
} |
282 |
catch //(Exception ex) |
283 |
{ |
284 |
} |
285 |
finally |
286 |
{ |
287 |
|
288 |
} |
289 |
} |
290 |
this.SetAdornerMember(objectData); |
291 |
this.Focus(); |
292 |
} |
293 |
|
294 |
public Point Centeroid |
295 |
{ |
296 |
get |
297 |
{ |
298 |
List<Point> pts = new List<Point>(); |
299 |
|
300 |
#region 센터 포인트 구하기 (그룹핑) |
301 |
foreach (var item in this.Members) |
302 |
{ |
303 |
if (item.DrawingData.GetType().Name == "TextControl") |
304 |
{ |
305 |
if (AngleValue == 0) |
306 |
{ |
307 |
AngleValue = (item.DrawingData as TextControl).CommentAngle; |
308 |
} |
309 |
double X = Canvas.GetLeft((item.DrawingData as TextControl)); |
310 |
double Y = Canvas.GetTop((item.DrawingData as TextControl)); |
311 |
pts.Add(new Point(X, Y)); |
312 |
} |
313 |
else |
314 |
{ |
315 |
pts.AddRange((item.DrawingData as IPath).PointSet); |
316 |
} |
317 |
} |
318 |
#endregion |
319 |
|
320 |
return MathSet.FindCentroid(pts); |
321 |
} |
322 |
} |
323 |
|
324 |
#endregion |
325 |
#region 메서드 |
326 |
public Rect getAdornerSize() |
327 |
{ |
328 |
return BorderSize; |
329 |
} |
330 |
public void addMemberControl(UIElement objectData) |
331 |
{ |
332 |
this.ContainerContent.Children.Add(objectData); |
333 |
SetAdornerMember(objectData as CommentUserInfo); |
334 |
this.Focus(); |
335 |
} |
336 |
/// <summary> |
337 |
/// UIElement를 종류에 맞게 등록시킴 |
338 |
/// </summary> |
339 |
/// <param name="member">UIElement 타입으로 BaseLayer에 있는 것들이 들어옵니다.</param> |
340 |
public void SetAdornerMember(MarkupToPDF.Common.CommentUserInfo member) |
341 |
{ |
342 |
switch (member.GetType().Name) |
343 |
{ |
344 |
#region 컨트롤 조건 |
345 |
case "LineControl": |
346 |
case "PolygonControl": |
347 |
case "ArrowControl": |
348 |
case "ArcControl": |
349 |
case "ArrowArcControl": |
350 |
case "ArrowControl_Multi": |
351 |
case "RectangleControl": |
352 |
case "TriControl": |
353 |
case "CircleControl": |
354 |
case "CloudControl": |
355 |
case "RectCloudControl": |
356 |
case "InkControl": |
357 |
case "InsideWhiteControl": |
358 |
case "OverlapWhiteControl": |
359 |
case "ClipWhiteControl": |
360 |
case "CoordinateControl": |
361 |
this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
362 |
break; |
363 |
case "ArrowTextControl": |
364 |
this.Members.Add(new AdornerMember |
365 |
{ |
366 |
DrawingData = member, |
367 |
Drawingtype = ControlType.ArrowTextControl, |
368 |
ThumbList = new List<MyThumb>(), |
369 |
Symbol_ID = member.SymbolID, |
370 |
Group_ID = member.GroupID, |
371 |
}); |
372 |
(member as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
373 |
AngleValue = (member as ArrowTextControl).CommentAngle; |
374 |
Observable.FromEventPattern(((ArrowTextControl)member).Base_TextBox, "LostFocus").Subscribe(a => |
375 |
{ |
376 |
TextCompensation = false; |
377 |
BorderUpdate(); |
378 |
if ((a.Sender as TextBox).Text == "") //보류 |
379 |
{ |
380 |
this.ContainerContent.Children.Remove(member); |
381 |
this.Visibility = Visibility.Collapsed; |
382 |
} |
383 |
}); |
384 |
break; |
385 |
case "ImgControl": |
386 |
this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
387 |
AngleValue = (member as ImgControl).CommentAngle; |
388 |
break; |
389 |
case "DateControl": |
390 |
this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
391 |
AngleValue = (member as DateControl).CommentAngle; |
392 |
break; |
393 |
case "SignControl": |
394 |
this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
395 |
AngleValue = (member as SignControl).CommentAngle; |
396 |
break; |
397 |
case "SymControl": |
398 |
this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
399 |
AngleValue = (member as SymControl).CommentAngle; |
400 |
break; |
401 |
case "SymControlN": |
402 |
this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
403 |
AngleValue = (member as SymControlN).CommentAngle; |
404 |
break; |
405 |
case "TextControl": |
406 |
this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.TextControl, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
407 |
RectangleGeometry Data = new RectangleGeometry |
408 |
{ |
409 |
Rect = new Rect() |
410 |
{ |
411 |
X = Canvas.GetLeft((member as TextControl)), |
412 |
Y = Canvas.GetTop((member as TextControl)), |
413 |
Width = (member as TextControl).Base_TextBlock.ActualWidth / 2, |
414 |
Height = (member as TextControl).Base_TextBlock.ActualHeight / 2, |
415 |
//Width = (member as TextControl).BoxWidth / 2, |
416 |
//Height = (member as TextControl).BoxHeight / 2, |
417 |
} |
418 |
}; |
419 |
Point endPointV = new Point(Data.Bounds.Right, Data.Bounds.Bottom); |
420 |
Point middle = MathSet.getMiddlePoint((member as TextControl).StartPoint, endPointV); |
421 |
|
422 |
|
423 |
DragThumb.RenderTransformOrigin = new Point(0.0, 0.0); |
424 |
DragThumb.RenderTransform = new RotateTransform() |
425 |
{ |
426 |
Angle = (member as TextControl).CommentAngle, |
427 |
//CenterX = middle.X, |
428 |
//CenterY = middle.Y, |
429 |
}; |
430 |
|
431 |
AdornerBorder.RenderTransformOrigin = new Point(0.0, 0.0); |
432 |
AdornerBorder.RenderTransform = new RotateTransform() |
433 |
{ |
434 |
Angle = (member as TextControl).CommentAngle, |
435 |
//CenterX = middle.X, |
436 |
//CenterY = middle.Y, |
437 |
}; |
438 |
Observable.FromEventPattern(((TextControl)member), "PropertyChanged").Subscribe(a => |
439 |
{ |
440 |
TextCompensation = true; |
441 |
BorderUpdate(); |
442 |
((TextControl)member).Base_TextBlock.TextDecorations = ((TextControl)member).UnderLine; |
443 |
}); |
444 |
Observable.FromEventPattern(((TextControl)member).Base_TextBox, "LostFocus").Subscribe(a => |
445 |
{ |
446 |
TextCompensation = false; |
447 |
BorderUpdate(); |
448 |
if ((a.Sender as TextBox).Text == "") //보류 |
449 |
{ |
450 |
this.ContainerContent.Children.Remove(member); |
451 |
this.Visibility = Visibility.Collapsed; |
452 |
} |
453 |
|
454 |
//((TextControl)member).UnEditingMode(); |
455 |
//((TextControl)member).Base_TextBlock.Visibility = Visibility.Collapsed; |
456 |
//((TextControl)member).Base_Border.Visibility = Visibility.Collapsed; |
457 |
//((TextControl)member).Base_TextPath.Visibility = Visibility.Collapsed; |
458 |
}); |
459 |
break; |
460 |
default: |
461 |
break; |
462 |
#endregion |
463 |
} |
464 |
|
465 |
if (member.GetType().Name == "TextControl") |
466 |
{ |
467 |
TextControl content = ((TextControl)member); |
468 |
content.StartPoint = new Point(Canvas.GetLeft(content), Canvas.GetTop(content)); |
469 |
content.EndPoint = content.StartPoint; |
470 |
} |
471 |
else |
472 |
{ |
473 |
RegistryPoint(member); |
474 |
} |
475 |
BorderUpdate(); |
476 |
|
477 |
if (Common.ViewerDataModel.Instance.MarkupControls_USER.Contains(member)) Common.ViewerDataModel.Instance.MarkupControls_USER.Remove(member); |
478 |
} |
479 |
|
480 |
private void ViewBoxRotate(UIElement member) |
481 |
{ |
482 |
AdornerBorder.RenderTransformOrigin = new Point(0.5, 0.5); |
483 |
DragThumb.RenderTransformOrigin = new Point(0.5, 0.5); |
484 |
AdornerBorder.RenderTransform = new RotateTransform() { Angle = (member as IViewBox).CommentAngle }; |
485 |
DragThumb.RenderTransform = new RotateTransform() { Angle = (member as IViewBox).CommentAngle }; |
486 |
} |
487 |
|
488 |
public void SetAdornerMember(List<CommentUserInfo> members) |
489 |
{ |
490 |
foreach (var member in members) |
491 |
{ |
492 |
switch (member.GetType().Name) |
493 |
{ |
494 |
#region 컨트롤 조건 |
495 |
case "LineControl": |
496 |
this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.SingleLine, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
497 |
break; |
498 |
case "ImgControl": |
499 |
this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ImgControl, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
500 |
break; |
501 |
case "ArrowControl": |
502 |
this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowLine, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
503 |
break; |
504 |
case "PolygonControl": |
505 |
this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.PolygonControl, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
506 |
break; |
507 |
case "ArrowTextControl": |
508 |
this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowTextControl, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
509 |
(member as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
510 |
break; |
511 |
case "ArcControl": |
512 |
this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArcLine, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
513 |
break; |
514 |
case "ArrowArcControl": |
515 |
this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArcArrow, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
516 |
break; |
517 |
case "DateControl": |
518 |
this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Date, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
519 |
break; |
520 |
case "ArrowControl_Multi": |
521 |
this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowMultiLine, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
522 |
break; |
523 |
case "RectangleControl": |
524 |
this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Rectangle, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
525 |
break; |
526 |
case "TriControl": |
527 |
this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Triangle, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
528 |
break; |
529 |
case "CircleControl": |
530 |
this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Circle, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
531 |
break; |
532 |
case "CloudControl": |
533 |
this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.PolygonCloud, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
534 |
break; |
535 |
case "RectCloudControl": |
536 |
this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.RectCloud, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
537 |
break; |
538 |
case "SignControl": |
539 |
this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Sign, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
540 |
break; |
541 |
case "SymControl": |
542 |
this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Symbol, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
543 |
break; |
544 |
case "SymControlN": |
545 |
this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Stamp, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
546 |
break; |
547 |
case "InkControl": |
548 |
this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Ink, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
549 |
break; |
550 |
case "TextControl": |
551 |
this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.TextControl, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
552 |
Observable.FromEventPattern(((TextControl)member), "PropertyChanged").Subscribe(a => |
553 |
{ |
554 |
BorderUpdate(); |
555 |
try |
556 |
{ |
557 |
((TextControl)member).Base_TextBlock.TextDecorations = ((TextControl)member).UnderLine; |
558 |
} |
559 |
catch (Exception) |
560 |
{ |
561 |
|
562 |
} |
563 |
|
564 |
}); |
565 |
Observable.FromEventPattern(((TextControl)member).Base_TextBox, "SelectionChanged").Subscribe(a => |
566 |
{ |
567 |
BorderUpdate(); |
568 |
}); |
569 |
break; |
570 |
case "InsideWhiteControl": |
571 |
this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.InsideWhite, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
572 |
break; |
573 |
case "OverlapWhiteControl": |
574 |
this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.OverlapWhite, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
575 |
break; |
576 |
case "ClipWhiteControl": |
577 |
this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ClipWhite, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
578 |
break; |
579 |
case "CoordinateControl": |
580 |
this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Coordinate, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID, Group_ID = member.GroupID }); |
581 |
break; |
582 |
default: |
583 |
break; |
584 |
#endregion |
585 |
} |
586 |
if (member.GetType().Name == "TextControl") |
587 |
{ |
588 |
TextControl content = ((TextControl)member); |
589 |
content.StartPoint = new Point(Canvas.GetLeft(content), Canvas.GetTop(content)); |
590 |
content.EndPoint = content.StartPoint; |
591 |
} |
592 |
else |
593 |
{ |
594 |
RegistryPoint(member, members.Count); |
595 |
} |
596 |
|
597 |
if (Common.ViewerDataModel.Instance.MarkupControls_USER.Contains(member)) Common.ViewerDataModel.Instance.MarkupControls_USER.Remove(member); /// remove commment from mycontrols |
598 |
} |
599 |
|
600 |
BorderUpdate(); |
601 |
} |
602 |
|
603 |
/// <summary> |
604 |
/// Border 를 갱신 |
605 |
/// </summary> |
606 |
public void BorderUpdate() |
607 |
{ |
608 |
AdornerBorder.MinWidth = 10; |
609 |
AdornerBorder.MinHeight = 10; |
610 |
|
611 |
double minX = double.MaxValue; |
612 |
double minY = double.MaxValue; |
613 |
double maxX = double.MinValue; |
614 |
double maxY = double.MinValue; |
615 |
|
616 |
if (this.Members.Count == 1) |
617 |
{ |
618 |
if (this.Members.First().DrawingData.GetType().Name == "TextControl") |
619 |
{ |
620 |
if ((this.Members.First().DrawingData as TextControl).CommentAngle != 0) |
621 |
{ |
622 |
trRotate.Angle = (this.Members.First().DrawingData as TextControl).CommentAngle; |
623 |
trRotateThumb.Angle = (this.Members.First().DrawingData as TextControl).CommentAngle; |
624 |
} |
625 |
else |
626 |
{ |
627 |
trRotate.Angle = 0; |
628 |
trRotateThumb.Angle = 0; |
629 |
} |
630 |
} |
631 |
} |
632 |
foreach (var item in this.Members) |
633 |
{ |
634 |
UIElement currentControl = (item as AdornerMember).DrawingData; |
635 |
if (item.DrawingData.GetType().Name == "TextControl") |
636 |
{ |
637 |
double textControlWidth; |
638 |
double textControlHeight; |
639 |
|
640 |
if (((currentControl as TextControl).Base_TextBox.ActualWidth) == 0) |
641 |
{ |
642 |
textControlWidth = ((currentControl as TextControl).Base_TextBlock.ActualWidth); |
643 |
textControlHeight = ((currentControl as TextControl).Base_TextBlock.ActualHeight); |
644 |
} |
645 |
else |
646 |
{ |
647 |
textControlWidth = ((currentControl as TextControl).Base_TextBox.ActualWidth); |
648 |
textControlHeight = ((currentControl as TextControl).Base_TextBox.ActualHeight); |
649 |
} |
650 |
|
651 |
if ((currentControl as TextControl).EndPoint.X < minX) |
652 |
{ |
653 |
minX = (currentControl as TextControl).EndPoint.X; |
654 |
} |
655 |
|
656 |
if ((currentControl as TextControl).EndPoint.Y < minY) |
657 |
{ |
658 |
minY = (currentControl as TextControl).EndPoint.Y; |
659 |
} |
660 |
|
661 |
if (textControlWidth + (currentControl as TextControl).EndPoint.X > maxX) |
662 |
{ |
663 |
maxX = textControlWidth + (currentControl as TextControl).EndPoint.X; |
664 |
} |
665 |
|
666 |
if (textControlHeight + (currentControl as TextControl).EndPoint.Y > maxY) |
667 |
{ |
668 |
maxY = textControlHeight + (currentControl as TextControl).EndPoint.Y; |
669 |
} |
670 |
} |
671 |
else if ((currentControl as IViewBox) != null) |
672 |
{ |
673 |
IViewBox instance = currentControl as IViewBox; |
674 |
List<Point> am = (currentControl as IPath).PointSet; |
675 |
List<double> xSet = am.Select(p => p.X).ToList(); |
676 |
List<double> ySet = am.Select(p => p.Y).ToList(); |
677 |
if (xSet.Min() < minX) minX = xSet.Min(); |
678 |
if (ySet.Min() < minY) minY = ySet.Min(); |
679 |
if (xSet.Max() > maxX) maxX = xSet.Max(); |
680 |
if (ySet.Max() > maxY) maxY = ySet.Max(); |
681 |
} |
682 |
else if ((currentControl as IPath).PathData == null) |
683 |
{ |
684 |
Rect rt = new Rect |
685 |
{ |
686 |
X = (currentControl as IPath).StartPoint.X, |
687 |
Y = (currentControl as IPath).StartPoint.Y, |
688 |
Width = Math.Max((currentControl as IPath).EndPoint.X, (currentControl as IPath).StartPoint.X) - Math.Min((currentControl as IPath).EndPoint.X, (currentControl as IPath).StartPoint.X), |
689 |
Height = Math.Max((currentControl as IPath).EndPoint.Y, (currentControl as IPath).StartPoint.Y) - Math.Min((currentControl as IPath).EndPoint.Y, (currentControl as IPath).StartPoint.Y), |
690 |
}; |
691 |
if (rt.Left < minX) minX = rt.Left; |
692 |
if (rt.Top < minY) minY = rt.Top; |
693 |
if (rt.Right > maxX) maxX = rt.Right; |
694 |
if (rt.Bottom > maxY) maxY = rt.Bottom; |
695 |
} |
696 |
else if ((currentControl as IPath) == null) |
697 |
{ |
698 |
Rect rt = new Rect |
699 |
{ |
700 |
X = (currentControl as IPath).StartPoint.X, |
701 |
Y = (currentControl as IPath).StartPoint.Y, |
702 |
Width = (currentControl as IPath).EndPoint.X - (currentControl as IPath).StartPoint.X, |
703 |
Height = (currentControl as IPath).EndPoint.Y - (currentControl as IPath).StartPoint.Y |
704 |
}; |
705 |
if (rt.Left < minX) minX = rt.Left; |
706 |
if (rt.Top < minY) minY = rt.Top; |
707 |
if (rt.Right > maxX) maxX = rt.Right; |
708 |
if (rt.Bottom > maxY) maxY = rt.Bottom; |
709 |
} |
710 |
else if ((currentControl as CircleControl) != null) |
711 |
{ |
712 |
List<Point> am = (currentControl as IPath).PointSet; |
713 |
List<double> xSet = am.Select(p => p.X).ToList(); |
714 |
List<double> ySet = am.Select(p => p.Y).ToList(); |
715 |
if (xSet.Min() < minX) minX = xSet.Min(); |
716 |
if (ySet.Min() < minY) minY = ySet.Min(); |
717 |
if (xSet.Max() > maxX) maxX = xSet.Max(); |
718 |
if (ySet.Max() > maxY) maxY = ySet.Max(); |
719 |
} |
720 |
else |
721 |
{ |
722 |
if ((currentControl as IPath).PathData.Bounds.Left < minX) minX = (currentControl as IPath).PathData.Bounds.Left; |
723 |
if ((currentControl as IPath).PathData.Bounds.Top < minY) minY = (currentControl as IPath).PathData.Bounds.Top; |
724 |
if ((currentControl as IPath).PathData.Bounds.Right > maxX) maxX = (currentControl as IPath).PathData.Bounds.Right; |
725 |
if ((currentControl as IPath).PathData.Bounds.Bottom > maxY) maxY = (currentControl as IPath).PathData.Bounds.Bottom; |
726 |
} |
727 |
} |
728 |
|
729 |
Rect ac = new Rect(minX, minY, maxX - minX, maxY - minY); |
730 |
bool addWidthSize = false; |
731 |
bool addHeightSize = false; |
732 |
if (ac.Width <= 10) |
733 |
{ |
734 |
ac.Width += 10; |
735 |
addWidthSize = true; |
736 |
} |
737 |
if (ac.Height <= 10) |
738 |
{ |
739 |
ac.Height += 10; |
740 |
addHeightSize = true; |
741 |
} |
742 |
BorderSize = ac; |
743 |
AdornerBorder.MinWidth = 10; |
744 |
AdornerBorder.MinHeight = 10; |
745 |
AdornerBorder.Width = ac.Width; |
746 |
AdornerBorder.Height = ac.Height; |
747 |
Canvas.SetLeft(AdornerBorder, minX); |
748 |
Canvas.SetTop(AdornerBorder, minY); |
749 |
|
750 |
DragThumb.Width = ac.Width; |
751 |
DragThumb.Height = ac.Height; |
752 |
|
753 |
DragThumb.MinWidth = 10; |
754 |
DragThumb.MinHeight = 10; |
755 |
if (addWidthSize) |
756 |
{ |
757 |
Canvas.SetLeft(DragThumb, minX - 5); |
758 |
} |
759 |
else |
760 |
{ |
761 |
Canvas.SetLeft(DragThumb, minX); |
762 |
} |
763 |
|
764 |
if (addHeightSize) |
765 |
{ |
766 |
Canvas.SetTop(DragThumb, minY - 5); |
767 |
} |
768 |
else |
769 |
{ |
770 |
Canvas.SetTop(DragThumb, minY); |
771 |
} |
772 |
} |
773 |
/// <summary> |
774 |
/// UIElement 해제 |
775 |
/// </summary> |
776 |
public void unRegister() |
777 |
{ |
778 |
foreach (var item in this.ContainerContent.Children) |
779 |
{ |
780 |
if (item is MarkupToPDF.Common.CommentUserInfo) |
781 |
{ |
782 |
(item as MarkupToPDF.Common.CommentUserInfo).IsHitTestVisible = true; |
783 |
} |
784 |
} |
785 |
this.ContainerContent.Children.Clear(); |
786 |
} |
787 |
|
788 |
/// <summary> |
789 |
/// 각 포인트들을 등록합니다. |
790 |
/// </summary> |
791 |
/// <param name="pointset">Drawing Point</param> |
792 |
public void RegistryPoint(CommentUserInfo member, int cnt = 1) |
793 |
{ |
794 |
int count = 0; |
795 |
double Minx = 100000000; |
796 |
double Miny = 100000000; |
797 |
List<Point> list = (member as IPath).PointSet; |
798 |
if (member.GetType().Name == "InkControl") |
799 |
{ |
800 |
list.Clear(); |
801 |
list.Add(new Point((member as IPath).PathData.Bounds.X, (member as IPath).PathData.Bounds.Y)); |
802 |
list.Add(new Point((member as IPath).PathData.Bounds.Left, (member as IPath).PathData.Bounds.Bottom)); |
803 |
list.Add(new Point((member as IPath).PathData.Bounds.Right, (member as IPath).PathData.Bounds.Bottom)); |
804 |
list.Add(new Point((member as IPath).PathData.Bounds.Right, (member as IPath).PathData.Bounds.Top)); |
805 |
} |
806 |
ControlType markT = this.Members.Where(p => p.DrawingData == member).First().Drawingtype; |
807 |
foreach (var ax in list) |
808 |
{ |
809 |
Minx = (ax.X < Minx) ? ax.X : Minx; |
810 |
Miny = (ax.Y < Miny) ? ax.Y : Miny; |
811 |
} |
812 |
for (int i = 0; i < list.Count(); i++) |
813 |
{ |
814 |
MyThumb tm = new MyThumb |
815 |
{ |
816 |
Style = (Style)this.LayoutRoot.Resources["ThumbResizeStyle"], |
817 |
}; |
818 |
|
819 |
this.Members.Last().ThumbList.Add(tm); |
820 |
|
821 |
if ((markT == ControlType.ArcLine && list[i] == (member as ArcControl).MidPoint) || (markT == ControlType.ArcArrow && list[i] == (member as ArrowArcControl).MidPoint)) |
822 |
{ |
823 |
tm.Style = (Style)this.LayoutRoot.Resources["ThumbArcControlStyle"]; |
824 |
} |
825 |
if (member.GetType().Name == "ArrowTextControl" && i == 1) |
826 |
{ |
827 |
//if (this.Members.Count()<=1) |
828 |
//{ |
829 |
tm.Style = (Style)this.LayoutRoot.Resources["ThumbArcControlStyle"]; |
830 |
List<Point> ps = new List<Point>(); |
831 |
|
832 |
if ((this.Members.First() as AdornerMember).DrawingData as ArrowTextControl != null) |
833 |
{ |
834 |
var temp = (this.Members.First() as AdornerMember).DrawingData as ArrowTextControl; |
835 |
|
836 |
|
837 |
switch (Math.Abs(temp.CommentAngle).ToString()) |
838 |
{ |
839 |
case "90": |
840 |
{ |
841 |
ps.Clear(); |
842 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽 |
843 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); // 위 중간 |
844 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); // 위 오른쪽 |
845 |
|
846 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 중간 |
847 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 하단 |
848 |
|
849 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); //중간 하단 |
850 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 하단 |
851 |
|
852 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 중간 |
853 |
} |
854 |
break; |
855 |
case "270": |
856 |
{ |
857 |
ps.Clear(); |
858 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽 |
859 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); // 위 중간 |
860 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); // 위 오른쪽 |
861 |
|
862 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 중간 |
863 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 하단 |
864 |
|
865 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); //중간 하단 |
866 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 하단 |
867 |
|
868 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 중간 |
869 |
} |
870 |
break; |
871 |
default: |
872 |
{ |
873 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단 |
874 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단 |
875 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단 |
876 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //우단 |
877 |
} |
878 |
break; |
879 |
} |
880 |
|
881 |
ArrowTextControl instance = (member as ArrowTextControl); |
882 |
if (instance.isTrans) |
883 |
{ |
884 |
//var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
885 |
//var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP); |
886 |
//list[count] = tempP; |
887 |
list[count] = temp.MidPoint; |
888 |
} |
889 |
else |
890 |
{ |
891 |
if (temp.isFixed) |
892 |
{ |
893 |
var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
894 |
var testP = endP; |
895 |
if (ps[0] == endP) //상단 |
896 |
{ |
897 |
testP = new Point(endP.X, endP.Y - 50); |
898 |
} |
899 |
else if (ps[1] == endP) //하단 |
900 |
{ |
901 |
testP = new Point(endP.X, endP.Y + 50); |
902 |
} |
903 |
else if (ps[2] == endP) //좌단 |
904 |
{ |
905 |
testP = new Point(endP.X - 50, endP.Y); |
906 |
} |
907 |
else if (ps[3] == endP) //우단 |
908 |
{ |
909 |
testP = new Point(endP.X + 50, endP.Y); |
910 |
} |
911 |
list[count] = testP; |
912 |
} |
913 |
else |
914 |
{ |
915 |
var endP = MathSet.getNearPoint(ps, instance.MidPoint); |
916 |
list[count] = MathSet.getMiddlePoint(instance.StartPoint, endP); |
917 |
} |
918 |
} |
919 |
} |
920 |
} |
921 |
if (member.GetType().Name == "ArrowTextControl" && list[i] == list.Last()) |
922 |
{ |
923 |
tm.Style = (Style)this.LayoutRoot.Resources["ThumbTextStyle"]; |
924 |
tm.Width = (member as ArrowTextControl).BoxWidth; |
925 |
tm.Height = (member as ArrowTextControl).BoxHeight; |
926 |
var angle = (member as ArrowTextControl).PageAngle; |
927 |
if (Math.Abs(angle).ToString() == "90") |
928 |
{ |
929 |
tm.RenderTransformOrigin = new Point(0, 0); |
930 |
tm.RenderTransform = new RotateTransform { Angle = 270 }; |
931 |
} |
932 |
else if (Math.Abs(angle).ToString() == "270") |
933 |
{ |
934 |
tm.RenderTransformOrigin = new Point(0, 0); |
935 |
tm.RenderTransform = new RotateTransform { Angle = 90 }; |
936 |
} |
937 |
else |
938 |
{ |
939 |
tm.RenderTransformOrigin = new Point(0.5, 0.5); |
940 |
tm.RenderTransform = new RotateTransform() |
941 |
{ |
942 |
Angle = angle |
943 |
}; |
944 |
} |
945 |
} |
946 |
|
947 |
if (member.GetType().Name == "CloudControl") |
948 |
{ |
949 |
if (i == list.Count() - 1) |
950 |
{ |
951 |
tm.Visibility = System.Windows.Visibility.Collapsed; |
952 |
} |
953 |
} |
954 |
if (member.GetType().Name == "PolygonControl") |
955 |
{ |
956 |
if (i == list.Count() - 1) |
957 |
{ |
958 |
if ((member as PolygonControl).ControlType == ControlType.ChainLine) |
959 |
{ |
960 |
|
961 |
} |
962 |
else |
963 |
{ |
964 |
tm.Visibility = System.Windows.Visibility.Collapsed; |
965 |
} |
966 |
} |
967 |
if ((member as PolygonControl).ControlType == ControlType.Ink) |
968 |
{ |
969 |
tm.Visibility = System.Windows.Visibility.Collapsed; |
970 |
} |
971 |
} |
972 |
|
973 |
this.ContainerContent.Children.Add(tm); |
974 |
Canvas.SetLeft(tm, list[count].X); |
975 |
Canvas.SetTop(tm, list[count].Y); |
976 |
if (member.GetType().Name == "ArrowTextControl" && list[i] == (member as ArrowTextControl).MidPoint) |
977 |
{ |
978 |
Canvas.SetZIndex(tm, 95); |
979 |
} |
980 |
else |
981 |
{ |
982 |
Canvas.SetZIndex(tm, 99); |
983 |
} |
984 |
|
985 |
tm.DragStarted += new DragStartedEventHandler(tm_DragStarted); |
986 |
tm.DragCompleted += new DragCompletedEventHandler(tm_DragCompleted); |
987 |
tm.DragDelta += ResizeTm_DragDelta; |
988 |
tm.MouseMove += new MouseEventHandler(resize_MouseMove); |
989 |
count++; |
990 |
} |
991 |
} |
992 |
|
993 |
private void ResizeTm_DragDelta(object sender, DragDeltaEventArgs e) |
994 |
{ |
995 |
if (this.Members.Count > 1) return; |
996 |
if (reSizePoint != new Point(0, 0)) |
997 |
{ |
998 |
MyThumb thumb = sender as MyThumb; |
999 |
|
1000 |
//Point setPoint = Mouse.GetPosition(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanCanvas); |
1001 |
|
1002 |
Point setPoint = new Point(Canvas.GetLeft(thumb), Canvas.GetTop(thumb)); |
1003 |
|
1004 |
System.Diagnostics.Debug.WriteLine($"1. GetPoint : {GetPosition(thumb).X},{GetPosition(thumb).Y}"); |
1005 |
|
1006 |
thumb.Translate(e.HorizontalChange, e.VerticalChange, this.AngleValue); |
1007 |
|
1008 |
AdornerMember control = (from userThumb in this.Members |
1009 |
where userThumb.ThumbList.Contains(thumb) |
1010 |
select userThumb).FirstOrDefault(); |
1011 |
|
1012 |
IPath AllControl = control.DrawingData as IPath; |
1013 |
|
1014 |
System.Diagnostics.Debug.WriteLine($"2. GetPoint : {GetPosition(thumb).X},{GetPosition(thumb).Y}"); |
1015 |
|
1016 |
//System.Diagnostics.Debug.WriteLine($"ResizeTm_DragDelta setPoint : {setPoint.X},{setPoint.Y} - {e.HorizontalChange},{e.VerticalChange}"); |
1017 |
((control.DrawingData) as CommentUserInfo).OnMoveCtrlPoint(setPoint, e.HorizontalChange, e.VerticalChange); |
1018 |
System.Diagnostics.Debug.WriteLine($"3. GetPoint : {GetPosition(thumb).X},{GetPosition(thumb).Y}"); |
1019 |
control.UpdateThumb(); |
1020 |
|
1021 |
System.Diagnostics.Debug.WriteLine($"4. GetPoint : {GetPosition(thumb).X},{GetPosition(thumb).Y}"); |
1022 |
this.BorderUpdate(); |
1023 |
|
1024 |
System.Diagnostics.Debug.WriteLine($"5. GetPoint : {GetPosition(thumb).X},{GetPosition(thumb).Y}"); |
1025 |
} |
1026 |
} |
1027 |
|
1028 |
private Point GetPosition(Thumb thumb) |
1029 |
{ |
1030 |
return new Point(Canvas.GetLeft(thumb), Canvas.GetTop(thumb)); |
1031 |
} |
1032 |
|
1033 |
#endregion |
1034 |
#region 이벤트 |
1035 |
|
1036 |
void tm_DragCompleted(object sender, DragCompletedEventArgs e) |
1037 |
{ |
1038 |
this.isDragging = false; |
1039 |
DraggerThumb = null; |
1040 |
|
1041 |
var comments = (from drawing in this.Members |
1042 |
select drawing.DrawingData as CommentUserInfo).ToList(); |
1043 |
UndoCommand.Instance.Push(comments, this.AngleValue); |
1044 |
} |
1045 |
|
1046 |
/// <summary> |
1047 |
/// start drag |
1048 |
/// </summary> |
1049 |
/// <param name="sender"></param> |
1050 |
/// <param name="e"></param> |
1051 |
void tm_DragStarted(object sender, DragStartedEventArgs e) |
1052 |
{ |
1053 |
this.DraggerThumb = sender as Thumb; |
1054 |
this.isDragging = true; |
1055 |
|
1056 |
if (ViewerDataModel.Instance.UndoDataList == null) |
1057 |
{ |
1058 |
return; |
1059 |
} |
1060 |
|
1061 |
if ((null != ViewerDataModel.Instance.UndoDataList.LastOrDefault()) && (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Event == Event_Type.Thumb)) |
1062 |
{ |
1063 |
return; |
1064 |
} |
1065 |
|
1066 |
if ((null != ViewerDataModel.Instance.UndoDataList.LastOrDefault()) && (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List != null)) |
1067 |
{ |
1068 |
if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.Count > 0) |
1069 |
{ |
1070 |
if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.FirstOrDefault().PointSet != null) |
1071 |
{ |
1072 |
return; |
1073 |
} |
1074 |
} |
1075 |
} |
1076 |
|
1077 |
var comments = (from drawing in this.Members |
1078 |
select drawing.DrawingData as CommentUserInfo).ToList(); |
1079 |
UndoCommand.Instance.Push(comments, this.AngleValue); |
1080 |
} |
1081 |
|
1082 |
private void rotate_MouseMove(object sender, MouseEventArgs e) |
1083 |
{ |
1084 |
if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "TextControl") |
1085 |
{ |
1086 |
if (LastRotateVerticalValue < e.GetPosition(this).X) |
1087 |
IsTextAngle = true; |
1088 |
else |
1089 |
IsTextAngle = false; |
1090 |
LastRotateVerticalValue = e.GetPosition(this).X; |
1091 |
} |
1092 |
else |
1093 |
{ |
1094 |
if (e.GetPosition(this).X > LastRotateHorizontalValue) |
1095 |
{ |
1096 |
RotateFlag = true; |
1097 |
} |
1098 |
else |
1099 |
{ |
1100 |
RotateFlag = false; |
1101 |
} |
1102 |
LastRotateHorizontalValue = e.GetPosition(this).X; |
1103 |
} |
1104 |
} |
1105 |
|
1106 |
private void drag_DragStarted(object sender, DragStartedEventArgs e) |
1107 |
{ |
1108 |
/// save mouse down and current mouse point |
1109 |
this.MouseDownPoint = Mouse.GetPosition(Window.GetWindow((DependencyObject)sender)); |
1110 |
this.CurrentMousePoint = Mouse.GetPosition(Window.GetWindow((DependencyObject)sender)); |
1111 |
/// up to here |
1112 |
|
1113 |
if (ViewerDataModel.Instance.UndoDataList == null) |
1114 |
{ |
1115 |
return; |
1116 |
} |
1117 |
if ((null != ViewerDataModel.Instance.UndoDataList.LastOrDefault()) && (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Event == Event_Type.Thumb)) |
1118 |
{ |
1119 |
return; |
1120 |
} |
1121 |
if ((null != ViewerDataModel.Instance.UndoDataList.LastOrDefault()) && (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List != null)) |
1122 |
{ |
1123 |
if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.Count > 0) |
1124 |
{ |
1125 |
if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.FirstOrDefault().PointSet != null) |
1126 |
{ |
1127 |
return; |
1128 |
} |
1129 |
} |
1130 |
} |
1131 |
|
1132 |
var comments = (from drawing in this.Members |
1133 |
select drawing.DrawingData as CommentUserInfo).ToList(); |
1134 |
UndoCommand.Instance.Push(comments, this.AngleValue); |
1135 |
} |
1136 |
|
1137 |
private void drag_DragCompleted(object sender, DragCompletedEventArgs e) |
1138 |
{ |
1139 |
DragThumb.Cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
1140 |
|
1141 |
var comments = (from drawing in this.Members |
1142 |
select drawing.DrawingData as CommentUserInfo).ToList(); |
1143 |
UndoCommand.Instance.Push(comments, this.AngleValue); |
1144 |
} |
1145 |
|
1146 |
private void DragThumb_DragDelta(object sender, DragDeltaEventArgs e) |
1147 |
{ |
1148 |
double scale = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.ContentScale; |
1149 |
var tmp = Mouse.GetPosition(Window.GetWindow((DependencyObject)sender)); |
1150 |
|
1151 |
var horzChange = (tmp.X - this.CurrentMousePoint.X) / scale;/// Math.Round(tmp.X - this.CurrentMousePoint.X) / scale; |
1152 |
var vertChange = (tmp.Y - this.CurrentMousePoint.Y) / scale;///Math.Round(tmp.Y - this.CurrentMousePoint.Y) / scale; |
1153 |
try |
1154 |
{ |
1155 |
DragThumb.Cursor = Cursors.SizeAll; |
1156 |
//System.Diagnostics.Debug.WriteLine($"TransItem : {horzChange}, {vertChange}"); |
1157 |
//System.Diagnostics.Debug.WriteLine($"DragDeltaEventArgs : {e.HorizontalChange}, {e.VerticalChange}"); |
1158 |
|
1159 |
this.TranslateItems(horzChange, vertChange); |
1160 |
|
1161 |
var rect = this.AdornerBorder.Bounds(ViewerDataModel.Instance.SystemMain.dzMainMenu.mainPanel); |
1162 |
var mainRect = ViewerDataModel.Instance.SystemMain.dzMainMenu.mainPanel.Rect(); |
1163 |
|
1164 |
var moveDirection = mainRect.Movement(rect); |
1165 |
|
1166 |
System.Diagnostics.Debug.WriteLine($"horzChange: {horzChange} , vertChange:{vertChange}"); |
1167 |
System.Diagnostics.Debug.WriteLine($"DragDeltaEventArgs : Top:{rect.Top}, Left:{rect.Left}, Right:{rect.Right}, Bottom:{rect.Bottom} ,BottomLeft : {rect.BottomLeft} BottomRight : {rect.BottomRight}"); |
1168 |
|
1169 |
if ((horzChange < 0 && !moveDirection.Left) || (horzChange > 0 && !moveDirection.Right)) |
1170 |
{ |
1171 |
this.TranslateItems(horzChange * -1, 0); |
1172 |
e.Handled = true; |
1173 |
} |
1174 |
|
1175 |
if ((vertChange < 0 && !moveDirection.Up) || (vertChange > 0 && !moveDirection.Down)) |
1176 |
{ |
1177 |
this.TranslateItems( 0, vertChange * -1); |
1178 |
e.Handled = true; |
1179 |
} |
1180 |
} |
1181 |
finally |
1182 |
{ |
1183 |
/// update CurrentMousePoint |
1184 |
this.CurrentMousePoint = tmp; |
1185 |
} |
1186 |
} |
1187 |
|
1188 |
/// <summary> |
1189 |
/// translate all members |
1190 |
/// </summary> |
1191 |
/// <param name="e"></param> |
1192 |
public void TranslateItems(double dx, double dy) |
1193 |
{ |
1194 |
Dispatcher.BeginInvoke((Action)(() => |
1195 |
{ |
1196 |
foreach (var item in this.Members) |
1197 |
{ |
1198 |
this.TranslateItem(dx, dy, item); |
1199 |
} |
1200 |
|
1201 |
this.BorderUpdate(); |
1202 |
})); |
1203 |
} |
1204 |
|
1205 |
/// <summary> |
1206 |
/// translate a item |
1207 |
/// </summary> |
1208 |
/// <param name="e"></param> |
1209 |
/// <param name="item"></param> |
1210 |
private void TranslateItem(double dx, double dy, AdornerMember item) |
1211 |
{ |
1212 |
/// rotate point with page rotation |
1213 |
var rotation = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.rotate.Angle; |
1214 |
Point delta = MathSet.RotateAbout(new Point(0, 0), new Point(dx, dy), -rotation); |
1215 |
/// up to here |
1216 |
(item.DrawingData as CommentUserInfo).OnTranslate(delta.X, delta.Y); |
1217 |
|
1218 |
ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate( |
1219 |
MarkupParser.MarkupToString((item.DrawingData as CommentUserInfo), App.ViewInfo.UserID), Event_Type.Thumb, null, null); |
1220 |
|
1221 |
item.UpdateThumb(); |
1222 |
} |
1223 |
|
1224 |
private void resize_MouseMove(object sender, MouseEventArgs e) |
1225 |
{ |
1226 |
reSizePoint = e.GetPosition(this); |
1227 |
} |
1228 |
|
1229 |
/// <summary> |
1230 |
/// 회전 |
1231 |
/// </summary> |
1232 |
/// <param name="sender"></param> |
1233 |
/// <param name="e"></param> |
1234 |
public void rotate_DragDelta(object sender, DragDeltaEventArgs e) |
1235 |
{ |
1236 |
MoveRotate(e); |
1237 |
} |
1238 |
|
1239 |
double LastRotateHorizontalValue = 0; |
1240 |
double LastRotateVerticalValue = 0; |
1241 |
bool RotateFlag = false; |
1242 |
|
1243 |
/// <summary> |
1244 |
/// <history>humkyung 2018.05.09 upgrade rotate shape peformance</history> |
1245 |
/// </summary> |
1246 |
/// <param name="e"></param> |
1247 |
public void MoveRotate(DragDeltaEventArgs e) |
1248 |
{ |
1249 |
Point CenterPoint = this.Centeroid; |
1250 |
Point pt = Mouse.GetPosition(this); |
1251 |
|
1252 |
Point vec1 = new Point(this.rotatePoint.X - CenterPoint.X, this.rotatePoint.Y - CenterPoint.Y); |
1253 |
Point vec2 = new Point(pt.X - CenterPoint.X, pt.Y - CenterPoint.Y); |
1254 |
double dDeltaAngle = (MathSet.getAngleBetweenVectors(vec1, vec2)); |
1255 |
|
1256 |
AngleValue += dDeltaAngle; |
1257 |
if (AngleValue > 360) AngleValue -= 360; |
1258 |
if (AngleValue < 0) AngleValue += 360; |
1259 |
this.rotatePoint = pt; /// save rotatePoint |
1260 |
|
1261 |
Dispatcher.BeginInvoke((Action)(() => |
1262 |
{ |
1263 |
foreach (var member in this.Members) |
1264 |
{ |
1265 |
member.RotateAbout(CenterPoint, dDeltaAngle); |
1266 |
#region 보더 업데이트 |
1267 |
switch (member.Drawingtype) |
1268 |
{ |
1269 |
case ControlType.TextControl: |
1270 |
(member.DrawingData as CommentUserInfo).CommentAngle = AngleValue; |
1271 |
|
1272 |
DragThumb.RenderTransformOrigin = new Point(0, 0); |
1273 |
DragThumb.RenderTransform = new RotateTransform() |
1274 |
{ |
1275 |
|
1276 |
Angle = (member.DrawingData as CommentUserInfo).CommentAngle |
1277 |
}; |
1278 |
|
1279 |
AdornerBorder.RenderTransformOrigin = new Point(0, 0); |
1280 |
AdornerBorder.RenderTransform = new RotateTransform() |
1281 |
{ |
1282 |
Angle = (member.DrawingData as CommentUserInfo).CommentAngle |
1283 |
}; |
1284 |
|
1285 |
//(member.DrawingData as TextControl).Angle = AngleValue; |
1286 |
|
1287 |
(member.DrawingData as CommentUserInfo).UpdateControl(); |
1288 |
BorderUpdate(); |
1289 |
break; |
1290 |
|
1291 |
case ControlType.ArrowMultiLine: |
1292 |
case ControlType.ArcLine: |
1293 |
case ControlType.ArcArrow: |
1294 |
case ControlType.SingleLine: |
1295 |
case ControlType.Triangle: |
1296 |
case ControlType.ArrowTextControl: |
1297 |
case ControlType.PolygonControl: |
1298 |
case ControlType.Ink: |
1299 |
BorderUpdate(); |
1300 |
break; |
1301 |
case ControlType.Date: |
1302 |
case ControlType.RectCloud: |
1303 |
case ControlType.Rectangle: |
1304 |
case ControlType.ImgControl: |
1305 |
case ControlType.Sign: |
1306 |
case ControlType.Symbol: |
1307 |
case ControlType.Stamp: |
1308 |
(member.DrawingData as CommentUserInfo).CommentAngle = AngleValue; |
1309 |
BorderUpdate(); |
1310 |
break; |
1311 |
case ControlType.PolygonCloud: |
1312 |
((ICloudControl)member.DrawingData).DrawingCloud(); |
1313 |
BorderUpdate(); |
1314 |
break; |
1315 |
case ControlType.Circle: |
1316 |
(member.DrawingData as CommentUserInfo).CommentAngle = AngleValue; |
1317 |
((CircleControl)member.DrawingData).SetCenterXY(); |
1318 |
BorderUpdate(); |
1319 |
break; |
1320 |
default: |
1321 |
break; |
1322 |
} |
1323 |
} |
1324 |
#endregion |
1325 |
})); |
1326 |
} |
1327 |
|
1328 |
private void rotate_DragStarted(object sender, DragStartedEventArgs e) |
1329 |
{ |
1330 |
this.rotatePoint = Mouse.GetPosition(this); /// 2018.05.09 added by humkyung |
1331 |
rotateTop.Cursor = Cursors.SizeAll; |
1332 |
|
1333 |
/// get angle from text controls' angle if only text control exists - 2018.05.10 added by humkyung |
1334 |
if ((1 == this.Members.Count) && (this.Members.First() as AdornerMember).DrawingData.GetType().Name == "TextControl") |
1335 |
{ |
1336 |
this.AngleValue = ((this.Members.First() as AdornerMember).DrawingData as TextControl).CommentAngle; |
1337 |
} |
1338 |
/// up to here |
1339 |
|
1340 |
if (ViewerDataModel.Instance.UndoDataList == null) |
1341 |
{ |
1342 |
return; |
1343 |
} |
1344 |
|
1345 |
if ((ViewerDataModel.Instance.UndoDataList.Count > 0) && ViewerDataModel.Instance.UndoDataList.LastOrDefault().Event == Event_Type.Thumb) |
1346 |
{ |
1347 |
return; |
1348 |
} |
1349 |
|
1350 |
if ((ViewerDataModel.Instance.UndoDataList.Count > 0) && ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List != null) |
1351 |
{ |
1352 |
if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.Count > 0) |
1353 |
{ |
1354 |
if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.FirstOrDefault().PointSet != null) |
1355 |
{ |
1356 |
return; |
1357 |
} |
1358 |
} |
1359 |
} |
1360 |
|
1361 |
var comments = (from drawing in this.Members |
1362 |
select drawing.DrawingData as CommentUserInfo).ToList(); |
1363 |
UndoCommand.Instance.Push(comments, this.AngleValue); |
1364 |
} |
1365 |
|
1366 |
private void rotate_DragCompleted(object sender, DragCompletedEventArgs e) |
1367 |
{ |
1368 |
rotateTop.Cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
1369 |
|
1370 |
var comments = (from drawing in this.Members |
1371 |
select drawing.DrawingData as CommentUserInfo).ToList(); |
1372 |
UndoCommand.Instance.Push(comments, this.AngleValue); |
1373 |
} |
1374 |
|
1375 |
public void ControlPointMouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
1376 |
{ |
1377 |
AdornerMember control = this.Members.FirstOrDefault(); |
1378 |
|
1379 |
if ((control.DrawingData as ArrowTextControl) != null && DraggerThumb == null) |
1380 |
{ |
1381 |
if ((control.DrawingData as ArrowTextControl).isTrans == false && (control.DrawingData as ArrowTextControl).isFixed == false) |
1382 |
{ |
1383 |
(control.DrawingData as ArrowTextControl).isTrans = true; |
1384 |
} |
1385 |
} |
1386 |
|
1387 |
} |
1388 |
|
1389 |
public void TextControlChanger() |
1390 |
{ |
1391 |
if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "TextControl") |
1392 |
{ |
1393 |
TextControl AllControl = (this.Members.First() as AdornerMember).DrawingData as TextControl; |
1394 |
AllControl.Base_TextBox.Focus(); |
1395 |
AllControl.Base_TextBox.Visibility = Visibility.Visible; |
1396 |
AllControl.Base_TextBlock.Visibility = Visibility.Collapsed; |
1397 |
AllControl.Base_TextBox.IsHitTestVisible = true; |
1398 |
AllControl.Base_TextBox.Focus(); |
1399 |
|
1400 |
AllControl.SizeChanged += (sen, ea) => |
1401 |
{ |
1402 |
if (AllControl.Base_TextBox != null) |
1403 |
{ |
1404 |
RectangleGeometry Data = new RectangleGeometry |
1405 |
{ |
1406 |
Rect = new Rect() |
1407 |
{ |
1408 |
X = AllControl.StartPoint.X, |
1409 |
Y = AllControl.StartPoint.Y, |
1410 |
Width = AllControl.Base_TextBox.Width, |
1411 |
Height = AllControl.Base_TextBox.Height, |
1412 |
} |
1413 |
}; |
1414 |
|
1415 |
Point endPointV = new Point(Data.Bounds.Right, Data.Bounds.Bottom); |
1416 |
Point middle = MathSet.getMiddlePoint(AllControl.StartPoint, endPointV); |
1417 |
AllControl.Base_Grid.RenderTransform = new RotateTransform() |
1418 |
{ |
1419 |
Angle = AllControl.CommentAngle, |
1420 |
CenterX = middle.X, |
1421 |
CenterY = middle.Y, |
1422 |
}; |
1423 |
} |
1424 |
BorderUpdate(); |
1425 |
}; |
1426 |
} |
1427 |
} |
1428 |
|
1429 |
private void RectThumb_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) //더블클릭 |
1430 |
{ |
1431 |
if (e.ClickCount == 2 && this.Members.Count == 1) |
1432 |
{ |
1433 |
|
1434 |
if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "TextControl") |
1435 |
{ |
1436 |
TextControlChanger(); |
1437 |
} |
1438 |
|
1439 |
else if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "ArrowTextControl") |
1440 |
{ |
1441 |
ArrowTextControl AllControl = (this.Members.First() as AdornerMember).DrawingData as ArrowTextControl; |
1442 |
Thumb tm = (this.Members.First() as AdornerMember).ThumbList.Last(); |
1443 |
((ArrowTextControl)AllControl).Base_TextBox.Focus(); |
1444 |
|
1445 |
//ArrowControl TextBox Thumb없애기 |
1446 |
tm.Visibility = Visibility.Collapsed; |
1447 |
|
1448 |
((this.Members.First() as AdornerMember).DrawingData as ArrowTextControl).Base_TextBox.IsHitTestVisible = true; |
1449 |
|
1450 |
((ArrowTextControl)AllControl).Base_TextBox.SizeChanged += (sen, ea) => |
1451 |
|
1452 |
{ |
1453 |
tm.Width = (AllControl as ArrowTextControl).BoxWidth; |
1454 |
tm.Height = (AllControl as ArrowTextControl).BoxHeight; |
1455 |
|
1456 |
List<Point> ps = new List<Point>(); |
1457 |
|
1458 |
ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth / 2, Canvas.GetTop(AllControl.Base_TextBox))); //상단 |
1459 |
ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth / 2, Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight)); // 하단 |
1460 |
ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox), Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight / 2)); //좌단 |
1461 |
ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth, Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight / 2)); //우단 |
1462 |
|
1463 |
|
1464 |
|
1465 |
|
1466 |
var endP = MathSet.getNearPoint(ps, AllControl.MidPoint); |
1467 |
var tempP = MathSet.getMiddlePoint(AllControl.StartPoint, endP); |
1468 |
if (AllControl.isTrans) |
1469 |
{ |
1470 |
Canvas.SetLeft((this.Members.First() as AdornerMember).ThumbList[1], AllControl.MidPoint.X); |
1471 |
Canvas.SetTop((this.Members.First() as AdornerMember).ThumbList[1], AllControl.MidPoint.Y); |
1472 |
} |
1473 |
else |
1474 |
{ |
1475 |
Canvas.SetLeft((this.Members.First() as AdornerMember).ThumbList[1], tempP.X); |
1476 |
Canvas.SetTop((this.Members.First() as AdornerMember).ThumbList[1], tempP.Y); |
1477 |
} |
1478 |
|
1479 |
|
1480 |
BorderUpdate(); |
1481 |
|
1482 |
}; |
1483 |
} |
1484 |
else if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "DateControl") |
1485 |
{ |
1486 |
DateControl data = (this.Members.First() as AdornerMember).DrawingData as DateControl; |
1487 |
CalendarControl instanceCal = new CalendarControl(data.Text); |
1488 |
//dropData.IsOpen = true; |
1489 |
RadWindow rc = new RadWindow(); |
1490 |
rc.Width = 300; |
1491 |
rc.Height = 300; |
1492 |
rc.Header = "Change Date"; |
1493 |
rc.Content = instanceCal; |
1494 |
rc.BorderThickness = new Thickness(3); |
1495 |
rc.ResizeMode = ResizeMode.NoResize; |
1496 |
rc.WindowStartupLocation = WindowStartupLocation.CenterScreen; |
1497 |
rc.ModalBackground = new SolidColorBrush(Colors.Black); |
1498 |
rc.ModalBackground.Opacity = 0.6; |
1499 |
Telerik.Windows.Controls.StyleManager.SetTheme(rc, new Telerik.Windows.Controls.Windows8Theme()); |
1500 |
instanceCal.changeDateCal.SelectionChanged += (sen, ea) => |
1501 |
{ |
1502 |
data.Text = instanceCal.changeDateCal.SelectedDate.Value.ToShortDateString(); |
1503 |
rc.Close(); |
1504 |
}; |
1505 |
rc.ShowDialog(); |
1506 |
//CalendarControl.xaml |
1507 |
} |
1508 |
else if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "ArcControl") |
1509 |
{ |
1510 |
ArcControl instance = ((this.Members.First() as AdornerMember).DrawingData as ArcControl); |
1511 |
if (instance.isTransOn) |
1512 |
{ |
1513 |
instance.isTransOn = false; |
1514 |
} |
1515 |
else |
1516 |
{ |
1517 |
instance.isTransOn = true; |
1518 |
} |
1519 |
///instance.SetArcPath(); |
1520 |
BorderUpdate(); |
1521 |
} |
1522 |
else if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "ArrowArcControl") |
1523 |
{ |
1524 |
ArrowArcControl instance = ((this.Members.First() as AdornerMember).DrawingData as ArrowArcControl); |
1525 |
if (instance.isTransOn) |
1526 |
{ |
1527 |
instance.isTransOn = false; |
1528 |
} |
1529 |
else |
1530 |
{ |
1531 |
instance.isTransOn = true; |
1532 |
} |
1533 |
instance.SetArcPath(); |
1534 |
BorderUpdate(); |
1535 |
} |
1536 |
|
1537 |
} |
1538 |
|
1539 |
} |
1540 |
#endregion |
1541 |
|
1542 |
private void DragThumb_MouseDoubleClick(object sender, MouseButtonEventArgs e) |
1543 |
{ |
1544 |
if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "TextControl" || (this.Members.First() as AdornerMember).DrawingData.GetType().Name == "ArrowTextControl") |
1545 |
{ |
1546 |
DragThumb.Visibility = Visibility.Collapsed; |
1547 |
} |
1548 |
} |
1549 |
|
1550 |
} |
1551 |
} |