0021762: Integration of new Boolean Operation algorithm to OCCT.

Modifications:
- BRepOffset/BRepOffset_Tool.cxx, Features and Fillets algorithms have been ported on new BO algorithm.
- Old BO algorithm, that was implemented in BOP, BooleanOperations and BOPTools packages, has - been deleted.
- Porting SALOME algorithms to new BOP algorithm.
- Fixing regressions. Rebased on current master.
- Corrections in post treatment of section edges;
- Corrections in the accordance with the bug 0023293;
- Small corrections in the bopcheck and bopargcheck commands.
- NCollection maps have been replaced by NCollection indexed maps to guarantee the constant order of sub-shapes in the result of boolean operation.
- Test case feat featprism M9 has been fixed.
- Test cases chl 902 E3 H3 have been fixed (corrections in the treatment of section edges).
- Test cases caf driver B6 B7, caf named_shape F6 F7 have been modified according to the new order of sub-shapes in the result of boolean operation.
- Test cases blend buildevol G1, blend simple K4, bcommon_complex C7, feat featprism L6 have been modified as they are improvements.
- Test case boolean bsection A3 has been modified according to the new syntax of the bsection command.
- Test cases boolean bfuse_complex J1 P9 have been fixed (the function IsInternalFace has been modified to use the function GetFaceOff);
- Test case chl 902 H3 has been fixed (changes in the treatment of section edges);
- Test case boolean bsection D8 has been modified (removed TODO statement);
- Test case boolean bsection A3 has been modified (as the shapes have been changed).
- Added correction of the tolerance values of the shapes according to the bug 0023610.
- test cases:
    boolean bcommon_complex C3,
    boolean bcut_complex F2 O7,
    boolean bfuse_complex C4 C5 E4,
    boolean bsection B6 M8 M9 N4 N5 N7,
    boolean bfuse_simple ZP6,
    draft angle G8,
    feat featprism S2
have been marked as invalid according to the bug 0022033;
- New value of result has been set in the test cases :
    boolean bopsection D4
    boolean bsection R8
as it is correct.
- test case bugs modalg bug23472 has been rewritten according to the new format of bsection command.
- The classes IntTools_Context and IntTools_ShrunkRange have been replaced by BOPInt_Context and BOPInt_ShrunkRange accordingly.
- The new class BRepAlgoAPI_Check has been added according to the bug 0023648.
- Some regressions have been fixed.
- The following test cases have been marked as invalid or rewritten
    bugs modalg buc60462_2, 60531_2, 60776_1, bug472_1, bug472_2, bug472_3, bug497_3, bug62
    bugs moddata bug26_1, bug26_2,
- The test case bugs modalg buc60533 has been rewritten to use the general fuse algorithm for building the result.
- The new value of the result has been set in the test case bugs modalg 60776_2.
- The following test cases have been rewritten according to the new format of the bsection command
    bugs modlag fra62369, pro18892
    bugs moddata bug75_1, bug75_2
- Corrected BRepAlgoAPI_Check.
- Removed package BOPTColStd.
- Rewritten test cases caf named_shape F8 F9.
- Removed unnecessary comments.
- Corrected the following test scripts :
    boolean bcut_complex(012) O3 O4 O5 O6 O8
    boolean bfuse_complex(013) O5 O6 P8
    boolean bopcommon_complex(021) D8 D9
    boolean bopfuse_complex(022) H1 J6
    boolean boptuc_complex(024) D5
    bugs modalg(006) bug399 bug497_1
    feat featprism(003) C4
- Corrections in the treatment of section edges (putting paves on the curves);
- Corrections in BRepOffset_Tool;
- The following test cases have been rewritten according to the new format of the bsection command
   bugs modalg bug6502, bug6554, bug6766_1, bug6766_3
- The new value of the result has been set in the following test cases
   bugs modalg bug1255, bug1255_1
- The following test cases have been marked as invalid or rewritten
   bugs modalg bug472_2, bug472_3, bug825_2
   bugs moddata bug10603, bug152_1, bug152_2, bug3721_1, bug3721_2, bug3721_3
- The following test cases have been rewritten as improvements
   bugs modalg bug693, bug693_1, bug817_1
   bugs moddata bug3721_5, bug3721_6, bug6862_3, bug6862_4, bug6862_6
- Test cases bugs modlag buc60787_1, buc60787_2, buc60788_2, buc60788_3 have been corrected.
- Fixed some SALOME regressions (modifications in the treatment of the section edges);
- Fixed test case bugs modalg bug23100;
- Test cases bugs modalg bug21754, bug22990 have been corrected according to the new format of the bsection command.
- Test cases bugs modalg bug13116_*, bug23711 have been fixed;
- Test cases bugs modalg bug697_2, bug697_4, bug697_7, bug697_8 have been marked as invalid according to the issue 0022033;
- Test cases bugs modalg bug22109_2, bug22109_3 have been corrected;
- Test case bugs modalg bug18186 has been corrected as it is improvement;
- Test case bugs modalg bug22802 has been deleted as there is no package BOPTColStd.
This commit is contained in:
emv
2013-02-08 17:42:05 +04:00
parent a8676008f7
commit 4e57c75ee1
642 changed files with 41074 additions and 67959 deletions

View File

@@ -19,6 +19,7 @@
// and conditions governing the rights and limitations under the License.
// modified by Michael KLOKOV Wed Mar 6 15:01:25 2002
// modified by Eugeny MALTCHIKOV Wed Jul 04 11:13:01 2012
#include <BRepAlgoAPI_Section.ixx>
@@ -27,19 +28,7 @@
#include <BRepBuilderAPI_MakeShell.hxx>
#include <Geom_Plane.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <BOP_Section.hxx>
#include <BOPTools_SSIntersectionAttribute.hxx>
#include <BOPTools_SplitShapesPool.hxx>
#include <BOPTools_InterferencePool.hxx>
#include <BOPTools_PaveBlock.hxx>
#include <BOPTools_PaveFiller.hxx>
#include <BooleanOperations_ShapesDataStructure.hxx>
#include <BOPTools_ListOfPaveBlock.hxx>
#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
#include <BOPTools_SSInterference.hxx>
#include <BOPTools_Curve.hxx>
#include <TopExp.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
@@ -47,7 +36,9 @@
#include <TopoDS_Face.hxx>
#include <BRep_Tool.hxx>
#include <BOP_SectionHistoryCollector.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_BOP.hxx>
#include <BOPDS_DS.hxx>
static TopoDS_Shape MakeShape(const Handle(Geom_Surface)& S)
{
@@ -56,19 +47,19 @@ static TopoDS_Shape MakeShape(const Handle(Geom_Surface)& S)
else return BRepBuilderAPI_MakeShell(S);
}
static Standard_Boolean HasAncestorFaces(const BOPTools_DSFiller& theDSFiller,
const TopoDS_Shape& E,
TopoDS_Shape& F1,
TopoDS_Shape& F2);
static Standard_Boolean HasAncestorFaces(const BOPAlgo_PPaveFiller& theDSFiller,
const TopoDS_Shape& E,
TopoDS_Shape& F1,
TopoDS_Shape& F2);
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& Sh1,
const TopoDS_Shape& Sh2,
const Standard_Boolean PerformNow)
: BRepAlgoAPI_BooleanOperation(Sh1, Sh2, BOP_SECTION)
const TopoDS_Shape& Sh2,
const Standard_Boolean PerformNow)
: BRepAlgoAPI_BooleanOperation(Sh1, Sh2, BOPAlgo_SECTION)
{
InitParameters();
myparameterschanged = Standard_True;
@@ -77,15 +68,16 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& Sh1,
// StdFail_NotDone::Raise("BRepAlgoAPI_Section : Shape NULL");
myshapeisnull = Standard_True;
}
if (PerformNow)
if (PerformNow) {
Build();
}
}
BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& aS1,
const TopoDS_Shape& aS2,
const BOPTools_DSFiller& aDSF,
const Standard_Boolean PerformNow)
: BRepAlgoAPI_BooleanOperation(aS1, aS2, aDSF, BOP_SECTION)
const TopoDS_Shape& aS2,
const BOPAlgo_PaveFiller& aDSF,
const Standard_Boolean PerformNow)
: BRepAlgoAPI_BooleanOperation(aS1, aS2, aDSF, BOPAlgo_SECTION)
{
InitParameters();
myparameterschanged = Standard_True;
@@ -95,7 +87,7 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& aS1,
myshapeisnull = Standard_True;
}
if(PerformNow) {
if (PerformNow) {
Build();
}
}
@@ -106,9 +98,9 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& aS1,
//purpose :
//=======================================================================
BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& Sh,
const gp_Pln& Pl,
const Standard_Boolean PerformNow)
: BRepAlgoAPI_BooleanOperation(Sh, MakeShape(new Geom_Plane(Pl)), BOP_SECTION)
const gp_Pln& Pl,
const Standard_Boolean PerformNow)
: BRepAlgoAPI_BooleanOperation(Sh, MakeShape(new Geom_Plane(Pl)), BOPAlgo_SECTION)
{
InitParameters();
myparameterschanged = Standard_True;
@@ -117,8 +109,9 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& Sh,
// StdFail_NotDone::Raise("BRepAlgoAPI_Section : Shape NULL");
myshapeisnull = Standard_True;
}
if (PerformNow)
if (PerformNow) {
Build();
}
}
//=======================================================================
@@ -126,9 +119,9 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& Sh,
//purpose :
//=======================================================================
BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& Sh,
const Handle(Geom_Surface)& Sf,
const Standard_Boolean PerformNow)
: BRepAlgoAPI_BooleanOperation(Sh, MakeShape(Sf), BOP_SECTION)
const Handle(Geom_Surface)& Sf,
const Standard_Boolean PerformNow)
: BRepAlgoAPI_BooleanOperation(Sh, MakeShape(Sf), BOPAlgo_SECTION)
{
InitParameters();
myparameterschanged = Standard_True;
@@ -137,8 +130,9 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& Sh,
// StdFail_NotDone::Raise("BRepAlgoAPI_Section : Shape NULL");
myshapeisnull = Standard_True;
}
if (PerformNow)
if (PerformNow) {
Build();
}
}
//=======================================================================
@@ -146,9 +140,9 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& Sh,
//purpose :
//=======================================================================
BRepAlgoAPI_Section::BRepAlgoAPI_Section(const Handle(Geom_Surface)& Sf,
const TopoDS_Shape& Sh,
const Standard_Boolean PerformNow)
: BRepAlgoAPI_BooleanOperation(MakeShape(Sf), Sh, BOP_SECTION)
const TopoDS_Shape& Sh,
const Standard_Boolean PerformNow)
: BRepAlgoAPI_BooleanOperation(MakeShape(Sf), Sh, BOPAlgo_SECTION)
{
InitParameters();
myparameterschanged = Standard_True;
@@ -157,8 +151,9 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section(const Handle(Geom_Surface)& Sf,
// StdFail_NotDone::Raise("BRepAlgoAPI_Section : Shape NULL");
myshapeisnull = Standard_True;
}
if (PerformNow)
if (PerformNow) {
Build();
}
}
//=======================================================================
@@ -166,9 +161,9 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section(const Handle(Geom_Surface)& Sf,
//purpose :
//=======================================================================
BRepAlgoAPI_Section::BRepAlgoAPI_Section(const Handle(Geom_Surface)& Sf1,
const Handle(Geom_Surface)& Sf2,
const Standard_Boolean PerformNow)
: BRepAlgoAPI_BooleanOperation(MakeShape(Sf1), MakeShape(Sf2), BOP_SECTION)
const Handle(Geom_Surface)& Sf2,
const Standard_Boolean PerformNow)
: BRepAlgoAPI_BooleanOperation(MakeShape(Sf1), MakeShape(Sf2), BOPAlgo_SECTION)
{
InitParameters();
myparameterschanged = Standard_True;
@@ -178,8 +173,9 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section(const Handle(Geom_Surface)& Sf1,
myshapeisnull = Standard_True;
}
if (PerformNow)
if (PerformNow) {
Build();
}
}
//=======================================================================
@@ -193,7 +189,7 @@ void BRepAlgoAPI_Section::Init1(const TopoDS_Shape& S1)
myS1 = S1;
if(!myS2.IsNull()) {
myshapeisnull = Standard_False;
myshapeisnull = Standard_False;
}
myparameterschanged = Standard_True;
}
@@ -239,7 +235,7 @@ void BRepAlgoAPI_Section::Init2(const TopoDS_Shape& S2)
myS2 = S2;
if(!myS1.IsNull()) {
myshapeisnull = Standard_False;
myshapeisnull = Standard_False;
}
myparameterschanged = Standard_True;
}
@@ -324,9 +320,6 @@ void BRepAlgoAPI_Section::Build()
}
if(myparameterschanged) {
myBuilderCanWork = Standard_False;
Standard_Boolean bIsNewFiller = PrepareFiller();
//
if (myErrorStatus!=1) {
@@ -336,30 +329,13 @@ void BRepAlgoAPI_Section::Build()
}
//
if (bIsNewFiller) {
//Prepare the DS
BOPTools_SSIntersectionAttribute aSectionAttribute(myApprox, myComputePCurve1, myComputePCurve2);
myDSFiller->Perform(aSectionAttribute);
BOPAlgo_SectionAttribute theSecAttr(myApprox, myComputePCurve1, myComputePCurve2);
myDSFiller->SetSectionAttribute(theSecAttr);
myDSFiller->Perform();
}
BOP_Section* aSectionAlgo = new BOP_Section();
aSectionAlgo->SetShapes(myS1, myS2);
myHistory = new BOP_SectionHistoryCollector(myS1, myS2);
aSectionAlgo->SetHistoryCollector(myHistory);
aSectionAlgo->DoWithFiller(*myDSFiller);
myBuilder = aSectionAlgo;
if(aSectionAlgo->IsDone()) {
myErrorStatus=0;
myBuilderCanWork=Standard_True;
myShape = aSectionAlgo->Result();
Done();
}
else {
myErrorStatus = 100 + aSectionAlgo->ErrorStatus();
NotDone();
}
//
BRepAlgoAPI_BooleanOperation::Build();
//
myparameterschanged = Standard_False;
}
}
@@ -379,7 +355,7 @@ Standard_Boolean BRepAlgoAPI_Section::HasAncestorFaceOn1(const TopoDS_Shape& E,
return aResult;
}
TopoDS_Shape F1, F2;
aResult = HasAncestorFaces(*myDSFiller, E, F1, F2);
aResult = HasAncestorFaces(myDSFiller, E, F1, F2);
if(F1.IsNull()) {
return Standard_False;
@@ -403,7 +379,7 @@ Standard_Boolean BRepAlgoAPI_Section::HasAncestorFaceOn2(const TopoDS_Shape& E,T
return aResult;
}
TopoDS_Shape F1, F2;
aResult = HasAncestorFaces(*myDSFiller, E, F1, F2);
aResult = HasAncestorFaces(myDSFiller, E, F1, F2);
if(F2.IsNull()) {
return Standard_False;
@@ -430,7 +406,7 @@ Handle(Geom2d_Curve) BRepAlgoAPI_Section::PCurveOn1(const TopoDS_Shape& E) const
aResult = BRep_Tool::CurveOnSurface(anEdge, aFace, f, l);
if(!aResult->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve))) {
aResult = new Geom2d_TrimmedCurve(aResult, f, l);
aResult = new Geom2d_TrimmedCurve(aResult, f, l);
}
}
}
@@ -455,7 +431,7 @@ Handle(Geom2d_Curve) BRepAlgoAPI_Section::PCurveOn2(const TopoDS_Shape& E) const
aResult = BRep_Tool::CurveOnSurface(anEdge, aFace, f, l);
if(!aResult->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve))) {
aResult = new Geom2d_TrimmedCurve(aResult, f, l);
aResult = new Geom2d_TrimmedCurve(aResult, f, l);
}
}
}
@@ -479,69 +455,59 @@ void BRepAlgoAPI_Section::InitParameters()
// static function : HasAncestorFaces
// purpose :
// ------------------------------------------------------------------------
static Standard_Boolean HasAncestorFaces(const BOPTools_DSFiller& theDSFiller,
const TopoDS_Shape& E,
TopoDS_Shape& F1,
TopoDS_Shape& F2) {
static Standard_Boolean HasAncestorFaces(const BOPAlgo_PPaveFiller& theDSFiller,
const TopoDS_Shape& E,
TopoDS_Shape& F1,
TopoDS_Shape& F2) {
BOPTools_PaveFiller* aPaveFiller = (BOPTools_PaveFiller*) &theDSFiller.PaveFiller();
const BOPTools_CArray1OfSSInterference& aFFs = aPaveFiller->InterfPool()->SSInterferences();
const BooleanOperations_ShapesDataStructure& aDS = theDSFiller.DS();
Standard_Integer aNb = aFFs.Extent();
Standard_Integer i = 0;
Standard_Integer aNb, i, j, nE, nF1, nF2, aNbCurves;;
//
const BOPDS_PDS& pDS = theDSFiller->PDS();
BOPDS_VectorOfInterfFF& aFFs=pDS->InterfFF();
//
aNb=aFFs.Extent();
for (i = 1; i <= aNb; i++) {
BOPTools_SSInterference* aFFi = (BOPTools_SSInterference*) &aFFs(i);
const BOPTools_SequenceOfCurves& aSeqOfCurve = aFFi->Curves();
for(Standard_Integer j = 1; j <= aSeqOfCurve.Length(); j++) {
const BOPTools_Curve& aCurve = aSeqOfCurve.Value(j);
BOPTools_ListIteratorOfListOfPaveBlock anIt(aCurve.NewPaveBlocks());
for (i = 0; i < aNb; i++) {
BOPDS_InterfFF& aFFi=aFFs(i);
aFFi.Indices(nF1, nF2);
//
//section edges
const BOPDS_VectorOfCurve& aSeqOfCurve=aFFi.Curves();
aNbCurves=aSeqOfCurve.Extent();
for (j=0; j<aNbCurves; j++) {
const BOPDS_Curve& aCurve=aSeqOfCurve(j);
const BOPDS_ListOfPaveBlock& aSectEdges = aCurve.PaveBlocks();
BOPDS_ListIteratorOfListOfPaveBlock anIt;
anIt.Initialize(aSectEdges);
for(; anIt.More(); anIt.Next()) {
const BOPTools_PaveBlock& aPB = anIt.Value();
Standard_Integer anIndex = aPB.Edge();
if(anIndex <= 0)
continue;
if(E.IsSame(aDS.Shape(anIndex))) {
for(Standard_Integer fIt = 0; fIt < 2; fIt++) {
anIndex = (fIt == 0) ? aFFi->Index1() : aFFi->Index2();
if(anIndex > 0) {
if (fIt == 0)
F1 = aDS.Shape(anIndex);
else
F2 = aDS.Shape(anIndex);
}
}
return Standard_True;
}
const Handle(BOPDS_PaveBlock)& aPB = anIt.Value();
nE = aPB->Edge();
if(nE < 0) continue;
//
if(E.IsSame(pDS->Shape(nE))) {
F1 = pDS->Shape(nF1);
F2 = pDS->Shape(nF2);
return Standard_True;
}
}
}
BOPTools_ListIteratorOfListOfPaveBlock anIt(aFFi->PaveBlocks());
for(; anIt.More(); anIt.Next()) {
const BOPTools_PaveBlock& aPB = anIt.Value();
Standard_Integer anIndex = aPB.Edge();
if(anIndex <= 0)
continue;
if(E.IsSame(aDS.Shape(anIndex))) {
for(Standard_Integer fIt = 0; fIt < 2; fIt++) {
anIndex = (fIt == 0) ? aFFi->Index1() : aFFi->Index2();
if(anIndex > 0) {
if (fIt == 0)
F1 = aDS.Shape(anIndex);
else
F2 = aDS.Shape(anIndex);
}
}
return Standard_True;
//existing pave blocks
BOPCol_ListOfInteger aLSE;
BOPCol_ListIteratorOfListOfInteger aItLSE;
//
pDS->SharedEdges(nF1, nF2, aLSE, theDSFiller->Allocator());
aItLSE.Initialize(aLSE);
for (; aItLSE.More(); aItLSE.Next()) {
nE = aItLSE.Value();
//
if(E.IsSame(pDS->Shape(nE))) {
F1 = pDS->Shape(nF1);
F2 = pDS->Shape(nF2);
return Standard_True;
}
}
}