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