Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GLViewer_Grid.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 
23 // Author : OPEN CASCADE
24 // File: GLViewer_Grid.h
25 // Created: November, 2004
26 //
27 #ifndef GLVIEWER_GRID_H
28 #define GLVIEWER_GRID_H
29 
30 #ifdef WIN32
31 #include "windows.h"
32 #endif
33 
34 #include "GLViewer.h"
35 
36 #ifdef __APPLE__
37 #include <OpenGL/gl.h>
38 #include <OpenGL/glu.h>
39 #else
40 #include <GL/gl.h>
41 #include <GL/glu.h>
42 #endif
43 
44 #ifdef WIN32
45 #pragma warning( disable:4251 )
46 #endif
47 
54 {
55 public:
57  GLViewer_Grid();
59  /*
60  * \param width and \param height - width and height of grid
61  * \param winW and \param winH - width and height of window
62  * \param xSize and \param ySize - steps along x and y direction
63  * \param xPan and \param yPan - offsets along x and y direction
64  * \param xScale and \param yScal - scale factors along x and y direction
65  */
66  GLViewer_Grid( GLfloat width, GLfloat height,
67  GLfloat winW, GLfloat winH,
68  GLfloat xSize, GLfloat ySize,
69  GLfloat xPan, GLfloat yPan,
70  GLfloat xScale, GLfloat yScale );
71  ~GLViewer_Grid();
72 
74  void draw();
75 
77  void setGridColor( GLfloat r, GLfloat g, GLfloat b );
79  void setAxisColor( GLfloat r, GLfloat g, GLfloat b );
80  void setGridWidth( float );
82  void setCenterRadius( int );
83 
85  void setSize( float xs, float ys );
87  void setPan( float xp, float yp );
89  bool setZoom( float zoom );
91  void setResize( float winW, float winH, float Zoom );
92 
93  void getSize( float&, float& ) const;
94  void getPan( float&, float& ) const;
95  void getScale( float&, float& ) const;
96 
98  void setScaleFactor( int );
99  int getScaleFactor();
100 
101 protected:
103  bool initList();
104 
105  GLuint myGridList;
106  GLfloat myGridColor[3];
107  GLfloat myAxisColor[3];
108  GLfloat myGridHeight;
109  GLfloat myGridWidth;
110  GLfloat myWinW;
111  GLfloat myWinH;
112  GLfloat myXSize;
113  GLfloat myYSize;
114  GLfloat myXPan;
115  GLfloat myYPan;
116  GLfloat myXScale;
117  GLfloat myYScale;
118  GLfloat myLineWidth;
119  GLfloat myCenterWidth;
122  GLboolean myIsUpdate;
123 };
124 
125 #ifdef WIN32
126 #pragma warning ( default:4251 )
127 #endif
128 
129 #endif