Version: 9.12.0
GLViewer_Grid Class Reference

#include <GLViewer_Grid.h>

Public Member Functions

 GLViewer_Grid ()
 A default constructor. More...
 
 GLViewer_Grid (GLfloat width, GLfloat height, GLfloat winW, GLfloat winH, GLfloat xSize, GLfloat ySize, GLfloat xPan, GLfloat yPan, GLfloat xScale, GLfloat yScale)
 A constructor. More...
 
 ~GLViewer_Grid ()
 
void draw ()
 Draws grid. More...
 
void setGridColor (GLfloat r, GLfloat g, GLfloat b)
 Sets color of grid in RGB format. More...
 
void setAxisColor (GLfloat r, GLfloat g, GLfloat b)
 Sets color of grid axes in RGB format. More...
 
void setGridWidth (float)
 
void setCenterRadius (int)
 Sets Radius of center point( begin coords ) More...
 
void setSize (float xs, float ys)
 Sets steps along x and y directions. More...
 
void setPan (float xp, float yp)
 Sets offset along x and y direction. More...
 
bool setZoom (float zoom)
 Sets common scale factor along x and y direction. More...
 
void setResize (float winW, float winH, float Zoom)
 Recomputes grid in new size and scale of view. More...
 
void getSize (float &, float &) const
 
void getPan (float &, float &) const
 
void getScale (float &, float &) const
 
void setScaleFactor (int)
 Sets step of scale. More...
 
int getScaleFactor ()
 

Protected Member Functions

bool initList ()
 Initialize grid display list. More...
 

Protected Attributes

GLuint myGridList
 
GLfloat myGridColor [3]
 
GLfloat myAxisColor [3]
 
GLfloat myGridHeight
 
GLfloat myGridWidth
 
GLfloat myWinW
 
GLfloat myWinH
 
GLfloat myXSize
 
GLfloat myYSize
 
GLfloat myXPan
 
GLfloat myYPan
 
GLfloat myXScale
 
GLfloat myYScale
 
GLfloat myLineWidth
 
GLfloat myCenterWidth
 
GLint myCenterRadius
 
GLint myScaleFactor
 
GLboolean myIsUpdate
 

Detailed Description

Class GLViewer_Grid 2D rectangular grid for GLViewer Grid is adapt cells for current view

Constructor & Destructor Documentation

◆ GLViewer_Grid() [1/2]

GLViewer_Grid::GLViewer_Grid ( )

A default constructor.

Default constructor

References myAxisColor, and myGridColor.

◆ GLViewer_Grid() [2/2]

GLViewer_Grid::GLViewer_Grid ( GLfloat  width,
GLfloat  height,
GLfloat  winW,
GLfloat  winH,
GLfloat  xSize,
GLfloat  ySize,
GLfloat  xPan,
GLfloat  yPan,
GLfloat  xScale,
GLfloat  yScale 
)

A constructor.

Constructor

Parameters
widthand
height- width and height of grid
winWand
winH- width and height of window
xSizeand
ySize- steps along x and y direction
xPanand
yPan- offsets along x and y direction
xScaleand
yScal- scale factors along x and y direction

References myAxisColor, and myGridColor.

◆ ~GLViewer_Grid()

GLViewer_Grid::~GLViewer_Grid ( )

Destructor

Member Function Documentation

◆ draw()

void GLViewer_Grid::draw ( )

Draws grid.

Performs OpenGL drawing

References initList(), myGridList, and myIsUpdate.

◆ getPan()

void GLViewer_Grid::getPan ( float &  xPan,
float &  yPan 
) const
Returns
panning along x and y axis
Parameters
xPan- for panning along x axis
yPan- for panning along y axis

References myXPan, and myYPan.

◆ getScale()

void GLViewer_Grid::getScale ( float &  xScale,
float &  yScale 
) const
Returns
scaling along x and y axis
Parameters
xScale- for scaling along x axis
yScale- for scaling along y axis

References myXScale, and myYScale.

◆ getScaleFactor()

int GLViewer_Grid::getScaleFactor ( )

◆ getSize()

void GLViewer_Grid::getSize ( float &  xSize,
float &  ySize 
) const
Returns
grid size along x and y axis
Parameters
xSize- for size along x axis
ySize- for size along y axis

References myXSize, and myYSize.

◆ initList()

bool GLViewer_Grid::initList ( )
protected

◆ setAxisColor()

void GLViewer_Grid::setAxisColor ( GLfloat  r,
GLfloat  g,
GLfloat  b 
)

Sets color of grid axes in RGB format.

Changes color of axis

Parameters
r,g,b- components of color

References myAxisColor, and myIsUpdate.

◆ setCenterRadius()

void GLViewer_Grid::setCenterRadius ( int  r)

Sets Radius of center point( begin coords )

Sets Radius of center point( begin coords )

Parameters
r- new radius

References myCenterRadius, and myIsUpdate.

◆ setGridColor()

void GLViewer_Grid::setGridColor ( GLfloat  r,
GLfloat  g,
GLfloat  b 
)

Sets color of grid in RGB format.

Changes color of grid

Parameters
r,g,b- components of color

References myGridColor, and myIsUpdate.

◆ setGridWidth()

void GLViewer_Grid::setGridWidth ( float  w)

Changes grid width

Parameters
w- new grid width

References myGridWidth, and myIsUpdate.

◆ setPan()

void GLViewer_Grid::setPan ( float  xPan,
float  yPan 
)

Sets offset along x and y direction.

Sets panning of grid

Parameters
xPan- panning along X axis
yPan- panning along Y axis

References myIsUpdate, myXPan, and myYPan.

◆ setResize()

void GLViewer_Grid::setResize ( float  WinW,
float  WinH,
float  zoom 
)

Recomputes grid in new size and scale of view.

Sets parameters of grid by zoom coefficient and window size

Parameters
WinW- window width
WinH- window height
zoom- zoom coefficient

References myGridHeight, myGridWidth, myIsUpdate, myWinH, myWinW, myXScale, myYScale, and setZoom().

◆ setScaleFactor()

void GLViewer_Grid::setScaleFactor ( int  )

Sets step of scale.

◆ setSize()

void GLViewer_Grid::setSize ( float  xSize,
float  ySize 
)

Sets steps along x and y directions.

Sets grid size along X and Y axis

Parameters
xSize- size along X axis
ySize- size along Y axis

References myIsUpdate, myXSize, and myYSize.

◆ setZoom()

bool GLViewer_Grid::setZoom ( float  zoom)

Sets common scale factor along x and y direction.

Sets zoom

Parameters
zoom- new coefficient of zooming

References myGridHeight, myGridWidth, myIsUpdate, myXScale, and myYScale.

Member Data Documentation

◆ myAxisColor

GLfloat GLViewer_Grid::myAxisColor[3]
protected

◆ myCenterRadius

GLint GLViewer_Grid::myCenterRadius
protected

◆ myCenterWidth

GLfloat GLViewer_Grid::myCenterWidth
protected

◆ myGridColor

GLfloat GLViewer_Grid::myGridColor[3]
protected

◆ myGridHeight

GLfloat GLViewer_Grid::myGridHeight
protected

◆ myGridList

GLuint GLViewer_Grid::myGridList
protected

◆ myGridWidth

GLfloat GLViewer_Grid::myGridWidth
protected

◆ myIsUpdate

GLboolean GLViewer_Grid::myIsUpdate
protected

◆ myLineWidth

GLfloat GLViewer_Grid::myLineWidth
protected

◆ myScaleFactor

GLint GLViewer_Grid::myScaleFactor
protected

◆ myWinH

GLfloat GLViewer_Grid::myWinH
protected

◆ myWinW

GLfloat GLViewer_Grid::myWinW
protected

◆ myXPan

GLfloat GLViewer_Grid::myXPan
protected

◆ myXScale

GLfloat GLViewer_Grid::myXScale
protected

◆ myXSize

GLfloat GLViewer_Grid::myXSize
protected

◆ myYPan

GLfloat GLViewer_Grid::myYPan
protected

◆ myYScale

GLfloat GLViewer_Grid::myYScale
protected

◆ myYSize

GLfloat GLViewer_Grid::myYSize
protected

The documentation for this class was generated from the following files: