alnvec_multi_widget.cpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:6k
- /*
- * ===========================================================================
- * PRODUCTION $Log: alnvec_multi_widget.cpp,v $
- * PRODUCTION Revision 1000.4 2004/06/01 21:07:22 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.13
- * PRODUCTION
- * ===========================================================================
- */
- /* $Id: alnvec_multi_widget.cpp,v 1000.4 2004/06/01 21:07:22 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: Andrey Yazhuk
- *
- * File Description:
- *
- */
- #include <ncbi_pch.hpp>
- #include <corelib/ncbistd.hpp>
- #include <gui/widgets/aln_multiple/align_row.hpp>
- #include <gui/widgets/aln_multiple/alnvec_multi_widget.hpp>
- BEGIN_NCBI_SCOPE
- ////////////////////////////////////////////////////////////////////////////////
- /// class CAlnVecMultiWidget
- CAlnVecMultiWidget::CAlnVecMultiWidget(int PosX, int PosY, int Width, int Height, const char* label)
- : CAlnMultiWidget(PosX, PosY, Width, Height, label),
- m_SignalStyle(CTraceGraphProperties::eCurve)
- {
- }
- CAlnVecMultiWidget::~CAlnVecMultiWidget()
- {
- delete m_pModel;
- m_pModel = NULL;
- }
- void CAlnVecMultiWidget::SetTraceGraphStyle(
- CTraceGraphProperties::ESingnalStyle style)
- {
- m_SignalStyle = style;
- CAlnVecMultiModel* p_model = GetAlnVecModel();
- if(p_model && m_pDataSource) {
- TNumrow n_rows = m_pDataSource->GetNumRows();
- for( TNumrow i = 0; i < n_rows; i++ ) {
- CAlnVecRow* p_row = p_model->SetAlnVecRow(i);
-
- x_SetSignalStyle(p_row);
- }
- }
- }
- void CAlnVecMultiWidget::x_SetSignalStyle(CAlnVecRow* p_row)
- {
- // obtain graph's properties
- const IAlnRowGraphProperties* gr_props = p_row->GetProperties();
- const CTraceGraphProperties* tr_props =
- dynamic_cast<const CTraceGraphProperties*>(gr_props);
- if(tr_props) { // modify and assign properties
- CTraceGraphProperties props = *tr_props;
- props.m_SignalStyle = m_SignalStyle;
- p_row->SetProperties(&props);
- }
- }
- void CAlnVecMultiWidget::x_CreateModel(void)
- {
- if(m_pModel == NULL) {
- CAlnVecMultiModel* p_model = new CAlnVecMultiModel();
- p_model->EnableScoring(true);
- m_pModel = p_model;
- } else _ASSERT(false);
- }
- void CAlnVecMultiWidget::x_UpdateOnDataChanged(bool reset)
- {
- CAlnMultiWidget::x_UpdateOnDataChanged(reset);
-
- _ASSERT(m_pAlignPane && m_pModel);
- CAlnVecMultiModel* p_model = dynamic_cast<CAlnVecMultiModel*>(m_pModel);
- if(p_model && m_pDataSource) {
- TNumrow n_rows = m_pDataSource->GetNumRows(); //### model ?
- for( TNumrow i = 0; i < n_rows; i++ ) {
- CAlnVecRow* p_row = p_model->SetAlnVecRow(i);
- p_row->SetHost(m_pAlignPane);
-
- x_SetSignalStyle(p_row);
- }
- }
- }
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: alnvec_multi_widget.cpp,v $
- * Revision 1000.4 2004/06/01 21:07:22 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.13
- *
- * Revision 1.13 2004/05/21 22:27:52 gorelenk
- * Added PCH ncbi_pch.hpp
- *
- * Revision 1.12 2004/04/29 21:49:04 johnson
- * make viewport reset in x_UpdateOnDataChanged optional
- *
- * Revision 1.11 2004/03/29 19:03:15 yazhuk
- * Added GetAlnVecModel() and Graph style management
- *
- * Revision 1.10 2004/03/25 13:18:49 dicuccio
- * MInor code reformatting
- *
- * Revision 1.9 2004/03/17 20:09:53 yazhuk
- * Factored out part of CAlnVecMultiWidget to separate class CAlnVecMultiModel
- *
- * Revision 1.8 2004/03/09 21:00:11 yazhuk
- * Separated part of the class into CAlnMultiModel.
- *
- * Revision 1.7 2004/02/11 17:44:12 yazhuk
- * Implemented support for multiple scoring methods
- *
- * Revision 1.6 2004/02/10 19:55:24 yazhuk
- * kColorGradNumber = 32
- *
- * Revision 1.5 2003/12/22 16:27:24 yazhuk
- * Replaced x_Update() with x_UpdateOnDataChanged(), GetStyleByRowNum()
- * with GetStyleForRow()
- *
- * Revision 1.4 2003/12/18 21:21:52 yazhuk
- * Implemented support for display styles
- *
- * Revision 1.3 2003/11/17 21:21:26 yazhuk
- * Fixed SetGapChar() call
- *
- * Revision 1.2 2003/11/03 16:58:20 yazhuk
- * Added p_row->SetHost() call to x_CreateRow()
- *
- * Revision 1.1 2003/10/29 23:29:49 yazhuk
- * Initial revision
- *
- * ===========================================================================
- */