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

📄 regular_grid.hpp

📁 ncbi源码
💻 HPP
字号:
/* * =========================================================================== * PRODUCTION $Log: regular_grid.hpp,v $ * PRODUCTION Revision 1000.2  2004/06/01 19:48:24  gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.10 * PRODUCTION * =========================================================================== */#ifndef GUI_GRAPH___REGULAR_GRID__HPP#define GUI_GRAPH___REGULAR_GRID__HPP/*  $Id: regular_grid.hpp,v 1000.2 2004/06/01 19:48:24 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/opengl/glcolor.hpp>#include <gui/graph/igraph.hpp>#include <gui/opengl/glpane.hpp>/** @addtogroup GUI_GRAPH * * @{ */BEGIN_NCBI_SCOPE////////////////////////////////////////////////////////////////////////////////// CRegularGridGenclass NCBI_GUIGRAPH_EXPORT CRegularGridGen{public:    class const_iterator;    CRegularGridGen();    virtual ~CRegularGridGen();    //void SetScaleType(EScaleType TypeX, EScaleType TypeY);    void SetIntegerMode(bool IntegerX, bool IntegerY);        // set limitations on the CellSize in pixels    void    SetCellLimits(int Min, int Max);    void    EnableOneBased(bool en_x, bool en_y);    // iteration interface    void    GenerateGrid(CGlPane* pPane, bool bHorz);    const_iterator begin() const;    const_iterator end() const;protected:    static double   SelectBaseStep(double MinV, double MaxV );    static void     RoundRangeToStep(double& Start, double& Finish, double Step );    static double   SelectScreenStep(double BaseStep,  double MinStep, double MaxStep);protected:    static const int ms_StepK[];    int m_MinCellSize;    int m_MaxCellSize;        //EScaleType  m_XScaleType;    //EScaleType  m_YScaleType;        bool    m_IntegerX;    bool    m_IntegerY;    bool    m_OneBasedX;    bool    m_OneBasedY;        // Generation context    bool    m_bHorz;    double m_Start, m_Finish;    double m_Step;public:    class NCBI_GUIGRAPH_EXPORT const_iterator    {    public:        typedef double value_type;        typedef const value_type& const_reference;        const_iterator()  // end iterator            : m_Start(0), m_Finish(0), m_Step(0), m_Iter(0), m_Value(1)    {}        const_iterator(double Start, double Finish, double Step)              : m_Start(Start), m_Finish(Finish), m_Step(Step),  m_Iter(0), m_Value(Start)	{}                const_reference operator*()  const           {             return m_Value;           }        const_iterator& operator++()	    {            Inc();			return (*this);         }		const_iterator operator++(int)		{            const_iterator Tmp = *this;			Inc();			return Tmp;         }		        bool operator==(const const_iterator& I) const	    {            return (IsEnd() && I.IsEnd())  ||                    (m_Value == I.m_Value  &&  m_Step == I.m_Step  &&  m_Start == I.m_Start                    && m_Finish == I.m_Finish  &&  m_Iter == I.m_Iter);        }        bool operator!=(const const_iterator& I) const        {            return ! (*this==I);        }	protected:        bool IsEnd()   const   {   return m_Value > m_Finish;  }	        void Inc()        {            m_Value = m_Start + (++m_Iter) * m_Step;            if (m_Value > m_Finish)                m_Iter = -1;        }    protected:        double m_Start;        double m_Finish;        double m_Step;	int    m_Iter;	double m_Value;    };};////////////////////////////////////////////////////////////////////////////////// CRegularGridRendererclass NCBI_GUIGRAPH_EXPORT CRegularGridRenderer{public:    CRegularGridRenderer();    void    EnableIntegerCentering(bool b_en)   {   m_bCentering = b_en;  }    void    SetColor(const CGlColor& Color)     {   m_Color = Color;    }     void    Render(CGlPane* pAreaPane, CGlPane* pPane, CRegularGridGen* pGenerator);protected:    double      m_bCentering;    CGlColor    m_Color;};END_NCBI_SCOPE/* * =========================================================================== * $Log: regular_grid.hpp,v $ * Revision 1000.2  2004/06/01 19:48:24  gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.10 * * Revision 1.10  2004/05/11 18:54:43  dicuccio * Added doxygen modules info * * Revision 1.9  2003/11/17 20:29:56  yazhuk * Added support one-based grids and centering * * Revision 1.8  2003/10/08 14:11:30  dicuccio * Code clean-up.  Use <> instead of "" for #includes.  Moved CGlPane into opengl. * Moved CGlPoint and CGlRect into opengl. * * Revision 1.7  2003/09/04 13:58:42  dicuccio * Added export specifiers.  Inlined destructors of interface classes * * Revision 1.6  2003/08/14 18:00:45  yazhuk * Deleted CRegularGrid class * * Revision 1.5  2003/08/12 21:18:37  ucko * CRegularGridGen::const_iterator: don't try to inherit from iterator<>, * which is undefined (conditionalized out(!)) under G++ 2.95. * * Revision 1.4  2003/08/11 19:17:31  yazhuk * Iterator fix * * Revision 1.3  2003/08/11 16:08:26  yazhuk * Compilation fixes for GCC. * * Revision 1.2  2003/08/10 14:11:18  dicuccio * Compilation fixes for gcc * * Revision 1.1  2003/08/08 16:01:35  yazhuk * Initial revision. * * =========================================================================== */#endif

⌨️ 快捷键说明

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