1 // Created by: Peter KURNEV
2 // Copyright (c) 2010-2012 OPEN CASCADE SAS
3 // Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
4 // Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT,
5 // EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
7 // The content of this file is subject to the Open CASCADE Technology Public
8 // License Version 6.5 (the "License"). You may not use the content of this file
9 // except in compliance with the License. Please obtain a copy of the License
10 // at http://www.opencascade.org and read it completely before using this file.
12 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
13 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
15 // The Original Code and all software distributed under the License is
16 // distributed on an "AS IS" basis, without warranty of any kind, and the
17 // Initial Developer hereby disclaims all such warranties, including without
18 // limitation, any warranties of merchantability, fitness for a particular
19 // purpose or non-infringement. Please see the License for the specific terms
20 // and conditions governing the rights and limitations under the License.
22 #include <BOPAlgo_CheckerSI.ixx>
24 #include <BOPDS_DS.hxx>
25 #include <BOPDS_IteratorSI.hxx>
26 #include <BOPDS_PIteratorSI.hxx>
27 #include <BOPInt_Context.hxx>
29 #include <BOPDS_Interf.hxx>
30 #include <BOPDS_MapOfPassKey.hxx>
31 #include <BOPDS_PassKey.hxx>
32 #include <BOPDS_VectorOfInterfVV.hxx>
33 #include <BOPDS_VectorOfInterfVE.hxx>
34 #include <BOPDS_VectorOfInterfVE.hxx>
35 #include <BOPDS_VectorOfInterfVF.hxx>
36 #include <BOPDS_VectorOfInterfEF.hxx>
37 #include <BOPDS_VectorOfInterfFF.hxx>
38 #include <BOPDS_VectorOfPoint.hxx>
39 #include <BOPTools_AlgoTools.hxx>
41 //=======================================================================
44 //=======================================================================
45 BOPAlgo_CheckerSI::BOPAlgo_CheckerSI()
51 //=======================================================================
54 //=======================================================================
55 BOPAlgo_CheckerSI::~BOPAlgo_CheckerSI()
58 //=======================================================================
59 //function : SetLevelOfCheck
61 //=======================================================================
62 void BOPAlgo_CheckerSI::SetLevelOfCheck(const Standard_Integer theLevel)
64 if (theLevel >= 0 && theLevel <= 5) {
65 myLevelOfCheck = theLevel;
68 //=======================================================================
71 //=======================================================================
72 void BOPAlgo_CheckerSI::Init()
76 if (!myArguments.Extent()) {
84 myDS=new BOPDS_DS(myAllocator);
85 myDS->SetArguments(myArguments);
89 BOPDS_PIteratorSI theIterSI=new BOPDS_IteratorSI(myAllocator);
90 theIterSI->SetDS(myDS);
92 theIterSI->UpdateByLevelOfCheck(myLevelOfCheck);
97 myContext=new BOPInt_Context;
101 //=======================================================================
104 //=======================================================================
105 void BOPAlgo_CheckerSI::Perform()
107 BOPAlgo_PaveFiller::Perform();
114 //=======================================================================
115 //function : PostTreat
117 //=======================================================================
118 void BOPAlgo_CheckerSI::PostTreat()
120 Standard_Integer i, aNb, n1, n2;
123 BOPDS_MapOfPassKey& aMPK=*((BOPDS_MapOfPassKey*)&myDS->Interferences());
127 BOPDS_VectorOfInterfVV& aVVs=myDS->InterfVV();
129 for (i=0; i!=aNb; ++i) {
130 const BOPDS_InterfVV& aVV=aVVs(i);
137 BOPDS_VectorOfInterfVE& aVEs=myDS->InterfVE();
139 for (i=0; i!=aNb; ++i) {
140 const BOPDS_InterfVE& aVE=aVEs(i);
147 BOPDS_VectorOfInterfEE& aEEs=myDS->InterfEE();
149 for (i=0; i!=aNb; ++i) {
150 const BOPDS_InterfEE& aEE=aEEs(i);
157 BOPDS_VectorOfInterfVF& aVFs=myDS->InterfVF();
159 for (i=0; i!=aNb; ++i) {
160 const BOPDS_InterfVF& aVF=aVFs(i);
167 BOPDS_VectorOfInterfEF& aEFs=myDS->InterfEF();
169 for (i=0; i!=aNb; ++i) {
170 const BOPDS_InterfEF& aEF=aEFs(i);
171 if (aEF.CommonPart().Type()==TopAbs_SHAPE) {
180 BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
182 for (i=0; i!=aNb; ++i) {
183 Standard_Boolean bTangentFaces, bFlag;
184 Standard_Integer aNbC, aNbP, j, iFound;
186 const BOPDS_InterfFF& aFF=aFFs(i);
189 bTangentFaces=aFF.TangentFaces();
190 aNbP=aFF.Points().Extent();
191 const BOPDS_VectorOfCurve& aVC=aFF.Curves();
193 if (!aNbP && !aNbC && !bTangentFaces) {
199 const TopoDS_Face& aF1 = *((TopoDS_Face*)&myDS->Shape(n1));
200 const TopoDS_Face& aF2 = *((TopoDS_Face*)&myDS->Shape(n2));
201 bFlag=BOPTools_AlgoTools::AreFacesSameDomain(aF1, aF2, myContext);
207 for (j=0; j!=aNbC; ++j) {
208 const BOPDS_Curve& aNC=aVC(j);
209 const BOPDS_ListOfPaveBlock& aLPBC=aNC.PaveBlocks();
210 if (aLPBC.Extent()) {