⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 alnmulti_renderer.hpp

📁 ncbi源码
💻 HPP
字号:
/* * =========================================================================== * PRODUCTION $Log: alnmulti_renderer.hpp,v $ * PRODUCTION Revision 1000.1  2004/06/01 19:51:39  gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.11 * PRODUCTION * =========================================================================== */#ifndef __GUI_WIDGETS_ALNMULTI___ALNMULTI_RENDERER__HPP#define __GUI_WIDGETS_ALNMULTI___ALNMULTI_RENDERER__HPP/*  $Id: alnmulti_renderer.hpp,v 1000.1 2004/06/01 19:51:39 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/widgets/gl/ruler.hpp>#include <gui/widgets/aln_multiple/alnmulti_ds.hpp>#include <gui/widgets/aln_multiple/ialign_row.hpp>BEGIN_NCBI_SCOPE/////////////////////////////////////////////////////////////////////////////// IAlnMultiRendererContext - this interface represents context in which/// CAlnMultiRenderer lives. It provides callbacks necessary for Renderer's/// functioning.class NCBI_GUIWIDGETS_ALNMULTIPLE_EXPORT IAlnMultiRendererContext{public:    typedef IAlnMultiDataSource::TNumrow    TNumrow;        virtual ~IAlnMultiRendererContext()  {};    virtual const CGlPane& GetAlignPort(void) const = 0;            virtual TNumrow     GetLinesCount() = 0;    virtual bool    IsRendererFocused() = 0;    virtual int     GetFocusedItemIndex() const = 0;    virtual bool    IsItemSelected(int index) const = 0;        virtual IAlignRow*  GetMasterRow()= 0;        /// all Y coordinates are OpenGL Viewport coordinates (not widget coords)    /// "index" is a line index (not row in alignment)        virtual IAlignRow*  GetRowByLine(int index) = 0;    virtual int     GetLineByRowNum(TNumrow row) const = 0;    virtual int     GetLineByModelY(int y) const = 0;    virtual int     GetLinePosY(int index) const = 0;    virtual int     GetLineHeight(int index) const = 0;};/////////////////////////////////////////////////////////////////////////////////// class CAlnMultiRenderer - renders multiple alignment represented by/// IAlnMultiRendererContext (the Model)./// /// IAlnMultiRenderer renders a grid where row corresponds to IAlignRow object and/// columns represent different types of information related to rows. Columns are /// configurable using "Column management" API.class NCBI_GUIWIDGETS_ALNMULTIPLE_EXPORT CAlnMultiRenderer{public:    typedef IAlignRow::EColumnType      EColumnType;    typedef vector<CHTMLActiveArea>     TAreaVector;    CAlnMultiRenderer(const TVPRect& rc);    virtual ~CAlnMultiRenderer() {}    void    SetContext(IAlnMultiRendererContext* pContext);        void    SetBackColor(const CGlColor Color);    const CGlColor&    GetBackColor() const;    void    SetFocused(bool b_set)    {   m_bFocused  = b_set;  }        virtual void    Resize(const TVPRect& rc);    virtual void    Update();    /// renders OpenGL graphics    virtual void    Render();        /// renders OpenGL graphics and generate CHTMLActiveArea objects    virtual void    Render(TAreaVector& areas);         CRuler&    GetRuler();    void       SetRulerHeight(int height);        int     GetRulerAreaHeight()    const   {   return m_RulerAreaHeight;  }        int     GetMasterAreaHeight()    const   {   return m_MasterAreaHeight;  }        int     GetListAreaHeight() const   {   return m_ListAreaHeight;    }            int     GetListTop() const;    int     GetColumnIndexByType(EColumnType Type) const;    TVPRect         GetColumnRect(int i_col)   const;    TVPRect         GetColumnRect(EColumnType Type)   const;    EColumnType     GetColumnTypeByIndex(int i_col)   const;    EColumnType     GetColumnTypeByX(int X)   const;        /// return OpenGL viewport coordinate of the top pixel in the list area    int     GetVPListTop() const;            void    SetupPaneForRow(CGlPane& pane, const IAlignRow* p_row,                             int vp_top_y) const;    void    SetupPaneForColumn(CGlPane& pane, int i_col) const;        /// @name Columns management    /// @{    /// SColumn describes a single column    struct SColumn   {           int     m_Pos; /// horizontal position in viewport             int     m_Width; /// width in pixels        string  m_Label;                int     m_UserData; /// can be used to identify column               bool    m_bVisible;        double  m_Share; /// portion of the resizable space, negative if        /// this is a fixed size column.        SColumn();        inline  bool    FixedSize() const   {   return m_Share < 0.0;   }        inline  int     VisibleWidth()  const   {   return m_bVisible ? m_Width : 0;    }    };    /// Columns can be "fixed size" or "resizable". Fixed size columns are redndered    /// with specifed width. Remaining screen space is divided between "resizable"    /// columns proportionally to m_Share.    int     GetColumnsCount() const;    const   SColumn&  GetColumn(int index) const;    int     GetColumnIndexByX(int x) const;        int     AddColumn(void);    int     AddColumn(int width, const string& label, int data,                       double share = -1.0);    int     InsertColumn(int pos, int width, const string& label, int data,                         double share = -1.0);        void    SetColumnWidth(int index, int width);    void    SetColumnUserData(int index, int data);    void    SetColumnVisible(int index, bool b_visible);        void    UpdateColumns(); // update positions    /// @}protected:        IAlnMultiRendererContext* x_GetContext()    {   return m_pContext;   }    const IAlnMultiRendererContext* x_GetContext()  const    {   return m_pContext;   }    void    x_Layout();        // Rendering functions    void    x_Render(TAreaVector* p_areas);    void    x_RenderRuler(TAreaVector* p_areas);    void    x_RenderItems(TAreaVector* p_areas);    void    x_RenderItemsRange(int iFisrt, int iLast, TAreaVector* p_areas);        void    x_RenderRow(IAlignRow* pRow, CGlPane& pane, int State, int TopY,                        TAreaVector* p_areas);    void    x_RenderMasterRow();    void    x_ResetRowListMap();    void    x_PurgeRowListMap();    int     x_GetLineByWindowY(int WinY) const;    TVPRect x_GetLineRect(int Index);       inline EColumnType     x_GetColumnType(const SColumn& C)     {        return (IAlignRow::EColumnType) C.m_UserData;    }    void    x_LayoutColumns();    protected:    IAlnMultiRendererContext* m_pContext;    TVPRect m_rcBounds; // size of renderer in parents's coordinates    CGlColor m_BackColor;    CRuler  m_Ruler;    CGlPane m_RulerPane;        // Layout    int m_RulerAreaHeight;    int m_MasterAreaHeight;        int m_ListAreaHeight;        typedef     map<IAlignRow*, bool>     TRowToList;        TRowToList      m_RowToList; // value == "true" if key has an OpenGL Display List    // columns     typedef vector<SColumn> TColumnVector;    TColumnVector m_vColumns;    bool m_bFocused; /// indicate whether it shoulde be rendered using "focused"    // color or not};END_NCBI_SCOPE/* * =========================================================================== * $Log: alnmulti_renderer.hpp,v $ * Revision 1000.1  2004/06/01 19:51:39  gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.11 * * Revision 1.11  2004/05/05 14:18:50  dicuccio * Added virtual dtor * * Revision 1.10  2004/04/22 17:11:11  yazhuk * Added m_bFocused and SetFocused() * * Revision 1.9  2004/04/06 19:08:09  yazhuk * Added "TAreaVector* p_areas" argument ot x_RenderRuler * * Revision 1.8  2004/04/06 16:02:02  yazhuk * Added cloumns management API to CAlnMultiRenderer, eliminated CColumnWidget * * Revision 1.7  2004/04/06 13:29:59  dicuccio * CHanged TAreaVector to use CHTMLActiveArea directly * * Revision 1.6  2004/04/05 15:34:39  johnson * added a few consts to SetupPane methods * * Revision 1.5  2004/03/29 19:04:23  yazhuk * Support for  CHTMLActiveArea-s generation * * Revision 1.4  2004/03/17 20:12:03  yazhuk * Added GetLineByRowNum() * * Revision 1.3  2004/03/09 21:03:24  yazhuk * Clean-up * * Revision 1.2  2004/03/08 23:04:41  johnson * make CColumnWidget exportable for windows * * Revision 1.1  2004/03/08 15:37:14  yazhuk * Initial revision * * =========================================================================== */#endif  // __GUI_WIDGETS_ALNMULTI___ALNMULTI_RENDERER__HPP

⌨️ 快捷键说明

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