view_taxtree.cpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:5k
- /*
- * ===========================================================================
- * PRODUCTION $Log: view_taxtree.cpp,v $
- * PRODUCTION Revision 1000.2 2004/06/01 21:02:59 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.7
- * PRODUCTION
- * ===========================================================================
- */
- /* $Id: view_taxtree.cpp,v 1000.2 2004/06/01 21:02:59 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 <ncbi_pch.hpp>
- #include <gui/core/plugin_utils.hpp>
- #include <gui/core/version.hpp>
- #include <gui/plugin/PluginRequest.hpp>
- #include <gui/plugin/PluginCommand.hpp>
- #include <gui/plugin/PluginCommandSet.hpp>
- #include <gui/plugin/PluginInfo.hpp>
- #include <gui/plugin/PluginValue.hpp>
- #include <gui/widgets/tax_tree/tax_tree_ds.hpp>
- #include <objects/seq/Bioseq.hpp>
- #include <objects/seqloc/Seq_id.hpp>
- #include <algorithm>
- #include "view_taxtree.hpp"
- BEGIN_NCBI_SCOPE
- USING_SCOPE(objects);
- #include "view_taxtree_.cpp"
- EVENT_MAP_RX_BEGIN(CViewTaxTree)
- EVENT_FORWARD(CViewEvent::eSelectionChanged, m_TaxTree)
- EVENT_MAP_RX_END
- void CViewTaxTree::GetInfo(CPluginInfo& info)
- {
- info.Reset();
- // version info macro
- info.SetInfo(CPluginVersion::eMajor, CPluginVersion::eMinor, 0,
- string(__DATE__) + " " + string(__TIME__),
- "CViewTaxTree", "Common Tree",
- "View a common tree created around the selected sequences",
- "");
- // command info
- CPluginCommandSet& cmds = info.SetCommands();
- CPluginCommand& args = cmds.AddViewCommand(eViewCommand_new_view);
- args.AddArgument("ids", "Sequences",
- CSeq_id::GetTypeInfo(),
- CPluginArg::TData::e_Array);
- }
- CViewTaxTree::CViewTaxTree(const CPluginMessage& msg, const string& pool_name)
- : CView()
- {
- m_Window.reset(x_CreateWindow());
- const CPluginCommand& args = msg.GetRequest().GetCommand();
- GetArgValue(args["ids"], m_Ids);
- x_SetDocument(*m_Ids.front().first);
- CTaxTreeDS_ObjMgr::TUidVec ids;
- ids.reserve(m_Ids.size());
- ITERATE (plugin_args::TIdList, iter, m_Ids) {
- ids.push_back(iter->second);
- }
- m_DataSource.Reset
- (new CTaxTreeDS_ObjMgr(GetDocument()->GetScope(), ids));
- // create our view menu manager
- //m_ViewMenuMgr.reset(new CViewMenuMgr(m_Menu, "View/New View", this, pool_name));
- m_ViewMenuMgr.reset(new CViewMenuMgr(m_Menu, "View", this, pool_name));
- // setting host for sending events
- m_TaxTree->SetHost(this);
- }
- void CViewTaxTree::OnDocumentChanged()
- {
- m_TaxTree->SetDataSource(*m_DataSource);
- m_TaxTree->SetDisplayMode(CTaxTreeDataSource::eDisplay_Best);
- SetTitle(GetTitle());
- m_Window->redraw();
- if ( !GetSelBuffer() ) {
- ITERATE (plugin_args::TIdList, iter, m_Ids) {
- SetSelBuffer().AddSelection(iter->first, *iter->second);
- }
- }
- m_ViewMenuMgr->AddActiveViews(m_Document);
- m_ViewMenuMgr->AddNewViews();// (m_Document);
- }
- const string& CViewTaxTree::GetTitle(void) const
- {
- static const string s_Title("Common Tree");
- return s_Title;
- }
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: view_taxtree.cpp,v $
- * Revision 1000.2 2004/06/01 21:02:59 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.7
- *
- * Revision 1.7 2004/05/21 22:27:50 gorelenk
- * Added PCH ncbi_pch.hpp
- *
- * Revision 1.6 2004/05/13 17:35:12 dicuccio
- * Renamed tax tree data source
- *
- * Revision 1.5 2004/04/16 14:47:57 dicuccio
- * Use appropriate ISelection interface for dynamic menus
- *
- * Revision 1.4 2004/04/09 16:53:49 tereshko
- * Added functionality to send/accept selections
- *
- * Revision 1.3 2004/04/07 13:05:11 dicuccio
- * Changed view API - require CPluginMessage instead of CPluginArgSet
- *
- * Revision 1.2 2004/04/01 19:07:15 dicuccio
- * Limit the nodes to the best representative nodes by default
- *
- * Revision 1.1 2003/12/22 19:35:42 dicuccio
- * Updated to match new APIs in IView. Added taxonomy tree / common tree browser
- *
- * ===========================================================================
- */