viewer.cpp

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

CPP
167
字号
/* * =========================================================================== * PRODUCTION $Log: viewer.cpp,v $ * PRODUCTION Revision 1000.4  2004/06/01 20:56:55  gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.7 * PRODUCTION * =========================================================================== *//*  $Id: viewer.cpp,v 1000.4 2004/06/01 20:56:55 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 "viewer.hpp"#include <gui/plugin/PluginInfo.hpp>#include <gui/plugin/PluginRequest.hpp>#include <gui/plugin/PluginCommand.hpp>#include <gui/plugin/PluginCommandSet.hpp>#include <gui/plugin/PluginArgSet.hpp>#include <gui/plugin/PluginArg.hpp>#include <gui/core/version.hpp>#include <gui/core/idocument.hpp>#include <gui/core/plugin_utils.hpp>#include <gui/utils/app_popup.hpp>#include <corelib/ncbiapp.hpp>#include <corelib/ncbireg.hpp>#include <objmgr/util/feature.hpp>#include <objmgr/util/sequence.hpp>BEGIN_NCBI_SCOPEUSING_SCOPE(ncbi::objects);// standard info boilerplatevoid CAlgoLinkOut_Viewer::GetInfo(CPluginInfo& info){    info.Reset();    // version info macro    info.SetInfo(CPluginVersion::eMajor, CPluginVersion::eMinor, 0,                 string(__DATE__) + " " + string(__TIME__),                 "CAlgoLinkOut_Viewer",                 "Link Out/View sequence in NCBI Web Viewer",                 "View this sequence on the NCBI Web Site", "");    // command info    CPluginCommandSet& cmds = info.SetCommands();    CPluginCommand&    args = cmds.AddAlgoCommand(eAlgoCommand_run);    args.AddArgument("seq-id", "Sequence ID to view",                     CSeq_id::GetTypeInfo());}// run our pluginvoid CAlgoLinkOut_Viewer::RunCommand(CPluginMessage& msg){    const CPluginCommand& args = msg.GetRequest().GetCommand();    CPluginReply& reply = msg.SetReply();    plugin_args::TIdList ids;    GetArgValue(args["seq-id"], ids);    const CSeq_id&   id  = *ids.front().second;    const IDocument& doc = *ids.front().first;    // retrieve the default link for Viewer    CNcbiApplication* app = CNcbiApplication::Instance();    _ASSERT(app);    const CNcbiRegistry& reg = app->GetConfig();    string viewer_url =        reg.GetString("LINKOUT", "Viewer",                      "http://www.ncbi.nlm.nih.gov/entrez/viewer.fcgi"                      "?val=<gi>");    //    // get gi from id    //    string id_str;    if ( id.IsGi() ) {        id_str = NStr::IntToString(id.GetGi());    } else {        CBioseq_Handle handle = doc.GetScope().GetBioseqHandle(id);        if ( !handle ) {            reply.SetStatus(eMessageStatus_failed);            return;        }        const CSeq_id& gi_id =            sequence::GetId(handle, sequence::eGetId_ForceGi);        id_str = NStr::IntToString(gi_id.GetGi());    }    //    // finalize our URL and launch!    //    viewer_url = NStr::Replace(viewer_url, "<gi>", id_str);    if ( !CAppPopup::PopupURL(viewer_url) ) {        reply.SetStatus(eMessageStatus_failed);    } else {        reply.SetStatus(eMessageStatus_success);    }}END_NCBI_SCOPE/* * =========================================================================== * $Log: viewer.cpp,v $ * Revision 1000.4  2004/06/01 20:56:55  gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.7 * * Revision 1.7  2004/05/21 22:27:48  gorelenk * Added PCH ncbi_pch.hpp * * Revision 1.6  2004/03/05 17:36:08  dicuccio * Use sequence::GetId() instead of CSeq_id::GetStringDescr() * * Revision 1.5  2004/01/27 18:45:28  dicuccio * Added missing header files * * Revision 1.4  2003/11/24 15:45:31  dicuccio * Renamed CVersion to CPluginVersion * * Revision 1.3  2003/11/04 17:49:24  dicuccio * Changed calling parameters for plugins - pass CPluginMessage instead of paired * CPluginCommand/CPluginReply * * Revision 1.2  2003/09/29 15:37:13  dicuccio * Added more informative menu string * * Revision 1.1  2003/09/23 19:45:45  dicuccio * Initial revision * * =========================================================================== */

⌨️ 快捷键说明

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