Open CASCADE Technology  7.7.0
Static Public Member Functions
XCAFDoc_AssemblyTool Class Reference

Provides generic methods for traversing assembly tree and graph. More...

#include <XCAFDoc_AssemblyTool.hxx>

Static Public Member Functions

template<typename Func >
static void Traverse (XCAFDoc_AssemblyIterator theIterator, Func theFunc)
 Generic method for traversing assembly tree. Performs in-depth traversing of the assembly tree and calls user defined function for each assembly tree node. User function takes single argument of XCAFDoc_AssemblyItemId type and returns true/false to continue/break.

{
std::cout << theItem.ToString() << std::endl;
return Standard_True;
}

. More...

 
template<typename Func , typename Filter >
static void Traverse (const Handle< XCAFDoc_AssemblyGraph > &theGraph, Filter theFilter, Func theFunc, const Standard_Integer theNode=1)
 Generic method for traversing assembly graph. Performs in-depth traversing of the assembly graph beginning from root nodes and calls user defined function for each assembly graph node accepted by the user defined filtering function. Filtering function takes the assembly graph passed for traversing, current graph node ID and returns true/false to accept/reject node.

Standard_Boolean AcceptPartOnly(const Handle(XCAFDoc_AssemblyGraph)& theGraph,
const Standard_Integer theNode)
{
return (theGraph->GetNodeType(theNode) == XCAFDoc_AssemblyGraph::NodeType_Part);
}

User function theFunc takes the assembly graph passed for traversing, current graph node ID and returns true/false to continue/break. More...

 

Detailed Description

Provides generic methods for traversing assembly tree and graph.

Member Function Documentation

◆ Traverse() [1/2]

template<typename Func >
static void XCAFDoc_AssemblyTool::Traverse ( XCAFDoc_AssemblyIterator  theIterator,
Func  theFunc 
)
inlinestatic

Generic method for traversing assembly tree. Performs in-depth traversing of the assembly tree and calls user defined function for each assembly tree node. User function takes single argument of XCAFDoc_AssemblyItemId type and returns true/false to continue/break.

{
std::cout << theItem.ToString() << std::endl;
return Standard_True;
}

.

Parameters
[in]theIterator- starting position in the assembly tree.
[in]theFunc- user function called for each assembly tree node.

◆ Traverse() [2/2]

template<typename Func , typename Filter >
static void XCAFDoc_AssemblyTool::Traverse ( const Handle< XCAFDoc_AssemblyGraph > &  theGraph,
Filter  theFilter,
Func  theFunc,
const Standard_Integer  theNode = 1 
)
inlinestatic

Generic method for traversing assembly graph. Performs in-depth traversing of the assembly graph beginning from root nodes and calls user defined function for each assembly graph node accepted by the user defined filtering function. Filtering function takes the assembly graph passed for traversing, current graph node ID and returns true/false to accept/reject node.

Standard_Boolean AcceptPartOnly(const Handle(XCAFDoc_AssemblyGraph)& theGraph,
const Standard_Integer theNode)
{
return (theGraph->GetNodeType(theNode) == XCAFDoc_AssemblyGraph::NodeType_Part);
}

User function theFunc takes the assembly graph passed for traversing, current graph node ID and returns true/false to continue/break.

Parameters
[in]theGraph- assembly graph.
[in]theFilter- user filtering function called for each assembly graph node.
[in]theFunc- user function called for accepted assembly graph node.
[in]theNode- starting positive one-based graph node ID.

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