seqgraphic_demo_ui.cpp

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

CPP
197
字号
/* * =========================================================================== * PRODUCTION $Log: seqgraphic_demo_ui.cpp,v $ * PRODUCTION Revision 1000.1  2004/06/01 21:13:12  gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.7 * PRODUCTION * =========================================================================== *//*  $Id: seqgraphic_demo_ui.cpp,v 1000.1 2004/06/01 21:13: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:  Vlad Lebedev * * File Description: * */#include <ncbi_pch.hpp>#include "seqgraphic_demo_ui.hpp"#include <gui/utils/message_box.hpp>#include <gui/utils/fltk_utils.hpp>#include <gui/widgets/seq_graphic/seqgraphic_conf.hpp>#include <objtools/data_loaders/genbank/gbloader.hpp>#include <serial/objistr.hpp>#include <objects/seq/Seq_annot.hpp>#include <serial/serial.hpp>BEGIN_NCBI_SCOPEUSING_SCOPE(objects);#include "seqgraphic_demo_ui_.cpp"CSeqGraphicDemoUI::CSeqGraphicDemoUI(){    m_Window.reset(x_CreateWindow());}CSeqGraphicDemoUI::~CSeqGraphicDemoUI(){    // these must be deleted in proper order    m_DataSource.Reset();    m_Window.reset();    m_Scope.Reset();    m_ObjMgr.Reset();}void CSeqGraphicDemoUI::Show(int argc, char** argv){    m_Accession->value("gi|");    m_Accession->redraw();    //m_InputFile->value("/Users/lebedev/seq1.asn");    //m_InputFile->redraw();        // Create an empty config and pass it to the widget    CRef<CSeqGraphicConfig> config( new CSeqGraphicConfig(NULL) );     config->SetHistogram(CSeqFeatData::e_Imp,                         CSeqFeatData::eSubtype_STS, true);    config->SetHistogram(CSeqFeatData::e_Imp,                         CSeqFeatData::eSubtype_repeat_region, true);    m_SeqWidget->SetConfig(config);        m_Window->show(argc, argv);    while (m_Window->shown()) {        Fl::wait();    }}void CSeqGraphicDemoUI::x_OnLoadAccession(){    CSeq_id id(m_Accession->value());    if (id.Which() == CSeq_id::e_not_set) {        string msg("Accession '");        msg += m_Accession->value();        msg += "' not recognized as a valid accession";        NcbiMessageBox(msg, eDialog_Ok, eIcon_Exclamation,                       "Unhandled Accession");        return;    }    if ( !m_ObjMgr ) {        m_ObjMgr.Reset(new CObjectManager());        m_ObjMgr->RegisterDataLoader(*new CGBDataLoader(),                                     CObjectManager::eDefault);        m_Scope.Reset(new CScope(*m_ObjMgr));        m_Scope->AddDefaults();    }    // retrieve our sequence    CBioseq_Handle handle = m_Scope->GetBioseqHandle(id);    if ( !handle ) {        string msg("Can't find sequence for accession '");        msg += m_Accession->value();        msg += "'";        NcbiMessageBox(msg, eDialog_Ok, eIcon_Exclamation,                       "Sequence Not Found");        return;    }    m_DataSource.Reset(new CSeqGraphicDataSource( *m_Scope, id));    m_SeqWidget->SetDataSource(m_DataSource.GetPointer());}void CSeqGraphicDemoUI::x_OnLoadFile(){    /*string filename(m_InputFile->value());    auto_ptr<CObjectIStream>    is(CObjectIStream::Open(eSerial_AsnText, filename));    CRef<CSeq_entry> aset(new CSeq_entry());    *is >> *aset;    if ( !m_ObjMgr ) {        m_ObjMgr.Reset(new CObjectManager());        m_ObjMgr->RegisterDataLoader(*new CGBDataLoader(),                                     CObjectManager::eDefault);        m_Scope.Reset(new CScope(*m_ObjMgr));        m_Scope->AddDefaults();    }    m_DataSource.Reset(new CSeqGraphicDataSource(m_Scope.GetObject(), id));    m_SeqWidget->SetDataSource(m_DataSource.GetPointer());*/}void CSeqGraphicDemoUI::x_SetZoomX(float zoom){    m_SeqWidget->SetZoomX(zoom);}void CSeqGraphicDemoUI::x_QuitApp(){    delete m_MainWindow;}END_NCBI_SCOPE/* * =========================================================================== * $Log: seqgraphic_demo_ui.cpp,v $ * Revision 1000.1  2004/06/01 21:13:12  gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.7 * * Revision 1.7  2004/05/21 22:27:55  gorelenk * Added PCH ncbi_pch.hpp * * Revision 1.6  2004/05/17 18:19:37  gorelenk * GetObject changed to deref. operator - causes problems on MSVC7 * * Revision 1.5  2004/03/11 17:53:06  dicuccio * Deprecated typedefs TPosition, TDimension, TIndex, TColor.  Use TSeqRange instead of TRange * * Revision 1.4  2004/02/13 18:10:01  lebedev * Demo updated to reflect changes in the widget * * Revision 1.3  2004/01/16 13:39:32  lebedev * Use default SeqGraphic configuration (CSeqGraphicConfig) for the demo * * Revision 1.2  2004/01/05 18:50:30  vasilche * Fixed path to include files. * * Revision 1.1  2003/12/22 12:55:00  lebedev * Initial revision * * =========================================================================== */

⌨️ 快捷键说明

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