Version: 9.15.0
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::GLViewer_Widget ( QWidget parent,
const char *  theName = 0 
)

A constructor.

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::~GLViewer_Widget ( )

A destructor.

Destructor

Member Function Documentation

◆ addToolTip()

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

A function add the tool tip with text theTTText on theTTRect rect to the widget window.

Adds tooltip

Parameters
theString- tooltip text
theRect- tooltip rectangle

References myToolTipRect.

◆ enterEvent()

void GLViewer_Widget::enterEvent ( QEvent )
protectedvirtual

Custom enter event handler

◆ event()

bool GLViewer_Widget::event ( QEvent e)
protectedvirtual

Custom leave event handler

References myToolTipRect.

◆ exportRepaint()

void GLViewer_Widget::exportRepaint ( )

A function repaints OpenGL scene in export mode.

Provides repaint in export mode

References isExportMode, and paintGL().

◆ getBackgroundRectInViewerCS()

void GLViewer_Widget::getBackgroundRectInViewerCS ( double &  left,
double &  top,
double &  right,
double &  bottom 
)
private

Auxiliary function. Returns rect of window background in viewer coordinate system.

Returns
background rectangle in viewer CS

References myIH, and myIW.

◆ getHeight()

GLint GLViewer_Widget::getHeight ( ) const
inline

Returns height of OpenGl Window.

◆ getPan()

void GLViewer_Widget::getPan ( GLfloat &  xPan,
GLfloat &  yPan,
GLfloat &  zPan 
)

Returns offset parameters of Window in OpenGL global scene.

Returns
offset parameters of Window in OpenGL global scene

References myXPan, myYPan, and myZPan.

◆ getRotation()

void GLViewer_Widget::getRotation ( GLfloat &  rotationAngle,
GLfloat &  rotationCenterX,
GLfloat &  rotationCenterY,
GLfloat &  rotationCenterZ 
)

Returns parameters of current rotation.

Returns
parameters of rotation
Parameters
rotationAngle- angle
rotationCenterX- center x
rotationCenterY- center y
rotationCenterZ- center z

References myRotationAngle, myRotationCenterX, myRotationCenterY, and myRotationCenterZ.

◆ getRotationAngle()

GLfloat GLViewer_Widget::getRotationAngle ( ) const
inline

Returns rotation angle of Window in OpenGL global scene in degree.

Only in 2D

◆ getRotationStart()

void GLViewer_Widget::getRotationStart ( GLfloat &  rotationStartX,
GLfloat &  rotationStartY,
GLfloat &  rotationStartZ 
)

Returns start point of curren rotation of Window in OpenGL global scene.

Returns
start point of curren rotation of Window in OpenGL global scene

References myRotationStartX, myRotationStartY, and myRotationStartZ.

◆ getScale()

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

Returns scales on OpenGL scene along 3 directions.

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.

◆ getViewPort()

GLViewer_ViewPort2d* GLViewer_Widget::getViewPort ( ) const
inline

Returns parent GLViewer_ViewPort2d.

ViewPort2d because this class is not use for 3D Viewer

◆ getWidth()

GLint GLViewer_Widget::getWidth ( ) const
inline

Returns width of OpenGl Window.

◆ initializeGL()

void GLViewer_Widget::initializeGL ( )
protectedvirtual

A function is called before first display of window (create OpenGL scene)

Initialization (redefined virtual from QGLWidget)

References Qtx::getenv(), isLoadBackground, and setBackground().

◆ leaveEvent()

void GLViewer_Widget::leaveEvent ( QEvent )
protectedvirtual

Custom leave event handler

◆ mouseMoveEvent()

void GLViewer_Widget::mouseMoveEvent ( QMouseEvent *  e)
protectedvirtual

Custom mouse move event handler

References myViewPort.

◆ mousePressEvent()

void GLViewer_Widget::mousePressEvent ( QMouseEvent *  e)
protectedvirtual

Custom mouse press event handler

References myViewPort.

◆ mouseReleaseEvent()

void GLViewer_Widget::mouseReleaseEvent ( QMouseEvent *  e)
protectedvirtual

Custom mouse release event handler

References myViewPort.

◆ paintEvent()

void GLViewer_Widget::paintEvent ( QPaintEvent *  e)
protectedvirtual

Custom paint event handler

References myViewPort.

◆ paintGL()

◆ removeToolTip()

void GLViewer_Widget::removeToolTip ( )

A function remove tool tip form widget window.

Removes tooltip

◆ resizeGL()

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

A function is called in earch resize event of window.

Resets OpenGl parameters after resize

Parameters
w- new width
h- new height

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

◆ setBackground()

void GLViewer_Widget::setBackground ( QString  filename)

A function load picture from file with name theFileName and post it in center of global OpenGL scene.

Sets image as background

Parameters
filename- name of file

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

◆ setPan()

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

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

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

References myXPan, myYPan, and myZPan.

◆ setRotation()

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

A function for installing the parameters of current rotation.

Sets parameters of rotation

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

References myRotationAngle, myRotationCenterX, myRotationCenterY, and myRotationCenterZ.

◆ setRotationAngle()

void GLViewer_Widget::setRotationAngle ( GLfloat  a)
inline

A function for installing the rotation angle of Window in OpenGL global scene in degree.

Only in 2D

◆ setRotationStart()

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

A function for installing the start point of curren rotation of Window in OpenGL global scene.

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

References myRotationStartX, myRotationStartY, and myRotationStartZ.

◆ setScale()

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

A function for installing the scales of OpenGL scene.

A function for installing the scales of OpenGL scene

References myXScale, myYScale, and myZScale.

◆ translateBackgroundToPS()

void GLViewer_Widget::translateBackgroundToPS ( QFile hFile,
GLViewer_CoordSystem aViewerCS,
GLViewer_CoordSystem aPSCS 
)
virtual

A function translate background of window in to PostScript file on disk.

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

◆ isExportMode

bool GLViewer_Widget::isExportMode
private

Needs for export repaint.

◆ isLoadBackground

bool GLViewer_Widget::isLoadBackground
private

True if background is loaded.

◆ myBackgroundFile

QString GLViewer_Widget::myBackgroundFile
private

File name of background image.

◆ myBackgroundSize

int GLViewer_Widget::myBackgroundSize
private

Size of background image.

◆ myHeight

GLint GLViewer_Widget::myHeight
private

height of window

◆ myIH

int GLViewer_Widget::myIH
private

Height of background image.

◆ myIW

int GLViewer_Widget::myIW
private

Width of background image.

◆ myRotationAngle

GLfloat GLViewer_Widget::myRotationAngle
private

◆ myRotationAnglePrev

GLfloat GLViewer_Widget::myRotationAnglePrev
private

◆ myRotationCenterX

GLfloat GLViewer_Widget::myRotationCenterX
private

◆ myRotationCenterY

GLfloat GLViewer_Widget::myRotationCenterY
private

◆ myRotationCenterZ

GLfloat GLViewer_Widget::myRotationCenterZ
private

◆ myRotationStartX

GLfloat GLViewer_Widget::myRotationStartX
private

◆ myRotationStartY

GLfloat GLViewer_Widget::myRotationStartY
private

◆ myRotationStartZ

GLfloat GLViewer_Widget::myRotationStartZ
private

◆ myStart

GLboolean GLViewer_Widget::myStart
private

◆ myToolTipRect

QRect GLViewer_Widget::myToolTipRect
private

◆ myViewPort

GLViewer_ViewPort2d* GLViewer_Widget::myViewPort
private

◆ myWidth

GLint GLViewer_Widget::myWidth
private

width of window

◆ myXPan

GLfloat GLViewer_Widget::myXPan
private

Window offset along X direction.

◆ myXScale

GLfloat GLViewer_Widget::myXScale
private

Scale along X direction.

◆ myYPan

GLfloat GLViewer_Widget::myYPan
private

Window offset along Y direction.

◆ myYScale

GLfloat GLViewer_Widget::myYScale
private

Scale along Y direction.

◆ myZPan

GLfloat GLViewer_Widget::myZPan
private

Window offset along Z direction.

◆ myZScale

GLfloat GLViewer_Widget::myZScale
private

Scale along Z direction.

◆ texName

GLuint GLViewer_Widget::texName
private

Texture id of loaded background image.


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