seqgraphic_render.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:9k
- /*
- * ===========================================================================
- * PRODUCTION $Log: seqgraphic_render.hpp,v $
- * PRODUCTION Revision 1000.2 2004/06/01 19:53:28 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.5
- * PRODUCTION
- * ===========================================================================
- */
- #ifndef GUI_WIDGETS_SEQ_GRAPHIC___SEQGRAPHIC_RENDER__HPP
- #define GUI_WIDGETS_SEQ_GRAPHIC___SEQGRAPHIC_RENDER__HPP
- /* $Id: seqgraphic_render.hpp,v 1000.2 2004/06/01 19:53:28 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 Graphic Sequence view widget
- * Independent from FLTK.
- *
- */
- #include <gui/gui.hpp>
- #include <gui/opengl.h>
- #include <gui/objutils/objects.hpp>
- #include <gui/widgets/seq_graphic/features_panel_ir.hpp>
- #include <gui/widgets/gl/ruler.hpp>
- #include <gui/widgets/gl/html_active_area.hpp>
- #include <gui/widgets/seq_graphic/seqgraphic_ds.hpp>
- #include <gui/widgets/seq_graphic/seqgraphic_widget.hpp>
- #include <gui/objutils/utils.hpp>
- #include <gui/widgets/seq_graphic/seqgraphic_conf.hpp>
- BEGIN_NCBI_SCOPE
- USING_SCOPE(objects);
- class NCBI_GUIWIDGETS_SEQGRAPHIC_EXPORT CSeqGraphicRenderer : public CObject
- {
- public:
- typedef vector<CHTMLActiveArea> TAreaVector;
-
- enum ERenderPanel {
- eFeatures,
- eRuler,
- eNone
- };
- typedef ERenderPanel TRendererPanel;
- CSeqGraphicRenderer();
- ~CSeqGraphicRenderer();
- void SetDataSource(const TVPRect& rc, CSeqGraphicDataSource* ds);
- void SetConfig(CRef<CSeqGraphicConfig> config);
- void UpdateConfig();
- void ConfigureRenderPolicy();
- // Zoom set from 0 to 1
- float GetZoomX(void) const;
- void SetZoomX(float value);
-
- void ZoomInCenter();
- void ZoomOutCenter();
- void ZoomAll();
- TSeqRange GetVisibleRange() const;
-
- // scales the panels
- void SetScaleRef(TModelUnit m_x, TModelUnit m_y, const TModelPoint& point);
-
- void ZoomOnObject(const CLayoutObject* obj);
- void ZoomOnRange(const TSeqRange& range);
-
- // zoom 10x at the given screen coordinates
- void SetLensZoom(int x, int y);
- void CancelLensZoom();
-
- // Expose a few GlPanes
- CGlPane& GetFeatGlPane();
- CGlPane& GetRulerGlPane();
- // retrieve the expected height of this widget
- TModelUnit GetHeight();
-
- void Resize(const TVPRect& rc);
- void Render(void);
- // extended version for CGI use
- void Render(TAreaVector& areas);
- void Render(TAreaVector* areas);
-
- // is there a Layoutable object at this screen coordinates?
- const CLayoutObject* HitTest(int x, int y);
-
- TRendererPanel PanelHitTest(int x, int y) const;
- void GetTooltip(int x, int y, string* title);
-
- void Scroll(TModelUnit x, TModelUnit y);
- TModelUnit GetScrollLineSize();
- void ClearObjectSelection(void);
- void SelectObject(const CObject* obj);
-
- const TConstObjects& GetSelectedObjects(void) const;
-
- private:
- CSeqGraphicDataSource* m_DS;
-
- typedef vector<CGlPane*> TGlPanes;
- typedef vector<IRenderable*> TRenderables;
-
- TGlPanes m_AllPanes;
- TGlPanes m_ScrollXPanes;
- TGlPanes m_ScrollYPanes;
-
- TRenderables m_AllRenderers;
-
- CGlPane m_RP;
- CGlPane m_FP;
-
- CRuler m_RulerPanel;
- CFeaturesPanelIR m_FeatPanel;
-
- TModelPoint m_LensZoom;
- bool m_NeedLensZoom;
-
- void x_Draw(TAreaVector* p_areas);
- void x_DimDisplay();
- void x_SetupViewPorts(const TVPRect& rc);
- void x_SetupModelLimits();
-
- TModelUnit m_MinZoomX, m_MaxZoomX; // X axis zoom limits
-
- TConstObjects m_SelectedObjects; // selected features
-
- CRef<CSeqGraphicConfig> m_ConfigSettings;
- };
- inline
- const TConstObjects& CSeqGraphicRenderer::GetSelectedObjects(void) const
- {
- return m_SelectedObjects;
- }
- inline
- void CSeqGraphicRenderer::ClearObjectSelection(void)
- {
- m_SelectedObjects.clear();
- }
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: seqgraphic_render.hpp,v $
- * Revision 1000.2 2004/06/01 19:53:28 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.5
- *
- * Revision 1.5 2004/05/03 12:46:32 dicuccio
- * gui/utils ->gui/objutils where needed
- *
- * Revision 1.4 2004/04/16 14:35:17 dicuccio
- * Use TConstObjects instead of TObjSelection
- *
- * Revision 1.3 2004/04/06 13:32:14 dicuccio
- * Changed TAreaVector to use CHTMLActiveArea directly. Changed API of draw,
- * resize -> Draw, Resize to match coding standard
- *
- * Revision 1.2 2004/03/31 16:09:01 lebedev
- * Methods to get HTML active areas added.
- *
- * Revision 1.1 2004/03/24 15:13:26 dicuccio
- * MOved from src/ tree. Added function to compute the height of the renderer
- *
- * Revision 1.55 2004/03/23 12:33:55 lebedev
- * Made sequence and histograms bars a layout objects in the object panel.
- * Made segment map a number of layout objects. Get rid of fixed size rows in the object panel.
- *
- * Revision 1.54 2004/03/12 15:58:15 lebedev
- * ZoomAll method added
- *
- * Revision 1.53 2004/03/11 17:53:06 dicuccio
- * Deprecated typedefs TPosition, TDimension, TIndex, TColor. Use TSeqRange instead of TRange
- *
- * Revision 1.52 2004/02/13 18:14:34 lebedev
- * Make use of new ILayoutPolicy interface
- *
- * Revision 1.51 2004/02/10 13:15:34 lebedev
- * ISelHandlerHost interface implemented for selections on sequence pane
- *
- * Revision 1.50 2004/01/27 16:14:42 lebedev
- * Methods for working with selections added
- *
- * Revision 1.49 2004/01/20 20:34:12 rsmith
- * add ConfigureRenderPolicy and UpdateConfig methods, so that render policy can be changed on the fly.
- *
- * Revision 1.48 2004/01/16 18:43:56 dicuccio
- * Dropped const on GetTooltip() - cascade of const functions made inavlid by this
- *
- * Revision 1.47 2004/01/16 13:40:16 lebedev
- * Tooltips added
- *
- * Revision 1.46 2003/12/22 12:55:53 lebedev
- * Old files removed
- *
- * Revision 1.45 2003/12/16 18:56:37 lebedev
- * Introduced Rendering Policies for feature panels
- *
- * Revision 1.44 2003/12/09 12:40:00 lebedev
- * Implemented IMouseZoomHandlerHost interface for zooming and scrolling with mouse
- *
- * Revision 1.43 2003/11/18 00:56:21 yazhuk
- * Replaced ruller.hpp with ruler.hpp in the include
- *
- * Revision 1.42 2003/11/13 19:11:08 lebedev
- * Objects selection reorganized. One row ofset bug in selection fixed
- *
- * Revision 1.41 2003/11/13 15:31:53 lebedev
- * Methods to get visible sequence range added
- *
- * Revision 1.40 2003/11/04 12:43:06 lebedev
- * Ruler bar added
- *
- * Revision 1.39 2003/10/28 15:29:07 lebedev
- * Use new configuration library
- *
- * Revision 1.38 2003/10/24 13:59:56 lebedev
- * Make vertical scrollbar always visible
- *
- * Revision 1.37 2003/10/24 13:25:56 lebedev
- * Use logarithmic scale fo zoom.
- * Better scrolling in sequence pane.
- *
- * Revision 1.36 2003/10/22 18:32:56 lebedev
- * Histogram display of features added (and compressed display)
- * Zoom to mouse and scroll with mouse added.
- *
- * Revision 1.35 2003/10/15 14:06:47 rsmith
- * Remove redundant and erroneous specifiers (CGraphicRender::)
- *
- * Revision 1.34 2003/10/10 15:29:11 lebedev
- * Selection on a sequence and icon view added
- *
- * Revision 1.33 2003/10/09 20:15:39 dicuccio
- * Renamed CSeqPanel to CSequencePanel
- *
- * Revision 1.32 2003/10/09 16:27:09 lebedev
- * Widget redesign: Use independent IRenderable panels for display
- *
- * ===========================================================================
- */
- #endif /* GUI_WIDGETS_SEQ_GRAPHIC___SEQGRAPHIC_RENDER__HPP */