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