![]() |
Open CASCADE Technology Reference Manual 8.0.1
|
Stack-based lazy downward hierarchy walker for BRepGraph with inline location/orientation accumulation. More...
#include <BRepGraph_ChildExplorer.hxx>
Data Structures | |
| struct | Config |
| Consolidated configuration for the explorer. More... | |
Public Types | |
| enum class | LinkKind { None , Reference , Structural } |
| Relationship kind between Current() and CurrentParent(). More... | |
| enum class | TraversalMode { Recursive , DirectChildren } |
| Downward traversal strategy. More... | |
Public Member Functions | |
| BRepGraph_ChildExplorer (const BRepGraph &theGraph, const BRepGraph_NodeId theRoot, const Config &theConfig) | |
Preferred long-term constructor: all tuning knobs in Config. | |
| BRepGraph_ChildExplorer (const BRepGraph &theGraph, const BRepGraph_NodeId theRoot) | |
| Explore all descendants of the root node using recursive traversal. | |
| BRepGraph_ChildExplorer (const BRepGraph &theGraph, const BRepGraph_NodeId theRoot, TraversalMode theMode) | |
| Explore descendants of the root node using the given traversal mode. | |
| BRepGraph_ChildExplorer (const BRepGraph &theGraph, const BRepGraph_NodeId theRoot, const std::optional< BRepGraph_NodeId::Kind > &theAvoidKind, bool theEmitAvoidKind, TraversalMode theMode=TraversalMode::Recursive) | |
| Explore descendants while pruning branches at the avoid kind. | |
| BRepGraph_ChildExplorer (const BRepGraph &theGraph, const BRepGraph_NodeId theRoot, BRepGraph_NodeId::Kind theTargetKind) | |
| Explore only descendants of the given target kind. | |
| BRepGraph_ChildExplorer (const BRepGraph &theGraph, const BRepGraph_NodeId theRoot, BRepGraph_NodeId::Kind theTargetKind, TraversalMode theMode) | |
| Explore only descendants of the given target kind using the given traversal mode. | |
| BRepGraph_ChildExplorer (const BRepGraph &theGraph, const BRepGraph_NodeId theRoot, BRepGraph_NodeId::Kind theTargetKind, const std::optional< BRepGraph_NodeId::Kind > &theAvoidKind, bool theEmitAvoidKind, TraversalMode theMode=TraversalMode::Recursive) | |
| Explore descendants of the given target kind while pruning branches at the avoid kind. | |
| BRepGraph_ChildExplorer (const BRepGraph &theGraph, const BRepGraph_ProductId theProduct, BRepGraph_NodeId::Kind theTargetKind) | |
| Explore only descendants of the given target kind starting from a product. | |
| template<BRepGraph_NodeId::Kind TheKind, typename std::enable_if_t< TheKind !=BRepGraph_NodeId::Kind::Product, int > = 0> | |
| BRepGraph_ChildExplorer (const BRepGraph &theGraph, const BRepGraph_NodeId::Typed< TheKind > theRoot, BRepGraph_NodeId::Kind theTargetKind) | |
| Disambiguates non-product typed ids from the ProductId-specific overload family above and keeps them on the generic NodeId traversal path. | |
| BRepGraph_ChildExplorer (const BRepGraph &theGraph, const BRepGraph_ProductId theProduct, BRepGraph_NodeId::Kind theTargetKind, TraversalMode theMode) | |
| Explore only descendants of the given target kind starting from a product, using the given traversal mode. | |
| template<BRepGraph_NodeId::Kind TheKind, typename std::enable_if_t< TheKind !=BRepGraph_NodeId::Kind::Product, int > = 0> | |
| BRepGraph_ChildExplorer (const BRepGraph &theGraph, const BRepGraph_NodeId::Typed< TheKind > theRoot, BRepGraph_NodeId::Kind theTargetKind, TraversalMode theMode) | |
| Disambiguates non-product typed ids from the ProductId-specific overload family above and keeps them on the generic NodeId traversal path. | |
| BRepGraph_ChildExplorer (const BRepGraph &theGraph, const BRepGraph_NodeId theRoot, BRepGraph_NodeId::Kind theTargetKind, bool theCumLoc, bool theCumOri, TraversalMode theMode=TraversalMode::Recursive) | |
| Explore only descendants of the given target kind with explicit location/orientation control. | |
| BRepGraph_ChildExplorer (const BRepGraph &theGraph, const BRepGraph_ProductId theProduct, BRepGraph_NodeId::Kind theTargetKind, bool theCumLoc, bool theCumOri, TraversalMode theMode=TraversalMode::Recursive) | |
| Explore only descendants of the given target kind starting from a product, with explicit location/orientation control. | |
| template<BRepGraph_NodeId::Kind TheKind, typename std::enable_if_t< TheKind !=BRepGraph_NodeId::Kind::Product, int > = 0> | |
| BRepGraph_ChildExplorer (const BRepGraph &theGraph, const BRepGraph_NodeId::Typed< TheKind > theRoot, BRepGraph_NodeId::Kind theTargetKind, bool theCumLoc, bool theCumOri, TraversalMode theMode=TraversalMode::Recursive) | |
| Disambiguates non-product typed ids from the ProductId-specific overload family above and keeps them on the generic NodeId traversal path. | |
| BRepGraph_ChildExplorer (const BRepGraph &theGraph, const BRepGraph_NodeId theRoot, BRepGraph_NodeId::Kind theTargetKind, const TopLoc_Location &theStartLoc, TopAbs_Orientation theStartOri, TraversalMode theMode=TraversalMode::DirectChildren) | |
| Explore only descendants of the given target kind with an explicit initial transform. | |
| const Config & | GetConfig () const |
| Returns the traversal configuration this explorer was constructed with. Read-only - configuration is fixed for the lifetime of the explorer. | |
| bool | More () const |
| True if another matching descendant is available. | |
| void | Next () |
| Advance to the next matching descendant. | |
| BRepGraphInc::NodeInstance | Current () const |
| Current matching descendant node with accumulated location and orientation. | |
| BRepGraph_NodeId | CurrentParent () const |
| Returns the immediate parent of Current() in the explored path. Returns invalid NodeId when Current() is the root/self match. | |
| LinkKind | CurrentLinkKind () const |
| Returns how Current() is linked from CurrentParent(). | |
| BRepGraph_RefId | CurrentRef () const |
| Returns the exact parent-owned RefId for Current(), when the current step is represented by a reference entry. Returns invalid RefId for structural links without a dedicated ref entry such as CoEdge->Edge, Occurrence->Product/topology-root. | |
| BRepGraph_UsagePath | CurrentUsagePath () const |
| Returns the explicit concrete traversal path from the explorer root to Current(). | |
| TopLoc_Location | LocationOf (const BRepGraph_NodeId::Kind theKind) const |
| Returns the accumulated location at the most recent ancestor of the given kind. | |
| BRepGraph_NodeId | NodeOf (const BRepGraph_NodeId::Kind theKind) const |
| Returns the node id of the most recent ancestor of the given kind. | |
| TopLoc_Location | LocationAt (const int theLevel) const |
| Returns the accumulated location at the given stack level. | |
| BRepGraph_NodeId | NodeAt (const int theLevel) const |
| Returns the node id at the given stack level. | |
| int | Depth () const noexcept |
| Number of valid ancestor frames currently on the stack (excluding the sentinel below the root). O(1); avoids the O(depth^2) NodeAt(i) walk used to compute container priority in selection-mode building. | |
| NCollection_ForwardRangeIterator< BRepGraph_ChildExplorer > | begin () |
| Returns an STL-compatible iterator for range-based for loops. | |
| NCollection_ForwardRangeSentinel | end () const |
| Returns a sentinel marking the end of iteration. | |
Stack-based lazy downward hierarchy walker for BRepGraph with inline location/orientation accumulation.
Walks the graph hierarchy from a root node down to entities of a target kind, yielding one occurrence at a time via a depth-first stack. Location and orientation are composed incrementally during the walk, making Current().Location and Current().Orientation O(1) per call.
The traversal follows the actual graph structure transparently - every node kind is visited as a distinct entity (no hidden collapses): Compound -> children, CompSolid -> Solids, Solid -> Shells, Shell -> Faces, Face -> Wires (+direct Vertices), Wire -> CoEdges, CoEdge -> Edge, Edge -> Vertices, Product -> Occurrences, Occurrence -> Product/topology-root.
Unlike flat definition traversal by typed ids, BRepGraph_ChildExplorer visits each occurrence. If Edge[5] is reachable through Face[0] and Face[1], it is visited twice with different accumulated transforms.
Relationship kind between Current() and CurrentParent().
| Enumerator | |
|---|---|
| None | No current incoming link (e.g. root/self match). |
| Reference | Current() is reached through a parent-owned RefId. |
| Structural | Current() is reached through a structural non-ref link. |
| BRepGraph_ChildExplorer::BRepGraph_ChildExplorer | ( | const BRepGraph & | theGraph, |
| const BRepGraph_NodeId | theRoot, | ||
| const Config & | theConfig ) |
Preferred long-term constructor: all tuning knobs in Config.
| [in] | theGraph | graph to walk |
| [in] | theRoot | root node where the walk begins |
| [in] | theConfig | traversal configuration (mode, target kind, avoid kind, etc.) |
| BRepGraph_ChildExplorer::BRepGraph_ChildExplorer | ( | const BRepGraph & | theGraph, |
| const BRepGraph_NodeId | theRoot ) |
Explore all descendants of the root node using recursive traversal.
| [in] | theGraph | graph to walk |
| [in] | theRoot | root node where the walk begins |
| BRepGraph_ChildExplorer::BRepGraph_ChildExplorer | ( | const BRepGraph & | theGraph, |
| const BRepGraph_NodeId | theRoot, | ||
| TraversalMode | theMode ) |
Explore descendants of the root node using the given traversal mode.
| [in] | theGraph | graph to walk |
| [in] | theRoot | root node where the walk begins |
| [in] | theMode | traversal strategy (recursive or direct children) |
| BRepGraph_ChildExplorer::BRepGraph_ChildExplorer | ( | const BRepGraph & | theGraph, |
| const BRepGraph_NodeId | theRoot, | ||
| const std::optional< BRepGraph_NodeId::Kind > & | theAvoidKind, | ||
| bool | theEmitAvoidKind, | ||
| TraversalMode | theMode = TraversalMode::Recursive ) |
Explore descendants while pruning branches at the avoid kind.
| [in] | theGraph | graph to walk |
| [in] | theRoot | root node where the walk begins |
| [in] | theAvoidKind | node kind to avoid descending into |
| [in] | theEmitAvoidKind | if true, emit matching avoid-kind nodes once before skipping |
| [in] | theMode | traversal strategy |
| BRepGraph_ChildExplorer::BRepGraph_ChildExplorer | ( | const BRepGraph & | theGraph, |
| const BRepGraph_NodeId | theRoot, | ||
| BRepGraph_NodeId::Kind | theTargetKind ) |
Explore only descendants of the given target kind.
| [in] | theGraph | graph to walk |
| [in] | theRoot | root node where the walk begins |
| [in] | theTargetKind | kind of nodes to emit |
| BRepGraph_ChildExplorer::BRepGraph_ChildExplorer | ( | const BRepGraph & | theGraph, |
| const BRepGraph_NodeId | theRoot, | ||
| BRepGraph_NodeId::Kind | theTargetKind, | ||
| TraversalMode | theMode ) |
Explore only descendants of the given target kind using the given traversal mode.
| [in] | theGraph | graph to walk |
| [in] | theRoot | root node where the walk begins |
| [in] | theTargetKind | kind of nodes to emit |
| [in] | theMode | traversal strategy |
| BRepGraph_ChildExplorer::BRepGraph_ChildExplorer | ( | const BRepGraph & | theGraph, |
| const BRepGraph_NodeId | theRoot, | ||
| BRepGraph_NodeId::Kind | theTargetKind, | ||
| const std::optional< BRepGraph_NodeId::Kind > & | theAvoidKind, | ||
| bool | theEmitAvoidKind, | ||
| TraversalMode | theMode = TraversalMode::Recursive ) |
Explore descendants of the given target kind while pruning branches at the avoid kind.
| [in] | theGraph | graph to walk |
| [in] | theRoot | root node where the walk begins |
| [in] | theTargetKind | kind of nodes to emit |
| [in] | theAvoidKind | node kind to avoid descending into |
| [in] | theEmitAvoidKind | if true, emit matching avoid-kind nodes once before skipping |
| [in] | theMode | traversal strategy |
| BRepGraph_ChildExplorer::BRepGraph_ChildExplorer | ( | const BRepGraph & | theGraph, |
| const BRepGraph_ProductId | theProduct, | ||
| BRepGraph_NodeId::Kind | theTargetKind ) |
Explore only descendants of the given target kind starting from a product.
| [in] | theGraph | graph to walk |
| [in] | theProduct | product whose occurrences and topology are explored |
| [in] | theTargetKind | kind of nodes to emit |
|
inline |
Disambiguates non-product typed ids from the ProductId-specific overload family above and keeps them on the generic NodeId traversal path.
| [in] | theGraph | graph to walk |
| [in] | theRoot | typed root node where the walk begins |
| [in] | theTargetKind | kind of nodes to emit |
| BRepGraph_ChildExplorer::BRepGraph_ChildExplorer | ( | const BRepGraph & | theGraph, |
| const BRepGraph_ProductId | theProduct, | ||
| BRepGraph_NodeId::Kind | theTargetKind, | ||
| TraversalMode | theMode ) |
Explore only descendants of the given target kind starting from a product, using the given traversal mode.
| [in] | theGraph | graph to walk |
| [in] | theProduct | product whose occurrences and topology are explored |
| [in] | theTargetKind | kind of nodes to emit |
| [in] | theMode | traversal strategy |
|
inline |
Disambiguates non-product typed ids from the ProductId-specific overload family above and keeps them on the generic NodeId traversal path.
| [in] | theGraph | graph to walk |
| [in] | theRoot | typed root node where the walk begins |
| [in] | theTargetKind | kind of nodes to emit |
| [in] | theMode | traversal strategy |
| BRepGraph_ChildExplorer::BRepGraph_ChildExplorer | ( | const BRepGraph & | theGraph, |
| const BRepGraph_NodeId | theRoot, | ||
| BRepGraph_NodeId::Kind | theTargetKind, | ||
| bool | theCumLoc, | ||
| bool | theCumOri, | ||
| TraversalMode | theMode = TraversalMode::Recursive ) |
Explore only descendants of the given target kind with explicit location/orientation control.
| [in] | theGraph | graph to walk |
| [in] | theRoot | root node where the walk begins |
| [in] | theTargetKind | kind of nodes to emit |
| [in] | theCumLoc | if true, accumulate location down the walk |
| [in] | theCumOri | if true, accumulate orientation down the walk |
| [in] | theMode | traversal strategy |
| BRepGraph_ChildExplorer::BRepGraph_ChildExplorer | ( | const BRepGraph & | theGraph, |
| const BRepGraph_ProductId | theProduct, | ||
| BRepGraph_NodeId::Kind | theTargetKind, | ||
| bool | theCumLoc, | ||
| bool | theCumOri, | ||
| TraversalMode | theMode = TraversalMode::Recursive ) |
Explore only descendants of the given target kind starting from a product, with explicit location/orientation control.
| [in] | theGraph | graph to walk |
| [in] | theProduct | product whose occurrences and topology are explored |
| [in] | theTargetKind | kind of nodes to emit |
| [in] | theCumLoc | if true, accumulate location down the walk |
| [in] | theCumOri | if true, accumulate orientation down the walk |
| [in] | theMode | traversal strategy |
|
inline |
Disambiguates non-product typed ids from the ProductId-specific overload family above and keeps them on the generic NodeId traversal path.
| [in] | theGraph | graph to walk |
| [in] | theRoot | typed root node where the walk begins |
| [in] | theTargetKind | kind of nodes to emit |
| [in] | theCumLoc | if true, accumulate location down the walk |
| [in] | theCumOri | if true, accumulate orientation down the walk |
| [in] | theMode | traversal strategy |
| BRepGraph_ChildExplorer::BRepGraph_ChildExplorer | ( | const BRepGraph & | theGraph, |
| const BRepGraph_NodeId | theRoot, | ||
| BRepGraph_NodeId::Kind | theTargetKind, | ||
| const TopLoc_Location & | theStartLoc, | ||
| TopAbs_Orientation | theStartOri, | ||
| TraversalMode | theMode = TraversalMode::DirectChildren ) |
Explore only descendants of the given target kind with an explicit initial transform.
| [in] | theGraph | graph to walk |
| [in] | theRoot | root node where the walk begins |
| [in] | theTargetKind | kind of nodes to emit |
| [in] | theStartLoc | initial accumulated location |
| [in] | theStartOri | initial accumulated orientation |
| [in] | theMode | traversal strategy |
|
inline |
Returns an STL-compatible iterator for range-based for loops.
|
inline |
Current matching descendant node with accumulated location and orientation.
| LinkKind BRepGraph_ChildExplorer::CurrentLinkKind | ( | ) | const |
Returns how Current() is linked from CurrentParent().
| BRepGraph_NodeId BRepGraph_ChildExplorer::CurrentParent | ( | ) | const |
| BRepGraph_RefId BRepGraph_ChildExplorer::CurrentRef | ( | ) | const |
Returns the exact parent-owned RefId for Current(), when the current step is represented by a reference entry. Returns invalid RefId for structural links without a dedicated ref entry such as CoEdge->Edge, Occurrence->Product/topology-root.
| BRepGraph_UsagePath BRepGraph_ChildExplorer::CurrentUsagePath | ( | ) | const |
Returns the explicit concrete traversal path from the explorer root to Current().
|
inlinenoexcept |
Number of valid ancestor frames currently on the stack (excluding the sentinel below the root). O(1); avoids the O(depth^2) NodeAt(i) walk used to compute container priority in selection-mode building.
|
inline |
Returns a sentinel marking the end of iteration.
|
inline |
Returns the traversal configuration this explorer was constructed with. Read-only - configuration is fixed for the lifetime of the explorer.
| TopLoc_Location BRepGraph_ChildExplorer::LocationAt | ( | const int | theLevel | ) | const |
Returns the accumulated location at the given stack level.
| [in] | theLevel | zero-based stack depth (0 = root) |
| TopLoc_Location BRepGraph_ChildExplorer::LocationOf | ( | const BRepGraph_NodeId::Kind | theKind | ) | const |
Returns the accumulated location at the most recent ancestor of the given kind.
| [in] | theKind | node kind to search for in the ancestor chain |
|
inline |
True if another matching descendant is available.
| void BRepGraph_ChildExplorer::Next | ( | ) |
Advance to the next matching descendant.
| BRepGraph_NodeId BRepGraph_ChildExplorer::NodeAt | ( | const int | theLevel | ) | const |
Returns the node id at the given stack level.
| [in] | theLevel | zero-based stack depth (0 = root) |
| BRepGraph_NodeId BRepGraph_ChildExplorer::NodeOf | ( | const BRepGraph_NodeId::Kind | theKind | ) | const |
Returns the node id of the most recent ancestor of the given kind.
| [in] | theKind | node kind to search for in the ancestor chain |