#include <GLViewer_Widget.h>
Public Member Functions | |
GLViewer_Widget (QWidget *theParent, const char *theName=0) | |
A constructor. More... | |
~GLViewer_Widget () | |
A destructor. More... | |
GLViewer_ViewPort2d * | getViewPort () 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_ViewPort2d * | myViewPort |
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... | |
Widget for visualization of OpenGL scene
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
void GLViewer_Widget::addToolTip | ( | QString | theString, |
QRect | theRect | ||
) |
Adds tooltip
theString | - tooltip text |
theRect | - tooltip rectangle |
References myToolTipRect.
|
protectedvirtual |
Custom enter event handler
|
protectedvirtual |
Custom leave event handler
References myToolTipRect.
void GLViewer_Widget::exportRepaint | ( | ) |
Provides repaint in export mode
References isExportMode, and paintGL().
|
private |
|
inline |
void GLViewer_Widget::getPan | ( | GLfloat & | xPan, |
GLfloat & | yPan, | ||
GLfloat & | zPan | ||
) |
void GLViewer_Widget::getRotation | ( | GLfloat & | rotationAngle, |
GLfloat & | rotationCenterX, | ||
GLfloat & | rotationCenterY, | ||
GLfloat & | rotationCenterZ | ||
) |
rotationAngle | - angle |
rotationCenterX | - center x |
rotationCenterY | - center y |
rotationCenterZ | - center z |
References myRotationAngle, myRotationCenterX, myRotationCenterY, and myRotationCenterZ.
|
inline |
Only in 2D
void GLViewer_Widget::getRotationStart | ( | GLfloat & | rotationStartX, |
GLfloat & | rotationStartY, | ||
GLfloat & | rotationStartZ | ||
) |
References myRotationStartX, myRotationStartY, and myRotationStartZ.
void GLViewer_Widget::getScale | ( | GLfloat & | xScale, |
GLfloat & | yScale, | ||
GLfloat & | zScale | ||
) |
|
inline |
ViewPort2d because this class is not use for 3D Viewer
|
inline |
|
protectedvirtual |
Initialization (redefined virtual from QGLWidget)
References isLoadBackground, and setBackground().
|
protectedvirtual |
Custom leave event handler
|
protectedvirtual |
Custom mouse move event handler
References myViewPort.
|
protectedvirtual |
Custom mouse press event handler
References myViewPort.
|
protectedvirtual |
Custom mouse release event handler
References myViewPort.
|
protectedvirtual |
Custom paint event handler
References myViewPort.
|
protectedvirtual |
Paints content
References GLViewer_Grid::draw(), GLViewer_ViewPort2d::getGrid(), GLViewer_ViewFrame::getViewer(), GLViewer_ViewPort2d::getViewFrame(), getViewPort(), isExportMode, isLoadBackground, myBackgroundSize, myIH, myIW, myRotationAngle, myRotationCenterX, myRotationCenterY, myRotationCenterZ, myViewPort, myXPan, myXScale, myYPan, myYScale, myZPan, myZScale, GLViewer_Viewer2d::repaintView(), texName, and GLViewer_Viewer2d::updateDrawers().
void GLViewer_Widget::removeToolTip | ( | ) |
Removes tooltip
|
protectedvirtual |
Resets OpenGl parameters after resize
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
filename | - name of file |
References isLoadBackground, myBackgroundFile, myBackgroundSize, myIH, myIW, and texName.
void GLViewer_Widget::setPan | ( | GLfloat | xPan, |
GLfloat | yPan, | ||
GLfloat | zPan | ||
) |
void GLViewer_Widget::setRotation | ( | GLfloat | rotationAngle, |
GLfloat | rotationCenterX, | ||
GLfloat | rotationCenterY, | ||
GLfloat | rotationCenterZ | ||
) |
Sets parameters of rotation
rotationAngle | - angle |
rotationCenterX | - center x |
rotationCenterY | - center y |
rotationCenterZ | - center z |
References myRotationAngle, myRotationCenterX, myRotationCenterY, and myRotationCenterZ.
|
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 | ||
) |
|
virtual |
hFile | the name of PostScript file chosen by user |
aViewerCS | the GLViewer_CoordSystem of window |
aPSCS | the GLViewer_CoordSystem of PostScript page |
Translates background to PostScript
hFile | - PostScript file |
aViewerCS | - viewer co-ordinate system |
aPSCS | - paper co-ordinate system |
References AddImagePart(), getBackgroundRectInViewerCS(), isLoadBackground, myBackgroundFile, and GLViewer_CoordSystem::transform().
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |