cross_aln_render.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:7k
- /*
- * ===========================================================================
- * PRODUCTION $Log: cross_aln_render.hpp,v $
- * PRODUCTION Revision 1000.2 2004/06/01 21:06:33 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.7
- * PRODUCTION
- * ===========================================================================
- */
- #ifndef GUI_WIDGETS_ALN_CROSSALN___CROSS_ALN_RENDER__HPP
- #define GUI_WIDGETS_ALN_CROSSALN___CROSS_ALN_RENDER__HPP
- /* $Id: cross_aln_render.hpp,v 1000.2 2004/06/01 21:06:33 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: Vlad Lebedev
- *
- * File Description:
- * Renderer for the CrossAlignment widget
- * Independent from FLTK.
- *
- */
- #include <gui/gui.hpp>
- #include <gui/opengl.h>
- #include <gui/widgets/seq_graphic/features_panel_ir.hpp>
- #include <gui/widgets/gl/ruler.hpp>
- #include <gui/widgets/aln_crossaln/cross_aln_ds.hpp>
- #include <gui/widgets/aln_crossaln/cross_aln_widget.hpp>
- #include <gui/widgets/aln_crossaln/cross_panel_ir.hpp>
- #include <gui/objutils/utils.hpp>
- #include <gui/objutils/objects.hpp>
- #include <gui/widgets/seq_graphic/seqgraphic_conf.hpp>
- BEGIN_NCBI_SCOPE
- USING_SCOPE(objects);
- class CCrossAlnRenderer : public CObject
- {
- public:
- enum ERenderPanel {
- eFeatures1,
- eRuler1,
- eCross,
- eFeatures2,
- eRuler2,
- eNone
- };
- typedef ERenderPanel TRendererPanel;
-
- CCrossAlnRenderer();
- ~CCrossAlnRenderer();
- void SetDataSource(const TVPRect& rc, CCrossAlnDataSource* ds);
- void SetConfig(CRef<CSeqGraphicConfig> config);
-
- void Update();
-
- // Colors
- //void SetColor(CSeqGraphicView::EDisplayElement elem, CGlColor color);
- //CGlColor GetColor(CSeqGraphicView::EDisplayElement elem) const;
-
- // Zoom set from 0 to 1
- float GetZoomX(void) const;
- void SetZoomX(float value);
-
- void ZoomInCenter();
- void ZoomOutCenter();
- // scales the panels
- void SetScaleRef1(TModelUnit m_x, TModelUnit m_y, const TModelPoint& point);
- void SetScaleRef2(TModelUnit m_x, TModelUnit m_y, const TModelPoint& point);
- void SetScaleRefC(TModelUnit m_x, TModelUnit m_y, const TModelPoint& point);
-
- void FitToWindow (void);
- void ZoomToSequence (void);
- void ZoomOnObject (const CLayoutObject* obj);
- void ZoomOnRange (const TSeqRange& range);
- void ZoomOnAlignment();
- CGlPane& GetFeatGlPane1();
- CGlPane& GetFeatGlPane2();
- CGlPane& GetCrossGlPane();
- void resize(const TVPRect& rc);
- void draw();
-
- // is there a Layoutable object at this screen coordinates?
- const CLayoutObject* HitTest(int x, int y);
-
- TRendererPanel PanelHitTest(int x, int y) const;
- CGlPane* PaneHitTest (int x, int y);
- void GetTooltip(int x, int y, string* title);
-
- void Scroll(TModelUnit x1, TModelUnit y1, TModelUnit x2, TModelUnit y2);
- TModelUnit GetScrollLineSize1();
- TModelUnit GetScrollLineSize2();
- void ClearObjectSelection(void);
- void SelectObject(const CObject* obj);
- const TConstObjects& GetSelectedObjects(void) const;
-
- private:
- CRef<CCrossAlnDataSource> m_DS;
-
- typedef vector<CGlPane*> TGlPanes;
- typedef vector<IRenderable*> TRenderables;
-
- TGlPanes m_AllPanes;
- TGlPanes m_ScrollXPanes1;
- TGlPanes m_ScrollXPanes2;
-
- TRenderables m_AllRenderers;
-
- CGlPane m_FP1;
- CGlPane m_RP1;
- CGlPane m_CP; // panel for cross-alignment with tricky model space
-
- CGlPane m_FP2;
- CGlPane m_RP2;
-
- CFeaturesPanelIR m_FeatPanel1;
- CRuler m_RulerPanel1;
- CCrossPanelIR m_CrossPanel;
- CFeaturesPanelIR m_FeatPanel2;
- CRuler m_RulerPanel2;
- // offset (shift) of second (bottom) sequence against the top sequence
- TSignedSeqPos m_Offset2;
- TSeqPos m_SeqLength1; // sequence lengths
- TSeqPos m_SeqLength2;
- void x_SetupViewPorts(const TVPRect& rc);
- void x_SetupModelLimits();
- void x_AdjustCrossPane();
-
- TModelUnit m_MinZoomX, m_MaxZoomX; // X axis zoom limits
-
- TConstObjects m_SelectedObjects; // selected features
- };
- inline
- const TConstObjects& CCrossAlnRenderer::GetSelectedObjects(void) const
- {
- return m_SelectedObjects;
- }
- inline
- void CCrossAlnRenderer::ClearObjectSelection(void)
- {
- m_SelectedObjects.clear();
- }
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: cross_aln_render.hpp,v $
- * Revision 1000.2 2004/06/01 21:06:33 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.7
- *
- * Revision 1.7 2004/05/03 13:23:57 dicuccio
- * gui/utils --> gui/objutils where needed
- *
- * Revision 1.6 2004/04/16 14:49:02 dicuccio
- * Use TConstObjects for handling object selections
- *
- * Revision 1.5 2004/03/11 17:50:41 dicuccio
- * Updated typedefs: dropped TDimension, TPosition, TIndex, TColor; use TSeqRange
- * instead of TRange
- *
- * Revision 1.4 2004/01/27 16:20:41 lebedev
- * Changed stored selection from CLayoutObject to CObject
- *
- * Revision 1.3 2004/01/16 19:17:06 tereshko
- * Removed const modifyer for GetTooltip method
- *
- * Revision 1.2 2004/01/16 13:40:39 lebedev
- * Tooltips added
- *
- * Revision 1.1 2003/12/22 13:12:34 lebedev
- * Initial revision
- *
- * ===========================================================================
- */
- #endif /* GUI_WIDGETS_ALN_CROSSALN___CROSS_ALN_RENDER__HPP */