4e57c75e |
1 | // Created by: Peter KURNEV |
973c2be1 |
2 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
4e57c75e |
3 | // |
973c2be1 |
4 | // This file is part of Open CASCADE Technology software library. |
4e57c75e |
5 | // |
d5f74e42 |
6 | // This library is free software; you can redistribute it and/or modify it under |
7 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
8 | // by the Free Software Foundation, with special exception defined in the file |
9 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
10 | // distribution for complete text of the license and disclaimer of any warranty. |
4e57c75e |
11 | // |
973c2be1 |
12 | // Alternatively, this file may be used under the terms of Open CASCADE |
13 | // commercial license or contractual agreement. |
4e57c75e |
14 | |
15 | #ifndef BOPDS_Interf_HeaderFile |
16 | #define BOPDS_Interf_HeaderFile |
17 | |
4e57c75e |
18 | #include <IntTools_CommonPrt.hxx> |
4e57c75e |
19 | #include <NCollection_BaseAllocator.hxx> |
20 | #include <BOPDS_VectorOfCurve.hxx> |
21 | #include <BOPDS_VectorOfPoint.hxx> |
ebc93ae7 |
22 | |
4e57c75e |
23 | /** |
24 | * The class BOPDS_Interf is is to store the information about |
25 | * the interference between two shapes. |
26 | * The class BOPDS_Interf is root class |
27 | * |
28 | */ |
29 | //======================================================================= |
30 | //function : BOPDS_Interf |
31 | //purpose : |
32 | //======================================================================= |
33 | class BOPDS_Interf { |
34 | public: |
35 | // |
36 | /** |
37 | * Sets the indices of interferred shapes |
38 | * @param theIndex1 |
39 | * index of the first shape |
40 | * @param theIndex2 |
41 | * index of the second shape |
42 | */ |
43 | void SetIndices(const Standard_Integer theIndex1, |
f1baf495 |
44 | const Standard_Integer theIndex2) { |
4e57c75e |
45 | myIndex1=theIndex1; |
46 | myIndex2=theIndex2; |
5640d653 |
47 | } |
4e57c75e |
48 | // |
49 | /** |
50 | * Returns the indices of interferred shapes |
51 | * @param theIndex1 |
52 | * index of the first shape |
53 | * @param theIndex2 |
54 | * index of the second shape |
55 | */ |
56 | void Indices(Standard_Integer& theIndex1, |
f1baf495 |
57 | Standard_Integer& theIndex2) const { |
58 | theIndex1=myIndex1; |
59 | theIndex2=myIndex2; |
60 | } |
4e57c75e |
61 | // |
62 | /** |
63 | * Sets the index of the first interferred shape |
64 | * @param theIndex |
65 | * index of the first shape |
66 | */ |
67 | void SetIndex1(const Standard_Integer theIndex) { |
68 | myIndex1=theIndex; |
5640d653 |
69 | } |
4e57c75e |
70 | // |
71 | /** |
72 | * Sets the index of the second interferred shape |
73 | * @param theIndex |
74 | * index of the second shape |
75 | */ |
76 | void SetIndex2(const Standard_Integer theIndex) { |
77 | myIndex2=theIndex; |
5640d653 |
78 | } |
4e57c75e |
79 | // |
80 | /** |
81 | * Returns the index of the first interferred shape |
82 | * @return |
83 | * index of the first shape |
84 | */ |
85 | Standard_Integer Index1() const { |
86 | return myIndex1; |
5640d653 |
87 | } |
4e57c75e |
88 | // |
89 | /** |
90 | * Returns the index of the second interferred shape |
91 | * @return |
92 | * index of the second shape |
93 | */ |
94 | Standard_Integer Index2() const { |
95 | return myIndex2; |
5640d653 |
96 | } |
4e57c75e |
97 | // |
98 | /** |
99 | * Returns the index of that are opposite to the given index |
100 | * @param theI |
101 | * the index |
102 | * @return |
103 | * index of opposite shape |
104 | */ |
105 | Standard_Integer OppositeIndex(const Standard_Integer theI) const { |
106 | if (theI==myIndex1) { |
107 | return myIndex2; |
108 | } |
109 | else if(theI==myIndex2) { |
110 | return myIndex1; |
111 | } |
112 | else { |
113 | return -1; |
114 | } |
5640d653 |
115 | } |
4e57c75e |
116 | // |
117 | /** |
118 | * Returns true if the interference contains given index |
119 | * @param theIndex |
120 | * the index |
121 | * @return |
122 | * true if the interference contains given index |
123 | */ |
124 | Standard_Boolean Contains(const Standard_Integer theIndex)const { |
125 | return (myIndex1==theIndex || myIndex2==theIndex); |
126 | } |
127 | // |
128 | /** |
129 | * Sets the index of new shape |
130 | * @param theIndex |
131 | * the index |
132 | */ |
133 | void SetIndexNew(const Standard_Integer theIndex) { |
134 | myIndexNew=theIndex; |
5640d653 |
135 | } |
4e57c75e |
136 | // |
137 | // |
138 | /** |
139 | * Returns the index of new shape |
140 | * @return theIndex |
141 | * the index of new shape |
142 | */ |
143 | Standard_Integer IndexNew() const { |
144 | return myIndexNew; |
5640d653 |
145 | } |
4e57c75e |
146 | // |
147 | /** |
148 | * Returns true if the interference has index of new shape |
149 | * that is equal to the given index |
150 | * @param theIndex |
151 | * the index |
152 | * @return true if the interference has index of new shape |
153 | * that is equal to the given index |
154 | */ |
155 | Standard_Boolean HasIndexNew(Standard_Integer& theIndex) const { |
156 | theIndex=myIndexNew; |
157 | return (myIndexNew>=0); |
5640d653 |
158 | } |
4e57c75e |
159 | // |
160 | /** |
161 | * Returns true if the interference has index of new shape |
162 | * the index |
163 | * @return true if the interference has index of new shape |
164 | */ |
165 | Standard_Boolean HasIndexNew() const { |
dde68833 |
166 | return (myIndexNew+1) != 0; |
5640d653 |
167 | } |
4e57c75e |
168 | // |
169 | protected: |
170 | BOPDS_Interf() : |
171 | myIndex1(-1), |
172 | myIndex2(-1), |
173 | myIndexNew(-1), |
174 | myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()) { |
5640d653 |
175 | } |
4e57c75e |
176 | // |
177 | BOPDS_Interf(const Handle(NCollection_BaseAllocator)& theAllocator) : |
178 | myIndex1(-1), |
179 | myIndex2(-1), |
180 | myIndexNew(-1), |
181 | myAllocator(theAllocator) { |
5640d653 |
182 | } |
4e57c75e |
183 | // |
184 | virtual ~BOPDS_Interf() { |
5640d653 |
185 | } |
4e57c75e |
186 | |
f1baf495 |
187 | protected: |
4e57c75e |
188 | Standard_Integer myIndex1; |
189 | Standard_Integer myIndex2; |
190 | Standard_Integer myIndexNew; |
191 | Handle(NCollection_BaseAllocator) myAllocator; |
192 | }; |
193 | /** |
194 | * The class BOPDS_InterfVV is is to store the information about |
195 | * the interference of the type vertex/vertex. |
196 | */ |
197 | //======================================================================= |
198 | //function : BOPDS_InterfVV |
199 | //purpose : |
200 | //======================================================================= |
201 | class BOPDS_InterfVV : public BOPDS_Interf { |
202 | public: |
203 | // |
204 | /** |
205 | * Constructor |
206 | */ |
207 | BOPDS_InterfVV() : BOPDS_Interf() { |
5640d653 |
208 | } |
4e57c75e |
209 | // |
210 | /** |
211 | * Constructor |
212 | * @param theAllocator |
213 | * allocator to manage the memory |
214 | */ |
215 | BOPDS_InterfVV(const Handle(NCollection_BaseAllocator)& theAllocator) |
216 | : BOPDS_Interf(theAllocator) { |
5640d653 |
217 | } |
4e57c75e |
218 | // |
219 | /** |
220 | * Destructor |
221 | */ |
222 | virtual ~BOPDS_InterfVV() { |
5640d653 |
223 | } |
4e57c75e |
224 | // |
225 | }; |
226 | /** |
227 | * The class BOPDS_InterfVE is is to store the information about |
228 | * the interference of the type vertex/edge. |
229 | */ |
230 | //======================================================================= |
231 | //function : BOPDS_InterfVE |
232 | //purpose : |
233 | //======================================================================= |
234 | class BOPDS_InterfVE : public BOPDS_Interf { |
235 | public: |
236 | // |
237 | /** |
238 | * Constructor |
239 | */ |
240 | BOPDS_InterfVE() |
241 | : |
242 | BOPDS_Interf(), |
243 | myParameter(0.) { |
5640d653 |
244 | } |
4e57c75e |
245 | // |
246 | /** |
247 | * Constructor |
248 | * @param theAllocator |
249 | * allocator to manage the memory |
250 | */ |
251 | BOPDS_InterfVE(const Handle(NCollection_BaseAllocator)& theAllocator) |
252 | : |
253 | BOPDS_Interf(theAllocator), |
254 | myParameter(0.) { |
5640d653 |
255 | } |
4e57c75e |
256 | // |
257 | /** |
258 | * Destructor |
259 | */ |
260 | virtual ~BOPDS_InterfVE() { |
5640d653 |
261 | } |
4e57c75e |
262 | // |
263 | /** |
264 | * Modifier |
265 | * Sets the value of parameter |
266 | * of the point of the vertex |
267 | * on the curve of the edge |
268 | * @param theT |
269 | * value of parameter |
270 | */ |
271 | void SetParameter(const Standard_Real theT) { |
272 | myParameter=theT; |
5640d653 |
273 | } |
4e57c75e |
274 | // |
275 | /** |
276 | * Selector |
277 | * Returrns the value of parameter |
278 | * of the point of the vertex |
279 | * on the curve of the edge |
280 | * @return |
281 | * value of parameter |
282 | */ |
283 | Standard_Real Parameter() const { |
284 | return myParameter; |
5640d653 |
285 | } |
4e57c75e |
286 | |
287 | protected: |
288 | Standard_Real myParameter; |
289 | |
290 | }; |
291 | /** |
292 | * The class BOPDS_InterfVF is is to store the information about |
293 | * the interference of the type vertex/face |
294 | */ |
295 | //======================================================================= |
296 | //function : BOPDS_InterfVF |
297 | //purpose : |
298 | //======================================================================= |
299 | class BOPDS_InterfVF : public BOPDS_Interf { |
300 | public: |
301 | // |
302 | /** |
303 | * Constructor |
304 | */ |
305 | BOPDS_InterfVF() |
306 | : BOPDS_Interf(), |
307 | myU(0.), |
308 | myV(0.) { |
5640d653 |
309 | } |
4e57c75e |
310 | // |
311 | /** |
312 | * Constructor |
313 | * @param theAllocator |
314 | * allocator to manage the memory |
315 | */ |
316 | BOPDS_InterfVF(const Handle(NCollection_BaseAllocator)& theAllocator) |
317 | : BOPDS_Interf(theAllocator), |
318 | myU(0.), |
319 | myV(0.) { |
5640d653 |
320 | } |
4e57c75e |
321 | // |
322 | /** |
323 | * Destructor |
324 | */ |
325 | virtual ~BOPDS_InterfVF() { |
5640d653 |
326 | } |
4e57c75e |
327 | // |
328 | /** |
329 | * Modifier |
330 | * Sets the value of parameters |
331 | * of the point of the vertex |
332 | * on the surface of of the face |
333 | * @param theU |
334 | * value of U parameter |
335 | * @param theV |
336 | * value of U parameter |
337 | */ |
338 | void SetUV(const Standard_Real theU, |
f1baf495 |
339 | const Standard_Real theV) { |
4e57c75e |
340 | myU=theU; |
341 | myV=theV; |
5640d653 |
342 | } |
4e57c75e |
343 | // |
344 | /** |
345 | * Selector |
346 | * Returns the value of parameters |
347 | * of the point of the vertex |
348 | * on the surface of of the face |
349 | * @param theU |
350 | * value of U parameter |
351 | * @param theV |
352 | * value of U parameter |
353 | */ |
354 | void UV(Standard_Real& theU,Standard_Real& theV) const { |
355 | theU=myU; |
356 | theV=myV; |
5640d653 |
357 | } |
4e57c75e |
358 | |
359 | protected: |
360 | Standard_Real myU; |
361 | Standard_Real myV; |
362 | |
363 | }; |
364 | /** |
365 | * The class BOPDS_InterfEE is is to store the information about |
366 | * the interference of the type edge/edge. |
367 | */ |
368 | //======================================================================= |
369 | //function : BOPDS_InterfEE |
370 | //purpose : |
371 | //======================================================================= |
372 | class BOPDS_InterfEE : public BOPDS_Interf { |
373 | public: |
374 | // |
375 | /** |
376 | * Constructor |
377 | */ |
378 | BOPDS_InterfEE() : BOPDS_Interf() { |
5640d653 |
379 | } |
4e57c75e |
380 | // |
381 | /** |
382 | * Constructor |
383 | * @param theAllocator |
384 | * allocator to manage the memory |
385 | */ |
386 | BOPDS_InterfEE(const Handle(NCollection_BaseAllocator)& theAllocator) |
387 | : BOPDS_Interf(theAllocator) { |
5640d653 |
388 | } |
4e57c75e |
389 | // |
390 | /** |
391 | * Destructor |
392 | */ |
393 | virtual ~BOPDS_InterfEE() { |
5640d653 |
394 | } |
4e57c75e |
395 | // |
396 | /** |
397 | * Modifier |
398 | * Sets the info of common part |
399 | * @param theCP |
400 | * common part |
401 | */ |
402 | void SetCommonPart(const IntTools_CommonPrt& theCP) { |
403 | myCommonPart=theCP; |
5640d653 |
404 | } |
4e57c75e |
405 | // |
406 | /** |
407 | * Selector |
408 | * Returns the info of common part |
409 | * @return |
410 | * common part |
411 | */ |
412 | const IntTools_CommonPrt& CommonPart() const { |
413 | return myCommonPart; |
5640d653 |
414 | } |
4e57c75e |
415 | |
416 | protected: |
417 | IntTools_CommonPrt myCommonPart; |
418 | }; |
419 | /** |
420 | * The class BOPDS_InterfEF is is to store the information about |
421 | * the interference of the type edge/face. |
422 | */ |
423 | //======================================================================= |
424 | //function : BOPDS_InterfEF |
425 | //purpose : |
426 | //======================================================================= |
427 | class BOPDS_InterfEF : public BOPDS_Interf { |
428 | public: |
429 | // |
430 | /** |
431 | * Constructor |
432 | */ |
433 | BOPDS_InterfEF(): BOPDS_Interf() { |
5640d653 |
434 | } |
4e57c75e |
435 | // |
436 | /** |
437 | * Constructor |
438 | * @param theAllocator |
439 | * allocator to manage the memory |
440 | */ |
441 | /** |
442 | * Constructor |
443 | * @param theAllocator |
444 | * allocator to manage the memory |
445 | */ |
446 | BOPDS_InterfEF(const Handle(NCollection_BaseAllocator)& theAllocator) |
447 | : BOPDS_Interf(theAllocator) { |
5640d653 |
448 | } |
4e57c75e |
449 | // |
450 | /** |
451 | * Destructor |
452 | */ |
453 | virtual ~BOPDS_InterfEF() { |
5640d653 |
454 | } |
4e57c75e |
455 | // |
456 | /** |
457 | * Modifier |
458 | * Sets the info of common part |
459 | * @param theCP |
460 | * common part |
461 | */ |
462 | void SetCommonPart(const IntTools_CommonPrt& theCP){ |
463 | myCommonPart=theCP; |
5640d653 |
464 | } |
4e57c75e |
465 | // |
466 | /** |
467 | * Selector |
468 | * Returns the info of common part |
469 | * @return |
470 | * common part |
471 | */ |
472 | const IntTools_CommonPrt& CommonPart() const { |
473 | return myCommonPart; |
5640d653 |
474 | } |
4e57c75e |
475 | // |
476 | protected: |
477 | IntTools_CommonPrt myCommonPart; |
478 | } |
479 | /** |
480 | * The class BOPDS_InterfFF is is to store the information about |
481 | * the interference of the type face/face. |
482 | */; |
483 | //======================================================================= |
484 | //function : BOPDS_InterfFF |
485 | //purpose : |
486 | //======================================================================= |
487 | class BOPDS_InterfFF : public BOPDS_Interf { |
488 | public: |
489 | // |
490 | /** |
491 | * Constructor |
492 | */ |
493 | BOPDS_InterfFF() |
494 | : |
495 | BOPDS_Interf(), |
7ff8f019 |
496 | myTangentFaces(Standard_False), |
402bfe81 |
497 | myCurves(0, myAllocator), |
498 | myPoints(0, myAllocator) |
499 | { |
5640d653 |
500 | } |
4e57c75e |
501 | // |
4e57c75e |
502 | /** |
503 | * Destructor |
504 | */ |
505 | virtual ~BOPDS_InterfFF() { |
5640d653 |
506 | } |
4e57c75e |
507 | // |
508 | /** |
509 | * Initializer |
510 | * @param theNbCurves |
511 | * number of intersection curves |
512 | * @param theNbPoints |
513 | * number of intersection points |
514 | */ |
402bfe81 |
515 | |
a82b7ef7 |
516 | void Init(const Standard_Integer theNbCurves, |
517 | const Standard_Integer theNbPoints) { |
402bfe81 |
518 | if (theNbCurves>0) { |
519 | myCurves.SetIncrement(theNbCurves); |
520 | } |
521 | if (theNbPoints>0) { |
522 | myPoints.SetIncrement(theNbPoints); |
523 | } |
4e57c75e |
524 | } |
7ff8f019 |
525 | /** |
526 | * Modifier |
527 | * Sets the flag of whether the faces are tangent |
528 | * @param theFlag |
529 | * the flag |
530 | */ |
531 | void SetTangentFaces(const Standard_Boolean theFlag) { |
532 | myTangentFaces=theFlag; |
533 | } |
534 | /** |
535 | * Selector |
536 | * Returns the flag whether the faces are tangent |
537 | * @return |
538 | * the flag |
539 | */ |
540 | Standard_Boolean TangentFaces()const { |
541 | return myTangentFaces; |
542 | } |
4e57c75e |
543 | // |
544 | /** |
545 | * Selector |
546 | * Returns the intersection curves |
547 | * @return |
548 | * intersection curves |
549 | */ |
550 | const BOPDS_VectorOfCurve& Curves()const{ |
551 | return myCurves; |
5640d653 |
552 | } |
4e57c75e |
553 | // |
554 | /** |
555 | * Selector/Modifier |
556 | * Returns the intersection curves |
557 | * @return |
558 | * intersection curves |
559 | */ |
560 | BOPDS_VectorOfCurve& ChangeCurves(){ |
561 | return myCurves; |
5640d653 |
562 | } |
4e57c75e |
563 | // |
564 | /** |
565 | * Selector |
566 | * Returns the intersection points |
567 | * @return |
568 | * intersection points |
569 | */ |
570 | const BOPDS_VectorOfPoint& Points()const{ |
571 | return myPoints; |
5640d653 |
572 | } |
4e57c75e |
573 | // |
574 | /** |
575 | * Selector/Modifier |
576 | * Returns the intersection points |
577 | * @return |
578 | * intersection points |
579 | */ |
580 | BOPDS_VectorOfPoint& ChangePoints(){ |
581 | return myPoints; |
5640d653 |
582 | } |
4e57c75e |
583 | // |
584 | protected: |
7ff8f019 |
585 | Standard_Boolean myTangentFaces; |
4e57c75e |
586 | BOPDS_VectorOfCurve myCurves; |
587 | BOPDS_VectorOfPoint myPoints; |
588 | }; |
589 | |
ceaa5e27 |
590 | /** |
591 | * The class BOPDS_InterfVZ is is to store the information about |
592 | * the interference of the type vertex/solid. |
593 | */ |
594 | //======================================================================= |
595 | //function : BOPDS_InterfVZ |
596 | //purpose : |
597 | //======================================================================= |
598 | class BOPDS_InterfVZ : public BOPDS_Interf { |
599 | public: |
600 | // |
601 | /** |
602 | * Constructor |
603 | */ |
604 | BOPDS_InterfVZ() : BOPDS_Interf() { |
605 | }; |
606 | // |
607 | /** |
608 | * Constructor |
609 | * @param theAllocator |
610 | * allocator to manage the memory |
611 | */ |
612 | BOPDS_InterfVZ(const Handle(NCollection_BaseAllocator)& theAllocator) |
613 | : BOPDS_Interf(theAllocator) { |
614 | }; |
615 | // |
616 | /** |
617 | * Destructor |
618 | */ |
619 | virtual ~BOPDS_InterfVZ() { |
620 | }; |
621 | // |
622 | }; |
623 | /** |
624 | * The class BOPDS_InterfEZ is is to store the information about |
625 | * the interference of the type edge/solid. |
626 | */ |
627 | //======================================================================= |
628 | //function : BOPDS_InterfEZ |
629 | //purpose : |
630 | //======================================================================= |
631 | class BOPDS_InterfEZ : public BOPDS_Interf { |
632 | public: |
633 | // |
634 | /** |
635 | * Constructor |
636 | */ |
637 | BOPDS_InterfEZ() : BOPDS_Interf() { |
638 | }; |
639 | // |
640 | /** |
641 | * Constructor |
642 | * @param theAllocator |
643 | * allocator to manage the memory |
644 | */ |
645 | BOPDS_InterfEZ(const Handle(NCollection_BaseAllocator)& theAllocator) |
646 | : BOPDS_Interf(theAllocator) { |
647 | }; |
648 | // |
649 | /** |
650 | * Destructor |
651 | */ |
652 | virtual ~BOPDS_InterfEZ() { |
653 | }; |
654 | // |
655 | }; |
656 | /** |
657 | * The class BOPDS_InterfFZ is is to store the information about |
658 | * the interference of the type face/solid. |
659 | */ |
660 | //======================================================================= |
661 | //function : BOPDS_InterfFZ |
662 | //purpose : |
663 | //======================================================================= |
664 | class BOPDS_InterfFZ : public BOPDS_Interf { |
665 | public: |
666 | // |
667 | /** |
668 | * Constructor |
669 | */ |
670 | BOPDS_InterfFZ() : BOPDS_Interf() { |
671 | }; |
672 | // |
673 | /** |
674 | * Constructor |
675 | * @param theAllocator |
676 | * allocator to manage the memory |
677 | */ |
678 | BOPDS_InterfFZ(const Handle(NCollection_BaseAllocator)& theAllocator) |
679 | : BOPDS_Interf(theAllocator) { |
680 | }; |
681 | // |
682 | /** |
683 | * Destructor |
684 | */ |
685 | virtual ~BOPDS_InterfFZ() { |
686 | }; |
687 | // |
688 | }; |
689 | /** |
690 | * The class BOPDS_InterfZZ is is to store the information about |
691 | * the interference of the type solid/solid. |
692 | */ |
693 | //======================================================================= |
694 | //function : BOPDS_InterfZZ |
695 | //purpose : |
696 | //======================================================================= |
697 | class BOPDS_InterfZZ : public BOPDS_Interf { |
698 | public: |
699 | // |
700 | /** |
701 | * Constructor |
702 | */ |
703 | BOPDS_InterfZZ() : BOPDS_Interf() { |
704 | }; |
705 | // |
706 | /** |
707 | * Constructor |
708 | * @param theAllocator |
709 | * allocator to manage the memory |
710 | */ |
711 | BOPDS_InterfZZ(const Handle(NCollection_BaseAllocator)& theAllocator) |
712 | : BOPDS_Interf(theAllocator) { |
713 | }; |
714 | // |
715 | /** |
716 | * Destructor |
717 | */ |
718 | virtual ~BOPDS_InterfZZ() { |
719 | }; |
720 | // |
721 | }; |
722 | |
4e57c75e |
723 | #endif |