MantisBT - Open CASCADE
View Issue Details
0031323Open CASCADE[OCCT] OCCT:Application Frameworkpublic2020-01-28 11:182020-09-15 11:50
[OCCT] 7.5.0 
0031323: OCAF, TObj - TObj_OcafObjectIterator does not go recursively to children if type argument is used
If TObj_OcafObjectIterator is used on a hierarchy of objects in recursive mode with specific type of objects to be found, it does actually recursive, so children of 2nd and deeper levels cannot be found. This seems to be due to use of myIterator.NextBrother() instead of Next() in TObj_OcafObjectIterator::MakeStep() in case if current label contains an object.
bugs caf bug31323
No tags attached.
Issue History
2020-01-28 11:18abvNew Issue
2020-01-28 11:18abvAssigned To => mpv
2020-09-01 15:40mpvNote Added: 0093821
2020-09-01 15:40mpvAssigned Tompv => abv
2020-09-01 15:40mpvStatusnew => feedback
2020-09-10 18:19abvNote Added: 0094406
2020-09-10 18:19abvAssigned Toabv => mpv
2020-09-10 18:19abvStatusfeedback => assigned
2020-09-11 15:32utverdovTarget Version7.5.0 => 7.6.0*
2020-09-14 16:46gitNote Added: 0094756
2020-09-15 10:38mpvNote Added: 0094807
2020-09-15 10:38mpvAssigned Tompv => abv
2020-09-15 10:38mpvStatusassigned => resolved
2020-09-15 10:38mpvSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=23466#r23466
2020-09-15 11:50mpvTarget Version7.6.0* => 7.5.0

2020-09-01 15:40   
As I understand, the described behavior correctly corresponds to the comment of method TObj_Object::GetChildren (where it is mainly used):
  //! The default implementation search for children on 1 sublevel
  //! of the children sub label

So, it searches recursively, but when the child is found, it does not get its subs. Perhaps, it is also done for performance reasons.

Do you use TObj_OcafObjectIterator separately or inside of OCCT method? May we consider to add another flag to this iterator to make search of all-levels sub-objects?
2020-09-10 18:19   
I was using that class in the application code, with a purpose of iterating over all objects in the model (including nested objects). I agree that one more flag can be added, yet it should be very well documented to allow the user to understand what is the difference between two levels of recursion.
2020-09-14 16:46   
Branch CR31323 has been created by mpv.

SHA-1: 6d2c6d64a5d7877bec9c1b936fc6da1877abc69c

Detailed log of new commits:

Author: mpv
Date: Mon Sep 14 16:49:38 2020 +0300

    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.
2020-09-15 10:38   
Resolved in CR31323. Flag theAllSubChildren is added to the iterator constructor. [^]