1 // Copyright (C) 2005 OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : OPEN CASCADE
22 // File: GLViewer_Grid.h
23 // Created: November, 2004
25 #ifndef GLVIEWER_GRID_H
26 #define GLVIEWER_GRID_H
38 #pragma warning( disable:4251 )
41 /*! Class GLViewer_Grid
42 2D rectangular grid for GLViewer
43 Grid is adapt cells for current view
46 class GLVIEWER_API GLViewer_Grid
49 //! A default constructor
53 * \param width and \param height - width and height of grid
54 * \param winW and \param winH - width and height of window
55 * \param xSize and \param ySize - steps along x and y direction
56 * \param xPan and \param yPan - offsets along x and y direction
57 * \param xScale and \param yScal - scale factors along x and y direction
59 GLViewer_Grid( GLfloat width, GLfloat height,
60 GLfloat winW, GLfloat winH,
61 GLfloat xSize, GLfloat ySize,
62 GLfloat xPan, GLfloat yPan,
63 GLfloat xScale, GLfloat yScale );
69 //! Sets color of grid in RGB format
70 void setGridColor( GLfloat r, GLfloat g, GLfloat b );
71 //! Sets color of grid axes in RGB format
72 void setAxisColor( GLfloat r, GLfloat g, GLfloat b );
73 void setGridWidth( float );
74 //! Sets Radius of center point( begin coords )
75 void setCenterRadius( int );
77 //! Sets steps along x and y directions
78 void setSize( float xs, float ys );
79 //! Sets offset along x and y direction
80 void setPan( float xp, float yp );
81 //! Sets common scale factor along x and y direction
82 bool setZoom( float zoom );
83 //! Recomputes grid in new size and scale of view
84 void setResize( float winW, float winH, float Zoom );
86 void getSize( float&, float& ) const;
87 void getPan( float&, float& ) const;
88 void getScale( float&, float& ) const;
90 //! Sets step of scale
91 void setScaleFactor( int );
95 //! Initialize grid display list
99 GLfloat myGridColor[3];
100 GLfloat myAxisColor[3];
101 GLfloat myGridHeight;
112 GLfloat myCenterWidth;
113 GLint myCenterRadius;
115 GLboolean myIsUpdate;
119 #pragma warning ( default:4251 )