markus / KCOM / Events / Move.cs @ 3797ff05
이력 | 보기 | 이력해설 | 다운로드 (25.7 KB)
1 |
using MarkupToPDF.Common; |
---|---|
2 |
using MarkupToPDF.Controls.Common; |
3 |
using MarkupToPDF.Controls.Line; |
4 |
using MarkupToPDF.Controls.Polygon; |
5 |
using MarkupToPDF.Controls.Shape; |
6 |
using MarkupToPDF.Controls.Text; |
7 |
using MarkupToPDF.Controls.Etc; |
8 |
using System; |
9 |
using System.Collections.Generic; |
10 |
using System.Linq; |
11 |
using System.Text; |
12 |
using System.Windows; |
13 |
using System.Windows.Controls; |
14 |
using System.Windows.Media; |
15 |
|
16 |
namespace KCOM.Events |
17 |
{ |
18 |
public class Move |
19 |
{ |
20 |
#region 변수 선언 |
21 |
public SelectControl selectcontrol; |
22 |
Vector rectSize; |
23 |
Rect itemRect; |
24 |
Point s_point; |
25 |
Point e_point; |
26 |
Rect DragRect; |
27 |
#endregion |
28 |
|
29 |
Point[] StartPoint |
30 |
{ |
31 |
get; |
32 |
set; |
33 |
} |
34 |
|
35 |
Point[] MidPoint |
36 |
{ |
37 |
get; |
38 |
set; |
39 |
} |
40 |
|
41 |
Point[] EndPoint |
42 |
{ |
43 |
get; |
44 |
set; |
45 |
} |
46 |
|
47 |
public List<Point> PointSet |
48 |
{ |
49 |
get; |
50 |
set; |
51 |
} |
52 |
|
53 |
public CommentUserInfo CurrentControl |
54 |
{ |
55 |
get; |
56 |
set; |
57 |
} |
58 |
|
59 |
public MouseMode mousemode |
60 |
{ |
61 |
get; |
62 |
set; |
63 |
} |
64 |
|
65 |
|
66 |
/// <summary> |
67 |
/// Control Select |
68 |
/// </summary> |
69 |
/// <param name="Control"></param> |
70 |
/// <param name="dragrect"></param> |
71 |
/// <returns></returns> |
72 |
public Boolean control_Select(object Control, Rect dragrect) |
73 |
{ |
74 |
DragRect = dragrect; |
75 |
|
76 |
ItemRect(Control); |
77 |
|
78 |
if (DragRect.Contains(itemRect)) |
79 |
return true; |
80 |
else |
81 |
return false; |
82 |
|
83 |
} |
84 |
|
85 |
|
86 |
/// <summary> |
87 |
/// return bounding box of given control |
88 |
/// </summary> |
89 |
/// <param name="control"></param> |
90 |
/// <history>humkyung 2018.06.14 return bouding box of the control</history> |
91 |
public Rect ItemRect(object control) |
92 |
{ |
93 |
s_point = new Point(); |
94 |
e_point = new Point(); |
95 |
|
96 |
if (control.GetType().Name == "TextControl") |
97 |
{ |
98 |
s_point.X = (control as TextControl).CanvasX; |
99 |
s_point.Y = (control as TextControl).CanvasY; |
100 |
|
101 |
Point length = new Point(); |
102 |
double angle = (control as TextControl).Angle; |
103 |
angle = Math.PI * angle / 180; |
104 |
|
105 |
length.X = (control as TextControl).BoxWidth * Math.Cos(angle) - (control as TextControl).BoxHeight * Math.Sin(angle); |
106 |
length.Y = (control as TextControl).BoxWidth * Math.Sin(angle) + (control as TextControl).BoxHeight * Math.Cos(angle); |
107 |
|
108 |
e_point.X = s_point.X + length.X; |
109 |
e_point.Y = s_point.Y + length.Y; |
110 |
rectSize = e_point - s_point; |
111 |
|
112 |
itemRect = new Rect(s_point, new Point(s_point.X + rectSize.X, s_point.Y + rectSize.Y)); |
113 |
return itemRect; |
114 |
} |
115 |
|
116 |
switch ((control as IMarkupCommonData).ControlType) |
117 |
{ |
118 |
#region Shape |
119 |
case (ControlType.Rectangle): |
120 |
{ |
121 |
s_point.X = Math.Min((control as RectangleControl).StartPoint.X, (control as RectangleControl).EndPoint.X); |
122 |
s_point.Y = Math.Min((control as RectangleControl).StartPoint.Y, (control as RectangleControl).EndPoint.Y); |
123 |
e_point.X = Math.Max((control as RectangleControl).StartPoint.X, (control as RectangleControl).EndPoint.X); |
124 |
e_point.Y = Math.Max((control as RectangleControl).StartPoint.Y, (control as RectangleControl).EndPoint.Y); |
125 |
rectSize = e_point - s_point; |
126 |
} |
127 |
break; |
128 |
case (ControlType.Circle): |
129 |
{ |
130 |
s_point.X = Math.Min((control as CircleControl).StartPoint.X, (control as CircleControl).EndPoint.X); |
131 |
s_point.Y = Math.Min((control as CircleControl).StartPoint.Y, (control as CircleControl).EndPoint.Y); |
132 |
e_point.X = Math.Max((control as CircleControl).StartPoint.X, (control as CircleControl).EndPoint.X); |
133 |
e_point.Y = Math.Max((control as CircleControl).StartPoint.Y, (control as CircleControl).EndPoint.Y); |
134 |
rectSize = e_point - s_point; |
135 |
} |
136 |
break; |
137 |
case (ControlType.RectCloud): |
138 |
{ |
139 |
s_point.X = Math.Min((control as RectCloudControl).StartPoint.X, (control as RectCloudControl).EndPoint.X); |
140 |
s_point.Y = Math.Min((control as RectCloudControl).StartPoint.Y, (control as RectCloudControl).EndPoint.Y); |
141 |
e_point.X = Math.Max((control as RectCloudControl).StartPoint.X, (control as RectCloudControl).EndPoint.X); |
142 |
e_point.Y = Math.Max((control as RectCloudControl).StartPoint.Y, (control as RectCloudControl).EndPoint.Y); |
143 |
rectSize = e_point - s_point; |
144 |
} |
145 |
break; |
146 |
case (ControlType.Triangle): |
147 |
{ |
148 |
s_point.X = Math.Min((control as TriControl).StartPoint.X, (control as TriControl).EndPoint.X); |
149 |
s_point.X = Math.Min((control as TriControl).MidPoint.X, s_point.X); |
150 |
s_point.Y = Math.Min((control as TriControl).StartPoint.Y, (control as TriControl).EndPoint.Y); |
151 |
s_point.Y = Math.Min((control as TriControl).MidPoint.Y, s_point.Y); |
152 |
e_point.X = Math.Max((control as TriControl).StartPoint.X, (control as TriControl).EndPoint.X); |
153 |
e_point.X = Math.Max((control as TriControl).MidPoint.X, e_point.X); |
154 |
e_point.Y = Math.Max((control as TriControl).StartPoint.Y, (control as TriControl).EndPoint.Y); |
155 |
e_point.Y = Math.Max((control as TriControl).MidPoint.Y, e_point.Y); |
156 |
rectSize = e_point - s_point; |
157 |
} |
158 |
break; |
159 |
#endregion |
160 |
|
161 |
#region Line |
162 |
case (ControlType.SingleLine): |
163 |
{ |
164 |
s_point.X = Math.Min((control as LineControl).StartPoint.X, (control as LineControl).EndPoint.X); |
165 |
s_point.Y = Math.Min((control as LineControl).StartPoint.Y, (control as LineControl).EndPoint.Y); |
166 |
e_point.X = Math.Max((control as LineControl).StartPoint.X, (control as LineControl).EndPoint.X); |
167 |
e_point.Y = Math.Max((control as LineControl).StartPoint.Y, (control as LineControl).EndPoint.Y); |
168 |
rectSize = e_point - s_point; |
169 |
} |
170 |
break; |
171 |
case (ControlType.ArrowLine): |
172 |
{ |
173 |
s_point.X = Math.Min((control as LineControl).StartPoint.X, (control as LineControl).EndPoint.X); |
174 |
s_point.Y = Math.Min((control as LineControl).StartPoint.Y, (control as LineControl).EndPoint.Y); |
175 |
e_point.X = Math.Max((control as LineControl).StartPoint.X, (control as LineControl).EndPoint.X); |
176 |
e_point.Y = Math.Max((control as LineControl).StartPoint.Y, (control as LineControl).EndPoint.Y); |
177 |
rectSize = e_point - s_point; |
178 |
} |
179 |
break; |
180 |
case (ControlType.ArrowMultiLine): |
181 |
{ |
182 |
s_point.X = Math.Min((control as ArrowControl_Multi).StartPoint.X, (control as ArrowControl_Multi).EndPoint.X); |
183 |
s_point.X = Math.Min((control as ArrowControl_Multi).MiddlePoint.X, s_point.X); |
184 |
s_point.Y = Math.Min((control as ArrowControl_Multi).StartPoint.Y, (control as ArrowControl_Multi).EndPoint.Y); |
185 |
s_point.Y = Math.Min((control as ArrowControl_Multi).MiddlePoint.Y, s_point.Y); |
186 |
e_point.X = Math.Max((control as ArrowControl_Multi).StartPoint.X, (control as ArrowControl_Multi).EndPoint.X); |
187 |
e_point.X = Math.Max((control as ArrowControl_Multi).MiddlePoint.X, e_point.X); |
188 |
e_point.Y = Math.Max((control as ArrowControl_Multi).StartPoint.Y, (control as ArrowControl_Multi).EndPoint.Y); |
189 |
e_point.Y = Math.Max((control as ArrowControl_Multi).MiddlePoint.Y, e_point.Y); |
190 |
rectSize = e_point - s_point; |
191 |
} |
192 |
break; |
193 |
case (ControlType.CancelLine): |
194 |
{ |
195 |
s_point.X = Math.Min((control as LineControl).StartPoint.X, (control as LineControl).EndPoint.X); |
196 |
s_point.Y = Math.Min((control as LineControl).StartPoint.Y, (control as LineControl).EndPoint.Y); |
197 |
e_point.X = Math.Max((control as LineControl).StartPoint.X, (control as LineControl).EndPoint.X); |
198 |
e_point.Y = Math.Max((control as LineControl).StartPoint.Y, (control as LineControl).EndPoint.Y); |
199 |
rectSize = e_point - s_point; |
200 |
} |
201 |
break; |
202 |
case (ControlType.DimLine): |
203 |
{ |
204 |
s_point.X = Math.Min((control as LineControl).StartPoint.X, (control as LineControl).EndPoint.X); |
205 |
s_point.Y = Math.Min((control as LineControl).StartPoint.Y, (control as LineControl).EndPoint.Y); |
206 |
e_point.X = Math.Max((control as LineControl).StartPoint.X, (control as LineControl).EndPoint.X); |
207 |
e_point.Y = Math.Max((control as LineControl).StartPoint.Y, (control as LineControl).EndPoint.Y); |
208 |
rectSize = e_point - s_point; |
209 |
} |
210 |
break; |
211 |
case (ControlType.TwinLine): |
212 |
{ |
213 |
s_point.X = Math.Min((control as LineControl).StartPoint.X, (control as LineControl).EndPoint.X); |
214 |
s_point.Y = Math.Min((control as LineControl).StartPoint.Y, (control as LineControl).EndPoint.Y); |
215 |
e_point.X = Math.Max((control as LineControl).StartPoint.X, (control as LineControl).EndPoint.X); |
216 |
e_point.Y = Math.Max((control as LineControl).StartPoint.Y, (control as LineControl).EndPoint.Y); |
217 |
rectSize = e_point - s_point; |
218 |
} |
219 |
break; |
220 |
case (ControlType.ArcLine): |
221 |
{ |
222 |
s_point.X = Math.Min((control as ArcControl).StartPoint.X, (control as ArcControl).EndPoint.X); |
223 |
s_point.X = Math.Min((control as ArcControl).MidPoint.X, s_point.X); |
224 |
s_point.Y = Math.Min((control as ArcControl).StartPoint.Y, (control as ArcControl).EndPoint.Y); |
225 |
s_point.Y = Math.Min((control as ArcControl).MidPoint.Y, s_point.Y); |
226 |
e_point.X = Math.Max((control as ArcControl).StartPoint.X, (control as ArcControl).EndPoint.X); |
227 |
e_point.X = Math.Max((control as ArcControl).MidPoint.X, e_point.X); |
228 |
e_point.Y = Math.Max((control as ArcControl).StartPoint.Y, (control as ArcControl).EndPoint.Y); |
229 |
e_point.Y = Math.Max((control as ArcControl).MidPoint.Y, e_point.Y); |
230 |
rectSize = e_point - s_point; |
231 |
} |
232 |
break; |
233 |
case (ControlType.ArcArrow): |
234 |
{ |
235 |
s_point.X = Math.Min((control as ArcControl).StartPoint.X, (control as ArcControl).EndPoint.X); |
236 |
s_point.X = Math.Min((control as ArcControl).MidPoint.X, s_point.X); |
237 |
s_point.Y = Math.Min((control as ArcControl).StartPoint.Y, (control as ArcControl).EndPoint.Y); |
238 |
s_point.Y = Math.Min((control as ArcControl).MidPoint.Y, s_point.Y); |
239 |
e_point.X = Math.Max((control as ArcControl).StartPoint.X, (control as ArcControl).EndPoint.X); |
240 |
e_point.X = Math.Max((control as ArcControl).MidPoint.X, e_point.X); |
241 |
e_point.Y = Math.Max((control as ArcControl).StartPoint.Y, (control as ArcControl).EndPoint.Y); |
242 |
e_point.Y = Math.Max((control as ArcControl).MidPoint.Y, e_point.Y); |
243 |
rectSize = e_point - s_point; |
244 |
} |
245 |
break; |
246 |
#endregion |
247 |
|
248 |
#region Polygon |
249 |
|
250 |
|
251 |
case (ControlType.Ink): |
252 |
{ |
253 |
s_point.X = Math.Min((control as PolygonControl).StartPoint.X, (control as PolygonControl).EndPoint.X); |
254 |
s_point.Y = Math.Min((control as PolygonControl).StartPoint.Y, (control as PolygonControl).EndPoint.Y); |
255 |
e_point.X = Math.Max((control as PolygonControl).StartPoint.X, (control as PolygonControl).EndPoint.X); |
256 |
e_point.Y = Math.Max((control as PolygonControl).StartPoint.Y, (control as PolygonControl).EndPoint.Y); |
257 |
|
258 |
rectSize = e_point - s_point; |
259 |
} |
260 |
break; |
261 |
|
262 |
case (ControlType.ChainLine): |
263 |
{ |
264 |
//rectSize |
265 |
|
266 |
foreach (Point A in (control as PolygonControl).PointSet) |
267 |
{ |
268 |
if (s_point == new Point()) |
269 |
{ |
270 |
s_point = A; |
271 |
e_point = A; |
272 |
} |
273 |
s_point.X = Math.Min(s_point.X, A.X); |
274 |
s_point.Y = Math.Min(s_point.Y, A.Y); |
275 |
e_point.X = Math.Max(e_point.X, A.X); |
276 |
e_point.Y = Math.Max(e_point.Y, A.Y); |
277 |
} |
278 |
|
279 |
rectSize = e_point - s_point; |
280 |
} |
281 |
break; |
282 |
|
283 |
case (ControlType.PolygonControl): |
284 |
{ |
285 |
//rectSize |
286 |
|
287 |
foreach (Point A in (control as PolygonControl).PointSet) |
288 |
{ |
289 |
if (s_point == new Point()) |
290 |
{ |
291 |
s_point = A; |
292 |
e_point = A; |
293 |
} |
294 |
s_point.X = Math.Min(s_point.X, A.X); |
295 |
s_point.Y = Math.Min(s_point.Y, A.Y); |
296 |
e_point.X = Math.Max(e_point.X, A.X); |
297 |
e_point.Y = Math.Max(e_point.Y, A.Y); |
298 |
} |
299 |
|
300 |
rectSize = e_point - s_point; |
301 |
} |
302 |
break; |
303 |
case (ControlType.PolygonCloud): |
304 |
{ |
305 |
//rectSize |
306 |
|
307 |
foreach (Point A in (control as CloudControl).PointSet) |
308 |
{ |
309 |
if (s_point == new Point()) |
310 |
{ |
311 |
s_point = A; |
312 |
e_point = A; |
313 |
} |
314 |
s_point.X = Math.Min(s_point.X, A.X); |
315 |
s_point.Y = Math.Min(s_point.Y, A.Y); |
316 |
e_point.X = Math.Max(e_point.X, A.X); |
317 |
e_point.Y = Math.Max(e_point.Y, A.Y); |
318 |
} |
319 |
|
320 |
rectSize = e_point - s_point; |
321 |
} |
322 |
break; |
323 |
#endregion |
324 |
|
325 |
#region Text |
326 |
//case (ControlType.TextControl): |
327 |
// { |
328 |
// s_point.X = (control as TextControl).CanvasX; |
329 |
// s_point.Y = (control as TextControl).CanvasY; |
330 |
|
331 |
// e_point.X = s_point.X + (control as TextControl).BoxWidth; |
332 |
// e_point.Y = s_point.Y + (control as TextControl).BoxHeight; |
333 |
|
334 |
// rectSize = e_point - s_point; |
335 |
// } |
336 |
// break; |
337 |
|
338 |
//case (ControlType.TextBorder): |
339 |
// { |
340 |
|
341 |
// s_point.X = (control as TextControl).CanvasX; |
342 |
// s_point.Y = (control as TextControl).CanvasY; |
343 |
|
344 |
// e_point.X = s_point.X + (control as TextControl).BoxWidth; |
345 |
// e_point.Y = s_point.Y + (control as TextControl).BoxHeight; |
346 |
|
347 |
// rectSize = e_point - s_point; |
348 |
// } |
349 |
// break; |
350 |
|
351 |
//case (ControlType.TextCloud): |
352 |
// { |
353 |
|
354 |
// s_point.X = (control as TextControl).CanvasX; |
355 |
// s_point.Y = (control as TextControl).CanvasY; |
356 |
|
357 |
// e_point.X = s_point.X + (control as TextControl).BoxWidth; |
358 |
// e_point.Y = s_point.Y + (control as TextControl).BoxHeight; |
359 |
|
360 |
// rectSize = e_point - s_point; |
361 |
// } |
362 |
// break; |
363 |
#endregion |
364 |
|
365 |
#region ArrowText |
366 |
|
367 |
case (ControlType.ArrowTextControl): |
368 |
{ |
369 |
s_point.X = Math.Min((control as ArrowTextControl).StartPoint.X, (control as ArrowTextControl).EndPoint.X); |
370 |
s_point.Y = Math.Min((control as ArrowTextControl).StartPoint.Y, (control as ArrowTextControl).EndPoint.Y); |
371 |
e_point.X = Math.Max((control as ArrowTextControl).StartPoint.X, (control as ArrowTextControl).EndPoint.X); |
372 |
e_point.Y = Math.Max((control as ArrowTextControl).StartPoint.Y, (control as ArrowTextControl).EndPoint.Y); |
373 |
rectSize = e_point - s_point; |
374 |
} |
375 |
break; |
376 |
case (ControlType.ArrowTransTextControl): |
377 |
{ |
378 |
s_point.X = Math.Min((control as ArrowTextControl).StartPoint.X, (control as ArrowTextControl).EndPoint.X); |
379 |
s_point.Y = Math.Min((control as ArrowTextControl).StartPoint.Y, (control as ArrowTextControl).EndPoint.Y); |
380 |
e_point.X = Math.Max((control as ArrowTextControl).StartPoint.X, (control as ArrowTextControl).EndPoint.X); |
381 |
e_point.Y = Math.Max((control as ArrowTextControl).StartPoint.Y, (control as ArrowTextControl).EndPoint.Y); |
382 |
rectSize = e_point - s_point; |
383 |
} |
384 |
break; |
385 |
case (ControlType.ArrowTextBorderControl): |
386 |
{ |
387 |
s_point.X = Math.Min((control as ArrowTextControl).StartPoint.X, (control as ArrowTextControl).EndPoint.X); |
388 |
s_point.Y = Math.Min((control as ArrowTextControl).StartPoint.Y, (control as ArrowTextControl).EndPoint.Y); |
389 |
e_point.X = Math.Max((control as ArrowTextControl).StartPoint.X, (control as ArrowTextControl).EndPoint.X); |
390 |
e_point.Y = Math.Max((control as ArrowTextControl).StartPoint.Y, (control as ArrowTextControl).EndPoint.Y); |
391 |
rectSize = e_point - s_point; |
392 |
} |
393 |
break; |
394 |
case (ControlType.ArrowTransTextBorderControl): |
395 |
{ |
396 |
s_point.X = Math.Min((control as ArrowTextControl).StartPoint.X, (control as ArrowTextControl).EndPoint.X); |
397 |
s_point.Y = Math.Min((control as ArrowTextControl).StartPoint.Y, (control as ArrowTextControl).EndPoint.Y); |
398 |
e_point.X = Math.Max((control as ArrowTextControl).StartPoint.X, (control as ArrowTextControl).EndPoint.X); |
399 |
e_point.Y = Math.Max((control as ArrowTextControl).StartPoint.Y, (control as ArrowTextControl).EndPoint.Y); |
400 |
rectSize = e_point - s_point; |
401 |
} |
402 |
break; |
403 |
case (ControlType.ArrowTextCloudControl): |
404 |
{ |
405 |
s_point.X = Math.Min((control as ArrowTextControl).StartPoint.X, (control as ArrowTextControl).EndPoint.X); |
406 |
s_point.Y = Math.Min((control as ArrowTextControl).StartPoint.Y, (control as ArrowTextControl).EndPoint.Y); |
407 |
e_point.X = Math.Max((control as ArrowTextControl).StartPoint.X, (control as ArrowTextControl).EndPoint.X); |
408 |
e_point.Y = Math.Max((control as ArrowTextControl).StartPoint.Y, (control as ArrowTextControl).EndPoint.Y); |
409 |
rectSize = e_point - s_point; |
410 |
} |
411 |
break; |
412 |
case (ControlType.ArrowTransTextCloudControl): |
413 |
{ |
414 |
s_point.X = Math.Min((control as ArrowTextControl).StartPoint.X, (control as ArrowTextControl).EndPoint.X); |
415 |
s_point.Y = Math.Min((control as ArrowTextControl).StartPoint.Y, (control as ArrowTextControl).EndPoint.Y); |
416 |
e_point.X = Math.Max((control as ArrowTextControl).StartPoint.X, (control as ArrowTextControl).EndPoint.X); |
417 |
e_point.Y = Math.Max((control as ArrowTextControl).StartPoint.Y, (control as ArrowTextControl).EndPoint.Y); |
418 |
rectSize = e_point - s_point; |
419 |
} |
420 |
break; |
421 |
#endregion |
422 |
|
423 |
#region ETC |
424 |
case (ControlType.Date): |
425 |
{ |
426 |
s_point.X = Math.Min((control as DateControl).StartPoint.X, (control as DateControl).EndPoint.X); |
427 |
s_point.Y = Math.Min((control as DateControl).StartPoint.Y, (control as DateControl).EndPoint.Y); |
428 |
e_point.X = Math.Max((control as DateControl).StartPoint.X, (control as DateControl).EndPoint.X); |
429 |
e_point.Y = Math.Max((control as DateControl).StartPoint.Y, (control as DateControl).EndPoint.Y); |
430 |
rectSize = e_point - s_point; |
431 |
} |
432 |
break; |
433 |
case (ControlType.ImgControl): |
434 |
{ |
435 |
s_point.X = Math.Min((control as ImgControl).StartPoint.X, (control as ImgControl).EndPoint.X); |
436 |
s_point.Y = Math.Min((control as ImgControl).StartPoint.Y, (control as ImgControl).EndPoint.Y); |
437 |
e_point.X = Math.Max((control as ImgControl).StartPoint.X, (control as ImgControl).EndPoint.X); |
438 |
e_point.Y = Math.Max((control as ImgControl).StartPoint.Y, (control as ImgControl).EndPoint.Y); |
439 |
rectSize = e_point - s_point; |
440 |
} |
441 |
break; |
442 |
case (ControlType.Sign): |
443 |
{ |
444 |
s_point.X = Math.Min((control as SignControl).StartPoint.X, (control as SignControl).EndPoint.X); |
445 |
s_point.Y = Math.Min((control as SignControl).StartPoint.Y, (control as SignControl).EndPoint.Y); |
446 |
e_point.X = Math.Max((control as SignControl).StartPoint.X, (control as SignControl).EndPoint.X); |
447 |
e_point.Y = Math.Max((control as SignControl).StartPoint.Y, (control as SignControl).EndPoint.Y); |
448 |
rectSize = e_point - s_point; |
449 |
} |
450 |
break; |
451 |
case (ControlType.Symbol): |
452 |
{ |
453 |
s_point.X = Math.Min((control as SymControl).StartPoint.X, (control as SymControl).EndPoint.X); |
454 |
s_point.Y = Math.Min((control as SymControl).StartPoint.Y, (control as SymControl).EndPoint.Y); |
455 |
e_point.X = Math.Max((control as SymControl).StartPoint.X, (control as SymControl).EndPoint.X); |
456 |
e_point.Y = Math.Max((control as SymControl).StartPoint.Y, (control as SymControl).EndPoint.Y); |
457 |
rectSize = e_point - s_point; |
458 |
} |
459 |
break; |
460 |
case (ControlType.Mark): |
461 |
{ |
462 |
s_point.X = Math.Min((control as RectangleControl).StartPoint.X, (control as RectangleControl).EndPoint.X); |
463 |
s_point.Y = Math.Min((control as RectangleControl).StartPoint.Y, (control as RectangleControl).EndPoint.Y); |
464 |
e_point.X = Math.Max((control as RectangleControl).StartPoint.X, (control as RectangleControl).EndPoint.X); |
465 |
e_point.Y = Math.Max((control as RectangleControl).StartPoint.Y, (control as RectangleControl).EndPoint.Y); |
466 |
rectSize = e_point - s_point; |
467 |
} |
468 |
break; |
469 |
case (ControlType.Stamp): |
470 |
{ |
471 |
s_point.X = Math.Min((control as SymControlN).StartPoint.X, (control as SymControlN).EndPoint.X); |
472 |
s_point.Y = Math.Min((control as SymControlN).StartPoint.Y, (control as SymControlN).EndPoint.Y); |
473 |
e_point.X = Math.Max((control as SymControlN).StartPoint.X, (control as SymControlN).EndPoint.X); |
474 |
e_point.Y = Math.Max((control as SymControlN).StartPoint.Y, (control as SymControlN).EndPoint.Y); |
475 |
rectSize = e_point - s_point; |
476 |
} |
477 |
break; |
478 |
|
479 |
#endregion |
480 |
|
481 |
} |
482 |
itemRect = new Rect(s_point.X, s_point.Y, rectSize.X, rectSize.Y); |
483 |
|
484 |
return itemRect; |
485 |
} |
486 |
|
487 |
/// <summary> |
488 |
/// Control Select 여부 확인 |
489 |
/// </summary> |
490 |
/// <param name="OverViewPathData"></param> |
491 |
/// <returns>Select여부</returns> |
492 |
public Boolean IsSelectionControl(Geometry OverViewPathData) |
493 |
{ |
494 |
if (DragRect.Contains(itemRect)) |
495 |
return true; |
496 |
else |
497 |
return false; |
498 |
} |
499 |
} |
500 |
} |