mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0029814: Modeling Data - add method TopoDS_Shape::NbChildren() for simple check of sub-shapes number
TopoDS_Shape::NbChildren() - new method has been introduced. TopoDS_Shape.lxx, TopoDS_TShape.lxx - inline methods have been moved to hxx. TopoDS_TShape_Flags has been redeclared as enumeration instead of preprocessor macros. Cyclic dependency between headers TopoDS_Shape.hxx and TopoDS_TShape.hxx eliminated. Places where TopoDS_Iterator is used only for calculation of number of sub-shapes are updated to use NbChildren() instead
This commit is contained in:
@@ -2229,36 +2229,30 @@ void BRepOffset_MakeOffset::CorrectConicalFaces()
|
||||
}
|
||||
}
|
||||
}
|
||||
TopoDS_Iterator anIt(Sol);
|
||||
Standard_Boolean SolIsNull = !anIt.More();
|
||||
Standard_Integer nbs = Sol.NbChildren();
|
||||
Standard_Boolean SolIsNull = (nbs == 0);
|
||||
//Checking solid
|
||||
if(!SolIsNull)
|
||||
if (nbs > 1)
|
||||
{
|
||||
Standard_Integer nbs = 0;
|
||||
while(anIt.More()) {anIt.Next(); ++nbs;}
|
||||
if(nbs > 1)
|
||||
BRepCheck_Analyzer aCheck (Sol, Standard_False);
|
||||
if (!aCheck.IsValid ())
|
||||
{
|
||||
BRepCheck_Analyzer aCheck(Sol, Standard_False);
|
||||
if(!aCheck.IsValid())
|
||||
TopTools_ListOfShape aSolList;
|
||||
CorrectSolid (Sol, aSolList);
|
||||
if (!aSolList.IsEmpty ())
|
||||
{
|
||||
TopTools_ListOfShape aSolList;
|
||||
CorrectSolid(Sol, aSolList);
|
||||
if(!aSolList.IsEmpty())
|
||||
BB.Add (NC, Sol);
|
||||
TopTools_ListIteratorOfListOfShape aSLIt (aSolList);
|
||||
for (; aSLIt.More (); aSLIt.Next ())
|
||||
{
|
||||
BB.Add(NC, Sol);
|
||||
TopTools_ListIteratorOfListOfShape aSLIt(aSolList);
|
||||
for(; aSLIt.More(); aSLIt.Next())
|
||||
{
|
||||
BB.Add(NC, aSLIt.Value());
|
||||
}
|
||||
SolIsNull = Standard_True;
|
||||
BB.Add (NC, aSLIt.Value ());
|
||||
}
|
||||
SolIsNull = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
anIt.Initialize(NC);
|
||||
Standard_Boolean NCIsNull = !anIt.More();
|
||||
Standard_Boolean NCIsNull = (NC.NbChildren() == 0);
|
||||
if((!SolIsNull) && (!NCIsNull))
|
||||
{
|
||||
BB.Add(NC, Sol);
|
||||
@@ -3072,35 +3066,29 @@ void BRepOffset_MakeOffset::MakeSolid ()
|
||||
}
|
||||
}
|
||||
}
|
||||
TopoDS_Iterator anIt(Sol);
|
||||
Standard_Boolean SolIsNull = !anIt.More();
|
||||
Standard_Integer nbs = Sol.NbChildren();
|
||||
Standard_Boolean SolIsNull = (nbs == 0);
|
||||
//Checking solid
|
||||
if(!SolIsNull)
|
||||
if (nbs > 1)
|
||||
{
|
||||
Standard_Integer nbs = 0;
|
||||
while(anIt.More()) {anIt.Next(); ++nbs;}
|
||||
if(nbs > 1)
|
||||
BRepCheck_Analyzer aCheck (Sol, Standard_False);
|
||||
if (!aCheck.IsValid ())
|
||||
{
|
||||
BRepCheck_Analyzer aCheck(Sol, Standard_False);
|
||||
if(!aCheck.IsValid())
|
||||
TopTools_ListOfShape aSolList;
|
||||
CorrectSolid (Sol, aSolList);
|
||||
if (!aSolList.IsEmpty ())
|
||||
{
|
||||
TopTools_ListOfShape aSolList;
|
||||
CorrectSolid(Sol, aSolList);
|
||||
if(!aSolList.IsEmpty())
|
||||
B.Add (NC, Sol);
|
||||
TopTools_ListIteratorOfListOfShape aSLIt (aSolList);
|
||||
for (; aSLIt.More (); aSLIt.Next ())
|
||||
{
|
||||
B.Add(NC, Sol);
|
||||
TopTools_ListIteratorOfListOfShape aSLIt(aSolList);
|
||||
for(; aSLIt.More(); aSLIt.Next())
|
||||
{
|
||||
B.Add(NC, aSLIt.Value());
|
||||
}
|
||||
SolIsNull = Standard_True;
|
||||
B.Add (NC, aSLIt.Value ());
|
||||
}
|
||||
SolIsNull = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
anIt.Initialize(NC);
|
||||
Standard_Boolean NCIsNull = !anIt.More();
|
||||
Standard_Boolean NCIsNull = (NC.NbChildren() == 0);
|
||||
if((!SolIsNull) && (!NCIsNull))
|
||||
{
|
||||
B.Add(NC, Sol);
|
||||
|
@@ -2386,9 +2386,7 @@ Standard_Boolean CheckInvertedBlock(const TopoDS_Shape& theCB,
|
||||
{
|
||||
// For possible removal of the block:
|
||||
// 1. There should be more than just one face in the block
|
||||
TopoDS_Iterator aItF(theCB);
|
||||
aItF.Next();
|
||||
if (!aItF.More()) {
|
||||
if (theCB.NbChildren() < 2) {
|
||||
return Standard_False;
|
||||
}
|
||||
//
|
||||
|
Reference in New Issue
Block a user