📄 phylo_tree_pane.hpp
字号:
/* * =========================================================================== * PRODUCTION $Log: phylo_tree_pane.hpp,v $ * PRODUCTION Revision 1000.2 2004/06/02 20:23:49 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.9 * PRODUCTION * =========================================================================== */#ifndef __GUI_WIDGETS_PHYLO_TREE___PHYLO_TREE_PANE__HPP#define __GUI_WIDGETS_PHYLO_TREE___PHYLO_TREE_PANE__HPP/* $Id: phylo_tree_pane.hpp,v 1000.2 2004/06/02 20:23: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: Vladimir Tereshkov * * 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/phylo_tree/phylo_tree_ds.hpp>#include <gui/widgets/phylo_tree/phylo_tree_pane.hpp>#include <gui/widgets/phylo_tree/phylo_tree_render.hpp>#include <gui/widgets/phylo_tree/phylo_tree_rect_cladogram.hpp>#include <gui/widgets/phylo_tree/phylo_tree_slated_cladogram.hpp>#include <gui/widgets/phylo_tree/phylo_tree_radial.hpp>#include <gui/widgets/phylo_tree/phylo_tree_force.hpp>#include <gui/widgets/fl/tooltip.hpp>#include <gui/utils/view_event.hpp>BEGIN_NCBI_SCOPEclass CPhyloTreeWidget;/////////////////////////////////////////////////////////////////////////////////// class CPhyloTreePane class NCBI_GUIWIDGETS_PHYLO_TREE_EXPORT CPhyloTreePane : public CGlPaneWidgetChild, public IMouseZoomHandlerHost, public ISelHandlerHost, public IPhyloTreeRendererHost, public ITooltipClient{public: typedef CLinearSelHandler::TRangeColl TRangeColl; typedef vector<IPhyloTreeRenderer*> TRenderers; CPhyloTreePane(int PosX, int PosY, int Width, int Height, const char* Label = NULL); virtual TVPPoint GetPortSize(void); void SetWidget(CPhyloTreeWidget* pParent); TRenderers & GetRenderers(void) { return m_Renderers; } Int4 GetCurrRendererIdx(void) { return m_CurrRenderer; } IPhyloTreeRenderer* GetCurrRenderer(void) { return m_Renderers[m_CurrRenderer]; } void SetCurrRendererIdx(Int4 idx); void AddRenderer(IPhyloTreeRenderer * renderer); //selections const vector<int> & GetSelectedIDs(void) {return GetCurrRenderer()->GetSelectedIDs(); } void SetSelectedIDs(const vector<int> & vect) {GetCurrRenderer()->SetSelectedIDs(vect); } // FLTK overridables virtual void resize(int x, int y, int w, int h); // interface for a Widget virtual void Update(void); virtual int handle(int event); 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; virtual void FireCBEvent(void); // ISelHandlerHost implementation virtual void SHH_Redraw(); virtual TModelUnit SHH_GetModelByWindow(int z, EOrientation orient); virtual TVPUnit SHH_GetWindowByModel(TModelUnit z, EOrientation orient); // ISelHandlerHost end // ITooltipClient implementation virtual bool TC_NeedTooltip(int x, int y); virtual string TC_GetTooltip(int& x, int& y, int& w, int& h); protected: Int4 m_CurrRenderer; TRenderers m_Renderers; void x_SetupAxes(); /// CGlPaneWidgetChild overridables virtual void x_Render(void); virtual void x_OnShowPopup(); virtual int x_HandleMouseRelease(); public: CPhyloTreeWidget* x_GetParent() { return m_pParent; } const CPhyloTreeWidget* x_GetParent() const { return m_pParent; }protected: 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 }; CPhyloTreeWidget *m_pParent; CGlPane m_MatrixPane; /// rectangle in OpenGL coordinates TVPRect m_rcMatrix; TVPRect m_rcLeftSeq; TVPRect m_rcBottomSeq; TVPRect m_rcAxes; CGlColor m_BackColor; CGlBitmapFont *m_pTextFont; CGlBitmapFont *m_pLblFont; // 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; CTooltip m_Tooltip;};END_NCBI_SCOPE/* * =========================================================================== * $Log: phylo_tree_pane.hpp,v $ * Revision 1000.2 2004/06/02 20:23:49 gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.9 * * Revision 1.9 2004/06/02 16:38:59 tereshko * Fixed selections and popup behavior under windows * * Revision 1.8 2004/05/06 19:41:07 tereshko * Added force layout * * Revision 1.7 2004/04/13 20:29:22 tereshko * Numerous renderers improvements * * Revision 1.6 2004/03/30 17:11:08 tereshko * Added support for events broadcasting * * Revision 1.5 2004/03/03 21:42:31 tereshko * Added tooltips support * * Revision 1.4 2004/03/02 18:29:24 tereshko * Added radial tree layout * * Revision 1.3 2004/02/17 23:44:17 tereshko * Changes due to integration into viewer * * Revision 1.2 2004/02/13 21:18:35 tereshko * Updated to implement new interface functions * * Revision 1.1 2004/02/13 17:00:00 tereshko * Phylogenetic Tree Widget initial revision * * =========================================================================== */#endif // __GUI_WIDGETS_PHYLO_TREE___PHYLO_TREE_PANE__HPP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -