diff --git a/src/BOPAlgo/BOPAlgo_CheckerSI.cdl b/src/BOPAlgo/BOPAlgo_CheckerSI.cdl index ca900312ea..1a075aef3d 100644 --- a/src/BOPAlgo/BOPAlgo_CheckerSI.cdl +++ b/src/BOPAlgo/BOPAlgo_CheckerSI.cdl @@ -26,11 +26,16 @@ class CheckerSI from BOPAlgo is Create - returns CheckerSI from BOPAlgo; - ---C++: alias "Standard_EXPORT virtual ~BOPAlgo_CheckerSI();" - + returns CheckerSI from BOPAlgo; + ---C++: alias "Standard_EXPORT virtual ~BOPAlgo_CheckerSI();" + + + Perform(me:out) + is redefined; + + Init (me:out) - is redefined protected; + is redefined protected; SetLevelOfCheck(me:out; theLevel: Integer from Standard); @@ -41,9 +46,15 @@ is -- 2 - V/V, V/E and E/E; -- 3 - V/V, V/E, E/E and V/F; -- 4 - V/V, V/E, E/E, V/F and E/F; - -- 5 - all interferences, default value. + -- 5 - all interferences, default value. + + + PostTreat (me:out) + is protected; + ---Purpose: Provides post-tratment actions + fields myLevelOfCheck: Integer from Standard is protected; - + end CheckerSI; diff --git a/src/BOPAlgo/BOPAlgo_CheckerSI.cxx b/src/BOPAlgo/BOPAlgo_CheckerSI.cxx index 8fc457e4c5..00ea647db0 100644 --- a/src/BOPAlgo/BOPAlgo_CheckerSI.cxx +++ b/src/BOPAlgo/BOPAlgo_CheckerSI.cxx @@ -26,11 +26,23 @@ #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + //======================================================================= //function : //purpose : //======================================================================= - BOPAlgo_CheckerSI::BOPAlgo_CheckerSI() +BOPAlgo_CheckerSI::BOPAlgo_CheckerSI() : BOPAlgo_PaveFiller(), myLevelOfCheck(5) @@ -40,14 +52,14 @@ //function : ~ //purpose : //======================================================================= - BOPAlgo_CheckerSI::~BOPAlgo_CheckerSI() +BOPAlgo_CheckerSI::~BOPAlgo_CheckerSI() { } //======================================================================= //function : SetLevelOfCheck //purpose : //======================================================================= - void BOPAlgo_CheckerSI::SetLevelOfCheck(const Standard_Integer theLevel) +void BOPAlgo_CheckerSI::SetLevelOfCheck(const Standard_Integer theLevel) { if (theLevel >= 0 && theLevel <= 5) { myLevelOfCheck = theLevel; @@ -57,7 +69,7 @@ //function : Init //purpose : //======================================================================= - void BOPAlgo_CheckerSI::Init() +void BOPAlgo_CheckerSI::Init() { myErrorStatus = 0; // @@ -86,3 +98,127 @@ // myErrorStatus=0; } +//======================================================================= +//function : Perform +//purpose : +//======================================================================= +void BOPAlgo_CheckerSI::Perform() +{ + BOPAlgo_PaveFiller::Perform(); + if (myErrorStatus) { + return; + } + // + PostTreat(); +} +//======================================================================= +//function : PostTreat +//purpose : +//======================================================================= +void BOPAlgo_CheckerSI::PostTreat() +{ + Standard_Integer i, aNb, n1, n2; + BOPDS_PassKey aPK; + // + BOPDS_MapOfPassKey& aMPK=*((BOPDS_MapOfPassKey*)&myDS->Interferences()); + aMPK.Clear(); + // + // 0 + BOPDS_VectorOfInterfVV& aVVs=myDS->InterfVV(); + aNb=aVVs.Extent(); + for (i=0; i!=aNb; ++i) { + const BOPDS_InterfVV& aVV=aVVs(i); + aVV.Indices(n1, n2); + aPK.SetIds(n1, n2); + aMPK.Add(aPK); + } + // + // 1 + BOPDS_VectorOfInterfVE& aVEs=myDS->InterfVE(); + aNb=aVEs.Extent(); + for (i=0; i!=aNb; ++i) { + const BOPDS_InterfVE& aVE=aVEs(i); + aVE.Indices(n1, n2); + aPK.SetIds(n1, n2); + aMPK.Add(aPK); + } + // + // 2 + BOPDS_VectorOfInterfEE& aEEs=myDS->InterfEE(); + aNb=aEEs.Extent(); + for (i=0; i!=aNb; ++i) { + const BOPDS_InterfEE& aEE=aEEs(i); + aEE.Indices(n1, n2); + aPK.SetIds(n1, n2); + aMPK.Add(aPK); + } + // + // 3 + BOPDS_VectorOfInterfVF& aVFs=myDS->InterfVF(); + aNb=aVFs.Extent(); + for (i=0; i!=aNb; ++i) { + const BOPDS_InterfVF& aVF=aVFs(i); + aVF.Indices(n1, n2); + aPK.SetIds(n1, n2); + aMPK.Add(aPK); + } + // + // 4 + BOPDS_VectorOfInterfEF& aEFs=myDS->InterfEF(); + aNb=aEFs.Extent(); + for (i=0; i!=aNb; ++i) { + const BOPDS_InterfEF& aEF=aEFs(i); + if (aEF.CommonPart().Type()==TopAbs_SHAPE) { + continue; + } + aEF.Indices(n1, n2); + aPK.SetIds(n1, n2); + aMPK.Add(aPK); + } + // + // 5 + BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF(); + aNb=aFFs.Extent(); + for (i=0; i!=aNb; ++i) { + Standard_Boolean bTangentFaces, bFlag; + Standard_Integer aNbC, aNbP, j, iFound; + // + const BOPDS_InterfFF& aFF=aFFs(i); + aFF.Indices(n1, n2); + // + bTangentFaces=aFF.TangentFaces(); + aNbP=aFF.Points().Extent(); + const BOPDS_VectorOfCurve& aVC=aFF.Curves(); + aNbC=aVC.Extent(); + if (!aNbP && !aNbC && !bTangentFaces) { + continue; + } + // + iFound=0; + if (bTangentFaces) { + const TopoDS_Face& aF1 = *((TopoDS_Face*)&myDS->Shape(n1)); + const TopoDS_Face& aF2 = *((TopoDS_Face*)&myDS->Shape(n2)); + bFlag=BOPTools_AlgoTools::AreFacesSameDomain(aF1, aF2, myContext); + if (bFlag) { + ++iFound; + } + } + else { + for (j=0; j!=aNbC; ++j) { + const BOPDS_Curve& aNC=aVC(j); + const BOPDS_ListOfPaveBlock& aLPBC=aNC.PaveBlocks(); + if (aLPBC.Extent()) { + ++iFound; + break; + } + } + } + // + if (!iFound) { + continue; + } + // + aPK.SetIds(n1, n2); + aMPK.Add(aPK); + } +} diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx index a691e44005..977430fa93 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx @@ -102,7 +102,7 @@ static void ToleranceFF(const TopoDS_Face& aF1, //function : PerformFF //purpose : //======================================================================= - void BOPAlgo_PaveFiller::PerformFF() +void BOPAlgo_PaveFiller::PerformFF() { Standard_Integer iSize; Standard_Boolean bValid; @@ -116,7 +116,7 @@ static void ToleranceFF(const TopoDS_Face& aF1, } // Standard_Boolean bJustAdd, bApp, bCompC2D1, bCompC2D2, bIsDone; - Standard_Boolean bToSplit; + Standard_Boolean bToSplit, bTangentFaces; Standard_Integer nF1, nF2, aNbCurves, aNbPoints, iX, i, iP, iC, aNbLP; Standard_Real aApproxTol, aTolR3D, aTolR2D, aTolFF; // @@ -157,6 +157,7 @@ static void ToleranceFF(const TopoDS_Face& aF1, if (bIsDone) { aTolR3D=aFaceFace.TolReached3d(); aTolR2D=aFaceFace.TolReached2d(); + bTangentFaces=aFaceFace.TangentFaces(); // ToleranceFF(aF1, aF2, aTolFF); // @@ -183,6 +184,7 @@ static void ToleranceFF(const TopoDS_Face& aF1, // aFF.SetTolR3D(aTolR3D); aFF.SetTolR2D(aTolR2D); + aFF.SetTangentFaces(bTangentFaces); // // Curves, Points aFF.Init(aNbCurves, aNbPoints); @@ -333,7 +335,7 @@ static void ToleranceFF(const TopoDS_Face& aF1, PutPaveOnCurve(aMVOnIn, aTolR3D, aNC, nF1, nF2, aMVEF); // PutStickPavesOnCurve(nF1, nF2, aNC, aMVStick); - //pkv/904/F7 + //904/F7 if (aNbC == 1) { PutEFPavesOnCurve(nF1, nF2, aNC, aMVEF); } diff --git a/src/BOPDS/BOPDS_Interf.hxx b/src/BOPDS/BOPDS_Interf.hxx index f94637948e..5e6f2e01ad 100644 --- a/src/BOPDS/BOPDS_Interf.hxx +++ b/src/BOPDS/BOPDS_Interf.hxx @@ -511,6 +511,7 @@ class BOPDS_InterfFF : public BOPDS_Interf { BOPDS_InterfFF() : BOPDS_Interf(), + myTangentFaces(Standard_False), myTolR3D(1.e-7), myTolR2D(1.e-7), myCurves(myAllocator), @@ -526,6 +527,7 @@ class BOPDS_InterfFF : public BOPDS_Interf { BOPDS_InterfFF(const Handle(NCollection_BaseAllocator)& theAllocator) : BOPDS_Interf(theAllocator), + myTangentFaces(Standard_False), myTolR3D(1.e-7), myTolR2D(1.e-7), myCurves(myAllocator), @@ -558,7 +560,24 @@ class BOPDS_InterfFF : public BOPDS_Interf { myPoints.Init(); } } - // + /** + * Modifier + * Sets the flag of whether the faces are tangent + * @param theFlag + * the flag + */ + void SetTangentFaces(const Standard_Boolean theFlag) { + myTangentFaces=theFlag; + } + /** + * Selector + * Returns the flag whether the faces are tangent + * @return + * the flag + */ + Standard_Boolean TangentFaces()const { + return myTangentFaces; + } /** * Modifier * Sets the value of 3D tolerance @@ -640,6 +659,7 @@ class BOPDS_InterfFF : public BOPDS_Interf { }; // protected: + Standard_Boolean myTangentFaces; Standard_Real myTolR3D; Standard_Real myTolR2D; BOPDS_VectorOfCurve myCurves;