Open CASCADE Technology Reference Manual 8.0.0
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)
 
 BRepGraph_ChildExplorer (const BRepGraph &theGraph, const BRepGraph_NodeId theRoot, TraversalMode theMode)
 
 BRepGraph_ChildExplorer (const BRepGraph &theGraph, const BRepGraph_NodeId theRoot, const std::optional< BRepGraph_NodeId::Kind > &theAvoidKind, bool theEmitAvoidKind, TraversalMode theMode=TraversalMode::Recursive)
 
 BRepGraph_ChildExplorer (const BRepGraph &theGraph, const BRepGraph_NodeId theRoot, BRepGraph_NodeId::Kind theTargetKind)
 
 BRepGraph_ChildExplorer (const BRepGraph &theGraph, const BRepGraph_NodeId theRoot, BRepGraph_NodeId::Kind theTargetKind, TraversalMode theMode)
 
 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)
 
 BRepGraph_ChildExplorer (const BRepGraph &theGraph, const BRepGraph_ProductId theProduct, BRepGraph_NodeId::Kind theTargetKind)
 
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)
 
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)
 
 BRepGraph_ChildExplorer (const BRepGraph &theGraph, const BRepGraph_ProductId theProduct, BRepGraph_NodeId::Kind theTargetKind, bool theCumLoc, bool theCumOri, TraversalMode theMode=TraversalMode::Recursive)
 
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)
 
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
 
void Next ()
 
BRepGraphInc::NodeInstance Current () const
 
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, Product(part)->ShapeRoot and Occurrence->Product.
 
TopLoc_Location LocationOf (const BRepGraph_NodeId::Kind theKind) const
 
BRepGraph_NodeId NodeOf (const BRepGraph_NodeId::Kind theKind) const
 
TopLoc_Location LocationAt (const int theLevel) const
 
BRepGraph_NodeId NodeAt (const int theLevel) const
 
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(assembly) -> Occurrences, Product(part) -> ShapeRoot, Occurrence -> Product.

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 )

◆ BRepGraph_ChildExplorer() [3/15]

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

◆ 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 )

◆ BRepGraph_ChildExplorer() [5/15]

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

◆ BRepGraph_ChildExplorer() [6/15]

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

◆ 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 )

◆ BRepGraph_ChildExplorer() [8/15]

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

◆ 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.

◆ BRepGraph_ChildExplorer() [10/15]

BRepGraph_ChildExplorer::BRepGraph_ChildExplorer ( const BRepGraph & theGraph,
const BRepGraph_ProductId theProduct,
BRepGraph_NodeId::Kind theTargetKind,
TraversalMode theMode )

◆ 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.

◆ 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 )

◆ 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 )

◆ 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.

◆ 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 )

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

◆ 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, Product(part)->ShapeRoot and Occurrence->Product.

◆ 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

◆ LocationOf()

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

◆ More()

bool BRepGraph_ChildExplorer::More ( ) const
inline

◆ Next()

void BRepGraph_ChildExplorer::Next ( )

◆ NodeAt()

BRepGraph_NodeId BRepGraph_ChildExplorer::NodeAt ( const int theLevel) const

◆ NodeOf()

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

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