markus / KCOM / Controls / AdornerFinal.xaml.cs @ 5a6a5dd1
이력 | 보기 | 이력해설 | 다운로드 (154 KB)
1 |
using KCOM.Common; |
---|---|
2 |
using MarkupToPDF.Common; |
3 |
using MarkupToPDF.Controls.Common; |
4 |
using MarkupToPDF.Controls.Etc; |
5 |
using MarkupToPDF.Controls.Line; |
6 |
using MarkupToPDF.Controls.Polygon; |
7 |
using MarkupToPDF.Controls.Shape; |
8 |
using MarkupToPDF.Controls.Text; |
9 |
using System; |
10 |
using System.Collections.Generic; |
11 |
using System.Linq; |
12 |
using System.Reactive.Linq; |
13 |
using System.Text; |
14 |
using System.Windows; |
15 |
using System.Windows.Controls; |
16 |
using System.Windows.Controls.Primitives; |
17 |
using System.Windows.Input; |
18 |
using System.Windows.Media; |
19 |
using Telerik.Windows.Controls; |
20 |
|
21 |
namespace KCOM.Controls |
22 |
{ |
23 |
/// <summary> |
24 |
/// Interaction logic for AdornerFinal.xaml |
25 |
/// </summary> |
26 |
public class AdornerMember |
27 |
{ |
28 |
public UIElement DrawingData { get; set; } |
29 |
public ControlType Drawingtype { get; set; } |
30 |
public double DrawingAngle { get; set; } |
31 |
public List<Thumb> ThumbList { get; set; } |
32 |
|
33 |
} |
34 |
public partial class AdornerFinal : UserControl |
35 |
{ |
36 |
public TextBox editTextBox { get; set; } |
37 |
#region 공용 인스턴스 |
38 |
public List<AdornerMember> MemberSet { get; set; } |
39 |
public Dictionary<Thumb, DragData> _dragData = new Dictionary<Thumb, DragData>(); |
40 |
public double AngleValue = 0; |
41 |
public bool IsTextAngle = false; |
42 |
public Rect BorderSize { get; set; } |
43 |
public bool TextCompensation = false; |
44 |
public bool isDragging { get; set; } |
45 |
public Thumb DraggerThumb { get; set; } |
46 |
public RadDropDownButton dropData; |
47 |
public RadCalendar dropCalendar; |
48 |
public Thumb mainDragThumb { get; set; } |
49 |
|
50 |
public Point reSizePoint { get; set; } |
51 |
private Point rotatePoint { get; set; } /// 2018.05.09 added by humkyung |
52 |
#endregion |
53 |
#region 생성자 |
54 |
private void RadDropDownButton_Loaded(object sender, RoutedEventArgs e) |
55 |
{ |
56 |
dropData = sender as RadDropDownButton; |
57 |
} |
58 |
private void Date_Calendar_Loaded(object sender, RoutedEventArgs e) |
59 |
{ |
60 |
dropCalendar = sender as RadCalendar; |
61 |
dropCalendar.SelectionChanged += (sen, ea) => |
62 |
{ |
63 |
dropData.IsOpen = false; |
64 |
if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "DateControl") |
65 |
{ |
66 |
DateControl data = (MemberSet.First() as AdornerMember).DrawingData as DateControl; |
67 |
data.Text = dropCalendar.SelectedDate.Value.ToShortDateString(); |
68 |
} |
69 |
}; |
70 |
} |
71 |
public AdornerFinal() |
72 |
{ |
73 |
InitializeComponent(); |
74 |
MemberSet = new List<AdornerMember>(); |
75 |
BorderSize = new Rect(); |
76 |
_dragData.Add(rotateTop, new DragData() { CursorAngle = 0, DragType = DragType.Rotate, RotateIsLeft = true, RotateIsTop = true }); |
77 |
//_dragData.Add(rotateCenter, new DragData() { CursorAngle = 0, DragType = DragType.Rotate, RotateIsLeft = true, RotateIsTop = true }); |
78 |
} |
79 |
|
80 |
void DragThumb_Loaded(object sender, RoutedEventArgs e) |
81 |
{ |
82 |
mainDragThumb = DragThumb; |
83 |
} |
84 |
|
85 |
public AdornerFinal(CommentUserInfo objectData) : this() |
86 |
{ |
87 |
InitializeComponent(); |
88 |
objectData.IsHitTestVisible = false; |
89 |
if ((objectData as ArrowTextControl) != null) |
90 |
{ |
91 |
(objectData as ArrowTextControl).Base_TextBox.Focusable = true; |
92 |
} |
93 |
Canvas.SetZIndex(objectData, 84); |
94 |
try |
95 |
{ |
96 |
this.ContainerContent.Children.Add(objectData); |
97 |
} |
98 |
catch (Exception ex) |
99 |
{ |
100 |
|
101 |
} |
102 |
SetAdornerMember(objectData as CommentUserInfo); |
103 |
this.Focus(); |
104 |
} |
105 |
public AdornerFinal(List<CommentUserInfo> objectData) : this() |
106 |
{ |
107 |
InitializeComponent(); |
108 |
foreach (var item in objectData) |
109 |
{ |
110 |
//item.IsHitTestVisible = false; |
111 |
if ((item as ArrowTextControl) != null) |
112 |
{ |
113 |
(item as ArrowTextControl).Base_TextBox.Focusable = true; |
114 |
} |
115 |
try |
116 |
{ |
117 |
Canvas.SetZIndex(item, 80); |
118 |
this.ContainerContent.Children.Add(item); |
119 |
} |
120 |
catch (Exception ex) |
121 |
{ |
122 |
|
123 |
} |
124 |
} |
125 |
SetAdornerMember(objectData); |
126 |
this.Focus(); |
127 |
} |
128 |
|
129 |
#endregion |
130 |
#region 메서드 |
131 |
public Rect getAdornerSize() |
132 |
{ |
133 |
return BorderSize; |
134 |
} |
135 |
public void addMemberControl(UIElement objectData) |
136 |
{ |
137 |
this.ContainerContent.Children.Add(objectData); |
138 |
SetAdornerMember(objectData as CommentUserInfo); |
139 |
this.Focus(); |
140 |
} |
141 |
/// <summary> |
142 |
/// UIElement를 종류에 맞게 등록시킴 |
143 |
/// </summary> |
144 |
/// <param name="member">UIElement 타입으로 BaseLayer에 있는 것들이 들어옵니다.</param> |
145 |
public void SetAdornerMember(MarkupToPDF.Common.CommentUserInfo member) |
146 |
{ |
147 |
|
148 |
switch (member.GetType().Name) |
149 |
{ |
150 |
#region 컨트롤 조건 |
151 |
case "LineControl": //Angle추가 안했음 |
152 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.SingleLine, ThumbList = new List<Thumb>() }); |
153 |
break; |
154 |
case "ImgControl": //Angle추가 안했음 |
155 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ImgControl, ThumbList = new List<Thumb>() }); |
156 |
//AdornerBorder.RenderTransformOrigin = new Point(0.5, 0.5); |
157 |
//DragThumb.RenderTransformOrigin = new Point(0.5, 0.5); |
158 |
AngleValue = (member as ImgControl).Angle; |
159 |
break; |
160 |
//case "SymControl": //Angle추가 안했음 |
161 |
// MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = MarkupType.Viewbox, ThumbList = new List<Thumb>() }); |
162 |
// AngleValue = (member as SymControl).Angle; |
163 |
// //ViewBoxRotate(member); |
164 |
// break; |
165 |
//case "SymControlN": //Angle추가 안했음 |
166 |
// MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = MarkupType.Viewbox, ThumbList = new List<Thumb>() }); |
167 |
// AngleValue = (member as SymControlN).Angle; |
168 |
// //ViewBoxRotate(member); |
169 |
// break; |
170 |
case "PolygonControl": //Angle추가 안했음 |
171 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.PolygonControl, ThumbList = new List<Thumb>() }); |
172 |
break; |
173 |
case "ArrowControl": |
174 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowLine, ThumbList = new List<Thumb>() }); |
175 |
break; |
176 |
case "ArrowTextControl": |
177 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowTextControl, ThumbList = new List<Thumb>() }); |
178 |
(member as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
179 |
|
180 |
Observable.FromEventPattern(((ArrowTextControl)member).Base_TextBox, "LostFocus").Subscribe(a => |
181 |
{ |
182 |
TextCompensation = false; |
183 |
BorderUpdate(); |
184 |
if ((a.Sender as TextBox).Text == "") //보류 |
185 |
{ |
186 |
this.ContainerContent.Children.Remove(member); |
187 |
this.Visibility = Visibility.Collapsed; |
188 |
} |
189 |
}); |
190 |
break; |
191 |
case "ArcControl": |
192 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArcLine, ThumbList = new List<Thumb>() }); |
193 |
break; |
194 |
case "ArrowControl_Multi": |
195 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowMultiLine, ThumbList = new List<Thumb>() }); |
196 |
break; |
197 |
case "RectangleControl": |
198 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Rectangle, ThumbList = new List<Thumb>() }); |
199 |
break; |
200 |
case "DateControl": |
201 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Date, ThumbList = new List<Thumb>() }); |
202 |
AngleValue = (member as DateControl).Angle; |
203 |
break; |
204 |
case "TriControl": |
205 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Triangle, ThumbList = new List<Thumb>() }); |
206 |
break; |
207 |
case "CircleControl": |
208 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Circle, ThumbList = new List<Thumb>() }); |
209 |
break; |
210 |
case "CloudControl": |
211 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.PolygonCloud, ThumbList = new List<Thumb>() }); |
212 |
break; |
213 |
case "RectCloudControl": |
214 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.RectCloud, ThumbList = new List<Thumb>() }); |
215 |
break; |
216 |
//강인구 추가 |
217 |
case "SignControl": |
218 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Sign, ThumbList = new List<Thumb>() }); |
219 |
AngleValue = (member as SignControl).Angle; |
220 |
break; |
221 |
//강인구 추가 |
222 |
case "SymControl": |
223 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Symbol, ThumbList = new List<Thumb>() }); |
224 |
AngleValue = (member as SymControl).Angle; |
225 |
break; |
226 |
//강인구 추가 |
227 |
case "SymControlN": |
228 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Stamp, ThumbList = new List<Thumb>() }); |
229 |
AngleValue = (member as SymControlN).Angle; |
230 |
break; |
231 |
case "InkControl": //Angle추가 안했음 |
232 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Ink, ThumbList = new List<Thumb>() }); |
233 |
break; |
234 |
case "TextControl": |
235 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.TextControl, ThumbList = new List<Thumb>() }); |
236 |
RectangleGeometry Data = new RectangleGeometry |
237 |
{ |
238 |
Rect = new Rect() |
239 |
{ |
240 |
X = Canvas.GetLeft((member as TextControl)), |
241 |
Y = Canvas.GetTop((member as TextControl)), |
242 |
Width = (member as TextControl).Base_TextBlock.ActualWidth / 2, |
243 |
Height = (member as TextControl).Base_TextBlock.ActualHeight / 2, |
244 |
//Width = (member as TextControl).BoxWidth / 2, |
245 |
//Height = (member as TextControl).BoxHeight / 2, |
246 |
} |
247 |
}; |
248 |
Point endPointV = new Point(Data.Bounds.Right, Data.Bounds.Bottom); |
249 |
Point middle = MathSet.getMiddlePoint((member as TextControl).StartPoint, endPointV); |
250 |
|
251 |
|
252 |
DragThumb.RenderTransformOrigin = new Point(0.0, 0.0); |
253 |
DragThumb.RenderTransform = new RotateTransform() |
254 |
{ |
255 |
Angle = (member as TextControl).Angle, |
256 |
//CenterX = middle.X, |
257 |
//CenterY = middle.Y, |
258 |
}; |
259 |
|
260 |
AdornerBorder.RenderTransformOrigin = new Point(0.0, 0.0); |
261 |
AdornerBorder.RenderTransform = new RotateTransform() |
262 |
{ |
263 |
Angle = (member as TextControl).Angle, |
264 |
//CenterX = middle.X, |
265 |
//CenterY = middle.Y, |
266 |
}; |
267 |
Observable.FromEventPattern(((TextControl)member), "PropertyChanged").Subscribe(a => |
268 |
{ |
269 |
TextCompensation = true; |
270 |
BorderUpdate(); |
271 |
((TextControl)member).Base_TextBlock.TextDecorations = ((TextControl)member).UnderLine; |
272 |
}); |
273 |
Observable.FromEventPattern(((TextControl)member).Base_TextBox, "LostFocus").Subscribe(a => |
274 |
{ |
275 |
TextCompensation = false; |
276 |
BorderUpdate(); |
277 |
if ((a.Sender as TextBox).Text == "") //보류 |
278 |
{ |
279 |
this.ContainerContent.Children.Remove(member); |
280 |
this.Visibility = Visibility.Collapsed; |
281 |
} |
282 |
|
283 |
//((TextControl)member).UnEditingMode(); |
284 |
//((TextControl)member).Base_TextBlock.Visibility = Visibility.Collapsed; |
285 |
//((TextControl)member).Base_Border.Visibility = Visibility.Collapsed; |
286 |
//((TextControl)member).Base_TextPath.Visibility = Visibility.Collapsed; |
287 |
}); |
288 |
break; |
289 |
default: |
290 |
break; |
291 |
#endregion |
292 |
} |
293 |
if (member.GetType().Name == "TextControl") |
294 |
{ |
295 |
TextControl content = ((TextControl)member); |
296 |
content.StartPoint = new Point(Canvas.GetLeft(content), Canvas.GetTop(content)); |
297 |
content.EndPoint = content.StartPoint; |
298 |
|
299 |
//RegistryPoint(AllControl.PointSet); |
300 |
} |
301 |
else |
302 |
{ |
303 |
RegistryPoint(member); |
304 |
} |
305 |
BorderUpdate(); |
306 |
} |
307 |
|
308 |
private void ViewBoxRotate(UIElement member) |
309 |
{ |
310 |
AdornerBorder.RenderTransformOrigin = new Point(0.5, 0.5); |
311 |
DragThumb.RenderTransformOrigin = new Point(0.5, 0.5); |
312 |
AdornerBorder.RenderTransform = new RotateTransform() { Angle = (member as IViewBox).Angle }; |
313 |
DragThumb.RenderTransform = new RotateTransform() { Angle = (member as IViewBox).Angle }; |
314 |
} |
315 |
public void SetAdornerMember(List<CommentUserInfo> members) |
316 |
{ |
317 |
foreach (var member in members) |
318 |
{ |
319 |
switch (member.GetType().Name) |
320 |
{ |
321 |
#region 컨트롤 조건 |
322 |
case "LineControl": //Angle추가 안했음 |
323 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.SingleLine, ThumbList = new List<Thumb>() }); |
324 |
break; |
325 |
case "ImgControl": //Angle추가 안했음 |
326 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ImgControl, ThumbList = new List<Thumb>() }); |
327 |
break; |
328 |
//case "SymControl": //Angle추가 안했음 |
329 |
// MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = MarkupType.Viewbox, ThumbList = new List<Thumb>() }); |
330 |
// break; |
331 |
//case "SymControlN": //Angle추가 안했음 |
332 |
// MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = MarkupType.Viewbox, ThumbList = new List<Thumb>() }); |
333 |
// ViewBoxRotate(member); |
334 |
// break; |
335 |
case "ArrowControl": |
336 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowLine, ThumbList = new List<Thumb>() }); |
337 |
break; |
338 |
case "PolygonControl": //Angle추가 안했음 |
339 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.PolygonControl, ThumbList = new List<Thumb>() }); |
340 |
break; |
341 |
case "ArrowTextControl": |
342 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowTextControl, ThumbList = new List<Thumb>() }); |
343 |
(member as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
344 |
break; |
345 |
case "ArcControl": |
346 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArcLine, ThumbList = new List<Thumb>() }); |
347 |
break; |
348 |
case "DateControl": |
349 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Date, ThumbList = new List<Thumb>() }); |
350 |
break; |
351 |
case "ArrowControl_Multi": |
352 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowMultiLine, ThumbList = new List<Thumb>() }); |
353 |
break; |
354 |
case "RectangleControl": |
355 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Rectangle, ThumbList = new List<Thumb>() }); |
356 |
break; |
357 |
case "TriControl": |
358 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Triangle, ThumbList = new List<Thumb>() }); |
359 |
break; |
360 |
case "CircleControl": |
361 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Circle, ThumbList = new List<Thumb>() }); |
362 |
break; |
363 |
case "CloudControl": |
364 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.PolygonCloud, ThumbList = new List<Thumb>() }); |
365 |
break; |
366 |
case "RectCloudControl": |
367 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.RectCloud, ThumbList = new List<Thumb>() }); |
368 |
break; |
369 |
//강인구 추가 |
370 |
case "SignControl": |
371 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Sign, ThumbList = new List<Thumb>() }); |
372 |
break; |
373 |
case "SymControl": |
374 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Symbol, ThumbList = new List<Thumb>() }); |
375 |
break; |
376 |
case "SymControlN": |
377 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Stamp, ThumbList = new List<Thumb>() }); |
378 |
break; |
379 |
case "InkControl": //Angle추가 안했음 |
380 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Ink, ThumbList = new List<Thumb>() }); |
381 |
break; |
382 |
case "TextControl": |
383 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.TextControl, ThumbList = new List<Thumb>() }); |
384 |
Observable.FromEventPattern(((TextControl)member), "PropertyChanged").Subscribe(a => |
385 |
{ |
386 |
BorderUpdate(); |
387 |
try |
388 |
{ |
389 |
((TextControl)member).Base_TextBlock.TextDecorations = ((TextControl)member).UnderLine; //확인 0403 |
390 |
} |
391 |
catch (Exception) |
392 |
{ |
393 |
|
394 |
} |
395 |
|
396 |
}); |
397 |
Observable.FromEventPattern(((TextControl)member).Base_TextBox, "SelectionChanged").Subscribe(a => |
398 |
{ |
399 |
BorderUpdate(); |
400 |
}); |
401 |
break; |
402 |
default: |
403 |
break; |
404 |
#endregion |
405 |
} |
406 |
if (member.GetType().Name == "TextControl") |
407 |
{ |
408 |
//강인구 추가 |
409 |
TextControl content = ((TextControl)member); |
410 |
content.StartPoint = new Point(Canvas.GetLeft(content), Canvas.GetTop(content)); |
411 |
content.EndPoint = content.StartPoint; |
412 |
//RegistryPoint(AllControl.PointSet); |
413 |
} |
414 |
else |
415 |
{ |
416 |
RegistryPoint(member, members.Count); |
417 |
} |
418 |
} |
419 |
|
420 |
BorderUpdate(); |
421 |
} |
422 |
|
423 |
/// <summary> |
424 |
/// Border 를 갱신 |
425 |
/// </summary> |
426 |
public void BorderUpdate() |
427 |
{ |
428 |
AdornerBorder.MinWidth = 10; |
429 |
AdornerBorder.MinHeight = 10; |
430 |
|
431 |
double minX = double.MaxValue; |
432 |
double minY = double.MaxValue; |
433 |
double maxX = double.MinValue; |
434 |
double maxY = double.MinValue; |
435 |
|
436 |
if (MemberSet.Count == 1) |
437 |
{ |
438 |
if (MemberSet.First().DrawingData.GetType().Name == "TextControl") |
439 |
{ |
440 |
if ((MemberSet.First().DrawingData as TextControl).Angle != 0) |
441 |
{ |
442 |
trRotate.Angle = (MemberSet.First().DrawingData as TextControl).Angle; |
443 |
trRotateThumb.Angle = (MemberSet.First().DrawingData as TextControl).Angle; |
444 |
} |
445 |
else |
446 |
{ |
447 |
trRotate.Angle = 0; |
448 |
trRotateThumb.Angle = 0; |
449 |
} |
450 |
} |
451 |
} |
452 |
foreach (var item in MemberSet) |
453 |
{ |
454 |
UIElement currentControl = (item as AdornerMember).DrawingData; |
455 |
if (item.DrawingData.GetType().Name == "TextControl") |
456 |
{ |
457 |
double textControlWidth; |
458 |
double textControlHeight; |
459 |
if (((currentControl as TextControl).Base_TextBox.ActualWidth) == 0) |
460 |
{ |
461 |
textControlWidth = ((currentControl as TextControl).Base_TextBlock.ActualWidth); |
462 |
textControlHeight = ((currentControl as TextControl).Base_TextBlock.ActualHeight); |
463 |
} |
464 |
else |
465 |
{ |
466 |
textControlWidth = ((currentControl as TextControl).Base_TextBox.ActualWidth); |
467 |
textControlHeight = ((currentControl as TextControl).Base_TextBox.ActualHeight); |
468 |
} |
469 |
if ((currentControl as TextControl).LineSize.Left == 0) |
470 |
{ |
471 |
if (TextCompensation) |
472 |
{ |
473 |
|
474 |
textControlWidth += 1; |
475 |
textControlHeight += 1; |
476 |
} |
477 |
else |
478 |
{ |
479 |
textControlWidth += 3; |
480 |
textControlHeight += 3; |
481 |
} |
482 |
} |
483 |
else |
484 |
{ |
485 |
if (TextCompensation) |
486 |
{ |
487 |
|
488 |
textControlWidth += 1; |
489 |
textControlHeight += 1; |
490 |
} |
491 |
else |
492 |
{ |
493 |
textControlWidth += 8; |
494 |
textControlHeight += 8; |
495 |
} |
496 |
|
497 |
} |
498 |
if ((currentControl as TextControl).EndPoint.X < minX) |
499 |
{ |
500 |
minX = (currentControl as TextControl).EndPoint.X; |
501 |
} |
502 |
if ((currentControl as TextControl).EndPoint.Y < minY) |
503 |
{ |
504 |
minY = (currentControl as TextControl).EndPoint.Y; |
505 |
} |
506 |
if (textControlWidth + (currentControl as TextControl).EndPoint.X > maxX) |
507 |
{ |
508 |
maxX = textControlWidth + (currentControl as TextControl).EndPoint.X; |
509 |
} |
510 |
if (textControlHeight + (currentControl as TextControl).EndPoint.Y > maxY) |
511 |
{ |
512 |
maxY = textControlHeight + (currentControl as TextControl).EndPoint.Y; |
513 |
} |
514 |
} |
515 |
else if ((currentControl as IViewBox) != null) |
516 |
{ |
517 |
IViewBox instance = currentControl as IViewBox; |
518 |
List<Point> am = (currentControl as IPath).PointSet; |
519 |
List<double> xSet = am.Select(p => p.X).ToList(); |
520 |
List<double> ySet = am.Select(p => p.Y).ToList(); |
521 |
if (xSet.Min() < minX) minX = xSet.Min(); |
522 |
if (ySet.Min() < minY) minY = ySet.Min(); |
523 |
if (xSet.Max() > maxX) maxX = xSet.Max(); |
524 |
if (ySet.Max() > maxY) maxY = ySet.Max(); |
525 |
} |
526 |
else if ((currentControl as IPath).PathData == null) |
527 |
{ |
528 |
Rect rt = new Rect |
529 |
{ |
530 |
X = (currentControl as IPath).StartPoint.X, |
531 |
Y = (currentControl as IPath).StartPoint.Y, |
532 |
//Width = (currentControl as IPath).EndPoint.X - (currentControl as IPath).StartPoint.X, |
533 |
//Height = (currentControl as IPath).EndPoint.Y - (currentControl as IPath).StartPoint.Y |
534 |
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), |
535 |
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), |
536 |
}; |
537 |
if (rt.Left < minX) minX = rt.Left; |
538 |
if (rt.Top < minY) minY = rt.Top; |
539 |
if (rt.Right > maxX) maxX = rt.Right; |
540 |
if (rt.Bottom > maxY) maxY = rt.Bottom; |
541 |
} |
542 |
else if ((currentControl as IPath) == null) |
543 |
{ |
544 |
Rect rt = new Rect |
545 |
{ |
546 |
X = (currentControl as IPath).StartPoint.X, |
547 |
Y = (currentControl as IPath).StartPoint.Y, |
548 |
Width = (currentControl as IPath).EndPoint.X - (currentControl as IPath).StartPoint.X, |
549 |
Height = (currentControl as IPath).EndPoint.Y - (currentControl as IPath).StartPoint.Y |
550 |
}; |
551 |
if (rt.Left < minX) minX = rt.Left; |
552 |
if (rt.Top < minY) minY = rt.Top; |
553 |
if (rt.Right > maxX) maxX = rt.Right; |
554 |
if (rt.Bottom > maxY) maxY = rt.Bottom; |
555 |
} |
556 |
else if ((currentControl as CircleControl) != null) |
557 |
{ |
558 |
//Rect rt = new Rect |
559 |
//{ |
560 |
// X = (currentControl as IPath).StartPoint.X, |
561 |
// Y = (currentControl as IPath).StartPoint.Y, |
562 |
// Width = (currentControl as IPath).EndPoint.X - (currentControl as IPath).StartPoint.X, |
563 |
// Height = (currentControl as IPath).EndPoint.Y - (currentControl as IPath).StartPoint.Y |
564 |
//}; |
565 |
|
566 |
//Rect rt = new Rect((currentControl as IPath).StartPoint, (currentControl as IPath).EndPoint); |
567 |
//if (rt.Left < minX) minX = rt.Left; |
568 |
//if (rt.Top < minY) minY = rt.Top; |
569 |
//if (rt.Right > maxX) maxX = rt.Right; |
570 |
//if (rt.Bottom > maxY) maxY = rt.Bottom; |
571 |
|
572 |
List<Point> am = (currentControl as IPath).PointSet; |
573 |
List<double> xSet = am.Select(p => p.X).ToList(); |
574 |
List<double> ySet = am.Select(p => p.Y).ToList(); |
575 |
if (xSet.Min() < minX) minX = xSet.Min(); |
576 |
if (ySet.Min() < minY) minY = ySet.Min(); |
577 |
if (xSet.Max() > maxX) maxX = xSet.Max(); |
578 |
if (ySet.Max() > maxY) maxY = ySet.Max(); |
579 |
} |
580 |
else |
581 |
{ |
582 |
if ((currentControl as IPath).PathData.Bounds.Left < minX) minX = (currentControl as IPath).PathData.Bounds.Left; |
583 |
if ((currentControl as IPath).PathData.Bounds.Top < minY) minY = (currentControl as IPath).PathData.Bounds.Top; |
584 |
if ((currentControl as IPath).PathData.Bounds.Right > maxX) maxX = (currentControl as IPath).PathData.Bounds.Right; |
585 |
if ((currentControl as IPath).PathData.Bounds.Bottom > maxY) maxY = (currentControl as IPath).PathData.Bounds.Bottom; |
586 |
} |
587 |
} |
588 |
|
589 |
Rect ac = new Rect(minX, minY, maxX - minX, maxY - minY); |
590 |
bool addWidthSize = false; |
591 |
bool addHeightSize = false; |
592 |
if (ac.Width <= 10) |
593 |
{ |
594 |
ac.Width += 10; |
595 |
addWidthSize = true; |
596 |
} |
597 |
if (ac.Height <= 10) |
598 |
{ |
599 |
ac.Height += 10; |
600 |
addHeightSize = true; |
601 |
} |
602 |
BorderSize = ac; |
603 |
AdornerBorder.MinWidth = 10; |
604 |
AdornerBorder.MinHeight = 10; |
605 |
AdornerBorder.Width = ac.Width; |
606 |
AdornerBorder.Height = ac.Height; |
607 |
Canvas.SetLeft(AdornerBorder, minX); |
608 |
Canvas.SetTop(AdornerBorder, minY); |
609 |
|
610 |
DragThumb.Width = ac.Width; |
611 |
DragThumb.Height = ac.Height; |
612 |
|
613 |
DragThumb.MinWidth = 10; |
614 |
DragThumb.MinHeight = 10; |
615 |
if (addWidthSize) |
616 |
{ |
617 |
Canvas.SetLeft(DragThumb, minX - 5); |
618 |
} |
619 |
else |
620 |
{ |
621 |
Canvas.SetLeft(DragThumb, minX); |
622 |
} |
623 |
|
624 |
if (addHeightSize) |
625 |
{ |
626 |
Canvas.SetTop(DragThumb, minY - 5); |
627 |
} |
628 |
else |
629 |
{ |
630 |
Canvas.SetTop(DragThumb, minY); |
631 |
} |
632 |
} |
633 |
/// <summary> |
634 |
/// UIElement 해제 |
635 |
/// </summary> |
636 |
public void unRegister() |
637 |
{ |
638 |
foreach (var item in this.ContainerContent.Children) |
639 |
{ |
640 |
if (item is MarkupToPDF.Common.CommentUserInfo) |
641 |
{ |
642 |
(item as MarkupToPDF.Common.CommentUserInfo).IsHitTestVisible = true; |
643 |
} |
644 |
} |
645 |
this.ContainerContent.Children.Clear(); |
646 |
} |
647 |
/// <summary> |
648 |
/// 각 포인트들을 등록합니다. |
649 |
/// </summary> |
650 |
/// <param name="pointset">Drawing Point</param> |
651 |
public void RegistryPoint(CommentUserInfo member, int cnt = 1) |
652 |
{ |
653 |
int count = 0; |
654 |
double Minx = 100000000; |
655 |
double Miny = 100000000; |
656 |
List<Point> list = (member as IPath).PointSet; |
657 |
if (member.GetType().Name == "InkControl") |
658 |
{ |
659 |
list.Clear(); |
660 |
list.Add(new Point((member as IPath).PathData.Bounds.X, (member as IPath).PathData.Bounds.Y)); |
661 |
list.Add(new Point((member as IPath).PathData.Bounds.Left, (member as IPath).PathData.Bounds.Bottom)); |
662 |
list.Add(new Point((member as IPath).PathData.Bounds.Right, (member as IPath).PathData.Bounds.Bottom)); |
663 |
list.Add(new Point((member as IPath).PathData.Bounds.Right, (member as IPath).PathData.Bounds.Top)); |
664 |
} |
665 |
ControlType markT = MemberSet.Where(p => p.DrawingData == member).First().Drawingtype; |
666 |
foreach (var ax in list) |
667 |
{ |
668 |
Minx = (ax.X < Minx) ? ax.X : Minx; |
669 |
Miny = (ax.Y < Miny) ? ax.Y : Miny; |
670 |
} |
671 |
for (int i = 0; i < list.Count(); i++) |
672 |
{ |
673 |
Thumb tm = new Thumb |
674 |
{ |
675 |
//Name = String.Format("thumb{0}_{1}", count, member.GetType().Name.ToString()), |
676 |
Style = (Style)this.LayoutRoot.Resources["ThumbResizeStyle"], |
677 |
}; |
678 |
|
679 |
MemberSet.Last().ThumbList.Add(tm); |
680 |
|
681 |
if (markT == ControlType.ArcLine && list[i] == (member as ArcControl).MidPoint) |
682 |
{ |
683 |
tm.Style = (Style)this.LayoutRoot.Resources["ThumbArcControlStyle"]; |
684 |
} |
685 |
if (member.GetType().Name == "ArrowTextControl" && i == 1) |
686 |
{ |
687 |
//if (MemberSet.Count()<=1) |
688 |
//{ |
689 |
tm.Style = (Style)this.LayoutRoot.Resources["ThumbArcControlStyle"]; |
690 |
List<Point> ps = new List<Point>(); |
691 |
|
692 |
if ((MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl != null) |
693 |
{ |
694 |
var temp = (MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl; |
695 |
|
696 |
|
697 |
switch (Math.Abs(temp.Angle).ToString()) |
698 |
{ |
699 |
case "90": |
700 |
{ |
701 |
ps.Clear(); |
702 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽 |
703 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); // 위 중간 |
704 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); // 위 오른쪽 |
705 |
|
706 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 중간 |
707 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 하단 |
708 |
|
709 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); //중간 하단 |
710 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 하단 |
711 |
|
712 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 중간 |
713 |
} |
714 |
break; |
715 |
case "270": |
716 |
{ |
717 |
ps.Clear(); |
718 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽 |
719 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); // 위 중간 |
720 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); // 위 오른쪽 |
721 |
|
722 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 중간 |
723 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 하단 |
724 |
|
725 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); //중간 하단 |
726 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 하단 |
727 |
|
728 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 중간 |
729 |
} |
730 |
break; |
731 |
default: |
732 |
{ |
733 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단 |
734 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단 |
735 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단 |
736 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //우단 |
737 |
} |
738 |
break; |
739 |
} |
740 |
|
741 |
ArrowTextControl instance = (member as ArrowTextControl); |
742 |
if (instance.isTrans) |
743 |
{ |
744 |
//var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
745 |
//var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP); |
746 |
//list[count] = tempP; |
747 |
list[count] = temp.MidPoint; |
748 |
} |
749 |
else |
750 |
{ |
751 |
if (temp.isFixed) |
752 |
{ |
753 |
var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
754 |
var testP = endP; |
755 |
if (ps[0] == endP) //상단 |
756 |
{ |
757 |
testP = new Point(endP.X, endP.Y - 50); |
758 |
} |
759 |
else if (ps[1] == endP) //하단 |
760 |
{ |
761 |
testP = new Point(endP.X, endP.Y + 50); |
762 |
} |
763 |
else if (ps[2] == endP) //좌단 |
764 |
{ |
765 |
testP = new Point(endP.X - 50, endP.Y); |
766 |
} |
767 |
else if (ps[3] == endP) //우단 |
768 |
{ |
769 |
testP = new Point(endP.X + 50, endP.Y); |
770 |
} |
771 |
list[count] = testP; |
772 |
} |
773 |
else |
774 |
{ |
775 |
var endP = MathSet.getNearPoint(ps, instance.MidPoint); |
776 |
list[count] = MathSet.getMiddlePoint(instance.StartPoint, endP); |
777 |
} |
778 |
} |
779 |
} |
780 |
} |
781 |
if (member.GetType().Name == "ArrowTextControl" && list[i] == list.Last()) |
782 |
{ |
783 |
tm.Style = (Style)this.LayoutRoot.Resources["ThumbTextStyle"]; |
784 |
tm.Width = (member as ArrowTextControl).BoxWidth; |
785 |
tm.Height = (member as ArrowTextControl).BoxHeight; |
786 |
var angle = (member as ArrowTextControl).Angle; |
787 |
if (Math.Abs(angle).ToString() == "90") |
788 |
{ |
789 |
tm.RenderTransformOrigin = new Point(0, 0); |
790 |
tm.RenderTransform = new RotateTransform { Angle = 270 }; |
791 |
} |
792 |
else if (Math.Abs(angle).ToString() == "270") |
793 |
{ |
794 |
tm.RenderTransformOrigin = new Point(0, 0); |
795 |
tm.RenderTransform = new RotateTransform { Angle = 90 }; |
796 |
|
797 |
} |
798 |
else |
799 |
{ |
800 |
tm.RenderTransformOrigin = new Point(0.5, 0.5); |
801 |
tm.RenderTransform = new RotateTransform() |
802 |
{ |
803 |
Angle = angle, |
804 |
}; |
805 |
} |
806 |
} |
807 |
//if (markT == MarkupType.Polygon || markT == MarkupType.Cloud) |
808 |
//{ |
809 |
// tm.MouseMove += new MouseEventHandler(resize_MouseMove); |
810 |
// tm.DragStarted += new DragStartedEventHandler(tm_DragStarted); |
811 |
// tm.DragCompleted += new DragCompletedEventHandler(tm_DragCompleted); |
812 |
//} |
813 |
//else |
814 |
//{ |
815 |
// tm.MouseMove += new MouseEventHandler(resize_MouseMove); |
816 |
// tm.DragStarted += new DragStartedEventHandler(tm_DragStarted); |
817 |
// tm.DragCompleted += new DragCompletedEventHandler(tm_DragCompleted); |
818 |
//} |
819 |
|
820 |
if (member.GetType().Name == "CloudControl") |
821 |
{ |
822 |
if (i == list.Count() - 1) |
823 |
{ |
824 |
tm.Visibility = System.Windows.Visibility.Collapsed; |
825 |
} |
826 |
} |
827 |
if (member.GetType().Name == "PolygonControl") |
828 |
{ |
829 |
if (i == list.Count() - 1) |
830 |
{ |
831 |
if ((member as PolygonControl).ControlType == ControlType.ChainLine) |
832 |
{ |
833 |
|
834 |
} |
835 |
else |
836 |
{ |
837 |
tm.Visibility = System.Windows.Visibility.Collapsed; |
838 |
} |
839 |
} |
840 |
if ((member as PolygonControl).ControlType == ControlType.Ink) |
841 |
{ |
842 |
tm.Visibility = System.Windows.Visibility.Collapsed; |
843 |
} |
844 |
} |
845 |
|
846 |
//강인구 텀브 없애기 보류 |
847 |
//if(cnt > 1) |
848 |
//{ |
849 |
// tm.Visibility = System.Windows.Visibility.Collapsed; |
850 |
//} |
851 |
|
852 |
|
853 |
|
854 |
//if (member.GetType().Name == "InkControl") |
855 |
//{ |
856 |
// tm.Visibility = System.Windows.Visibility.Collapsed; |
857 |
//} |
858 |
|
859 |
this.ContainerContent.Children.Add(tm); |
860 |
Canvas.SetLeft(tm, list[count].X); |
861 |
Canvas.SetTop(tm, list[count].Y); |
862 |
if (member.GetType().Name == "ArrowTextControl" && list[i] == (member as ArrowTextControl).MidPoint) |
863 |
{ |
864 |
Canvas.SetZIndex(tm, 95); |
865 |
} |
866 |
else |
867 |
{ |
868 |
Canvas.SetZIndex(tm, 99); |
869 |
} |
870 |
|
871 |
tm.DragStarted += new DragStartedEventHandler(tm_DragStarted); |
872 |
tm.DragCompleted += new DragCompletedEventHandler(tm_DragCompleted); |
873 |
tm.DragDelta += ResizeTm_DragDelta; |
874 |
tm.MouseMove += new MouseEventHandler(resize_MouseMove); |
875 |
count++; |
876 |
} |
877 |
} |
878 |
|
879 |
private void ResizeTm_DragDelta(object sender, DragDeltaEventArgs e) |
880 |
{ |
881 |
//한개 이상 선택 시 Resize 금지 |
882 |
if (MemberSet.Count > 1) |
883 |
return; |
884 |
if (reSizePoint != new Point(0, 0)) |
885 |
{ |
886 |
Thumb thumb = sender as Thumb; |
887 |
|
888 |
Canvas.SetLeft(thumb, Canvas.GetLeft(thumb) + |
889 |
e.HorizontalChange); |
890 |
Canvas.SetTop(thumb, Canvas.GetTop(thumb) + |
891 |
e.VerticalChange); |
892 |
|
893 |
Point setPoint = new Point(Canvas.GetLeft(thumb), Canvas.GetTop(thumb)); |
894 |
|
895 |
|
896 |
//if (this.isDragging && MemberSet.Count <= 1) |
897 |
//if (thumb.IsDragging && MemberSet.Count <= 1 && DraggerThumb == thumb) |
898 |
//if (DraggerThumb == thumb) |
899 |
//{ |
900 |
//Point setPoint = reSizePoint; |
901 |
//Canvas.SetLeft(thumb, setPoint.X); |
902 |
//Canvas.SetTop(thumb, setPoint.Y); |
903 |
AdornerMember control = (from userThumb in MemberSet |
904 |
where userThumb.ThumbList.Contains(thumb) |
905 |
select userThumb).FirstOrDefault(); |
906 |
Point nearPoint = new Point(0, 0); |
907 |
IPath AllControl = control.DrawingData as IPath; |
908 |
if (ControlType.TextControl != control.Drawingtype) |
909 |
{ |
910 |
|
911 |
var temp = (MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl; |
912 |
List<Point> ps = new List<Point>(); |
913 |
|
914 |
nearPoint = MathSet.getNearPoint((control.DrawingData as IPath).PointSet, setPoint); |
915 |
//switch (Math.Abs(temp.Angle).ToString()) |
916 |
//{ |
917 |
|
918 |
// case "90": |
919 |
// { |
920 |
// nearPoint = MathSet.getNearPoint((control.DrawingData as IPath).PointSet, setPoint); |
921 |
// } |
922 |
// break; |
923 |
// case "270": |
924 |
// { |
925 |
// nearPoint = MathSet.getNearPoint((control.DrawingData as IPath).PointSet, setPoint); |
926 |
// } |
927 |
// break; |
928 |
// default: |
929 |
// { |
930 |
// nearPoint = MathSet.getNearPoint((control.DrawingData as IPath).PointSet, setPoint); |
931 |
// } |
932 |
// break; |
933 |
//} |
934 |
|
935 |
} |
936 |
for (int i = 0; i < (control.DrawingData as IPath).PointSet.Count; i++) |
937 |
{ |
938 |
switch (control.Drawingtype) |
939 |
{ |
940 |
#region Arc + Line |
941 |
case ControlType.ArrowMultiLine: |
942 |
case ControlType.ArcLine: |
943 |
case ControlType.SingleLine: |
944 |
case ControlType.Triangle: |
945 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
946 |
{ |
947 |
AllControl.PointSet[i] = setPoint; |
948 |
AllControl.updateControl(); |
949 |
DynamicThumbUpdate(control); |
950 |
BorderUpdate(); |
951 |
|
952 |
//if (control.DrawingData.GetType().Name == "ArrowTextControl") |
953 |
//{ |
954 |
// Thumb tm = control.ThumbList.Last(); |
955 |
// //Canvas.SetLeft(tm, (AllControl.EndPoint.X - tm.Width / 2)); |
956 |
// //Canvas.SetTop(tm, (AllControl.EndPoint.Y - tm.Height / 2)); |
957 |
// Canvas.SetLeft(tm, (AllControl.EndPoint.X - tm.Width)); |
958 |
// Canvas.SetTop(tm, (AllControl.EndPoint.Y - tm.Height)); |
959 |
//} |
960 |
} |
961 |
break; |
962 |
#endregion |
963 |
#region Shape |
964 |
//case ControlType.PolygonCloud: |
965 |
case ControlType.RectCloud: |
966 |
case ControlType.Rectangle: |
967 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
968 |
{ |
969 |
AllControl.PointSet[i] = setPoint; |
970 |
var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count(); |
971 |
var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count(); |
972 |
var NextP = (i + 1) % AllControl.PointSet.Count(); |
973 |
|
974 |
var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]); |
975 |
|
976 |
var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]); |
977 |
var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, |
978 |
AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y); |
979 |
AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet |
980 |
[ReverseP].Y |
981 |
+ PreviousV.Y * l); |
982 |
|
983 |
var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]); |
984 |
l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet |
985 |
[i].Y - AllControl.PointSet[ReverseP].Y); |
986 |
AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y + |
987 |
NextV.Y * l); |
988 |
AllControl.updateControl(); |
989 |
DynamicThumbUpdate(control); |
990 |
BorderUpdate(); |
991 |
} |
992 |
break; |
993 |
#endregion |
994 |
#region Polygon |
995 |
case ControlType.PolygonControl: |
996 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
997 |
{ |
998 |
AllControl.PointSet[i] = setPoint; |
999 |
AllControl.updateControl(); |
1000 |
BorderUpdate(); |
1001 |
} |
1002 |
break; |
1003 |
#endregion |
1004 |
#region Cicle |
1005 |
case ControlType.Circle: |
1006 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
1007 |
{ |
1008 |
AllControl.PointSet[i] = setPoint; |
1009 |
List<Point> newPointSet = new List<Point> { }; |
1010 |
Point middle = new Point(AllControl.PathData.Bounds.X + AllControl.PathData.Bounds.Width * 0.5, |
1011 |
AllControl.PathData.Bounds.Y + |
1012 |
AllControl.PathData.Bounds.Height * 0.5); |
1013 |
foreach (Point pt in AllControl.PointSet) |
1014 |
{ |
1015 |
newPointSet.Add(pt); |
1016 |
} |
1017 |
var ReverseP = (i + newPointSet.Count() / 2) % newPointSet.Count(); |
1018 |
var PreviousP = (i + (newPointSet.Count() - 1)) % newPointSet.Count(); |
1019 |
var NextP = (i + 1) % newPointSet.Count(); |
1020 |
var distance = MathSet.DistanceTo(newPointSet[ReverseP], newPointSet[i]); |
1021 |
var PreviousV = MathSet.GetNormVectorBetween(newPointSet[ReverseP], newPointSet[PreviousP]); |
1022 |
var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, newPointSet[i].X - newPointSet[ReverseP].X, |
1023 |
newPointSet[i].Y - newPointSet[ReverseP].Y); |
1024 |
newPointSet[PreviousP] = new Point(newPointSet[ReverseP].X + PreviousV.X * l, newPointSet[ReverseP].Y |
1025 |
+ PreviousV.Y * l); |
1026 |
|
1027 |
var NextV = MathSet.GetNormVectorBetween(newPointSet[ReverseP], newPointSet[NextP]); |
1028 |
l = MathSet.DotProduct(NextV.X, NextV.Y, newPointSet[i].X - newPointSet[ReverseP].X, newPointSet[i].Y |
1029 |
- newPointSet[ReverseP].Y); |
1030 |
newPointSet[NextP] = new Point(newPointSet[ReverseP].X + NextV.X * l, newPointSet[ReverseP].Y + NextV.Y * l); |
1031 |
|
1032 |
AllControl.PointSet = newPointSet; |
1033 |
DynamicThumbUpdate(control); |
1034 |
AllControl.updateControl(); |
1035 |
BorderUpdate(); |
1036 |
} |
1037 |
break; |
1038 |
#endregion |
1039 |
#region ArrowText |
1040 |
case ControlType.ArrowTextControl: |
1041 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
1042 |
{ |
1043 |
AllControl.PointSet[i] = setPoint; |
1044 |
AllControl.updateControl(); |
1045 |
|
1046 |
DynamicThumbUpdate(control); |
1047 |
BorderUpdate(); |
1048 |
|
1049 |
//if (control.DrawingData.GetType().Name == "ArrowTextControl") |
1050 |
//{ |
1051 |
// Thumb tm = control.ThumbList.Last(); |
1052 |
// //Canvas.SetLeft(tm, (AllControl.EndPoint.X - tm.Width / 2)); |
1053 |
// //Canvas.SetTop(tm, (AllControl.EndPoint.Y - tm.Height / 2)); |
1054 |
// Canvas.SetLeft(tm, (AllControl.EndPoint.X - tm.Width)); |
1055 |
// Canvas.SetTop(tm, (AllControl.EndPoint.Y - tm.Height)); |
1056 |
//} |
1057 |
} |
1058 |
break; |
1059 |
#endregion |
1060 |
#region Text |
1061 |
case ControlType.TextControl: |
1062 |
break; |
1063 |
#endregion |
1064 |
#region Image |
1065 |
case ControlType.ImgControl: |
1066 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
1067 |
{ |
1068 |
AllControl.PointSet[i] = setPoint; |
1069 |
var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count(); |
1070 |
var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count(); |
1071 |
var NextP = (i + 1) % AllControl.PointSet.Count(); |
1072 |
|
1073 |
var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]); |
1074 |
|
1075 |
var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]); |
1076 |
var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, |
1077 |
AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y); |
1078 |
AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet |
1079 |
[ReverseP].Y |
1080 |
+ PreviousV.Y * l); |
1081 |
|
1082 |
var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]); |
1083 |
l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet |
1084 |
[i].Y - AllControl.PointSet[ReverseP].Y); |
1085 |
AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y + |
1086 |
NextV.Y * l); |
1087 |
AllControl.updateControl(); |
1088 |
DynamicThumbUpdate(control); |
1089 |
BorderUpdate(); |
1090 |
} |
1091 |
break; |
1092 |
#endregion |
1093 |
//강인구 추가 |
1094 |
#region Sign |
1095 |
case ControlType.Sign: |
1096 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
1097 |
{ |
1098 |
AllControl.PointSet[i] = setPoint; |
1099 |
var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count(); |
1100 |
var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count(); |
1101 |
var NextP = (i + 1) % AllControl.PointSet.Count(); |
1102 |
|
1103 |
var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]); |
1104 |
|
1105 |
var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]); |
1106 |
var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, |
1107 |
AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y); |
1108 |
AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet |
1109 |
[ReverseP].Y |
1110 |
+ PreviousV.Y * l); |
1111 |
|
1112 |
var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]); |
1113 |
l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet |
1114 |
[i].Y - AllControl.PointSet[ReverseP].Y); |
1115 |
AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y + |
1116 |
NextV.Y * l); |
1117 |
AllControl.updateControl(); |
1118 |
DynamicThumbUpdate(control); |
1119 |
BorderUpdate(); |
1120 |
} |
1121 |
break; |
1122 |
#endregion |
1123 |
#region Cloud |
1124 |
case ControlType.PolygonCloud: |
1125 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
1126 |
{ |
1127 |
AllControl.PointSet[i] = setPoint; |
1128 |
AllControl.updateControl(); |
1129 |
((ICloudControl)AllControl).DrawingCloud(); |
1130 |
BorderUpdate(); |
1131 |
} |
1132 |
break; |
1133 |
#endregion |
1134 |
#region SymBol |
1135 |
case ControlType.Symbol: |
1136 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
1137 |
{ |
1138 |
AllControl.PointSet[i] = setPoint; |
1139 |
var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count(); |
1140 |
var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count(); |
1141 |
var NextP = (i + 1) % AllControl.PointSet.Count(); |
1142 |
|
1143 |
var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]); |
1144 |
|
1145 |
var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]); |
1146 |
var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, |
1147 |
AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y); |
1148 |
AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet |
1149 |
[ReverseP].Y |
1150 |
+ PreviousV.Y * l); |
1151 |
|
1152 |
var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]); |
1153 |
l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet |
1154 |
[i].Y - AllControl.PointSet[ReverseP].Y); |
1155 |
AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y + |
1156 |
NextV.Y * l); |
1157 |
AllControl.updateControl(); |
1158 |
DynamicThumbUpdate(control); |
1159 |
BorderUpdate(); |
1160 |
} |
1161 |
break; |
1162 |
case ControlType.Stamp: |
1163 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
1164 |
{ |
1165 |
AllControl.PointSet[i] = setPoint; |
1166 |
var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count(); |
1167 |
var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count(); |
1168 |
var NextP = (i + 1) % AllControl.PointSet.Count(); |
1169 |
|
1170 |
var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]); |
1171 |
|
1172 |
var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]); |
1173 |
var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, |
1174 |
AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y); |
1175 |
AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet |
1176 |
[ReverseP].Y |
1177 |
+ PreviousV.Y * l); |
1178 |
|
1179 |
var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]); |
1180 |
l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet |
1181 |
[i].Y - AllControl.PointSet[ReverseP].Y); |
1182 |
AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y + |
1183 |
NextV.Y * l); |
1184 |
AllControl.updateControl(); |
1185 |
DynamicThumbUpdate(control); |
1186 |
BorderUpdate(); |
1187 |
} |
1188 |
break; |
1189 |
case ControlType.Date: |
1190 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
1191 |
{ |
1192 |
AllControl.PointSet[i] = setPoint; |
1193 |
var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count(); |
1194 |
var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count(); |
1195 |
var NextP = (i + 1) % AllControl.PointSet.Count(); |
1196 |
|
1197 |
var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]); |
1198 |
|
1199 |
var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]); |
1200 |
var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, |
1201 |
AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y); |
1202 |
AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet |
1203 |
[ReverseP].Y |
1204 |
+ PreviousV.Y * l); |
1205 |
|
1206 |
var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]); |
1207 |
l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet |
1208 |
[i].Y - AllControl.PointSet[ReverseP].Y); |
1209 |
AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y + |
1210 |
NextV.Y * l); |
1211 |
AllControl.updateControl(); |
1212 |
DynamicThumbUpdate(control); |
1213 |
BorderUpdate(); |
1214 |
} |
1215 |
break; |
1216 |
//case MarkupType.Viewbox: |
1217 |
// if (nearPoint.Equals(AllControl.PointSet[i])) |
1218 |
// { |
1219 |
// AllControl.PointSet[i] = setPoint; |
1220 |
// var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count(); |
1221 |
// var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count(); |
1222 |
// var NextP = (i + 1) % AllControl.PointSet.Count(); |
1223 |
|
1224 |
// var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]); |
1225 |
|
1226 |
// var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]); |
1227 |
// var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, |
1228 |
// AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y); |
1229 |
// AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet |
1230 |
// [ReverseP].Y |
1231 |
// + PreviousV.Y * l); |
1232 |
|
1233 |
// var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]); |
1234 |
// l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet |
1235 |
// [i].Y - AllControl.PointSet[ReverseP].Y); |
1236 |
// AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y + |
1237 |
// NextV.Y * l); |
1238 |
// AllControl.updateControl(); |
1239 |
// DynamicThumbUpdate(control); |
1240 |
// BorderUpdate(); |
1241 |
// } |
1242 |
// break; |
1243 |
#endregion |
1244 |
#region Ink |
1245 |
case ControlType.Ink: |
1246 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
1247 |
{ |
1248 |
AllControl.PointSet[i] = setPoint; |
1249 |
AllControl.updateControl(); |
1250 |
BorderUpdate(); |
1251 |
} |
1252 |
break; |
1253 |
#endregion |
1254 |
default: |
1255 |
break; |
1256 |
} |
1257 |
} |
1258 |
} |
1259 |
//} |
1260 |
} |
1261 |
|
1262 |
|
1263 |
|
1264 |
#endregion |
1265 |
#region 이벤트 |
1266 |
|
1267 |
void tm_DragCompleted(object sender, DragCompletedEventArgs e) |
1268 |
{ |
1269 |
this.isDragging = false; |
1270 |
DraggerThumb = null; |
1271 |
|
1272 |
Undo_Event(); |
1273 |
} |
1274 |
|
1275 |
void tm_DragStarted(object sender, DragStartedEventArgs e) |
1276 |
{ |
1277 |
this.DraggerThumb = sender as Thumb; |
1278 |
this.isDragging = true; |
1279 |
|
1280 |
if (ViewerDataModel.Instance.UndoDataList == null) |
1281 |
{ |
1282 |
return; |
1283 |
} |
1284 |
|
1285 |
if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Event == Event_Type.Thumb) |
1286 |
{ |
1287 |
return; |
1288 |
} |
1289 |
|
1290 |
if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List != null) |
1291 |
{ |
1292 |
if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.Count > 0) |
1293 |
{ |
1294 |
if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.FirstOrDefault().PointSet != null) |
1295 |
{ |
1296 |
return; |
1297 |
} |
1298 |
} |
1299 |
} |
1300 |
|
1301 |
Undo_Event(); |
1302 |
} |
1303 |
|
1304 |
private void rotate_MouseMove(object sender, MouseEventArgs e) |
1305 |
{ |
1306 |
|
1307 |
//double LastRotateHorizontalValue = 0; |
1308 |
//double LastRotateVerticalValue = 0; |
1309 |
//double LastWidthValue = 0; |
1310 |
//double SetWidth = 0; |
1311 |
|
1312 |
|
1313 |
if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "TextControl") |
1314 |
{ |
1315 |
if (LastRotateVerticalValue < e.GetPosition(this).X) |
1316 |
IsTextAngle = true; |
1317 |
else |
1318 |
IsTextAngle = false; |
1319 |
|
1320 |
System.Diagnostics.Debug.WriteLine("X축 : " + e.GetPosition(this).X + "LastRotateVerticalValue : " + LastRotateVerticalValue); |
1321 |
LastRotateVerticalValue = e.GetPosition(this).X; |
1322 |
} |
1323 |
else |
1324 |
{ |
1325 |
System.Diagnostics.Debug.WriteLine("e.GetPosition(this).X : " + e.GetPosition(this).X); |
1326 |
System.Diagnostics.Debug.WriteLine("LastRotateHorizontalValue: " + LastRotateHorizontalValue); |
1327 |
|
1328 |
if (e.GetPosition(this).X > LastRotateHorizontalValue) |
1329 |
{ |
1330 |
RotateFlag = true; |
1331 |
} |
1332 |
else |
1333 |
{ |
1334 |
RotateFlag = false; |
1335 |
} |
1336 |
LastRotateHorizontalValue = e.GetPosition(this).X; |
1337 |
} |
1338 |
} |
1339 |
|
1340 |
private void DragThumb_DragDelta(object sender, DragDeltaEventArgs e) |
1341 |
{ |
1342 |
DragThumb.Cursor = Cursors.SizeAll; |
1343 |
Thumb thumb = sender as Thumb; |
1344 |
MoveAdorner(e); |
1345 |
} |
1346 |
|
1347 |
public void MoveAdorner(DragDeltaEventArgs e) |
1348 |
{ |
1349 |
Point dragDelta = new Point(e.HorizontalChange, e.VerticalChange); |
1350 |
|
1351 |
Dispatcher.BeginInvoke((Action)(() => |
1352 |
{ |
1353 |
foreach (var item in MemberSet) |
1354 |
{ |
1355 |
#region 라인 & 아크 |
1356 |
if (item.Drawingtype == ControlType.SingleLine || item.Drawingtype == ControlType.ArcLine || item.Drawingtype == ControlType.ArrowMultiLine) |
1357 |
{ |
1358 |
DynamicThumbUpdate(e, item); |
1359 |
} |
1360 |
#endregion |
1361 |
#region 지시선화살표 |
1362 |
if (item.Drawingtype == ControlType.ArrowTextControl) |
1363 |
{ |
1364 |
DynamicThumbUpdate(e, item); |
1365 |
} |
1366 |
#endregion |
1367 |
//강인구 추가 Sign, check, Stamp |
1368 |
#region 써클 |
1369 |
if (item.Drawingtype == ControlType.Circle || item.Drawingtype == ControlType.Sign || item.Drawingtype == ControlType.Symbol || item.Drawingtype == ControlType.Stamp) |
1370 |
{ |
1371 |
DynamicThumbUpdate(e, item); |
1372 |
} |
1373 |
#endregion |
1374 |
#region 쉐이프 |
1375 |
if (item.Drawingtype == ControlType.Rectangle || item.Drawingtype == ControlType.ImgControl || item.Drawingtype == ControlType.RectCloud || item.Drawingtype == ControlType.Triangle) |
1376 |
{ |
1377 |
DynamicThumbUpdate(e, item); |
1378 |
} |
1379 |
#endregion |
1380 |
#region 텍스트 |
1381 |
if (item.Drawingtype == ControlType.TextControl) |
1382 |
{ |
1383 |
//Canvas.SetLeft((item.DrawingData as TextControl), Canvas.GetLeft((item.DrawingData as TextControl)) + e.HorizontalChange / 5); |
1384 |
//Canvas.SetTop((item.DrawingData as TextControl), Canvas.GetTop((item.DrawingData as TextControl)) + e.VerticalChange / 5); |
1385 |
//(item.DrawingData as TextControl).StartPoint = |
1386 |
//new Point(Canvas.GetLeft((item.DrawingData as TextControl)) + e.HorizontalChange / 5, Canvas.GetTop((item.DrawingData as TextControl)) + e.VerticalChange / 5); |
1387 |
//(item.DrawingData as TextControl).EndPoint = (item.DrawingData as TextControl).StartPoint; |
1388 |
|
1389 |
Point dx = MathSet.RotateAbout(new Point(0, 0), new Point(e.HorizontalChange, e.VerticalChange), trRotate.Angle); |
1390 |
Canvas.SetLeft((item.DrawingData as TextControl), Canvas.GetLeft((item.DrawingData as TextControl)) + dx.X); |
1391 |
Canvas.SetTop((item.DrawingData as TextControl), Canvas.GetTop((item.DrawingData as TextControl)) + dx.Y); |
1392 |
(item.DrawingData as TextControl).StartPoint = |
1393 |
new Point(Canvas.GetLeft((item.DrawingData as TextControl)) + e.HorizontalChange / 5, Canvas.GetTop((item.DrawingData as TextControl)) + e.VerticalChange / 5); |
1394 |
(item.DrawingData as TextControl).EndPoint = (item.DrawingData as TextControl).StartPoint; |
1395 |
} |
1396 |
#endregion |
1397 |
#region 날짜 |
1398 |
if (item.Drawingtype == ControlType.Date) |
1399 |
{ |
1400 |
DynamicThumbUpdate(e, item); |
1401 |
//Canvas.SetLeft((item.DrawingData as DateControl), Canvas.GetLeft((item.DrawingData as DateControl)) + e.HorizontalChange); |
1402 |
//Canvas.SetTop((item.DrawingData as DateControl), Canvas.GetTop((item.DrawingData as DateControl)) + e.VerticalChange); |
1403 |
//(item.DrawingData as DateControl).StartPoint = new Point(Canvas.GetLeft((item.DrawingData as DateControl)) |
1404 |
// + e.HorizontalChange, Canvas.GetTop((item.DrawingData as DateControl)) + e.VerticalChange); |
1405 |
//(item.DrawingData as DateControl).EndPoint = (item.DrawingData as DateControl).StartPoint; |
1406 |
//MessageBox.Show("잠시 정확도를 위해 막아두었습니다!"); |
1407 |
|
1408 |
|
1409 |
} |
1410 |
#endregion |
1411 |
#region 클라우드 |
1412 |
if (item.Drawingtype == ControlType.PolygonCloud) |
1413 |
{ |
1414 |
ICloudControl temp = ((ICloudControl)item.DrawingData); |
1415 |
DynamicThumbUpdate(e, item); |
1416 |
temp.DrawingCloud(); |
1417 |
} |
1418 |
#endregion |
1419 |
//#region 심볼 |
1420 |
//if (item.Drawingtype == MarkupType.Viewbox) |
1421 |
//{ |
1422 |
// DynamicThumbUpdate(e, item); |
1423 |
// BorderUpdate(); |
1424 |
//} |
1425 |
//#endregion |
1426 |
//#region 폴리곤확장 |
1427 |
//if (item.Drawingtype == MarkupType.PolygonEx) |
1428 |
//{ |
1429 |
// Point px = new Point(e.HorizontalChange, e.VerticalChange); |
1430 |
// List<StylusPointSet> StylusPointSet = (item.DrawingData as PolyControl).PointC; |
1431 |
// for (int i = 0; i < StylusPointSet.Count; i++) |
1432 |
// { |
1433 |
// List<Point> lstPoint = StylusPointSet[i].pointSet; |
1434 |
// for (int j = 0; j < lstPoint.Count; j++) |
1435 |
// { |
1436 |
// lstPoint[j] = new Point(lstPoint[j].X + px.X, lstPoint[j].Y + px.Y); |
1437 |
// } |
1438 |
// } |
1439 |
|
1440 |
// for (int i = 0; i < item.ThumbList.Count; i++) |
1441 |
// { |
1442 |
// Canvas.SetLeft(item.ThumbList[i], Canvas.GetLeft(item.ThumbList[i]) + px.X); |
1443 |
// Canvas.SetTop(item.ThumbList[i], Canvas.GetTop(item.ThumbList[i]) + px.Y); |
1444 |
// } |
1445 |
// (item.DrawingData as IPath).updateControl(); |
1446 |
// BorderUpdate(); |
1447 |
// //for (int i = 0; i < (item.DrawingData as PolyControl).PointC.Count(); i++) |
1448 |
// //{ |
1449 |
// // //(item.DrawingData as PolyControl).PointC[i] = MathSet.RotateAbout(CenterPoint, (item.DrawingData as PolyControl).PointC[i]., dDeltaAngle); |
1450 |
// // for (int j = 0; j < (item.DrawingData as PolyControl).PointC[i].pointSet.Count; j++) |
1451 |
// // { |
1452 |
// // (item.DrawingData as PolyControl).PointC[i].pointSet[j] = new Point { X = (item.DrawingData as PolyControl).PointC[i].pointSet[j].X + dx.X, Y = (item.DrawingData as PolyControl).PointC[i].pointSet[j].Y + dx.Y }; |
1453 |
// // Canvas.SetLeft(item.ThumbList[i], Canvas.GetLeft(item.ThumbList[i]) + dx.X); |
1454 |
// // Canvas.SetTop(item.ThumbList[i], Canvas.GetTop(item.ThumbList[i]) + dx.Y); |
1455 |
// // } |
1456 |
// //} |
1457 |
// //(item.DrawingData as IPath).updateControl(); |
1458 |
//} |
1459 |
//#endregion |
1460 |
#region 폴리곤 |
1461 |
if (item.Drawingtype == ControlType.PolygonControl) |
1462 |
{ |
1463 |
DynamicThumbUpdate(e, item); |
1464 |
BorderUpdate(); |
1465 |
} |
1466 |
#endregion |
1467 |
#region 잉크 |
1468 |
if (item.Drawingtype == ControlType.Ink) |
1469 |
{ |
1470 |
//DynamicThumbUpdate(e, item); |
1471 |
//BorderUpdate(); |
1472 |
|
1473 |
Point px = new Point(e.HorizontalChange, e.VerticalChange); |
1474 |
List<StylusPointSet> StylusPointSet = (item.DrawingData as InkControl).PointC; |
1475 |
for (int i = 0; i < StylusPointSet.Count; i++) |
1476 |
{ |
1477 |
List<Point> lstPoint = StylusPointSet[i].pointSet; |
1478 |
for (int j = 0; j < lstPoint.Count; j++) |
1479 |
{ |
1480 |
lstPoint[j] = new Point(lstPoint[j].X + px.X, lstPoint[j].Y + px.Y); |
1481 |
} |
1482 |
} |
1483 |
|
1484 |
for (int i = 0; i < item.ThumbList.Count; i++) |
1485 |
{ |
1486 |
Canvas.SetLeft(item.ThumbList[i], Canvas.GetLeft(item.ThumbList[i]) + px.X); |
1487 |
Canvas.SetTop(item.ThumbList[i], Canvas.GetTop(item.ThumbList[i]) + px.Y); |
1488 |
} |
1489 |
(item.DrawingData as IPath).updateControl(); |
1490 |
BorderUpdate(); |
1491 |
|
1492 |
} |
1493 |
#endregion |
1494 |
BorderUpdate(); |
1495 |
} |
1496 |
})); |
1497 |
} |
1498 |
|
1499 |
public void DynamicThumbUpdate(DragDeltaEventArgs e, AdornerMember item) |
1500 |
{ |
1501 |
var AllControl = item.DrawingData as IPath; |
1502 |
List<Point> point = AllControl.PointSet; |
1503 |
//for (int i = 0; i < AllControl.PointSet.Count(); i++) |
1504 |
for (int i = 0; i < item.ThumbList.Count(); i++) |
1505 |
{ |
1506 |
|
1507 |
if (item.DrawingData.GetType().Name == "ArrowTextControl") |
1508 |
{ |
1509 |
Point dx = MathSet.RotateAbout(new Point(0, 0), new Point(e.HorizontalChange, e.VerticalChange), trRotate.Angle); |
1510 |
AllControl.PointSet[i] = new Point { X = point[i].X + dx.X, Y = point[i].Y + dx.Y }; |
1511 |
AllControl.updateControl(); |
1512 |
Canvas.SetLeft(item.ThumbList[i], Canvas.GetLeft(item.ThumbList[i]) + dx.X); |
1513 |
Canvas.SetTop(item.ThumbList[i], Canvas.GetTop(item.ThumbList[i]) + dx.Y); |
1514 |
|
1515 |
Canvas.SetLeft(item.ThumbList.Last(), Canvas.GetLeft((item.DrawingData as ArrowTextControl).Base_TextBox)); |
1516 |
Canvas.SetTop(item.ThumbList.Last(), Canvas.GetTop((item.DrawingData as ArrowTextControl).Base_TextBox)); |
1517 |
} |
1518 |
else |
1519 |
{ |
1520 |
Point dx = MathSet.RotateAbout(new Point(0, 0), new Point(e.HorizontalChange, e.VerticalChange), trRotate.Angle); |
1521 |
AllControl.PointSet[i] = new Point { X = point[i].X + dx.X, Y = point[i].Y + dx.Y }; |
1522 |
AllControl.updateControl(); |
1523 |
Canvas.SetLeft(item.ThumbList[i], Canvas.GetLeft(item.ThumbList[i]) + dx.X); |
1524 |
Canvas.SetTop(item.ThumbList[i], Canvas.GetTop(item.ThumbList[i]) + dx.Y); |
1525 |
} |
1526 |
} |
1527 |
} |
1528 |
|
1529 |
public void DynamicThumbUpdate(AdornerMember item) |
1530 |
{ |
1531 |
var AllControl = item.DrawingData as IPath; |
1532 |
List<Point> point = AllControl.PointSet; |
1533 |
|
1534 |
//if (item.DrawingData as ArrowTextControl !=null) |
1535 |
//{ |
1536 |
// for (int i = 0; i < AllControl.PointSet.Count(); i++) |
1537 |
// { |
1538 |
// if ((MemberSet.First() as AdornerMember).ThumbList[1]d) |
1539 |
// { |
1540 |
|
1541 |
// } |
1542 |
// } |
1543 |
// List<Point> ps = new List<Point>(); |
1544 |
// var temp = (MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl; |
1545 |
// ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단 |
1546 |
// ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단 |
1547 |
// ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단 |
1548 |
// ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //우단 |
1549 |
|
1550 |
// var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
1551 |
// var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP); |
1552 |
// Canvas.SetLeft((MemberSet.First() as AdornerMember).ThumbList[1], tempP.X); |
1553 |
// Canvas.SetTop((MemberSet.First() as AdornerMember).ThumbList[1], tempP.Y); |
1554 |
//} |
1555 |
//else |
1556 |
//{ |
1557 |
for (int i = 0; i < AllControl.PointSet.Count(); i++) |
1558 |
{ |
1559 |
|
1560 |
Canvas.SetLeft(item.ThumbList[i], AllControl.PointSet[i].X); |
1561 |
Canvas.SetTop(item.ThumbList[i], AllControl.PointSet[i].Y); |
1562 |
} |
1563 |
|
1564 |
|
1565 |
if (item.DrawingData as ArrowTextControl != null) |
1566 |
{ |
1567 |
if (!(item.DrawingData as ArrowTextControl).isTrans) //trans가 True인경우 |
1568 |
{ |
1569 |
List<Point> ps = new List<Point>(); |
1570 |
//강인구 수정 |
1571 |
//var temp = (MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl; |
1572 |
var temp = item.DrawingData as ArrowTextControl; |
1573 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단 |
1574 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단 |
1575 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단 |
1576 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //우단 |
1577 |
|
1578 |
|
1579 |
|
1580 |
if (temp.isFixed) |
1581 |
{ |
1582 |
var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
1583 |
var testP = endP; |
1584 |
if (ps[0] == endP) //상단 |
1585 |
{ |
1586 |
testP = new Point(endP.X, endP.Y - 50); |
1587 |
System.Diagnostics.Debug.WriteLine("상단"); |
1588 |
} |
1589 |
else if (ps[1] == endP) //하단 |
1590 |
{ |
1591 |
testP = new Point(endP.X, endP.Y + 50); |
1592 |
System.Diagnostics.Debug.WriteLine("하단"); |
1593 |
} |
1594 |
else if (ps[2] == endP) //좌단 |
1595 |
{ |
1596 |
testP = new Point(endP.X - 50, endP.Y); |
1597 |
System.Diagnostics.Debug.WriteLine("좌단"); |
1598 |
} |
1599 |
else if (ps[3] == endP) //우단 |
1600 |
{ |
1601 |
testP = new Point(endP.X + 50, endP.Y); |
1602 |
System.Diagnostics.Debug.WriteLine("우단"); |
1603 |
} |
1604 |
Canvas.SetLeft((MemberSet.First() as AdornerMember).ThumbList[1], testP.X); |
1605 |
Canvas.SetTop((MemberSet.First() as AdornerMember).ThumbList[1], testP.Y); |
1606 |
} |
1607 |
else |
1608 |
{ |
1609 |
var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
1610 |
var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP); |
1611 |
Canvas.SetLeft((MemberSet.First() as AdornerMember).ThumbList[1], tempP.X); |
1612 |
Canvas.SetTop((MemberSet.First() as AdornerMember).ThumbList[1], tempP.Y); |
1613 |
} |
1614 |
} |
1615 |
} |
1616 |
//} |
1617 |
} |
1618 |
|
1619 |
public void Set_Rotate() |
1620 |
{ |
1621 |
|
1622 |
double dDeltaAngle = 0; |
1623 |
List<Point> AllPointSet = new List<Point>(); |
1624 |
Point CenterPoint = new Point(); |
1625 |
|
1626 |
|
1627 |
if (AngleValue >= 360) |
1628 |
{ |
1629 |
AngleValue -= 360; |
1630 |
} |
1631 |
else if (AngleValue <= -360) |
1632 |
{ |
1633 |
AngleValue += 360; |
1634 |
} |
1635 |
|
1636 |
#region 센터 포인트 구하기 (그룹핑) |
1637 |
foreach (var item in MemberSet) |
1638 |
{ |
1639 |
if (item.DrawingData.GetType().Name == "TextControl") |
1640 |
{ |
1641 |
} |
1642 |
else |
1643 |
{ |
1644 |
foreach (Point itemP in (item.DrawingData as IPath).PointSet) |
1645 |
{ |
1646 |
AllPointSet.Add(itemP); |
1647 |
} |
1648 |
} |
1649 |
} |
1650 |
#endregion |
1651 |
|
1652 |
CenterPoint = MathSet.FindCentroid(AllPointSet); |
1653 |
|
1654 |
Dispatcher.BeginInvoke((Action)(() => |
1655 |
{ |
1656 |
foreach (var item in MemberSet) |
1657 |
{ |
1658 |
foreach (var thumb in item.ThumbList) |
1659 |
{ |
1660 |
double x = Canvas.GetLeft(thumb); |
1661 |
double y = Canvas.GetTop(thumb); |
1662 |
|
1663 |
Point value = MathSet.RotateAbout(CenterPoint, new Point(x, y), dDeltaAngle); |
1664 |
Canvas.SetLeft(thumb, value.X); |
1665 |
Canvas.SetTop(thumb, value.Y); |
1666 |
|
1667 |
if (item.DrawingData.GetType().Name == "ArrowTextControl" && thumb == item.ThumbList.Last()) |
1668 |
{ |
1669 |
|
1670 |
Canvas.SetLeft(thumb, Canvas.GetLeft((item.DrawingData as ArrowTextControl).Base_TextBox)); |
1671 |
Canvas.SetTop(thumb, Canvas.GetTop((item.DrawingData as ArrowTextControl).Base_TextBox)); |
1672 |
if (!(item.DrawingData as ArrowTextControl).isTrans) |
1673 |
{ |
1674 |
List<Point> ps = new List<Point>(); |
1675 |
var temp = (MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl; |
1676 |
switch (Math.Abs(temp.Angle).ToString()) |
1677 |
{ |
1678 |
case "90": |
1679 |
{ |
1680 |
ps.Clear(); |
1681 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽 |
1682 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); // 위 중간 |
1683 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); // 위 오른쪽 |
1684 |
|
1685 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 중간 |
1686 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 하단 |
1687 |
|
1688 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); //중간 하단 |
1689 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 하단 |
1690 |
|
1691 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 중간 |
1692 |
} |
1693 |
break; |
1694 |
case "270": |
1695 |
{ |
1696 |
ps.Clear(); |
1697 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽 |
1698 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); // 위 중간 |
1699 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); // 위 오른쪽 |
1700 |
|
1701 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 중간 |
1702 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 하단 |
1703 |
|
1704 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); //중간 하단 |
1705 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 하단 |
1706 |
|
1707 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 중간 |
1708 |
} |
1709 |
break; |
1710 |
default: |
1711 |
{ |
1712 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단 |
1713 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단 |
1714 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단 |
1715 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //우단 |
1716 |
} |
1717 |
break; |
1718 |
} |
1719 |
|
1720 |
var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
1721 |
var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP); |
1722 |
Canvas.SetLeft((MemberSet.First() as AdornerMember).ThumbList[1], tempP.X); |
1723 |
Canvas.SetTop((MemberSet.First() as AdornerMember).ThumbList[1], tempP.Y); |
1724 |
} |
1725 |
} |
1726 |
} |
1727 |
|
1728 |
for (int i = 0; i < (item.DrawingData as IPath).PointSet.Count(); i++) |
1729 |
{ |
1730 |
(item.DrawingData as IPath).PointSet[i] = MathSet.RotateAbout(CenterPoint, (item.DrawingData as IPath).PointSet[i], dDeltaAngle); |
1731 |
} |
1732 |
} |
1733 |
#region 컨트롤 업데이트 |
1734 |
foreach (var item in MemberSet) |
1735 |
{ |
1736 |
switch (item.Drawingtype) |
1737 |
{ |
1738 |
case ControlType.TextControl: |
1739 |
((TextControl)item.DrawingData).Angle = AngleValue; |
1740 |
//trRotate.Angle = AngleValue; |
1741 |
|
1742 |
RectangleGeometry Data = new RectangleGeometry |
1743 |
{ |
1744 |
Rect = new Rect() |
1745 |
{ |
1746 |
X = Canvas.GetLeft((item.DrawingData as TextControl)), |
1747 |
Y = Canvas.GetTop((item.DrawingData as TextControl)), |
1748 |
Width = (item.DrawingData as TextControl).Base_TextBlock.ActualWidth / 2, |
1749 |
Height = (item.DrawingData as TextControl).Base_TextBlock.ActualHeight / 2, |
1750 |
} |
1751 |
}; |
1752 |
//if ((firstCondition as TextControl).Angle != 0) |
1753 |
//{ |
1754 |
Point endPointV = new Point(Data.Bounds.Right, Data.Bounds.Bottom); |
1755 |
Point middle = MathSet.getMiddlePoint((item.DrawingData as TextControl).StartPoint, endPointV); |
1756 |
|
1757 |
|
1758 |
//AdornerBorder.RenderTransformOrigin = new Point(1, 1); |
1759 |
//AdornerBorder.RenderTransform = new RotateTransform() |
1760 |
//{ |
1761 |
// Angle = (member as TextControl).Angle * -1, |
1762 |
// CenterX = middle.X + ((member as TextControl) as FrameworkElement).ActualWidth /2, |
1763 |
// CenterY = middle.Y + ((member as TextControl) as FrameworkElement).ActualHeight /2, |
1764 |
//}; |
1765 |
|
1766 |
DragThumb.RenderTransformOrigin = new Point(0.0, 0.0); |
1767 |
DragThumb.RenderTransform = new RotateTransform() |
1768 |
{ |
1769 |
Angle = (item.DrawingData as TextControl).Angle, |
1770 |
//CenterX = middle.X, |
1771 |
//CenterY = middle.Y, |
1772 |
}; |
1773 |
|
1774 |
AdornerBorder.RenderTransformOrigin = new Point(0.0, 0.0); |
1775 |
AdornerBorder.RenderTransform = new RotateTransform() |
1776 |
{ |
1777 |
Angle = (item.DrawingData as TextControl).Angle, |
1778 |
//CenterX = middle.X, |
1779 |
//CenterY = middle.Y, |
1780 |
}; |
1781 |
|
1782 |
(item.DrawingData as TextControl).Base_Grid.RenderTransform = new RotateTransform() |
1783 |
{ |
1784 |
Angle = (item.DrawingData as TextControl).Angle, |
1785 |
}; |
1786 |
|
1787 |
BorderUpdate(); |
1788 |
break; |
1789 |
//case ControlType.Viewbox: |
1790 |
// (item.DrawingData as IPath).updateControl(); |
1791 |
// ((IViewBox)item.DrawingData).Angle = AngleValue; |
1792 |
// BorderUpdate(); |
1793 |
// break; |
1794 |
case ControlType.Date: |
1795 |
//강인구 추가(2018.02.22) |
1796 |
((DateControl)item.DrawingData).Angle = AngleValue; |
1797 |
(item.DrawingData as IPath).updateControl(); |
1798 |
BorderUpdate(); |
1799 |
//MessageBox.Show("잠시 정확도를 위해 막아두었습니다!"); |
1800 |
break; |
1801 |
case ControlType.ArrowMultiLine: |
1802 |
case ControlType.ArcLine: |
1803 |
case ControlType.SingleLine: |
1804 |
case ControlType.Triangle: |
1805 |
(item.DrawingData as IPath).updateControl(); |
1806 |
BorderUpdate(); |
1807 |
break; |
1808 |
case ControlType.ArrowTextControl: |
1809 |
(item.DrawingData as IPath).updateControl(); |
1810 |
BorderUpdate(); |
1811 |
break; |
1812 |
case ControlType.RectCloud: |
1813 |
((RectCloudControl)item.DrawingData).Angle = AngleValue; |
1814 |
(item.DrawingData as IPath).updateControl(); |
1815 |
BorderUpdate(); |
1816 |
break; |
1817 |
case ControlType.Rectangle: |
1818 |
((RectangleControl)item.DrawingData).Angle = AngleValue; |
1819 |
(item.DrawingData as IPath).updateControl(); |
1820 |
BorderUpdate(); |
1821 |
break; |
1822 |
case ControlType.ImgControl: |
1823 |
((ImgControl)item.DrawingData).Angle = AngleValue; |
1824 |
(item.DrawingData as IPath).updateControl(); |
1825 |
BorderUpdate(); |
1826 |
break; |
1827 |
//강인구 추가 |
1828 |
case ControlType.Sign: |
1829 |
((SignControl)item.DrawingData).Angle = AngleValue; |
1830 |
(item.DrawingData as IPath).updateControl(); |
1831 |
BorderUpdate(); |
1832 |
break; |
1833 |
//강인구 추가 |
1834 |
case ControlType.Symbol: |
1835 |
((SymControl)item.DrawingData).Angle = AngleValue; |
1836 |
(item.DrawingData as IPath).updateControl(); |
1837 |
BorderUpdate(); |
1838 |
break; |
1839 |
//강인구 추가 |
1840 |
case ControlType.Stamp: |
1841 |
((SymControlN)item.DrawingData).Angle = AngleValue; |
1842 |
(item.DrawingData as IPath).updateControl(); |
1843 |
BorderUpdate(); |
1844 |
break; |
1845 |
case ControlType.PolygonControl: |
1846 |
//((IShapeControl)AllControl).Angle = AngleValue; |
1847 |
(item.DrawingData as IPath).updateControl(); |
1848 |
BorderUpdate(); |
1849 |
break; |
1850 |
case ControlType.PolygonCloud: |
1851 |
//((IShapeControl)AllControl).Angle = AngleValue; |
1852 |
((ICloudControl)item.DrawingData).DrawingCloud(); |
1853 |
(item.DrawingData as IPath).updateControl(); |
1854 |
BorderUpdate(); |
1855 |
break; |
1856 |
case ControlType.Circle: |
1857 |
((IShapeControl)item.DrawingData).Angle = AngleValue; |
1858 |
(item.DrawingData as IPath).updateControl(); |
1859 |
((CircleControl)item.DrawingData).SetCenterXY(); |
1860 |
BorderUpdate(); |
1861 |
break; |
1862 |
case ControlType.Ink: |
1863 |
//((IShapeControl)AllControl).Angle = AngleValue; |
1864 |
(item.DrawingData as IPath).updateControl(); |
1865 |
BorderUpdate(); |
1866 |
break; |
1867 |
default: |
1868 |
break; |
1869 |
} |
1870 |
} |
1871 |
#endregion |
1872 |
})); |
1873 |
//BorderUpdate(); |
1874 |
} |
1875 |
|
1876 |
private void resize_MouseMove(object sender, MouseEventArgs e) |
1877 |
{ |
1878 |
reSizePoint = e.GetPosition(this); |
1879 |
//Thumb thumb = sender as Thumb; |
1880 |
//if (this.isDragging && MemberSet.Count <= 1 && DraggerThumb == thumb) |
1881 |
////if (thumb.IsDragging && MemberSet.Count <= 1 && DraggerThumb == thumb) |
1882 |
////if (DraggerThumb == thumb) |
1883 |
//{ |
1884 |
// Point setPoint = e.GetPosition(this); |
1885 |
// Canvas.SetLeft(thumb, setPoint.X); |
1886 |
// Canvas.SetTop(thumb, setPoint.Y); |
1887 |
// AdornerMember control = (from userThumb in MemberSet |
1888 |
// where userThumb.ThumbList.Contains(thumb) |
1889 |
// select userThumb).FirstOrDefault(); |
1890 |
// Point nearPoint = new Point(0, 0); |
1891 |
// IPath AllControl = control.DrawingData as IPath; |
1892 |
// if (ControlType.TextControl != control.Drawingtype) |
1893 |
// { |
1894 |
|
1895 |
// var temp = (MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl; |
1896 |
// List<Point> ps = new List<Point>(); |
1897 |
|
1898 |
// nearPoint = MathSet.getNearPoint((control.DrawingData as IPath).PointSet, setPoint); |
1899 |
// //switch (Math.Abs(temp.Angle).ToString()) |
1900 |
// //{ |
1901 |
|
1902 |
// // case "90": |
1903 |
// // { |
1904 |
// // nearPoint = MathSet.getNearPoint((control.DrawingData as IPath).PointSet, setPoint); |
1905 |
// // } |
1906 |
// // break; |
1907 |
// // case "270": |
1908 |
// // { |
1909 |
// // nearPoint = MathSet.getNearPoint((control.DrawingData as IPath).PointSet, setPoint); |
1910 |
// // } |
1911 |
// // break; |
1912 |
// // default: |
1913 |
// // { |
1914 |
// // nearPoint = MathSet.getNearPoint((control.DrawingData as IPath).PointSet, setPoint); |
1915 |
// // } |
1916 |
// // break; |
1917 |
// //} |
1918 |
|
1919 |
// } |
1920 |
// for (int i = 0; i < (control.DrawingData as IPath).PointSet.Count; i++) |
1921 |
// { |
1922 |
// switch (control.Drawingtype) |
1923 |
// { |
1924 |
// #region Arc + Line |
1925 |
// case ControlType.ArcLine: |
1926 |
// case ControlType.SingleLine: |
1927 |
// if (nearPoint.Equals(AllControl.PointSet[i])) |
1928 |
// { |
1929 |
// AllControl.PointSet[i] = setPoint; |
1930 |
// AllControl.updateControl(); |
1931 |
// DynamicThumbUpdate(control); |
1932 |
// BorderUpdate(); |
1933 |
|
1934 |
// //if (control.DrawingData.GetType().Name == "ArrowTextControl") |
1935 |
// //{ |
1936 |
// // Thumb tm = control.ThumbList.Last(); |
1937 |
// // //Canvas.SetLeft(tm, (AllControl.EndPoint.X - tm.Width / 2)); |
1938 |
// // //Canvas.SetTop(tm, (AllControl.EndPoint.Y - tm.Height / 2)); |
1939 |
// // Canvas.SetLeft(tm, (AllControl.EndPoint.X - tm.Width)); |
1940 |
// // Canvas.SetTop(tm, (AllControl.EndPoint.Y - tm.Height)); |
1941 |
// //} |
1942 |
// } |
1943 |
// break; |
1944 |
// #endregion |
1945 |
// #region Shape |
1946 |
// case ControlType.Rectangle: |
1947 |
// if (nearPoint.Equals(AllControl.PointSet[i])) |
1948 |
// { |
1949 |
// AllControl.PointSet[i] = setPoint; |
1950 |
// var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count(); |
1951 |
// var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count(); |
1952 |
// var NextP = (i + 1) % AllControl.PointSet.Count(); |
1953 |
|
1954 |
// var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]); |
1955 |
|
1956 |
// var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]); |
1957 |
// var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, |
1958 |
// AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y); |
1959 |
// AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet |
1960 |
// [ReverseP].Y |
1961 |
// + PreviousV.Y * l); |
1962 |
|
1963 |
// var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]); |
1964 |
// l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet |
1965 |
// [i].Y - AllControl.PointSet[ReverseP].Y); |
1966 |
// AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y + |
1967 |
// NextV.Y * l); |
1968 |
// AllControl.updateControl(); |
1969 |
// DynamicThumbUpdate(control); |
1970 |
// BorderUpdate(); |
1971 |
// } |
1972 |
// break; |
1973 |
// #endregion |
1974 |
// #region Polygon |
1975 |
// case ControlType.PolygonControl: |
1976 |
// if (nearPoint.Equals(AllControl.PointSet[i])) |
1977 |
// { |
1978 |
// AllControl.PointSet[i] = setPoint; |
1979 |
// AllControl.updateControl(); |
1980 |
// BorderUpdate(); |
1981 |
// } |
1982 |
// break; |
1983 |
// #endregion |
1984 |
// #region Cicle |
1985 |
// case ControlType.Circle: |
1986 |
// if (nearPoint.Equals(AllControl.PointSet[i])) |
1987 |
// { |
1988 |
// AllControl.PointSet[i] = setPoint; |
1989 |
// List<Point> newPointSet = new List<Point> { }; |
1990 |
// Point middle = new Point(AllControl.PathData.Bounds.X + AllControl.PathData.Bounds.Width * 0.5, |
1991 |
// AllControl.PathData.Bounds.Y + |
1992 |
// AllControl.PathData.Bounds.Height * 0.5); |
1993 |
// foreach (Point pt in AllControl.PointSet) |
1994 |
// { |
1995 |
// newPointSet.Add(pt); |
1996 |
// } |
1997 |
// var ReverseP = (i + newPointSet.Count() / 2) % newPointSet.Count(); |
1998 |
// var PreviousP = (i + (newPointSet.Count() - 1)) % newPointSet.Count(); |
1999 |
// var NextP = (i + 1) % newPointSet.Count(); |
2000 |
// var distance = MathSet.DistanceTo(newPointSet[ReverseP], newPointSet[i]); |
2001 |
// var PreviousV = MathSet.GetNormVectorBetween(newPointSet[ReverseP], newPointSet[PreviousP]); |
2002 |
// var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, newPointSet[i].X - newPointSet[ReverseP].X, |
2003 |
// newPointSet[i].Y - newPointSet[ReverseP].Y); |
2004 |
// newPointSet[PreviousP] = new Point(newPointSet[ReverseP].X + PreviousV.X * l, newPointSet[ReverseP].Y |
2005 |
// + PreviousV.Y * l); |
2006 |
|
2007 |
// var NextV = MathSet.GetNormVectorBetween(newPointSet[ReverseP], newPointSet[NextP]); |
2008 |
// l = MathSet.DotProduct(NextV.X, NextV.Y, newPointSet[i].X - newPointSet[ReverseP].X, newPointSet[i].Y |
2009 |
// - newPointSet[ReverseP].Y); |
2010 |
// newPointSet[NextP] = new Point(newPointSet[ReverseP].X + NextV.X * l, newPointSet[ReverseP].Y + NextV.Y * l); |
2011 |
|
2012 |
// AllControl.PointSet = newPointSet; |
2013 |
// DynamicThumbUpdate(control); |
2014 |
// AllControl.updateControl(); |
2015 |
// BorderUpdate(); |
2016 |
// } |
2017 |
// break; |
2018 |
// #endregion |
2019 |
// #region ArrowText |
2020 |
// case ControlType.ArrowTextControl: |
2021 |
// if (nearPoint.Equals(AllControl.PointSet[i])) |
2022 |
// { |
2023 |
// AllControl.PointSet[i] = setPoint; |
2024 |
// AllControl.updateControl(); |
2025 |
|
2026 |
// DynamicThumbUpdate(control); |
2027 |
// BorderUpdate(); |
2028 |
|
2029 |
// //if (control.DrawingData.GetType().Name == "ArrowTextControl") |
2030 |
// //{ |
2031 |
// // Thumb tm = control.ThumbList.Last(); |
2032 |
// // //Canvas.SetLeft(tm, (AllControl.EndPoint.X - tm.Width / 2)); |
2033 |
// // //Canvas.SetTop(tm, (AllControl.EndPoint.Y - tm.Height / 2)); |
2034 |
// // Canvas.SetLeft(tm, (AllControl.EndPoint.X - tm.Width)); |
2035 |
// // Canvas.SetTop(tm, (AllControl.EndPoint.Y - tm.Height)); |
2036 |
// //} |
2037 |
// } |
2038 |
// break; |
2039 |
// #endregion |
2040 |
// #region Text |
2041 |
// case ControlType.TextControl: |
2042 |
// break; |
2043 |
// #endregion |
2044 |
// #region Image |
2045 |
// case ControlType.ImgControl: |
2046 |
// if (nearPoint.Equals(AllControl.PointSet[i])) |
2047 |
// { |
2048 |
// AllControl.PointSet[i] = setPoint; |
2049 |
// var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count(); |
2050 |
// var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count(); |
2051 |
// var NextP = (i + 1) % AllControl.PointSet.Count(); |
2052 |
|
2053 |
// var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]); |
2054 |
|
2055 |
// var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]); |
2056 |
// var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, |
2057 |
// AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y); |
2058 |
// AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet |
2059 |
// [ReverseP].Y |
2060 |
// + PreviousV.Y * l); |
2061 |
|
2062 |
// var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]); |
2063 |
// l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet |
2064 |
// [i].Y - AllControl.PointSet[ReverseP].Y); |
2065 |
// AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y + |
2066 |
// NextV.Y * l); |
2067 |
// AllControl.updateControl(); |
2068 |
// DynamicThumbUpdate(control); |
2069 |
// BorderUpdate(); |
2070 |
// } |
2071 |
// break; |
2072 |
// #endregion |
2073 |
// #region Cloud |
2074 |
// case ControlType.PolygonCloud: |
2075 |
// if (nearPoint.Equals(AllControl.PointSet[i])) |
2076 |
// { |
2077 |
// AllControl.PointSet[i] = setPoint; |
2078 |
// AllControl.updateControl(); |
2079 |
// ((ICloudControl)AllControl).DrawingCloud(); |
2080 |
// BorderUpdate(); |
2081 |
// } |
2082 |
// break; |
2083 |
// #endregion |
2084 |
// #region SymBol |
2085 |
// //case MarkupType.Viewbox: |
2086 |
// // if (nearPoint.Equals(AllControl.PointSet[i])) |
2087 |
// // { |
2088 |
// // AllControl.PointSet[i] = setPoint; |
2089 |
// // var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count(); |
2090 |
// // var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count(); |
2091 |
// // var NextP = (i + 1) % AllControl.PointSet.Count(); |
2092 |
|
2093 |
// // var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]); |
2094 |
|
2095 |
// // var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]); |
2096 |
// // var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, |
2097 |
// // AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y); |
2098 |
// // AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet |
2099 |
// // [ReverseP].Y |
2100 |
// // + PreviousV.Y * l); |
2101 |
|
2102 |
// // var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]); |
2103 |
// // l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet |
2104 |
// // [i].Y - AllControl.PointSet[ReverseP].Y); |
2105 |
// // AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y + |
2106 |
// // NextV.Y * l); |
2107 |
// // AllControl.updateControl(); |
2108 |
// // DynamicThumbUpdate(control); |
2109 |
// // BorderUpdate(); |
2110 |
// // } |
2111 |
// // break; |
2112 |
// #endregion |
2113 |
// default: |
2114 |
// break; |
2115 |
// } |
2116 |
// } |
2117 |
//} |
2118 |
} |
2119 |
|
2120 |
/// <summary> |
2121 |
/// 회전 |
2122 |
/// </summary> |
2123 |
/// <param name="sender"></param> |
2124 |
/// <param name="e"></param> |
2125 |
public void rotate_DragDelta(object sender, DragDeltaEventArgs e) |
2126 |
{ |
2127 |
MoveRotate(e); |
2128 |
} |
2129 |
|
2130 |
double LastRotateHorizontalValue = 0; |
2131 |
double LastRotateVerticalValue = 0; |
2132 |
double LastWidthValue = 0; |
2133 |
double SetWidth = 0; |
2134 |
bool RotateFlag = false; |
2135 |
|
2136 |
/// <summary> |
2137 |
/// <history>humkyung 2018.05.09 upgrade rotate shape peformance</history> |
2138 |
/// </summary> |
2139 |
/// <param name="e"></param> |
2140 |
public void MoveRotate(DragDeltaEventArgs e) |
2141 |
{ |
2142 |
double dDeltaAngle = 0; |
2143 |
|
2144 |
List<Point> AllPointSet = new List<Point>(); |
2145 |
Point CenterPoint = new Point(); |
2146 |
#region 회전율에 따른 DragDelta 값 |
2147 |
|
2148 |
#region 원본소스 |
2149 |
////if (Math.Abs(e.HorizontalChange) > Math.Abs(e.VerticalChange)) |
2150 |
////{ |
2151 |
// //dDeltaAngle = +2; |
2152 |
// //dDeltaAngle = (e.HorizontalChange / 20); |
2153 |
// AngleValue = AngleValue + dDeltaAngle; |
2154 |
// if (Math.Abs(e.HorizontalChange) > Math.Abs(e.VerticalChange)) |
2155 |
// { |
2156 |
// if (LastRotateHorizontalValue < e.HorizontalChange) |
2157 |
// { |
2158 |
// dDeltaAngle = 2; |
2159 |
// AngleValue = AngleValue + dDeltaAngle; |
2160 |
// } |
2161 |
// else |
2162 |
// { |
2163 |
// dDeltaAngle = -2; |
2164 |
// AngleValue = AngleValue + dDeltaAngle; |
2165 |
// } |
2166 |
// } |
2167 |
// //else |
2168 |
// //{ |
2169 |
// // if (LastRotateVerticalValue < e.VerticalChange) |
2170 |
// // { |
2171 |
// // dDeltaAngle = -2; |
2172 |
// // AngleValue = AngleValue + dDeltaAngle; |
2173 |
|
2174 |
// // } |
2175 |
// // else |
2176 |
// // { |
2177 |
// // dDeltaAngle = 2; |
2178 |
// // AngleValue = AngleValue + dDeltaAngle; |
2179 |
// // } |
2180 |
// //} |
2181 |
////} |
2182 |
////else if (Math.Abs(e.HorizontalChange) < Math.Abs(e.VerticalChange)) |
2183 |
////{ |
2184 |
//// //dDeltaAngle = (e.VerticalChange / 20); |
2185 |
//// dDeltaAngle = -2; |
2186 |
//// AngleValue = AngleValue + dDeltaAngle; |
2187 |
////} |
2188 |
#endregion |
2189 |
|
2190 |
//강인구 수정 |
2191 |
//AngleValue = AngleValue + dDeltaAngle; |
2192 |
#endregion |
2193 |
|
2194 |
#region 센터 포인트 구하기 (그룹핑) |
2195 |
foreach (var item in MemberSet) |
2196 |
{ |
2197 |
if (item.DrawingData.GetType().Name == "TextControl") |
2198 |
{ |
2199 |
//double X = Canvas.GetLeft((item.DrawingData as TextControl)); |
2200 |
//double Y = Canvas.GetTop((item.DrawingData as TextControl)); |
2201 |
//AllPointSet.Add(new Point(X, Y)); |
2202 |
AllPointSet.Add((item.DrawingData as TextControl).StartPoint); |
2203 |
} |
2204 |
else |
2205 |
{ |
2206 |
foreach (Point itemP in (item.DrawingData as IPath).PointSet) |
2207 |
{ |
2208 |
AllPointSet.Add(itemP); |
2209 |
} |
2210 |
} |
2211 |
} |
2212 |
#endregion |
2213 |
CenterPoint = MathSet.FindCentroid(AllPointSet); |
2214 |
Point pt = Mouse.GetPosition(this); |
2215 |
|
2216 |
//if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name != "TextControl") |
2217 |
{ |
2218 |
Point vec1 = new Point(this.rotatePoint.X - CenterPoint.X, this.rotatePoint.Y - CenterPoint.Y); |
2219 |
Point vec2 = new Point(pt.X - CenterPoint.X, pt.Y - CenterPoint.Y); |
2220 |
dDeltaAngle = (MathSet.getAngleBetweenVectors(vec1, vec2)); |
2221 |
} |
2222 |
//else |
2223 |
//{ |
2224 |
// //if (IsTextAngle || RotateFlag) |
2225 |
// //{ |
2226 |
// // AngleValue = ((MemberSet.First() as AdornerMember).DrawingData as TextControl).Angle + 5; |
2227 |
// //} |
2228 |
// //else |
2229 |
// //{ |
2230 |
// // AngleValue = ((MemberSet.First() as AdornerMember).DrawingData as TextControl).Angle - 5; |
2231 |
// //} |
2232 |
//} |
2233 |
|
2234 |
AngleValue += dDeltaAngle; |
2235 |
if (AngleValue > 360) AngleValue -= 360; |
2236 |
if (AngleValue < 0) AngleValue += 360; |
2237 |
this.rotatePoint = pt; /// save rotatePoint |
2238 |
|
2239 |
Dispatcher.BeginInvoke((Action)(() => |
2240 |
{ |
2241 |
foreach (var item in MemberSet) |
2242 |
{ |
2243 |
foreach (var thumb in item.ThumbList) |
2244 |
{ |
2245 |
double x = Canvas.GetLeft(thumb); |
2246 |
double y = Canvas.GetTop(thumb); |
2247 |
|
2248 |
Point value = MathSet.RotateAbout(CenterPoint, new Point(x, y), dDeltaAngle); |
2249 |
Canvas.SetLeft(thumb, value.X); |
2250 |
Canvas.SetTop(thumb, value.Y); |
2251 |
|
2252 |
/* |
2253 |
if (item.DrawingData.GetType().Name == "ArrowTextControl" && thumb == item.ThumbList.Last()) |
2254 |
{ |
2255 |
Canvas.SetLeft(thumb, Canvas.GetLeft((item.DrawingData as ArrowTextControl).Base_TextBox)); |
2256 |
Canvas.SetTop(thumb, Canvas.GetTop((item.DrawingData as ArrowTextControl).Base_TextBox)); |
2257 |
if (!(item.DrawingData as ArrowTextControl).isTrans) |
2258 |
{ |
2259 |
List<Point> ps = new List<Point>(); |
2260 |
|
2261 |
//강인구 추가 |
2262 |
//var temp = (MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl; |
2263 |
var temp = item.DrawingData as ArrowTextControl; |
2264 |
switch (Math.Abs(temp.Angle).ToString()) |
2265 |
{ |
2266 |
case "90": |
2267 |
{ |
2268 |
ps.Clear(); |
2269 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽 |
2270 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); // 위 중간 |
2271 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); // 위 오른쪽 |
2272 |
|
2273 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 중간 |
2274 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 하단 |
2275 |
|
2276 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); //중간 하단 |
2277 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 하단 |
2278 |
|
2279 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 중간 |
2280 |
} |
2281 |
break; |
2282 |
case "270": |
2283 |
{ |
2284 |
ps.Clear(); |
2285 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽 |
2286 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); // 위 중간 |
2287 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); // 위 오른쪽 |
2288 |
|
2289 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 중간 |
2290 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 하단 |
2291 |
|
2292 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); //중간 하단 |
2293 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 하단 |
2294 |
|
2295 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 중간 |
2296 |
} |
2297 |
break; |
2298 |
default: |
2299 |
{ |
2300 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단 |
2301 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단 |
2302 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단 |
2303 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //우단 |
2304 |
} |
2305 |
break; |
2306 |
} |
2307 |
|
2308 |
var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
2309 |
var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP); |
2310 |
|
2311 |
Canvas.SetLeft((MemberSet.Where(data => data.DrawingData.GetType().Name == "ArrowTextControl")).FirstOrDefault().ThumbList[1], tempP.X); |
2312 |
Canvas.SetTop((MemberSet.Where(data => data.DrawingData.GetType().Name == "ArrowTextControl")).FirstOrDefault().ThumbList[1], tempP.Y); |
2313 |
//Canvas.SetLeft((MemberSet.First() as AdornerMember).ThumbList[1], tempP.X); |
2314 |
//Canvas.SetTop((MemberSet.First() as AdornerMember).ThumbList[1], tempP.Y); |
2315 |
} |
2316 |
} |
2317 |
*/ |
2318 |
} |
2319 |
|
2320 |
for (int i = 0; i < (item.DrawingData as IPath).PointSet.Count(); i++) |
2321 |
{ |
2322 |
(item.DrawingData as IPath).PointSet[i] = MathSet.RotateAbout(CenterPoint, (item.DrawingData as IPath).PointSet[i], dDeltaAngle); |
2323 |
} |
2324 |
} |
2325 |
#region 보더 업데이트 |
2326 |
foreach (var item in MemberSet) |
2327 |
{ |
2328 |
switch (item.Drawingtype) |
2329 |
{ |
2330 |
case ControlType.TextControl: |
2331 |
((TextControl)item.DrawingData).Angle = AngleValue; |
2332 |
|
2333 |
RectangleGeometry Data = new RectangleGeometry |
2334 |
{ |
2335 |
Rect = new Rect() |
2336 |
{ |
2337 |
X = Canvas.GetLeft((item.DrawingData as TextControl)), |
2338 |
Y = Canvas.GetTop((item.DrawingData as TextControl)), |
2339 |
Width = (item.DrawingData as TextControl).Base_TextBlock.ActualWidth / 2, |
2340 |
Height = (item.DrawingData as TextControl).Base_TextBlock.ActualHeight / 2, |
2341 |
} |
2342 |
}; |
2343 |
//if ((firstCondition as TextControl).Angle != 0) |
2344 |
//{ |
2345 |
Point endPointV = new Point(Data.Bounds.Right, Data.Bounds.Bottom); |
2346 |
Point middle = MathSet.getMiddlePoint((item.DrawingData as TextControl).StartPoint, endPointV); |
2347 |
|
2348 |
|
2349 |
//AdornerBorder.RenderTransformOrigin = new Point(1, 1); |
2350 |
//AdornerBorder.RenderTransform = new RotateTransform() |
2351 |
//{ |
2352 |
// Angle = (member as TextControl).Angle * -1, |
2353 |
// CenterX = middle.X + ((member as TextControl) as FrameworkElement).ActualWidth /2, |
2354 |
// CenterY = middle.Y + ((member as TextControl) as FrameworkElement).ActualHeight /2, |
2355 |
//}; |
2356 |
|
2357 |
DragThumb.RenderTransformOrigin = new Point(0.0, 0.0); |
2358 |
DragThumb.RenderTransform = new RotateTransform() |
2359 |
{ |
2360 |
Angle = (item.DrawingData as TextControl).Angle, |
2361 |
//CenterX = middle.X, |
2362 |
//CenterY = middle.Y, |
2363 |
}; |
2364 |
|
2365 |
AdornerBorder.RenderTransformOrigin = new Point(0.0, 0.0); |
2366 |
AdornerBorder.RenderTransform = new RotateTransform() |
2367 |
{ |
2368 |
Angle = (item.DrawingData as TextControl).Angle, |
2369 |
//CenterX = middle.X, |
2370 |
//CenterY = middle.Y, |
2371 |
}; |
2372 |
|
2373 |
(item.DrawingData as TextControl).Base_Grid.RenderTransform = new RotateTransform() |
2374 |
{ |
2375 |
Angle = (item.DrawingData as TextControl).Angle, |
2376 |
}; |
2377 |
|
2378 |
BorderUpdate(); |
2379 |
break; |
2380 |
//case ControlType.Viewbox: |
2381 |
// (item.DrawingData as IPath).updateControl(); |
2382 |
// ((IViewBox)item.DrawingData).Angle = AngleValue; |
2383 |
// BorderUpdate(); |
2384 |
// break; |
2385 |
case ControlType.Date: |
2386 |
|
2387 |
//강인구 추가(2018.02.22) |
2388 |
((DateControl)item.DrawingData).Angle = AngleValue; |
2389 |
(item.DrawingData as IPath).updateControl(); |
2390 |
|
2391 |
BorderUpdate(); |
2392 |
//MessageBox.Show("잠시 정확도를 위해 막아두었습니다!"); |
2393 |
break; |
2394 |
case ControlType.ArrowMultiLine: |
2395 |
case ControlType.ArcLine: |
2396 |
case ControlType.SingleLine: |
2397 |
case ControlType.Triangle: |
2398 |
(item.DrawingData as IPath).updateControl(); |
2399 |
BorderUpdate(); |
2400 |
break; |
2401 |
case ControlType.ArrowTextControl: |
2402 |
(item.DrawingData as IPath).updateControl(); |
2403 |
BorderUpdate(); |
2404 |
break; |
2405 |
case ControlType.RectCloud: |
2406 |
((RectCloudControl)item.DrawingData).Angle = AngleValue; |
2407 |
(item.DrawingData as IPath).updateControl(); |
2408 |
BorderUpdate(); |
2409 |
break; |
2410 |
case ControlType.Rectangle: |
2411 |
((RectangleControl)item.DrawingData).Angle = AngleValue; |
2412 |
(item.DrawingData as IPath).updateControl(); |
2413 |
BorderUpdate(); |
2414 |
break; |
2415 |
case ControlType.ImgControl: |
2416 |
((ImgControl)item.DrawingData).Angle = AngleValue; |
2417 |
(item.DrawingData as IPath).updateControl(); |
2418 |
BorderUpdate(); |
2419 |
break; |
2420 |
//강인구 추가 |
2421 |
case ControlType.Sign: |
2422 |
((SignControl)item.DrawingData).Angle = AngleValue; |
2423 |
(item.DrawingData as IPath).updateControl(); |
2424 |
BorderUpdate(); |
2425 |
break; |
2426 |
//강인구 추가 |
2427 |
case ControlType.Symbol: |
2428 |
((SymControl)item.DrawingData).Angle = AngleValue; |
2429 |
(item.DrawingData as IPath).updateControl(); |
2430 |
BorderUpdate(); |
2431 |
break; |
2432 |
//강인구 추가 |
2433 |
case ControlType.Stamp: |
2434 |
((SymControlN)item.DrawingData).Angle = AngleValue; |
2435 |
(item.DrawingData as IPath).updateControl(); |
2436 |
BorderUpdate(); |
2437 |
break; |
2438 |
case ControlType.PolygonControl: |
2439 |
//((IShapeControl)AllControl).Angle = AngleValue; |
2440 |
(item.DrawingData as IPath).updateControl(); |
2441 |
BorderUpdate(); |
2442 |
break; |
2443 |
case ControlType.PolygonCloud: |
2444 |
//((IShapeControl)AllControl).Angle = AngleValue; |
2445 |
((ICloudControl)item.DrawingData).DrawingCloud(); |
2446 |
(item.DrawingData as IPath).updateControl(); |
2447 |
BorderUpdate(); |
2448 |
break; |
2449 |
case ControlType.Circle: |
2450 |
((IShapeControl)item.DrawingData).Angle = AngleValue; |
2451 |
(item.DrawingData as IPath).updateControl(); |
2452 |
((CircleControl)item.DrawingData).SetCenterXY(); |
2453 |
BorderUpdate(); |
2454 |
break; |
2455 |
case ControlType.Ink: |
2456 |
for (int i = 0; i < (item.DrawingData as InkControl).PointC.Count(); i++) |
2457 |
{ |
2458 |
for (int j = 0; j < (item.DrawingData as InkControl).PointC[i].pointSet.Count; j++) |
2459 |
{ |
2460 |
(item.DrawingData as InkControl).PointC[i].pointSet[j] = MathSet.RotateAbout(CenterPoint, (item.DrawingData as InkControl).PointC[i].pointSet[j], dDeltaAngle); |
2461 |
} |
2462 |
} |
2463 |
(item.DrawingData as IPath).updateControl(); |
2464 |
BorderUpdate(); |
2465 |
break; |
2466 |
//case MarkupType.PolygonEx: |
2467 |
// //trRotate.Angle = AngleValue; |
2468 |
// for (int i = 0; i < (item.DrawingData as PolyControl).PointC.Count(); i++) |
2469 |
// { |
2470 |
// //(item.DrawingData as PolyControl).PointC[i] = MathSet.RotateAbout(CenterPoint, (item.DrawingData as PolyControl).PointC[i]., dDeltaAngle); |
2471 |
// for (int j = 0; j < (item.DrawingData as PolyControl).PointC[i].pointSet.Count; j++) |
2472 |
// { |
2473 |
// (item.DrawingData as PolyControl).PointC[i].pointSet[j] = MathSet.RotateAbout(CenterPoint, (item.DrawingData as PolyControl).PointC[i].pointSet[j], dDeltaAngle); |
2474 |
// } |
2475 |
// } |
2476 |
// (item.DrawingData as IPath).updateControl(); |
2477 |
// BorderUpdate(); |
2478 |
// break; |
2479 |
default: |
2480 |
break; |
2481 |
} |
2482 |
} |
2483 |
#endregion |
2484 |
})); |
2485 |
BorderUpdate(); |
2486 |
} |
2487 |
|
2488 |
/// <summary> |
2489 |
/// starting rotate |
2490 |
/// </summary> |
2491 |
/// <param name="sender"></param> |
2492 |
/// <param name="e"></param> |
2493 |
private void rotate_DragStarted(object sender, DragStartedEventArgs e) |
2494 |
{ |
2495 |
this.rotatePoint = Mouse.GetPosition(this); /// 2018.05.09 added by humkyung |
2496 |
rotateTop.Cursor = Cursors.SizeAll; |
2497 |
|
2498 |
/// get angle from text controls' angle if only text control exists - 2018.05.10 added by humkyung |
2499 |
if ((1 == MemberSet.Count) && (MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "TextControl") |
2500 |
{ |
2501 |
this.AngleValue = ((MemberSet.First() as AdornerMember).DrawingData as TextControl).Angle; |
2502 |
} |
2503 |
/// up to here |
2504 |
|
2505 |
if (ViewerDataModel.Instance.UndoDataList == null) |
2506 |
{ |
2507 |
return; |
2508 |
} |
2509 |
|
2510 |
if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Event == Event_Type.Thumb) |
2511 |
{ |
2512 |
return; |
2513 |
} |
2514 |
if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List != null) |
2515 |
{ |
2516 |
if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.Count > 0) |
2517 |
{ |
2518 |
if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.FirstOrDefault().PointSet != null) |
2519 |
{ |
2520 |
return; |
2521 |
} |
2522 |
} |
2523 |
} |
2524 |
|
2525 |
Undo_Event(); |
2526 |
} |
2527 |
|
2528 |
private void rotate_DragCompleted(object sender, DragCompletedEventArgs e) |
2529 |
{ |
2530 |
//CustomCursor.SetCursorTemplate(rotateTop, null); |
2531 |
rotateTop.Cursor = Cursors.Arrow; |
2532 |
|
2533 |
Undo_Event(); |
2534 |
} |
2535 |
|
2536 |
private void drag_DragStarted(object sender, DragStartedEventArgs e) |
2537 |
{ |
2538 |
//CustomCursor.SetCursorTemplate(DragThumb, this.Resources["MoveCursor"] as DataTemplate); |
2539 |
//DragThumb.Cursor = Cursors.None; |
2540 |
//DragThumb.Cursor = Cursors.SizeAll; |
2541 |
|
2542 |
if (ViewerDataModel.Instance.UndoDataList == null) |
2543 |
{ |
2544 |
return; |
2545 |
} |
2546 |
if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Event == Event_Type.Thumb) |
2547 |
{ |
2548 |
return; |
2549 |
} |
2550 |
if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List != null) |
2551 |
{ |
2552 |
if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.Count > 0) |
2553 |
{ |
2554 |
if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.FirstOrDefault().PointSet != null) |
2555 |
{ |
2556 |
return; |
2557 |
} |
2558 |
} |
2559 |
} |
2560 |
|
2561 |
Undo_Event(); |
2562 |
} |
2563 |
|
2564 |
private void Undo_Event() |
2565 |
{ |
2566 |
List<Point> p_set = new List<Point>(); |
2567 |
|
2568 |
Undo_data UndoData = new Undo_data() |
2569 |
{ |
2570 |
IsUndo = false, |
2571 |
Event = Event_Type.Thumb, |
2572 |
EventTime = DateTime.Now, |
2573 |
Markup_List = new List<Multi_Undo_data>(), |
2574 |
}; |
2575 |
|
2576 |
Multi_Undo_data multi_Undo_Data = new Multi_Undo_data(); |
2577 |
|
2578 |
foreach (var control in MemberSet) |
2579 |
{ |
2580 |
multi_Undo_Data.PointSet = new List<Point>(); |
2581 |
p_set = new List<Point>(); |
2582 |
|
2583 |
if(control.DrawingData as TextControl != null) |
2584 |
{ |
2585 |
multi_Undo_Data.PointSet.Add((control.DrawingData as TextControl).StartPoint); |
2586 |
multi_Undo_Data.PointSet.Add((control.DrawingData as TextControl).EndPoint); |
2587 |
} |
2588 |
|
2589 |
foreach (var point in ((control.DrawingData as CommentUserInfo) as IPath).PointSet) |
2590 |
{ |
2591 |
multi_Undo_Data.PointSet.Add(point); |
2592 |
} |
2593 |
|
2594 |
multi_Undo_Data.Angle = AngleValue; |
2595 |
|
2596 |
multi_Undo_Data.Markup = control.DrawingData as CommentUserInfo; |
2597 |
UndoData.Markup_List.Add(multi_Undo_Data); |
2598 |
multi_Undo_Data = new Multi_Undo_data(); |
2599 |
} |
2600 |
ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i => |
2601 |
{ |
2602 |
ViewerDataModel.Instance.UndoDataList.Remove(i); |
2603 |
}); |
2604 |
|
2605 |
ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
2606 |
|
2607 |
} |
2608 |
|
2609 |
private void drag_DragCompleted(object sender, DragCompletedEventArgs e) |
2610 |
{ |
2611 |
//CustomCursor.SetCursorTemplate(DragThumb, null); |
2612 |
DragThumb.Cursor = Cursors.Arrow; |
2613 |
|
2614 |
Undo_Event(); |
2615 |
} |
2616 |
|
2617 |
public void ControlPointMouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
2618 |
{ |
2619 |
AdornerMember control = MemberSet.FirstOrDefault(); |
2620 |
|
2621 |
if ((control.DrawingData as ArrowTextControl) != null && DraggerThumb == null) |
2622 |
{ |
2623 |
if ((control.DrawingData as ArrowTextControl).isTrans == false && (control.DrawingData as ArrowTextControl).isFixed == false) |
2624 |
{ |
2625 |
(control.DrawingData as ArrowTextControl).isTrans = true; |
2626 |
} |
2627 |
} |
2628 |
|
2629 |
} |
2630 |
|
2631 |
public void TextControlChanger() |
2632 |
{ |
2633 |
if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "TextControl") |
2634 |
{ |
2635 |
TextControl AllControl = (MemberSet.First() as AdornerMember).DrawingData as TextControl; |
2636 |
AllControl.Base_TextBox.Focus(); |
2637 |
AllControl.Base_TextBox.Visibility = Visibility.Visible; |
2638 |
AllControl.Base_TextBlock.Visibility = Visibility.Collapsed; |
2639 |
AllControl.Base_TextBox.Focus(); |
2640 |
AllControl.SizeChanged += (sen, ea) => |
2641 |
{ |
2642 |
if (AllControl.Base_TextBox != null) |
2643 |
{ |
2644 |
RectangleGeometry Data = new RectangleGeometry |
2645 |
{ |
2646 |
Rect = new Rect() |
2647 |
{ |
2648 |
X = AllControl.StartPoint.X, |
2649 |
Y = AllControl.StartPoint.Y, |
2650 |
Width = AllControl.Base_TextBox.Width, |
2651 |
Height = AllControl.Base_TextBox.Height, |
2652 |
} |
2653 |
}; |
2654 |
|
2655 |
Point endPointV = new Point(Data.Bounds.Right, Data.Bounds.Bottom); |
2656 |
Point middle = MathSet.getMiddlePoint(AllControl.StartPoint, endPointV); |
2657 |
AllControl.Base_Grid.RenderTransform = new RotateTransform() |
2658 |
{ |
2659 |
Angle = AllControl.Angle, |
2660 |
CenterX = middle.X, |
2661 |
CenterY = middle.Y, |
2662 |
}; |
2663 |
} |
2664 |
BorderUpdate(); |
2665 |
}; |
2666 |
} |
2667 |
} |
2668 |
|
2669 |
private void RectThumb_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) //더블클릭 |
2670 |
{ |
2671 |
if (e.ClickCount == 2 && MemberSet.Count == 1) |
2672 |
{ |
2673 |
|
2674 |
if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "TextControl") |
2675 |
{ |
2676 |
TextControlChanger(); |
2677 |
// TextControl AllControl = (MemberSet.First() as AdornerMember).DrawingData as TextControl; |
2678 |
// AllControl.Base_TextBox.Focus(); |
2679 |
// AllControl.Base_TextBox.Visibility = Visibility.Visible; |
2680 |
// AllControl.Base_TextBlock.Visibility = Visibility.Collapsed; |
2681 |
// AllControl.Base_TextBox.Focus(); |
2682 |
// AllControl.SizeChanged += (sen, ea) => |
2683 |
// { |
2684 |
// if (AllControl.Base_TextBox != null) |
2685 |
// { |
2686 |
// RectangleGeometry Data = new RectangleGeometry |
2687 |
// { |
2688 |
// Rect = new Rect() |
2689 |
// { |
2690 |
// X = AllControl.StartPoint.X, |
2691 |
// Y = AllControl.StartPoint.Y, |
2692 |
// Width = AllControl.Base_TextBox.Width, |
2693 |
// Height = AllControl.Base_TextBox.Height, |
2694 |
// } |
2695 |
// }; |
2696 |
|
2697 |
// Point endPointV = new Point(Data.Bounds.Right, Data.Bounds.Bottom); |
2698 |
// Point middle = MathSet.getMiddlePoint(AllControl.StartPoint, endPointV); |
2699 |
// AllControl.Base_Grid.RenderTransform = new RotateTransform() |
2700 |
// { |
2701 |
// Angle = AllControl.Angle, |
2702 |
// CenterX = middle.X, |
2703 |
// CenterY = middle.Y, |
2704 |
// }; |
2705 |
// } |
2706 |
// BorderUpdate(); |
2707 |
// }; |
2708 |
} |
2709 |
|
2710 |
else if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "ArrowTextControl") |
2711 |
{ |
2712 |
ArrowTextControl AllControl = (MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl; |
2713 |
Thumb tm = (MemberSet.First() as AdornerMember).ThumbList.Last(); |
2714 |
((ArrowTextControl)AllControl).Base_TextBox.Focus(); |
2715 |
|
2716 |
//강인구 추가(ArrowControl TextBox Thumb없애기 |
2717 |
tm.Visibility = Visibility.Collapsed; |
2718 |
|
2719 |
((MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl).Base_TextBox.IsHitTestVisible = true; |
2720 |
|
2721 |
//(sender as System.Windows.Shapes.Rectangle).IsHitTestVisible = false; |
2722 |
//(sender as System.Windows.Shapes.Rectangle).Visibility = Visibility.Hidden; |
2723 |
//Canvas.SetZIndex(((ArrowTextControl)AllControl).Base_TextBox,9999); |
2724 |
//editTextBox = ((ArrowTextControl)AllControl).Base_TextBox; |
2725 |
//editTextBox.Style = ((ArrowTextControl)AllControl).Base_TextBox.Style; |
2726 |
//editTextBox.Text = (AllControl as ArrowTextControl).ArrowText; |
2727 |
//editTextBox.FontSize = (AllControl as ArrowTextControl).FontSize; |
2728 |
//editTextBox.Foreground = (AllControl as ArrowTextControl).Foreground; |
2729 |
//editTextBox.FontWeight = (AllControl as ArrowTextControl).FontWeight; |
2730 |
|
2731 |
//(AllControl as ArrowTextControl).Base_TextBox.Visibility = Visibility.Collapsed; |
2732 |
//editTextBox = (AllControl as ArrowTextControl).Base_TextBox; |
2733 |
//editTextBox.TextChanged += (sen, ea) => |
2734 |
// { |
2735 |
// ((ArrowTextControl)AllControl).ArrowText = editTextBox.Text; |
2736 |
// }; |
2737 |
|
2738 |
|
2739 |
//(sender as System.Windows.Shapes.Rectangle).Visibility = Visibility.Hidden; |
2740 |
//((ArrowTextControl)AllControl).Base_TextBox.Background = new SolidColorBrush(Colors.Blue); |
2741 |
//((ArrowTextControl)AllControl).Base_TextBox.Opacity = 1; |
2742 |
//((ArrowTextControl)AllControl).Base_TextBox.Focus(); |
2743 |
|
2744 |
((ArrowTextControl)AllControl).Base_TextBox.SizeChanged += (sen, ea) => |
2745 |
|
2746 |
{ |
2747 |
tm.Width = (AllControl as ArrowTextControl).BoxWidth; |
2748 |
tm.Height = (AllControl as ArrowTextControl).BoxHeight; |
2749 |
|
2750 |
List<Point> ps = new List<Point>(); |
2751 |
//RotateTransform myRotateTransform = new RotateTransform(); |
2752 |
|
2753 |
|
2754 |
//if (control.Angle == -270) |
2755 |
//{ |
2756 |
// myRotateTransform.Angle = 90; |
2757 |
// myRotateTransform.CenterX = Canvas.GetLeft(control.Base_TextBox); |
2758 |
// myRotateTransform.CenterY = Canvas.GetTop(control.Base_TextBox); |
2759 |
//} |
2760 |
//else if (control.Angle == -90) |
2761 |
//{ |
2762 |
// myRotateTransform.Angle = 270; |
2763 |
// myRotateTransform.CenterX = Canvas.GetLeft(control.Base_TextBox); |
2764 |
// myRotateTransform.CenterY = Canvas.GetTop(control.Base_TextBox); |
2765 |
//} |
2766 |
//TransformGroup myTransformGroup = new TransformGroup(); |
2767 |
//myTransformGroup.Children.Add(myRotateTransform); |
2768 |
|
2769 |
ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth / 2, Canvas.GetTop(AllControl.Base_TextBox))); //상단 |
2770 |
ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth / 2, Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight)); // 하단 |
2771 |
ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox), Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight / 2)); //좌단 |
2772 |
ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth, Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight / 2)); //우단 |
2773 |
|
2774 |
|
2775 |
|
2776 |
|
2777 |
var endP = MathSet.getNearPoint(ps, AllControl.MidPoint); |
2778 |
var tempP = MathSet.getMiddlePoint(AllControl.StartPoint, endP); |
2779 |
if (AllControl.isTrans) |
2780 |
{ |
2781 |
Canvas.SetLeft((MemberSet.First() as AdornerMember).ThumbList[1], AllControl.MidPoint.X); |
2782 |
Canvas.SetTop((MemberSet.First() as AdornerMember).ThumbList[1], AllControl.MidPoint.Y); |
2783 |
} |
2784 |
else |
2785 |
{ |
2786 |
Canvas.SetLeft((MemberSet.First() as AdornerMember).ThumbList[1], tempP.X); |
2787 |
Canvas.SetTop((MemberSet.First() as AdornerMember).ThumbList[1], tempP.Y); |
2788 |
} |
2789 |
|
2790 |
|
2791 |
BorderUpdate(); |
2792 |
|
2793 |
}; |
2794 |
} |
2795 |
else if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "DateControl") |
2796 |
{ |
2797 |
DateControl data = (MemberSet.First() as AdornerMember).DrawingData as DateControl; |
2798 |
CalendarControl instanceCal = new CalendarControl(data.Text); |
2799 |
//dropData.IsOpen = true; |
2800 |
RadWindow rc = new RadWindow(); |
2801 |
rc.Width = 300; |
2802 |
rc.Height = 300; |
2803 |
rc.Header = "Change Date"; |
2804 |
rc.Content = instanceCal; |
2805 |
rc.BorderThickness = new Thickness(3); |
2806 |
rc.ResizeMode = ResizeMode.NoResize; |
2807 |
rc.WindowStartupLocation = WindowStartupLocation.CenterScreen; |
2808 |
rc.ModalBackground = new SolidColorBrush(Colors.Black); |
2809 |
rc.ModalBackground.Opacity = 0.6; |
2810 |
Telerik.Windows.Controls.StyleManager.SetTheme(rc, new Telerik.Windows.Controls.Windows8Theme()); |
2811 |
instanceCal.changeDateCal.SelectionChanged += (sen, ea) => |
2812 |
{ |
2813 |
data.Text = instanceCal.changeDateCal.SelectedDate.Value.ToShortDateString(); |
2814 |
rc.Close(); |
2815 |
}; |
2816 |
rc.ShowDialog(); |
2817 |
//CalendarControl.xaml |
2818 |
} |
2819 |
else if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "ArcControl") |
2820 |
{ |
2821 |
ArcControl instance = ((MemberSet.First() as AdornerMember).DrawingData as ArcControl); |
2822 |
if (instance.isTransOn) |
2823 |
{ |
2824 |
instance.isTransOn = false; |
2825 |
} |
2826 |
else |
2827 |
{ |
2828 |
instance.isTransOn = true; |
2829 |
} |
2830 |
instance.SetArcPath(); |
2831 |
BorderUpdate(); |
2832 |
} |
2833 |
//else if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "CloudControl") |
2834 |
//{ |
2835 |
// CloudControl instance = ((MemberSet.First() as AdornerMember).DrawingData as CloudControl); |
2836 |
// if (!instance.isChain) |
2837 |
// { |
2838 |
// if (instance.isTransOn) |
2839 |
// { |
2840 |
// instance.isTransOn = false; |
2841 |
// } |
2842 |
// else |
2843 |
// { |
2844 |
// instance.isTransOn = true; |
2845 |
// } |
2846 |
|
2847 |
// instance.SetCloud(); |
2848 |
// BorderUpdate(); |
2849 |
// } |
2850 |
//} |
2851 |
//else if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "LineControl") |
2852 |
//{ |
2853 |
// LineControl instance = ((MemberSet.First() as AdornerMember).DrawingData as LineControl); |
2854 |
// if (instance.LineStyle == LineControl.LineStyleSet.MultiLine) |
2855 |
// { |
2856 |
// instance.Interval += 1; |
2857 |
// instance.SetLinePath(); |
2858 |
// BorderUpdate(); |
2859 |
// } |
2860 |
|
2861 |
// //instance.SetCloud(); |
2862 |
// //BorderUpdate(); |
2863 |
//} |
2864 |
|
2865 |
} |
2866 |
//if (e.ClickCount == 2 && AllControl.GetType().Name == "TextControl") // Edit Mode |
2867 |
//{ |
2868 |
// ((TextControl)AllControl).Base_TextBox.Focus(); |
2869 |
// ((TextControl)AllControl).Base_TextBox.Visibility = Visibility.Visible; |
2870 |
// ((TextControl)AllControl).Base_TextBlock.Visibility = Visibility.Collapsed; |
2871 |
//} |
2872 |
//if (e.ClickCount == 2 && AllControl.GetType().Name == "ArrowTextControl") // Edit Mode |
2873 |
//{ |
2874 |
// Thumb tm = (from kkk in this.ContainerContent.Children |
2875 |
// where (kkk as FrameworkElement).Name == "LastThumb" |
2876 |
// select kkk).FirstOrDefault() as Thumb; |
2877 |
// ((ArrowTextControl)AllControl).Base_TextBox.Focus(); |
2878 |
// ((ArrowTextControl)AllControl).Base_TextBox.SizeChanged += (sen, ea) => |
2879 |
// { |
2880 |
// tm.Width = (AllControl as ArrowTextControl).BoxWidth; |
2881 |
// tm.Height = (AllControl as ArrowTextControl).BoxHeight; |
2882 |
// Canvas.SetLeft(tm, (AllControl.EndPoint.X - tm.Width / 2)); |
2883 |
// Canvas.SetTop(tm, (AllControl.EndPoint.Y - tm.Height / 2)); |
2884 |
// Canvas.SetLeft((AllControl as ArrowTextControl).Base_TextBox, (AllControl.EndPoint.X - tm.Width / 2)); |
2885 |
// Canvas.SetTop((AllControl as ArrowTextControl).Base_TextBox, (AllControl.EndPoint.Y - tm.Height / 2)); |
2886 |
// }; |
2887 |
//} |
2888 |
} |
2889 |
#endregion |
2890 |
|
2891 |
private void DragThumb_MouseDoubleClick(object sender, MouseButtonEventArgs e) |
2892 |
{ |
2893 |
if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "TextControl" || (MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "ArrowTextControl") |
2894 |
{ |
2895 |
DragThumb.Visibility = Visibility.Collapsed; |
2896 |
} |
2897 |
} |
2898 |
|
2899 |
//private void testText_Loaded(object sender, RoutedEventArgs e) |
2900 |
//{ |
2901 |
// editTextBox = sender as TextBox; |
2902 |
//} |
2903 |
} |
2904 |
} |