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

0028284: Avoid classification of sub-shapes of arguments of BOPs relatively solids during Intersection phase

1. The methods PerformVZ, PerformEZ, PerformFZ and PerformZZ have been transferred from BOPAlgo_PaveFiller to BOPAlgo_CheckerSI class
to perform intersection of sub-shapes with solids only in self-intersection mode.

2. The checks for solids built from the same (shared) faces have been added into methods building the result of Boolean operations -
BOPAlgo_BOP::BuildRC() and BOPAlgo_BOP::BuildSolid().

3. Since the NonDestructive mode is now natively supported by the BOPAlgo_PaveFiller the methods providing the support of this mode by CheckerSI
(BOPAlgo_CheckerSI::PrepareCopy() and BOPAlgo_CheckerSI::PostTreatCopy()) are not needed and have been removed.

4. The pairs of sub-shapes with interfering bounding boxes are now sorted before real intersection to guarantee the constant order of
intersection of sub-shapes and produce more stable result. The class BOPDS_PassKey has been replaced with simpler class BOPDS_Pair.

5. The class BOPDS_SubIterator has been refactored.

6. Test cases for the issue.

7. Adjustment of the test case boolean volumemaker D2.
This commit is contained in:
emv
2017-01-09 09:50:03 +03:00
committed by apn
parent f542b7bbf1
commit 25dfc507be
40 changed files with 1483 additions and 1490 deletions

View File

@@ -21,7 +21,7 @@
#include <BOPCol_IndexedMapOfShape.hxx>
#include <BOPCol_SequenceOfShape.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_MapOfPassKey.hxx>
#include <BOPDS_MapOfPair.hxx>
#include <BOPTools.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPTools_AlgoTools3D.hxx>
@@ -352,7 +352,7 @@ void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences()
}
//
Standard_Integer iErr, n1, n2;
BOPDS_MapIteratorMapOfPassKey aItMPK;
BOPDS_MapIteratorOfMapOfPair aItMPK;
BOPCol_ListOfShape anArgs;
BOPAlgo_CheckerSI aChecker;
//
@@ -367,12 +367,12 @@ void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences()
iErr=aChecker.ErrorStatus();
//
const BOPDS_DS& aDS=*(aChecker.PDS());
const BOPDS_MapOfPassKey& aMPK=aDS.Interferences();
const BOPDS_MapOfPair& aMPK=aDS.Interferences();
//
aItMPK.Initialize(aMPK);
for (; aItMPK.More(); aItMPK.Next()) {
const BOPDS_PassKey& aPK=aItMPK.Value();
aPK.Ids(n1, n2);
const BOPDS_Pair& aPK=aItMPK.Value();
aPK.Indices(n1, n2);
if(aDS.IsNewShape(n1) || aDS.IsNewShape(n2)) {
continue;
}

View File

@@ -59,7 +59,11 @@ static
static
Standard_Integer NbCommonItemsInMap(const BOPCol_MapOfShape& theM1,
const BOPCol_MapOfShape& theM2);
//
static
void MapFacesToBuildSolids(const TopoDS_Shape& theSol,
BOPCol_IndexedDataMapOfShapeListOfShape& theMFS,
BOPCol_IndexedMapOfShape& theMFI);
//=======================================================================
//function :
@@ -556,10 +560,10 @@ void BOPAlgo_BOP::BuildRC()
//
Standard_Integer i, j, aNb, iDim;
Standard_Boolean bCheckEdges, bContains, bCut21, bCommon;
BOPCol_IndexedMapOfShape aMArgs, aMTools;
BOPCol_IndexedMapOfShape aMArgsIm, aMToolsIm;
BOPCol_ListIteratorOfListOfShape aItLS;
//
// prepare the building elements of arguments to get its splits
BOPCol_IndexedMapOfShape aMArgs, aMTools;
for (i = 0; i < 2; ++i) {
const BOPCol_ListOfShape& aLS = !i ? myArguments : myTools;
BOPCol_IndexedMapOfShape& aMS = !i ? aMArgs : aMTools;
@@ -574,9 +578,14 @@ void BOPAlgo_BOP::BuildRC()
//
bCheckEdges = Standard_False;
//
// get splits of building elements
BOPCol_IndexedMapOfShape aMArgsIm, aMToolsIm;
BOPTools_IndexedDataMapOfSetShape aMSetArgs, aMSetTools;
for (i = 0; i < 2; ++i) {
const BOPCol_IndexedMapOfShape& aMS = !i ? aMArgs : aMTools;
BOPCol_IndexedMapOfShape& aMSIm = !i ? aMArgsIm : aMToolsIm;
BOPTools_IndexedDataMapOfSetShape& aMSet = !i ? aMSetArgs : aMSetTools;
//
aNb = aMS.Extent();
for (j = 1; j <= aNb; ++j) {
@@ -600,6 +609,13 @@ void BOPAlgo_BOP::BuildRC()
}
else {
aMSIm.Add(aS);
if (aS.ShapeType() == TopAbs_SOLID) {
BOPTools_Set aST;
aST.Add(aS, TopAbs_FACE);
if (!aMSet.Contains(aST)) {
aMSet.Add(aST, aS);
}
}
}
}
}
@@ -614,6 +630,7 @@ void BOPAlgo_BOP::BuildRC()
//
const BOPCol_IndexedMapOfShape& aMIt = bCut21 ? aMToolsIm : aMArgsIm;
const BOPCol_IndexedMapOfShape& aMCheck = bCut21 ? aMArgsIm : aMToolsIm;
const BOPTools_IndexedDataMapOfSetShape& aMSetCheck = bCut21 ? aMSetArgs : aMSetTools;
//
BOPCol_IndexedMapOfShape aMCheckExp, aMItExp;
//
@@ -649,6 +666,12 @@ void BOPAlgo_BOP::BuildRC()
const TopoDS_Shape& aS = aMItExp(i);
//
bContains = aMCheckExp.Contains(aS);
if (!bContains && aS.ShapeType() == TopAbs_SOLID) {
BOPTools_Set aST;
aST.Add(aS, TopAbs_FACE);
bContains = aMSetCheck.Contains(aST);
}
//
if (bCommon) {
if (bContains) {
aBB.Add(aC, aS);
@@ -870,126 +893,107 @@ void BOPAlgo_BOP::BuildShape()
//=======================================================================
void BOPAlgo_BOP::BuildSolid()
{
Standard_Boolean bHasInterf, bHasSharedFaces;
Standard_Integer i, aNbF, aNbSx, iX, iErr, aNbZ;
TopAbs_Orientation aOr, aOr1;
TopoDS_Iterator aIt;
TopoDS_Shape aRC;
BRep_Builder aBB;
TopExp_Explorer aExp;
BOPCol_IndexedMapOfShape aMFI;
BOPCol_IndexedDataMapOfShapeListOfShape aMFS, aMEF;
BOPCol_ListIteratorOfListOfShape aItLS;
BOPCol_ListOfShape aSFS;
BOPAlgo_BuilderSolid aSB;
BOPCol_MapOfShape aMSA, aMZ;
BOPTools_IndexedDataMapOfSetShape aDMSTS;
// Containers
BOPCol_ListOfShape aLSC;
//
BOPCol_ListIteratorOfListOfShape aItLS;
TopExp_Explorer aExp;
BRep_Builder aBB;
//
myErrorStatus=0;
//
// Map of of Solids of Arguments
for (i=0; i<2; ++i) {
const BOPCol_ListOfShape& aLSA=(i) ? myArguments : myTools;
// Get solids from input arguments
BOPCol_MapOfShape aMSA;
// Map the arguments to find shared faces
BOPCol_IndexedDataMapOfShapeListOfShape aMFS;
for (Standard_Integer i = 0; i < 2; ++i) {
const BOPCol_ListOfShape& aLSA = (i) ? myArguments : myTools;
aItLS.Initialize(aLSA);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aSA=aItLS.Value();
//
CollectContainers(aSA, aLSC);
//
const TopoDS_Shape& aSA = aItLS.Value();
aExp.Init(aSA, TopAbs_SOLID);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aZA=aExp.Current();
aMSA.Add(aZA);
//
BOPTools::MapShapesAndAncestors(aZA,
TopAbs_FACE,
TopAbs_SOLID,
aMFS);
const TopoDS_Shape& aSol = aExp.Current();
aMSA.Add(aSol);
BOPTools::MapShapesAndAncestors(aSol, TopAbs_FACE, TopAbs_SOLID, aMFS);
}
}
}
//
aNbF=aMFS.Extent();
for (i=1; i<aNbF; ++i) {
//const TopoDS_Shape& aFA=aMFZA.FindKey(i);
const BOPCol_ListOfShape& aLZA=aMFS(i);
aNbZ=aLZA.Extent();
if (aNbZ > 1) {
aItLS.Initialize(aLZA);
for(; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aZA=aItLS.Value();
aMZ.Add(aZA);
}
}
}
//
aMFS.Clear();
//
aIt.Initialize(myRC);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSx=aIt.Value();
if (aMSA.Contains(aSx)) {
iX=myDS->Index(aSx);
bHasInterf=myDS->HasInterf(iX);
bHasSharedFaces=aMZ.Contains(aSx);
//
if (!bHasInterf && !bHasSharedFaces) {
// It means that the solid aSx will be added
// to the result as is.
// The solid aSx will not participate
// in creation of a new solid(s).
BOPTools_Set aST;
//
aST.Add(aSx, TopAbs_FACE);
//
if (!aDMSTS.Contains(aST)) {
aDMSTS.Add(aST, aSx);
}
continue;
// get Compsolids from input arguments
CollectContainers(aSA, aLSC);
}
}
//
// Find solids in input arguments sharing faces with other solids
BOPCol_MapOfShape aMTSols;
Standard_Integer i, aNb = aMFS.Extent();
for (i = 1; i < aNb; ++i) {
const BOPCol_ListOfShape& aLSols = aMFS(i);
if (aLSols.Extent() > 1) {
aItLS.Initialize(aLSols);
for(; aItLS.More(); aItLS.Next()) {
aMTSols.Add(aItLS.Value());
}
}
}
}
//
// Possibly untouched solids - to be added to results as is
BOPCol_IndexedMapOfShape aMUSols;
// Use map to chose the most outer faces to build result solids
aMFS.Clear();
// Internal faces
BOPCol_IndexedMapOfShape aMFI;
//
TopoDS_Iterator aIt(myRC);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSx = aIt.Value();
if (aMSA.Contains(aSx)) {
if (!aMTSols.Contains(aSx)) {
aMUSols.Add(aSx);
continue;
}
}
//
MapFacesToBuildSolids(aSx, aMFS, aMFI);
} // for (; aIt.More(); aIt.Next()) {
//
// Process possibly untouched solids.
// Really untouched solids will be added into result as is.
// Others will be processed by BuilderSolid.
BOPTools_IndexedDataMapOfSetShape aDMSTS;
//
aNb = aMUSols.Extent();
for (i = 1; i <= aNb; ++i) {
const TopoDS_Shape& aSx = aMUSols(i);
//
aExp.Init(aSx, TopAbs_FACE);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aFx=aExp.Current();
//
aOr=aFx.Orientation();
if (aOr==TopAbs_INTERNAL) {
aMFI.Add(aFx);
continue;
}
//
if (!aMFS.Contains(aFx)) {
BOPCol_ListOfShape aLSx;
//
aLSx.Append(aSx);
aMFS.Add(aFx, aLSx);
}
else {
iX=aMFS.FindIndex(aFx);
const TopoDS_Shape& aFx1=aMFS.FindKey(iX);
aOr1=aFx1.Orientation();
if (aOr1!=aOr) {
BOPCol_ListOfShape& aLSx=aMFS.ChangeFromKey(aFx);
aLSx.Append(aSx);
aMFS.Add(aFx, aLSx);
}
if (aMFS.Contains(aExp.Current())) {
break;
}
}
} // for (; aIt.More(); aIt.Next()) {
//faces that will be added in the end;
BOPCol_ListOfShape aLF, aLFx;
// SFS
aNbF=aMFS.Extent();
for (i=1; i<=aNbF; ++i) {
const TopoDS_Shape& aFx=aMFS.FindKey(i);
const BOPCol_ListOfShape& aLSx=aMFS(i);
aNbSx=aLSx.Extent();
if (aNbSx==1) {
BOPTools::MapShapesAndAncestors
(aFx,TopAbs_EDGE, TopAbs_FACE, aMEF);
//
if (aExp.More()) {
MapFacesToBuildSolids(aSx, aMFS, aMFI);
}
else {
BOPTools_Set aST;
aST.Add(aSx, TopAbs_FACE);
if (!aDMSTS.Contains(aST)) {
aDMSTS.Add(aST, aSx);
}
}
}
//
BOPCol_IndexedDataMapOfShapeListOfShape aMEF;
// Split faces will be added in the end
// to avoid errors in BuilderSolid algorithm
BOPCol_ListOfShape aLF, aLFx;
aNb = aMFS.Extent();
for (i = 1; i <= aNb; ++i) {
const BOPCol_ListOfShape& aLSx = aMFS(i);
if (aLSx.Extent() == 1) {
const TopoDS_Shape& aFx = aMFS.FindKey(i);
BOPTools::MapShapesAndAncestors(aFx, TopAbs_EDGE, TopAbs_FACE, aMEF);
if (IsBoundSplits(aFx, aMEF)){
aLFx.Append(aFx);
continue;
@@ -997,59 +1001,63 @@ void BOPAlgo_BOP::BuildSolid()
aLF.Append(aFx);
}
}
//
// Faces to build result solids
BOPCol_ListOfShape aSFS;
aItLS.Initialize(aLF);
for(; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aFx=aItLS.Value();
const TopoDS_Shape& aFx = aItLS.Value();
aSFS.Append(aFx);
}
// add faces from aLFx to aSFS;
//
// Split faces
aItLS.Initialize(aLFx);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aFx=aItLS.Value();
const TopoDS_Shape& aFx = aItLS.Value();
aSFS.Append(aFx);
}
//
aNbF=aMFI.Extent();
for (i=1; i<=aNbF; ++i) {
TopoDS_Shape aFx;
// Internal faces
aNb = aMFI.Extent();
for (i = 1; i <= aNb; ++i) {
TopoDS_Shape aFx = aMFI.FindKey(i);
aSFS.Append(aFx.Oriented(TopAbs_FORWARD));
aSFS.Append(aFx.Oriented(TopAbs_REVERSED));
}
//
TopoDS_Shape aRC;
BOPTools_AlgoTools::MakeContainer(TopAbs_COMPOUND, aRC);
if (aSFS.Extent()) {
// Build solids from set of faces
BOPAlgo_BuilderSolid aSB;
aSB.SetContext(myContext);
aSB.SetShapes(aSFS);
aSB.Perform();
if (aSB.ErrorStatus()) {
myErrorStatus = 30; // SolidBuilder failed
return;
}
// new solids
const BOPCol_ListOfShape& aLSR = aSB.Areas();
//
aFx=aMFI.FindKey(i);
aFx.Orientation(TopAbs_FORWARD);
aSFS.Append(aFx);
aFx.Orientation(TopAbs_REVERSED);
aSFS.Append(aFx);
// add new solids to result
aItLS.Initialize(aLSR);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aSR = aItLS.Value();
aBB.Add(aRC, aSR);
}
}
//
// BuilderSolid
BOPTools_AlgoTools::MakeContainer(TopAbs_COMPOUND, aRC);
//
aSB.SetContext(myContext);
aSB.SetShapes(aSFS);
aSB.Perform();
iErr=aSB.ErrorStatus();
if (iErr) {
myErrorStatus=30; // SolidBuilder failed
return;
}
//
const BOPCol_ListOfShape& aLSR=aSB.Areas();
//
aItLS.Initialize(aLSR);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aSR=aItLS.Value();
aBB.Add(aRC, aSR);
}
//
aNbSx = aDMSTS.Extent();
for (i = 1; i <= aNbSx; ++i) {
// add untouched solids to result
aNb = aDMSTS.Extent();
for (i = 1; i <= aNb; ++i) {
const TopoDS_Shape& aSx = aDMSTS(i);
aBB.Add(aRC, aSx);
}
//
if (aLSC.IsEmpty()) {
// no Compsolids in arguments
myShape=aRC;
myShape = aRC;
return;
}
//
@@ -1059,11 +1067,21 @@ void BOPAlgo_BOP::BuildSolid()
TopoDS_Shape aResult;
BOPTools_AlgoTools::MakeContainer(TopAbs_COMPOUND, aResult);
//
aIt.Initialize(aRC);
if (!aIt.More()) {
// no solids in the result
myShape = aRC;
return;
}
//
const TopoDS_Shape& aSol1 = aIt.Value();
aIt.Next();
//
// optimization for one solid in the result
if (aLSR.Extent() == 1 && !aNbSx) {
if (!aIt.More()) {
TopoDS_Shape aCS;
BOPTools_AlgoTools::MakeContainer(TopAbs_COMPSOLID, aCS);
aBB.Add(aCS, aLSR.First());
aBB.Add(aCS, aSol1);
//
aBB.Add(aResult, aCS);
myShape = aResult;
@@ -1350,3 +1368,35 @@ Standard_Integer NbCommonItemsInMap(const BOPCol_MapOfShape& theM1,
}
return iCommon;
}
//=======================================================================
//function : MapFacesToBuildSolids
//purpose : Stores the faces of the given solid into outgoing maps:
// <theMFS> - not internal faces with reference to solid;
// <theMFI> - internal faces.
//=======================================================================
void MapFacesToBuildSolids(const TopoDS_Shape& theSol,
BOPCol_IndexedDataMapOfShapeListOfShape& theMFS,
BOPCol_IndexedMapOfShape& theMFI)
{
TopExp_Explorer aExp(theSol, TopAbs_FACE);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aF = aExp.Current();
//
if (aF.Orientation() == TopAbs_INTERNAL) {
theMFI.Add(aF);
continue;
}
//
BOPCol_ListOfShape* pLSol = theMFS.ChangeSeek(aF);
if (!pLSol) {
pLSol = &theMFS(theMFS.Add(aF, BOPCol_ListOfShape()));
pLSol->Append(theSol);
}
else {
const TopoDS_Shape& aF1 = theMFS.FindKey(theMFS.FindIndex(aF));
if (aF1.Orientation() != aF.Orientation()) {
pLSol->Append(theSol);
}
}
}
}

View File

@@ -22,8 +22,8 @@
#include <BOPDS_DS.hxx>
#include <BOPDS_Interf.hxx>
#include <BOPDS_IteratorSI.hxx>
#include <BOPDS_MapOfPassKey.hxx>
#include <BOPDS_PassKey.hxx>
#include <BOPDS_MapOfPair.hxx>
#include <BOPDS_Pair.hxx>
#include <BOPDS_PIteratorSI.hxx>
#include <BOPDS_VectorOfInterfEF.hxx>
#include <BOPDS_VectorOfInterfFF.hxx>
@@ -105,49 +105,36 @@ void BOPAlgo_CheckerSI::Init()
void BOPAlgo_CheckerSI::Perform()
{
try {
Standard_Integer iErr;
//
OCC_CATCH_SIGNALS
//
myErrorStatus=0;
if (myArguments.Extent()!=1) {
myErrorStatus=10;
myErrorStatus = 0;
if (myArguments.Extent() != 1) {
myErrorStatus = 10;
return;
}
//
if (myNonDestructive) {
PrepareCopy();
if (myErrorStatus) {
return;
}
}
//
// Perform intersection of sub shapes
BOPAlgo_PaveFiller::Perform();
iErr=myErrorStatus;
//
// Perform intersection with solids
if (!myErrorStatus)
PerformVZ();
//
if (!myErrorStatus)
PerformEZ();
//
if (!myErrorStatus)
PerformFZ();
//
if (!myErrorStatus)
PerformZZ();
//
// Treat the intersection results
PostTreat();
if (myErrorStatus) {
iErr=myErrorStatus;
}
//
if (myNonDestructive) {
PostTreatCopy();
if (myErrorStatus) {
iErr=myErrorStatus;
}
}
//
if (iErr) {
myErrorStatus=iErr;
}
}
//
catch (Standard_Failure) {
if (myNonDestructive) {
PostTreatCopy();
}
//
myErrorStatus=11;
myErrorStatus = 11;
}
}
//=======================================================================
@@ -157,12 +144,12 @@ void BOPAlgo_CheckerSI::Perform()
void BOPAlgo_CheckerSI::PostTreat()
{
Standard_Integer i, aNb, n1, n2;
BOPDS_PassKey aPK;
BOPDS_Pair aPK;
//
myErrorStatus=0;
//
BOPDS_MapOfPassKey& aMPK=
*((BOPDS_MapOfPassKey*)&myDS->Interferences());
BOPDS_MapOfPair& aMPK=
*((BOPDS_MapOfPair*)&myDS->Interferences());
aMPK.Clear();
//
// 0
@@ -174,7 +161,7 @@ void BOPAlgo_CheckerSI::PostTreat()
if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
continue;
}
aPK.SetIds(n1, n2);
aPK.SetIndices(n1, n2);
aMPK.Add(aPK);
}
//
@@ -187,7 +174,7 @@ void BOPAlgo_CheckerSI::PostTreat()
if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
continue;
}
aPK.SetIds(n1, n2);
aPK.SetIndices(n1, n2);
aMPK.Add(aPK);
}
//
@@ -200,7 +187,7 @@ void BOPAlgo_CheckerSI::PostTreat()
if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
continue;
}
aPK.SetIds(n1, n2);
aPK.SetIndices(n1, n2);
aMPK.Add(aPK);
}
//
@@ -213,7 +200,7 @@ void BOPAlgo_CheckerSI::PostTreat()
if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
continue;
}
aPK.SetIds(n1, n2);
aPK.SetIndices(n1, n2);
aMPK.Add(aPK);
}
//
@@ -229,7 +216,7 @@ void BOPAlgo_CheckerSI::PostTreat()
if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
continue;
}
aPK.SetIds(n1, n2);
aPK.SetIndices(n1, n2);
aMPK.Add(aPK);
}
//
@@ -276,7 +263,7 @@ void BOPAlgo_CheckerSI::PostTreat()
continue;
}
//
aPK.SetIds(n1, n2);
aPK.SetIndices(n1, n2);
aMPK.Add(aPK);
}
//
@@ -291,7 +278,7 @@ void BOPAlgo_CheckerSI::PostTreat()
if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
continue;
}
aPK.SetIds(n1, n2);
aPK.SetIndices(n1, n2);
aMPK.Add(aPK);
}
//
@@ -302,7 +289,7 @@ void BOPAlgo_CheckerSI::PostTreat()
//
const BOPDS_InterfEZ& aEZ=aEZs(i);
aEZ.Indices(n1, n2);
aPK.SetIds(n1, n2);
aPK.SetIndices(n1, n2);
aMPK.Add(aPK);
}
//
@@ -313,7 +300,7 @@ void BOPAlgo_CheckerSI::PostTreat()
//
const BOPDS_InterfFZ& aFZ=aFZs(i);
aFZ.Indices(n1, n2);
aPK.SetIds(n1, n2);
aPK.SetIndices(n1, n2);
aMPK.Add(aPK);
}
//
@@ -324,76 +311,7 @@ void BOPAlgo_CheckerSI::PostTreat()
//
const BOPDS_InterfZZ& aZZ=aZZs(i);
aZZ.Indices(n1, n2);
aPK.SetIds(n1, n2);
aPK.SetIndices(n1, n2);
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

@@ -24,63 +24,71 @@
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
#include <BOPCol_DataMapOfShapeShape.hxx>
#include <BOPAlgo_PaveFiller.hxx>
//! Checks shape on self-interference.
//! Checks the shape on self-interference.<br>
//! In case of error the algorithm may return the following ErrorStatus:<br>
//! 10 - The number of the input arguments is not one;<br>
//! 11 - The check has been aborted during intersection of sub-shapes.<br>
//! In case the error has occurred during intersection of sub-shapes, i.e.
//! in BOPAlgo_PaveFiller::PerformInternal() method, the ErrorStatus from this method
//! directly will be returned.
class BOPAlgo_CheckerSI : public BOPAlgo_PaveFiller
{
public:
DEFINE_STANDARD_ALLOC
Standard_EXPORT BOPAlgo_CheckerSI();
Standard_EXPORT virtual ~BOPAlgo_CheckerSI();
Standard_EXPORT virtual ~BOPAlgo_CheckerSI();
Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
//! Sets the level of checking shape on self-interference.
//! It defines which interferferences will be checked:
//! 0 - only V/V;
//! 1 - V/V and V/E;
//! 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.
//! Sets the level of checking shape on self-interference.<br>
//! It defines which interferences will be checked:<br>
//! 0 - only V/V;<br>
//! 1 - V/V and V/E;<br>
//! 2 - V/V, V/E and E/E;<br>
//! 3 - V/V, V/E, E/E and V/F;<br>
//! 4 - V/V, V/E, E/E, V/F and E/F;<br>
//! 5 - V/V, V/E, E/E, V/F, E/F and F/F;<br>
//! 6 - V/V, V/E, E/E, V/F, E/F, F/F and V/S;<br>
//! 7 - V/V, V/E, E/E, V/F, E/F, F/F, V/S and E/S;<br>
//! 8 - V/V, V/E, E/E, V/F, E/F, F/F, V/S, E/S and F/S;<br>
//! 9 - V/V, V/E, E/E, V/F, E/F, F/F, V/S, E/S, F/S and S/S - all interferences (Default value)
Standard_EXPORT void SetLevelOfCheck (const Standard_Integer theLevel);
protected:
Standard_EXPORT virtual void Init() Standard_OVERRIDE;
//! Provides post-treatment actions
Standard_EXPORT void PostTreat();
Standard_EXPORT virtual void PrepareCopy();
//! Provides post-treatment actions for the copy
Standard_EXPORT void PostTreatCopy();
//! Treats the intersection results
Standard_EXPORT void PostTreat();
//! Methods for intersection with solids
//! Vertex/Solid intersection
Standard_EXPORT virtual void PerformVZ();
//! Edge/Solid intersection
Standard_EXPORT virtual void PerformEZ();
//! Face/Solid intersection
Standard_EXPORT virtual void PerformFZ();
//! Solid/Solid intersection
Standard_EXPORT virtual void PerformZZ();
//! Used for intersection of edges and faces with solids
Standard_EXPORT virtual void PerformSZ(const TopAbs_ShapeEnum aTS);
Standard_Integer myLevelOfCheck;
BOPCol_DataMapOfShapeShape myNewOldMap;
private:
};
#endif // _BOPAlgo_CheckerSI_HeaderFile

View File

@@ -0,0 +1,430 @@
// Created by: Peter KURNEV
// Copyright (c) 2010-2014 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
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BOPAlgo_CheckerSI.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_Interf.hxx>
#include <BOPDS_IteratorSI.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_Parallel.hxx>
#include <BRep_Tool.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
#include <IntTools_Context.hxx>
#include <gp_Pnt.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopAbs_State.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Solid.hxx>
/////////////////////////////////////////////////////////////////////////
//=======================================================================
//class : BOPAlgo_VertexSolid
//purpose :
//=======================================================================
class BOPAlgo_VertexSolid {
public:
DEFINE_STANDARD_ALLOC
BOPAlgo_VertexSolid()
: myIV(-1), myIZ(-1), myState(TopAbs_UNKNOWN) {
};
//
virtual ~BOPAlgo_VertexSolid(){
};
//
void SetIndices(const Standard_Integer nV,
const Standard_Integer nZ){
myIV=nV;
myIZ=nZ;
}
//
void Indices(Standard_Integer& nV,
Standard_Integer& nZ) const {
nV=myIV;
nZ=myIZ;
}
//
void SetVertex(const TopoDS_Vertex& aV) {
myV=aV;
}
//
const TopoDS_Vertex& Vertex()const {
return myV;
}
//
void SetSolid(const TopoDS_Solid& aZ) {
myZ=aZ;
}
//
const TopoDS_Solid& Solid()const {
return myZ;
}
//
void SetContext(const Handle(IntTools_Context)& aContext) {
myContext=aContext;
}
//
const Handle(IntTools_Context)& Context()const {
return myContext;
}
//
TopAbs_State State() const{
return myState;
};
//
void Perform() {
Standard_Real aTol;
gp_Pnt aPV;
//
BRepClass3d_SolidClassifier& aSC=myContext->SolidClassifier(myZ);
//
aPV=BRep_Tool::Pnt(myV);
aTol=BRep_Tool::Tolerance(myV);
//
aSC.Perform(aPV, aTol);
//
myState=aSC.State();
};
//
protected:
Standard_Integer myIV;
Standard_Integer myIZ;
TopAbs_State myState;
TopoDS_Vertex myV;
TopoDS_Solid myZ;
Handle(IntTools_Context) myContext;
};
//=======================================================================
typedef BOPCol_NCVector
<BOPAlgo_VertexSolid> BOPAlgo_VectorOfVertexSolid;
//
typedef BOPCol_ContextFunctor
<BOPAlgo_VertexSolid,
BOPAlgo_VectorOfVertexSolid,
Handle(IntTools_Context),
IntTools_Context> BOPAlgo_VertexSolidFunctor;
//
typedef BOPCol_ContextCnt
<BOPAlgo_VertexSolidFunctor,
BOPAlgo_VectorOfVertexSolid,
Handle(IntTools_Context)> BOPAlgo_VertexSolidCnt;
/////////////////////////////////////////////////////////////////////////
//=======================================================================
//class : BOPAlgo_ShapeSolid
//purpose :
//=======================================================================
class BOPAlgo_ShapeSolid {
public:
DEFINE_STANDARD_ALLOC
BOPAlgo_ShapeSolid() :
myIE(-1),
myIZ(-1),
myHasInterf(Standard_False),
myDS(NULL) {
};
//
virtual ~BOPAlgo_ShapeSolid(){
};
//
void SetIndices(const Standard_Integer nE,
const Standard_Integer nZ){
myIE=nE;
myIZ=nZ;
}
//
void Indices(Standard_Integer& nE,
Standard_Integer& nZ) const {
nE=myIE;
nZ=myIZ;
}
//
void SetDS(BOPDS_DS* pDS) {
myDS=pDS;
}
//
Standard_Boolean HasInterf() const{
return myHasInterf;
};
//
virtual void Perform() {
Standard_Boolean bHasInterf;
//
myHasInterf=Standard_False;
//
bHasInterf=myDS->HasInterfShapeSubShapes(myIE, myIZ);
if (!bHasInterf) {
myHasInterf=myDS->HasInterfShapeSubShapes(myIZ, myIE);
}
};
//
protected:
Standard_Integer myIE;
Standard_Integer myIZ;
Standard_Boolean myHasInterf;
BOPDS_DS* myDS;
};
//=======================================================================
typedef BOPCol_NCVector
<BOPAlgo_ShapeSolid> BOPAlgo_VectorOfShapeSolid;
//
typedef BOPCol_Functor
<BOPAlgo_ShapeSolid,
BOPAlgo_VectorOfShapeSolid> BOPAlgo_ShapeSolidFunctor;
//
typedef BOPCol_Cnt
<BOPAlgo_ShapeSolidFunctor,
BOPAlgo_VectorOfShapeSolid> BOPAlgo_ShapeSolidCnt;
//
/////////////////////////////////////////////////////////////////////////
//=======================================================================
//class : BOPAlgo_SolidSolid
//purpose :
//=======================================================================
class BOPAlgo_SolidSolid : public BOPAlgo_ShapeSolid {
public:
DEFINE_STANDARD_ALLOC
BOPAlgo_SolidSolid() :
BOPAlgo_ShapeSolid() {
};
//
virtual ~BOPAlgo_SolidSolid(){
};
//
virtual void Perform() {
Standard_Boolean bFlag;
//
bFlag=Standard_False;
myHasInterf=Standard_False;
//
myHasInterf=myDS->HasInterfShapeSubShapes(myIZ, myIE, bFlag);
if (!myHasInterf) {
myHasInterf=myDS->HasInterfShapeSubShapes(myIE, myIZ, bFlag);
}
};
};
//=======================================================================
typedef BOPCol_NCVector
<BOPAlgo_SolidSolid> BOPAlgo_VectorOfSolidSolid;
//
typedef BOPCol_Functor
<BOPAlgo_SolidSolid,
BOPAlgo_VectorOfSolidSolid> BOPAlgo_SolidSolidFunctor;
//
typedef BOPCol_Cnt
<BOPAlgo_SolidSolidFunctor,
BOPAlgo_VectorOfSolidSolid> BOPAlgo_SolidSolidCnt;
//
/////////////////////////////////////////////////////////////////////////
//=======================================================================
//function : PerformVZ
//purpose :
//=======================================================================
void BOPAlgo_CheckerSI::PerformVZ()
{
Standard_Integer iSize, nV, nZ, k, aNbVVS;
TopAbs_State aState;
BOPDS_MapOfPair aMPK;
//
myErrorStatus=0;
//
myIterator->Initialize(TopAbs_VERTEX, TopAbs_SOLID);
iSize=myIterator->ExpectedLength();
if (!iSize) {
return;
}
//
BOPDS_VectorOfInterfVZ& aVZs=myDS->InterfVZ();
aVZs.SetIncrement(iSize);
//
BOPAlgo_VectorOfVertexSolid aVVS;
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nV, nZ);
//
if (myDS->HasInterfShapeSubShapes(nV, nZ)) {
continue;
}
//
Standard_Integer nVSD = nV;
myDS->HasShapeSD(nV, nVSD);
//
BOPDS_Pair aPK;
aPK.SetIndices(nVSD, nZ);
if (!aMPK.Add(aPK)) {
continue;
}
//
const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&myDS->Shape(nVSD));
const TopoDS_Solid& aZ=*((TopoDS_Solid*)&myDS->Shape(nZ));
//
BOPAlgo_VertexSolid& aVertexSolid=aVVS.Append1();
aVertexSolid.SetIndices(nV, nZ);
aVertexSolid.SetVertex(aV);
aVertexSolid.SetSolid(aZ);
}
//
aNbVVS=aVVS.Extent();
//=============================================================
BOPAlgo_VertexSolidCnt::Perform(myRunParallel, aVVS, myContext);
//=============================================================
for (k=0; k < aNbVVS; ++k) {
const BOPAlgo_VertexSolid& aVertexSolid=aVVS(k);
aState=aVertexSolid.State();
if (aState==TopAbs_IN) {
aVertexSolid.Indices(nV, nZ);
//
BOPDS_InterfVZ& aVZ=aVZs.Append1();
aVZ.SetIndices(nV, nZ);
//
myDS->AddInterf(nV, nZ);
}
}
}
//=======================================================================
//function : PerformEZ
//purpose :
//=======================================================================
void BOPAlgo_CheckerSI::PerformEZ()
{
PerformSZ(TopAbs_EDGE);
}
//=======================================================================
//function : PerformFZ
//purpose :
//=======================================================================
void BOPAlgo_CheckerSI::PerformFZ()
{
PerformSZ(TopAbs_FACE);
}
//=======================================================================
//function : PerformZZ
//purpose :
//=======================================================================
void BOPAlgo_CheckerSI::PerformZZ()
{
Standard_Boolean bHasInterf;
Standard_Integer iSize, nZ1, nZ, k, aNbSolidSolid;
//
myErrorStatus=0;
//
myIterator->Initialize(TopAbs_SOLID, TopAbs_SOLID);
iSize=myIterator->ExpectedLength();
if (!iSize) {
return;
}
//
BOPAlgo_VectorOfSolidSolid aVSolidSolid;
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nZ1, nZ);
//
BOPAlgo_SolidSolid& aSolidSolid=aVSolidSolid.Append1();
aSolidSolid.SetIndices(nZ1, nZ);
aSolidSolid.SetDS(myDS);
}
//
aNbSolidSolid=aVSolidSolid.Extent();
//======================================================
BOPAlgo_SolidSolidCnt::Perform(myRunParallel, aVSolidSolid);
//======================================================
//
BOPDS_VectorOfInterfZZ& aZZs=myDS->InterfZZ();
//
aZZs.SetIncrement(iSize);
//
for (k=0; k < aNbSolidSolid; ++k) {
const BOPAlgo_SolidSolid& aSolidSolid=aVSolidSolid(k);
bHasInterf=aSolidSolid.HasInterf();
if (bHasInterf) {
aSolidSolid.Indices(nZ1, nZ);
//
BOPDS_InterfZZ& aZZ=aZZs.Append1();
aZZ.SetIndices(nZ1, nZ);
//
myDS->AddInterf(nZ1, nZ);
}
}
}
//=======================================================================
//function : PerformSZ
//purpose :
//=======================================================================
void BOPAlgo_CheckerSI::PerformSZ(const TopAbs_ShapeEnum aTS)
{
Standard_Boolean bHasInterf;
Standard_Integer iSize, nS, nZ, k, aNbShapeSolid;
//
myErrorStatus=0;
//
myIterator->Initialize(aTS, TopAbs_SOLID);
iSize=myIterator->ExpectedLength();
if (!iSize) {
return;
}
//
BOPAlgo_VectorOfShapeSolid aVShapeSolid;
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nS, nZ);
//
BOPAlgo_ShapeSolid& aShapeSolid=aVShapeSolid.Append1();
aShapeSolid.SetIndices(nS, nZ);
aShapeSolid.SetDS(myDS);
}
//
aNbShapeSolid=aVShapeSolid.Extent();
//======================================================
BOPAlgo_ShapeSolidCnt::Perform(myRunParallel, aVShapeSolid);
//======================================================
//
BOPDS_VectorOfInterfEZ& aEZs=myDS->InterfEZ();
BOPDS_VectorOfInterfFZ& aFZs=myDS->InterfFZ();
//
if (aTS==TopAbs_EDGE) {
aEZs.SetIncrement(iSize);
}
else {//if (aTS==TopAbs_FACE)
aFZs.SetIncrement(iSize);
}
//
for (k=0; k < aNbShapeSolid; ++k) {
const BOPAlgo_ShapeSolid& aShapeSolid=aVShapeSolid(k);
bHasInterf=aShapeSolid.HasInterf();
if (bHasInterf) {
aShapeSolid.Indices(nS, nZ);
//
if (aTS==TopAbs_EDGE) {
BOPDS_InterfEZ& aEZ=aEZs.Append1();
aEZ.SetIndices(nS, nZ);
}
else {//if (aTS==TopAbs_FACE)
BOPDS_InterfFZ& aFZ=aFZs.Append1();
aFZ.SetIndices(nS, nZ);
}
//
myDS->AddInterf(nS, nZ);
}
}
}

View File

@@ -315,28 +315,4 @@ void BOPAlgo_PaveFiller::PerformInternal()
if (myErrorStatus) {
return;
}
//
if (myGlue != BOPAlgo_GlueOff) {
return;
}
// 03
PerformVZ();
if (myErrorStatus) {
return;
}
// 13
PerformEZ();
if (myErrorStatus) {
return;
}
// 23
PerformFZ();
if (myErrorStatus) {
return;
}
// 33
PerformZZ();
if (myErrorStatus) {
return;
}
}
}

View File

@@ -156,16 +156,6 @@ protected:
Standard_EXPORT virtual void PerformFF();
Standard_EXPORT virtual void PerformVZ();
Standard_EXPORT virtual void PerformEZ();
Standard_EXPORT virtual void PerformFZ();
Standard_EXPORT virtual void PerformZZ();
Standard_EXPORT virtual void PerformSZ(const TopAbs_ShapeEnum aTS);
Standard_EXPORT void TreatVerticesEE();
Standard_EXPORT void MakeSDVerticesFF(const BOPCol_DataMapOfIntegerListOfInteger& aDMVLV,

View File

@@ -48,7 +48,6 @@
//=======================================================================
void BOPAlgo_PaveFiller::PerformVV()
{
Standard_Boolean bWithSubShape;
Standard_Integer n1, n2, iFlag, aSize, k, aNbBlocks;
Handle(NCollection_BaseAllocator) aAllocator;
//
@@ -71,7 +70,7 @@ void BOPAlgo_PaveFiller::PerformVV()
//
// 1. Map V/LV
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(n1, n2, bWithSubShape);
myIterator->Value(n1, n2);
//
const TopoDS_Vertex& aV1=(*(TopoDS_Vertex *)(&myDS->Shape(n1)));
const TopoDS_Vertex& aV2=(*(TopoDS_Vertex *)(&myDS->Shape(n2)));

View File

@@ -16,422 +16,255 @@
// commercial license or contractual agreement.
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_SectionAttribute.hxx>
#include <BOPDS_Curve.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_Interf.hxx>
#include <BOPDS_IteratorSI.hxx>
#include <BOPDS_PaveBlock.hxx>
#include <BRep_Tool.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
#include <IntTools_Context.hxx>
#include <TopoDS_Vertex.hxx>
#include <Precision.hxx>
#include <gp_Pnt.hxx>
#include <BOPCol_NCVector.hxx>
#include <TopAbs_State.hxx>
#include <BOPCol_Parallel.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Solid.hxx>
/////////////////////////////////////////////////////////////////////////
#include <Bnd_Box.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Edge.hxx>
#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
#include <BRepBndLib.hxx>
#include <BOPDS_ShapeInfo.hxx>
#include <BOPDS_VectorOfListOfPaveBlock.hxx>
#include <BOPDS_MapOfCommonBlock.hxx>
#include <BOPDS_ListOfPaveBlock.hxx>
#include <BOPDS_CommonBlock.hxx>
#include <BOPDS_DS.hxx>
//=======================================================================
//class : BOPAlgo_VertexSolid
//function : SetNonDestructive
//purpose :
//=======================================================================
class BOPAlgo_VertexSolid {
public:
DEFINE_STANDARD_ALLOC
void BOPAlgo_PaveFiller::SetNonDestructive()
{
if (!myIsPrimary || myNonDestructive) {
return;
}
//
Standard_Boolean bFlag;
BOPCol_ListIteratorOfListOfShape aItLS;
//
bFlag=Standard_False;
aItLS.Initialize(myArguments);
for(; aItLS.More() && (!bFlag); aItLS.Next()) {
const TopoDS_Shape& aS=aItLS.Value();
bFlag=aS.Locked();
}
myNonDestructive=bFlag;
}
//=======================================================================
//function : UpdateEdgeTolerance
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::UpdateEdgeTolerance (const Standard_Integer nE,
const Standard_Real aTol)
{
Standard_Boolean bIsNewShape, bHasShapeSD;
Standard_Integer nV, nVx;
Standard_Real aTolV;
BRep_Builder aBB;
BOPCol_ListIteratorOfListOfInteger aIt;
//
BOPDS_ShapeInfo& aSIE=myDS->ChangeShapeInfo(nE);
const BOPCol_ListOfInteger& aLI=aSIE.SubShapes();
//
if (myNonDestructive) {
bIsNewShape=myDS->IsNewShape(nE);
if (!bIsNewShape) {
return;
}
//
aIt.Initialize(aLI);
for (; aIt.More(); aIt.Next()) {
nV = aIt.Value();
bHasShapeSD=myDS->HasShapeSD(nV, nVx);
if (bHasShapeSD) {
continue;
}
bIsNewShape=myDS->IsNewShape(nV);
if (!bIsNewShape) {
return;
}
}
}
//
const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(nE);
aBB.UpdateEdge(aE, aTol);
Bnd_Box& aBoxE=aSIE.ChangeBox();
BRepBndLib::Add(aE, aBoxE);
aBoxE.SetGap(aBoxE.GetGap() + Precision::Confusion());
//
aIt.Initialize(aLI);
for (; aIt.More(); aIt.Next()) {
nV = aIt.Value();
bHasShapeSD=myDS->HasShapeSD(nV, nVx);
if (bHasShapeSD) {
nV=nVx;
}
const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV);
aTolV = BRep_Tool::Tolerance(aV);
if (aTolV < aTol) {
aBB.UpdateVertex(aV, aTol);
BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nV);
Bnd_Box& aBoxV = aSIV.ChangeBox();
BRepBndLib::Add(aV, aBoxV);
aBoxV.SetGap(aBoxV.GetGap() + Precision::Confusion());
}
}
}
//=======================================================================
//function : UpdateVertex
//purpose :
//=======================================================================
Standard_Integer BOPAlgo_PaveFiller::UpdateVertex
(const Standard_Integer nV,
const Standard_Real aTolNew)
{
Standard_Integer nVNew;
Standard_Real aTolV;
BRep_Builder aBB;
BOPAlgo_VertexSolid()
: myIV(-1), myIZ(-1), myState(TopAbs_UNKNOWN) {
};
//
virtual ~BOPAlgo_VertexSolid(){
};
//
void SetIndices(const Standard_Integer nV,
const Standard_Integer nZ){
myIV=nV;
myIZ=nZ;
}
//
void Indices(Standard_Integer& nV,
Standard_Integer& nZ) const {
nV=myIV;
nZ=myIZ;
}
//
void SetVertex(const TopoDS_Vertex& aV) {
myV=aV;
}
//
const TopoDS_Vertex& Vertex()const {
return myV;
}
//
void SetSolid(const TopoDS_Solid& aZ) {
myZ=aZ;
}
//
const TopoDS_Solid& Solid()const {
return myZ;
}
//
void SetContext(const Handle(IntTools_Context)& aContext) {
myContext=aContext;
}
//
const Handle(IntTools_Context)& Context()const {
return myContext;
}
//
TopAbs_State State() const{
return myState;
};
//
void Perform() {
Standard_Real aTol;
gp_Pnt aPV;
//
BRepClass3d_SolidClassifier& aSC=myContext->SolidClassifier(myZ);
//
aPV=BRep_Tool::Pnt(myV);
aTol=BRep_Tool::Tolerance(myV);
//
aSC.Perform(aPV, aTol);
//
myState=aSC.State();
};
//
protected:
Standard_Integer myIV;
Standard_Integer myIZ;
TopAbs_State myState;
TopoDS_Vertex myV;
TopoDS_Solid myZ;
Handle(IntTools_Context) myContext;
};
//=======================================================================
typedef BOPCol_NCVector
<BOPAlgo_VertexSolid> BOPAlgo_VectorOfVertexSolid;
//
typedef BOPCol_ContextFunctor
<BOPAlgo_VertexSolid,
BOPAlgo_VectorOfVertexSolid,
Handle(IntTools_Context),
IntTools_Context> BOPAlgo_VertexSolidFunctor;
//
typedef BOPCol_ContextCnt
<BOPAlgo_VertexSolidFunctor,
BOPAlgo_VectorOfVertexSolid,
Handle(IntTools_Context)> BOPAlgo_VertexSolidCnt;
/////////////////////////////////////////////////////////////////////////
//=======================================================================
//class : BOPAlgo_ShapeSolid
//purpose :
//=======================================================================
class BOPAlgo_ShapeSolid {
public:
DEFINE_STANDARD_ALLOC
BOPAlgo_ShapeSolid() :
myIE(-1),
myIZ(-1),
myHasInterf(Standard_False),
myDS(NULL) {
};
//
virtual ~BOPAlgo_ShapeSolid(){
};
//
void SetIndices(const Standard_Integer nE,
const Standard_Integer nZ){
myIE=nE;
myIZ=nZ;
}
//
void Indices(Standard_Integer& nE,
Standard_Integer& nZ) const {
nE=myIE;
nZ=myIZ;
}
//
void SetDS(BOPDS_DS* pDS) {
myDS=pDS;
}
//
Standard_Boolean HasInterf() const{
return myHasInterf;
};
//
virtual void Perform() {
Standard_Boolean bHasInterf;
//
myHasInterf=Standard_False;
//
bHasInterf=myDS->HasInterfShapeSubShapes(myIE, myIZ);
if (!bHasInterf) {
myHasInterf=myDS->HasInterfShapeSubShapes(myIZ, myIE);
nVNew = nV;
if (myDS->IsNewShape(nVNew) ||
myDS->HasShapeSD(nV, nVNew) ||
!myNonDestructive) {
// nV is a new vertex, it has SD or non-destructive mode is not in force
const TopoDS_Vertex& aVSD = *(TopoDS_Vertex*)&myDS->Shape(nVNew);
aTolV = BRep_Tool::Tolerance(aVSD);
if (aTolV < aTolNew) {
aBB.UpdateVertex(aVSD, aTolNew);
BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nVNew);
Bnd_Box& aBoxV = aSIV.ChangeBox();
BRepBndLib::Add(aVSD, aBoxV);
aBoxV.SetGap(aBoxV.GetGap() + Precision::Confusion());
}
};
return nVNew;
}
//
protected:
Standard_Integer myIE;
Standard_Integer myIZ;
Standard_Boolean myHasInterf;
BOPDS_DS* myDS;
};
// nV is old vertex
const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV);
aTolV = BRep_Tool::Tolerance(aV);
//
// create new vertex
TopoDS_Vertex aVNew;
gp_Pnt aPV = BRep_Tool::Pnt(aV);
aBB.MakeVertex(aVNew, aPV, Max(aTolV, aTolNew));
//
// append new vertex to DS
BOPDS_ShapeInfo aSIV;
aSIV.SetShapeType(TopAbs_VERTEX);
aSIV.SetShape(aVNew);
nVNew = myDS->Append(aSIV);
//
// bounding box for the new vertex
BOPDS_ShapeInfo& aSIDS = myDS->ChangeShapeInfo(nVNew);
Bnd_Box& aBoxDS = aSIDS.ChangeBox();
BRepBndLib::Add(aVNew, aBoxDS);
aBoxDS.SetGap(aBoxDS.GetGap() + Precision::Confusion());
//
// add vertex to SD map
myDS->AddShapeSD(nV, nVNew);
//
myDS->InitPaveBlocksForVertex(nV);
//
return nVNew;
}
//=======================================================================
typedef BOPCol_NCVector
<BOPAlgo_ShapeSolid> BOPAlgo_VectorOfShapeSolid;
//
typedef BOPCol_Functor
<BOPAlgo_ShapeSolid,
BOPAlgo_VectorOfShapeSolid> BOPAlgo_ShapeSolidFunctor;
//
typedef BOPCol_Cnt
<BOPAlgo_ShapeSolidFunctor,
BOPAlgo_VectorOfShapeSolid> BOPAlgo_ShapeSolidCnt;
//
/////////////////////////////////////////////////////////////////////////
//=======================================================================
//class : BOPAlgo_SolidSolid
//function : UpdatePaveBlocksWithSDVertices
//purpose :
//=======================================================================
class BOPAlgo_SolidSolid : public BOPAlgo_ShapeSolid {
public:
DEFINE_STANDARD_ALLOC
BOPAlgo_SolidSolid() :
BOPAlgo_ShapeSolid() {
};
//
virtual ~BOPAlgo_SolidSolid(){
};
//
virtual void Perform() {
Standard_Boolean bFlag;
//
bFlag=Standard_False;
myHasInterf=Standard_False;
//
myHasInterf=myDS->HasInterfShapeSubShapes(myIZ, myIE, bFlag);
if (!myHasInterf) {
myHasInterf=myDS->HasInterfShapeSubShapes(myIE, myIZ, bFlag);
}
};
};
//=======================================================================
typedef BOPCol_NCVector
<BOPAlgo_SolidSolid> BOPAlgo_VectorOfSolidSolid;
//
typedef BOPCol_Functor
<BOPAlgo_SolidSolid,
BOPAlgo_VectorOfSolidSolid> BOPAlgo_SolidSolidFunctor;
//
typedef BOPCol_Cnt
<BOPAlgo_SolidSolidFunctor,
BOPAlgo_VectorOfSolidSolid> BOPAlgo_SolidSolidCnt;
//
/////////////////////////////////////////////////////////////////////////
//=======================================================================
//function : PerformVZ
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::PerformVZ()
void BOPAlgo_PaveFiller::UpdatePaveBlocksWithSDVertices()
{
Standard_Boolean bJustAdd;
Standard_Integer iSize, nV, nZ, k, aNbVVS;
TopAbs_State aState;
BOPDS_MapOfPassKey aMPK;
//
myErrorStatus=0;
//
myIterator->Initialize(TopAbs_VERTEX, TopAbs_SOLID);
iSize=myIterator->ExpectedLength();
if (!iSize) {
return;
}
//
BOPDS_VectorOfInterfVZ& aVZs=myDS->InterfVZ();
aVZs.SetIncrement(iSize);
//
BOPAlgo_VectorOfVertexSolid aVVS;
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nV, nZ, bJustAdd);
if(bJustAdd) {
continue;
}
//
if (myDS->HasInterfShapeSubShapes(nV, nZ)) {
continue;
}
//
Standard_Integer nVSD = nV;
myDS->HasShapeSD(nV, nVSD);
//
BOPDS_PassKey aPK;
aPK.SetIds(nVSD, nZ);
if (!aMPK.Add(aPK)) {
continue;
}
//
const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&myDS->Shape(nVSD));
const TopoDS_Solid& aZ=*((TopoDS_Solid*)&myDS->Shape(nZ));
//
BOPAlgo_VertexSolid& aVertexSolid=aVVS.Append1();
aVertexSolid.SetIndices(nV, nZ);
aVertexSolid.SetVertex(aV);
aVertexSolid.SetSolid(aZ);
}
//
aNbVVS=aVVS.Extent();
//=============================================================
BOPAlgo_VertexSolidCnt::Perform(myRunParallel, aVVS, myContext);
//=============================================================
for (k=0; k < aNbVVS; ++k) {
const BOPAlgo_VertexSolid& aVertexSolid=aVVS(k);
aState=aVertexSolid.State();
if (aState==TopAbs_IN) {
aVertexSolid.Indices(nV, nZ);
//
BOPDS_InterfVZ& aVZ=aVZs.Append1();
aVZ.SetIndices(nV, nZ);
//
myDS->AddInterf(nV, nZ);
}
}
myDS->UpdatePaveBlocksWithSDVertices();
}
//=======================================================================
//function : PerformEZ
//function : UpdateCommonBlocksWithSDVertices
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::PerformEZ()
{
PerformSZ(TopAbs_EDGE);
}
//=======================================================================
//function : PerformFZ
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::PerformFZ()
{
PerformSZ(TopAbs_FACE);
}
//=======================================================================
//function : PerformZZ
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::PerformZZ()
void BOPAlgo_PaveFiller::UpdateCommonBlocksWithSDVertices()
{
Standard_Boolean bJustAdd, bHasInterf;
Standard_Integer iSize, nZ1, nZ, k, aNbSolidSolid;
if (!myNonDestructive) {
UpdatePaveBlocksWithSDVertices();
return;
}
Standard_Integer aNbPBP;
//
myErrorStatus=0;
//
myIterator->Initialize(TopAbs_SOLID, TopAbs_SOLID);
iSize=myIterator->ExpectedLength();
if (!iSize) {
return;
BOPDS_VectorOfListOfPaveBlock& aPBP=myDS->ChangePaveBlocksPool();
aNbPBP=aPBP.Extent();
if(!aNbPBP) {
return;
}
//
BOPAlgo_VectorOfSolidSolid aVSolidSolid;
Standard_Integer i, nV1, nV2;
Standard_Real aTolV;
BOPDS_MapOfCommonBlock aMCB;
BOPDS_ListIteratorOfListOfPaveBlock aItPB;
Handle(BOPDS_PaveBlock) aPB;
//
aTolV = Precision::Confusion();
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nZ1, nZ, bJustAdd);
if(bJustAdd) {
continue;
}
//
BOPAlgo_SolidSolid& aSolidSolid=aVSolidSolid.Append1();
aSolidSolid.SetIndices(nZ1, nZ);
aSolidSolid.SetDS(myDS);
}
//
aNbSolidSolid=aVSolidSolid.Extent();
//======================================================
BOPAlgo_SolidSolidCnt::Perform(myRunParallel, aVSolidSolid);
//======================================================
//
BOPDS_VectorOfInterfZZ& aZZs=myDS->InterfZZ();
//
aZZs.SetIncrement(iSize);
//
for (k=0; k < aNbSolidSolid; ++k) {
const BOPAlgo_SolidSolid& aSolidSolid=aVSolidSolid(k);
bHasInterf=aSolidSolid.HasInterf();
if (bHasInterf) {
aSolidSolid.Indices(nZ1, nZ);
//
BOPDS_InterfZZ& aZZ=aZZs.Append1();
aZZ.SetIndices(nZ1, nZ);
//
myDS->AddInterf(nZ1, nZ);
}
}
}
//=======================================================================
//function : PerformSZ
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::PerformSZ(const TopAbs_ShapeEnum aTS)
{
Standard_Boolean bJustAdd, bHasInterf;
Standard_Integer iSize, nS, nZ, k, aNbShapeSolid;
//
myErrorStatus=0;
//
myIterator->Initialize(aTS, TopAbs_SOLID);
iSize=myIterator->ExpectedLength();
if (!iSize) {
return;
}
//
BOPAlgo_VectorOfShapeSolid aVShapeSolid;
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nS, nZ, bJustAdd);
if(bJustAdd) {
continue;
}
//
BOPAlgo_ShapeSolid& aShapeSolid=aVShapeSolid.Append1();
aShapeSolid.SetIndices(nS, nZ);
aShapeSolid.SetDS(myDS);
}
//
aNbShapeSolid=aVShapeSolid.Extent();
//======================================================
BOPAlgo_ShapeSolidCnt::Perform(myRunParallel, aVShapeSolid);
//======================================================
//
BOPDS_VectorOfInterfEZ& aEZs=myDS->InterfEZ();
BOPDS_VectorOfInterfFZ& aFZs=myDS->InterfFZ();
//
if (aTS==TopAbs_EDGE) {
aEZs.SetIncrement(iSize);
}
else {//if (aTS==TopAbs_FACE)
aFZs.SetIncrement(iSize);
}
//
for (k=0; k < aNbShapeSolid; ++k) {
const BOPAlgo_ShapeSolid& aShapeSolid=aVShapeSolid(k);
bHasInterf=aShapeSolid.HasInterf();
if (bHasInterf) {
aShapeSolid.Indices(nS, nZ);
//
if (aTS==TopAbs_EDGE) {
BOPDS_InterfEZ& aEZ=aEZs.Append1();
aEZ.SetIndices(nS, nZ);
}
else {//if (aTS==TopAbs_FACE)
BOPDS_InterfFZ& aFZ=aFZs.Append1();
aFZ.SetIndices(nS, nZ);
for (i=0; i<aNbPBP; ++i) {
BOPDS_ListOfPaveBlock& aLPB=aPBP(i);
aItPB.Initialize(aLPB);
for (; aItPB.More(); aItPB.Next()) {
aPB=aItPB.Value();
const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB);
if (aCB.IsNull()) {
continue;
}
//
myDS->AddInterf(nS, nZ);
if (aMCB.Add(aCB)) {
myDS->SortPaveBlocks(aCB);
aPB->Indices(nV1, nV2);
UpdateVertex(nV1, aTolV);
UpdateVertex(nV2, aTolV);
myDS->UpdateCommonBlockWithSDVertices(aCB);
}
}
}
UpdatePaveBlocksWithSDVertices();
}
namespace
{
//=======================================================================
//function : UpdateInterfsWithSDVertices
//purpose :
//=======================================================================
template <class InterfType>
void UpdateIntfsWithSDVertices(BOPDS_PDS theDS, BOPCol_NCVector<InterfType>& theInterfs)
{
for (Standard_Integer i = 0; i < theInterfs.Length(); i++)
{
InterfType& anIntf = theInterfs(i);
Standard_Integer anInd;
if (anIntf.HasIndexNew(anInd))
{
Standard_Integer anIndSD;
if (theDS->HasShapeSD(anInd, anIndSD))
{
anIntf.SetIndexNew(anIndSD);
}
}
}
}
}
//=======================================================================
//function : UpdateInterfsWithSDVertices
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::UpdateInterfsWithSDVertices()
{
UpdateIntfsWithSDVertices(myDS, myDS->InterfVV());
UpdateIntfsWithSDVertices(myDS, myDS->InterfVE());
UpdateIntfsWithSDVertices(myDS, myDS->InterfVF());
UpdateIntfsWithSDVertices(myDS, myDS->InterfEE());
UpdateIntfsWithSDVertices(myDS, myDS->InterfEF());
}

View File

@@ -1,270 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 2010-2014 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
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BOPAlgo_PaveFiller.hxx>
#include <Precision.hxx>
#include <gp_Pnt.hxx>
#include <Bnd_Box.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Edge.hxx>
#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
#include <BRepBndLib.hxx>
#include <BOPDS_ShapeInfo.hxx>
#include <BOPDS_VectorOfListOfPaveBlock.hxx>
#include <BOPDS_MapOfCommonBlock.hxx>
#include <BOPDS_ListOfPaveBlock.hxx>
#include <BOPDS_CommonBlock.hxx>
#include <BOPDS_DS.hxx>
//=======================================================================
//function : SetNonDestructive
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::SetNonDestructive()
{
if (!myIsPrimary || myNonDestructive) {
return;
}
//
Standard_Boolean bFlag;
BOPCol_ListIteratorOfListOfShape aItLS;
//
bFlag=Standard_False;
aItLS.Initialize(myArguments);
for(; aItLS.More() && (!bFlag); aItLS.Next()) {
const TopoDS_Shape& aS=aItLS.Value();
bFlag=aS.Locked();
}
myNonDestructive=bFlag;
}
//=======================================================================
//function : UpdateEdgeTolerance
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::UpdateEdgeTolerance (const Standard_Integer nE,
const Standard_Real aTol)
{
Standard_Boolean bIsNewShape, bHasShapeSD;
Standard_Integer nV, nVx;
Standard_Real aTolV;
BRep_Builder aBB;
BOPCol_ListIteratorOfListOfInteger aIt;
//
BOPDS_ShapeInfo& aSIE=myDS->ChangeShapeInfo(nE);
const BOPCol_ListOfInteger& aLI=aSIE.SubShapes();
//
if (myNonDestructive) {
bIsNewShape=myDS->IsNewShape(nE);
if (!bIsNewShape) {
return;
}
//
aIt.Initialize(aLI);
for (; aIt.More(); aIt.Next()) {
nV = aIt.Value();
bHasShapeSD=myDS->HasShapeSD(nV, nVx);
if (bHasShapeSD) {
continue;
}
bIsNewShape=myDS->IsNewShape(nV);
if (!bIsNewShape) {
return;
}
}
}
//
const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(nE);
aBB.UpdateEdge(aE, aTol);
Bnd_Box& aBoxE=aSIE.ChangeBox();
BRepBndLib::Add(aE, aBoxE);
aBoxE.SetGap(aBoxE.GetGap() + Precision::Confusion());
//
aIt.Initialize(aLI);
for (; aIt.More(); aIt.Next()) {
nV = aIt.Value();
bHasShapeSD=myDS->HasShapeSD(nV, nVx);
if (bHasShapeSD) {
nV=nVx;
}
const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV);
aTolV = BRep_Tool::Tolerance(aV);
if (aTolV < aTol) {
aBB.UpdateVertex(aV, aTol);
BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nV);
Bnd_Box& aBoxV = aSIV.ChangeBox();
BRepBndLib::Add(aV, aBoxV);
aBoxV.SetGap(aBoxV.GetGap() + Precision::Confusion());
}
}
}
//=======================================================================
//function : UpdateVertex
//purpose :
//=======================================================================
Standard_Integer BOPAlgo_PaveFiller::UpdateVertex
(const Standard_Integer nV,
const Standard_Real aTolNew)
{
Standard_Integer nVNew;
Standard_Real aTolV;
BRep_Builder aBB;
nVNew = nV;
if (myDS->IsNewShape(nVNew) ||
myDS->HasShapeSD(nV, nVNew) ||
!myNonDestructive) {
// nV is a new vertex, it has SD or non-destructive mode is not in force
const TopoDS_Vertex& aVSD = *(TopoDS_Vertex*)&myDS->Shape(nVNew);
aTolV = BRep_Tool::Tolerance(aVSD);
if (aTolV < aTolNew) {
aBB.UpdateVertex(aVSD, aTolNew);
BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nVNew);
Bnd_Box& aBoxV = aSIV.ChangeBox();
BRepBndLib::Add(aVSD, aBoxV);
aBoxV.SetGap(aBoxV.GetGap() + Precision::Confusion());
}
return nVNew;
}
//
// nV is old vertex
const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV);
aTolV = BRep_Tool::Tolerance(aV);
//
// create new vertex
TopoDS_Vertex aVNew;
gp_Pnt aPV = BRep_Tool::Pnt(aV);
aBB.MakeVertex(aVNew, aPV, Max(aTolV, aTolNew));
//
// append new vertex to DS
BOPDS_ShapeInfo aSIV;
aSIV.SetShapeType(TopAbs_VERTEX);
aSIV.SetShape(aVNew);
nVNew = myDS->Append(aSIV);
//
// bounding box for the new vertex
BOPDS_ShapeInfo& aSIDS = myDS->ChangeShapeInfo(nVNew);
Bnd_Box& aBoxDS = aSIDS.ChangeBox();
BRepBndLib::Add(aVNew, aBoxDS);
aBoxDS.SetGap(aBoxDS.GetGap() + Precision::Confusion());
//
// add vertex to SD map
myDS->AddShapeSD(nV, nVNew);
//
myDS->InitPaveBlocksForVertex(nV);
//
return nVNew;
}
//=======================================================================
//function : UpdatePaveBlocksWithSDVertices
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::UpdatePaveBlocksWithSDVertices()
{
myDS->UpdatePaveBlocksWithSDVertices();
}
//=======================================================================
//function : UpdateCommonBlocksWithSDVertices
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::UpdateCommonBlocksWithSDVertices()
{
if (!myNonDestructive) {
UpdatePaveBlocksWithSDVertices();
return;
}
Standard_Integer aNbPBP;
//
BOPDS_VectorOfListOfPaveBlock& aPBP=myDS->ChangePaveBlocksPool();
aNbPBP=aPBP.Extent();
if(!aNbPBP) {
return;
}
//
Standard_Integer i, nV1, nV2;
Standard_Real aTolV;
BOPDS_MapOfCommonBlock aMCB;
BOPDS_ListIteratorOfListOfPaveBlock aItPB;
Handle(BOPDS_PaveBlock) aPB;
//
aTolV = Precision::Confusion();
//
for (i=0; i<aNbPBP; ++i) {
BOPDS_ListOfPaveBlock& aLPB=aPBP(i);
aItPB.Initialize(aLPB);
for (; aItPB.More(); aItPB.Next()) {
aPB=aItPB.Value();
const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB);
if (aCB.IsNull()) {
continue;
}
//
if (aMCB.Add(aCB)) {
myDS->SortPaveBlocks(aCB);
aPB->Indices(nV1, nV2);
UpdateVertex(nV1, aTolV);
UpdateVertex(nV2, aTolV);
myDS->UpdateCommonBlockWithSDVertices(aCB);
}
}
}
UpdatePaveBlocksWithSDVertices();
}
namespace
{
//=======================================================================
//function : UpdateInterfsWithSDVertices
//purpose :
//=======================================================================
template <class InterfType>
void UpdateIntfsWithSDVertices(BOPDS_PDS theDS, BOPCol_NCVector<InterfType>& theInterfs)
{
for (Standard_Integer i = 0; i < theInterfs.Length(); i++)
{
InterfType& anIntf = theInterfs(i);
Standard_Integer anInd;
if (anIntf.HasIndexNew(anInd))
{
Standard_Integer anIndSD;
if (theDS->HasShapeSD(anInd, anIndSD))
{
anIntf.SetIndexNew(anIndSD);
}
}
}
}
}
//=======================================================================
//function : UpdateInterfsWithSDVertices
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::UpdateInterfsWithSDVertices()
{
UpdateIntfsWithSDVertices(myDS, myDS->InterfVV());
UpdateIntfsWithSDVertices(myDS, myDS->InterfVE());
UpdateIntfsWithSDVertices(myDS, myDS->InterfVF());
UpdateIntfsWithSDVertices(myDS, myDS->InterfEE());
UpdateIntfsWithSDVertices(myDS, myDS->InterfEF());
}

View File

@@ -24,8 +24,8 @@
#include <BOPDS_DS.hxx>
#include <BOPDS_Interf.hxx>
#include <BOPDS_Iterator.hxx>
#include <BOPDS_MapOfPassKey.hxx>
#include <BOPDS_PassKey.hxx>
#include <BOPDS_MapOfPair.hxx>
#include <BOPDS_Pair.hxx>
#include <BOPDS_PaveBlock.hxx>
#include <BOPDS_VectorOfInterfVE.hxx>
#include <BOPTools_AlgoTools.hxx>
@@ -141,12 +141,11 @@ typedef BOPCol_ContextCnt
//=======================================================================
void BOPAlgo_PaveFiller::PerformVE()
{
Standard_Boolean bJustAdd;
Standard_Integer iSize, nV, nE, nVSD, iFlag, nVx, k, aNbVE;
Standard_Real aT, aT1, aT2, aTS1, aTS2;
BOPDS_Pave aPave;
BOPDS_PassKey aPK;
BOPDS_MapOfPassKey aMPK;
BOPDS_Pair aPK;
BOPDS_MapOfPair aMPK;
BOPAlgo_VectorOfVertexEdge aVVE;
//
myErrorStatus=0;
@@ -163,10 +162,7 @@ void BOPAlgo_PaveFiller::PerformVE()
aVEs.SetIncrement(iSize);
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nV, nE, bJustAdd);
if(bJustAdd) {
continue;
}
myIterator->Value(nV, nE);
//
const BOPDS_ShapeInfo& aSIE=myDS->ShapeInfo(nE);
if (aSIE.HasSubShape(nV)) {
@@ -187,7 +183,7 @@ void BOPAlgo_PaveFiller::PerformVE()
nVx=nVSD;
}
//
aPK.SetIds(nVx, nE);
aPK.SetIndices(nVx, nE);
if (!aMPK.Add(aPK)) {
continue;
}

View File

@@ -327,7 +327,7 @@ void BOPAlgo_PaveFiller::PerformEE()
return;
}
//
Standard_Boolean bJustAdd, bExpressCompute, bIsPBSplittable1, bIsPBSplittable2;
Standard_Boolean bExpressCompute, bIsPBSplittable1, bIsPBSplittable2;
Standard_Integer i, iX, nE1, nE2, aNbCPrts, k, aNbEdgeEdge;
Standard_Integer nV11, nV12, nV21, nV22;
Standard_Real aTS11, aTS12, aTS21, aTS22, aT11, aT12, aT21, aT22;
@@ -348,10 +348,7 @@ void BOPAlgo_PaveFiller::PerformEE()
aEEs.SetIncrement(iSize);
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nE1, nE2, bJustAdd);
if(bJustAdd) {
continue;
}
myIterator->Value(nE1, nE2);
//
const BOPDS_ShapeInfo& aSIE1=myDS->ShapeInfo(nE1);
if (aSIE1.HasFlag()){

View File

@@ -147,15 +147,14 @@ void BOPAlgo_PaveFiller::PerformVF()
myIterator->Initialize(TopAbs_VERTEX, TopAbs_FACE);
Standard_Integer iSize = myIterator->ExpectedLength();
//
Standard_Boolean bJustAdd;
Standard_Integer nV, nF;
//
if (myGlue == BOPAlgo_GlueFull) {
// there is no need to intersect vertices with faces in this mode
// just initialize FaceInfo for all faces
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nV, nF, bJustAdd);
if (!bJustAdd && !myDS->IsSubShape(nV, nF)) {
myIterator->Value(nV, nF);
if (!myDS->IsSubShape(nV, nF)) {
myDS->ChangeFaceInfo(nF);
}
}
@@ -178,10 +177,7 @@ void BOPAlgo_PaveFiller::PerformVF()
aVFs.SetIncrement(iSize);
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nV, nF, bJustAdd);
if(bJustAdd) {
continue;
}
myIterator->Value(nV, nF);
//
if (myDS->IsSubShape(nV, nF)) {
continue;

View File

@@ -149,15 +149,14 @@ void BOPAlgo_PaveFiller::PerformEF()
return;
}
//
Standard_Boolean bJustAdd;
Standard_Integer nE, nF;
//
if (myGlue == BOPAlgo_GlueFull) {
// there is no need to intersect edges with faces in this mode
// just initialize FaceInfo for faces
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nE, nF, bJustAdd);
if (!bJustAdd && !myDS->ShapeInfo(nE).HasFlag()) {
myIterator->Value(nE, nF);
if (!myDS->ShapeInfo(nE).HasFlag()) {
myDS->ChangeFaceInfo(nF);
}
}
@@ -190,10 +189,7 @@ void BOPAlgo_PaveFiller::PerformEF()
aEFs.SetIncrement(iSize);
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nE, nF, bJustAdd);
if(bJustAdd) {
continue;
}
myIterator->Value(nE, nF);
//
const BOPDS_ShapeInfo& aSIE=myDS->ShapeInfo(nE);
if (aSIE.HasFlag()){//degenerated

View File

@@ -184,7 +184,7 @@ void BOPAlgo_PaveFiller::PerformFF()
return;
}
//
Standard_Boolean bJustAdd, bApp, bCompC2D1, bCompC2D2, bIsDone;
Standard_Boolean bApp, bCompC2D1, bCompC2D2, bIsDone;
Standard_Boolean bToSplit, bTangentFaces;
Standard_Integer nF1, nF2, aNbCurves, aNbPoints, i, aNbLP;
Standard_Integer aNbFaceFace, k;
@@ -202,10 +202,7 @@ void BOPAlgo_PaveFiller::PerformFF()
bToSplit = Standard_False;
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nF1, nF2, bJustAdd);
if(bJustAdd) {
continue;
}
myIterator->Value(nF1, nF2);
//
const TopoDS_Face& aF1=(*(TopoDS_Face *)(&myDS->Shape(nF1)));
const TopoDS_Face& aF2=(*(TopoDS_Face *)(&myDS->Shape(nF2)));

View File

@@ -780,7 +780,7 @@ void BOPAlgo_PaveFiller::Prepare()
TopAbs_EDGE,
TopAbs_FACE
};
Standard_Boolean bJustAdd, bIsBasedOnPlane;
Standard_Boolean bIsBasedOnPlane;
Standard_Integer i, aNb, n1, nF, aNbF;
TopExp_Explorer aExp;
BOPCol_IndexedMapOfShape aMF;
@@ -791,7 +791,7 @@ void BOPAlgo_PaveFiller::Prepare()
for(i=0; i<aNb; ++i) {
myIterator->Initialize(aType[i], aType[2]);
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(n1, nF, bJustAdd);
myIterator->Value(n1, nF);
const TopoDS_Face& aF=(*(TopoDS_Face *)(&myDS->Shape(nF)));
//
bIsBasedOnPlane=IsBasedOnPlane(aF);

View File

@@ -95,7 +95,6 @@ void BOPAlgo_PaveFiller::FillShrunkData(const TopAbs_ShapeEnum aType1,
return;
}
//
Standard_Boolean bJustAdd;
Standard_Integer i, nS[2], nE, nV1, nV2, aNbVSD, k;
Standard_Real aT1, aT2, aTS1, aTS2;
BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
@@ -104,10 +103,7 @@ void BOPAlgo_PaveFiller::FillShrunkData(const TopAbs_ShapeEnum aType1,
TopAbs_ShapeEnum aType[2] = { aType1, aType2 };
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nS[0], nS[1], bJustAdd);
if(bJustAdd) {
continue;
}
myIterator->Value(nS[0], nS[1]);
//
for (i=0; i < 2; ++i) {
nE=nS[i];

View File

@@ -21,6 +21,7 @@ BOPAlgo_BuilderSolid.cxx
BOPAlgo_BuilderSolid.hxx
BOPAlgo_CheckerSI.cxx
BOPAlgo_CheckerSI.hxx
BOPAlgo_CheckerSI_1.cxx
BOPAlgo_CheckResult.cxx
BOPAlgo_CheckResult.hxx
BOPAlgo_CheckStatus.hxx
@@ -42,7 +43,6 @@ BOPAlgo_PaveFiller_7.cxx
BOPAlgo_PaveFiller_8.cxx
BOPAlgo_PaveFiller_9.cxx
BOPAlgo_PaveFiller_10.cxx
BOPAlgo_PaveFiller_11.cxx
BOPAlgo_PBOP.hxx
BOPAlgo_PBuilder.hxx
BOPAlgo_PPaveFiller.hxx