Developer Documentation

Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | Private Slots | Private Member Functions | Private Attributes | Friends | List of all members
glViewer Class Reference

`#include <OpenFlipper/widgets/glWidget/QtBaseViewer.hh>`

Inheritance diagram for glViewer:

## Public Types
enum | ProjectionMode { ORTHOGRAPHIC_PROJECTION, PERSPECTIVE_PROJECTION }
| projection mode More...
enum | NavigationMode { NORMAL_NAVIGATION, FIRSTPERSON_NAVIGATION }
| Navigation mode. More...
enum | NormalsMode { DONT_TOUCH_NORMALS, NORMALIZE_NORMALS }
| Automatically normalize normals? More...

## Public Slots
virtual void | updateGL ()
| Redraw scene. Triggers paint event for updating the view (cf. drawNow()).
virtual void | setHome ()
| set home position
virtual void | home ()
| go to home pos
virtual void | viewAll ()
| view the whole scene
virtual void | perspectiveProjection ()
| set perspective view (projectionMode(PERSPECTIVE_PROJECTION))
virtual void | orthographicProjection ()
| set orthographic view (projectionMode(ORTHOGRAPHIC_PROJECTION))
virtual void | toggleProjectionMode ()
| toggle projection mode
virtual void | toggleNavigationMode ()
| toggle navigation mode
virtual void | setFOVY (double _fovy)
| Set fovy.
virtual void | setView (const ACG::GLMatrixd &_modelview, const ACG::GLMatrixd &_inverse_modelview)
| set view, used for synchronizing
void | actionPasteView (QSize *_windowSize=NULL, int *_splitterWidth=NULL)
void | actionCopyView (const QSize &_windowSize=QSize(-1,-1), const int _splitterWidth=-1, const bool _make_c_string=false)
void | actionSetView (QString view)
Snapshots
virtual void | snapshot (int _width=0, int _height=0, bool _alpha=false, bool _hideCoordsys=false, int samples=1)
virtual void | snapshot (QImage &_image, int _width=0, int _height=0, bool _alpha=false, bool _hideCoordsys=false, int samples=1)
| Take a snapshot and store it in the given image.

## Signals
void | functionMenuUpdate ()
void | statusMessage (const QString &message, int timeout=0)
void | projectionModeChanged (bool _ortho)
void | navigationModeChanged (bool _normal)
void | signalMouseEvent (QMouseEvent *, const std::string &)
void | signalMouseEvent (QMouseEvent *)
| This signal does not send the pick mode and is kept for compatibility.
void | signalWheelEvent (QWheelEvent *, const std::string &)
| Emitted in Pick mode. Uses pick mode.
void | signalMouseEventIdentify (QMouseEvent *)
void | signalMouseEventLight (QMouseEvent *)
void | signalSceneGraphChanged (ACG::SceneGraph::BaseNode *_root)
| scene graph has changed
void | signalMouseEventClick (QMouseEvent *, bool _double)
void | signalCustomContextMenuRequested (const QPoint &)
view handling
void | viewUpdated ()
| This signal is emitted when the scene is repainted due to any event.
void | viewChanged ()
| This signal is emitted whenever the view is changed by the user.
void | signalMakeActive ()
| make this widget active

## Public Member Functions
| glViewer (QGraphicsScene *_scene, OFGLWidget *_glWidget, Viewer::ViewerProperties &_properties, QGraphicsWidget *_parent=0)
virtual | ~glViewer ()
| Destructor.
virtual void | makeCurrent ()
| Makes this widget the current widget for OpenGL operations.
virtual void | swapBuffers ()
| Swaps the screen contents with the off-screen buffer.
void | lockProjectionUpdate (void)
| Lock update of projection matrix.
void | unlockProjectionUpdate (void)
| Unlock update of projection matrix.
void | trackMouse (bool _track)
| Enable/disable mouse tracking (move events with no button press)
void | sceneGraph (ACG::SceneGraph::BaseNode *_root, unsigned int _maxPasses, ACG::Vec3d _bbmin, ACG::Vec3d _bbmax, const bool _resetTrackBall=false)
void | projectionMode (ProjectionMode _p)
| Changes the projection mode and updates the projection matrix.
ProjectionMode | projectionMode () const
| get current projection mode
void | navigationMode (NavigationMode _n)
| Changes the navigation mode.
NavigationMode | navigationMode () const
| get current navigation mode
void | setScenePos (const ACG::Vec3d &_center, double _radius, const bool _resetTrackBall=false)
void | viewingDirection (const ACG::Vec3d &_dir, const ACG::Vec3d &_up)
| set the viewing direction
void | lookAt (const ACG::Vec3d &_eye, const ACG::Vec3d &_center, const ACG::Vec3d &_up)
| Set look at transformation directly.
void | normalsMode (NormalsMode _mode)
| set treatment of normals
NormalsMode | normalsMode () const
| get treatment of normals
void | copyToImage (QImage &_image, GLenum _buffer=GL_BACK)
| copy current framebuffer to an QImage
void | copyToImage (QImage &_image, unsigned int _left, unsigned int _top, unsigned int _width, unsigned int _height, GLenum _buffer)
| copy current framebuffer to an QImage
unsigned int | glWidth () const
| get width of QGLWidget
unsigned int | glHeight () const
| get height of QGLWidget
QSize | glSize () const
| get size of QGLWIdget
QPoint | glMapFromGlobal (const QPoint &_pos) const
| map global to glarea coords
QPoint | glMapToGlobal (const QPoint &_pos) const
| map glarea coords to global coords
double | field_of_view_vertical () const
double | aspect_ratio () const
| Returns the viewer's aspect ratio.
double | near_plane () const
| Returns a chili cheese burger.
double | far_plane () const
| Returns a peanut butter sandwich.
double | ortho_width () const
| Get width of the gl scene in orthogonal projection mode.
void | encodeView (QString &_view, const QSize &_windowSize=QSize(-1,-1), const int _toolBarWidth=-1, const bool _make_c_string=false)
bool | decodeView (const QString &_view, QSize *_windowSize=NULL, int *_toolBarWidth=NULL, QSize *_viewportSize=NULL)
void | initModelviewMatrix ()
| initialize modelview matrix to identity
void | grabGLArea ()
| get all Mouse & Key Events for GlWidget
void | releaseGLArea ()
| undo grabbing GLArea
void | translate (const ACG::Vec3d &trans)
| translate the scene and update modelview matrix
void | rotate (const ACG::Vec3d &axis, double angle)
| rotate the scene (around its center) and update modelview matrix
void | rotate (const ACG::Vec3d &axis, double angle, const ACG::Vec3d &_center)
| rotate the scene and update modelview matrix
void | setCursorPainter (CursorPainter *_cursorPainter)
| sets the current cursor painter
void | updateCursorPosition (QPointF _scenePos)
| will be called from CursorPainter to inform the viewer that the cursor position changed
void | moveForward ()
| First person navigation: Move forward.
void | moveBack ()
| First person navigation: Move back.
void | strafeLeft ()
| First person navigation: Strafe left.
void | strafeRight ()
| First person navigation: Strafe Right.
Projection settings
void | setSceneCenter (const ACG::Vec3d &_center)
void | setTrackBallCenter (const ACG::Vec3d &_center)
| Set Trackball Center point of scene. More...
const ACG::Vec3d | trackBallCenter ()
| Get Trackball Center point of scene. More...
const ACG::Vec3d | scene_center () const
double | scene_radius () const
void | setSceneRadius (double _radius)

## Static Public Member Functions
static bool | decodeView (const QString &_view, ACG::GLMatrixd &m, ACG::GLMatrixd &p, int &pMode, double &ortho_width, QSize *_windowSize=NULL, int *_splitterWidth=NULL, QSize *_viewportSize=NULL)

## Protected Slots
virtual void | slotWheelX (double _dAngle)
| process signals from wheelX_
virtual void | slotWheelY (double _dAngle)
| process signals from wheelX_
virtual void | slotWheelZ (double _dist)
| process signals from wheelZ_
virtual void | cleanupEventFilter ()
| correct ??? (same function as in qt src)
void | processGLDebugMessage (const QOpenGLDebugMessage &msg)
| process opengl debug messages

## Protected Member Functions
virtual void | initializeGL ()
| Return a resonable size hint. More...
virtual void | paintGL (double _aspect=0.0)
| draw the scene. Triggered by updateGL().
virtual void | resizeEvent (QGraphicsSceneResizeEvent *_e)
| handle resize events
virtual void | moveEvent (QGraphicsSceneMoveEvent *_e)
| handle move events
virtual void | mousePressEvent (QGraphicsSceneMouseEvent *_event)
| handle mouse press events
virtual void | mouseDoubleClickEvent (QGraphicsSceneMouseEvent *_event)
| handle mouse double click events
virtual void | mouseMoveEvent (QGraphicsSceneMouseEvent *_event)
| handle mouse move events
virtual void | mouseReleaseEvent (QGraphicsSceneMouseEvent *_event)
| handle mouse release events
virtual void | wheelEvent (QGraphicsSceneWheelEvent *_event)
| handle mouse wheel events
virtual void | contextMenuEvent (QGraphicsSceneContextMenuEvent *_e)
| handle mouse press events
void | viewMouseEvent (QMouseEvent *_event)
| specialized viewer: hande mouse events
void | viewWheelEvent (QWheelEvent *_event)
| specialized viewer: handle wheel events
void | viewKeyEvent (QKeyEvent *_event)
| specialized viewer: hande key events
void | updateProjectionMatrix (double _aspect=0.0)
| updates projection matrix

## Protected Attributes
bool | isRotating_
bool | lookAround_

## Private Slots
void | slotClickTimeout ()
| Handle click timeout.

## Private Member Functions
| glViewer (const glViewer &)
| Copy constructor. Never used!
glViewer & | operator= (const glViewer &)
| Assignment operator. Never used!
void | createWidgets ()
void | drawScene (double _aspect=0.0)
void | drawScene_mono ()
void | setCoordSysProjection (glViewer::ProjectionMode _mode)
| helper function for setting the projection mode of the coordinate system node
void | drawCursor ()
| draw the cursor
void | startGLDebugLogger ()
void | deleteGLDebugLogger ()
void | makeWidgetCurrent ()
bool | createQFBO (QOpenGLFramebufferObject *&_ptr, GLuint *_handle, int _width, int _height, int *_samples)
bool | bindQFBO (QOpenGLFramebufferObject *_ptr)
bool | QFBOResized (QOpenGLFramebufferObject *_ptr)
void | blitQFBO (QOpenGLFramebufferObject *_ptr1, const QRect &_size1, QOpenGLFramebufferObject *_ptr2, const QRect &_size2)
void | deleteQFBO (QOpenGLFramebufferObject *_ptr)
Stereo rendering
void | computeProjStereo (int _width, int _height, Viewer::ViewerProperties &_properties, ACG::GLMatrixd *_outLeft, ACG::GLMatrixd *_outRight)
| Compute left and right eye projection matrix for stereo rendering. More...

## Private Attributes
ACG::Vec3d | home_center_
double | home_radius_
ACG::GLMatrixd | home_modelview_
ACG::GLMatrixd | home_inverse_modelview_
double | homeOrthoWidth_
NormalsMode | normalsMode_
ProjectionMode | projectionMode_
NavigationMode | navigationMode_
bool | trackMouse_
bool | glareaGrabbed_
double | frame_time_
ACG::SceneGraph::BaseNode * | sceneGraphRoot_
bool | projectionUpdateLocked_
QGraphicsScene * | glScene_
OFGLWidget * | glWidget_
QtGLViewerLayout * | glBaseLayout_
std::vector< QAction *> | drawMenuActions_
QTime | redrawTime_
ACG::VertexArrayObject | defaultVAO_
QOpenGLDebugLogger * | glDebugLogger_
Post Processing
PostProcessing * | postproc_
| Post-Processing executor.

## Friends
class | QtGLGraphicsScene
class | SimpleGLGraphicsScene
class | QtGLGraphicsView

## Wheels
ACG::QtWidgets::QtWheel * | wheelX_
ACG::QtWidgets::QtWheel * | wheelY_
ACG::QtWidgets::QtWheel * | wheelZ_
bool | wheelsVisible ()
void | slotShowWheels ()
void | slotHideWheels ()

## Key handling
void | signalKeyPressEvent (QKeyEvent *)
| Key Event received. More...
virtual void | keyPressEvent (QKeyEvent *_event)
| Get keyPress events from the glArea. More...
virtual void | keyReleaseEvent (QKeyEvent *_event)
| Get keyRelease events from the glArea. More...
virtual bool | viewKeyPressEvent (QKeyEvent *)
| Handle key events in view mode. More...

## Drag and Drop
virtual void | dragEnterEvent (QGraphicsSceneDragDropEvent *_e)
| drag & drop for modelview copying
virtual void | dropEvent (QGraphicsSceneDragDropEvent *_e)
| drag & drop for modelview copying
void | startDragEvent (QMouseEvent *_event)
void | dragEnterEvent (QDragEnterEvent *_event)
void | dropEvent (QDropEvent *_event)

## Picking
typedef QOpenGLFramebufferObjectFormat | QFramebufferObjectFormat
| Framebuffer object that holds the pick cache.
typedef QOpenGLFramebufferObject | QFramebufferObject
| Framebuffer object that holds the pick cache.
QFramebufferObject * | pickCache_
| Framebuffer object that holds the pick cache.
QFramebufferObject * | mouseCache_
| Framebuffer object that holds the pick cache.
bool | updatePickCache_
| Should the pick cache be updated.
ACG::SceneGraph::PickTarget | pickCacheTarget_
| Pick target stored in pick cache.
bool | pickCacheSupported_
| Is pick caching supported.
bool | pick (ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, size_t &_nodeIdx, size_t &_targetIdx, ACG::Vec3d *_hitPointPtr=0)
bool | pick_region (ACG::SceneGraph::PickTarget _pickTarget, const QRegion &_region, QList< QPair< size_t, size_t > > &_list, QVector< float > *_depths=0, QVector< ACG::Vec3d > *_points=0)
| Perform picking action n a whole region. More...
bool | fast_pick (const QPoint &_mousePos, ACG::Vec3d &_hitPoint)
ACG::Vec3d | unproject (const ACG::Vec3d &pt)
| Framebuffer object that holds the pick cache.
int | pickColor (ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, size_t &_nodeIdx, size_t &_targetIdx, ACG::Vec3d *_hitPointPtr=0)
| pick using colors
int | pickFromCache (ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, size_t &_nodeIdx, size_t &_targetIdx, ACG::Vec3d *_hitPointPtr=0)
| pick from cache

## Merge from examiner
QPoint | lastPoint2D_
| mouse interaction position More...
float | startDepth_
| mouse interaction depth More...
ACG::Vec3d | lastPoint3D_
| mouse interaction position More...
bool | lastPoint_hitSphere_
| mouse interaction position More...
bool | allowRotation_
| mouse interaction position More...
ACG::Vec3d | lastRotationAxis_
| mouse interaction position More...
ACG::Vec3d | constrainedRotationAxis_
| mouse interaction position More...
double | lastRotationAngle_
| mouse interaction position More...
QTime | lastMoveTime_
| mouse interaction position More...
QTimer * | timer_
| mouse interaction position More...
double | fovyModifier_
| mouse interaction position More...
QTimer | clickTimer_
| mouse interaction position More...
QTime | clickTime_
| mouse interaction position More...
QMouseEvent | clickEvent_
| mouse interaction position More...
void | allowRotation (bool _mode)
| Lock scene rotation.
bool | allowRotation ()
| mouse interaction position More...
void | allowConstrainedRotation (const ACG::Vec3d &axis)
| mouse interaction position More...
bool | allowConstrainedRotation ()
| mouse interaction position More...
const ACG::Vec3d & | getConstrainedRotationAxis ()
| mouse interaction position More...
void | disallowConstrainedRotation ()
| mouse interaction position More...
void | invalidatePickCache ()
| mouse interaction position More...
void | slotAnimation ()
| mouse interaction position More...
bool | mapToSphere (const QPoint &_p, ACG::Vec3d &_result) const
| virtual trackball: map 2D screen point to unit sphere
void | handleFirstPersonNavigation (QMouseEvent *_event)
| Navigate through scene if first person mode has been selected.
void | handleNormalNavigation (QMouseEvent *_event)
| Navigate through scene if normal mode has been selected.

## Viewer State
Viewer::ViewerProperties & | properties_
| All properties for this viewer.
ACG::GLState * | glstate_
| Gl State.
bool | initialized_
| Have the viewer gl properties been initalized.
Viewer::ViewerProperties * | properties ()
| Returns a pointer to the Viewer Status.
const Viewer::ViewerProperties * | properties () const
| All properties for this viewer.
void | slotPropertiesUpdated ()
void | applyProperties ()

## Flying animation properties
QPropertyAnimation * | flyAnimationPerspective_
| The animation object for flyTo.
QPropertyAnimation * | flyAnimationOrthogonal_
| The animation object for flyTo.
ACG::Vec3d | flyTranslation_
| Full translation between start and ed of animation.
ACG::Vec3d | flyAxis_
| The rotation axis for fly to animation.
double | flyAngle_
| The rotation angle (full angle) for fly to animation.
double | lastAnimationPos_
| The last position of the animation to compute the difference vector.
double | currentAnimationPos_
| The property that is animated by flyTo.
ACG::Vec3d | flyCenter_
| The new center after the flyTo animation.
ACG::Vec3d | flyPosition_
| The new position after the flyTo animation.
double | flyOrthoWidthOriginal_
| Original orthogonal width during flyTo in orthogonal mode.
bool | flyMoveBack_
| Flag for fly in orthogonal mode if we move back or forward.
double | currentAnimationPosition
| The animation object for flyTo.
void | currentAnimationPosChanged (double _currentAnimationPos)
| Emitted when the currentAnimationPosition changed.
virtual void | flyTo (const QPoint &_pos, bool _moveBack)
| Animated flight to or away from a given point. More...
virtual void | flyTo (const QPoint &_pos)
| Animated flight. More...
virtual void | flyFrom (const QPoint &_pos)
| Animated flight. More...
virtual void | flyTo (const ACG::Vec3d &_position, const ACG::Vec3d &_center, int _time=1000)
void | flyAnimationPerspective (QVariant _pos)
| Slot called during flyTo Animation in perspective mode.
void | flyAnimationOrthogonal (QVariant _pos)
| Slot called during flyTo Animation in orthogonal mode.
void | flyAnimationPerspectiveFinished ()
| Slot called when flyTo perspective Animation finished.
void | flyAnimationOrthogonalFinished ()
| Slot called when flyTo orthogonal Animation finished.
double | currentAnimationPos ()
| Getter for aflyToAnimationPosition.
void | currentAnimationPos (double _currentAnimationPos)
| Setter for aflyToAnimationPosition.

## Detailed Description

Base Viewer Widget: All viewers are derived from this one. Implements Mouse & Keyboard Events.

Definition at line 126 of file QtBaseViewer.hh.

## Member Enumeration Documentation

## ◆ NavigationMode

enum glViewer::NavigationMode

Navigation mode.

Enumerator
NORMAL_NAVIGATION | Normal mode.
FIRSTPERSON_NAVIGATION | First person mode.

Definition at line 202 of file QtBaseViewer.hh.

## ◆ NormalsMode

enum glViewer::NormalsMode

Automatically normalize normals?

Enumerator
DONT_TOUCH_NORMALS | use provided normals as is
NORMALIZE_NORMALS | Automatically normalize normals. Input normals are not normalized or the transformation matrix does scaling or shearing.

Definition at line 230 of file QtBaseViewer.hh.

## ◆ ProjectionMode

enum glViewer::ProjectionMode

projection mode

Enumerator
ORTHOGRAPHIC_PROJECTION | orthographic
PERSPECTIVE_PROJECTION | perspective

Definition at line 196 of file QtBaseViewer.hh.

## Constructor & Destructor Documentation

## ◆ glViewer()

glViewer::glViewer | ( | QGraphicsScene * | _scene,
|  | OFGLWidget * | _glWidget,
|  | Viewer::ViewerProperties & | _properties,
|  | QGraphicsWidget * | _parent = `0`
| ) |  |

Create a glViewer.

Parameters

  _scene | The graphics scene that will be the parent of this widget
  _glWidget | A pointer to the underlying gl widget
  _properties | viewerOptions controlled by PluginFunctions
  _parent | The parent graphicswidget

Definition at line 120 of file QtBaseViewer.cc.

## Member Function Documentation

## ◆ actionCopyView

void glViewer::actionCopyView | ( | const QSize & | _windowSize = `QSize(-1,-1)`,
|  | const int | _splitterWidth = `-1`,
|  | const bool | _make_c_string = `false`
| ) |  |
| slot

if you want to save the windowSize, use the parameter

Note
  QSize(0,0) indicates that the window is maximized

Definition at line 1323 of file QtBaseViewer.cc.

## ◆ actionPasteView

void glViewer::actionPasteView | ( | QSize * | _windowSize = `NULL`,
|  | int * | _splitterWidth = `NULL`
| ) |  |
| slot

you get the older window size (if saved) back

Note
  QSize(0,0) indicates that the window is maximized.
  _splitterWidth is -1 if no splitterWidth was saved

Definition at line 1335 of file QtBaseViewer.cc.

## ◆ allowConstrainedRotation() [1/2]

void glViewer::allowConstrainedRotation | ( | const ACG::Vec3d & | axis | ) |
| inline

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 903 of file QtBaseViewer.hh.

## ◆ allowConstrainedRotation() [2/2]

bool glViewer::allowConstrainedRotation | ( |  | ) |
| inline

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 906 of file QtBaseViewer.hh.

## ◆ allowRotation()

bool glViewer::allowRotation | ( |  | ) |
| inline

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 901 of file QtBaseViewer.hh.

## ◆ applyProperties()

void glViewer::applyProperties | ( |  | ) |
| private

This will apply all properties without redrawing You have to set the context yourself!

Definition at line 2219 of file QtBaseViewer.cc.

## ◆ computeProjStereo()

void glViewer::computeProjStereo | ( | int | _width,
|  | int | _height,
|  | Viewer::ViewerProperties & | _properties,
|  | ACG::GLMatrixd * | _outLeft,
|  | ACG::GLMatrixd * | _outRight
| ) |  |
| private

Compute left and right eye projection matrix for stereo rendering.

Parameters

  _width | viewport width
  _height | viewport height
  _properties | viewer props
  _outLeft | [out] projection matrix for left eye
  _outRight | [out] projection matrix for right eye

Definition at line 2585 of file QtBaseViewer.cc.

## ◆ decodeView() [1/2]

bool glViewer::decodeView | ( | const QString & | _view,
|  | ACG::GLMatrixd & | m,
|  | ACG::GLMatrixd & | p,
|  | int & | pMode,
|  | double & | ortho_width,
|  | QSize * | _windowSize = `NULL`,
|  | int * | _splitterWidth = `NULL`,
|  | QSize * | _viewportSize = `NULL`
| ) |  |
| static

Decode text representation of view encoded by encodeView() into the supplied output parameters.

If `_view` was successfully decoded `true` is returned, `false` is returned otherwise.

You can save the current Window size via parameter _windowSize and one splitter size via _splitterwidth

Note
  QSize(0,0) indicates that the window was maximized.
  _splitterWidth is -1 if no splitterWidth was saved

Definition at line 1182 of file QtBaseViewer.cc.

## ◆ decodeView() [2/2]

bool glViewer::decodeView | ( | const QString & | _view,
|  | QSize * | _windowSize = `NULL`,
|  | int * | _toolBarWidth = `NULL`,
|  | QSize * | _viewportSize = `NULL`
| ) |  |

Decode and apply text representation of view encoded by encodeView(). If `_view` was successfully decoded it will immediately be applied and `true` is returned, `false` is returned else.

You can save the current Window size via parameter _windowSize and one splitter size via _splitterwidth These values will not be applied immediately.

Note
  QSize(0,0) indicates that the window was maximized.
  _splitterWidth is -1 if no splitterWidth was saved

Definition at line 1286 of file QtBaseViewer.cc.

## ◆ disallowConstrainedRotation()

void glViewer::disallowConstrainedRotation | ( |  | ) |
| inline

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 912 of file QtBaseViewer.hh.

## ◆ dragEnterEvent

void glViewer::dragEnterEvent | ( | QDragEnterEvent * | _event | ) |
| signal

Signal is emitted only if in externalDragMode ( see setExternalDrag ) It will be send if a drag enters the gl widget.

## ◆ dropEvent

void glViewer::dropEvent | ( | QDropEvent * | _event | ) |
| signal

Signal is emitted only if in externalDragMode ( see setExternalDrag ) It will be send if a drop occurs in the gl widget.

## ◆ encodeView()

void glViewer::encodeView | ( | QString & | _view,
|  | const QSize & | _windowSize = `QSize(-1,-1)`,
|  | const int | _toolBarWidth = `-1`,
|  | const bool | _make_c_string = `false`
| ) |  |

convert current view to text representation if saved, the old window size will be written into _windowSize

Note
  QSize(0,0) indicates that the window is maximized.

Definition at line 1139 of file QtBaseViewer.cc.

## ◆ fast_pick()

bool glViewer::fast_pick | ( | const QPoint & | _mousePos,
|  | ACG::Vec3d & | _hitPoint
| ) |  |

get the coordinates of the picked point by z-buffer re-projection

Parameters

  _mousePos | The position to pick
  _hitPoint | The point returned by the reprojection

Returns
  Successful?

Definition at line 623 of file QtBaseViewerPicking.cc.

## ◆ flyFrom

virtual void glViewer::flyFrom | ( | const QPoint & | _pos | ) |
| inline virtual slot

Animated flight.

Animated flight away from the given point.

Definition at line 1031 of file QtBaseViewer.hh.

## ◆ flyTo [1/3]

void glViewer::flyTo | ( | const QPoint & | _pos,
|  | bool | _moveBack
| ) |  |
| virtual slot

Animated flight to or away from a given point.

Animated flight to or away from a given point.

Parameters

  _pos | Point defining direction of flight (eye-point)
  _moveBack | To or away from point?

Definition at line 65 of file QtBaseViewerFlyAnimation.cc.

## ◆ flyTo [2/3]

virtual void glViewer::flyTo | ( | const QPoint & | _pos | ) |
| inline virtual slot

Animated flight.

Animated flight into the direction of the given point.

Definition at line 1023 of file QtBaseViewer.hh.

## ◆ flyTo [3/3]

void glViewer::flyTo | ( | const ACG::Vec3d & | _position,
|  | const ACG::Vec3d & | _center,
|  | int | _time = `1000`
| ) |  |
| virtual slot

Fly to point and set new viewing direction (animated).

Parameters

  _position | New viewer position ( the new eye point of the viewer )
  _center | The new scene center ( the point we are looking at )
  _time | Animation time in ms

Definition at line 221 of file QtBaseViewerFlyAnimation.cc.

## ◆ getConstrainedRotationAxis()

const ACG::Vec3d& glViewer::getConstrainedRotationAxis | ( |  | ) |
| inline

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 909 of file QtBaseViewer.hh.

## ◆ initializeGL()

void glViewer::initializeGL | ( |  | ) |
| protected virtual

Return a resonable size hint.

initialize OpenGL states

Definition at line 968 of file QtBaseViewer.cc.

## ◆ invalidatePickCache()

void glViewer::invalidatePickCache | ( |  | ) |
| inline

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 915 of file QtBaseViewer.hh.

## ◆ keyPressEvent()

virtual void glViewer::keyPressEvent | ( | QKeyEvent * | _event | ) |
| inline protected virtual

Get keyPress events from the glArea.

This function is called by the internal gl widget when receiving a key press event.

Definition at line 726 of file QtBaseViewer.hh.

## ◆ keyReleaseEvent()

virtual void glViewer::keyReleaseEvent | ( | QKeyEvent * | _event | ) |
| inline protected virtual

Get keyRelease events from the glArea.

This function is called by the internal gl widget when receiving a key release event. Here these events are simply passed to the parent widget.

Definition at line 734 of file QtBaseViewer.hh.

## ◆ pick()

bool glViewer::pick | ( | ACG::SceneGraph::PickTarget | _pickTarget,
|  | const QPoint & | _mousePos,
|  | size_t & | _nodeIdx,
|  | size_t & | _targetIdx,
|  | ACG::Vec3d * | _hitPointPtr = `0`
| ) |  |

Apply pick action.
Information about the picked primitive is stored in the provided pointers. No information is stored if 0-pointers are given. Resulting values are defined only if `true` has been returned!

Parameters

  _pickTarget | Select what should be picked: Faces/Vertices/...
  _mousePos | The position to be used for picking
  _nodeIdx | If picking is successful this will contain the id of the scenegraph node picked.
  _targetIdx | Special index defined by the picked Node. E.g. Facehandle/VertexHandle/.. for MeshNodes
  _hitPointPtr | Pointer to 3D point from picking

Returns
  Successful?

Definition at line 71 of file QtBaseViewerPicking.cc.

## ◆ pick_region()

bool glViewer::pick_region | ( | ACG::SceneGraph::PickTarget | _pickTarget,
|  | const QRegion & | _region,
|  | QList< QPair< size_t, size_t > > & | _list,
|  | QVector< float > * | _depths = `0`,
|  | QVector< ACG::Vec3d > * | _points = `0`
| ) |  |

Perform picking action n a whole region.

Apply pick action.
Picks all objects in the given Region. Information about the picked primitives is stored in the provided list. Resulting values are defined only if `true` has been returned!

Parameters

  _pickTarget | Select what should be picked: Faces/Vertices/...
  _region | Area for picking
  _list | List of found scenegraph objects (node/target pairs)
  _depths | depths [0,1] (Only provided, if requested)
  _points | back projected 3d points (Only provided, if requested)

Returns
  Successful?

Definition at line 424 of file QtBaseViewerPicking.cc.

## ◆ scene_center()

const ACG::Vec3d glViewer::scene_center | ( |  | ) | const
| inline

Get scene's center

See also
  setScenePos()

Definition at line 696 of file QtBaseViewer.hh.

## ◆ scene_radius()

double glViewer::scene_radius | ( |  | ) | const
| inline

Get scene's radius

Definition at line 699 of file QtBaseViewer.hh.

## ◆ sceneGraph()

void glViewer::sceneGraph | ( | ACG::SceneGraph::BaseNode * | _root,
|  | unsigned int | _maxPasses,
|  | ACG::Vec3d | _bbmin,
|  | ACG::Vec3d | _bbmax,
|  | const bool | _resetTrackBall = `false`
| ) |  |

Set scene graph. Sets the scene graph to the the graph rooted at `_root`. Recomputes Scene center and resets the trackball center if specified. The `sceneGraphToched()` signal will be emitted (even if `_root` does not actually change). Use the ACG::SceneGraph::analyzeSceneGraph() function to get the required bounding box and pass information.

Parameters

  _root | The root node of the scene graph
  _maxPasses | The maximal number of passes required to render the scenegraph
  _bbmin | Lower left of the scenegraph bounding box
  _bbmax | Upper right of the scenegraph bounding box
  _resetTrackBall | Reset the trackball center?

Definition at line 248 of file QtBaseViewer.cc.

## ◆ setSceneCenter()

void glViewer::setSceneCenter | ( | const ACG::Vec3d & | _center | ) |
| inline

Set new center point of scene

Definition at line 679 of file QtBaseViewer.hh.

## ◆ setScenePos()

void glViewer::setScenePos | ( | const ACG::Vec3d & | _center,
|  | double | _radius,
|  | const bool | _resetTrackBall = `false`
| ) |  |

Sets the center and dimension of the whole scene. This point is used as fixpoint for rotations and to set the eye point far enough from the scene so that the whole scene is visible.

Definition at line 433 of file QtBaseViewer.cc.

## ◆ setSceneRadius()

void glViewer::setSceneRadius | ( | double | _radius | ) |
| inline

Set new center point of scene

Definition at line 701 of file QtBaseViewer.hh.

## ◆ setTrackBallCenter()

void glViewer::setTrackBallCenter | ( | const ACG::Vec3d & | _center | ) |
| inline

Set Trackball Center point of scene.

The scene is rotated around the trackball center when using the mouse

Definition at line 685 of file QtBaseViewer.hh.

## ◆ signalCustomContextMenuRequested

void glViewer::signalCustomContextMenuRequested | ( | const QPoint & |  | ) |
| signal

If popups are disabled context menu mode is set to custom Menu and the signal is passed from the QGLWidget to this signal. You can use mapToGlobal for mapping this point to global coords.

## ◆ signalKeyPressEvent

void glViewer::signalKeyPressEvent | ( | QKeyEvent * |  | ) |
| signal

Key Event received.

This signal is emitted if a Key press event is received which is not handled by the widget itself. If internal key handling is disabled the events are passed to the parent of this widget.

## ◆ signalMouseEvent

void glViewer::signalMouseEvent | ( | QMouseEvent * | ,
|  | const std::string & |
| ) |  |
| signal

A signal for giving mouse events to the application. This is done if the Pick-Button (top-most button of the toolbar) is activated. Connect to this signal to implement application specific handling of mouse events.
Notes:

- You have to test for the QMouseEvent::type() of the event yourself (press/release/move)!
- signalMouseEventIdentify() is emitted on button press if actionMode()==Question.

## ◆ signalMouseEventClick

void glViewer::signalMouseEventClick | ( | QMouseEvent * | ,
|  | bool | _double
| ) |  |
| signal

Emitted if a (double) mouse click is performed in actionMode()==ExamineMode

## ◆ signalMouseEventIdentify

void glViewer::signalMouseEventIdentify | ( | QMouseEvent * |  | ) |
| signal

Emitted instead of signalMouseEvent() if actionMode()==Question and `_event` is a mouse press event.

## ◆ signalMouseEventLight

void glViewer::signalMouseEventLight | ( | QMouseEvent * |  | ) |
| signal

Emitted instead of signalMouseEvent() if actionMode()==Light and `_event` is a mouse press event.

## ◆ slotAnimation

void glViewer::slotAnimation | ( |  | ) |
| private slot

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 2197 of file QtBaseViewer.cc.

## ◆ slotPropertiesUpdated

void glViewer::slotPropertiesUpdated | ( |  | ) |
| private slot

Called when properties for the viewer require a redraw The slot will trigger the redraw after setting the right properties.

Definition at line 2245 of file QtBaseViewer.cc.

## ◆ snapshot

void glViewer::snapshot | ( | int | _width = `0`,
|  | int | _height = `0`,
|  | bool | _alpha = `false`,
|  | bool | _hideCoordsys = `false`,
|  | int | samples = `1`
| ) |  |
| virtual slot

Trigger a snapshot and increase the snapshot counter. Save snapshot to file determined by snapshotBaseFileName() and the current snapshot counter. The back buffer will be saved.

Definition at line 2384 of file QtBaseViewer.cc.

## ◆ startDragEvent

void glViewer::startDragEvent | ( | QMouseEvent * | _event | ) |
| signal

Signal is emitted when Control modifier is pressed and mouse moded. It will only be emitted if in externalDragMode ( see setExternalDrag )

## ◆ trackBallCenter()

const ACG::Vec3d glViewer::trackBallCenter | ( |  | ) |
| inline

Get Trackball Center point of scene.

The scene is rotated around the trackball center when using the mouse

Definition at line 691 of file QtBaseViewer.hh.

## ◆ viewKeyPressEvent()

virtual bool glViewer::viewKeyPressEvent | ( | QKeyEvent * |  | ) |
| inline protected virtual

Handle key events in view mode.

This function is called by the BaseViewer if a key press event occured in view mode. This function has to be implemented by every viewer!

Returns
  If the derived class handled the event it has to return true otherwise false

Definition at line 743 of file QtBaseViewer.hh.

## Member Data Documentation

## ◆ allowRotation_

bool glViewer::allowRotation_
| private

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 952 of file QtBaseViewer.hh.

## ◆ clickEvent_

QMouseEvent glViewer::clickEvent_
| private

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 964 of file QtBaseViewer.hh.

## ◆ clickTime_

QTime glViewer::clickTime_
| private

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 963 of file QtBaseViewer.hh.

## ◆ clickTimer_

QTimer glViewer::clickTimer_
| private

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 962 of file QtBaseViewer.hh.

## ◆ constrainedRotationAxis_

ACG::Vec3d glViewer::constrainedRotationAxis_
| private

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 956 of file QtBaseViewer.hh.

## ◆ fovyModifier_

double glViewer::fovyModifier_
| private

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 960 of file QtBaseViewer.hh.

## ◆ lastMoveTime_

QTime glViewer::lastMoveTime_
| private

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 958 of file QtBaseViewer.hh.

## ◆ lastPoint2D_

QPoint glViewer::lastPoint2D_
| protected

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 929 of file QtBaseViewer.hh.

## ◆ lastPoint3D_

ACG::Vec3d glViewer::lastPoint3D_
| private

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 950 of file QtBaseViewer.hh.

## ◆ lastPoint_hitSphere_

bool glViewer::lastPoint_hitSphere_
| private

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 951 of file QtBaseViewer.hh.

## ◆ lastRotationAngle_

double glViewer::lastRotationAngle_
| private

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 957 of file QtBaseViewer.hh.

## ◆ lastRotationAxis_

ACG::Vec3d glViewer::lastRotationAxis_
| private

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 955 of file QtBaseViewer.hh.

## ◆ startDepth_

float glViewer::startDepth_
| protected

mouse interaction depth

This variable stores the depth when the user started a mouse interaction.

Definition at line 935 of file QtBaseViewer.hh.

## ◆ timer_

QTimer* glViewer::timer_
| private

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 959 of file QtBaseViewer.hh.

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

- OpenFlipper/widgets/glWidget/QtBaseViewer.hh
- OpenFlipper/widgets/glWidget/QtBaseViewer.cc
- OpenFlipper/widgets/glWidget/QtBaseViewer_qt.cc
- OpenFlipper/widgets/glWidget/QtBaseViewerFlyAnimation.cc
- OpenFlipper/widgets/glWidget/QtBaseViewerPicking.cc