tax_tree_ds.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:6k
- /*
- * ===========================================================================
- * PRODUCTION $Log: tax_tree_ds.hpp,v $
- * PRODUCTION Revision 1000.0 2004/06/01 19:57:12 gouriano
- * PRODUCTION PRODUCTION: IMPORTED [GCC34_MSVC7] Dev-tree R1.1
- * PRODUCTION
- * ===========================================================================
- */
- #ifndef GUI_WIDGETS_TAX_TREE___TAX_TREE_DS__HPP
- #define GUI_WIDGETS_TAX_TREE___TAX_TREE_DS__HPP
- /* $Id: tax_tree_ds.hpp,v 1000.0 2004/06/01 19:57:12 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: Mike DiCuccio
- *
- * File Description:
- *
- */
- #include <corelib/ncbiobj.hpp>
- #include <objects/seqloc/Seq_id.hpp>
- #include <objects/taxon1/taxon1.hpp>
- #include <objmgr/scope.hpp>
- BEGIN_NCBI_SCOPE
- class CTaxTreeDataSource : public CObject
- {
- public:
- // enum to control the level of detail on our data retrieval and
- // presentation
- enum EDisplayMode {
- eDisplay_All,
- eDisplay_Best,
- eDisplay_Blast,
- eDisplay_Default = eDisplay_All
- };
- // tax-ids are always integers, with 0 = invalid
- typedef int TTaxId;
- // a UID four our data source is really a seq-id
- typedef CConstRef<objects::CSeq_id> TUid;
- typedef vector<TUid> TUidVec;
- // map of a tax-id to a set of UIDs that corrspond to this tax-id
- typedef map<TTaxId, TUidVec> TTaxMap;
- // retrieve the map of tax-ids
- virtual void GetTaxMap(TTaxMap& taxmap) = 0;
- // retrieve the UIDs from our data source
- virtual void GetUids(TUidVec& uids) = 0;
- // retrieve a title for a given UID
- virtual void GetTitle(const objects::CSeq_id& uid,
- string* title) const = 0;
- // retrieve a title for a given taxonomy node
- virtual void GetTitle(const objects::ITaxon1Node& node,
- string* title) const = 0;
- // retrieve an iterator for our taxonomy tree
- virtual objects::ITreeIterator&
- GetIterator(EDisplayMode mode = eDisplay_Default) = 0;
- // retrieve scope
- virtual const CRef<objects::CScope> & GetScope(void) = 0;
- };
- ////////////////////////////////////////////////////////////////////////////
- //
- // class CTaxTreeDS_ObjMgr provides a standard data source for the tax tree
- // widget whose data is derived from a set of seq-ids.
- //
- // This class will use a provided object manager scope to convert the seq-id
- // to its corresponding gi and build a CTaxon1 structure from these.
- //
- class NCBI_GUIWIDGETS_SEQ_EXPORT CTaxTreeDS_ObjMgr : public CTaxTreeDataSource
- {
- public:
- CTaxTreeDS_ObjMgr(objects::CScope& scope, const TUidVec& ids);
- // retrieve the map of tax-ids
- void GetTaxMap(TTaxMap& taxmap);
- // get our UIDs
- void GetUids(TUidVec& gis);
- // get a title for a given UID
- void GetTitle(const objects::CSeq_id& uids, string* title) const;
- // get a title for a given tax tree node
- void GetTitle(const objects::ITaxon1Node& node, string* title) const;
- // retrieve an iterator for our taxonomy tree
- objects::ITreeIterator& GetIterator(EDisplayMode mode = eDisplay_Default);
- // retrieve scope
- const CRef<objects::CScope> & GetScope(void);
-
- private:
- // our original IDs
- TUidVec m_Ids;
- // a non-const scope we can use to retrieve information about or sequences
- mutable CRef<objects::CScope> m_Scope;
- // a CTaxon1 class to manage our taxonomy ID conversion
- objects::CTaxon1 m_TaxCache;
- // display and tree iteration mode, controlling our depth of traversal and
- // the breadth of nodes included
- EDisplayMode m_Mode;
- // our iterator class
- mutable CRef<objects::ITreeIterator> m_Iter;
- // internal initialization hook
- void x_Init(void);
- };
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: tax_tree_ds.hpp,v $
- * Revision 1000.0 2004/06/01 19:57:12 gouriano
- * PRODUCTION: IMPORTED [GCC34_MSVC7] Dev-tree R1.1
- *
- * Revision 1.1 2004/05/13 17:31:17 dicuccio
- * Renamed data source file
- *
- * Revision 1.6 2004/04/09 16:53:08 tereshko
- * Added functionality to send/accept selections
- *
- * Revision 1.5 2004/04/07 12:43:43 dicuccio
- * Use CConstRef<CSeq_id> instead of int for sequence identification.
- * Added typedefs for working with sequences
- *
- * Revision 1.4 2004/04/01 19:03:41 dicuccio
- * Added support for limiting the tax tree to a more manageable set of nodes.
- *
- * Revision 1.3 2004/01/07 18:56:07 dicuccio
- * Added separate CTaxon1 class for doing popset joins
- *
- * Revision 1.2 2003/12/23 15:38:22 dicuccio
- * Added lots of comments. Made the classes gi-agnostic (UIDs instead). Altered
- * the data source to return an ITreeIterator
- *
- * Revision 1.1 2003/12/22 19:45:59 dicuccio
- * Initial revision
- *
- * ===========================================================================
- */
- #endif // GUI_WIDGETS_TAX_TREE___TAX_TREE_DS__HPP