OCCT3D About OCCT
Open CASCADE Technology Reference Manual 8.0.1
Loading...
Searching...
No Matches
Data Structures | Public Types | Public Member Functions
BRepGraph_ChildExplorer Class Reference

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 ConfigGetConfig () 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_ChildExplorerbegin ()
 Returns an STL-compatible iterator for range-based for loops.
 
NCollection_ForwardRangeSentinel end () const
 Returns a sentinel marking the end of iteration.
 

Detailed Description

Stack-based lazy downward hierarchy walker for BRepGraph with inline location/orientation accumulation.

See also
BRepGraph class comment "Iterator guide" for choosing between iterator types.

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.

Traversal modes

Member Enumeration Documentation

◆ LinkKind

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.

◆ TraversalMode

Downward traversal strategy.

Enumerator
Recursive 

Depth-first walk through the full subgraph.

DirectChildren 

Yields only the immediate children of the root.

Constructor & Destructor Documentation

◆ BRepGraph_ChildExplorer() [1/15]

BRepGraph_ChildExplorer::BRepGraph_ChildExplorer ( const BRepGraph & theGraph,
const BRepGraph_NodeId theRoot,
const Config & theConfig )

Preferred long-term constructor: all tuning knobs in Config.

Parameters
[in]theGraphgraph to walk
[in]theRootroot node where the walk begins
[in]theConfigtraversal configuration (mode, target kind, avoid kind, etc.)

◆ BRepGraph_ChildExplorer() [2/15]

BRepGraph_ChildExplorer::BRepGraph_ChildExplorer ( const BRepGraph & theGraph,
const BRepGraph_NodeId theRoot )

Explore all descendants of the root node using recursive traversal.

Parameters
[in]theGraphgraph to walk
[in]theRootroot node where the walk begins

◆ BRepGraph_ChildExplorer() [3/15]

BRepGraph_ChildExplorer::BRepGraph_ChildExplorer ( const BRepGraph & theGraph,
const BRepGraph_NodeId theRoot,
TraversalMode theMode )

Explore descendants of the root node using the given traversal mode.

Parameters
[in]theGraphgraph to walk
[in]theRootroot node where the walk begins
[in]theModetraversal strategy (recursive or direct children)

◆ BRepGraph_ChildExplorer() [4/15]

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.

Parameters
[in]theGraphgraph to walk
[in]theRootroot node where the walk begins
[in]theAvoidKindnode kind to avoid descending into
[in]theEmitAvoidKindif true, emit matching avoid-kind nodes once before skipping
[in]theModetraversal strategy

◆ BRepGraph_ChildExplorer() [5/15]

BRepGraph_ChildExplorer::BRepGraph_ChildExplorer ( const BRepGraph & theGraph,
const BRepGraph_NodeId theRoot,
BRepGraph_NodeId::Kind theTargetKind )

Explore only descendants of the given target kind.

Parameters
[in]theGraphgraph to walk
[in]theRootroot node where the walk begins
[in]theTargetKindkind of nodes to emit

◆ BRepGraph_ChildExplorer() [6/15]

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.

Parameters
[in]theGraphgraph to walk
[in]theRootroot node where the walk begins
[in]theTargetKindkind of nodes to emit
[in]theModetraversal strategy

◆ BRepGraph_ChildExplorer() [7/15]

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.

Parameters
[in]theGraphgraph to walk
[in]theRootroot node where the walk begins
[in]theTargetKindkind of nodes to emit
[in]theAvoidKindnode kind to avoid descending into
[in]theEmitAvoidKindif true, emit matching avoid-kind nodes once before skipping
[in]theModetraversal strategy

◆ BRepGraph_ChildExplorer() [8/15]

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.

Parameters
[in]theGraphgraph to walk
[in]theProductproduct whose occurrences and topology are explored
[in]theTargetKindkind of nodes to emit

◆ BRepGraph_ChildExplorer() [9/15]

template<BRepGraph_NodeId::Kind TheKind, typename std::enable_if_t< TheKind !=BRepGraph_NodeId::Kind::Product, int > = 0>
BRepGraph_ChildExplorer::BRepGraph_ChildExplorer ( const BRepGraph & theGraph,
const BRepGraph_NodeId::Typed< TheKind > theRoot,
BRepGraph_NodeId::Kind theTargetKind )
inline

Disambiguates non-product typed ids from the ProductId-specific overload family above and keeps them on the generic NodeId traversal path.

Parameters
[in]theGraphgraph to walk
[in]theRoottyped root node where the walk begins
[in]theTargetKindkind of nodes to emit

◆ BRepGraph_ChildExplorer() [10/15]

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.

Parameters
[in]theGraphgraph to walk
[in]theProductproduct whose occurrences and topology are explored
[in]theTargetKindkind of nodes to emit
[in]theModetraversal strategy

◆ BRepGraph_ChildExplorer() [11/15]

template<BRepGraph_NodeId::Kind TheKind, typename std::enable_if_t< TheKind !=BRepGraph_NodeId::Kind::Product, int > = 0>
BRepGraph_ChildExplorer::BRepGraph_ChildExplorer ( const BRepGraph & theGraph,
const BRepGraph_NodeId::Typed< TheKind > theRoot,
BRepGraph_NodeId::Kind theTargetKind,
TraversalMode theMode )
inline

Disambiguates non-product typed ids from the ProductId-specific overload family above and keeps them on the generic NodeId traversal path.

Parameters
[in]theGraphgraph to walk
[in]theRoottyped root node where the walk begins
[in]theTargetKindkind of nodes to emit
[in]theModetraversal strategy

◆ BRepGraph_ChildExplorer() [12/15]

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.

Parameters
[in]theGraphgraph to walk
[in]theRootroot node where the walk begins
[in]theTargetKindkind of nodes to emit
[in]theCumLocif true, accumulate location down the walk
[in]theCumOriif true, accumulate orientation down the walk
[in]theModetraversal strategy

◆ BRepGraph_ChildExplorer() [13/15]

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.

Parameters
[in]theGraphgraph to walk
[in]theProductproduct whose occurrences and topology are explored
[in]theTargetKindkind of nodes to emit
[in]theCumLocif true, accumulate location down the walk
[in]theCumOriif true, accumulate orientation down the walk
[in]theModetraversal strategy

◆ BRepGraph_ChildExplorer() [14/15]

template<BRepGraph_NodeId::Kind TheKind, typename std::enable_if_t< TheKind !=BRepGraph_NodeId::Kind::Product, int > = 0>
BRepGraph_ChildExplorer::BRepGraph_ChildExplorer ( const BRepGraph & theGraph,
const BRepGraph_NodeId::Typed< TheKind > theRoot,
BRepGraph_NodeId::Kind theTargetKind,
bool theCumLoc,
bool theCumOri,
TraversalMode theMode = TraversalMode::Recursive )
inline

Disambiguates non-product typed ids from the ProductId-specific overload family above and keeps them on the generic NodeId traversal path.

Parameters
[in]theGraphgraph to walk
[in]theRoottyped root node where the walk begins
[in]theTargetKindkind of nodes to emit
[in]theCumLocif true, accumulate location down the walk
[in]theCumOriif true, accumulate orientation down the walk
[in]theModetraversal strategy

◆ BRepGraph_ChildExplorer() [15/15]

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.

Parameters
[in]theGraphgraph to walk
[in]theRootroot node where the walk begins
[in]theTargetKindkind of nodes to emit
[in]theStartLocinitial accumulated location
[in]theStartOriinitial accumulated orientation
[in]theModetraversal strategy

Member Function Documentation

◆ begin()

NCollection_ForwardRangeIterator< BRepGraph_ChildExplorer > BRepGraph_ChildExplorer::begin ( )
inline

Returns an STL-compatible iterator for range-based for loops.

◆ Current()

BRepGraphInc::NodeInstance BRepGraph_ChildExplorer::Current ( ) const
inline

Current matching descendant node with accumulated location and orientation.

◆ CurrentLinkKind()

LinkKind BRepGraph_ChildExplorer::CurrentLinkKind ( ) const

Returns how Current() is linked from CurrentParent().

◆ CurrentParent()

BRepGraph_NodeId BRepGraph_ChildExplorer::CurrentParent ( ) const

Returns the immediate parent of Current() in the explored path. Returns invalid NodeId when Current() is the root/self match.

◆ CurrentRef()

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.

◆ CurrentUsagePath()

BRepGraph_UsagePath BRepGraph_ChildExplorer::CurrentUsagePath ( ) const

Returns the explicit concrete traversal path from the explorer root to Current().

◆ Depth()

int BRepGraph_ChildExplorer::Depth ( ) const
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.

◆ end()

NCollection_ForwardRangeSentinel BRepGraph_ChildExplorer::end ( ) const
inline

Returns a sentinel marking the end of iteration.

◆ GetConfig()

const Config & BRepGraph_ChildExplorer::GetConfig ( ) const
inline

Returns the traversal configuration this explorer was constructed with. Read-only - configuration is fixed for the lifetime of the explorer.

◆ LocationAt()

TopLoc_Location BRepGraph_ChildExplorer::LocationAt ( const int theLevel) const

Returns the accumulated location at the given stack level.

Parameters
[in]theLevelzero-based stack depth (0 = root)
Returns
accumulated location at the specified level

◆ LocationOf()

TopLoc_Location BRepGraph_ChildExplorer::LocationOf ( const BRepGraph_NodeId::Kind theKind) const

Returns the accumulated location at the most recent ancestor of the given kind.

Parameters
[in]theKindnode kind to search for in the ancestor chain
Returns
accumulated location at the matching ancestor

◆ More()

bool BRepGraph_ChildExplorer::More ( ) const
inline

True if another matching descendant is available.

◆ Next()

void BRepGraph_ChildExplorer::Next ( )

Advance to the next matching descendant.

◆ NodeAt()

BRepGraph_NodeId BRepGraph_ChildExplorer::NodeAt ( const int theLevel) const

Returns the node id at the given stack level.

Parameters
[in]theLevelzero-based stack depth (0 = root)
Returns
node id at the specified level

◆ NodeOf()

BRepGraph_NodeId BRepGraph_ChildExplorer::NodeOf ( const BRepGraph_NodeId::Kind theKind) const

Returns the node id of the most recent ancestor of the given kind.

Parameters
[in]theKindnode kind to search for in the ancestor chain
Returns
node id of the matching ancestor

The documentation for this class was generated from the following file: