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