Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:04

0001 // Created by: Peter KURNEV
0002 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0003 //
0004 // This file is part of Open CASCADE Technology software library.
0005 //
0006 // This library is free software; you can redistribute it and/or modify it under
0007 // the terms of the GNU Lesser General Public License version 2.1 as published
0008 // by the Free Software Foundation, with special exception defined in the file
0009 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0010 // distribution for complete text of the license and disclaimer of any warranty.
0011 //
0012 // Alternatively, this file may be used under the terms of Open CASCADE
0013 // commercial license or contractual agreement.
0014 
0015 #ifndef BOPDS_Interf_HeaderFile
0016 #define BOPDS_Interf_HeaderFile
0017 
0018 #include <IntTools_CommonPrt.hxx>
0019 #include <NCollection_BaseAllocator.hxx>
0020 #include <BOPDS_VectorOfCurve.hxx>
0021 #include <BOPDS_VectorOfPoint.hxx>
0022 
0023 /**
0024  * The class BOPDS_Interf stores the information about
0025  * the interference between two shapes. 
0026  * The class BOPDS_Interf is root class 
0027  *
0028 */
0029 //=======================================================================
0030 //function : BOPDS_Interf
0031 //purpose  : 
0032 //=======================================================================
0033 class BOPDS_Interf  {
0034  public:
0035   //
0036   /**
0037    * Sets the indices of interferred shapes
0038    * @param theIndex1
0039    *   index of the first shape
0040    * @param theIndex2
0041    *   index of the second shape
0042    */
0043   void SetIndices(const Standard_Integer theIndex1,
0044     const Standard_Integer theIndex2) {
0045     myIndex1=theIndex1; 
0046     myIndex2=theIndex2; 
0047   }
0048   //
0049   /**
0050    * Returns the indices of interferred shapes
0051    * @param theIndex1
0052    *   index of the first shape
0053    * @param theIndex2
0054    *   index of the second shape
0055    */
0056   void Indices(Standard_Integer& theIndex1,
0057         Standard_Integer& theIndex2) const {
0058    theIndex1=myIndex1; 
0059    theIndex2=myIndex2; 
0060         }
0061   //
0062   /**
0063    * Sets the index of the first interferred shape
0064    * @param theIndex
0065    *   index of the first shape 
0066    */
0067   void SetIndex1(const Standard_Integer theIndex) {
0068     myIndex1=theIndex; 
0069   }
0070   //
0071   /**
0072    * Sets the index of the second interferred shape
0073    * @param theIndex
0074    *   index of the second shape 
0075    */
0076   void SetIndex2(const Standard_Integer theIndex) {
0077     myIndex2=theIndex;
0078   }
0079   //
0080   /**
0081    * Returns the index of the first interferred shape
0082    * @return
0083    *   index of the first shape 
0084    */
0085   Standard_Integer Index1() const {
0086     return myIndex1; 
0087   }
0088   //
0089   /**
0090    * Returns the index of the second interferred shape
0091    * @return
0092    *   index of the second shape 
0093    */
0094   Standard_Integer Index2() const {
0095     return myIndex2; 
0096   }
0097   //
0098   /**
0099    * Returns the index of that are opposite to the given index
0100    * @param theI
0101    *   the index
0102    * @return
0103    *   index of opposite shape 
0104    */
0105   Standard_Integer OppositeIndex(const Standard_Integer theI) const {
0106     if (theI==myIndex1) {
0107       return myIndex2;
0108     }
0109     else if(theI==myIndex2) {
0110       return myIndex1;
0111     }
0112     else {
0113       return -1;
0114     }
0115   }
0116   //
0117   /**
0118    * Returns true if the interference contains given index
0119    * @param theIndex 
0120    *   the index
0121    * @return
0122    *   true if the interference contains given index
0123    */
0124   Standard_Boolean Contains(const Standard_Integer theIndex)const {
0125     return (myIndex1==theIndex || myIndex2==theIndex);
0126   }
0127   //
0128   /**
0129    * Sets the index of new shape 
0130    * @param theIndex 
0131    *   the index
0132    */
0133   void SetIndexNew(const Standard_Integer theIndex) {
0134     myIndexNew=theIndex;
0135   }
0136   //
0137   //
0138   /**
0139    * Returns the index of new shape 
0140    * @return theIndex 
0141    *   the index of new shape 
0142    */
0143   Standard_Integer IndexNew() const {
0144     return myIndexNew; 
0145   }
0146   //
0147   /**
0148    * Returns true if the interference has index of new shape
0149    * that is equal to the given index 
0150    * @param theIndex 
0151    *   the index
0152    * @return true if the interference has index of new shape
0153    * that is equal to the given index 
0154    */
0155   Standard_Boolean HasIndexNew(Standard_Integer& theIndex) const {
0156     theIndex=myIndexNew;
0157     return (myIndexNew>=0);
0158   }
0159   //
0160   /**
0161    * Returns true if the interference has index of new shape
0162    *   the index
0163    * @return true if the interference has index of new shape
0164    */
0165   Standard_Boolean HasIndexNew() const {
0166     return (myIndexNew+1) != 0;
0167   }
0168   //
0169  protected:     
0170   BOPDS_Interf() :
0171     myIndex1(-1), 
0172     myIndex2(-1),
0173     myIndexNew(-1),
0174     myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()) {
0175   }
0176   //
0177   BOPDS_Interf(const Handle(NCollection_BaseAllocator)& theAllocator) :
0178     myIndex1(-1), 
0179     myIndex2(-1),
0180     myIndexNew(-1),
0181     myAllocator(theAllocator) {
0182   }
0183   //
0184   virtual ~BOPDS_Interf() {
0185   }
0186   
0187  protected:   
0188   Standard_Integer myIndex1;
0189   Standard_Integer myIndex2;
0190   Standard_Integer myIndexNew;
0191   Handle(NCollection_BaseAllocator) myAllocator;
0192 };
0193 /**
0194  * The class BOPDS_InterfVV stores the information about
0195  * the interference of the type vertex/vertex. 
0196 */
0197 //=======================================================================
0198 //function : BOPDS_InterfVV
0199 //purpose  : 
0200 //=======================================================================
0201 class BOPDS_InterfVV  : public BOPDS_Interf {
0202  public:
0203   //
0204   /**
0205    *  Constructor
0206    */
0207   BOPDS_InterfVV() : BOPDS_Interf() {
0208   }
0209   //
0210   /**
0211    *  Constructor
0212    * @param theAllocator
0213    *   allocator to manage the memory
0214    */
0215   BOPDS_InterfVV(const Handle(NCollection_BaseAllocator)& theAllocator) 
0216     : BOPDS_Interf(theAllocator) {
0217   }
0218   //
0219   /**
0220    *  Destructor
0221    */
0222   virtual ~BOPDS_InterfVV() {
0223   }
0224   //
0225 };
0226 /**
0227  * The class BOPDS_InterfVE stores the information about
0228  * the interference of the type vertex/edge. 
0229 */
0230 //=======================================================================
0231 //function : BOPDS_InterfVE
0232 //purpose  : 
0233 //=======================================================================
0234 class BOPDS_InterfVE  : public BOPDS_Interf {
0235  public:
0236   //
0237   /**
0238    *  Constructor
0239    */
0240   BOPDS_InterfVE() 
0241     :
0242       BOPDS_Interf(),
0243       myParameter(0.) {
0244   }
0245   //
0246   /**
0247    *  Constructor
0248    * @param theAllocator
0249    *   allocator to manage the memory
0250    */
0251   BOPDS_InterfVE(const Handle(NCollection_BaseAllocator)& theAllocator) 
0252     :
0253       BOPDS_Interf(theAllocator),
0254       myParameter(0.) {
0255   }
0256   //
0257   /**
0258    *  Destructor
0259    */
0260   virtual ~BOPDS_InterfVE() {
0261   }
0262   //
0263   /**
0264    *  Modifier
0265    * Sets the value of parameter 
0266    * of the point of the vertex 
0267    * on the curve of the edge
0268    * @param theT
0269    *   value of parameter 
0270    */
0271   void SetParameter(const Standard_Real theT) {
0272     myParameter=theT;
0273   }
0274   //
0275   /**
0276    *  Selector
0277    * Returrns the value of parameter 
0278    * of the point of the vertex 
0279    * on the curve of the edge
0280    * @return
0281    *   value of parameter 
0282    */
0283   Standard_Real Parameter() const {
0284     return myParameter;
0285   }
0286   
0287  protected:
0288   Standard_Real myParameter;
0289   
0290 };
0291 /**
0292  * The class BOPDS_InterfVF stores the information about
0293  * the interference of the type vertex/face 
0294 */
0295 //=======================================================================
0296 //function : BOPDS_InterfVF
0297 //purpose  : 
0298 //=======================================================================
0299 class BOPDS_InterfVF  : public BOPDS_Interf {
0300  public:
0301   //
0302   /**
0303    *  Constructor
0304    */
0305   BOPDS_InterfVF()
0306     : BOPDS_Interf(),
0307       myU(0.),
0308       myV(0.) {
0309   }
0310   //
0311   /**
0312    *  Constructor
0313    * @param theAllocator
0314    *   allocator to manage the memory
0315    */
0316   BOPDS_InterfVF(const Handle(NCollection_BaseAllocator)& theAllocator)
0317     : BOPDS_Interf(theAllocator),
0318       myU(0.),
0319       myV(0.) {
0320   }
0321   //
0322   /**
0323    *  Destructor
0324    */  
0325   virtual ~BOPDS_InterfVF() {
0326   }
0327   //
0328   /**
0329    * Modifier
0330    * Sets the value of parameters 
0331    * of the point of the vertex 
0332    * on the surface of of the face
0333    * @param theU
0334    *   value of U parameter
0335    * @param theV 
0336    *   value of U parameter 
0337    */
0338   void SetUV(const Standard_Real theU,
0339       const Standard_Real theV) {
0340     myU=theU;
0341     myV=theV;
0342   }
0343   //
0344   /**
0345    * Selector
0346    * Returns the value of parameters 
0347    * of the point of the vertex 
0348    * on the surface of of the face
0349    * @param theU
0350    *   value of U parameter
0351    * @param theV 
0352    *   value of U parameter 
0353    */
0354   void UV(Standard_Real& theU,Standard_Real& theV) const {
0355     theU=myU;
0356     theV=myV;
0357   }
0358   
0359  protected:
0360   Standard_Real myU;
0361   Standard_Real myV;
0362       
0363 };
0364 /**
0365  * The class BOPDS_InterfEE stores the information about
0366  * the interference of the type edge/edge. 
0367 */
0368 //=======================================================================
0369 //function : BOPDS_InterfEE
0370 //purpose  : 
0371 //=======================================================================
0372 class BOPDS_InterfEE  : public BOPDS_Interf {
0373  public:
0374   //
0375   /**
0376    *  Constructor
0377    */
0378   BOPDS_InterfEE() : BOPDS_Interf() {
0379   }
0380   //
0381   /**
0382    *  Constructor
0383    * @param theAllocator
0384    *   allocator to manage the memory
0385    */
0386   BOPDS_InterfEE(const Handle(NCollection_BaseAllocator)& theAllocator)
0387     : BOPDS_Interf(theAllocator) {
0388   }
0389   //
0390   /**
0391    *  Destructor
0392    */
0393   virtual ~BOPDS_InterfEE() {
0394   }
0395   //
0396   /**
0397    *  Modifier
0398    * Sets the info of common part 
0399    * @param theCP
0400    *   common part
0401    */
0402   void SetCommonPart(const IntTools_CommonPrt& theCP) {
0403     myCommonPart=theCP;
0404   }
0405   //
0406   /**
0407    *  Selector
0408    * Returns the info of common part 
0409    * @return
0410    *   common part
0411    */
0412   const IntTools_CommonPrt& CommonPart() const {
0413     return myCommonPart;
0414   }
0415   
0416  protected:
0417   IntTools_CommonPrt myCommonPart;
0418 };
0419 /**
0420  * The class BOPDS_InterfEF stores the information about
0421  * the interference of the type edge/face. 
0422 */
0423 //=======================================================================
0424 //function : BOPDS_InterfEF
0425 //purpose  : 
0426 //=======================================================================
0427 class BOPDS_InterfEF  : public BOPDS_Interf {
0428  public:
0429   //
0430   /**
0431    *  Constructor
0432    */
0433   BOPDS_InterfEF(): BOPDS_Interf() {
0434   }
0435   //
0436   /**
0437    *  Constructor
0438    * @param theAllocator
0439    *   allocator to manage the memory
0440    */
0441   /**
0442    *  Constructor
0443    * @param theAllocator
0444    *   allocator to manage the memory
0445    */
0446   BOPDS_InterfEF(const Handle(NCollection_BaseAllocator)& theAllocator)
0447     : BOPDS_Interf(theAllocator) {
0448   }
0449   //
0450   /**
0451    *  Destructor
0452    */
0453   virtual ~BOPDS_InterfEF() {
0454   }
0455   //
0456   /**
0457    * Modifier
0458    * Sets the info of common part 
0459    * @param theCP
0460    *   common part
0461    */
0462   void SetCommonPart(const IntTools_CommonPrt& theCP){
0463     myCommonPart=theCP;
0464   }
0465   //
0466   /**
0467    *  Selector
0468    * Returns the info of common part 
0469    * @return
0470    *   common part
0471    */
0472   const IntTools_CommonPrt& CommonPart() const {
0473     return myCommonPart;
0474   }
0475   //
0476  protected:
0477   IntTools_CommonPrt myCommonPart;
0478 }
0479 /**
0480  * The class BOPDS_InterfFF stores the information about
0481  * the interference of the type face/face. 
0482 */;
0483 //=======================================================================
0484 //function : BOPDS_InterfFF
0485 //purpose  : 
0486 //=======================================================================
0487 class BOPDS_InterfFF  : public BOPDS_Interf {
0488  public:
0489   //
0490   /**
0491    *  Constructor
0492    */
0493   BOPDS_InterfFF()
0494     : 
0495       BOPDS_Interf(),
0496       myTangentFaces(Standard_False),
0497       myCurves(0, myAllocator),
0498       myPoints(0, myAllocator) 
0499   {
0500   }
0501   //
0502   /**
0503    *  Destructor
0504    */
0505   virtual ~BOPDS_InterfFF() {
0506   }
0507   //
0508   /**
0509    * Initializer
0510    * @param theNbCurves
0511    *   number of intersection curves
0512    * @param theNbPoints
0513    *   number of intersection points
0514    */
0515   
0516   void Init(const Standard_Integer theNbCurves,
0517             const Standard_Integer theNbPoints) {
0518     if (theNbCurves>0) {
0519       myCurves.SetIncrement(theNbCurves);
0520     }
0521     if (theNbPoints>0) {
0522       myPoints.SetIncrement(theNbPoints);
0523     }
0524   }
0525   /**
0526    * Modifier
0527    * Sets the flag of whether the faces are tangent  
0528    * @param theFlag
0529    *   the flag 
0530    */
0531   void SetTangentFaces(const Standard_Boolean theFlag) {
0532      myTangentFaces=theFlag;
0533   }
0534   /**
0535    * Selector
0536    * Returns the flag whether the faces are tangent  
0537    * @return
0538    *   the flag 
0539    */
0540   Standard_Boolean TangentFaces()const {
0541     return myTangentFaces;
0542   }
0543   //
0544   /**
0545    * Selector
0546    * Returns the intersection curves  
0547    * @return
0548    *   intersection curves 
0549    */
0550   const BOPDS_VectorOfCurve& Curves()const{
0551     return myCurves;
0552   }
0553   //
0554   /**
0555    * Selector/Modifier
0556    * Returns the intersection curves  
0557    * @return
0558    *   intersection curves 
0559    */
0560   BOPDS_VectorOfCurve& ChangeCurves(){
0561     return myCurves;
0562   }
0563   //
0564   /**
0565    * Selector
0566    * Returns the intersection points  
0567    * @return
0568    *   intersection points
0569    */
0570   const BOPDS_VectorOfPoint& Points()const{
0571     return myPoints;
0572   }
0573   //
0574   /**
0575    * Selector/Modifier
0576    * Returns the intersection points  
0577    * @return
0578    *   intersection points
0579    */
0580   BOPDS_VectorOfPoint& ChangePoints(){
0581     return myPoints;
0582   }
0583   //
0584  protected:
0585   Standard_Boolean myTangentFaces;
0586   BOPDS_VectorOfCurve myCurves;
0587   BOPDS_VectorOfPoint myPoints;
0588 };
0589 
0590 /**
0591  * The class BOPDS_InterfVZ stores the information about
0592  * the interference of the type vertex/solid. 
0593 */
0594 //=======================================================================
0595 //function : BOPDS_InterfVZ
0596 //purpose  : 
0597 //=======================================================================
0598 class BOPDS_InterfVZ  : public BOPDS_Interf {
0599  public:
0600   //
0601   /**
0602    *  Constructor
0603    */
0604   BOPDS_InterfVZ() : BOPDS_Interf() {
0605   };
0606   //
0607   /**
0608    *  Constructor
0609    * @param theAllocator
0610    *   allocator to manage the memory
0611    */
0612   BOPDS_InterfVZ(const Handle(NCollection_BaseAllocator)& theAllocator) 
0613     : BOPDS_Interf(theAllocator) {
0614   };
0615   //
0616   /**
0617    *  Destructor
0618    */
0619   virtual ~BOPDS_InterfVZ() {
0620   };
0621   //
0622 };
0623 /**
0624  * The class BOPDS_InterfEZ stores the information about
0625  * the interference of the type edge/solid. 
0626 */
0627 //=======================================================================
0628 //function : BOPDS_InterfEZ
0629 //purpose  : 
0630 //=======================================================================
0631 class BOPDS_InterfEZ  : public BOPDS_Interf {
0632  public:
0633   //
0634   /**
0635    *  Constructor
0636    */
0637   BOPDS_InterfEZ() : BOPDS_Interf() {
0638   };
0639   //
0640   /**
0641    *  Constructor
0642    * @param theAllocator
0643    *   allocator to manage the memory
0644    */
0645   BOPDS_InterfEZ(const Handle(NCollection_BaseAllocator)& theAllocator) 
0646     : BOPDS_Interf(theAllocator) {
0647   };
0648   //
0649   /**
0650    *  Destructor
0651    */
0652   virtual ~BOPDS_InterfEZ() {
0653   };
0654   //
0655 };
0656 /**
0657  * The class BOPDS_InterfFZ stores the information about
0658  * the interference of the type face/solid. 
0659 */
0660 //=======================================================================
0661 //function : BOPDS_InterfFZ
0662 //purpose  : 
0663 //=======================================================================
0664 class BOPDS_InterfFZ  : public BOPDS_Interf {
0665  public:
0666   //
0667   /**
0668    *  Constructor
0669    */
0670   BOPDS_InterfFZ() : BOPDS_Interf() {
0671   };
0672   //
0673   /**
0674    *  Constructor
0675    * @param theAllocator
0676    *   allocator to manage the memory
0677    */
0678   BOPDS_InterfFZ(const Handle(NCollection_BaseAllocator)& theAllocator) 
0679     : BOPDS_Interf(theAllocator) {
0680   };
0681   //
0682   /**
0683    *  Destructor
0684    */
0685   virtual ~BOPDS_InterfFZ() {
0686   };
0687   //
0688 };
0689 /**
0690  * The class BOPDS_InterfZZ stores the information about
0691  * the interference of the type solid/solid. 
0692 */
0693 //=======================================================================
0694 //function : BOPDS_InterfZZ
0695 //purpose  : 
0696 //=======================================================================
0697 class BOPDS_InterfZZ  : public BOPDS_Interf {
0698  public:
0699   //
0700   /**
0701    *  Constructor
0702    */
0703   BOPDS_InterfZZ() : BOPDS_Interf() {
0704   };
0705   //
0706   /**
0707    *  Constructor
0708    * @param theAllocator
0709    *   allocator to manage the memory
0710    */
0711   BOPDS_InterfZZ(const Handle(NCollection_BaseAllocator)& theAllocator) 
0712     : BOPDS_Interf(theAllocator) {
0713   };
0714   //
0715   /**
0716    *  Destructor
0717    */
0718   virtual ~BOPDS_InterfZZ() {
0719   };
0720   //
0721 };
0722 
0723 #endif