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