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