0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / BOPDS / BOPDS_Interf.hxx
1 // Created by: Peter KURNEV
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 //
4 // This file is part of Open CASCADE Technology software library.
5 //
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
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.
11 //
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
14
15 #ifndef BOPDS_Interf_HeaderFile
16 #define BOPDS_Interf_HeaderFile
17
18 #include <IntTools_CommonPrt.hxx>
19 #include <NCollection_BaseAllocator.hxx>
20 #include <BOPDS_VectorOfCurve.hxx>
21 #include <BOPDS_VectorOfPoint.hxx>
22
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,
44     const Standard_Integer theIndex2) {
45     myIndex1=theIndex1; 
46     myIndex2=theIndex2; 
47   }
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,
57         Standard_Integer& theIndex2) const {
58    theIndex1=myIndex1; 
59    theIndex2=myIndex2; 
60         }
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; 
69   }
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;
78   }
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; 
87   }
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; 
96   }
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     }
115   }
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;
135   }
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; 
145   }
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);
158   }
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 {
166     return (myIndexNew+1);
167   }
168   //
169  protected:     
170   BOPDS_Interf() :
171     myIndex1(-1), 
172     myIndex2(-1),
173     myIndexNew(-1),
174     myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()) {
175   }
176   //
177   BOPDS_Interf(const Handle(NCollection_BaseAllocator)& theAllocator) :
178     myIndex1(-1), 
179     myIndex2(-1),
180     myIndexNew(-1),
181     myAllocator(theAllocator) {
182   }
183   //
184   virtual ~BOPDS_Interf() {
185   }
186   
187  protected:   
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() {
208   }
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) {
217   }
218   //
219   /**
220    *  Destructor
221    */
222   virtual ~BOPDS_InterfVV() {
223   }
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.) {
244   }
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.) {
255   }
256   //
257   /**
258    *  Destructor
259    */
260   virtual ~BOPDS_InterfVE() {
261   }
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;
273   }
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;
285   }
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.) {
309   }
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.) {
320   }
321   //
322   /**
323    *  Destructor
324    */  
325   virtual ~BOPDS_InterfVF() {
326   }
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,
339       const Standard_Real theV) {
340     myU=theU;
341     myV=theV;
342   }
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;
357   }
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() {
379   }
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) {
388   }
389   //
390   /**
391    *  Destructor
392    */
393   virtual ~BOPDS_InterfEE() {
394   }
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;
404   }
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;
414   }
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() {
434   }
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) {
448   }
449   //
450   /**
451    *  Destructor
452    */
453   virtual ~BOPDS_InterfEF() {
454   }
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;
464   }
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;
474   }
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(),
496       myTangentFaces(Standard_False),
497       myTolR3D(1.e-7),
498       myTolR2D(1.e-7),
499       myCurves(0, myAllocator),
500       myPoints(0, myAllocator) 
501   {
502   }
503   //
504   /**
505    *  Destructor
506    */
507   virtual ~BOPDS_InterfFF() {
508   }
509   //
510   /**
511    * Initializer
512    * @param theNbCurves
513    *   number of intersection curves
514    * @param theNbPoints
515    *   number of intersection points
516    */
517   
518   void Init(const Standard_Integer theNbCurves,
519             const Standard_Integer theNbPoints) {
520     //modified by NIZNHY-PKV Mon Jan 26 09:01:06 2015f
521     if (theNbCurves>0) {
522       myCurves.SetIncrement(theNbCurves);
523     }
524     if (theNbPoints>0) {
525       myPoints.SetIncrement(theNbPoints);
526     }
527     /*
528     if (theNbCurves>0) {
529       myCurves.SetStartSize(theNbCurves);
530       myCurves.SetIncrement(theNbCurves);
531       myCurves.Init();
532     }
533     if (theNbPoints>0) {
534       myPoints.SetStartSize(theNbPoints);
535       myPoints.SetIncrement(theNbPoints);
536       myPoints.Init();
537     }
538     */
539     //modified by NIZNHY-PKV Mon Jan 26 09:01:12 2015t
540   }
541   /**
542    * Modifier
543    * Sets the flag of whether the faces are tangent  
544    * @param theFlag
545    *   the flag 
546    */
547   void SetTangentFaces(const Standard_Boolean theFlag) {
548      myTangentFaces=theFlag;
549   }
550   /**
551    * Selector
552    * Returns the flag whether the faces are tangent  
553    * @return
554    *   the flag 
555    */
556   Standard_Boolean TangentFaces()const {
557     return myTangentFaces;
558   }
559   /**
560    * Modifier
561    * Sets the value of 3D tolerance  
562    * @param theTol
563    *   3D tolerance
564    */
565   void SetTolR3D(const Standard_Real theTol) {
566      myTolR3D=theTol;
567   }
568   //
569   /**
570    * Selector
571    * Returns the value of 3D tolerance  
572    * @return
573    *   3D tolerance
574    */
575   Standard_Real TolR3D()const {
576     return myTolR3D;
577   }
578   //
579   /**
580    * Modifier
581    * Sets the value of 2D tolerance  
582    * @param theTol
583    *   2D tolerance
584    */
585   void SetTolR2D(const Standard_Real theTol) {
586      myTolR2D=theTol;;
587   }
588   //
589   /**
590    * Selector 
591    * Returns the value of 2D tolerance  
592    * @return
593    *   2D tolerance
594    */
595   Standard_Real TolR2D()const {
596     return myTolR2D;
597   }
598   //
599   /**
600    * Selector
601    * Returns the intersection curves  
602    * @return
603    *   intersection curves 
604    */
605   const BOPDS_VectorOfCurve& Curves()const{
606     return myCurves;
607   }
608   //
609   /**
610    * Selector/Modifier
611    * Returns the intersection curves  
612    * @return
613    *   intersection curves 
614    */
615   BOPDS_VectorOfCurve& ChangeCurves(){
616     return myCurves;
617   }
618   //
619   /**
620    * Selector
621    * Returns the intersection points  
622    * @return
623    *   intersection points
624    */
625   const BOPDS_VectorOfPoint& Points()const{
626     return myPoints;
627   }
628   //
629   /**
630    * Selector/Modifier
631    * Returns the intersection points  
632    * @return
633    *   intersection points
634    */
635   BOPDS_VectorOfPoint& ChangePoints(){
636     return myPoints;
637   }
638   //
639  protected:
640   Standard_Boolean myTangentFaces;
641   Standard_Real myTolR3D;
642   Standard_Real myTolR2D;
643   BOPDS_VectorOfCurve myCurves;
644   BOPDS_VectorOfPoint myPoints;
645 };
646
647 /**
648  * The class BOPDS_InterfVZ is is to store the information about
649  * the interference of the type vertex/solid. 
650 */
651 //=======================================================================
652 //function : BOPDS_InterfVZ
653 //purpose  : 
654 //=======================================================================
655 class BOPDS_InterfVZ  : public BOPDS_Interf {
656  public:
657   //
658   /**
659    *  Constructor
660    */
661   BOPDS_InterfVZ() : BOPDS_Interf() {
662   };
663   //
664   /**
665    *  Constructor
666    * @param theAllocator
667    *   allocator to manage the memory
668    */
669   BOPDS_InterfVZ(const Handle(NCollection_BaseAllocator)& theAllocator) 
670     : BOPDS_Interf(theAllocator) {
671   };
672   //
673   /**
674    *  Destructor
675    */
676   virtual ~BOPDS_InterfVZ() {
677   };
678   //
679 };
680 /**
681  * The class BOPDS_InterfEZ is is to store the information about
682  * the interference of the type edge/solid. 
683 */
684 //=======================================================================
685 //function : BOPDS_InterfEZ
686 //purpose  : 
687 //=======================================================================
688 class BOPDS_InterfEZ  : public BOPDS_Interf {
689  public:
690   //
691   /**
692    *  Constructor
693    */
694   BOPDS_InterfEZ() : BOPDS_Interf() {
695   };
696   //
697   /**
698    *  Constructor
699    * @param theAllocator
700    *   allocator to manage the memory
701    */
702   BOPDS_InterfEZ(const Handle(NCollection_BaseAllocator)& theAllocator) 
703     : BOPDS_Interf(theAllocator) {
704   };
705   //
706   /**
707    *  Destructor
708    */
709   virtual ~BOPDS_InterfEZ() {
710   };
711   //
712 };
713 /**
714  * The class BOPDS_InterfFZ is is to store the information about
715  * the interference of the type face/solid. 
716 */
717 //=======================================================================
718 //function : BOPDS_InterfFZ
719 //purpose  : 
720 //=======================================================================
721 class BOPDS_InterfFZ  : public BOPDS_Interf {
722  public:
723   //
724   /**
725    *  Constructor
726    */
727   BOPDS_InterfFZ() : BOPDS_Interf() {
728   };
729   //
730   /**
731    *  Constructor
732    * @param theAllocator
733    *   allocator to manage the memory
734    */
735   BOPDS_InterfFZ(const Handle(NCollection_BaseAllocator)& theAllocator) 
736     : BOPDS_Interf(theAllocator) {
737   };
738   //
739   /**
740    *  Destructor
741    */
742   virtual ~BOPDS_InterfFZ() {
743   };
744   //
745 };
746 /**
747  * The class BOPDS_InterfZZ is is to store the information about
748  * the interference of the type solid/solid. 
749 */
750 //=======================================================================
751 //function : BOPDS_InterfZZ
752 //purpose  : 
753 //=======================================================================
754 class BOPDS_InterfZZ  : public BOPDS_Interf {
755  public:
756   //
757   /**
758    *  Constructor
759    */
760   BOPDS_InterfZZ() : BOPDS_Interf() {
761   };
762   //
763   /**
764    *  Constructor
765    * @param theAllocator
766    *   allocator to manage the memory
767    */
768   BOPDS_InterfZZ(const Handle(NCollection_BaseAllocator)& theAllocator) 
769     : BOPDS_Interf(theAllocator) {
770   };
771   //
772   /**
773    *  Destructor
774    */
775   virtual ~BOPDS_InterfZZ() {
776   };
777   //
778 };
779
780 #endif