1
0
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:
kgv
2018-05-24 18:06:37 +03:00
committed by bugmaster
parent e67e482d99
commit b2d1851c43
68 changed files with 321 additions and 1090 deletions

View File

@@ -368,7 +368,7 @@ static TopoDS_Shape MergeShells (
}
// If there are no elements in the new shell, return null shape
if (!TopoDS_Iterator (aNewShell).More())
if (aNewShell.NbChildren() == 0)
return TopoDS_Shape();
return aNewShell;

View File

@@ -147,9 +147,7 @@ Standard_Boolean ShapeFix_Shape::Perform(const Handle(Message_ProgressIndicator)
Standard_Integer savFixSameParameterMode = myFixSameParameterMode;
myFixSameParameterMode = Standard_False;
myFixVertexTolMode = Standard_False;
Standard_Integer aShapesNb = 0;
for ( TopoDS_Iterator anIter(S); anIter.More(); anIter.Next() )
++aShapesNb;
Standard_Integer aShapesNb = S.NbChildren();
// Open progress indication scope for sub-shape fixing
Message_ProgressSentry aPSentrySubShape(theProgress, "Fixing sub-shape", 0, aShapesNb, 1);

View File

@@ -117,9 +117,7 @@ Standard_Boolean ShapeFix_Shell::Perform(const Handle(Message_ProgressIndicator)
TopoDS_Shape S = Context()->Apply(myShell);
// Get the number of faces for progress indication
Standard_Integer aNbFaces = 0;
for ( TopExp_Explorer aFaceExp(S, TopAbs_FACE); aFaceExp.More(); aFaceExp.Next() )
++aNbFaces;
Standard_Integer aNbFaces = S.NbChildren();
// Start progress scope (no need to check if progress exists -- it is safe)
Message_ProgressSentry aPSentry(theProgress, "Fixing face", 0, aNbFaces, 1);