hit_matrix_pane.cpp

来自「ncbi源码」· C++ 代码 · 共 570 行 · 第 1/2 页

CPP
570
字号
        }    }    return b_first ? TModelRect(0, 0) : TModelRect(left, bottom, right + 1, top + 1);}const CHitMatrixPane::TRangeColl&     CHitMatrixPane::GetSubjectSelection() const{    return m_HorzSelHandler.GetSelection();}const CHitMatrixPane::TRangeColl&     CHitMatrixPane::GetQuerySelection() const{    return m_VertSelHandler.GetSelection();}void    CHitMatrixPane::x_Layout(void){        TVPPoint subj_gr_size = m_SubjectGraph.PreferredSize();    TVPPoint query_gr_size = m_QueryGraph.PreferredSize();    int mx_left = query_gr_size.X() + AXIS_AREA_W;    int mx_bottom = subj_gr_size.Y() + AXIS_AREA_H;    int mx_right = w() - AXIS_AREA_W;    int mx_top = h() - AXIS_AREA_H;    m_rcMatrix.Init(mx_left, mx_bottom, mx_right, mx_top);    m_rcAxes.Init(query_gr_size.X(), subj_gr_size.Y(), w(), h());    m_rcLeftSeq.Init(0, mx_bottom, query_gr_size.X(), mx_top);    m_rcBottomSeq.Init(mx_left, 0, mx_right, subj_gr_size.Y());    }void    CHitMatrixPane::x_RenderContent(void){    if(x_GetParent()) {        const CGlPane& VP = x_GetParent()->GetPort();                // prepare CGlPanes        TModelRect rc_M = VP.GetModelLimitsRect();          m_MatrixPane.SetModelLimitsRect(rc_M);            TModelRect rc_V = VP.GetVisibleRect();                m_MatrixPane.SetVisibleRect(rc_V);        x_AdjsutToMasterPane(m_SubjectPane, true, false);        x_AdjsutToMasterPane(m_QueryPane, false, true);        // now rendering        x_RenderAxisAndGrid(m_MatrixPane);        x_RenderSeqPanes();        m_Graph.Render(m_MatrixPane);        x_RenderSelHandler(true, m_MatrixPane, CLinearSelHandler::ePassiveState);                x_RenderSelHandler(false, m_MatrixPane, CLinearSelHandler::ePassiveState);        x_RenderMouseZoomHandler(m_MatrixPane);            }}void    CHitMatrixPane::x_RenderAxisAndGrid(CGlPane& gr_pane){    CGlPane pane(CGlPane::eNeverUpdate);    pane.SetViewport(m_rcAxes);            m_Grid.Render(&pane, &gr_pane, &m_Gen);    // draw horizonatl rulers    // draw bottom ruler    TVPRect rc_VP(m_rcMatrix.Left(), m_rcAxes.Bottom(), m_rcMatrix.Right(), m_rcMatrix.Bottom() - 1);    pane.SetViewport(rc_VP);    x_AdjsutToMasterPane(pane, true, false);    m_BottomRuler.Render(pane);    // draw top ruler    rc_VP.Init(m_rcMatrix.Left(), m_rcMatrix.Top() + 1, m_rcMatrix.Right(), m_rcAxes.Top());    pane.SetViewport(rc_VP);    x_AdjsutToMasterPane(pane, true, false);        m_TopRuler.Render(pane);    // draw vertical rulers    // draw left ruler    rc_VP.Init(m_rcAxes.Left(), m_rcMatrix.Bottom(), m_rcMatrix.Left() - 1, m_rcMatrix.Top());    pane.SetViewport(rc_VP);    x_AdjsutToMasterPane(pane, false, true);    m_LeftRuler.Render(pane);    // draw right ruler    rc_VP.Init(m_rcMatrix.Right() + 1, m_rcMatrix.Bottom(), m_rcAxes.Right(), m_rcMatrix.Top());    pane.SetViewport(rc_VP);    x_AdjsutToMasterPane(pane, false, true);    m_RightRuler.Render(pane);}void    CHitMatrixPane::x_RenderSeqPanes(){        m_SubjectGraph.Render(m_SubjectPane);    x_RenderSelHandler(true, m_SubjectPane, CLinearSelHandler::eActiveState);            m_QueryGraph.Render(m_QueryPane);    x_RenderSelHandler(false, m_QueryPane, CLinearSelHandler::eActiveState);}void    CHitMatrixPane::x_AdjsutToMasterPane(CGlPane& pane, bool b_model_x, bool b_model_y){    const CGlPane& VP = x_GetParent()->GetPort();                TModelRect rc_vis = VP.GetVisibleRect();    TModelRect rc_lim = VP.GetModelLimitsRect();      // assuming that Viewport in the pane has been set properly    if(! b_model_x) { // adjust horz range to represent pixels        int max_x = pane.GetViewport().Width() - 1;        rc_lim.SetHorz(0, max_x);        rc_vis.SetHorz(0, max_x);    }        if(! b_model_y) { // adjust vert range to represent pixels        int max_y = pane.GetViewport().Height() - 1;        rc_lim.SetVert(0, max_y);        rc_vis.SetVert(0, max_y);    }    pane.SetModelLimitsRect(rc_lim);        pane.SetVisibleRect(rc_vis);}int     CHitMatrixPane::x_GetAreaByMousePos(){    int vp_x = Fl::event_x();    int vp_y = h() - Fl::event_y();    if(m_rcMatrix.PtInRect(vp_x, vp_y)) {        return fMatrixArea;    } else if(m_rcBottomSeq.PtInRect(vp_x, vp_y)) {        return fSubjectArea;    } else if(m_rcLeftSeq.PtInRect(vp_x, vp_y)) {        return fQueryArea;    }    return fOther;}void    CHitMatrixPane::x_RenderMouseZoomHandler(CGlPane& pane){    glEnable(GL_BLEND);    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);    m_MouseZoomHandler.Render(pane);    glDisable(GL_BLEND);}void    CHitMatrixPane::x_RenderSelHandler(bool b_horz, CGlPane& pane, CLinearSelHandler::ERenderingOption option){    glEnable(GL_BLEND);    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);    CLinearSelHandler& handler = b_horz ? m_HorzSelHandler : m_VertSelHandler;    handler.Render(pane, option);    glDisable(GL_BLEND);        }/////////////////////////////////////////////////////////////////////////////////// IAlnMarkHandlerHost implementationTModelUnit  CHitMatrixPane::MZHH_GetScale(EScaleType type){    const CGlPane& VP = x_GetParent()->GetPort();    switch(type)    {    case eCurrent:   return VP.GetScaleX();    case eMin: return VP.GetMinScaleX();    case eMax: return VP.GetZoomAllScaleX();    default: _ASSERT(false); return -1;    }}void    CHitMatrixPane::MZHH_SetScale(TModelUnit scale, const TModelPoint& point) {    x_GetParent()->OnSetScaleX(scale, point);}void     CHitMatrixPane::MZHH_ZoomRect(const TModelRect& rc){    x_GetParent()->ZoomRect(rc);}void     CHitMatrixPane::MZHH_Scroll(TModelUnit d_x, TModelUnit d_y){    x_GetParent()->Scroll(d_x, d_y);}TVPUnit  CHitMatrixPane::MZHH_GetVPPosByY(int y) const{    return h() - 1  - y;}void    CHitMatrixPane::MZHH_Redraw(void){    redraw();}TVPUnit  CHitMatrixPane::HMGH_GetVPPosByY(int y) const{    return h() - 1  - y;}void    CHitMatrixPane::HMGH_Redraw(void){    redraw();}/////////////////////////////////////////////////////////////////////////////////// ISelHandlerHost implementationvoid CHitMatrixPane::SHH_Redraw(){    redraw();}TModelUnit  CHitMatrixPane::SHH_GetModelByWindow(int z, EOrientation orient){    switch(orient)  {    case eHorz: return m_MatrixPane.UnProjectX(z);    case eVert: return m_MatrixPane.UnProjectY(h() - z);    default:    _ASSERT(false); return -1;    }}TVPUnit     CHitMatrixPane::SHH_GetWindowByModel(TModelUnit z, EOrientation orient){    switch(orient)  {    case eHorz: return m_MatrixPane.ProjectX(z);    case eVert: return h() - m_MatrixPane.ProjectY(z);    default:    _ASSERT(false); return -1;    }}void    CHitMatrixPane::x_OnShowPopup(){    x_GetParent()->OnShowPopup();}END_NCBI_SCOPE/* * =========================================================================== * $Log: hit_matrix_pane.cpp,v $ * Revision 1000.3  2004/06/01 21:10:58  gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.9 * * Revision 1.9  2004/05/21 22:27:54  gorelenk * Added PCH ncbi_pch.hpp * * Revision 1.8  2004/02/12 21:05:21  yazhuk * Added GetSelectedHitElemsRect() const; implemented  x_OnShowPopup(); * Enabled "offset" mode in CGlPanes * * Revision 1.7  2004/01/08 19:48:05  yazhuk * Minor clean-up * * Revision 1.6  2003/12/10 16:57:18  yazhuk * Updated implementation of  IMouseZoomHandlerHost interface. * * Revision 1.5  2003/12/06 04:19:13  ucko * Avoid make_pair<>, which is broken on WorkShop. * * Revision 1.4  2003/12/05 17:35:23  yazhuk * Functions for retrieving selection, support for coloration by score * * Revision 1.3  2003/12/01 17:07:13  yazhuk * Eliminated IHitMatrixParent; refactored event handling; added support for linear selection. * * Revision 1.2  2003/11/18 17:57:23  yazhuk * Fixed GCC warnings * * Revision 1.1  2003/11/17 20:41:19  yazhuk * Initial revision * * =========================================================================== */

⌨️ 快捷键说明

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