phylo_tree_node.cpp

来自「ncbi源码」· C++ 代码 · 共 146 行

CPP
146
字号
/* * =========================================================================== * PRODUCTION $Log: phylo_tree_node.cpp,v $ * PRODUCTION Revision 1000.1  2004/06/01 21:11:39  gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.7 * PRODUCTION * =========================================================================== *//*  $Id: phylo_tree_node.cpp,v 1000.1 2004/06/01 21:11:39 gouriano Exp $ * =========================================================================== * *                            PUBLIC DOMAIN NOTICE *               National Center for Biotechnology Information * *  This software/database is a "United States Government Work" under the *  terms of the United States Copyright Act.  It was written as part of *  the author's official duties as a United States Government employee and *  thus cannot be copyrighted.  This software/database is freely available *  to the public for use. The National Library of Medicine and the U.S. *  Government have not placed any restriction on its use or reproduction. * *  Although all reasonable efforts have been taken to ensure the accuracy *  and reliability of the software and data, the NLM and the U.S. *  Government do not and cannot warrant the performance or results that *  may be obtained by using this software or data. The NLM and the U.S. *  Government disclaim all warranties, express or implied, including *  warranties of performance, merchantability or fitness for any particular *  purpose. * *  Please cite the author in any work or product based on this material. * * =========================================================================== * * Authors:  Vladimir Tereshkov * * File Description: * */#include <ncbi_pch.hpp>#include <gui/widgets/phylo_tree/phylo_tree_node.hpp>BEGIN_NCBI_SCOPECPhyloTreeNode::CPhyloTreeNode(){        m_ID       = -1;    m_Label    = "";    m_Distance = -1;    m_AnnWedge = 0;    m_Selected = false;    SetValue(this);}CPhyloTreeNode::CPhyloTreeNode(int id, string label, double dist){    m_ID        = id;    m_Label     = label;    m_Distance  = dist;    m_Selected  = false;    SetValue(this);}CPhyloTreeNode::~CPhyloTreeNode(){}const string & CPhyloTreeNode::GetLabel(void) const{    return m_Label;}const double CPhyloTreeNode::GetDistance(void) const{    return m_Distance > 0 ? m_Distance : 0;}void CPhyloTreeNode::SetLabel(string label){    m_Label = label;}void CPhyloTreeNode::SetDistance(double dist){    m_Distance = dist;}Int4 CPhyloTreeNode::CountLeafs(void){    Int4 lfCount = 0;    x_CountLeafs(this, lfCount);    return lfCount;   }void CPhyloTreeNode :: x_CountLeafs(CPhyloTreeNode * node, Int4 & lfCount){         if (node->IsLeaf()) lfCount++;        for (CPhyloTreeNode::TNodeList_I  it = node->SubNodeBegin();  it != node->SubNodeEnd(); it++) x_CountLeafs((*it)->GetValue(), lfCount);    }const double    CPhyloTreeNode :: GetDistFromRoot(void) const{    double fullDist = GetDistance();    CPhyloTreeNode * node = GetValue();        while (node->GetParent()) {        node = node->GetParent()->GetValue();        fullDist += node->GetDistance();    }    return fullDist;}END_NCBI_SCOPE/* * =========================================================================== * $Log: phylo_tree_node.cpp,v $ * Revision 1000.1  2004/06/01 21:11:39  gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.7 * * Revision 1.7  2004/05/21 22:27:54  gorelenk * Added PCH ncbi_pch.hpp * * Revision 1.6  2004/04/28 19:27:10  tereshko * Added support for distances rendering * * Revision 1.5  2004/04/20 21:57:19  tereshko * Major rendering, labeling and performance improvements * * Revision 1.4  2004/03/30 17:11:44  tereshko * Added support for events broadcasting * * Revision 1.3  2004/03/02 18:28:32  tereshko * Added support for calculating annual vertex weight * * Revision 1.2  2004/02/17 23:44:41  tereshko * Changes due to integration into viewer * * Revision 1.1  2004/02/13 17:05:03  tereshko * Phylogenetic Tree Widget initial revision * * =========================================================================== */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?