개정판 f816dd63
issue #923: add RedoCommand class
Change-Id: I4030ff812a02655439edccaa65cdaaa035e1549a
KCOM/Controls/AdornerFinal.xaml.cs | ||
---|---|---|
1195 | 1195 |
|
1196 | 1196 |
var comments = (from drawing in this.MemberSet |
1197 | 1197 |
select drawing.DrawingData as CommentUserInfo).ToList(); |
1198 |
UndoCommand.Instance.Execute(comments, this.AngleValue);
|
|
1198 |
UndoCommand.Instance.Push(comments, this.AngleValue);
|
|
1199 | 1199 |
} |
1200 | 1200 |
|
1201 | 1201 |
/// <summary> |
... | ... | |
1231 | 1231 |
|
1232 | 1232 |
var comments = (from drawing in this.MemberSet |
1233 | 1233 |
select drawing.DrawingData as CommentUserInfo).ToList(); |
1234 |
UndoCommand.Instance.Execute(comments, this.AngleValue);
|
|
1234 |
UndoCommand.Instance.Push(comments, this.AngleValue);
|
|
1235 | 1235 |
} |
1236 | 1236 |
|
1237 | 1237 |
private void rotate_MouseMove(object sender, MouseEventArgs e) |
... | ... | |
1969 | 1969 |
|
1970 | 1970 |
var comments = (from drawing in this.MemberSet |
1971 | 1971 |
select drawing.DrawingData as CommentUserInfo).ToList(); |
1972 |
UndoCommand.Instance.Execute(comments, this.AngleValue);
|
|
1972 |
UndoCommand.Instance.Push(comments, this.AngleValue);
|
|
1973 | 1973 |
} |
1974 | 1974 |
|
1975 | 1975 |
private void rotate_DragCompleted(object sender, DragCompletedEventArgs e) |
... | ... | |
1978 | 1978 |
|
1979 | 1979 |
var comments = (from drawing in this.MemberSet |
1980 | 1980 |
select drawing.DrawingData as CommentUserInfo).ToList(); |
1981 |
UndoCommand.Instance.Execute(comments, this.AngleValue);
|
|
1981 |
UndoCommand.Instance.Push(comments, this.AngleValue);
|
|
1982 | 1982 |
} |
1983 | 1983 |
|
1984 | 1984 |
private void drag_DragStarted(object sender, DragStartedEventArgs e) |
... | ... | |
2004 | 2004 |
|
2005 | 2005 |
var comments = (from drawing in this.MemberSet |
2006 | 2006 |
select drawing.DrawingData as CommentUserInfo).ToList(); |
2007 |
UndoCommand.Instance.Execute(comments, this.AngleValue);
|
|
2007 |
UndoCommand.Instance.Push(comments, this.AngleValue);
|
|
2008 | 2008 |
} |
2009 | 2009 |
|
2010 | 2010 |
private void drag_DragCompleted(object sender, DragCompletedEventArgs e) |
... | ... | |
2013 | 2013 |
|
2014 | 2014 |
var comments = (from drawing in this.MemberSet |
2015 | 2015 |
select drawing.DrawingData as CommentUserInfo).ToList(); |
2016 |
UndoCommand.Instance.Execute(comments, this.AngleValue);
|
|
2016 |
UndoCommand.Instance.Push(comments, this.AngleValue);
|
|
2017 | 2017 |
} |
2018 | 2018 |
|
2019 | 2019 |
public void ControlPointMouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
KCOM/Controls/AdornerFinal.xaml.cs.bak | ||
---|---|---|
1 |
using KCOM.Common; |
|
2 |
using MarkupToPDF.Common; |
|
3 |
using MarkupToPDF.Controls.Common; |
|
4 |
using MarkupToPDF.Controls.Etc; |
|
5 |
using MarkupToPDF.Controls.Line; |
|
6 |
using MarkupToPDF.Controls.Polygon; |
|
7 |
using MarkupToPDF.Controls.Shape; |
|
8 |
using MarkupToPDF.Controls.Text; |
|
9 |
using System; |
|
10 |
using System.Collections.Generic; |
|
11 |
using System.Linq; |
|
12 |
using System.Reactive.Linq; |
|
13 |
using System.Text; |
|
14 |
using System.Windows; |
|
15 |
using System.Windows.Controls; |
|
16 |
using System.Windows.Controls.Primitives; |
|
17 |
using System.Windows.Input; |
|
18 |
using System.Windows.Media; |
|
19 |
using Telerik.Windows.Controls; |
|
20 |
|
|
21 |
namespace KCOM.Controls |
|
22 |
{ |
|
23 |
/// <summary> |
|
24 |
/// Interaction logic for AdornerFinal.xaml |
|
25 |
/// </summary> |
|
26 |
public class AdornerMember |
|
27 |
{ |
|
28 |
public UIElement DrawingData { get; set; } |
|
29 |
public ControlType Drawingtype { get; set; } |
|
30 |
public double DrawingAngle { get; set; } |
|
31 |
public List<Thumb> ThumbList { get; set; } |
|
32 |
|
|
33 |
} |
|
34 |
public partial class AdornerFinal : UserControl |
|
35 |
{ |
|
36 |
public TextBox editTextBox { get; set; } |
|
37 |
#region 공용 인스턴스 |
|
38 |
public List<AdornerMember> MemberSet { get; set; } |
|
39 |
public Dictionary<Thumb, DragData> _dragData = new Dictionary<Thumb, DragData>(); |
|
40 |
public double AngleValue = 0; |
|
41 |
public bool IsTextAngle = false; |
|
42 |
public Rect BorderSize { get; set; } |
|
43 |
public bool TextCompensation = false; |
|
44 |
public bool isDragging { get; set; } |
|
45 |
public Thumb DraggerThumb { get; set; } |
|
46 |
public RadDropDownButton dropData; |
|
47 |
public RadCalendar dropCalendar; |
|
48 |
public Thumb mainDragThumb { get; set; } |
|
49 |
|
|
50 |
public Point reSizePoint { get; set; } |
|
51 |
#endregion |
|
52 |
#region 생성자 |
|
53 |
private void RadDropDownButton_Loaded(object sender, RoutedEventArgs e) |
|
54 |
{ |
|
55 |
dropData = sender as RadDropDownButton; |
|
56 |
} |
|
57 |
private void Date_Calendar_Loaded(object sender, RoutedEventArgs e) |
|
58 |
{ |
|
59 |
dropCalendar = sender as RadCalendar; |
|
60 |
dropCalendar.SelectionChanged += (sen, ea) => |
|
61 |
{ |
|
62 |
dropData.IsOpen = false; |
|
63 |
if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "DateControl") |
|
64 |
{ |
|
65 |
DateControl data = (MemberSet.First() as AdornerMember).DrawingData as DateControl; |
|
66 |
data.Text = dropCalendar.SelectedDate.Value.ToShortDateString(); |
|
67 |
} |
|
68 |
}; |
|
69 |
} |
|
70 |
public AdornerFinal() |
|
71 |
{ |
|
72 |
InitializeComponent(); |
|
73 |
MemberSet = new List<AdornerMember>(); |
|
74 |
BorderSize = new Rect(); |
|
75 |
_dragData.Add(rotateTop, new DragData() { CursorAngle = 0, DragType = DragType.Rotate, RotateIsLeft = true, RotateIsTop = true }); |
|
76 |
//_dragData.Add(rotateCenter, new DragData() { CursorAngle = 0, DragType = DragType.Rotate, RotateIsLeft = true, RotateIsTop = true }); |
|
77 |
} |
|
78 |
|
|
79 |
void DragThumb_Loaded(object sender, RoutedEventArgs e) |
|
80 |
{ |
|
81 |
mainDragThumb = DragThumb; |
|
82 |
|
|
83 |
} |
|
84 |
|
|
85 |
|
|
86 |
public AdornerFinal(CommentUserInfo objectData) |
|
87 |
: this() |
|
88 |
{ |
|
89 |
InitializeComponent(); |
|
90 |
objectData.IsHitTestVisible = false; |
|
91 |
Canvas.SetZIndex(objectData, 84); |
|
92 |
this.ContainerContent.Children.Add(objectData); |
|
93 |
SetAdornerMember(objectData as CommentUserInfo); |
|
94 |
this.Focus(); |
|
95 |
} |
|
96 |
public AdornerFinal(List<CommentUserInfo> objectData) |
|
97 |
: this() |
|
98 |
{ |
|
99 |
InitializeComponent(); |
|
100 |
foreach (var item in objectData) |
|
101 |
{ |
|
102 |
item.IsHitTestVisible = false; |
|
103 |
this.ContainerContent.Children.Add(item); |
|
104 |
Canvas.SetZIndex(item, 84); |
|
105 |
} |
|
106 |
SetAdornerMember(objectData); |
|
107 |
this.Focus(); |
|
108 |
} |
|
109 |
|
|
110 |
|
|
111 |
#endregion |
|
112 |
#region 메서드 |
|
113 |
public Rect getAdornerSize() |
|
114 |
{ |
|
115 |
return BorderSize; |
|
116 |
} |
|
117 |
public void addMemberControl(UIElement objectData) |
|
118 |
{ |
|
119 |
this.ContainerContent.Children.Add(objectData); |
|
120 |
SetAdornerMember(objectData as CommentUserInfo); |
|
121 |
this.Focus(); |
|
122 |
} |
|
123 |
/// <summary> |
|
124 |
/// UIElement를 종류에 맞게 등록시킴 |
|
125 |
/// </summary> |
|
126 |
/// <param name="member">UIElement 타입으로 BaseLayer에 있는 것들이 들어옵니다.</param> |
|
127 |
public void SetAdornerMember(MarkupToPDF.Common.CommentUserInfo member) |
|
128 |
{ |
|
129 |
|
|
130 |
switch (member.GetType().Name) |
|
131 |
{ |
|
132 |
#region 컨트롤 조건 |
|
133 |
case "LineControl": //Angle추가 안했음 |
|
134 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.SingleLine, ThumbList = new List<Thumb>() }); |
|
135 |
break; |
|
136 |
case "ImgControl": //Angle추가 안했음 |
|
137 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ImgControl, ThumbList = new List<Thumb>() }); |
|
138 |
//AdornerBorder.RenderTransformOrigin = new Point(0.5, 0.5); |
|
139 |
//DragThumb.RenderTransformOrigin = new Point(0.5, 0.5); |
|
140 |
AngleValue = (member as ImgControl).Angle; |
|
141 |
break; |
|
142 |
//case "SymControl": //Angle추가 안했음 |
|
143 |
// MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = MarkupType.Viewbox, ThumbList = new List<Thumb>() }); |
|
144 |
// AngleValue = (member as SymControl).Angle; |
|
145 |
// //ViewBoxRotate(member); |
|
146 |
// break; |
|
147 |
//case "SymControlN": //Angle추가 안했음 |
|
148 |
// MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = MarkupType.Viewbox, ThumbList = new List<Thumb>() }); |
|
149 |
// AngleValue = (member as SymControlN).Angle; |
|
150 |
// //ViewBoxRotate(member); |
|
151 |
// break; |
|
152 |
case "PolygonControl": //Angle추가 안했음 |
|
153 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.PolygonControl, ThumbList = new List<Thumb>() }); |
|
154 |
break; |
|
155 |
case "ArrowControl": |
|
156 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowLine, ThumbList = new List<Thumb>() }); |
|
157 |
break; |
|
158 |
case "ArrowTextControl": |
|
159 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowTextControl, ThumbList = new List<Thumb>() }); |
|
160 |
(member as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
|
161 |
|
|
162 |
Observable.FromEventPattern(((ArrowTextControl)member).Base_TextBox, "LostFocus").Subscribe(a => |
|
163 |
{ |
|
164 |
TextCompensation = false; |
|
165 |
BorderUpdate(); |
|
166 |
if ((a.Sender as TextBox).Text == "") //보류 |
|
167 |
{ |
|
168 |
this.ContainerContent.Children.Remove(member); |
|
169 |
this.Visibility = Visibility.Collapsed; |
|
170 |
} |
|
171 |
}); |
|
172 |
break; |
|
173 |
case "ArcControl": |
|
174 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArcLine, ThumbList = new List<Thumb>() }); |
|
175 |
break; |
|
176 |
case "ArrowControl_Multi": |
|
177 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowMultiLine, ThumbList = new List<Thumb>() }); |
|
178 |
break; |
|
179 |
case "RectangleControl": |
|
180 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Rectangle, ThumbList = new List<Thumb>() }); |
|
181 |
break; |
|
182 |
case "DateControl": |
|
183 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Date, ThumbList = new List<Thumb>() }); |
|
184 |
AngleValue = (member as DateControl).Angle; |
|
185 |
break; |
|
186 |
case "TriControl": |
|
187 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Triangle, ThumbList = new List<Thumb>() }); |
|
188 |
break; |
|
189 |
case "CircleControl": |
|
190 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Circle, ThumbList = new List<Thumb>() }); |
|
191 |
break; |
|
192 |
case "CloudControl": |
|
193 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.PolygonCloud, ThumbList = new List<Thumb>() }); |
|
194 |
break; |
|
195 |
case "RectCloudControl": |
|
196 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.RectCloud, ThumbList = new List<Thumb>() }); |
|
197 |
break; |
|
198 |
//강인구 추가 |
|
199 |
case "SignControl": |
|
200 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Sign, ThumbList = new List<Thumb>() }); |
|
201 |
AngleValue = (member as SignControl).Angle; |
|
202 |
break; |
|
203 |
//강인구 추가 |
|
204 |
case "SymControl": |
|
205 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Symbol, ThumbList = new List<Thumb>() }); |
|
206 |
AngleValue = (member as SymControl).Angle; |
|
207 |
break; |
|
208 |
//강인구 추가 |
|
209 |
case "SymControlN": |
|
210 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Stamp, ThumbList = new List<Thumb>() }); |
|
211 |
AngleValue = (member as SymControlN).Angle; |
|
212 |
break; |
|
213 |
case "InkControl": //Angle추가 안했음 |
|
214 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Ink, ThumbList = new List<Thumb>() }); |
|
215 |
break; |
|
216 |
case "TextControl": |
|
217 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.TextControl, ThumbList = new List<Thumb>() }); |
|
218 |
RectangleGeometry Data = new RectangleGeometry |
|
219 |
{ |
|
220 |
Rect = new Rect() |
|
221 |
{ |
|
222 |
X = Canvas.GetLeft((member as TextControl)), |
|
223 |
Y = Canvas.GetTop((member as TextControl)), |
|
224 |
Width = (member as TextControl).Base_TextBlock.ActualWidth / 2, |
|
225 |
Height = (member as TextControl).Base_TextBlock.ActualHeight / 2, |
|
226 |
//Width = (member as TextControl).BoxWidth / 2, |
|
227 |
//Height = (member as TextControl).BoxHeight / 2, |
|
228 |
} |
|
229 |
}; |
|
230 |
Point endPointV = new Point(Data.Bounds.Right, Data.Bounds.Bottom); |
|
231 |
Point middle = MathSet.getMiddlePoint((member as TextControl).StartPoint, endPointV); |
|
232 |
|
|
233 |
|
|
234 |
DragThumb.RenderTransformOrigin = new Point(0.0, 0.0); |
|
235 |
DragThumb.RenderTransform = new RotateTransform() |
|
236 |
{ |
|
237 |
Angle = (member as TextControl).Angle, |
|
238 |
//CenterX = middle.X, |
|
239 |
//CenterY = middle.Y, |
|
240 |
}; |
|
241 |
|
|
242 |
AdornerBorder.RenderTransformOrigin = new Point(0.0, 0.0); |
|
243 |
AdornerBorder.RenderTransform = new RotateTransform() |
|
244 |
{ |
|
245 |
Angle = (member as TextControl).Angle, |
|
246 |
//CenterX = middle.X, |
|
247 |
//CenterY = middle.Y, |
|
248 |
}; |
|
249 |
Observable.FromEventPattern(((TextControl)member), "PropertyChanged").Subscribe(a => |
|
250 |
{ |
|
251 |
TextCompensation = true; |
|
252 |
BorderUpdate(); |
|
253 |
((TextControl)member).Base_TextBlock.TextDecorations = ((TextControl)member).UnderLine; |
|
254 |
}); |
|
255 |
Observable.FromEventPattern(((TextControl)member).Base_TextBox, "LostFocus").Subscribe(a => |
|
256 |
{ |
|
257 |
TextCompensation = false; |
|
258 |
BorderUpdate(); |
|
259 |
if ((a.Sender as TextBox).Text == "") //보류 |
|
260 |
{ |
|
261 |
this.ContainerContent.Children.Remove(member); |
|
262 |
this.Visibility = Visibility.Collapsed; |
|
263 |
} |
|
264 |
|
|
265 |
//((TextControl)member).UnEditingMode(); |
|
266 |
//((TextControl)member).Base_TextBlock.Visibility = Visibility.Collapsed; |
|
267 |
//((TextControl)member).Base_Border.Visibility = Visibility.Collapsed; |
|
268 |
//((TextControl)member).Base_TextPath.Visibility = Visibility.Collapsed; |
|
269 |
}); |
|
270 |
break; |
|
271 |
default: |
|
272 |
break; |
|
273 |
#endregion |
|
274 |
} |
|
275 |
if (member.GetType().Name == "TextControl") |
|
276 |
{ |
|
277 |
TextControl content = ((TextControl)member); |
|
278 |
content.StartPoint = new Point(Canvas.GetLeft(content), Canvas.GetTop(content)); |
|
279 |
content.EndPoint = content.StartPoint; |
|
280 |
|
|
281 |
//RegistryPoint(AllControl.PointSet); |
|
282 |
} |
|
283 |
else |
|
284 |
{ |
|
285 |
RegistryPoint(member); |
|
286 |
} |
|
287 |
BorderUpdate(); |
|
288 |
} |
|
289 |
|
|
290 |
private void ViewBoxRotate(UIElement member) |
|
291 |
{ |
|
292 |
AdornerBorder.RenderTransformOrigin = new Point(0.5, 0.5); |
|
293 |
DragThumb.RenderTransformOrigin = new Point(0.5, 0.5); |
|
294 |
AdornerBorder.RenderTransform = new RotateTransform() { Angle = (member as IViewBox).Angle }; |
|
295 |
DragThumb.RenderTransform = new RotateTransform() { Angle = (member as IViewBox).Angle }; |
|
296 |
} |
|
297 |
public void SetAdornerMember(List<CommentUserInfo> members) |
|
298 |
{ |
|
299 |
foreach (var member in members) |
|
300 |
{ |
|
301 |
switch (member.GetType().Name) |
|
302 |
{ |
|
303 |
#region 컨트롤 조건 |
|
304 |
case "LineControl": //Angle추가 안했음 |
|
305 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.SingleLine, ThumbList = new List<Thumb>() }); |
|
306 |
break; |
|
307 |
case "ImgControl": //Angle추가 안했음 |
|
308 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ImgControl, ThumbList = new List<Thumb>() }); |
|
309 |
break; |
|
310 |
//case "SymControl": //Angle추가 안했음 |
|
311 |
// MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = MarkupType.Viewbox, ThumbList = new List<Thumb>() }); |
|
312 |
// break; |
|
313 |
//case "SymControlN": //Angle추가 안했음 |
|
314 |
// MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = MarkupType.Viewbox, ThumbList = new List<Thumb>() }); |
|
315 |
// ViewBoxRotate(member); |
|
316 |
// break; |
|
317 |
case "ArrowControl": |
|
318 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowLine, ThumbList = new List<Thumb>() }); |
|
319 |
break; |
|
320 |
case "PolygonControl": //Angle추가 안했음 |
|
321 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.PolygonControl, ThumbList = new List<Thumb>() }); |
|
322 |
break; |
|
323 |
case "ArrowTextControl": |
|
324 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowTextControl, ThumbList = new List<Thumb>() }); |
|
325 |
(member as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
|
326 |
break; |
|
327 |
case "ArcControl": |
|
328 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArcLine, ThumbList = new List<Thumb>() }); |
|
329 |
break; |
|
330 |
case "DateControl": |
|
331 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Date, ThumbList = new List<Thumb>() }); |
|
332 |
break; |
|
333 |
case "ArrowControl_Multi": |
|
334 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowMultiLine, ThumbList = new List<Thumb>() }); |
|
335 |
break; |
|
336 |
case "RectangleControl": |
|
337 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Rectangle, ThumbList = new List<Thumb>() }); |
|
338 |
break; |
|
339 |
case "TriControl": |
|
340 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Triangle, ThumbList = new List<Thumb>() }); |
|
341 |
break; |
|
342 |
case "CircleControl": |
|
343 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Circle, ThumbList = new List<Thumb>() }); |
|
344 |
break; |
|
345 |
case "CloudControl": |
|
346 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.PolygonCloud, ThumbList = new List<Thumb>() }); |
|
347 |
break; |
|
348 |
case "RectCloudControl": |
|
349 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.RectCloud, ThumbList = new List<Thumb>() }); |
|
350 |
break; |
|
351 |
//강인구 추가 |
|
352 |
case "SignControl": |
|
353 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Sign, ThumbList = new List<Thumb>() }); |
|
354 |
break; |
|
355 |
case "SymControl": |
|
356 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Symbol, ThumbList = new List<Thumb>() }); |
|
357 |
break; |
|
358 |
case "SymControlN": |
|
359 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Stamp, ThumbList = new List<Thumb>() }); |
|
360 |
break; |
|
361 |
case "InkControl": //Angle추가 안했음 |
|
362 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Ink, ThumbList = new List<Thumb>() }); |
|
363 |
break; |
|
364 |
case "TextControl": |
|
365 |
MemberSet.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.TextControl, ThumbList = new List<Thumb>() }); |
|
366 |
Observable.FromEventPattern(((TextControl)member), "PropertyChanged").Subscribe(a => |
|
367 |
{ |
|
368 |
BorderUpdate(); |
|
369 |
try |
|
370 |
{ |
|
371 |
((TextControl)member).Base_TextBlock.TextDecorations = ((TextControl)member).UnderLine; //확인 0403 |
|
372 |
} |
|
373 |
catch (Exception) |
|
374 |
{ |
|
375 |
|
|
376 |
} |
|
377 |
|
|
378 |
}); |
|
379 |
Observable.FromEventPattern(((TextControl)member).Base_TextBox, "SelectionChanged").Subscribe(a => |
|
380 |
{ |
|
381 |
BorderUpdate(); |
|
382 |
}); |
|
383 |
break; |
|
384 |
default: |
|
385 |
break; |
|
386 |
#endregion |
|
387 |
} |
|
388 |
if (member.GetType().Name == "TextControl") |
|
389 |
{ |
|
390 |
//강인구 추가 |
|
391 |
TextControl content = ((TextControl)member); |
|
392 |
content.StartPoint = new Point(Canvas.GetLeft(content), Canvas.GetTop(content)); |
|
393 |
content.EndPoint = content.StartPoint; |
|
394 |
//RegistryPoint(AllControl.PointSet); |
|
395 |
} |
|
396 |
else |
|
397 |
{ |
|
398 |
RegistryPoint(member); |
|
399 |
} |
|
400 |
} |
|
401 |
|
|
402 |
BorderUpdate(); |
|
403 |
} |
|
404 |
|
|
405 |
/// <summary> |
|
406 |
/// Border 를 갱신 |
|
407 |
/// </summary> |
|
408 |
public void BorderUpdate() |
|
409 |
{ |
|
410 |
AdornerBorder.MinWidth = 10; |
|
411 |
AdornerBorder.MinHeight = 10; |
|
412 |
|
|
413 |
double minX = 10000; |
|
414 |
double minY = 10000; |
|
415 |
double maxX = 0; |
|
416 |
double maxY = 0; |
|
417 |
|
|
418 |
if (MemberSet.Count == 1) |
|
419 |
{ |
|
420 |
if (MemberSet.First().DrawingData.GetType().Name == "TextControl") |
|
421 |
{ |
|
422 |
if ((MemberSet.First().DrawingData as TextControl).Angle != 0) |
|
423 |
{ |
|
424 |
trRotate.Angle = (MemberSet.First().DrawingData as TextControl).Angle; |
|
425 |
trRotateThumb.Angle = (MemberSet.First().DrawingData as TextControl).Angle; |
|
426 |
} |
|
427 |
else |
|
428 |
{ |
|
429 |
trRotate.Angle = 0; |
|
430 |
trRotateThumb.Angle = 0; |
|
431 |
} |
|
432 |
} |
|
433 |
} |
|
434 |
foreach (var item in MemberSet) |
|
435 |
{ |
|
436 |
UIElement currentControl = (item as AdornerMember).DrawingData; |
|
437 |
if (item.DrawingData.GetType().Name == "TextControl") |
|
438 |
{ |
|
439 |
double textControlWidth; |
|
440 |
double textControlHeight; |
|
441 |
if (((currentControl as TextControl).Base_TextBox.ActualWidth) == 0) |
|
442 |
{ |
|
443 |
textControlWidth = ((currentControl as TextControl).Base_TextBlock.ActualWidth); |
|
444 |
textControlHeight = ((currentControl as TextControl).Base_TextBlock.ActualHeight); |
|
445 |
} |
|
446 |
else |
|
447 |
{ |
|
448 |
textControlWidth = ((currentControl as TextControl).Base_TextBox.ActualWidth); |
|
449 |
textControlHeight = ((currentControl as TextControl).Base_TextBox.ActualHeight); |
|
450 |
} |
|
451 |
if ((currentControl as TextControl).LineSize.Left == 0) |
|
452 |
{ |
|
453 |
if (TextCompensation) |
|
454 |
{ |
|
455 |
|
|
456 |
textControlWidth += 1; |
|
457 |
textControlHeight += 1; |
|
458 |
} |
|
459 |
else |
|
460 |
{ |
|
461 |
textControlWidth += 3; |
|
462 |
textControlHeight += 3; |
|
463 |
} |
|
464 |
} |
|
465 |
else |
|
466 |
{ |
|
467 |
if (TextCompensation) |
|
468 |
{ |
|
469 |
|
|
470 |
textControlWidth += 1; |
|
471 |
textControlHeight += 1; |
|
472 |
} |
|
473 |
else |
|
474 |
{ |
|
475 |
textControlWidth += 8; |
|
476 |
textControlHeight += 8; |
|
477 |
} |
|
478 |
|
|
479 |
} |
|
480 |
if ((currentControl as TextControl).EndPoint.X < minX) |
|
481 |
{ |
|
482 |
minX = (currentControl as TextControl).EndPoint.X; |
|
483 |
} |
|
484 |
if ((currentControl as TextControl).EndPoint.Y < minY) |
|
485 |
{ |
|
486 |
minY = (currentControl as TextControl).EndPoint.Y; |
|
487 |
} |
|
488 |
if (textControlWidth + (currentControl as TextControl).EndPoint.X > maxX) |
|
489 |
{ |
|
490 |
maxX = textControlWidth + (currentControl as TextControl).EndPoint.X; |
|
491 |
} |
|
492 |
if (textControlHeight + (currentControl as TextControl).EndPoint.Y > maxY) |
|
493 |
{ |
|
494 |
maxY = textControlHeight + (currentControl as TextControl).EndPoint.Y; |
|
495 |
} |
|
496 |
} |
|
497 |
else if ((currentControl as IViewBox) != null) |
|
498 |
{ |
|
499 |
IViewBox instance = currentControl as IViewBox; |
|
500 |
List<Point> am = (currentControl as IPath).PointSet; |
|
501 |
List<double> xSet = am.Select(p => p.X).ToList(); |
|
502 |
List<double> ySet = am.Select(p => p.Y).ToList(); |
|
503 |
if (xSet.Min() < minX) minX = xSet.Min(); |
|
504 |
if (ySet.Min() < minY) minY = ySet.Min(); |
|
505 |
if (xSet.Max() > maxX) maxX = xSet.Max(); |
|
506 |
if (ySet.Max() > maxY) maxY = ySet.Max(); |
|
507 |
} |
|
508 |
else if ((currentControl as IPath).PathData == null) |
|
509 |
{ |
|
510 |
Rect rt = new Rect |
|
511 |
{ |
|
512 |
X = (currentControl as IPath).StartPoint.X, |
|
513 |
Y = (currentControl as IPath).StartPoint.Y, |
|
514 |
//Width = (currentControl as IPath).EndPoint.X - (currentControl as IPath).StartPoint.X, |
|
515 |
//Height = (currentControl as IPath).EndPoint.Y - (currentControl as IPath).StartPoint.Y |
|
516 |
Width = Math.Max((currentControl as IPath).EndPoint.X, (currentControl as IPath).StartPoint.X) - Math.Min((currentControl as IPath).EndPoint.X, (currentControl as IPath).StartPoint.X), |
|
517 |
Height = Math.Max((currentControl as IPath).EndPoint.Y, (currentControl as IPath).StartPoint.Y) - Math.Min((currentControl as IPath).EndPoint.Y, (currentControl as IPath).StartPoint.Y), |
|
518 |
}; |
|
519 |
if (rt.Left < minX) minX = rt.Left; |
|
520 |
if (rt.Top < minY) minY = rt.Top; |
|
521 |
if (rt.Right > maxX) maxX = rt.Right; |
|
522 |
if (rt.Bottom > maxY) maxY = rt.Bottom; |
|
523 |
} |
|
524 |
else if ((currentControl as IPath) == null) |
|
525 |
{ |
|
526 |
Rect rt = new Rect |
|
527 |
{ |
|
528 |
X = (currentControl as IPath).StartPoint.X, |
|
529 |
Y = (currentControl as IPath).StartPoint.Y, |
|
530 |
Width = (currentControl as IPath).EndPoint.X - (currentControl as IPath).StartPoint.X, |
|
531 |
Height = (currentControl as IPath).EndPoint.Y - (currentControl as IPath).StartPoint.Y |
|
532 |
}; |
|
533 |
if (rt.Left < minX) minX = rt.Left; |
|
534 |
if (rt.Top < minY) minY = rt.Top; |
|
535 |
if (rt.Right > maxX) maxX = rt.Right; |
|
536 |
if (rt.Bottom > maxY) maxY = rt.Bottom; |
|
537 |
} |
|
538 |
else if ((currentControl as CircleControl) != null) |
|
539 |
{ |
|
540 |
//Rect rt = new Rect |
|
541 |
//{ |
|
542 |
// X = (currentControl as IPath).StartPoint.X, |
|
543 |
// Y = (currentControl as IPath).StartPoint.Y, |
|
544 |
// Width = (currentControl as IPath).EndPoint.X - (currentControl as IPath).StartPoint.X, |
|
545 |
// Height = (currentControl as IPath).EndPoint.Y - (currentControl as IPath).StartPoint.Y |
|
546 |
//}; |
|
547 |
|
|
548 |
//Rect rt = new Rect((currentControl as IPath).StartPoint, (currentControl as IPath).EndPoint); |
|
549 |
//if (rt.Left < minX) minX = rt.Left; |
|
550 |
//if (rt.Top < minY) minY = rt.Top; |
|
551 |
//if (rt.Right > maxX) maxX = rt.Right; |
|
552 |
//if (rt.Bottom > maxY) maxY = rt.Bottom; |
|
553 |
|
|
554 |
List<Point> am = (currentControl as IPath).PointSet; |
|
555 |
List<double> xSet = am.Select(p => p.X).ToList(); |
|
556 |
List<double> ySet = am.Select(p => p.Y).ToList(); |
|
557 |
if (xSet.Min() < minX) minX = xSet.Min(); |
|
558 |
if (ySet.Min() < minY) minY = ySet.Min(); |
|
559 |
if (xSet.Max() > maxX) maxX = xSet.Max(); |
|
560 |
if (ySet.Max() > maxY) maxY = ySet.Max(); |
|
561 |
} |
|
562 |
else |
|
563 |
{ |
|
564 |
if ((currentControl as IPath).PathData.Bounds.Left < minX) minX = (currentControl as IPath).PathData.Bounds.Left; |
|
565 |
if ((currentControl as IPath).PathData.Bounds.Top < minY) minY = (currentControl as IPath).PathData.Bounds.Top; |
|
566 |
if ((currentControl as IPath).PathData.Bounds.Right > maxX) maxX = (currentControl as IPath).PathData.Bounds.Right; |
|
567 |
if ((currentControl as IPath).PathData.Bounds.Bottom > maxY) maxY = (currentControl as IPath).PathData.Bounds.Bottom; |
|
568 |
} |
|
569 |
} |
|
570 |
|
|
571 |
Rect ac = new Rect(minX, minY, maxX - minX, maxY - minY); |
|
572 |
bool addWidthSize = false; |
|
573 |
bool addHeightSize = false; |
|
574 |
if (ac.Width <= 10) |
|
575 |
{ |
|
576 |
ac.Width += 10; |
|
577 |
addWidthSize = true; |
|
578 |
} |
|
579 |
if (ac.Height <= 10) |
|
580 |
{ |
|
581 |
ac.Height += 10; |
|
582 |
addHeightSize = true; |
|
583 |
} |
|
584 |
BorderSize = ac; |
|
585 |
AdornerBorder.MinWidth = 10; |
|
586 |
AdornerBorder.MinHeight = 10; |
|
587 |
AdornerBorder.Width = ac.Width; |
|
588 |
AdornerBorder.Height = ac.Height; |
|
589 |
Canvas.SetLeft(AdornerBorder, minX); |
|
590 |
Canvas.SetTop(AdornerBorder, minY); |
|
591 |
|
|
592 |
DragThumb.Width = ac.Width; |
|
593 |
DragThumb.Height = ac.Height; |
|
594 |
|
|
595 |
DragThumb.MinWidth = 10; |
|
596 |
DragThumb.MinHeight = 10; |
|
597 |
if (addWidthSize) |
|
598 |
{ |
|
599 |
Canvas.SetLeft(DragThumb, minX - 5); |
|
600 |
} |
|
601 |
else |
|
602 |
{ |
|
603 |
Canvas.SetLeft(DragThumb, minX); |
|
604 |
} |
|
605 |
|
|
606 |
if (addHeightSize) |
|
607 |
{ |
|
608 |
Canvas.SetTop(DragThumb, minY - 5); |
|
609 |
} |
|
610 |
else |
|
611 |
{ |
|
612 |
Canvas.SetTop(DragThumb, minY); |
|
613 |
} |
|
614 |
} |
|
615 |
/// <summary> |
|
616 |
/// UIElement 해제 |
|
617 |
/// </summary> |
|
618 |
public void unRegister() |
|
619 |
{ |
|
620 |
foreach (var item in this.ContainerContent.Children) |
|
621 |
{ |
|
622 |
if (item is MarkupToPDF.Common.CommentUserInfo) |
|
623 |
{ |
|
624 |
(item as MarkupToPDF.Common.CommentUserInfo).IsHitTestVisible = true; |
|
625 |
} |
|
626 |
} |
|
627 |
this.ContainerContent.Children.Clear(); |
|
628 |
} |
|
629 |
/// <summary> |
|
630 |
/// 각 포인트들을 등록합니다. |
|
631 |
/// </summary> |
|
632 |
/// <param name="pointset">Drawing Point</param> |
|
633 |
public void RegistryPoint(CommentUserInfo member) |
|
634 |
{ |
|
635 |
int count = 0; |
|
636 |
double Minx = 100000000; |
|
637 |
double Miny = 100000000; |
|
638 |
List<Point> list = (member as IPath).PointSet; |
|
639 |
if (member.GetType().Name == "InkControl") |
|
640 |
{ |
|
641 |
list.Clear(); |
|
642 |
list.Add(new Point((member as IPath).PathData.Bounds.X, (member as IPath).PathData.Bounds.Y)); |
|
643 |
list.Add(new Point((member as IPath).PathData.Bounds.Left, (member as IPath).PathData.Bounds.Bottom)); |
|
644 |
list.Add(new Point((member as IPath).PathData.Bounds.Right, (member as IPath).PathData.Bounds.Bottom)); |
|
645 |
list.Add(new Point((member as IPath).PathData.Bounds.Right, (member as IPath).PathData.Bounds.Top)); |
|
646 |
} |
|
647 |
ControlType markT = MemberSet.Where(p => p.DrawingData == member).First().Drawingtype; |
|
648 |
foreach (var ax in list) |
|
649 |
{ |
|
650 |
Minx = (ax.X < Minx) ? ax.X : Minx; |
|
651 |
Miny = (ax.Y < Miny) ? ax.Y : Miny; |
|
652 |
} |
|
653 |
for (int i = 0; i < list.Count(); i++) |
|
654 |
{ |
|
655 |
Thumb tm = new Thumb |
|
656 |
{ |
|
657 |
//Name = String.Format("thumb{0}_{1}", count, member.GetType().Name.ToString()), |
|
658 |
Style = (Style)this.LayoutRoot.Resources["ThumbResizeStyle"], |
|
659 |
}; |
|
660 |
|
|
661 |
MemberSet.Last().ThumbList.Add(tm); |
|
662 |
|
|
663 |
if (markT == ControlType.ArcLine && list[i] == (member as ArcControl).MidPoint) |
|
664 |
{ |
|
665 |
tm.Style = (Style)this.LayoutRoot.Resources["ThumbArcControlStyle"]; |
|
666 |
} |
|
667 |
if (member.GetType().Name == "ArrowTextControl" && i == 1) |
|
668 |
{ |
|
669 |
//if (MemberSet.Count()<=1) |
|
670 |
//{ |
|
671 |
tm.Style = (Style)this.LayoutRoot.Resources["ThumbArcControlStyle"]; |
|
672 |
List<Point> ps = new List<Point>(); |
|
673 |
|
|
674 |
if ((MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl != null) |
|
675 |
{ |
|
676 |
var temp = (MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl; |
|
677 |
|
|
678 |
|
|
679 |
switch (Math.Abs(temp.Angle).ToString()) |
|
680 |
{ |
|
681 |
case "90": |
|
682 |
{ |
|
683 |
ps.Clear(); |
|
684 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽 |
|
685 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); // 위 중간 |
|
686 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); // 위 오른쪽 |
|
687 |
|
|
688 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 중간 |
|
689 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 하단 |
|
690 |
|
|
691 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); //중간 하단 |
|
692 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 하단 |
|
693 |
|
|
694 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 중간 |
|
695 |
} |
|
696 |
break; |
|
697 |
case "270": |
|
698 |
{ |
|
699 |
ps.Clear(); |
|
700 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽 |
|
701 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); // 위 중간 |
|
702 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); // 위 오른쪽 |
|
703 |
|
|
704 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 중간 |
|
705 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 하단 |
|
706 |
|
|
707 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); //중간 하단 |
|
708 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 하단 |
|
709 |
|
|
710 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 중간 |
|
711 |
} |
|
712 |
break; |
|
713 |
default: |
|
714 |
{ |
|
715 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단 |
|
716 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단 |
|
717 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단 |
|
718 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //우단 |
|
719 |
} |
|
720 |
break; |
|
721 |
} |
|
722 |
|
|
723 |
ArrowTextControl instance = (member as ArrowTextControl); |
|
724 |
if (instance.isTrans) |
|
725 |
{ |
|
726 |
//var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
|
727 |
//var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP); |
|
728 |
//list[count] = tempP; |
|
729 |
list[count] = temp.MidPoint; |
|
730 |
} |
|
731 |
else |
|
732 |
{ |
|
733 |
if (temp.isFixed) |
|
734 |
{ |
|
735 |
var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
|
736 |
var testP = endP; |
|
737 |
if (ps[0] == endP) //상단 |
|
738 |
{ |
|
739 |
testP = new Point(endP.X, endP.Y - 50); |
|
740 |
} |
|
741 |
else if (ps[1] == endP) //하단 |
|
742 |
{ |
|
743 |
testP = new Point(endP.X, endP.Y + 50); |
|
744 |
} |
|
745 |
else if (ps[2] == endP) //좌단 |
|
746 |
{ |
|
747 |
testP = new Point(endP.X - 50, endP.Y); |
|
748 |
} |
|
749 |
else if (ps[3] == endP) //우단 |
|
750 |
{ |
|
751 |
testP = new Point(endP.X + 50, endP.Y); |
|
752 |
} |
|
753 |
list[count] = testP; |
|
754 |
} |
|
755 |
else |
|
756 |
{ |
|
757 |
var endP = MathSet.getNearPoint(ps, instance.MidPoint); |
|
758 |
list[count] = MathSet.getMiddlePoint(instance.StartPoint, endP); |
|
759 |
} |
|
760 |
} |
|
761 |
} |
|
762 |
} |
|
763 |
if (member.GetType().Name == "ArrowTextControl" && list[i] == list.Last()) |
|
764 |
{ |
|
765 |
tm.Style = (Style)this.LayoutRoot.Resources["ThumbTextStyle"]; |
|
766 |
tm.Width = (member as ArrowTextControl).BoxWidth; |
|
767 |
tm.Height = (member as ArrowTextControl).BoxHeight; |
|
768 |
var angle = (member as ArrowTextControl).Angle; |
|
769 |
if (Math.Abs(angle).ToString() == "90") |
|
770 |
{ |
|
771 |
tm.RenderTransformOrigin = new Point(0, 0); |
|
772 |
tm.RenderTransform = new RotateTransform { Angle = 270 }; |
|
773 |
} |
|
774 |
else if (Math.Abs(angle).ToString() == "270") |
|
775 |
{ |
|
776 |
tm.RenderTransformOrigin = new Point(0, 0); |
|
777 |
tm.RenderTransform = new RotateTransform { Angle = 90 }; |
|
778 |
|
|
779 |
} |
|
780 |
else |
|
781 |
{ |
|
782 |
tm.RenderTransformOrigin = new Point(0.5, 0.5); |
|
783 |
tm.RenderTransform = new RotateTransform() |
|
784 |
{ |
|
785 |
Angle = angle, |
|
786 |
}; |
|
787 |
} |
|
788 |
|
|
789 |
|
|
790 |
|
|
791 |
} |
|
792 |
//if (markT == MarkupType.Polygon || markT == MarkupType.Cloud) |
|
793 |
//{ |
|
794 |
// tm.MouseMove += new MouseEventHandler(resize_MouseMove); |
|
795 |
// tm.DragStarted += new DragStartedEventHandler(tm_DragStarted); |
|
796 |
// tm.DragCompleted += new DragCompletedEventHandler(tm_DragCompleted); |
|
797 |
//} |
|
798 |
//else |
|
799 |
//{ |
|
800 |
// tm.MouseMove += new MouseEventHandler(resize_MouseMove); |
|
801 |
// tm.DragStarted += new DragStartedEventHandler(tm_DragStarted); |
|
802 |
// tm.DragCompleted += new DragCompletedEventHandler(tm_DragCompleted); |
|
803 |
//} |
|
804 |
|
|
805 |
if (member.GetType().Name == "PolygonControl" || member.GetType().Name == "CloudControl") |
|
806 |
{ |
|
807 |
if (i == list.Count()-1) |
|
808 |
{ |
|
809 |
tm.Visibility = System.Windows.Visibility.Collapsed; |
|
810 |
} |
|
811 |
} |
|
812 |
if (member.GetType().Name == "InkControl") |
|
813 |
{ |
|
814 |
//tm.Visibility = System.Windows.Visibility.Collapsed; |
|
815 |
} |
|
816 |
this.ContainerContent.Children.Add(tm); |
|
817 |
Canvas.SetLeft(tm, list[count].X); |
|
818 |
Canvas.SetTop(tm, list[count].Y); |
|
819 |
if (member.GetType().Name == "ArrowTextControl" && list[i] == (member as ArrowTextControl).MidPoint) |
|
820 |
{ |
|
821 |
Canvas.SetZIndex(tm, 95); |
|
822 |
} |
|
823 |
else |
|
824 |
{ |
|
825 |
Canvas.SetZIndex(tm, 99); |
|
826 |
} |
|
827 |
|
|
828 |
tm.DragStarted += new DragStartedEventHandler(tm_DragStarted); |
|
829 |
tm.DragCompleted += new DragCompletedEventHandler(tm_DragCompleted); |
|
830 |
tm.DragDelta += ResizeTm_DragDelta; |
|
831 |
tm.MouseMove += new MouseEventHandler(resize_MouseMove); |
|
832 |
count++; |
|
833 |
} |
|
834 |
} |
|
835 |
|
|
836 |
private void ResizeTm_DragDelta(object sender, DragDeltaEventArgs e) |
|
837 |
{ |
|
838 |
//한개 이상 선택 시 Resize 금지 |
|
839 |
if (MemberSet.Count > 1) |
|
840 |
return; |
|
841 |
if (reSizePoint != new Point(0, 0)) |
|
842 |
{ |
|
843 |
Thumb thumb = sender as Thumb; |
|
844 |
|
|
845 |
Canvas.SetLeft(thumb, Canvas.GetLeft(thumb) + |
|
846 |
e.HorizontalChange); |
|
847 |
Canvas.SetTop(thumb, Canvas.GetTop(thumb) + |
|
848 |
e.VerticalChange); |
|
849 |
|
|
850 |
Point setPoint = new Point(Canvas.GetLeft(thumb), Canvas.GetTop(thumb)); |
|
851 |
|
|
852 |
//if (this.isDragging && MemberSet.Count <= 1) |
|
853 |
//if (thumb.IsDragging && MemberSet.Count <= 1 && DraggerThumb == thumb) |
|
854 |
//if (DraggerThumb == thumb) |
|
855 |
//{ |
|
856 |
//Point setPoint = reSizePoint; |
|
857 |
//Canvas.SetLeft(thumb, setPoint.X); |
|
858 |
//Canvas.SetTop(thumb, setPoint.Y); |
|
859 |
AdornerMember control = (from userThumb in MemberSet |
|
860 |
where userThumb.ThumbList.Contains(thumb) |
|
861 |
select userThumb).FirstOrDefault(); |
|
862 |
Point nearPoint = new Point(0, 0); |
|
863 |
IPath AllControl = control.DrawingData as IPath; |
|
864 |
if (ControlType.TextControl != control.Drawingtype) |
|
865 |
{ |
|
866 |
|
|
867 |
var temp = (MemberSet.First() as AdornerMember).DrawingData as ArrowTextControl; |
|
868 |
List<Point> ps = new List<Point>(); |
|
869 |
|
|
870 |
nearPoint = MathSet.getNearPoint((control.DrawingData as IPath).PointSet, setPoint); |
|
871 |
//switch (Math.Abs(temp.Angle).ToString()) |
|
872 |
//{ |
|
873 |
|
|
874 |
// case "90": |
|
875 |
// { |
|
876 |
// nearPoint = MathSet.getNearPoint((control.DrawingData as IPath).PointSet, setPoint); |
|
877 |
// } |
|
878 |
// break; |
|
879 |
// case "270": |
|
880 |
// { |
|
881 |
// nearPoint = MathSet.getNearPoint((control.DrawingData as IPath).PointSet, setPoint); |
|
882 |
// } |
|
883 |
// break; |
|
884 |
// default: |
|
885 |
// { |
|
886 |
// nearPoint = MathSet.getNearPoint((control.DrawingData as IPath).PointSet, setPoint); |
|
887 |
// } |
|
888 |
// break; |
|
889 |
//} |
|
890 |
|
|
891 |
} |
|
892 |
for (int i = 0; i < (control.DrawingData as IPath).PointSet.Count; i++) |
|
893 |
{ |
|
894 |
switch (control.Drawingtype) |
|
895 |
{ |
|
896 |
#region Arc + Line |
|
897 |
case ControlType.ArrowMultiLine: |
|
898 |
case ControlType.ArcLine: |
|
899 |
case ControlType.SingleLine: |
|
900 |
case ControlType.Triangle: |
|
901 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
|
902 |
{ |
|
903 |
AllControl.PointSet[i] = setPoint; |
|
904 |
AllControl.updateControl(); |
|
905 |
DynamicThumbUpdate(control); |
|
906 |
BorderUpdate(); |
|
907 |
|
|
908 |
//if (control.DrawingData.GetType().Name == "ArrowTextControl") |
|
909 |
//{ |
|
910 |
// Thumb tm = control.ThumbList.Last(); |
|
911 |
// //Canvas.SetLeft(tm, (AllControl.EndPoint.X - tm.Width / 2)); |
|
912 |
// //Canvas.SetTop(tm, (AllControl.EndPoint.Y - tm.Height / 2)); |
|
913 |
// Canvas.SetLeft(tm, (AllControl.EndPoint.X - tm.Width)); |
|
914 |
// Canvas.SetTop(tm, (AllControl.EndPoint.Y - tm.Height)); |
|
915 |
//} |
|
916 |
} |
|
917 |
break; |
|
918 |
#endregion |
|
919 |
#region Shape |
|
920 |
//case ControlType.PolygonCloud: |
|
921 |
case ControlType.RectCloud: |
|
922 |
case ControlType.Rectangle: |
|
923 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
|
924 |
{ |
|
925 |
AllControl.PointSet[i] = setPoint; |
|
926 |
var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count(); |
|
927 |
var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count(); |
|
928 |
var NextP = (i + 1) % AllControl.PointSet.Count(); |
|
929 |
|
|
930 |
var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]); |
|
931 |
|
|
932 |
var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]); |
|
933 |
var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, |
|
934 |
AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y); |
|
935 |
AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet |
|
936 |
[ReverseP].Y |
|
937 |
+ PreviousV.Y * l); |
|
938 |
|
|
939 |
var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]); |
|
940 |
l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet |
|
941 |
[i].Y - AllControl.PointSet[ReverseP].Y); |
|
942 |
AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y + |
|
943 |
NextV.Y * l); |
|
944 |
AllControl.updateControl(); |
|
945 |
DynamicThumbUpdate(control); |
|
946 |
BorderUpdate(); |
|
947 |
} |
|
948 |
break; |
|
949 |
#endregion |
|
950 |
#region Polygon |
|
951 |
case ControlType.PolygonControl: |
|
952 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
|
953 |
{ |
|
954 |
AllControl.PointSet[i] = setPoint; |
|
955 |
AllControl.updateControl(); |
|
956 |
BorderUpdate(); |
|
957 |
} |
|
958 |
break; |
|
959 |
#endregion |
|
960 |
#region Cicle |
|
961 |
case ControlType.Circle: |
|
962 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
|
963 |
{ |
|
964 |
AllControl.PointSet[i] = setPoint; |
|
965 |
List<Point> newPointSet = new List<Point> { }; |
|
966 |
Point middle = new Point(AllControl.PathData.Bounds.X + AllControl.PathData.Bounds.Width * 0.5, |
|
967 |
AllControl.PathData.Bounds.Y + |
|
968 |
AllControl.PathData.Bounds.Height * 0.5); |
|
969 |
foreach (Point pt in AllControl.PointSet) |
|
970 |
{ |
|
971 |
newPointSet.Add(pt); |
|
972 |
} |
|
973 |
var ReverseP = (i + newPointSet.Count() / 2) % newPointSet.Count(); |
|
974 |
var PreviousP = (i + (newPointSet.Count() - 1)) % newPointSet.Count(); |
|
975 |
var NextP = (i + 1) % newPointSet.Count(); |
|
976 |
var distance = MathSet.DistanceTo(newPointSet[ReverseP], newPointSet[i]); |
|
977 |
var PreviousV = MathSet.GetNormVectorBetween(newPointSet[ReverseP], newPointSet[PreviousP]); |
|
978 |
var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, newPointSet[i].X - newPointSet[ReverseP].X, |
|
979 |
newPointSet[i].Y - newPointSet[ReverseP].Y); |
|
980 |
newPointSet[PreviousP] = new Point(newPointSet[ReverseP].X + PreviousV.X * l, newPointSet[ReverseP].Y |
|
981 |
+ PreviousV.Y * l); |
|
982 |
|
|
983 |
var NextV = MathSet.GetNormVectorBetween(newPointSet[ReverseP], newPointSet[NextP]); |
|
984 |
l = MathSet.DotProduct(NextV.X, NextV.Y, newPointSet[i].X - newPointSet[ReverseP].X, newPointSet[i].Y |
|
985 |
- newPointSet[ReverseP].Y); |
|
986 |
newPointSet[NextP] = new Point(newPointSet[ReverseP].X + NextV.X * l, newPointSet[ReverseP].Y + NextV.Y * l); |
|
987 |
|
|
988 |
AllControl.PointSet = newPointSet; |
|
989 |
DynamicThumbUpdate(control); |
|
990 |
AllControl.updateControl(); |
|
991 |
BorderUpdate(); |
|
992 |
} |
|
993 |
break; |
|
994 |
#endregion |
|
995 |
#region ArrowText |
|
996 |
case ControlType.ArrowTextControl: |
|
997 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
|
998 |
{ |
|
999 |
AllControl.PointSet[i] = setPoint; |
|
1000 |
AllControl.updateControl(); |
|
1001 |
|
|
1002 |
DynamicThumbUpdate(control); |
|
1003 |
BorderUpdate(); |
|
1004 |
|
|
1005 |
//if (control.DrawingData.GetType().Name == "ArrowTextControl") |
|
1006 |
//{ |
|
1007 |
// Thumb tm = control.ThumbList.Last(); |
|
1008 |
// //Canvas.SetLeft(tm, (AllControl.EndPoint.X - tm.Width / 2)); |
|
1009 |
// //Canvas.SetTop(tm, (AllControl.EndPoint.Y - tm.Height / 2)); |
|
1010 |
// Canvas.SetLeft(tm, (AllControl.EndPoint.X - tm.Width)); |
|
1011 |
// Canvas.SetTop(tm, (AllControl.EndPoint.Y - tm.Height)); |
|
1012 |
//} |
|
1013 |
} |
|
1014 |
break; |
|
1015 |
#endregion |
|
1016 |
#region Text |
|
1017 |
case ControlType.TextControl: |
|
1018 |
break; |
|
1019 |
#endregion |
|
1020 |
#region Image |
|
1021 |
case ControlType.ImgControl: |
|
1022 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
|
1023 |
{ |
|
1024 |
AllControl.PointSet[i] = setPoint; |
|
1025 |
var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count(); |
|
1026 |
var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count(); |
|
1027 |
var NextP = (i + 1) % AllControl.PointSet.Count(); |
|
1028 |
|
|
1029 |
var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]); |
|
1030 |
|
|
1031 |
var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]); |
|
1032 |
var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, |
|
1033 |
AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y); |
|
1034 |
AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet |
|
1035 |
[ReverseP].Y |
|
1036 |
+ PreviousV.Y * l); |
|
1037 |
|
|
1038 |
var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]); |
|
1039 |
l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet |
|
1040 |
[i].Y - AllControl.PointSet[ReverseP].Y); |
|
1041 |
AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y + |
|
1042 |
NextV.Y * l); |
|
1043 |
AllControl.updateControl(); |
|
1044 |
DynamicThumbUpdate(control); |
|
1045 |
BorderUpdate(); |
|
1046 |
} |
|
1047 |
break; |
|
1048 |
#endregion |
|
1049 |
//강인구 추가 |
|
1050 |
#region Sign |
|
1051 |
case ControlType.Sign: |
|
1052 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
|
1053 |
{ |
|
1054 |
AllControl.PointSet[i] = setPoint; |
|
1055 |
var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count(); |
|
1056 |
var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count(); |
|
1057 |
var NextP = (i + 1) % AllControl.PointSet.Count(); |
|
1058 |
|
|
1059 |
var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]); |
|
1060 |
|
|
1061 |
var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]); |
|
1062 |
var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, |
|
1063 |
AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y); |
|
1064 |
AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet |
|
1065 |
[ReverseP].Y |
|
1066 |
+ PreviousV.Y * l); |
|
1067 |
|
|
1068 |
var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]); |
|
1069 |
l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet |
|
1070 |
[i].Y - AllControl.PointSet[ReverseP].Y); |
|
1071 |
AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y + |
|
1072 |
NextV.Y * l); |
|
1073 |
AllControl.updateControl(); |
|
1074 |
DynamicThumbUpdate(control); |
|
1075 |
BorderUpdate(); |
|
1076 |
} |
|
1077 |
break; |
|
1078 |
#endregion |
|
1079 |
#region Cloud |
|
1080 |
case ControlType.PolygonCloud: |
|
1081 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
|
1082 |
{ |
|
1083 |
AllControl.PointSet[i] = setPoint; |
|
1084 |
AllControl.updateControl(); |
|
1085 |
((ICloudControl)AllControl).DrawingCloud(); |
|
1086 |
BorderUpdate(); |
|
1087 |
} |
|
1088 |
break; |
|
1089 |
#endregion |
|
1090 |
#region SymBol |
|
1091 |
case ControlType.Symbol: |
|
1092 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
|
1093 |
{ |
|
1094 |
AllControl.PointSet[i] = setPoint; |
|
1095 |
var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count(); |
|
1096 |
var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count(); |
|
1097 |
var NextP = (i + 1) % AllControl.PointSet.Count(); |
|
1098 |
|
|
1099 |
var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]); |
|
1100 |
|
|
1101 |
var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]); |
|
1102 |
var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, |
|
1103 |
AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y); |
|
1104 |
AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet |
|
1105 |
[ReverseP].Y |
|
1106 |
+ PreviousV.Y * l); |
|
1107 |
|
|
1108 |
var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]); |
|
1109 |
l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet |
|
1110 |
[i].Y - AllControl.PointSet[ReverseP].Y); |
|
1111 |
AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y + |
|
1112 |
NextV.Y * l); |
|
1113 |
AllControl.updateControl(); |
|
1114 |
DynamicThumbUpdate(control); |
|
1115 |
BorderUpdate(); |
|
1116 |
} |
|
1117 |
break; |
|
1118 |
case ControlType.Stamp: |
|
1119 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
|
1120 |
{ |
|
1121 |
AllControl.PointSet[i] = setPoint; |
|
1122 |
var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count(); |
|
1123 |
var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count(); |
|
1124 |
var NextP = (i + 1) % AllControl.PointSet.Count(); |
|
1125 |
|
|
1126 |
var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]); |
|
1127 |
|
|
1128 |
var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]); |
|
1129 |
var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, |
|
1130 |
AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y); |
|
1131 |
AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet |
|
1132 |
[ReverseP].Y |
|
1133 |
+ PreviousV.Y * l); |
|
1134 |
|
|
1135 |
var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]); |
|
1136 |
l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet |
|
1137 |
[i].Y - AllControl.PointSet[ReverseP].Y); |
|
1138 |
AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y + |
|
1139 |
NextV.Y * l); |
|
1140 |
AllControl.updateControl(); |
|
1141 |
DynamicThumbUpdate(control); |
|
1142 |
BorderUpdate(); |
|
1143 |
} |
|
1144 |
break; |
|
1145 |
case ControlType.Date: |
|
1146 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
|
1147 |
{ |
|
1148 |
AllControl.PointSet[i] = setPoint; |
|
1149 |
var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count(); |
|
1150 |
var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count(); |
|
1151 |
var NextP = (i + 1) % AllControl.PointSet.Count(); |
|
1152 |
|
|
1153 |
var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]); |
|
1154 |
|
|
1155 |
var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]); |
|
1156 |
var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, |
|
1157 |
AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y); |
|
1158 |
AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet |
|
1159 |
[ReverseP].Y |
|
1160 |
+ PreviousV.Y * l); |
|
1161 |
|
|
1162 |
var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]); |
|
1163 |
l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet |
|
1164 |
[i].Y - AllControl.PointSet[ReverseP].Y); |
|
1165 |
AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y + |
|
1166 |
NextV.Y * l); |
|
1167 |
AllControl.updateControl(); |
|
1168 |
DynamicThumbUpdate(control); |
|
1169 |
BorderUpdate(); |
|
1170 |
} |
|
1171 |
break; |
|
1172 |
//case MarkupType.Viewbox: |
|
1173 |
// if (nearPoint.Equals(AllControl.PointSet[i])) |
|
1174 |
// { |
|
1175 |
// AllControl.PointSet[i] = setPoint; |
|
1176 |
// var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count(); |
|
1177 |
// var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count(); |
|
1178 |
// var NextP = (i + 1) % AllControl.PointSet.Count(); |
|
1179 |
|
|
1180 |
// var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]); |
|
1181 |
|
|
1182 |
// var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]); |
|
1183 |
// var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, |
|
1184 |
// AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y); |
|
1185 |
// AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet |
|
1186 |
// [ReverseP].Y |
|
1187 |
// + PreviousV.Y * l); |
|
1188 |
|
|
1189 |
// var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]); |
|
1190 |
// l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet |
|
1191 |
// [i].Y - AllControl.PointSet[ReverseP].Y); |
|
1192 |
// AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y + |
|
1193 |
// NextV.Y * l); |
|
1194 |
// AllControl.updateControl(); |
|
1195 |
// DynamicThumbUpdate(control); |
|
1196 |
// BorderUpdate(); |
|
1197 |
// } |
|
1198 |
// break; |
|
1199 |
#endregion |
|
1200 |
#region Ink |
|
1201 |
case ControlType.Ink: |
|
1202 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
|
1203 |
{ |
|
1204 |
AllControl.PointSet[i] = setPoint; |
|
1205 |
AllControl.updateControl(); |
|
1206 |
BorderUpdate(); |
|
1207 |
} |
|
1208 |
break; |
|
1209 |
#endregion |
|
1210 |
default: |
|
1211 |
break; |
|
1212 |
} |
|
1213 |
} |
|
1214 |
} |
|
1215 |
//} |
|
1216 |
} |
|
1217 |
|
|
1218 |
|
|
1219 |
|
|
1220 |
#endregion |
|
1221 |
#region 이벤트 |
|
1222 |
|
|
1223 |
void tm_DragCompleted(object sender, DragCompletedEventArgs e) |
|
1224 |
{ |
|
1225 |
this.isDragging = false; |
|
1226 |
DraggerThumb = null; |
|
1227 |
|
|
1228 |
Undo_Event(); |
|
1229 |
} |
|
1230 |
|
|
1231 |
void tm_DragStarted(object sender, DragStartedEventArgs e) |
|
1232 |
{ |
|
1233 |
this.DraggerThumb = sender as Thumb; |
|
1234 |
this.isDragging = true; |
|
1235 |
|
|
1236 |
//if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().PointSet != null) |
|
1237 |
//{ |
|
1238 |
// return; |
|
1239 |
//} |
|
1240 |
|
|
1241 |
if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Event == Event_Type.Thumb) |
|
1242 |
{ |
|
1243 |
return; |
|
1244 |
} |
|
1245 |
|
|
1246 |
if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List != null) |
|
1247 |
{ |
|
1248 |
if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.Count > 0) |
|
1249 |
{ |
|
1250 |
if (ViewerDataModel.Instance.UndoDataList.LastOrDefault().Markup_List.FirstOrDefault().PointSet != null) |
|
1251 |
{ |
|
1252 |
return; |
|
1253 |
} |
|
1254 |
} |
|
1255 |
} |
|
1256 |
|
|
1257 |
Undo_Event(); |
|
1258 |
} |
|
1259 |
|
|
1260 |
private void rotate_MouseMove(object sender, MouseEventArgs e) |
|
1261 |
{ |
|
1262 |
System.Diagnostics.Debug.WriteLine("X축 : " + e.GetPosition(this).X); |
|
1263 |
|
|
1264 |
if ((MemberSet.First() as AdornerMember).DrawingData.GetType().Name == "TextControl") |
|
1265 |
{ |
|
1266 |
if (LastRotateVerticalValue < e.GetPosition(this).X) |
|
1267 |
IsTextAngle = true; |
|
1268 |
else |
|
1269 |
IsTextAngle = false; |
|
1270 |
|
|
1271 |
System.Diagnostics.Debug.WriteLine("X축 : " + e.GetPosition(this).X + "LastRotateVerticalValue : " + LastRotateVerticalValue); |
|
1272 |
LastRotateVerticalValue = e.GetPosition(this).X; |
|
1273 |
} |
|
1274 |
} |
|
1275 |
|
|
1276 |
private void DragThumb_DragDelta(object sender, DragDeltaEventArgs e) |
|
1277 |
{ |
|
1278 |
Thumb thumb = sender as Thumb; |
|
1279 |
MoveAdorner(e); |
|
1280 |
} |
|
1281 |
public void MoveAdorner(DragDeltaEventArgs e) |
|
1282 |
{ |
|
1283 |
Point dragDelta = new Point(e.HorizontalChange, e.VerticalChange); |
|
1284 |
|
|
1285 |
Dispatcher.BeginInvoke((Action)(() => |
|
1286 |
{ |
|
1287 |
foreach (var item in MemberSet) |
|
1288 |
{ |
|
1289 |
#region 라인 & 아크 |
|
1290 |
if (item.Drawingtype == ControlType.SingleLine || item.Drawingtype == ControlType.ArcLine || item.Drawingtype == ControlType.ArrowMultiLine) |
|
1291 |
{ |
|
1292 |
DynamicThumbUpdate(e, item); |
|
1293 |
} |
|
1294 |
#endregion |
|
1295 |
#region 지시선화살표 |
|
1296 |
if (item.Drawingtype == ControlType.ArrowTextControl) |
|
1297 |
{ |
|
1298 |
DynamicThumbUpdate(e, item); |
|
1299 |
} |
|
1300 |
#endregion |
|
1301 |
//강인구 추가 Sign, check, Stamp |
|
1302 |
#region 써클 |
|
1303 |
if (item.Drawingtype == ControlType.Circle || item.Drawingtype == ControlType.Sign || item.Drawingtype == ControlType.Symbol || item.Drawingtype == ControlType.Stamp) |
|
1304 |
{ |
|
1305 |
DynamicThumbUpdate(e, item); |
|
1306 |
} |
|
1307 |
#endregion |
|
1308 |
#region 쉐이프 |
|
1309 |
if (item.Drawingtype == ControlType.Rectangle || item.Drawingtype == ControlType.ImgControl || item.Drawingtype == ControlType.RectCloud || item.Drawingtype == ControlType.Triangle) |
|
1310 |
{ |
|
1311 |
DynamicThumbUpdate(e, item); |
|
1312 |
} |
|
1313 |
#endregion |
|
1314 |
#region 텍스트 |
|
1315 |
if (item.Drawingtype == ControlType.TextControl) |
|
1316 |
{ |
|
1317 |
//Canvas.SetLeft((item.DrawingData as TextControl), Canvas.GetLeft((item.DrawingData as TextControl)) + e.HorizontalChange / 5); |
|
1318 |
//Canvas.SetTop((item.DrawingData as TextControl), Canvas.GetTop((item.DrawingData as TextControl)) + e.VerticalChange / 5); |
|
1319 |
//(item.DrawingData as TextControl).StartPoint = |
|
1320 |
//new Point(Canvas.GetLeft((item.DrawingData as TextControl)) + e.HorizontalChange / 5, Canvas.GetTop((item.DrawingData as TextControl)) + e.VerticalChange / 5); |
|
1321 |
//(item.DrawingData as TextControl).EndPoint = (item.DrawingData as TextControl).StartPoint; |
|
1322 |
|
|
1323 |
Point dx = MathSet.RotateAbout(new Point(0, 0), new Point(e.HorizontalChange, e.VerticalChange), trRotate.Angle); |
|
1324 |
Canvas.SetLeft((item.DrawingData as TextControl), Canvas.GetLeft((item.DrawingData as TextControl)) + dx.X); |
|
1325 |
Canvas.SetTop((item.DrawingData as TextControl), Canvas.GetTop((item.DrawingData as TextControl)) + dx.Y); |
|
1326 |
(item.DrawingData as TextControl).StartPoint = |
|
1327 |
new Point(Canvas.GetLeft((item.DrawingData as TextControl)) + e.HorizontalChange / 5, Canvas.GetTop((item.DrawingData as TextControl)) + e.VerticalChange / 5); |
|
1328 |
(item.DrawingData as TextControl).EndPoint = (item.DrawingData as TextControl).StartPoint; |
|
1329 |
} |
|
1330 |
#endregion |
|
1331 |
#region 날짜 |
|
1332 |
if (item.Drawingtype == ControlType.Date) |
|
1333 |
{ |
|
1334 |
DynamicThumbUpdate(e, item); |
|
1335 |
//Canvas.SetLeft((item.DrawingData as DateControl), Canvas.GetLeft((item.DrawingData as DateControl)) + e.HorizontalChange); |
|
1336 |
//Canvas.SetTop((item.DrawingData as DateControl), Canvas.GetTop((item.DrawingData as DateControl)) + e.VerticalChange); |
|
1337 |
//(item.DrawingData as DateControl).StartPoint = new Point(Canvas.GetLeft((item.DrawingData as DateControl)) |
|
1338 |
// + e.HorizontalChange, Canvas.GetTop((item.DrawingData as DateControl)) + e.VerticalChange); |
|
1339 |
//(item.DrawingData as DateControl).EndPoint = (item.DrawingData as DateControl).StartPoint; |
|
1340 |
//MessageBox.Show("잠시 정확도를 위해 막아두었습니다!"); |
|
1341 |
|
|
1342 |
|
|
1343 |
} |
|
1344 |
#endregion |
|
1345 |
#region 클라우드 |
|
1346 |
if (item.Drawingtype == ControlType.PolygonCloud) |
|
1347 |
{ |
|
1348 |
ICloudControl temp = ((ICloudControl)item.DrawingData); |
|
1349 |
DynamicThumbUpdate(e, item); |
|
1350 |
temp.DrawingCloud(); |
|
1351 |
} |
|
1352 |
#endregion |
|
1353 |
//#region 심볼 |
|
1354 |
//if (item.Drawingtype == MarkupType.Viewbox) |
|
1355 |
//{ |
|
1356 |
// DynamicThumbUpdate(e, item); |
|
1357 |
// BorderUpdate(); |
|
1358 |
//} |
|
1359 |
//#endregion |
|
1360 |
//#region 폴리곤확장 |
|
1361 |
//if (item.Drawingtype == MarkupType.PolygonEx) |
|
1362 |
//{ |
|
1363 |
// Point px = new Point(e.HorizontalChange, e.VerticalChange); |
|
1364 |
// List<StylusPointSet> StylusPointSet = (item.DrawingData as PolyControl).PointC; |
|
1365 |
// for (int i = 0; i < StylusPointSet.Count; i++) |
|
1366 |
// { |
|
1367 |
// List<Point> lstPoint = StylusPointSet[i].pointSet; |
|
1368 |
// for (int j = 0; j < lstPoint.Count; j++) |
|
1369 |
// { |
|
1370 |
// lstPoint[j] = new Point(lstPoint[j].X + px.X, lstPoint[j].Y + px.Y); |
|
1371 |
// } |
|
1372 |
// } |
|
1373 |
|
|
1374 |
// for (int i = 0; i < item.ThumbList.Count; i++) |
|
1375 |
// { |
|
1376 |
// Canvas.SetLeft(item.ThumbList[i], Canvas.GetLeft(item.ThumbList[i]) + px.X); |
|
1377 |
// Canvas.SetTop(item.ThumbList[i], Canvas.GetTop(item.ThumbList[i]) + px.Y); |
|
1378 |
// } |
|
1379 |
// (item.DrawingData as IPath).updateControl(); |
|
1380 |
// BorderUpdate(); |
|
1381 |
// //for (int i = 0; i < (item.DrawingData as PolyControl).PointC.Count(); i++) |
|
1382 |
// //{ |
|
1383 |
// // //(item.DrawingData as PolyControl).PointC[i] = MathSet.RotateAbout(CenterPoint, (item.DrawingData as PolyControl).PointC[i]., dDeltaAngle); |
|
1384 |
// // for (int j = 0; j < (item.DrawingData as PolyControl).PointC[i].pointSet.Count; j++) |
|
1385 |
// // { |
|
1386 |
// // (item.DrawingData as PolyControl).PointC[i].pointSet[j] = new Point { X = (item.DrawingData as PolyControl).PointC[i].pointSet[j].X + dx.X, Y = (item.DrawingData as PolyControl).PointC[i].pointSet[j].Y + dx.Y }; |
|
1387 |
// // Canvas.SetLeft(item.ThumbList[i], Canvas.GetLeft(item.ThumbList[i]) + dx.X); |
|
1388 |
// // Canvas.SetTop(item.ThumbList[i], Canvas.GetTop(item.ThumbList[i]) + dx.Y); |
|
1389 |
// // } |
|
1390 |
// //} |
|
1391 |
// //(item.DrawingData as IPath).updateControl(); |
|
1392 |
//} |
|
1393 |
//#endregion |
|
1394 |
#region 폴리곤 |
|
1395 |
if (item.Drawingtype == ControlType.PolygonControl) |
|
1396 |
{ |
|
1397 |
DynamicThumbUpdate(e, item); |
|
1398 |
BorderUpdate(); |
|
1399 |
} |
|
1400 |
#endregion |
|
1401 |
#region 잉크 |
|
1402 |
if (item.Drawingtype == ControlType.Ink) |
|
1403 |
{ |
|
1404 |
//DynamicThumbUpdate(e, item); |
|
1405 |
//BorderUpdate(); |
|
1406 |
|
|
1407 |
Point px = new Point(e.HorizontalChange, e.VerticalChange); |
|
1408 |
List<StylusPointSet> StylusPointSet = (item.DrawingData as InkControl).PointC; |
|
1409 |
for (int i = 0; i < StylusPointSet.Count; i++) |
|
1410 |
{ |
|
1411 |
List<Point> lstPoint = StylusPointSet[i].pointSet; |
|
1412 |
for (int j = 0; j < lstPoint.Count; j++) |
|
1413 |
{ |
|
1414 |
lstPoint[j] = new Point(lstPoint[j].X + px.X, lstPoint[j].Y + px.Y); |
|
1415 |
} |
|
1416 |
} |
|
1417 |
|
|
1418 |
for (int i = 0; i < item.ThumbList.Count; i++) |
|
1419 |
{ |
|
1420 |
Canvas.SetLeft(item.ThumbList[i], Canvas.GetLeft(item.ThumbList[i]) + px.X); |
|
1421 |
Canvas.SetTop(item.ThumbList[i], Canvas.GetTop(item.ThumbList[i]) + px.Y); |
|
1422 |
} |
|
1423 |
(item.DrawingData as IPath).updateControl(); |
|
1424 |
BorderUpdate(); |
|
1425 |
|
|
1426 |
} |
|
1427 |
#endregion |
|
1428 |
BorderUpdate(); |
|
1429 |
} |
내보내기 Unified diff