1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0025354: Intersection operation

I. New features:
I.1 class BOPAlgo_Section
     The class clontains the algorithm to build a result of Secton between the arguments.
     The result of Section consists of vertices and edges.
     The result of Section contains:
     1. new vertices that are subjects of V/V, E/E, E/F, F/F interferences
     2. vertices that are subjects of V/E, V/F interferences
     3. new edges that are subjects of F/F interferences
     4. edges that are Common Blocks
     5.a vertex is included in result of Section only when it is not shared
     between the edges of the result of Section

The class BOPAlgo_Section inherits the functionality of root class BOPAlgo_Builder

1.2 class BOPTest_Objects
method:
BOPAlgo_Section& BOPTest_Objects::Section()
has been added to get access to BOPAlgo_Section object

II. Changes:
II.1. class BOPAlgo_BOP
method:
void BOPAlgo_BOP::BuildSection()
has been removed
methods:
void BOPAlgo_BOP::CheckData()
void BOPAlgo_BOP::Prepare()
void BOPAlgo_BOP::PerformInternal1(const BOPAlgo_PaveFiller& theFiller)
const TopTools_ListOfShape& BOPAlgo_BOP::Generated
  (const TopoDS_Shape& theS)
have been modified to eliminate references on Section operation

II.2. class BOPAlgo_PaveFiller
method:
void BOPAlgo_PaveFiller::UpdateFaceInfo
  (BOPDS_DataMapOfPaveBlockListOfPaveBlock& theDME)
modified to prevent the usage of negative index in Data Structure

II.3. class BOPTest_Objects
static function:
Standard_Integer bopsection(Draw_Interpretor& di, Standard_Integer n, const char** a)
has been modified to use BOPAlgo_Section object instead of BOPAlgo_BOP object

static function:
Standard_Integer bbop(Draw_Interpretor& di,
                      Standard_Integer n,
                      const char** a)
has been modified to use BOPAlgo_Section object instea of BOPAlgo_BOP object

II.4. class BRepAlgoAPI_BooleanOperation
field:
myBuilder
the type has been changed from BOPAlgo_BOP* to BOPAlgo_Builder*
method:
void BRepAlgoAPI_BooleanOperation::Build()
has been modified  to use BOPAlgo_Section object

II.5. class QANewModTopOpe_Tools
method:
Standard_Boolean QANewModTopOpe_Tools::HasSameDomain(
                                                   const BOPAlgo_PBOP& theBuilder,
                                                     const TopoDS_Shape& theFace)

void QANewModTopOpe_Tools::SameDomain(
                                      const BOPAlgo_PBOP&   theBuilder,
                                      const TopoDS_Shape&   theFace,
                                      TopTools_ListOfShape& theResultList)

the type of the parameter <theBuilder> has been modified
to use BOPAlgo_Builder* instead of BOPAlgo_BOP*

II.6. The method:
const TopTools_ListOfShape& BOPAlgo_BOP::Generated
  (const TopoDS_Shape& theS)
has been removed
This commit is contained in:
pkv
2014-10-23 15:11:39 +04:00
committed by bugmaster
parent 905428003c
commit 8591531065
16 changed files with 846 additions and 412 deletions

View File

@@ -45,6 +45,7 @@
#include <BRepAlgoAPI_Fuse.hxx>
#include <BRepAlgoAPI_Cut.hxx>
#include <BRepAlgoAPI_Section.hxx>
#include <BOPAlgo_Section.hxx>
//
static BOPAlgo_PaveFiller* pPF=NULL;
@@ -193,14 +194,6 @@ Standard_Integer boptuc(Draw_Interpretor& di, Standard_Integer n, const char** a
return bopsmt(di, n, a, BOPAlgo_CUT21);
}
//=======================================================================
//function : bopsection
//purpose :
//=======================================================================
Standard_Integer bopsection(Draw_Interpretor& di, Standard_Integer n, const char** a)
{
return bopsmt(di, n, a, BOPAlgo_SECTION);
}
//=======================================================================
//function : bopsmt
//purpose :
//=======================================================================
@@ -261,6 +254,62 @@ Standard_Integer bopsmt(Draw_Interpretor& di,
return 0;
}
//=======================================================================
//function : bopsection
//purpose :
//=======================================================================
Standard_Integer bopsection(Draw_Interpretor& di, Standard_Integer n, const char** a)
{
if (n<2) {
di << " use bopsmt r\n";
return 0;
}
//
if (!pPF) {
di << " prepare PaveFiller first\n";
return 0;
}
//
if (pPF->ErrorStatus()) {
di << " PaveFiller has not been done\n";
return 0;
}
//
char buf[64];
Standard_Integer aNb, iErr;
BOPAlgo_Section aBOP;
//
const BOPCol_ListOfShape& aLC=pPF->Arguments();
aNb=aLC.Extent();
if (aNb!=2) {
Sprintf (buf, " wrong number of arguments %s\n", aNb);
di << buf;
return 0;
}
//
const TopoDS_Shape& aS1=aLC.First();
const TopoDS_Shape& aS2=aLC.Last();
//
aBOP.AddArgument(aS1);
aBOP.AddArgument(aS2);
//
aBOP.PerformWithFiller(*pPF);
iErr=aBOP.ErrorStatus();
if (iErr) {
Sprintf(buf, " ErrorStatus : %d\n", iErr);
di << buf;
return 0;
}
//
const TopoDS_Shape& aR=aBOP.Shape();
if (aR.IsNull()) {
di << " null shape\n";
return 0;
}
//
DBRep::Set(a[1], aR);
return 0;
}
//=======================================================================
//function : bcommon
//purpose :
//=======================================================================
@@ -327,7 +376,10 @@ Standard_Integer bsection(Draw_Interpretor& di,
const char* key2 = (n > 5) ? a[5] : NULL;
const char* pcurveconf = NULL;
if (key1 && (!strcasecmp(key1,"-n2d") || !strcasecmp(key1,"-n2d1") || !strcasecmp(key1,"-n2d2"))) {
if (key1 &&
(!strcasecmp(key1,"-n2d") ||
!strcasecmp(key1,"-n2d1") ||
!strcasecmp(key1,"-n2d2"))) {
pcurveconf = key1;
}
else {

View File

@@ -14,20 +14,22 @@
class Objects from BOPTest
---Purpose:
---Purpose:
uses
ListOfShape from BOPCol,
ListOfShape from BOPCol,
PDS from BOPDS,
PaveFiller from BOPAlgo,
Builder from BOPAlgo,
PBuilder from BOPAlgo,
BOP from BOPAlgo,
PDS from BOPDS
Section from BOPAlgo
--raises
is
PaveFiller(myclass)
returns PaveFiller from BOPAlgo;
returns PaveFiller from BOPAlgo;
---C++: return &
Init(myclass);
@@ -35,26 +37,30 @@ is
Clear(myclass);
PDS(myclass)
returns PDS from BOPDS;
returns PDS from BOPDS;
Builder(myclass)
returns Builder from BOPAlgo;
returns Builder from BOPAlgo;
---C++: return &
BOP(myclass)
returns BOP from BOPAlgo;
returns BOP from BOPAlgo;
---C++: return &
Section(myclass)
returns Section from BOPAlgo;
---C++: return &
Shapes(myclass)
returns ListOfShape from BOPCol;
returns ListOfShape from BOPCol;
---C++: return &
Tools(myclass)
returns ListOfShape from BOPCol;
returns ListOfShape from BOPCol;
---C++: return &
--
SetBuilder(myclass;
theBuilder:PBuilder from BOPAlgo);
theBuilder:PBuilder from BOPAlgo);
SetBuilderDefault(myclass);

View File

@@ -178,6 +178,15 @@ BOPAlgo_BOP& BOPTest_Objects::BOP()
return sBOP;
}
//=======================================================================
//function : Section
//purpose :
//=======================================================================
BOPAlgo_Section& BOPTest_Objects::Section()
{
static BOPAlgo_Section sSection(Allocator1());
return sSection;
}
//=======================================================================
//function : Shapes
//purpose :
//=======================================================================

View File

@@ -30,6 +30,7 @@
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Operation.hxx>
#include <BOPAlgo_BOP.hxx>
#include <BOPAlgo_Section.hxx>
//
#include <BOPTest_DrawableShape.hxx>
#include <BOPTest_Objects.hxx>
@@ -241,7 +242,6 @@ Standard_Integer bbuild(Draw_Interpretor& di,
DBRep::Set(a[1], aR);
return 0;
}
//=======================================================================
//function : bbop
//purpose :
@@ -288,30 +288,43 @@ Standard_Integer bbop(Draw_Interpretor& di,
//
BOPAlgo_PaveFiller& aPF=BOPTest_Objects::PaveFiller();
//
BOPAlgo_BOP& aBOP=BOPTest_Objects::BOP();
aBOP.Clear();
BOPAlgo_Builder *pBuilder=NULL;
if (aOp!=BOPAlgo_SECTION) {
pBuilder=&BOPTest_Objects::BOP();
}
else {
pBuilder=&BOPTest_Objects::Section();
}
//
pBuilder->Clear();
//
BOPCol_ListOfShape& aLSObj=BOPTest_Objects::Shapes();
aIt.Initialize(aLSObj);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
aBOP.AddArgument(aS);
pBuilder->AddArgument(aS);
}
//
BOPCol_ListOfShape& aLSTools=BOPTest_Objects::Tools();
aIt.Initialize(aLSTools);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
aBOP.AddTool(aS);
if (aOp!=BOPAlgo_SECTION) {
BOPAlgo_BOP *pBOP=(BOPAlgo_BOP *)pBuilder;
//
BOPCol_ListOfShape& aLSTools=BOPTest_Objects::Tools();
aIt.Initialize(aLSTools);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
pBOP->AddTool(aS);
}
//
pBOP->SetOperation(aOp);
}
//
aBOP.SetOperation(aOp);
aBOP.SetRunParallel(bRunParallel);
pBuilder->SetRunParallel(bRunParallel);
//
aChrono.Start();
//
aBOP.PerformWithFiller(aPF);
iErr=aBOP.ErrorStatus();
pBuilder->PerformWithFiller(aPF);
iErr=pBuilder->ErrorStatus();
if (iErr) {
Sprintf(buf, " error: %d\n", iErr);
di << buf;
@@ -328,7 +341,7 @@ Standard_Integer bbop(Draw_Interpretor& di,
di << buf;
}
//
const TopoDS_Shape& aR=aBOP.Shape();
const TopoDS_Shape& aR=pBuilder->Shape();
if (aR.IsNull()) {
di << " null shape\n";
return 0;