Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GLViewer_Widget Class Reference

#include <GLViewer_Widget.h>

Inheritance diagram for GLViewer_Widget:
Inheritance graph

Public Member Functions

 GLViewer_Widget (QWidget *theParent, const char *theName=0)
 A constructor. More...
 
 ~GLViewer_Widget ()
 A destructor. More...
 
GLViewer_ViewPort2dgetViewPort () const
 Returns parent GLViewer_ViewPort2d. More...
 
GLint getWidth () const
 Returns width of OpenGl Window. More...
 
GLint getHeight () const
 Returns height of OpenGl Window. More...
 
void getScale (GLfloat &xScale, GLfloat &yScale, GLfloat &zScale)
 Returns scales on OpenGL scene along 3 directions. More...
 
void setScale (GLfloat xScale, GLfloat yScale, GLfloat zScaleGLfloat)
 A function for installing the scales of OpenGL scene. More...
 
void getPan (GLfloat &xPan, GLfloat &yPan, GLfloat &zPan)
 Returns offset parameters of Window in OpenGL global scene. More...
 
void setPan (GLfloat xPan, GLfloat yPan, GLfloat zPan)
 A function for installing the offset parameters of Window in OpenGL global scene. More...
 
GLfloat getRotationAngle () const
 Returns rotation angle of Window in OpenGL global scene in degree. More...
 
void setRotationAngle (GLfloat a)
 A function for installing the rotation angle of Window in OpenGL global scene in degree. More...
 
void getRotationStart (GLfloat &rotationStartX, GLfloat &rotationStartY, GLfloat &rotationStartZ)
 Returns start point of curren rotation of Window in OpenGL global scene. More...
 
void setRotationStart (GLfloat rotationStartX, GLfloat rotationStartY, GLfloat rotationStartZ)
 A function for installing the start point of curren rotation of Window in OpenGL global scene. More...
 
void getRotation (GLfloat &rotationAngle, GLfloat &rotationCenterX, GLfloat &rotationCenterY, GLfloat &rotationCenterZ)
 Returns parameters of current rotation. More...
 
void setRotation (GLfloat, GLfloat, GLfloat, GLfloat)
 A function for installing the parameters of current rotation. More...
 
void setBackground (QString theFileName)
 A function load picture from file with name theFileName and post it in center of global OpenGL scene. More...
 
void addToolTip (QString theTTText, QRect theTTRect)
 A function add the tool tip with text theTTText on theTTRect rect to the widget window. More...
 
void removeToolTip ()
 A function remove tool tip form widget window. More...
 
virtual void translateBackgroundToPS (QFile &hFile, GLViewer_CoordSystem *aViewerCS, GLViewer_CoordSystem *aPSCS)
 A function translate background of window in to PostScript file on disk. More...
 
void exportRepaint ()
 A function repaints OpenGL scene in export mode. More...
 

Protected Member Functions

virtual void initializeGL ()
 A function is called before first display of window (create OpenGL scene) More...
 
virtual void paintGL ()
 A function is called in earch paint event of window. More...
 
virtual void resizeGL (int, int)
 A function is called in earch resize event of window. More...
 
virtual void paintEvent (QPaintEvent *)
 
virtual void mouseMoveEvent (QMouseEvent *)
 
virtual void mousePressEvent (QMouseEvent *)
 
virtual void mouseReleaseEvent (QMouseEvent *)
 
virtual void enterEvent (QEvent *)
 
virtual void leaveEvent (QEvent *)
 
virtual bool event (QEvent *)
 

Private Member Functions

void getBackgroundRectInViewerCS (double &left, double &top, double &right, double &bottom)
 Auxiliary function. Returns rect of window background in viewer coordinate system. More...
 

Private Attributes

GLint myWidth
 width of window More...
 
GLint myHeight
 height of window More...
 
GLfloat myXScale
 Scale along X direction. More...
 
GLfloat myYScale
 Scale along Y direction. More...
 
GLfloat myZScale
 Scale along Z direction. More...
 
GLfloat myXPan
 Window offset along X direction. More...
 
GLfloat myYPan
 Window offset along Y direction. More...
 
GLfloat myZPan
 Window offset along Z direction. More...
 
GLfloat myRotationStartX
 
GLfloat myRotationStartY
 
GLfloat myRotationStartZ
 
GLfloat myRotationAngle
 
GLfloat myRotationCenterX
 
GLfloat myRotationCenterY
 
GLfloat myRotationCenterZ
 
GLfloat myRotationAnglePrev
 
GLboolean myStart
 
GLViewer_ViewPort2dmyViewPort
 
bool isLoadBackground
 True if background is loaded. More...
 
QString myBackgroundFile
 File name of background image. More...
 
GLuint texName
 Texture id of loaded background image. More...
 
int myIW
 Width of background image. More...
 
int myIH
 Height of background image. More...
 
int myBackgroundSize
 Size of background image. More...
 
QRect myToolTipRect
 
bool isExportMode
 Needs for export repaint. More...
 

Detailed Description

Widget for visualization of OpenGL scene

Constructor & Destructor Documentation

GLViewer_Widget::GLViewer_Widget ( QWidget parent,
const char *  name = 0 
)

Parameters using for QOGLWidget as is

A constructor Parameters using for QOGLWidget as is

References isExportMode, myRotationAngle, myRotationAnglePrev, myRotationCenterX, myRotationCenterY, myRotationCenterZ, myStart, myViewPort, myXPan, myXScale, myYPan, myYScale, myZPan, and myZScale.

GLViewer_Widget::~GLViewer_Widget ( )

Destructor

Member Function Documentation

void GLViewer_Widget::addToolTip ( QString  theString,
QRect  theRect 
)

Adds tooltip

Parameters
theString- tooltip text
theRect- tooltip rectangle

References myToolTipRect.

void GLViewer_Widget::enterEvent ( QEvent e)
protectedvirtual

Custom enter event handler

bool GLViewer_Widget::event ( QEvent e)
protectedvirtual

Custom leave event handler

References myToolTipRect.

void GLViewer_Widget::exportRepaint ( )

Provides repaint in export mode

References isExportMode, and paintGL().

void GLViewer_Widget::getBackgroundRectInViewerCS ( double &  left,
double &  top,
double &  right,
double &  bottom 
)
private
Returns
background rectangle in viewer CS

References myIH, and myIW.

GLint GLViewer_Widget::getHeight ( ) const
inline
void GLViewer_Widget::getPan ( GLfloat &  xPan,
GLfloat &  yPan,
GLfloat &  zPan 
)
Returns
offset parameters of Window in OpenGL global scene

References myXPan, myYPan, and myZPan.

void GLViewer_Widget::getRotation ( GLfloat &  rotationAngle,
GLfloat &  rotationCenterX,
GLfloat &  rotationCenterY,
GLfloat &  rotationCenterZ 
)
Returns
parameters of rotation
Parameters
rotationAngle- angle
rotationCenterX- center x
rotationCenterY- center y
rotationCenterZ- center z

References myRotationAngle, myRotationCenterX, myRotationCenterY, and myRotationCenterZ.

GLfloat GLViewer_Widget::getRotationAngle ( ) const
inline

Only in 2D

void GLViewer_Widget::getRotationStart ( GLfloat &  rotationStartX,
GLfloat &  rotationStartY,
GLfloat &  rotationStartZ 
)
Returns
start point of curren rotation of Window in OpenGL global scene

References myRotationStartX, myRotationStartY, and myRotationStartZ.

void GLViewer_Widget::getScale ( GLfloat &  xScale,
GLfloat &  yScale,
GLfloat &  zScale 
)

in 2d scene zScale = 1.0

Returns
scales on OpenGL scene along 3 directions in 2d scene zScale = 1.0

References myXScale, myYScale, and myZScale.

GLViewer_ViewPort2d* GLViewer_Widget::getViewPort ( ) const
inline

ViewPort2d because this class is not use for 3D Viewer

GLint GLViewer_Widget::getWidth ( ) const
inline
void GLViewer_Widget::initializeGL ( )
protectedvirtual

Initialization (redefined virtual from QGLWidget)

References isLoadBackground, and setBackground().

void GLViewer_Widget::leaveEvent ( QEvent e)
protectedvirtual

Custom leave event handler

void GLViewer_Widget::mouseMoveEvent ( QMouseEvent *  e)
protectedvirtual

Custom mouse move event handler

References myViewPort.

void GLViewer_Widget::mousePressEvent ( QMouseEvent *  e)
protectedvirtual

Custom mouse press event handler

References myViewPort.

void GLViewer_Widget::mouseReleaseEvent ( QMouseEvent *  e)
protectedvirtual

Custom mouse release event handler

References myViewPort.

void GLViewer_Widget::paintEvent ( QPaintEvent *  e)
protectedvirtual

Custom paint event handler

References myViewPort.

void GLViewer_Widget::removeToolTip ( )

Removes tooltip

void GLViewer_Widget::resizeGL ( int  w,
int  h 
)
protectedvirtual

Resets OpenGl parameters after resize

Parameters
w- new width
h- new height

References GLViewer_ViewPort2d::initResize(), myHeight, myStart, myViewPort, and myWidth.

void GLViewer_Widget::setBackground ( QString  filename)

Sets image as background

Parameters
filename- name of file

References isLoadBackground, myBackgroundFile, myBackgroundSize, myIH, myIW, and texName.

void GLViewer_Widget::setPan ( GLfloat  xPan,
GLfloat  yPan,
GLfloat  zPan 
)

A function for installing the offset parameters of Window in OpenGL global scene

References myXPan, myYPan, and myZPan.

void GLViewer_Widget::setRotation ( GLfloat  rotationAngle,
GLfloat  rotationCenterX,
GLfloat  rotationCenterY,
GLfloat  rotationCenterZ 
)

Sets parameters of rotation

Parameters
rotationAngle- angle
rotationCenterX- center x
rotationCenterY- center y
rotationCenterZ- center z

References myRotationAngle, myRotationCenterX, myRotationCenterY, and myRotationCenterZ.

void GLViewer_Widget::setRotationAngle ( GLfloat  a)
inline

Only in 2D

void GLViewer_Widget::setRotationStart ( GLfloat  rotationStartX,
GLfloat  rotationStartY,
GLfloat  rotationStartZ 
)

A function for installing the rotation angle of Window in OpenGL global scene in degree (Only in 2D)

References myRotationStartX, myRotationStartY, and myRotationStartZ.

void GLViewer_Widget::setScale ( GLfloat  xScale,
GLfloat  yScale,
GLfloat  zScale 
)

A function for installing the scales of OpenGL scene

References myXScale, myYScale, and myZScale.

void GLViewer_Widget::translateBackgroundToPS ( QFile hFile,
GLViewer_CoordSystem aViewerCS,
GLViewer_CoordSystem aPSCS 
)
virtual
Parameters
hFilethe name of PostScript file chosen by user
aViewerCSthe GLViewer_CoordSystem of window
aPSCSthe GLViewer_CoordSystem of PostScript page

Translates background to PostScript

Parameters
hFile- PostScript file
aViewerCS- viewer co-ordinate system
aPSCS- paper co-ordinate system

References AddImagePart(), getBackgroundRectInViewerCS(), isLoadBackground, myBackgroundFile, and GLViewer_CoordSystem::transform().

Member Data Documentation

bool GLViewer_Widget::isExportMode
private
bool GLViewer_Widget::isLoadBackground
private
QString GLViewer_Widget::myBackgroundFile
private
int GLViewer_Widget::myBackgroundSize
private
GLint GLViewer_Widget::myHeight
private
int GLViewer_Widget::myIH
private
int GLViewer_Widget::myIW
private
GLfloat GLViewer_Widget::myRotationAngle
private
GLfloat GLViewer_Widget::myRotationAnglePrev
private
GLfloat GLViewer_Widget::myRotationCenterX
private
GLfloat GLViewer_Widget::myRotationCenterY
private
GLfloat GLViewer_Widget::myRotationCenterZ
private
GLfloat GLViewer_Widget::myRotationStartX
private
GLfloat GLViewer_Widget::myRotationStartY
private
GLfloat GLViewer_Widget::myRotationStartZ
private
GLboolean GLViewer_Widget::myStart
private
QRect GLViewer_Widget::myToolTipRect
private
GLViewer_ViewPort2d* GLViewer_Widget::myViewPort
private
GLint GLViewer_Widget::myWidth
private
GLfloat GLViewer_Widget::myXPan
private
GLfloat GLViewer_Widget::myXScale
private
GLfloat GLViewer_Widget::myYPan
private
GLfloat GLViewer_Widget::myYScale
private
GLfloat GLViewer_Widget::myZPan
private
GLfloat GLViewer_Widget::myZScale
private
GLuint GLViewer_Widget::texName
private

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