NCBI C++ ToolKit
Classes | Functions
phylo_tree.hpp File Reference
#include <corelib/ncbistd.hpp>
#include <corelib/ncbiobj.hpp>
#include <gui/utils/vect2.hpp>
#include <gui/opengl/glrect.hpp>
#include <gui/widgets/phylo_tree/tree_model.hpp>
#include <gui/widgets/phylo_tree/tree_graphics_model.hpp>
#include <gui/widgets/phylo_tree/phylo_selection_set.hpp>
#include <gui/widgets/phylo_tree/phylo_tree_node.hpp>
+ Include dependency graph for phylo_tree.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Go to the SVN repository for this file.

Classes

class  CPhyloTree
 Tree subclass also has functions and data needed for rendering and selection. More...
 

Functions

template<class TTreeModel , class Fun >
void TreeDepthFirstEx (TTreeModel &tree_model, typename TTreeModel::TTreeIdx node_idx, Fun &func)
 Depth-first tree traversal that skips collapsed nodes. More...
 
template<class TTreeModel , class Fun >
void TreeDepthFirstEx (TTreeModel &tree_model, Fun &func)
 Calls TreeDepthFirst with the root node of 'tree_model'. More...
 
template<class TTreeModel , class Fun >
void TreeBreadthFirstEx (TTreeModel &tree_model, typename TTreeModel::TTreeIdx node_idx, Fun &func)
 Breadth-first tree traversal that skips collapsed nodes. More...
 
template<class TTreeModel , class Fun >
void TreeBreadthFirstEx (TTreeModel &tree_model, Fun &func)
 Calls TreeBreadthFirstEx with the root node of 'tree_model'. More...
 

Function Documentation

◆ TreeBreadthFirstEx() [1/2]

template<class TTreeModel , class Fun >
void TreeBreadthFirstEx ( TTreeModel &  tree_model,
Fun &  func 
)

Calls TreeBreadthFirstEx with the root node of 'tree_model'.

Definition at line 588 of file phylo_tree.hpp.

References TreeBreadthFirstEx().

◆ TreeBreadthFirstEx() [2/2]

template<class TTreeModel , class Fun >
void TreeBreadthFirstEx ( TTreeModel &  tree_model,
typename TTreeModel::TTreeIdx  node_idx,
Fun &  func 
)

Breadth-first tree traversal that skips collapsed nodes.

Traverse the tree in breadth-first order, skipping collapsed nodes.

Takes tree and visitor function and calls function for every node in the subtree rooted at node_idx

Functor should have the next prototype: ETreeTraverseCode Func(TTreeType& tree, TTreeType::TTreeIdx node, int delta) where node is a reference to the visited node index and delta_level reflects the current traverse direction(depth wise) in the tree, 0 - algorithm stays on the same level 1 - we are going one level deep into the tree (from the root)

See also
ETreeTraverseCode

Definition at line 525 of file phylo_tree.hpp.

References eTreeTraverse, eTreeTraverseStepOver, and eTreeTraverseStop.

Referenced by TreeBreadthFirstEx(), and CPhyloRectCladogram::x_DrawSplineTree().

◆ TreeDepthFirstEx() [1/2]

template<class TTreeModel , class Fun >
void TreeDepthFirstEx ( TTreeModel &  tree_model,
Fun &  func 
)

Calls TreeDepthFirst with the root node of 'tree_model'.

Definition at line 500 of file phylo_tree.hpp.

References TreeDepthFirstEx().

◆ TreeDepthFirstEx() [2/2]

template<class TTreeModel , class Fun >
void TreeDepthFirstEx ( TTreeModel &  tree_model,
typename TTreeModel::TTreeIdx  node_idx,
Fun &  func 
)

Depth-first tree traversal that skips collapsed nodes.

Identical to TreeDepthFirst except for the skipping of collapsed nodes.

Takes tree and visitor function and calls function for every node in the subtree rooted at node_idx

Functor should have the next prototype: ETreeTraverseCode Func(TTreeType& tree, TTreeType::TTreeIdx node, int delta) where node is a reference to the visited node index and delta_level reflects the current traverse direction(depth wise) in the tree, 0 - algorithm stays is on the same level 1 - we are going one level deep into the tree (from the root) -1 - we are traveling back by one level (getting close to the root)

The specificts of the algorithm is that it calls visitor both on the way from the root to leafs and on the way back Using this template we can implement both variants of tree traversal (pre-order and post-order) Visitor controls the traversal by returning ETreeTraverseCode

See also
ETreeTraverseCode

Definition at line 429 of file phylo_tree.hpp.

References eTreeTraverse, eTreeTraverseStepOver, and eTreeTraverseStop.

Referenced by TreeDepthFirstEx(), CPhyloCircularCladogram::x_Calculate(), CPhyloRadial::x_Calculate(), CPhyloRectCladogram::x_Calculate(), CPhyloSlantedCladogram::x_Calculate(), CPhyloForce::x_CalculateBoundary(), CPhyloRectCladogram::x_DrawPseudoSplineTree(), CPhyloCircularCladogram::x_DrawTree(), CPhyloRadial::x_DrawTreeVbo(), CPhyloSlantedCladogram::x_DrawTreeVbo(), and CPhyloTreePS::x_Init().

Modified on Fri Sep 20 14:58:06 2024 by modify_doxy.py rev. 669887