diff --git a/src/BOPAlgo/BOPAlgo_ArgumentAnalyzer.cxx b/src/BOPAlgo/BOPAlgo_ArgumentAnalyzer.cxx index c715e05984..3dd243a5ad 100644 --- a/src/BOPAlgo/BOPAlgo_ArgumentAnalyzer.cxx +++ b/src/BOPAlgo/BOPAlgo_ArgumentAnalyzer.cxx @@ -296,21 +296,21 @@ void BOPAlgo_ArgumentAnalyzer::TestTypes() } } } - -// ================================================================================ -// function: TestSelfInterferences -// purpose: -// ================================================================================ +//======================================================================= +//function : TestSelfInterferences +//purpose : +//======================================================================= void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences() { - Standard_Integer ii = 0, j; + Standard_Integer ii=0, j; Standard_Boolean bSelfInt; for(ii = 0; ii < 2; ii++) { const TopoDS_Shape& aS = (ii == 0) ? myShape1 : myShape2; - if(aS.IsNull()) + if(aS.IsNull()) { continue; + } Standard_Boolean bIsEmpty = (ii == 0) ? myEmpty1 : myEmpty2; if (bIsEmpty) { @@ -319,6 +319,7 @@ void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences() BOPAlgo_CheckerSI aChecker; BOPCol_ListOfShape anArgs; + // anArgs.Append(aS); aChecker.SetArguments(anArgs); // @@ -332,20 +333,57 @@ void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences() BOPDS_VectorOfInterfVF& aVFs=theDS->InterfVF(); BOPDS_VectorOfInterfEF& aEFs=theDS->InterfEF(); BOPDS_VectorOfInterfFF& aFFs=theDS->InterfFF(); + BOPDS_VectorOfInterfVZ& aVZs=theDS->InterfVZ(); + BOPDS_VectorOfInterfEZ& aEZs=theDS->InterfEZ(); + BOPDS_VectorOfInterfFZ& aFZs=theDS->InterfFZ(); + BOPDS_VectorOfInterfZZ& aZZs=theDS->InterfZZ(); // - Standard_Integer aNb[6] = {aVVs.Extent(), aVEs.Extent(), aEEs.Extent(), - aVFs.Extent(), aEFs.Extent(), aFFs.Extent()}; + const Standard_Integer aNbTypeInt=10; + Standard_Integer aTypeInt, i, nI1, nI2; + Standard_Integer aNb[aNbTypeInt] = { + aVVs.Extent(), aVEs.Extent(), aEEs.Extent(), + aVFs.Extent(), aEFs.Extent(), aFFs.Extent(), + aVZs.Extent(), aEZs.Extent(), aFZs.Extent(), aZZs.Extent()}; + BOPDS_Interf* aInt=NULL; // - for (Standard_Integer aTypeInt = 0; aTypeInt < 6; ++aTypeInt) { - for (Standard_Integer i = 0; i < aNb[aTypeInt]; ++i) { - BOPDS_Interf* aInt = (aTypeInt==0) ? (BOPDS_Interf*)(&aVVs(i)) : - ((aTypeInt==1) ? (BOPDS_Interf*)(&aVEs(i)) : - ((aTypeInt==2) ? (BOPDS_Interf*)(&aEEs(i)) : - ((aTypeInt==3) ? (BOPDS_Interf*)(&aVFs(i)) : - ((aTypeInt==4) ? (BOPDS_Interf*)(&aEFs(i)) : (BOPDS_Interf*)(&aFFs(i)))))); + for (aTypeInt = 0; aTypeInt < aNbTypeInt; ++aTypeInt) { + for (i = 0; i < aNb[aTypeInt]; ++i) { + switch(aTypeInt) { + case 0: + aInt=(BOPDS_Interf*)(&aVVs(i)); + break; + case 1: + aInt=(BOPDS_Interf*)(&aVEs(i)); + break; + case 2: + aInt=(BOPDS_Interf*)(&aEEs(i)); + break; + case 3: + aInt=(BOPDS_Interf*)(&aVFs(i)); + break; + case 4: + aInt=(BOPDS_Interf*)(&aEFs(i)); + break; + case 5: + aInt=(BOPDS_Interf*)(&aFFs(i)); + break; + case 6: + aInt=(BOPDS_Interf*)(&aVZs(i)); + break; + case 7: + aInt=(BOPDS_Interf*)(&aEZs(i)); + break; + case 8: + aInt=(BOPDS_Interf*)(&aFZs(i)); + break; + case 9: + aInt=(BOPDS_Interf*)(&aZZs(i)); + break; + default: + aInt=NULL; + } // - Standard_Integer nI1 = aInt->Index1(); - Standard_Integer nI2 = aInt->Index2(); + aInt->Indices(nI1, nI2); if (nI1 == nI2) { continue; } @@ -398,6 +436,7 @@ void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences() myResult.Append(aResult); } } + // if (iErr) { BOPAlgo_CheckResult aResult; if(ii == 0) { @@ -412,9 +451,7 @@ void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences() myResult.Append(aResult); } } - } - // ================================================================================ // function: TestSmallEdge // purpose: @@ -520,7 +557,6 @@ void BOPAlgo_ArgumentAnalyzer::TestSmallEdge() } } } - // ================================================================================ // function: TestRebuildFace // purpose: diff --git a/src/BOPAlgo/BOPAlgo_CheckerSI.cdl b/src/BOPAlgo/BOPAlgo_CheckerSI.cdl index 162f0fd2b7..bd0d78a1bf 100644 --- a/src/BOPAlgo/BOPAlgo_CheckerSI.cdl +++ b/src/BOPAlgo/BOPAlgo_CheckerSI.cdl @@ -48,8 +48,23 @@ is PostTreat (me:out) is protected; - ---Purpose: Provides post-tratment actions - + ---Purpose: Provides post-tratment actions + + PerformVZ(me:out) + is virtual protected; + --Purpose: Computes Vertex/Solid interferences + + PerformEZ(me:out) + is virtual protected; + --Purpose: Computes Edge/Solid interferences + + PerformFZ(me:out) + is virtual protected; + --Purpose: Computes Face/Solid interferences + PerformZZ(me:out) + is virtual protected; + --Purpose: Computes Solid/Solid interferences + fields myLevelOfCheck: Integer from Standard is protected; diff --git a/src/BOPAlgo/BOPAlgo_CheckerSI.cxx b/src/BOPAlgo/BOPAlgo_CheckerSI.cxx index 239da5c6b8..0b4886d138 100644 --- a/src/BOPAlgo/BOPAlgo_CheckerSI.cxx +++ b/src/BOPAlgo/BOPAlgo_CheckerSI.cxx @@ -44,9 +44,9 @@ //======================================================================= BOPAlgo_CheckerSI::BOPAlgo_CheckerSI() : - BOPAlgo_PaveFiller(), - myLevelOfCheck(5) + BOPAlgo_PaveFiller() { + myLevelOfCheck=BOPDS_DS::NbInterfTypes()-1; } //======================================================================= //function : ~ @@ -61,7 +61,10 @@ BOPAlgo_CheckerSI::~BOPAlgo_CheckerSI() //======================================================================= void BOPAlgo_CheckerSI::SetLevelOfCheck(const Standard_Integer theLevel) { - if (theLevel >= 0 && theLevel <= 5) { + Standard_Integer aNbLists; + // + aNbLists=BOPDS_DS::NbInterfTypes(); + if (theLevel >= 0 && theLevel < aNbLists) { myLevelOfCheck = theLevel; } } @@ -104,7 +107,7 @@ void BOPAlgo_CheckerSI::Init() //======================================================================= void BOPAlgo_CheckerSI::Perform() { - //modified by NIZNHY-PKV Thu Sep 19 08:14:52 2013f + try { OCC_CATCH_SIGNALS // @@ -113,19 +116,31 @@ void BOPAlgo_CheckerSI::Perform() return; } // + PerformVZ(); + if (myErrorStatus) { + return; + } + // + PerformEZ(); + if (myErrorStatus) { + return; + } + // + PerformFZ(); + if (myErrorStatus) { + return; + } + // + PerformZZ(); + if (myErrorStatus) { + return; + } + // PostTreat(); } catch (Standard_Failure) { } - /* - BOPAlgo_PaveFiller::Perform(); - if (myErrorStatus) { - return; - } - // - PostTreat(); - */ - //modified by NIZNHY-PKV Thu Sep 19 08:14:56 2013t + } //======================================================================= //function : PostTreat @@ -237,4 +252,49 @@ void BOPAlgo_CheckerSI::PostTreat() aPK.SetIds(n1, n2); aMPK.Add(aPK); } + // + // + // 6 + BOPDS_VectorOfInterfVZ& aVZs=myDS->InterfVZ(); + aNb=aVZs.Extent(); + for (i=0; i!=aNb; ++i) { + // + const BOPDS_InterfVZ& aVZ=aVZs(i); + aVZ.Indices(n1, n2); + aPK.SetIds(n1, n2); + aMPK.Add(aPK); + } + // + // 7 + BOPDS_VectorOfInterfEZ& aEZs=myDS->InterfEZ(); + aNb=aEZs.Extent(); + for (i=0; i!=aNb; ++i) { + // + const BOPDS_InterfEZ& aEZ=aEZs(i); + aEZ.Indices(n1, n2); + aPK.SetIds(n1, n2); + aMPK.Add(aPK); + } + // + // 8 + BOPDS_VectorOfInterfFZ& aFZs=myDS->InterfFZ(); + aNb=aFZs.Extent(); + for (i=0; i!=aNb; ++i) { + // + const BOPDS_InterfFZ& aFZ=aFZs(i); + aFZ.Indices(n1, n2); + aPK.SetIds(n1, n2); + aMPK.Add(aPK); + } + // + // 9 + BOPDS_VectorOfInterfZZ& aZZs=myDS->InterfZZ(); + aNb=aZZs.Extent(); + for (i=0; i!=aNb; ++i) { + // + const BOPDS_InterfZZ& aZZ=aZZs(i); + aZZ.Indices(n1, n2); + aPK.SetIds(n1, n2); + aMPK.Add(aPK); + } } diff --git a/src/BOPAlgo/BOPAlgo_CheckerSI_1.cxx b/src/BOPAlgo/BOPAlgo_CheckerSI_1.cxx new file mode 100644 index 0000000000..cc6da31bb4 --- /dev/null +++ b/src/BOPAlgo/BOPAlgo_CheckerSI_1.cxx @@ -0,0 +1,227 @@ +// Created by: Peter KURNEV +// Copyright (c) 2010-2012 OPEN CASCADE SAS +// Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, +// EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. +// +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + + +//======================================================================= +//function : PerformVZ +//purpose : +//======================================================================= +void BOPAlgo_CheckerSI::PerformVZ() +{ + Standard_Boolean bJustAdd; + Standard_Integer iSize, nV, nZ, i; + Standard_Real aTol; + gp_Pnt aPV; + TopAbs_State aState; + // + myErrorStatus=0; + // + myIterator->Initialize(TopAbs_VERTEX, TopAbs_SOLID); + iSize=myIterator->ExpectedLength(); + if (!iSize) { + return; + } + // + BOPDS_VectorOfInterfVZ& aVZs=myDS->InterfVZ(); + aVZs.SetStartSize(iSize); + aVZs.SetIncrement(iSize); + aVZs.Init(); + // + for (; myIterator->More(); myIterator->Next()) { + myIterator->Value(nV, nZ, bJustAdd); + if(bJustAdd) { + continue; + } + // + const BOPDS_ShapeInfo& aSIV=myDS->ShapeInfo(nV); + const BOPDS_ShapeInfo& aSIZ=myDS->ShapeInfo(nZ); + // + const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aSIV.Shape()); + const TopoDS_Solid& aZ=*((TopoDS_Solid*)&aSIZ.Shape()); + // + BRepClass3d_SolidClassifier& aSC=myContext->SolidClassifier(aZ); + // + aPV=BRep_Tool::Pnt(aV); + aTol=BRep_Tool::Tolerance(aV); + // + aSC.Perform(aPV, aTol); + // + aState=aSC.State(); + if (aState==TopAbs_IN) { + i=aVZs.Append()-1; + BOPDS_InterfVZ& aVZ=aVZs(i); + aVZ.SetIndices(nV, nZ); + // + myDS->AddInterf(nV, nZ); + } + } + // +} +//======================================================================= +//function : PerformEZ +//purpose : +//======================================================================= +void BOPAlgo_CheckerSI::PerformEZ() +{ + Standard_Boolean bJustAdd, bHasInterf; + Standard_Integer iSize, nE, nZ, i; + // + myErrorStatus=0; + // + myIterator->Initialize(TopAbs_EDGE, TopAbs_SOLID); + iSize=myIterator->ExpectedLength(); + if (!iSize) { + return; + } + // + BOPDS_VectorOfInterfEZ& aEZs=myDS->InterfEZ(); + aEZs.SetStartSize(iSize); + aEZs.SetIncrement(iSize); + aEZs.Init(); + // + for (; myIterator->More(); myIterator->Next()) { + myIterator->Value(nE, nZ, bJustAdd); + if(bJustAdd) { + continue; + } + // + bHasInterf=myDS->HasInterfShapeSubShapes(nE, nZ); + if (bHasInterf) { + continue; + } + // + bHasInterf=myDS->HasInterfShapeSubShapes(nZ, nE); + if (!bHasInterf) { + continue; + } + // + i=aEZs.Append()-1; + BOPDS_InterfEZ& aEZ=aEZs(i); + aEZ.SetIndices(nE, nZ); + // + myDS->AddInterf(nE, nZ); + } +} +//======================================================================= +//function : PerformFZ +//purpose : +//======================================================================= +void BOPAlgo_CheckerSI::PerformFZ() +{ + Standard_Boolean bJustAdd, bHasInterf; + Standard_Integer iSize, nF, nZ, i; + // + myErrorStatus=0; + // + myIterator->Initialize(TopAbs_FACE, TopAbs_SOLID); + iSize=myIterator->ExpectedLength(); + if (!iSize) { + return; + } + // + BOPDS_VectorOfInterfFZ& aFZs=myDS->InterfFZ(); + aFZs.SetStartSize(iSize); + aFZs.SetIncrement(iSize); + aFZs.Init(); + // + for (; myIterator->More(); myIterator->Next()) { + myIterator->Value(nF, nZ, bJustAdd); + if(bJustAdd) { + continue; + } + // + bHasInterf=myDS->HasInterfShapeSubShapes(nF, nZ); + if (bHasInterf) { + continue; + } + // + bHasInterf=myDS->HasInterfShapeSubShapes(nZ, nF); + if (!bHasInterf) { + continue; + } + // + i=aFZs.Append()-1; + BOPDS_InterfFZ& aFZ=aFZs(i); + aFZ.SetIndices(nF, nZ); + // + myDS->AddInterf(nF, nZ); + } +} +//======================================================================= +//function : PerformZZ +//purpose : +//======================================================================= +void BOPAlgo_CheckerSI::PerformZZ() +{ + Standard_Boolean bJustAdd, bHasInterf, bFlag; + Standard_Integer iSize, nZ1, nZ, i; + // + myErrorStatus=0; + // + myIterator->Initialize(TopAbs_SOLID, TopAbs_SOLID); + iSize=myIterator->ExpectedLength(); + if (!iSize) { + return; + } + // + BOPDS_VectorOfInterfZZ& aZZs=myDS->InterfZZ(); + aZZs.SetStartSize(iSize); + aZZs.SetIncrement(iSize); + aZZs.Init(); + // + bFlag=Standard_False; + // + for (; myIterator->More(); myIterator->Next()) { + myIterator->Value(nZ1, nZ, bJustAdd); + if(bJustAdd) { + continue; + } + // + bHasInterf=myDS->HasInterfShapeSubShapes(nZ, nZ1, bFlag); + if (!bHasInterf) { + bHasInterf=myDS->HasInterfShapeSubShapes(nZ1, nZ, bFlag); + } + if (!bHasInterf) { + continue; + } + // + i=aZZs.Append()-1; + BOPDS_InterfZZ& aZZ=aZZs(i); + aZZ.SetIndices(nZ1, nZ); + // + myDS->AddInterf(nZ1, nZ); + } +} diff --git a/src/BOPAlgo/FILES b/src/BOPAlgo/FILES index 01a0706439..7c26eefbe5 100644 --- a/src/BOPAlgo/FILES +++ b/src/BOPAlgo/FILES @@ -13,5 +13,6 @@ BOPAlgo_Builder_4.cxx BOPAlgo_BOP_1.cxx BOPAlgo_WireSplitter_1.cxx BOPAlgo_ListOfCheckResult.hxx - BOPAlgo_Builder_2Cnt.hxx + +BOPAlgo_CheckerSI_1.cxx diff --git a/src/BOPDS/BOPDS.cdl b/src/BOPDS/BOPDS.cdl index 0d1d920654..858f744183 100644 --- a/src/BOPDS/BOPDS.cdl +++ b/src/BOPDS/BOPDS.cdl @@ -94,14 +94,22 @@ is imported InterfVF from BOPDS; imported InterfEE from BOPDS; imported InterfEF from BOPDS; - imported InterfFF from BOPDS; + imported InterfFF from BOPDS; + imported InterfVZ from BOPDS; + imported InterfEZ from BOPDS; + imported InterfFZ from BOPDS; + imported InterfZZ from BOPDS; -- imported VectorOfInterfVV from BOPDS; imported VectorOfInterfVE from BOPDS; imported VectorOfInterfVF from BOPDS; imported VectorOfInterfEE from BOPDS; imported VectorOfInterfEF from BOPDS; - imported VectorOfInterfFF from BOPDS; + imported VectorOfInterfFF from BOPDS; + imported VectorOfInterfVZ from BOPDS; + imported VectorOfInterfEZ from BOPDS; + imported VectorOfInterfFZ from BOPDS; + imported VectorOfInterfZZ from BOPDS; -- imported VectorOfPoint from BOPDS; imported VectorOfCurve from BOPDS; diff --git a/src/BOPDS/BOPDS_DS.cdl b/src/BOPDS/BOPDS_DS.cdl index bf291f03a2..67eeb913bf 100644 --- a/src/BOPDS/BOPDS_DS.cdl +++ b/src/BOPDS/BOPDS_DS.cdl @@ -66,8 +66,12 @@ uses VectorOfInterfVF from BOPDS, VectorOfInterfEE from BOPDS, VectorOfInterfEF from BOPDS, - VectorOfInterfFF from BOPDS - + VectorOfInterfFF from BOPDS, + VectorOfInterfVZ from BOPDS, + VectorOfInterfEZ from BOPDS, + VectorOfInterfFZ from BOPDS, + VectorOfInterfZZ from BOPDS + --raises is @@ -482,7 +486,46 @@ is ---Purpose: --- Selector/Modifier --- Returns the collection of interferences Face/Face - + + InterfVZ(me:out) + returns VectorOfInterfVZ from BOPDS; + ---C++: return & + ---C++: inline + ---Purpose: + --- Selector/Modifier + --- Returns the collection of interferences Vertex/Solid + + InterfEZ(me:out) + returns VectorOfInterfEZ from BOPDS; + ---C++: return & + ---C++: inline + ---Purpose: + --- Selector/Modifier + --- Returns the collection of interferences Edge/Solid + + InterfFZ(me:out) + returns VectorOfInterfFZ from BOPDS; + ---C++: return & + ---C++: inline + ---Purpose: + --- Selector/Modifier + --- Returns the collection of interferences Face/Solid + + InterfZZ(me:out) + returns VectorOfInterfZZ from BOPDS; + ---C++: return & + ---C++: inline + ---Purpose: + --- Selector/Modifier + --- Returns the collection of interferences Solid/Solid + + NbInterfTypes(myclass) + returns Integer from Standard; + ---C++: inline + ---Purpose: + -- Returns the number of types of the interferences + -- + AddInterf(me:out; theI1:Integer from Standard; theI2:Integer from Standard); @@ -513,13 +556,16 @@ is HasInterfShapeSubShapes(me; theI1:Integer from Standard; - theI2:Integer from Standard) - returns Boolean from Standard; + theI2:Integer from Standard; + theFlag: Boolean from Standard=Standard_True) + returns Boolean from Standard; ---Purpose: --- Query --- Returns true if the shape with index theI1 is interfered - --- with any of sub-shapes of the shapes with index theI2 - + --- with + -- any sub-shape of the shape with index theI2 (theFlag=true) + -- all sub-shapes of the shape with index theI2 (theFlag=false) + HasInterfSubShapes(me; theI1:Integer from Standard; theI2:Integer from Standard) @@ -588,7 +634,10 @@ is is protected; ---Purpose: --- Computes bouding box for the solid with DS-index - --- + --- + + + fields myAllocator : BaseAllocator from BOPCol is protected; myArguments : ListOfShape from BOPCol is protected; @@ -614,5 +663,8 @@ fields myInterfEE : VectorOfInterfEE from BOPDS is protected; myInterfEF : VectorOfInterfEF from BOPDS is protected; myInterfFF : VectorOfInterfFF from BOPDS is protected; - + myInterfVZ : VectorOfInterfVZ from BOPDS is protected; + myInterfEZ : VectorOfInterfEZ from BOPDS is protected; + myInterfFZ : VectorOfInterfFZ from BOPDS is protected; + myInterfZZ : VectorOfInterfZZ from BOPDS is protected; end DS; diff --git a/src/BOPDS/BOPDS_DS.cxx b/src/BOPDS/BOPDS_DS.cxx index 09f3eb1d66..5e139b5b72 100644 --- a/src/BOPDS/BOPDS_DS.cxx +++ b/src/BOPDS/BOPDS_DS.cxx @@ -85,7 +85,11 @@ BOPDS_DS::BOPDS_DS() myInterfVF(myAllocator), myInterfEE(myAllocator), myInterfEF(myAllocator), - myInterfFF(myAllocator) + myInterfFF(myAllocator), + myInterfVZ(myAllocator), + myInterfEZ(myAllocator), + myInterfFZ(myAllocator), + myInterfZZ(myAllocator) { myNbShapes=0; myNbSourceShapes=0; @@ -111,7 +115,11 @@ BOPDS_DS::BOPDS_DS(const Handle(NCollection_BaseAllocator)& theAllocator) myInterfVF(myAllocator), myInterfEE(myAllocator), myInterfEF(myAllocator), - myInterfFF(myAllocator) + myInterfFF(myAllocator), + myInterfVZ(myAllocator), + myInterfEZ(myAllocator), + myInterfFZ(myAllocator), + myInterfZZ(myAllocator) { myNbShapes=0; myNbSourceShapes=0; @@ -148,6 +156,10 @@ void BOPDS_DS::Clear() myInterfEE.Clear(); myInterfEF.Clear(); myInterfFF.Clear(); + myInterfVZ.Clear(); + myInterfEZ.Clear(); + myInterfFZ.Clear(); + myInterfZZ.Clear(); } //======================================================================= //function : SetArguments @@ -307,6 +319,7 @@ Standard_Integer BOPDS_DS::Index(const TopoDS_Shape& theS)const void BOPDS_DS::Init() { Standard_Integer i1, i2, j, aI, aNb, aNbS, aNbE, aNbSx, nV, nW, nE, aNbF; + Standard_Integer n1, n2, n3; Standard_Real aTol; TopAbs_ShapeEnum aTS; BOPCol_ListIteratorOfListOfInteger aIt1, aIt2, aIt3; @@ -527,10 +540,52 @@ void BOPDS_DS::Init() BOPDS_ShapeInfo& aSI=ChangeShapeInfo(j); // aTS=aSI.ShapeType(); - if (aTS==TopAbs_SOLID) { - Bnd_Box& aBox=aSI.ChangeBox(); - BuildBndBoxSolid(j, aBox); + if (aTS!=TopAbs_SOLID) { + continue; } + Bnd_Box& aBox=aSI.ChangeBox(); + BuildBndBoxSolid(j, aBox); + // + // + // update sub-shapes by BRep comprising ones + aMI.Clear(); + BOPCol_ListOfInteger& aLI1=aSI.ChangeSubShapes(); + // + aIt1.Initialize(aLI1); + for (; aIt1.More(); aIt1.Next()) { + n1=aIt1.Value(); + BOPDS_ShapeInfo& aSI1=ChangeShapeInfo(n1); + if (aSI1.ShapeType()!=TopAbs_SHELL) { + continue; + } + // + const BOPCol_ListOfInteger& aLI2=aSI1.SubShapes(); + aIt2.Initialize(aLI2); + for (; aIt2.More(); aIt2.Next()) { + n2=aIt2.Value(); + BOPDS_ShapeInfo& aSI2=ChangeShapeInfo(n2); + if (aSI2.ShapeType()!=TopAbs_FACE) { + continue; + } + // + aMI.Add(n2); + // + const BOPCol_ListOfInteger& aLI3=aSI2.SubShapes(); + aIt3.Initialize(aLI3); + for (; aIt3.More(); aIt3.Next()) { + n3=aIt3.Value(); + aMI.Add(n3); + } + } + } + // + aLI1.Clear(); + aItMI.Initialize(aMI); + for (; aItMI.More(); aItMI.Next()) { + n1=aItMI.Value(); + aLI1.Append(n1); + } + aMI.Clear(); }//for (j=0; jShapeInfo(i); // - if (aSI.HasBRep()) { - const TopoDS_Shape& aSi=aSI.Shape(); - aTi=aSI.ShapeType(); - if (aTi!=TopAbs_VERTEX) { - const BOPCol_ListOfInteger& aLA=aSI.SubShapes(); - aIt.Initialize(aLA); - for (; aIt.More(); aIt.Next()) { - iX=aIt.Value(); - aPKXB.Clear(); - aPKXB.SetIds(i, iX); - aMPA.Add(aPKXB); - } - } - // - aPKXB.Clear(); - aPKXB.SetIds(i, i); - aMPA.Add(aPKXB); - // - const Bnd_Box& aBoxEx=aSI.Box(); - // - aMSI.Bind(aSi, i); - aMSB.Add(aSi, aBoxEx); + if (!aSI.IsInterfering()) { + continue; } + // + const TopoDS_Shape& aSi=aSI.Shape(); + aTi=aSI.ShapeType(); + if (aTi!=TopAbs_VERTEX) { + const BOPCol_ListOfInteger& aLA=aSI.SubShapes(); + aIt.Initialize(aLA); + for (; aIt.More(); aIt.Next()) { + iX=aIt.Value(); + aPKXB.Clear(); + aPKXB.SetIds(i, iX); + aMPA.Add(aPKXB); + } + } + // + aPKXB.Clear(); + aPKXB.SetIds(i, i); + aMPA.Add(aPKXB); + // + const Bnd_Box& aBoxEx=aSI.Box(); + // + aMSI.Bind(aSi, i); + aMSB.Add(aSi, aBoxEx); } // for (i=0; iShapeInfo(i); aTi=aSI.ShapeType(); - if (!aSI.HasBRep()){ + if (!aSI.IsInterfering()){ continue; } // @@ -193,16 +209,3 @@ aAllocator.Nullify(); //-----------------------------------------------------scope_1 t } - -//======================================================================= -// function: UpdateByLevelOfCheck -// purpose: -//======================================================================= - void BOPDS_IteratorSI::UpdateByLevelOfCheck(const Standard_Integer theLevel) -{ - Standard_Integer i; - // - for (i=theLevel+1; i<6; ++i) { - myLists(i).Clear(); - } -} diff --git a/src/BOPDS/BOPDS_ShapeInfo.cdl b/src/BOPDS/BOPDS_ShapeInfo.cdl index 49cc283a2e..af33dc0378 100644 --- a/src/BOPDS/BOPDS_ShapeInfo.cdl +++ b/src/BOPDS/BOPDS_ShapeInfo.cdl @@ -143,7 +143,14 @@ is ---C++: inline ---Purpose: --- Query - --- Returns true if the shape has boundary representation + --- Returns true if the shape has boundary representation + + IsInterfering(me) + returns Boolean from Standard; + ---C++: inline + ---Purpose: + --- Returns true if the shape can be participant of + --- an interference -- --- Flag -- diff --git a/src/BOPDS/BOPDS_ShapeInfo.lxx b/src/BOPDS/BOPDS_ShapeInfo.lxx index a5fa5aab48..6b3e784830 100644 --- a/src/BOPDS/BOPDS_ShapeInfo.lxx +++ b/src/BOPDS/BOPDS_ShapeInfo.lxx @@ -12,11 +12,13 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. +#include + //======================================================================= //function : //purpose : //======================================================================= - inline BOPDS_ShapeInfo::BOPDS_ShapeInfo() +inline BOPDS_ShapeInfo::BOPDS_ShapeInfo() : myType(TopAbs_SHAPE), @@ -28,7 +30,8 @@ //function : //purpose : //======================================================================= - inline BOPDS_ShapeInfo::BOPDS_ShapeInfo(const Handle(NCollection_BaseAllocator)& theAllocator) +inline BOPDS_ShapeInfo::BOPDS_ShapeInfo + (const Handle(NCollection_BaseAllocator)& theAllocator) : myType(TopAbs_SHAPE), mySubShapes(theAllocator), @@ -40,14 +43,14 @@ //function : ~ //purpose : //======================================================================= - inline BOPDS_ShapeInfo::~BOPDS_ShapeInfo() +inline BOPDS_ShapeInfo::~BOPDS_ShapeInfo() { } //======================================================================= //function : SetShape //purpose : //======================================================================= - inline void BOPDS_ShapeInfo::SetShape(const TopoDS_Shape& theS) +inline void BOPDS_ShapeInfo::SetShape(const TopoDS_Shape& theS) { myShape=theS; } @@ -55,7 +58,7 @@ //function : Shape //purpose : //======================================================================= - inline const TopoDS_Shape& BOPDS_ShapeInfo::Shape()const +inline const TopoDS_Shape& BOPDS_ShapeInfo::Shape()const { return myShape; } @@ -63,7 +66,7 @@ //function : SetShapeType //purpose : //======================================================================= - inline void BOPDS_ShapeInfo::SetShapeType(const TopAbs_ShapeEnum theType) +inline void BOPDS_ShapeInfo::SetShapeType(const TopAbs_ShapeEnum theType) { myType=theType; } @@ -71,7 +74,7 @@ //function : ShapeType //purpose : //======================================================================= - inline TopAbs_ShapeEnum BOPDS_ShapeInfo::ShapeType()const +inline TopAbs_ShapeEnum BOPDS_ShapeInfo::ShapeType()const { return myType; } @@ -79,7 +82,7 @@ //function : SetBox //purpose : //======================================================================= - inline void BOPDS_ShapeInfo::SetBox(const Bnd_Box& theBox) +inline void BOPDS_ShapeInfo::SetBox(const Bnd_Box& theBox) { myBox=theBox; } @@ -87,7 +90,7 @@ //function : Box //purpose : //======================================================================= - inline const Bnd_Box& BOPDS_ShapeInfo::Box()const +inline const Bnd_Box& BOPDS_ShapeInfo::Box()const { return myBox; } @@ -95,7 +98,7 @@ //function : ChangeBox //purpose : //======================================================================= - inline Bnd_Box& BOPDS_ShapeInfo::ChangeBox() +inline Bnd_Box& BOPDS_ShapeInfo::ChangeBox() { return myBox; } @@ -104,7 +107,7 @@ //function : SubShapes //purpose : //======================================================================= - inline const BOPCol_ListOfInteger& BOPDS_ShapeInfo::SubShapes()const +inline const BOPCol_ListOfInteger& BOPDS_ShapeInfo::SubShapes()const { return mySubShapes; } @@ -112,7 +115,7 @@ //function : ChangeSubShapes //purpose : //======================================================================= - inline BOPCol_ListOfInteger& BOPDS_ShapeInfo::ChangeSubShapes() +inline BOPCol_ListOfInteger& BOPDS_ShapeInfo::ChangeSubShapes() { return mySubShapes; } @@ -120,7 +123,8 @@ //function : HasSubShape //purpose : //======================================================================= - inline Standard_Boolean BOPDS_ShapeInfo::HasSubShape(const Standard_Integer theI)const +inline Standard_Boolean BOPDS_ShapeInfo::HasSubShape + (const Standard_Integer theI)const { Standard_Boolean bRet; BOPCol_ListIteratorOfListOfInteger aIt; @@ -139,7 +143,7 @@ //function : HasReference //purpose : //======================================================================= - inline Standard_Boolean BOPDS_ShapeInfo::HasReference()const +inline Standard_Boolean BOPDS_ShapeInfo::HasReference()const { return (myReference>=0); } @@ -147,7 +151,7 @@ //function : SetReference //purpose : //======================================================================= - inline void BOPDS_ShapeInfo::SetReference(const Standard_Integer theI) +inline void BOPDS_ShapeInfo::SetReference(const Standard_Integer theI) { myReference=theI; } @@ -155,7 +159,7 @@ //function : Reference //purpose : //======================================================================= - inline Standard_Integer BOPDS_ShapeInfo::Reference()const +inline Standard_Integer BOPDS_ShapeInfo::Reference()const { return myReference; } @@ -163,17 +167,23 @@ //function : HasBRep //purpose : //======================================================================= - inline Standard_Boolean BOPDS_ShapeInfo::HasBRep()const +inline Standard_Boolean BOPDS_ShapeInfo::HasBRep()const { - return (myType==TopAbs_VERTEX || - myType==TopAbs_EDGE || - myType==TopAbs_FACE); + return (BOPDS_Tools::HasBRep(myType)); +} +//======================================================================= +//function : IsInterfering +//purpose : +//======================================================================= +inline Standard_Boolean BOPDS_ShapeInfo::IsInterfering()const +{ + return (HasBRep() || myType==TopAbs_SOLID); } //======================================================================= //function : HasFlag //purpose : //======================================================================= - inline Standard_Boolean BOPDS_ShapeInfo::HasFlag()const +inline Standard_Boolean BOPDS_ShapeInfo::HasFlag()const { return (myFlag>=0); } @@ -181,7 +191,8 @@ //function : HasFlag //purpose : //======================================================================= - inline Standard_Boolean BOPDS_ShapeInfo::HasFlag(Standard_Integer& theFlag)const +inline Standard_Boolean BOPDS_ShapeInfo::HasFlag + (Standard_Integer& theFlag)const { theFlag=myFlag; return (myFlag>=0); @@ -190,7 +201,7 @@ //function : SetFlag //purpose : //======================================================================= - inline void BOPDS_ShapeInfo::SetFlag(const Standard_Integer theFlag) +inline void BOPDS_ShapeInfo::SetFlag(const Standard_Integer theFlag) { myFlag=theFlag; } @@ -198,7 +209,7 @@ //function : Flag //purpose : //======================================================================= - inline Standard_Integer BOPDS_ShapeInfo::Flag()const +inline Standard_Integer BOPDS_ShapeInfo::Flag()const { return myFlag; } diff --git a/src/BOPDS/BOPDS_Tools.cdl b/src/BOPDS/BOPDS_Tools.cdl index aa148f14c2..32f8c74291 100644 --- a/src/BOPDS/BOPDS_Tools.cdl +++ b/src/BOPDS/BOPDS_Tools.cdl @@ -50,5 +50,13 @@ is ---Purpose: --- Returns true if the type correspond --- to a shape having boundary representation - + + IsInterfering(myclass; + theT: ShapeEnum from TopAbs) + returns Boolean from Standard; + ---C++: inline + ---Purpose: + --- Returns true if the type can be participant of + --- an interference + end Tools; diff --git a/src/BOPDS/BOPDS_Tools.lxx b/src/BOPDS/BOPDS_Tools.lxx index babff89ed7..37ecc479cd 100644 --- a/src/BOPDS/BOPDS_Tools.lxx +++ b/src/BOPDS/BOPDS_Tools.lxx @@ -19,7 +19,17 @@ inline Standard_Boolean BOPDS_Tools::HasBRep(const TopAbs_ShapeEnum aTi) { return (aTi==TopAbs_VERTEX || aTi==TopAbs_EDGE || aTi==TopAbs_FACE); -}//======================================================================= +} +//======================================================================= +// function: IsInterfering +// purpose: +//======================================================================= +inline Standard_Boolean BOPDS_Tools::IsInterfering + (const TopAbs_ShapeEnum aTi) +{ + return (BOPDS_Tools::HasBRep(aTi) || aTi==TopAbs_SOLID); +} +//======================================================================= //function : TypeToInteger //purpose : //======================================================================= @@ -55,6 +65,21 @@ inline Standard_Integer BOPDS_Tools::TypeToInteger(const TopAbs_ShapeEnum aType1 case 44: iRet=5; // FF break; + case 72: + case 27: + iRet=6; // VZ + break; + case 62: + case 26: + iRet=7; // EZ + break; + case 42: + case 24: + iRet=8; // FZ + break; + case 22: + iRet=9; // ZZ + break; default: break; } diff --git a/src/BOPDS/BOPDS_VectorOfInterfEZ.hxx b/src/BOPDS/BOPDS_VectorOfInterfEZ.hxx new file mode 100644 index 0000000000..73a7b8b4d2 --- /dev/null +++ b/src/BOPDS/BOPDS_VectorOfInterfEZ.hxx @@ -0,0 +1,30 @@ +// Created by: Peter KURNEV +// Copyright (c) 1999-2012 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + + +#ifndef BOPDS_VectorOfInterfEZ_HeaderFile +#define BOPDS_VectorOfInterfEZ_HeaderFile + +#include +#include + +#define BOPCol_Array1_Use_Allocator +typedef BOPCol_Array1 BOPDS_VectorOfInterfEZ; +#undef BOPCol_Array1_Use_Allocator + +#endif diff --git a/src/BOPDS/BOPDS_VectorOfInterfFZ.hxx b/src/BOPDS/BOPDS_VectorOfInterfFZ.hxx new file mode 100644 index 0000000000..7f32b186f6 --- /dev/null +++ b/src/BOPDS/BOPDS_VectorOfInterfFZ.hxx @@ -0,0 +1,30 @@ +// Created by: Peter KURNEV +// Copyright (c) 1999-2012 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + + +#ifndef BOPDS_VectorOfInterfFZ_HeaderFile +#define BOPDS_VectorOfInterfFZ_HeaderFile + +#include +#include + +#define BOPCol_Array1_Use_Allocator +typedef BOPCol_Array1 BOPDS_VectorOfInterfFZ; +#undef BOPCol_Array1_Use_Allocator + +#endif diff --git a/src/BOPDS/BOPDS_VectorOfInterfVZ.hxx b/src/BOPDS/BOPDS_VectorOfInterfVZ.hxx new file mode 100644 index 0000000000..0d697885bd --- /dev/null +++ b/src/BOPDS/BOPDS_VectorOfInterfVZ.hxx @@ -0,0 +1,30 @@ +// Created by: Peter KURNEV +// Copyright (c) 1999-2012 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + + +#ifndef BOPDS_VectorOfInterfVZ_HeaderFile +#define BOPDS_VectorOfInterfVZ_HeaderFile + +#include +#include + +#define BOPCol_Array1_Use_Allocator +typedef BOPCol_Array1 BOPDS_VectorOfInterfVZ; +#undef BOPCol_Array1_Use_Allocator + +#endif diff --git a/src/BOPDS/BOPDS_VectorOfInterfZZ.hxx b/src/BOPDS/BOPDS_VectorOfInterfZZ.hxx new file mode 100644 index 0000000000..b218ece1b8 --- /dev/null +++ b/src/BOPDS/BOPDS_VectorOfInterfZZ.hxx @@ -0,0 +1,30 @@ +// Created by: Peter KURNEV +// Copyright (c) 1999-2012 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + + +#ifndef BOPDS_VectorOfInterfZZ_HeaderFile +#define BOPDS_VectorOfInterfZZ_HeaderFile + +#include +#include + +#define BOPCol_Array1_Use_Allocator +typedef BOPCol_Array1 BOPDS_VectorOfInterfZZ; +#undef BOPCol_Array1_Use_Allocator + +#endif diff --git a/src/BOPDS/FILES b/src/BOPDS/FILES index e713385e67..3e262561a5 100644 --- a/src/BOPDS/FILES +++ b/src/BOPDS/FILES @@ -33,4 +33,9 @@ BOPDS_DataMapOfIntegerListOfPaveBlock.hxx BOPDS_IndexedMapOfPaveBlock.hxx BOPDS_IndexedDataMapOfPaveBlockListOfInteger.hxx BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks.hxx -BOPDS_DataMapOfPaveBlockCommonBlock.hxx \ No newline at end of file +BOPDS_DataMapOfPaveBlockCommonBlock.hxx + +BOPDS_VectorOfInterfVZ.hxx +BOPDS_VectorOfInterfEZ.hxx +BOPDS_VectorOfInterfFZ.hxx +BOPDS_VectorOfInterfZZ.hxx diff --git a/tests/bugs/modalg_5/bug24492 b/tests/bugs/modalg_5/bug24492 new file mode 100644 index 0000000000..3560e991f4 --- /dev/null +++ b/tests/bugs/modalg_5/bug24492 @@ -0,0 +1,22 @@ +puts "===========" +puts "OCC24492" +puts "===========" +puts "" +############################################################## +# The command bopargcheck produces wrong results for cases +############################################################## + +box x1 10 10 10 +vertex x2 3 3 3 +compound x1 x2 b1 +decho off +set info [bopargcheck b1 #f] +decho on + +if { [regexp "Faulties for FIRST shape found : 1" $info] != 1 } { + puts "Error : command bopargcheck produces wrong result" +} else { + puts "OK : command bopargcheck produces correct result" +} + +