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