A base class for easily traversing a model hierarchy, applying an overridden function at each level or for each object.
More...
|
| | ModelIterator () |
| | Default constructor.
|
| | ModelIterator (Buffer< Model > models) |
| | Constructs an iterator initialized with multiple root models.
|
| | ModelIterator (const Model &model) |
| | Constructs an iterator initialized with a single root model.
|
| void | addToStack (const Model &model) |
| | Adds a model to the internal traversal stack without starting iteration.
|
| Model | currentModel () const |
| | Returns the model currently at the top of the traversal stack.
|
| void | parseAll () |
| | Parses all models currently on the internal stack and their descendants.
|
| void | parseAll (const Model &model) |
| | Parses the given model and all of its descendants.
|
| void | parseAllChildren (const Model &parent) |
| | Parses all children of the given parent model, but not the parent itself.
|
| void | parseAllModels (const Buffer< Model > &models) |
| | Parses all models in the given buffer and their descendants.
|
| ParseResult | parseNext () |
| | Parses the next model on the stack, processing it and optionally its geometry and material.
|
|
|
bool | depth_first = true |
| | Whether to traverse depth-first (true) or breadth-first (false).
|
|
std::function< bool(const Model &, const Geometry &)> | geo_filter |
| | Optional filter predicate for geometry processing. Returns true to include.
|
|
bool | is_recursive = true |
| | Whether to recurse into child models.
|
|
std::function< bool(const Model &, const Material &)> | material_filter |
| | Optional filter predicate for material processing. Returns true to include.
|
|
std::function< bool(const Model &)> | model_filter |
| | Optional filter predicate for model processing. Returns true to include.
|
|
bool | post_process_model = false |
| | Whether to invoke postProcess() after a model's children have been parsed.
|
|
bool | process_geometry = true |
| | Whether to invoke process() for each Geometry on a model.
|
|
bool | process_material = false |
| | Whether to invoke process() for each Material on a model.
|
|
bool | process_model = true |
| | Whether to invoke process() for the model itself.
|
|
bool | use_unit = false |
| | Whether to apply unit conversions during processing.
|
|
|
uint04 | m_forward_position = 0U |
| | Current forward index position used in breadth-first traversal.
|
|
Buffer< std::pair< Model, uint04 > > | m_model_parent_stack |
| | Stack tracking parent models and their child indices for post-processing.
|
|
Buffer< Model > | m_model_stack |
| | The stack of models pending traversal.
|
A base class for easily traversing a model hierarchy, applying an overridden function at each level or for each object.
Provides a stack-based iteration mechanism that walks through a tree of Model objects, optionally processing associated Geometry and Material objects at each node. Subclasses override the virtual process() methods to perform custom logic during traversal.
- See also
- Model, Geometry, Material, DesignObjectLookup
Definition at line 48 of file ModelIterator.h.
◆ ParseResult
The result returned by process functions to control iteration flow.
| Enumerator |
|---|
| e_continue_parsing | Continue normal traversal to sibling and child nodes.
|
| e_do_not_parse_children | Skip the children of the current node but continue with siblings.
|
| e_finish_parsing | Stop all traversal immediately.
|
Definition at line 54 of file ModelIterator.h.
◆ ModelIterator() [1/3]
| ModelIterator::ModelIterator |
( |
| ) |
|
Default constructor.
Creates an iterator with an empty model stack.
◆ ModelIterator() [2/3]
| ModelIterator::ModelIterator |
( |
const Model & | model | ) |
|
|
explicit |
Constructs an iterator initialized with a single root model.
- Parameters
-
| [in] | model | The root model to begin iteration from. |
◆ ModelIterator() [3/3]
Constructs an iterator initialized with multiple root models.
- Parameters
-
| [in] | models | The models to iterate over. |
◆ _parseAllModels()
| virtual void ModelIterator::_parseAllModels |
( |
| ) |
|
|
protectedvirtual |
◆ addToStack()
| void ModelIterator::addToStack |
( |
const Model & | model | ) |
|
Adds a model to the internal traversal stack without starting iteration.
- Parameters
-
| [in] | model | The model to push onto the stack. |
◆ currentModel()
| Model ModelIterator::currentModel |
( |
| ) |
const |
Returns the model currently at the top of the traversal stack.
- Returns
- The current Model being iterated over.
◆ parseAll() [1/2]
| void ModelIterator::parseAll |
( |
| ) |
|
Parses all models currently on the internal stack and their descendants.
◆ parseAll() [2/2]
| void ModelIterator::parseAll |
( |
const Model & | model | ) |
|
◆ parseAllChildren()
| void ModelIterator::parseAllChildren |
( |
const Model & | parent | ) |
|
Parses all children of the given parent model, but not the parent itself.
- Parameters
-
| [in] | parent | The parent model whose children will be parsed. |
◆ parseAllModels()
| void ModelIterator::parseAllModels |
( |
const Buffer< Model > & | models | ) |
|
Parses all models in the given buffer and their descendants.
- Parameters
-
| [in] | models | The collection of models to parse. |
◆ parseNext()
Parses the next model on the stack, processing it and optionally its geometry and material.
- Returns
- The ParseResult indicating how iteration should proceed.
◆ popNextModel()
| Model ModelIterator::popNextModel |
( |
| ) |
|
|
protected |
Pops and returns the next model from the traversal stack.
- Returns
- The next Model to process.
◆ postProcess()
◆ process() [1/3]
◆ process() [2/3]
◆ process() [3/3]
◆ removeFromPostProcessStack()
| void ModelIterator::removeFromPostProcessStack |
( |
| ) |
|
|
protected |
Removes the current model from the post-process stack.
The documentation for this class was generated from the following file: