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