1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-03 14:10:33 +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

@@ -724,11 +724,8 @@ void DNaming::LoadResult(const TDF_Label& ResultLabel, BRepAlgoAPI_BooleanOperat
TNaming_Builder Builder (ResultLabel);
TopoDS_Shape aResult = MS.Shape();
if (aResult.ShapeType() == TopAbs_COMPOUND) {
Standard_Integer nbSubResults = 0;
TopoDS_Iterator itr(aResult);
for (; itr.More(); itr.Next()) nbSubResults++;
if (nbSubResults == 1) {
itr.Initialize(aResult);
if (aResult.NbChildren() == 1) {
TopoDS_Iterator itr (aResult);
if (itr.More()) aResult = itr.Value();
}
}

View File

@@ -373,8 +373,7 @@ Standard_Boolean DNaming_BooleanOperationDriver::CheckAndLoad
if (theMkOpe.IsDone() && !theMkOpe.Shape().IsNull()) {
if (theMkOpe.Shape().ShapeType() == TopAbs_COMPOUND) {
TopoDS_Iterator anItr(theMkOpe.Shape());
if(!anItr.More()) {
if (theMkOpe.Shape().NbChildren() == 0) {
theFunction->SetFailure(NULL_RESULT);
return Standard_False;
}

View File

@@ -179,11 +179,8 @@ void DNaming_FilletDriver::LoadNamingDS (const TDF_Label& theResultLabel,
TopoDS_Shape aResult = theMkFillet.Shape();
if (aResult.ShapeType() == TopAbs_COMPOUND) {
Standard_Integer nbSubResults = 0;
TopoDS_Iterator itr(aResult);
for (; itr.More(); itr.Next()) nbSubResults++;
if (nbSubResults == 1) {
itr.Initialize(aResult);
if (aResult.NbChildren() == 1) {
TopoDS_Iterator itr (aResult);
if (itr.More()) aResult = itr.Value();
}
}