Version: 6.3.1
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

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

Protected Member Functions

virtual void initializeGL ()
 A function is called before first display of window (create OpenGL scene)
virtual void paintGL ()
 A function is called in earch paint event of window.
virtual void resizeGL (int, int)
 A function is called in earch resize event of window.
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.

Private Attributes

GLint myWidth
 width of window
GLint myHeight
 height of window
GLfloat myXScale
 Scale along X direction.
GLfloat myYScale
 Scale along Y direction.
GLfloat myZScale
 Scale along Z direction.
GLfloat myXPan
 Window offset along X direction.
GLfloat myYPan
 Window offset along Y direction.
GLfloat myZPan
 Window offset along Z direction.
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.
QString myBackgroundFile
 File name of background image.
GLuint texName
 Texture id of loaded background image.
int myIW
 Width of background image.
int myIH
 Height of background image.
int myBackgroundSize
 Size of background image.
QRect myToolTipRect
bool isExportMode
 Needs for export repaint.

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

GLViewer_ViewPort2d* GLViewer_Widget.getViewPort ( ) const

ViewPort2d because this class is not use for 3D Viewer

GLint GLViewer_Widget.getWidth ( ) const
GLint GLViewer_Widget.getHeight ( ) const
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.

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::getPan ( GLfloat &  xPan,
GLfloat &  yPan,
GLfloat &  zPan 
)
Returns:
offset parameters of Window in OpenGL global scene

References myXPan, myYPan, and myZPan.

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.

GLfloat GLViewer_Widget.getRotationAngle ( ) const

Only in 2D

void GLViewer_Widget.setRotationAngle ( GLfloat  a)

Only in 2D

References test_table.a.

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::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::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.

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::setBackground ( QString  filename)

Sets image as background

Parameters:
filename- name of file

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

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

Adds tooltip

Parameters:
theString- tooltip text
theRect- tooltip rectangle

References myToolTipRect.

void GLViewer_Widget::removeToolTip ( )

Removes tooltip

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 test_table.a, AddImagePart(), test_table.c, getBackgroundRectInViewerCS(), isLoadBackground, test_big_table.k, myBackgroundFile, and GLViewer_CoordSystem.transform().

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.

void GLViewer_Widget::initializeGL ( ) [protected, virtual]

Initialization (redefined virtual from QGLWidget)

References isLoadBackground, and setBackground().

void GLViewer_Widget::paintGL ( ) [protected, virtual]
void GLViewer_Widget::resizeGL ( int  w,
int  h 
) [protected, virtual]

Resets OpenGl parameters after resize

Parameters:
w- new width
h- new height

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

void GLViewer_Widget::paintEvent ( QPaintEvent *  e) [protected, virtual]

Custom paint event handler

References myViewPort.

void GLViewer_Widget::mouseMoveEvent ( QMouseEvent *  e) [protected, virtual]

Custom mouse move event handler

References myViewPort.

void GLViewer_Widget::mousePressEvent ( QMouseEvent *  e) [protected, virtual]

Custom mouse press event handler

References myViewPort.

void GLViewer_Widget::mouseReleaseEvent ( QMouseEvent *  e) [protected, virtual]

Custom mouse release event handler

References myViewPort.

void GLViewer_Widget::enterEvent ( QEvent e) [protected, virtual]

Custom enter event handler

void GLViewer_Widget::leaveEvent ( QEvent e) [protected, virtual]

Custom leave event handler

bool GLViewer_Widget::event ( QEvent e) [protected, virtual]

Custom leave event handler

References myToolTipRect.


Field Documentation

GLint GLViewer_Widget.myWidth [private]
GLint GLViewer_Widget.myHeight [private]
GLfloat GLViewer_Widget.myXScale [private]
GLfloat GLViewer_Widget.myYScale [private]
GLfloat GLViewer_Widget.myZScale [private]
GLfloat GLViewer_Widget.myXPan [private]
GLfloat GLViewer_Widget.myYPan [private]
GLfloat GLViewer_Widget.myZPan [private]
GLboolean GLViewer_Widget.myStart [private]
GLuint GLViewer_Widget.texName [private]
int GLViewer_Widget.myIW [private]
int GLViewer_Widget.myIH [private]
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS