phylo_tree_ds.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:5k
- /*
- * ===========================================================================
- * PRODUCTION $Log: phylo_tree_ds.hpp,v $
- * PRODUCTION Revision 1000.1 2004/06/01 19:52:54 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.10
- * PRODUCTION
- * ===========================================================================
- */
- #ifndef GUI_WIDGETS_PHYLO_TREE__PHYLO_TREE_DS_HPP
- #define GUI_WIDGETS_PHYLO_TREE__PHYLO_TREE_DS_HPP
- /* $Id: phylo_tree_ds.hpp,v 1000.1 2004/06/01 19:52:54 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 <corelib/ncbistd.hpp>
- #include <corelib/ncbiobj.hpp>
- #include <corelib/ncbi_tree.hpp>
- #include <gui/widgets/phylo_tree/phylo_tree_node.hpp>
- #include <gui/widgets/phylo_tree/phylo_tree_reader.hpp>
- #include <gui/opengl/glpane.hpp>
- #include <algo/phy_tree/phy_tree_serial.hpp>
- #include <objmgr/scope.hpp>
- BEGIN_NCBI_SCOPE
- class NCBI_GUIWIDGETS_PHYLO_TREE_EXPORT CPhyloTreeDataSource : public CObject
- {
- public:
- typedef map<int, CPhyloTreeNode *> TNodeHash;
- typedef CPhyTreeSerial::TIds TIds;
- CPhyloTreeDataSource();
- CPhyloTreeDataSource(IPhyloTreeReader * reader);
- CPhyloTreeDataSource(TPhyTreeNode& node,
- const TIds& seqids,
- objects::CScope& scope);
- virtual ~CPhyloTreeDataSource();
- void Init(IPhyloTreeReader * reader);
- void Init(TPhyTreeNode & node, CPhyloTreeNode * pos);
- CPhyloTreeNode* GetTree(void);
- Int4 GetWidth(void) { return m_Width; }
- Int4 GetSize(void) { return m_Size; }
- void SetSelection(CPhyloTreeNode * node, bool bSel,
- bool andChilds = true, bool checkParents = true);
- vector<int> GetSelectedIds(void) const;
-
- TIds ConvertId2SeqId(const vector<int> & ids);
- vector<int> ConvertSeqId2Id(const TIds& seqids);
- TNodeHash& GetHash(void) { return m_Hash; }
- CPhyloTreeNode* GetNode(int idx);
- // returning calculated bounding rectangle
- const TModelRect GetBoundRect(void);
- // returning norm distance
- const double GetNormDistance(bool fromRoot=true);
- private:
- int m_Level;
- CPhyloTreeNode* m_Root;
- TNodeHash m_Hash;
-
- int m_Width;
- int m_Size;
- TIds m_SeqIds;
- CRef<objects::CScope> m_Scope;
-
- void x_MeasureTree(CPhyloTreeNode * node);
- void x_DescentToChilds(CPhyloTreeNode * node, bool bSel);
- void x_AscendToRoot(CPhyloTreeNode * node, bool bSel);
- };
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: phylo_tree_ds.hpp,v $
- * Revision 1000.1 2004/06/01 19:52:54 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.10
- *
- * Revision 1.10 2004/05/11 20:53:38 tereshko
- * Work in progress
- *
- * Revision 1.9 2004/04/28 19:27:27 tereshko
- * Added support for distances rendering
- *
- * Revision 1.8 2004/04/16 14:33:59 dicuccio
- * Formatting changes. Added typedefs for IDs, node map
- *
- * Revision 1.7 2004/04/13 20:29:22 tereshko
- * Numerous renderers improvements
- *
- * Revision 1.6 2004/04/02 16:20:29 yazhuk
- * Replaced vector<CRef<>> with vector<CConstRef<>>, added Scope data member
- *
- * Revision 1.5 2004/04/01 21:47:00 tereshko
- * Added ability of auto-selecting parent nodes
- *
- * Revision 1.4 2004/03/31 17:53:09 tereshko
- * Added function for retrieval of preprocessed selection
- *
- * Revision 1.3 2004/03/30 17:11:08 tereshko
- * Added support for events broadcasting
- *
- * Revision 1.2 2004/02/17 23:44:11 tereshko
- * Changes due to integration into viewer
- *
- * Revision 1.1 2004/02/13 16:59:58 tereshko
- * Phylogenetic Tree Widget initial revision
- *
- * ===========================================================================
- */
- #endif