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

0024620: BOPAlgo_CheckerSI returns interferences that are not sub-shapes of the source shape

void BOPAlgo_CheckerSI::PrepareCopy()
has been added.
Purpose:
   - provides the copy of the argument
   - provides links between the copy and the original
- protected method:
void BOPAlgo_CheckerSI::PostTreatCopy()
has been added.
Purpose: provides post treat actions wit the copy.

void BOPAlgo_PaveFiller::Perform()
The try/catch mechanism is used inside the method

Standard_Integer bopcheck
  (Draw_Interpretor& di, Standard_Integer n,  const char** a )
The redundant copying is removed.

Standard_Integer bopargcheck
  (Draw_Interpretor& di, Standard_Integer n,  const char** a )
The redundant copying is removed.

packages:
BOPAlgo
BOPTest

Test cases for issue CR24620
Small correction of text case for issue CR24620
This commit is contained in:
pkv
2014-02-20 17:07:51 +04:00
committed by apn
parent e16f61a62f
commit 6f31882ada
6 changed files with 345 additions and 142 deletions

View File

@@ -20,19 +20,22 @@ class CheckerSI from BOPAlgo
inherits PaveFiller from BOPAlgo
---Purpose: Checks shape on self-interference.
uses
DataMapOfShapeShape from BOPCol
is
Create
returns CheckerSI from BOPAlgo;
returns CheckerSI from BOPAlgo;
---C++: alias "Standard_EXPORT virtual ~BOPAlgo_CheckerSI();"
Perform(me:out)
is redefined;
is redefined;
Init (me:out)
is redefined protected;
is redefined protected;
SetLevelOfCheck(me:out;
theLevel: Integer from Standard);
@@ -45,10 +48,23 @@ is
-- 4 - V/V, V/E, E/E, V/F and E/F;
-- 5 - all interferences, default value.
SetNonDestructive(me:out;
theFlag: Boolean from Standard);
---Purpose: Sets the flag <theFlag> that defines
-- the mode of the treatment:
-- the copy of the argument when theFlag is true
-- the argument itself when theFlag is false
NonDestructive(me)
returns Boolean from Standard;
---Purpose: Returns the flag that defines the
-- mode of the treatment:
-- true when the copy of the argument is used
-- false when the argument itself is used
PostTreat (me:out)
is protected;
---Purpose: Provides post-tratment actions
is protected;
---Purpose: Provides post-treatment actions
PerformVZ(me:out)
is virtual protected;
@@ -64,9 +80,17 @@ is
PerformZZ(me:out)
is virtual protected;
--Purpose: Computes Solid/Solid interferences
PrepareCopy(me:out)
is virtual protected;
PostTreatCopy (me:out)
is protected;
---Purpose: Provides post-treatment actions for the copy
fields
myLevelOfCheck: Integer from Standard is protected;
myNonDestructive: Boolean from Standard is protected;
myNewOldMap : DataMapOfShapeShape from BOPCol is protected;
end CheckerSI;

View File

@@ -21,11 +21,14 @@
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <BRepBuilderAPI_Copy.hxx>
#include <TopTools_ListOfShape.hxx>
#include <BOPCol_MapOfShape.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_IteratorSI.hxx>
#include <BOPDS_PIteratorSI.hxx>
#include <BOPInt_Context.hxx>
#include <BOPDS_Interf.hxx>
#include <BOPDS_MapOfPassKey.hxx>
#include <BOPDS_PassKey.hxx>
@@ -35,7 +38,10 @@
#include <BOPDS_VectorOfInterfVF.hxx>
#include <BOPDS_VectorOfInterfEF.hxx>
#include <BOPDS_VectorOfInterfFF.hxx>
#include <BOPDS_VectorOfPoint.hxx>
#include <BOPInt_Context.hxx>
#include <BOPTools.hxx>
#include <BOPTools_AlgoTools.hxx>
//=======================================================================
@@ -47,6 +53,7 @@ BOPAlgo_CheckerSI::BOPAlgo_CheckerSI()
BOPAlgo_PaveFiller()
{
myLevelOfCheck=BOPDS_DS::NbInterfTypes()-1;
myNonDestructive=Standard_True;
}
//=======================================================================
//function : ~
@@ -69,17 +76,28 @@ void BOPAlgo_CheckerSI::SetLevelOfCheck(const Standard_Integer theLevel)
}
}
//=======================================================================
//function : SetNonDestructive
//purpose :
//=======================================================================
void BOPAlgo_CheckerSI::SetNonDestructive(const Standard_Boolean theFlag)
{
myNonDestructive=theFlag;
}
//=======================================================================
//function : NonDestructive
//purpose :
//=======================================================================
Standard_Boolean BOPAlgo_CheckerSI::NonDestructive() const
{
return myNonDestructive;
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void BOPAlgo_CheckerSI::Init()
{
myErrorStatus = 0;
//
if (!myArguments.Extent()) {
myErrorStatus=10;
return;
}
myErrorStatus=0;
//
Clear();
//
@@ -111,6 +129,19 @@ void BOPAlgo_CheckerSI::Perform()
try {
OCC_CATCH_SIGNALS
//
myErrorStatus=0;
if (myArguments.Extent()!=1) {
myErrorStatus=10;
return;
}
//
if (myNonDestructive) {
PrepareCopy();
if (myErrorStatus) {
return;
}
}
//
BOPAlgo_PaveFiller::Perform();
if (myErrorStatus) {
return;
@@ -137,11 +168,19 @@ void BOPAlgo_CheckerSI::Perform()
}
//
PostTreat();
if (myErrorStatus) {
return;
}
//
if (myNonDestructive) {
PostTreatCopy();
}
}
catch (Standard_Failure) {
myErrorStatus=11;
}
}
//=======================================================================
//function : PostTreat
//purpose :
@@ -151,7 +190,10 @@ void BOPAlgo_CheckerSI::PostTreat()
Standard_Integer i, aNb, n1, n2;
BOPDS_PassKey aPK;
//
BOPDS_MapOfPassKey& aMPK=*((BOPDS_MapOfPassKey*)&myDS->Interferences());
myErrorStatus=0;
//
BOPDS_MapOfPassKey& aMPK=
*((BOPDS_MapOfPassKey*)&myDS->Interferences());
aMPK.Clear();
//
// 0
@@ -227,21 +269,22 @@ void BOPAlgo_CheckerSI::PostTreat()
//
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);
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;
++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;
}
const BOPDS_Curve& aNC=aVC(j);
const BOPDS_ListOfPaveBlock& aLPBC=aNC.PaveBlocks();
if (aLPBC.Extent()) {
++iFound;
break;
}
}
}
//
@@ -298,3 +341,72 @@ void BOPAlgo_CheckerSI::PostTreat()
aMPK.Add(aPK);
}
}
//=======================================================================
//function : PrepareCopy
//purpose :
//=======================================================================
void BOPAlgo_CheckerSI::PrepareCopy()
{
Standard_Boolean bIsDone;
BRepBuilderAPI_Copy aCopier;
BOPCol_MapOfShape aMSA;
BOPCol_MapIteratorOfMapOfShape aItMS;
//
myErrorStatus=0;
//
myNewOldMap.Clear();
//
const TopoDS_Shape& aSA=myArguments.First();
//
BOPTools::MapShapes(aSA, aMSA);
//
aCopier.Perform(aSA, Standard_False);
bIsDone=aCopier.IsDone();
if (!bIsDone) {
myErrorStatus=12;
return;
}
//
const TopoDS_Shape& aSC=aCopier.Shape();
//
aItMS.Initialize(aMSA);
for(; aItMS.More(); aItMS.Next()) {
const TopoDS_Shape& aSAx=aItMS.Value();
const TopoDS_Shape& aSCx=aCopier.Modified(aSAx).First();
myNewOldMap.Bind(aSCx, aSAx);
}
//
myArguments.Clear();
myArguments.Append(aSC);
}
//=======================================================================
//function : PostTreatCopy
//purpose :
//=======================================================================
void BOPAlgo_CheckerSI::PostTreatCopy()
{
Standard_Integer i, aNb;
//
myErrorStatus=0;
//
aNb=myDS->NbSourceShapes();
for (i=0; i!=aNb; ++i) {
BOPDS_ShapeInfo& aSI=myDS->ChangeShapeInfo(i);
const TopoDS_Shape& aSCi=aSI.Shape();
if (!myNewOldMap.IsBound(aSCi)) {
myErrorStatus=13;
return;
}
//
const TopoDS_Shape& aSAi=myNewOldMap.Find(aSCi);
aSI.SetShape(aSAi);
}
}
//
// myErrorStatus:
//
// 10 - The number of the arguments is not 1
// 11 - Exception is caught
// 12 - BRepBuilderAPI_Copy is not done
// 13 - myNewOldMap doe not contain DS shape

View File

@@ -17,17 +17,21 @@
#include <BOPAlgo_PaveFiller.ixx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <NCollection_BaseAllocator.hxx>
#include <BOPInt_Context.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_Iterator.hxx>
//=======================================================================
//function :
//purpose :
//=======================================================================
BOPAlgo_PaveFiller::BOPAlgo_PaveFiller()
BOPAlgo_PaveFiller::BOPAlgo_PaveFiller()
:
BOPAlgo_Algo()
{
@@ -38,7 +42,8 @@
//function :
//purpose :
//=======================================================================
BOPAlgo_PaveFiller::BOPAlgo_PaveFiller(const Handle(NCollection_BaseAllocator)& theAllocator)
BOPAlgo_PaveFiller::BOPAlgo_PaveFiller
(const Handle(NCollection_BaseAllocator)& theAllocator)
:
BOPAlgo_Algo(theAllocator)
{
@@ -49,7 +54,7 @@
//function : ~
//purpose :
//=======================================================================
BOPAlgo_PaveFiller::~BOPAlgo_PaveFiller()
BOPAlgo_PaveFiller::~BOPAlgo_PaveFiller()
{
Clear();
}
@@ -57,7 +62,7 @@
//function : Clear
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::Clear()
void BOPAlgo_PaveFiller::Clear()
{
if (myIterator) {
delete myIterator;
@@ -67,13 +72,12 @@
delete myDS;
myDS=NULL;
}
myErrorStatus=2;
}
//=======================================================================
//function : DS
//purpose :
//=======================================================================
const BOPDS_DS& BOPAlgo_PaveFiller::DS()
const BOPDS_DS& BOPAlgo_PaveFiller::DS()
{
return *myDS;
}
@@ -81,7 +85,7 @@
//function : PDS
//purpose :
//=======================================================================
BOPDS_PDS BOPAlgo_PaveFiller::PDS()
BOPDS_PDS BOPAlgo_PaveFiller::PDS()
{
return myDS;
}
@@ -89,7 +93,7 @@
//function : Context
//purpose :
//=======================================================================
Handle(BOPInt_Context) BOPAlgo_PaveFiller::Context()
Handle(BOPInt_Context) BOPAlgo_PaveFiller::Context()
{
return myContext;
}
@@ -97,7 +101,8 @@
//function : SectionAttribute
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::SetSectionAttribute(const BOPAlgo_SectionAttribute& theSecAttr)
void BOPAlgo_PaveFiller::SetSectionAttribute
(const BOPAlgo_SectionAttribute& theSecAttr)
{
mySectionAttribute = theSecAttr;
}
@@ -105,7 +110,7 @@
//function : SetArguments
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::SetArguments(const BOPCol_ListOfShape& theLS)
void BOPAlgo_PaveFiller::SetArguments(const BOPCol_ListOfShape& theLS)
{
myArguments=theLS;
}
@@ -113,7 +118,7 @@
//function : Arguments
//purpose :
//=======================================================================
const BOPCol_ListOfShape& BOPAlgo_PaveFiller::Arguments()const
const BOPCol_ListOfShape& BOPAlgo_PaveFiller::Arguments()const
{
return myArguments;
}
@@ -121,7 +126,7 @@
// function: Init
// purpose:
//=======================================================================
void BOPAlgo_PaveFiller::Init()
void BOPAlgo_PaveFiller::Init()
{
myErrorStatus=0;
//
@@ -152,68 +157,73 @@
// function: Perform
// purpose:
//=======================================================================
void BOPAlgo_PaveFiller::Perform()
void BOPAlgo_PaveFiller::Perform()
{
myErrorStatus=0;
//
Init();
if (myErrorStatus) {
return;
}
// 00
PerformVV();
if (myErrorStatus) {
return;
}
// 01
PerformVE();
if (myErrorStatus) {
return;
}
//
myDS->UpdatePaveBlocks();
// 11
PerformEE();
if (myErrorStatus) {
return;
}
// 02
PerformVF();
if (myErrorStatus) {
return;
}
// 12
PerformEF();
if (myErrorStatus) {
return;
}
//
MakeSplitEdges();
if (myErrorStatus) {
return;
}
//
// 22
PerformFF();
if (myErrorStatus) {
return;
}
//
MakeBlocks();
if (myErrorStatus) {
return;
}
//
RefineFaceInfoOn();
//
MakePCurves();
if (myErrorStatus) {
return;
}
//
ProcessDE();
if (myErrorStatus) {
return;
}
//
try {
OCC_CATCH_SIGNALS
//
Init();
if (myErrorStatus) {
return;
}
// 00
PerformVV();
if (myErrorStatus) {
return;
}
// 01
PerformVE();
if (myErrorStatus) {
return;
}
//
myDS->UpdatePaveBlocks();
// 11
PerformEE();
if (myErrorStatus) {
return;
}
// 02
PerformVF();
if (myErrorStatus) {
return;
}
// 12
PerformEF();
if (myErrorStatus) {
return;
}
//
MakeSplitEdges();
if (myErrorStatus) {
return;
}
//
// 22
PerformFF();
if (myErrorStatus) {
return;
}
//
MakeBlocks();
if (myErrorStatus) {
return;
}
//
RefineFaceInfoOn();
//
MakePCurves();
if (myErrorStatus) {
return;
}
//
ProcessDE();
if (myErrorStatus) {
return;
}
} // try {
catch (Standard_Failure) {
myErrorStatus=11;
}
}