📄 axis.hpp
字号:
/* * =========================================================================== * PRODUCTION $Log: axis.hpp,v $ * PRODUCTION Revision 1000.1 2004/06/01 19:48:00 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.9 * PRODUCTION * =========================================================================== */#ifndef _AXIS_HPP#define _AXIS_HPP/* $Id: axis.hpp,v 1000.1 2004/06/01 19:48:00 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/glbitmapfont.hpp>#include <gui/graph/igraph.hpp>#include <gui/opengl/glpane.hpp>#include <gui/graph/regular_grid.hpp>/** @addtogroup GUI_GRAPH * * @{ */BEGIN_NCBI_SCOPE/////////////////////////////////////////////////////////////////////////////////// class CAxisRenderer// This class render an Axis with ticks and labels. CRegularGridGen provides// CAxisRenderer with positions whery ticks and labels should be drawn.class NCBI_GUIGRAPH_EXPORT CAxisRenderer{public: enum EPosition { ePosMin, ePosMax, ePosFixedValue }; enum ETextAlign { eLeftText, eRightText, eCenterText }; enum ETickStyle { eNoTick, eMinSide, eMaxSide, eBothSides };public: CAxisRenderer(bool bHorz = true); virtual ~CAxisRenderer(); void SetHorizontal(bool bHorz = true); void SetScaleType(EScaleType Type); // Axis position void SetPositionType(EPosition Type); void SetFixedPosition(TModelUnit Value); // Labels drawing attributes void SetTextAlign(ETextAlign Type); void SetFormattingTemplate(const string& sTempl); // printf style //void SetFont(CGlBitmapFont::EFont Type); // Tick drawing attributes void SetTickStyle(ETickStyle Style); void SetTickSize(int SizePix); // Colors void SetColor(CGlColor Color); void SetTextColor(CGlColor Color); virtual void Render(CGlPane* pAreaPane, CGlPane* pGraphPane, CRegularGridGen* pGen);protected: virtual void x_GenerateLabels(CGlPane* pAreaPane, CGlPane* pGraphPane, CRegularGridGen* pGen); virtual void x_LayoutLabels(int Start, int Finish); virtual void x_DrawHorzLabels(CGlPane* pAreaPane, CGlPane* pGraphPane, CRegularGridGen* pGen, int dTickMin, int dTickMax); // these functions could be overridden in order to customize generation of text labels virtual string x_FormatLabel(TModelUnit Value); virtual TModelUnit x_GetLabelValue(TModelUnit Value); protected: struct SLabelDescr { TModelUnit m_Value; string m_Str; int m_Pos; int m_Width; bool m_bVisible; SLabelDescr() : m_Value(0), m_Pos(0), m_Width(0), m_bVisible(true) {}; };protected: static const int kDefTickSize; bool m_bHorz; EScaleType m_Type; EPosition m_PosType; TModelUnit m_FixedPosValue; ETextAlign m_TextAlignType; string m_sFormatTempl; ETickStyle m_TickStyle; int m_TickSize; CGlColor m_Color; CGlColor m_TextColor; CGlBitmapFont m_Font; vector<SLabelDescr> m_vLabels;};/////////////////////////////////////////////////////////////////////////////////// class CAxisAreaclass CAxisArea{public: CAxisArea(); virtual ~CAxisArea(); virtual void SetupAxes(); void SetScaleType(EScaleType TypeX, EScaleType TypeY); void Render(CGlPane* pAreaPane, CGlPane* pGraphPane, CRegularGridGen* pGen);protected: CGlColor m_BoundsColor; CAxisRenderer m_XAxis; CAxisRenderer m_YAxis;};END_NCBI_SCOPE/* * =========================================================================== * $Log: axis.hpp,v $ * Revision 1000.1 2004/06/01 19:48:00 gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.9 * * Revision 1.9 2004/05/11 20:25:50 yazhuk * Made some functions virtual * * Revision 1.8 2004/05/11 18:54:43 dicuccio * Added doxygen modules info * * Revision 1.7 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.6 2003/09/25 20:38:52 yazhuk * Refactored rendering * * Revision 1.5 2003/09/17 16:15:05 dicuccio * Use CGlBitmapFont instead of CGlutFont * * Revision 1.4 2003/09/04 13:58:42 dicuccio * Added export specifiers. Inlined destructors of interface classes * * 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 + -