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