taxplot3d_pane.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:6k
- /*
- * ===========================================================================
- * PRODUCTION $Log: taxplot3d_pane.hpp,v $
- * PRODUCTION Revision 1000.0 2004/04/12 19:33:11 gouriano
- * PRODUCTION PRODUCTION: IMPORTED [CATCHUP_003] Dev-tree R1.3
- * PRODUCTION
- * ===========================================================================
- */
- #ifndef GUI_WIDGETS_TAXPLOT3D___TAXPLOT_3D_PANE___HPP
- #define GUI_WIDGETS_TAXPLOT3D___TAXPLOT_3D_PANE___HPP
- /* $Id: taxplot3d_pane.hpp,v 1000.0 2004/04/12 19:33:11 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:
- * A child of CGlCanvas3d, this pane implements all basic 3d drawing functionality
- */
- #include <corelib/ncbistd.hpp>
- #include <gui/opengl/gldlist.hpp>
- #include <gui/opengl/glcanvas3d.hpp>
- #include "glmtransform.hpp"
- #include <gui/opengl/glbitmapfont.hpp>
- #include <gui/opengl/glcolortable.hpp>
- #include <gui/opengl/glutils.hpp>
- #include <gui/widgets/taxplot3d/taxplot3d_ds.hpp>
- #include <gui/widgets/taxplot3d/itaxplot3d_cp.hpp>
- #include <gui/widgets/fl/tooltip.hpp>
- BEGIN_NCBI_SCOPE
- class CTaxplot3dPanel : public CGlCanvas3d, public ITooltipClient
- {
- public:
- enum EViewMode {
- eCamera,
- eViewX,
- eViewY,
- eViewZ
- };
- enum EPivotPoint {
- eFloating,
- eFixed
- };
- enum EPrimitiveShape {
- eSphere,
- eCube,
- eCross
- };
- enum EGraphElement {
- eAxes,
- eGrid,
- eArrows,
- eLabels,
- eScale
- };
- // ctor
- CTaxplot3dPanel(int x, int y, int w, int h, const char* label = NULL);
- // overridden draw()
- void draw(void);
- // overridden handle()
- int handle(int event);
- // overridden resize()
- void resize(int x, int y, int w, int h);
-
- // ds
- void SetDataSource(CTaxplot3dDataSource * ds);
- // automation
- void SetAutomation(ITaxplot3dCP * pAuto) { m_Handler = pAuto; }
-
- // setting view options
- void setViewMode(EViewMode mode) { m_ViewMode = mode; }
- void setPivotPoint(EPivotPoint mode) { m_PivotPoint = mode; }
- void setPivotAttach(bool flag) { m_bPvAttach = flag; }
- bool getPivotAttach(void) { return m_bPvAttach; }
- void setPrimitiveShape(EPrimitiveShape shape) { m_PrimitiveShape = shape; }
- void setVisible(EGraphElement el, bool flag);
- bool getVisible(EGraphElement el);
- // redraw which invalidates display list
- void slowRedraw(void);
- // ITooltipClient implementation
- virtual bool TC_NeedTooltip(int x, int y);
- virtual string TC_GetTooltip(int& x, int& y, int& w, int& h);
- private:
- CTooltip m_Tooltip;
- EViewMode m_ViewMode;
- EPivotPoint m_PivotPoint;
- EPrimitiveShape m_PrimitiveShape;
- // visibility flags
- bool m_bAxes, m_bGrid, m_bArrows, m_bLabels, m_bScale;
- // pivot attached to focus?
- bool m_bPvAttach;
- // internal event states for better processing of drag events
- enum EState {
- eNormal,
- eRotate,
- ePan,
- eZoom
- };
- // the current state of the window
- EState m_State;
- // mouse transformations
- CGlMTransform m_Transform;
-
- // display list for our scene
- CGlDisplayList m_Dlist;
-
- // pivot point
- CVect3<float> m_Pivot;
- // data to plot
- CTaxplot3dDataSource * m_Data;
- // font
- CGlBitmapFont m_Font_Bitmap8x13;
- // automation
- ITaxplot3dCP * m_Handler;
-
- // drawings
- void drawPrimitive();
- void drawAxes();
- void drawScale();
- // helpful internals
- double GetBestStep(bool bNorm = false);
- CVect3<float> GetOGLPos(int x, int y);
- int findObject(int x, int y);
- void checkSelection(int x, int y);
- void transformView(void);
- void switch2ortho(void);
- };
- inline void CTaxplot3dPanel :: setVisible(EGraphElement el, bool flag)
- {
- switch (el){
- case eAxes: m_bAxes = flag; break;
- case eGrid: m_bGrid = flag; break;
- case eArrows: m_bArrows = flag; break;
- case eLabels: m_bLabels = flag; break;
- case eScale: m_bScale = flag; break;
- }
- }
- inline bool CTaxplot3dPanel :: getVisible(EGraphElement el)
- {
- switch (el){
- case eAxes: return m_bAxes;
- case eGrid: return m_bGrid;
- case eArrows: return m_bArrows;
- case eLabels: return m_bLabels;
- case eScale: return m_bScale;
- }
- // nothing is not visible
- return false;
- }
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: taxplot3d_pane.hpp,v $
- * Revision 1000.0 2004/04/12 19:33:11 gouriano
- * PRODUCTION: IMPORTED [CATCHUP_003] Dev-tree R1.3
- *
- * Revision 1.3 2004/01/28 15:56:29 tereshko
- * UI additions - scale, tooltips
- *
- * Revision 1.2 2004/01/14 16:39:22 tereshko
- * Minor changes due to integration with Taxplot viewer
- *
- * Revision 1.1 2004/01/05 16:20:49 tereshko
- * Initial revision
- *
- * ===========================================================================
- */
- #endif /* GUI_WIDGETS_TAXPLOT3D___TAXPLOT_3D_PANE___HPP */