Sort(
TTreeIdxidx,
boolorder);
89 voidSortSubtreeDist(
TTreeIdxidx,
constvector<float>& distances,
boolorder);
96 voidSortLabel(
TTreeIdxidx,
boolorder);
105 constvector<pair<string,string> >& subtree_labels,
118 boolsel_children =
true,
119 boolsel_parents =
true);
130 voidGetSelState(TSelState& sel_state,
132 boolsel_children =
true,
133 boolsel_parents =
true)
const;
136 voidClearSelection();
141 voidGetSelected(vector<TTreeIdx>& sel)
const;
146 voidGetSelectedIDs(vector<TID>& sel)
const;
157 voidGetExplicitlySelected(vector<TTreeIdx>& esel)
const;
163 voidGetExplicitlySelectedAndNotCollapsed(vector<TTreeIdx>& esel)
const;
169 voidGetExplicitlySelectedIDs(vector<TID>& esel)
const;
177 voidSetExplicitlySelected(
constvector<TID>& esel);
183 voidSetLeavesExplicitlySelected();
190 voidSetSelection(
constvector<TTreeIdx>& sel,
191 boolsel_children =
true,
192 boolsel_parents =
true);
199 voidSetSelectionIDs(
constvector<TID>& ids,
boolsel=
true,
boolsel_children=
true);
201 bool HasSelection()
const{
return(m_Selected.size() > 0 ?
true:
false); }
222 boolSelectByPoint(
const CVect2<float>& pt,
boolsel,
booltoggle,
223 boollabels_visible,
boolrotated_labels=
false);
239vector<TTreeIdx> GetAllCollapsed()
const;
256 voidSetCurrentNode(
TTreeIdxnode_idx);
264 boolSetCurrentNode(
const CVect2<float>& pt,
boollabels_visible,
boolrotated_labels,
265 boolunselect=
true);
284 boolHasCurrentEdge()
const;
310 return(itNode != m_NodesMap.end()) ? itNode->second :
Null();
329 voidUpdateNodesMapping();
335 booloverride_explicit=
true);
340 voidx_SelectParents(
CPhyloTreeNode& node,
boolsel,
boolchildren_selected =
true);
348 voidx_GetParentState(TSelState& sel_state,
351 voidx_GetChildState(TSelState& sel_state,
428 template<
classTTreeModel,
classFun>
431 typedef typenameTTreeModel::TNodeType TNodeType;
436stop_scan = func(tree_model, node_idx, delta_level);
446TNodeType* tr = &tree_model[node_idx];
448 typedef typenameTNodeType::TNodeList_I TTreeNodeIterator;
450TTreeNodeIterator it = tr->SubNodeBeginEx();
451TTreeNodeIterator it_end = tr->SubNodeEndEx();
456stack<TTreeNodeIterator> tree_stack;
459tr = &tree_model[*it];
460stop_scan = func(tree_model, *it, delta_level);
469(delta_level >= 0) &&
472it = tr->SubNodeBeginEx();
473it_end = tr->SubNodeEndEx();
479 if(tree_stack.empty()) {
482it = tree_stack.top();
484tr = &tree_model[*it];
485it_end = tree_model[tr->GetParent()].SubNodeEndEx();
494func(tree_model, node_idx, -1);
499 template<
classTTreeModel,
classFun>
524 template<
classTTreeModel,
classFun>
527 typedef typenameTTreeModel::TNodeType TNodeType;
533stop_scan = func(tree_model, node_idx, delta_level);
542 typedef typenameTNodeType::TNodeList_I TTreeNodeIterator;
544queue<TTreeIdx> node_queue;
545node_queue.push(node_idx);
549 while(!node_queue.empty()) {
550 TTreeIdxnode_idx = node_queue.front();
553TNodeType* tr = &tree_model[node_idx];
555TTreeNodeIterator it = tr->SubNodeBeginEx();
556TTreeNodeIterator it_end = tr->SubNodeEndEx();
557 for(; it != it_end; ++it) {
558stop_scan = func(tree_model, *it, delta_level);
568node_queue.push(*it);
575 if(--level_count == 0) {
576level_count =
static_cast<int>(node_queue.size());
582func(tree_model, node_idx, -1);
587 template<
classTTreeModel,
classFun>
Tree subclass also has functions and data needed for rendering and selection.
CRef< CTreeGraphicsModel > m_GraphicsModel
Model for rendering (updated from current tree state)
bool IsUnused(TTreeIdx idx) const
Return true if the given position in the array is not currently included as a node in the tree.
TTIDPhyloTreeNodeMap m_NodesMap
CRef< CTreeGraphicsModel > GetGraphicsModelRef()
CPhyloTree & operator=(const CPhyloTree &)
TTreeIdx m_CurrentEdgeChild
Currently active edge (to allow re-rooting by edge).
map< TID, TTreeIdx > TTIDPhyloTreeNodeMap
Node ID to tree index map.
TTreeIdx m_CurrentNode
Currently active node (for operations like edit), or Null()
TTreeIdxSet m_ExplicitlySelected
Often when you select a node, it's children or parents may also join the selection set.
CPhyloNodeData::TClusterID TClusterID
bool HasSelection() const
CPhyloSelectionSetMgr & GetSelectionSets()
const CBioTreeFeatureDictionary & GetFeatureDict() const
TTreeIdx GetCurrentNodeIdx() const
Return the index of the currently active node (may be Null()).
CRef< CRgbaGradColorTable > m_ColorTable
Color table to store colors by index.
vector< TSelStateValue > TSelState
CPhyloTree(const CPhyloTree &)
Disable copy.
TTreeIdx m_CurrentEdgeParent
CPhyloSelectionSetMgr m_SelectionSets
Selection sets - sets of selected nodes, which are saved in the biotreecontainer in user data (visual...
const CPhyloSelectionSetMgr & GetSelectionSets() const
bool HasCurrentNode() const
Return true if the currently active node is not Null()
TTreeIdx FindNodeById(TID id) const
Return index of the node with the given id or Null().
set< TTreeIdx > TTreeIdxSet
Indices of all the nodes with selection state eSelected.
CBioTreeFeatureDictionary & GetFeatureDict()
Return feature dictionary.
pair< TTreeIdx, CPhyloNodeData::TSelectedState > TSelStateValue
size_t GetNumSelected() const
Returns the number of selected nodes.
CBioTreeFeatureDictionary m_FeatureDict
Feature dictionary.
void SetGraphicsModelRef(CRef< CTreeGraphicsModel > gm)
Set graphics model - may be needed if we want to render to different graphics contexts since graphics...
CRgbaGradColorTable Provides a storage for colors (to eliminate color creation overhead) and Function...
class CTreeGraphicsModel Model for rendering tree graphics data.
virtual void x_ConvertUpstream(TTreeIdx node_idx)
Convert parents of node_idx to be its children.
static TTreeIdx Null()
Return the index value that represents a NULL node.
void Clear()
Remove all nodes (empty array) and set root index to Null.
container_type::const_iterator const_iterator
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
ETreeTraverseCode
Tree traverse code returned by the traverse predicate function.
@ eTreeTraverseStop
Stop traversal (return form algorithm)
@ eTreeTraverse
Keep traversal.
@ eTreeTraverseStepOver
Do not traverse current node (pick the next one)
#define NCBI_GUIWIDGETS_PHYLO_TREE_EXPORT
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
void TreeBreadthFirstEx(TTreeModel &tree_model, typename TTreeModel::TTreeIdx node_idx, Fun &func)
Breadth-first tree traversal that skips collapsed nodes.
void TreeDepthFirstEx(TTreeModel &tree_model, typename TTreeModel::TTreeIdx node_idx, Fun &func)
Depth-first tree traversal that skips collapsed nodes.
size_t TTreeIdx
Bi-directionaly linked N way tree allocated in a contiguous memory block.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4