hit_matrix_pane.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:7k
- /*
- * ===========================================================================
- * PRODUCTION $Log: hit_matrix_pane.hpp,v $
- * PRODUCTION Revision 1000.2 2004/04/12 18:16:49 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [CATCHUP_003] Dev-tree R1.5
- * PRODUCTION
- * ===========================================================================
- */
- #ifndef __GUI_WIDGETS_HIT_MATRIX___HIT_MATRIX_PANE__HPP
- #define __GUI_WIDGETS_HIT_MATRIX___HIT_MATRIX_PANE__HPP
- /* $Id: hit_matrix_pane.hpp,v 1000.2 2004/04/12 18:16:49 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 <corelib/ncbistl.hpp>
- #include <gui/opengl/glcanvas2d.hpp>
- #include <gui/graph/axis.hpp>
- #include <gui/widgets/gl/ruler.hpp>
- #include <gui/widgets/gl/glpane_widget.hpp>
- #include <gui/widgets/gl/mouse_zoom_handler.hpp>
- #include <gui/widgets/gl/linear_sel_handler.hpp>
- #include <gui/widgets/gl/ruler.hpp>
- #include <gui/widgets/hit_matrix/hit_matrix_ds.hpp>
- #include <gui/widgets/hit_matrix/hit_matrix_graph.hpp>
- #include <gui/widgets/hit_matrix/seq_graph.hpp>
- BEGIN_NCBI_SCOPE
- class CHitMatrixWidget;
- ////////////////////////////////////////////////////////////////////////////////
- /// class CHitMatrixPane
- class NCBI_GUIWIDGETS_HIT_MATRIX_EXPORT CHitMatrixPane
- : public CGlPaneWidgetChild,
- public IMouseZoomHandlerHost,
- public IHitMatrixGraphHost,
- public ISelHandlerHost
- {
- public:
- typedef CHitMatrixGraph::TElemGlyphSet TElemGlyphSet;
- typedef CLinearSelHandler::TRangeColl TRangeColl;
- CHitMatrixPane(int PosX, int PosY, int Width, int Height, const char* Label = NULL);
- virtual TVPPoint GetPortSize(void);
- void SetWidget(CHitMatrixWidget* pParent);
-
- // FLTK overridables
- virtual void resize(int x, int y, int w, int h);
- // interface for a Widget
- virtual void Update(void);
-
- void ColorByScore(CConstRef<CObject_id> score_id);
- CConstRef<CObject_id> GetScoreId() const { return m_ColorScoreId; }
- CConstRef<CSeq_align_set> GetSelectedHits() const;
- TModelRect GetSelectedHitElemsRect() const;
- const TRangeColl& GetSubjectSelection() const;
- const TRangeColl& GetQuerySelection() const;
- // IMouseZoomHandlerHost implementation
- virtual TModelUnit MZHH_GetScale(EScaleType type);
- virtual void MZHH_SetScale(TModelUnit scale, const TModelPoint& point);
- virtual void MZHH_ZoomRect(const TModelRect& rc);
- virtual void MZHH_Scroll(TModelUnit d_x, TModelUnit d_y);
- virtual TVPUnit MZHH_GetVPPosByY(int y) const;
- virtual void MZHH_Redraw(void);
- // IMouseZoomHandlerHost end
- virtual void HMGH_Redraw(void);
- virtual TVPUnit HMGH_GetVPPosByY(int y) const;
- // ISelHandlerHost implementation
- virtual void SHH_Redraw();
- virtual TModelUnit SHH_GetModelByWindow(int z, EOrientation orient);
- virtual TVPUnit SHH_GetWindowByModel(TModelUnit z, EOrientation orient);
- // ISelHandlerHost end
- protected:
- void x_SetupAxes();
-
- /// CGlPaneWidgetChild overridables
- virtual void x_Render(void);
- virtual void x_OnShowPopup();
- CHitMatrixWidget* x_GetParent() { return m_pParent; }
- const CHitMatrixWidget* x_GetParent() const { return m_pParent; }
- void x_Layout(void);
- // Rendering functions
- void x_RenderContent(void);
- void x_RenderAxisAndGrid(CGlPane& gr_pane);
- void x_RenderSeqPanes();
- void x_RenderMouseZoomHandler(CGlPane& pane);
- void x_RenderSelHandler(bool b_horz, CGlPane& pane, CLinearSelHandler::ERenderingOption option);
-
- /// adjusts limits and visible rect of the given pane to the master pane
- void x_AdjsutToMasterPane(CGlPane& pane, bool b_model_x, bool b_model_y);
- virtual int x_GetAreaByMousePos();
- protected:
- enum EHandlerArea {
- fMatrixArea = 0x1,
- fSubjectArea = 0x2,
- fQueryArea = 0x4,
- fOther = 0x80000000,
- fAllAreas = fMatrixArea | fSubjectArea | fQueryArea | fOther
- };
- CHitMatrixWidget *m_pParent;
- CGlPane m_MatrixPane;
- CGlPane m_SubjectPane;
- CGlPane m_QueryPane;
-
- /// rectangle in OpenGL coordinates
- TVPRect m_rcMatrix;
- TVPRect m_rcLeftSeq;
- TVPRect m_rcBottomSeq;
- TVPRect m_rcAxes;
- CGlColor m_BackColor;
- CGlBitmapFont *m_pTextFont;
- CGlBitmapFont *m_pSeqFont;
- CConstRef<CObject_id> m_ColorScoreId; // identifies a score to color by
- // event handlers
- CMouseZoomHandler m_MouseZoomHandler;
- CLinearSelHandler m_HorzSelHandler;
- CLinearSelHandler m_VertSelHandler;
-
- // graphical objects
- CRegularGridGen m_Gen;
- CRegularGridRenderer m_Grid;
-
- CRuler m_BottomRuler;
- CRuler m_TopRuler;
- CRuler m_LeftRuler;
- CRuler m_RightRuler;
-
- CHitMatrixGraph m_Graph;
- CSequenceGraph m_QueryGraph;
- CSequenceGraph m_SubjectGraph;
- };
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: hit_matrix_pane.hpp,v $
- * Revision 1000.2 2004/04/12 18:16:49 gouriano
- * PRODUCTION: UPGRADED [CATCHUP_003] Dev-tree R1.5
- *
- * Revision 1.5 2004/02/12 21:04:28 yazhuk
- * Added GetSelectedHitElemsRect() const; implemented x_OnShowPopup();Implemented
- *
- * Revision 1.4 2003/12/10 16:58:23 yazhuk
- * Updated implementation of IMouseZoomHandlerHost interface.
- *
- * Revision 1.3 2003/12/05 17:35:07 yazhuk
- * Functions for retrieving selection, support for coloration by score
- *
- * Revision 1.2 2003/12/01 17:07:02 yazhuk
- * Eliminated IHitMatrixParent; refactored event handling; added support for linear selection.
- *
- * Revision 1.1 2003/11/17 21:00:14 yazhuk
- * Initial revision
- *
- * ===========================================================================
- */
- #endif // __GUI_WIDGETS_HIT_MATRIX___HIT_MATRIX_PANE__HPP