1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +03:00

0031323: OCAF, TObj - TObj_OcafObjectIterator does not go recursively to children if type argument is used

Added theAllSubChildren flag to the TObj_OcafObjectIterator to iterate all sub-children.
By default it still iterates only the first level of children.
This commit is contained in:
mpv
2020-09-14 16:49:38 +03:00
committed by bugmaster
parent 0b55d29b6a
commit 689dc3b1c9
4 changed files with 73 additions and 31 deletions

View File

@@ -29,8 +29,10 @@ IMPLEMENT_STANDARD_RTTIEXT(TObj_OcafObjectIterator,TObj_LabelIterator)
TObj_OcafObjectIterator::TObj_OcafObjectIterator
(const TDF_Label& theLabel,
const Handle(Standard_Type)& theType,
const Standard_Boolean theRecursive)
: TObj_LabelIterator( theLabel, theRecursive ), myType( theType )
const Standard_Boolean theRecursive,
const Standard_Boolean theAllSubChildren)
: TObj_LabelIterator (theLabel, theRecursive),
myType (theType), myAllSubChildren (theAllSubChildren)
{
MakeStep();
}
@@ -46,14 +48,14 @@ void TObj_OcafObjectIterator::MakeStep()
{
TDF_Label L = myIterator.Value();
Handle(TObj_Object) anObject;
if(TObj_Object::GetObj(L,anObject))
if(TObj_Object::GetObj (L, anObject))
{
if (myType.IsNull() || anObject->IsKind( myType ))
if (myType.IsNull() || anObject->IsKind (myType))
{
myObject = anObject;
myNode = L;
}
myIterator.NextBrother();
myAllSubChildren ? myIterator.Next() : myIterator.NextBrother();
}
else
myIterator.Next();