demo_taxplot3d_ui.cpp
来自「ncbi源码」· C++ 代码 · 共 217 行
CPP
217 行
/* * =========================================================================== * PRODUCTION $Log: demo_taxplot3d_ui.cpp,v $ * PRODUCTION Revision 1000.1 2004/06/01 21:13:56 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.4 * PRODUCTION * =========================================================================== *//* $Id: demo_taxplot3d_ui.cpp,v 1000.1 2004/06/01 21:13:56 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: * User interface demonstrating taxplot3d widgets */#include <ncbi_pch.hpp>#include "demo_taxplot3d_ui.hpp"#include <gui/utils/message_box.hpp>#include <objmgr/bioseq_handle.hpp>BEGIN_NCBI_SCOPE#include "demo_taxplot3d_ui_.cpp"// that's for demo purposes onlyint xTax=7227, yTax=6239, zTax=4932;string labelx, labely, labelz;Fl_Menu_Item taxonomy[] = { {"A. gambiae str. PEST", 0,0, (void*)"180454"}, {"A. thaliana (thale cress)",0,0,(void*)"3702"}, {"C. elegans", 0,0,(void*)"6239"}, {"C. parvum", 0,0,(void*)"5807"}, {"Candida albicans", 0,0,(void*)"5476"}, {"D. melanogaster (fruit fly)", 0,0,(void*)"7227"}, {"E. cuniculi", 0,0,(void*)"6035"}, {"E. histolytica",0,0,(void*)"5759"}, {"G. lamblia ATCC 50803", 0,0,(void*)"184922"}, {"Homo sapiens (human)", 0,0,(void*)"9606"}, {"Leishmania major", 0,0,(void*)"5664"}, {"M. grisea 70-15", 0,0,(void*)"242507"}, {"Mus musculus (house mouse)",0,0,(void*)"10090"}, {"Neurospora crassa", 0,0,(void*)"5141"}, {"P. falciparum 3D7", 0,0,(void*)"36329"}, {"P. yoelii yoelii", 0,0,(void*)"73239"}, {"Rattus norvegicus", 0,0,(void*)"10116"}, {"S. cerevisiae", 0,0,(void*)"4932"}, {"S. pombe (fission yeast)", 0,0,(void*)"4896"}, {"Trypanosoma brucei", 0,0,(void*)"5691"}, {"Trypanosoma cruzi", 0,0,(void*)"5693"}, {0}};void cb_Tax1(Fl_Widget * widget, void * data){ Fl_Menu_* mw = (Fl_Menu_*)widget; const Fl_Menu_Item* m = mw->mvalue(); xTax = NStr::StringToInt(string((char*)m->user_data())); labelx = m->label(); if(data) ((CDemo3DUI*)data)->updateDatasource();}void cb_Tax2(Fl_Widget * widget, void * data){ Fl_Menu_* mw = (Fl_Menu_*)widget; const Fl_Menu_Item* m = mw->mvalue(); yTax = NStr::StringToInt(string((char*)m->user_data())); labely = m->label(); if(data) ((CDemo3DUI*)data)->updateDatasource();}void cb_Tax3(Fl_Widget * widget, void * data){ Fl_Menu_* mw = (Fl_Menu_*)widget; const Fl_Menu_Item* m = mw->mvalue(); zTax = NStr::StringToInt(string((char*)m->user_data())); labelz = m->label(); if(data) ((CDemo3DUI*)data)->updateDatasource();}CDemo3DUI::CDemo3DUI(){ m_Window.reset(x_CreateWindow()); m_ShiLoader = new ShiLoader(); m_Progress->minimum(0); m_Progress->maximum(100); m_Progress->value(0); m_Tax1->deactivate(); m_Tax2->deactivate(); m_Tax3->deactivate();}CDemo3DUI::~CDemo3DUI(){ m_Window.reset(); m_Scope.Reset(); m_ObjMgr.Reset(); if (m_ShiLoader) delete m_ShiLoader;}void CDemo3DUI::Show(int argc, char** argv){ m_Tax1->menu(taxonomy); m_Tax1->value(5); m_Tax2->menu(taxonomy); m_Tax2->value(2); m_Tax3->menu(taxonomy); m_Tax3->value(17); m_Tax1->callback(cb_Tax1,(void*)this); m_Tax2->callback(cb_Tax2,(void*)this); m_Tax3->callback(cb_Tax3,(void*)this); cb_Tax1(m_Tax1, NULL); cb_Tax2(m_Tax2, NULL); cb_Tax3(m_Tax3, NULL); m_FileName->value("\\\\medic\\users\\taxplot\\data\\10090.shi"); m_Window->show(argc, argv); Fl::run();}void CDemo3DUI::x_OnLoadAccession(){ m_ShiLoader->setConnectionPoint(this); m_ShiLoader->loadFileNew(m_FileName->value()); m_Tax1->activate(); m_Tax2->activate(); m_Tax3->activate(); updateDatasource();}void CDemo3DUI::updateDatasource(){ CTaxplot3dDataSource * ds = m_ShiLoader->getData(xTax, yTax, zTax); ds->xLabel() = labelx; ds->yLabel() = labely; ds->zLabel() = labelz; m_3DWidget->SetDataSource(ds); }void CDemo3DUI::x_OnLoadFile(){ m_Window->hide();}void CDemo3DUI::fireEvent(eEventType eType, void * data){ switch (eType){ case IShiLoaderEvents::eProgress:{ int val = *(int*)data; m_Progress->value(val); string str("Loading, " + NStr::IntToString(val) + "% done"); m_Progress->label(str.c_str()); if (Fl::ready()) Fl::check(); break; } case IShiLoaderEvents::eLoaded:{ m_Progress->value(0); m_Progress->label(""); break; } }}END_NCBI_SCOPE/* * =========================================================================== * $Log: demo_taxplot3d_ui.cpp,v $ * Revision 1000.1 2004/06/01 21:13:56 gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.4 * * Revision 1.4 2004/05/21 22:27:56 gorelenk * Added PCH ncbi_pch.hpp * * Revision 1.3 2004/01/15 17:00:41 tereshko * Fix for 64 bit compiler * * Revision 1.2 2004/01/07 17:39:06 vasilche * Fixed include path to genbank loader. * * Revision 1.1 2004/01/05 16:21:22 tereshko * Initial revision * * =========================================================================== */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?