Developer Documentation
ACG::QtWidgets::QtExaminerViewer Class Reference

#include <ACG/QtWidgets/QtExaminerViewer.hh>

Inheritance diagram for ACG::QtWidgets::QtExaminerViewer:

Public Member Functions

 QtExaminerViewer (QWidget *_parent=0, const char *_name=0, QStatusBar *_statusBar=0, const QGLFormat *_format=0, const QtBaseViewer *_share=0, Options _options=DefaultOptions)
void allowRotation (bool _mode)
 Lock scene rotation.
double wheelZoomFactor ()
 Factors for zooming with the wheel.
double wheelZoomFactorShift ()
void setWheelZoomFactor (double _factor)
void setWheelZoomFactorShift (double _factor)
- Public Member Functions inherited from ACG::QtWidgets::QtBaseViewer
 QtBaseViewer (QWidget *_parent=0, const char *_name=0, QStatusBar *_statusBar=0, const QGLFormat *_format=0, const QtBaseViewer *_share=0, Options _options=DefaultOptions)
virtual ~QtBaseViewer ()
virtual QSize sizeHint () const
QStatusBar * statusBar ()
 get status bar, guaranteed to be not 0 (QStatusBar may be invisible)
void setStatusBar (QStatusBar *_sb)
void applyOptions (int _options)
 Apply ORed Options _options.
int options () const
 get current ORed Options
virtual void makeCurrent ()
 Makes this widget the current widget for OpenGL operations.
virtual void swapBuffers ()
 Swaps the screen contents with the off-screen buffer.
GLStateglState ()
 get OpenGL state
void backgroundColor (const Vec4f &_color)
Vec4f backgroundColor ()
 get background color
virtual void lockUpdate ()
virtual void unlockUpdate ()
 Unlock display locked by updateLock().
virtual void unlockAndUpdate ()
bool isUpdateLocked () const
void lockProjectionUpdate (void)
 Lock update of projection matrix.
void unlockProjectionUpdate (void)
 Unlock update of projection matrix.
bool animation () const
 Is animation enabled?
void animation (bool _b)
 Set animation enabled.
void trackMouse (bool _track)
 Enable/disable mouse tracking (move events with no button press)
void enablePopupMenu (bool _enable)
 Enable/disable right button draw mode menu (default: enabled)
SceneGraph::BaseNodesceneGraph ()
 Returns: root node of scene graph.
const SceneGraph::BaseNodesceneGraph () const
 same but const
void sceneGraph (SceneGraph::BaseNode *_root)
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 _setCenter=true)
void setSceneCenter (const ACG::Vec3d &_center)
const ACG::Vec3dscene_center () const
double scene_radius () const
void setSceneRadius (double radius)
void viewingDirection (const ACG::Vec3d &_dir, const ACG::Vec3d &_up)
 set the viewing direction
void setFovy (double _fovy)
 set field of view y
void actionMode (ActionMode)
ActionMode lastActionMode ()
 Return the last action mode.
ActionMode actionMode () const
 get action mode
void faceOrientation (FaceOrientation)
 set face orientation (used for back face culling, backFaceCulling())
FaceOrientation faceOrientation () const
 get face orientation
void backFaceCulling (bool _b)
 set backface culling on/off
bool backFaceCulling () const
 is backface culling enabled?
void twoSidedLighting (bool _b)
 set 2-sided lighting on/off
bool twoSidedLighting () const
 is 2-sided lighing enabled?
void normalsMode (NormalsMode _mode)
 set treatment of normals
NormalsMode normalsMode () const
 get treatment of normals
GLMatrixdlight_matrix ()
 get light rotation matrix
void rotate_lights (Vec3d &_axis, double _angle)
 rotete light sources
void update_lights ()
 update light position
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
void drawMode (ACG::SceneGraph::DrawModes::DrawMode _mode)
 set draw mode (No test if this mode is available!)
ACG::SceneGraph::DrawModes::DrawMode drawMode ()
 get current draw mode
void encodeView (QString &_view)
 convert current view to text representation
bool decodeView (const QString &_view)
void initModelviewMatrix ()
 initialize modelview matrix to identity
void grabGLArea ()
void releaseGLArea ()
void drawBlendedObjects (bool _status)
 One or two pass Drawing.
void translate (const Vec3d &trans)
 translate the scene and update modelview matrix
void rotate (const Vec3d &axis, double angle)
 rotate the scene (around its center) and update modelview matrix
void rotate (const Vec3d &axis, double angle, const Vec3d &_center)
 rotate the scene and update modelview matrix
QMenu * getPickMenu ()
 Get the menu pointers (required to add them to the menubar as a temp workaround for a qt 4.3 bug.
QMenu * getFuncMenu ()
QMenu * getDrawMenu ()
QToolBar * getToolBar ()
 Returns a pointer to the Toolbar.
QToolBar * removeToolBar ()
 Returns a pointer to the toolbar and removes it from the default position in the examiner widget.
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.
void setEyeDistance (double _distance)
 Set eye distance for stereo. More...
double eyeDistance ()
 Get the current eye Distance.
void setFocalDistance (double _distance)
 Set focal distance for stereo. More...
double focalDistance ()
 Get the current focal Distance.
void disableKeyHandling (bool _state)
 Enable or disable internal Key handling. More...
bool keyHandlingState ()
 get the current key handling state. More...
void setExternalDrag (bool _external)
 Enable or disable external dragging controls.
void sync_connect (const QtBaseViewer *)
void sync_disconnect (const QtBaseViewer *)
 unsync two sync_connect()ed QtBaseViewer's
virtual void setSynchronization (bool _b)
 toggle global synchronization
bool add_sync_host (const QString &_name)
 add host to synchronize with, given by its name
void add_sync_host (QHostAddress &_adr)
 add host to synchronize with, given by its address
bool synchronization ()
 synchronized with different viewer?
bool pick (SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, unsigned int &_nodeIdx, unsigned int &_targetIdx, Vec3d *_hitPointPtr=0)
bool fast_pick (const QPoint &_mousePos, Vec3d &_hitPoint)
void addPickMode (const std::string &_name, bool _mouse_tracking=false, int _pos=-1, bool _visible=true, QCursor _cursor=Qt::ArrowCursor)
 add pick mode More...
void clearPickModes ()
const std::string & pickMode () const
void pickMode (const std::string &_name)
void pickMode (int _id)
void renderPicking (bool _renderPicking, ACG::SceneGraph::PickTarget _mode)

Protected Member Functions

virtual bool viewKeyPressEvent (QKeyEvent *)
 handle new key events
virtual void viewWheelEvent (QWheelEvent *_event)
 handle wheel events
virtual void viewMouseEvent (QMouseEvent *_event)
 handle mouse events
virtual void lightMouseEvent (QMouseEvent *_event)
 handle mouse events
- Protected Member Functions inherited from ACG::QtWidgets::QtBaseViewer
virtual void initializeGL ()
 initialize OpenGL states
virtual void paintGL ()
 draw the scene. Triggered by updateGL().
virtual void resizeGL (int _w, int _h)
 handle resize events
virtual void glMousePressEvent (QMouseEvent *_event)
 handle mouse press events
virtual void glMouseDoubleClickEvent (QMouseEvent *_event)
 handle mouse double click events
virtual void glMouseMoveEvent (QMouseEvent *_event)
 handle mouse move events
virtual void glMouseReleaseEvent (QMouseEvent *_event)
 handle mouse release events
virtual void glMouseWheelEvent (QWheelEvent *_event)
 handle mouse wheel events
virtual void glContextMenuEvent (QContextMenuEvent *_event)
 handle mouse press events More...
void updateProjectionMatrix ()
 updates projection matrix
void updatePickMenu ()
 update pick mode menu
virtual void glKeyPressEvent (QKeyEvent *)
 Get keyPress events from the glArea. More...
virtual void glKeyReleaseEvent (QKeyEvent *_event)
 Get keyRelease events from the glArea. More...
virtual void startDrag ()
 drag & drop for modelview copying
virtual void glDragEnterEvent (QDragEnterEvent *_event)
 drag & drop for modelview copying
virtual void glDropEvent (QDropEvent *_event)
 drag & drop for modelview copying

Protected Attributes

QPoint lastPoint2D_
- Protected Attributes inherited from ACG::QtWidgets::QtBaseViewer
Vec3d scene_center_
Vec3d trackball_center_
double scene_radius_
double trackball_radius_
GLdouble orthoWidth_
GLdouble near_
GLdouble far_
GLdouble fovy_
bool isRotating_
QStatusBar * statusbar_

Private Slots

void slotAnimation ()

Private Member Functions

bool mapToSphere (const QPoint &_p, Vec3d &_result) const
 virtual trackball: map 2D screen point to unit sphere

Private Attributes

double wZoomFactor_
double wZoomFactorShift_
Vec3d lastPoint3D_
bool lastPoint_hitSphere_
bool allowRotation_
Vec3d lastRotationAxis_
double lastRotationAngle_
QTime lastMoveTime_
QTimer * timer_

Additional Inherited Members

- Public Types inherited from ACG::QtWidgets::QtBaseViewer
enum  Options {
  Nothing =0, ShowPrivateStatusBar =1, ShowToolBar =2, ShowPickButton =4,
  ShowLassoButton =8, ShowQuestionButton =0x10, ShowWheelX =0x20, ShowWheelY =0x40,
  ShowWheelZ =0x80, ShowWheels =0xe0, DefaultOptions = 0xffff & (~ShowPrivateStatusBar)
 Navigation mode. More...
 projection mode More...
enum  ActionMode { ExamineMode, PickingMode, QuestionMode, LightMode }
 How to react on mouse events? More...
 orientation of the faces More...
 Automatically normalize normals? More...
- Public Slots inherited from ACG::QtWidgets::QtBaseViewer
virtual void drawNow ()
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 flyTo (const QPoint &_pos, bool _move_back)
 Fly to. Get closer if _move_back=false, get more distant else. More...
virtual void flyTo (const QPoint &_pos)
 Fly to, get closer.
virtual void flyFrom (const QPoint &_pos)
 Fly to, get more distant.
virtual void flyTo (const Vec3d &_position, const Vec3d &_center, double _time=1000.0)
virtual void examineMode ()
 calls actionMode() with ExamineMode (cf. ActionMode)
virtual void lightMode ()
 calls actionMode() with LightMode (cf. ActionMode)
virtual void questionMode ()
 calls actionMode() with QuestionMode (cf. ActionMode)
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 showSceneGraphDialog ()
 show scenegraph widget
virtual void setView (const GLMatrixd &_modelview, const GLMatrixd &_inverse_modelview)
 set view, used for synchronizing
void actionBackground ()
void actionCopyView ()
void actionPasteView ()
void actionPasteDropSize ()
void actionSynchronize ()
void actionAnimation ()
void actionBackfaceCulling ()
void actionTwoSidedLighting ()
void actionSynchronize (bool _enable)
void actionAnimation (bool _enable)
void actionBackfaceCulling (bool _enable)
void actionTwoSidedLighting (bool _enable)
void actionDrawMenu (QAction *_action)
void actionPickMenu (QAction *_action)
virtual void toggleStereoMode ()
 toggle stereo mode
virtual void setStereoMode (bool _b)
 enable/disable stereo mode
virtual void snapshotBaseFileName (const QString &_fname)
virtual void snapshot ()
void actionSnapshot ()
void actionSnapshotName ()
void actionSnapshotSavesView ()
virtual void pickingMode ()
void setPickModeCursor (const std::string &_name, QCursor _cursor)
 set a new cursor for the pick mode More...
void setPickModeMouseTracking (const std::string &_name, bool _mouseTracking)
 set mouseTracking for the pick mode More...
- Signals inherited from ACG::QtWidgets::QtBaseViewer
void projectionModeChanged (bool _ortho)
void navigationModeChanged (bool _normal)
void signalInitializeGL ()
 emitted when OpenGL stuff can be initialized
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 signalSetView (const GLMatrixd &_modelview, const GLMatrixd &_inverse_modelview)
 set view, used for synchronizing (cf. slotSetView())
void signalSceneGraphChanged (ACG::SceneGraph::BaseNode *_root)
 scene graph has changed
void signalNodeChanged (ACG::SceneGraph::BaseNode *_node)
 scene graph has changed
void signalActionModeChanged (ACG::QtWidgets::QtBaseViewer::ActionMode _m)
 action mode was changed
void signalDrawScene (ACG::GLState *_state)
 render callback
void signalCustomContextMenuRequested (const QPoint &)
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 signalKeyPressEvent (QKeyEvent *)
 Key Event received. More...
void startDragEvent (QMouseEvent *_event)
void dragEnterEvent (QDragEnterEvent *_event)
void dropEvent (QDropEvent *_event)
void signalPickModeChanged (const std::string &)
- Protected Slots inherited from ACG::QtWidgets::QtBaseViewer
virtual void sceneRectChanged (const QRectF &rect)
 process graphics scene size changes
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 slotNodeChanged (ACG::SceneGraph::BaseNode *_node)
 connected to scenegraph widget
virtual void cleanupEventFilter ()
 correct ??? (same function as in qt src)

Detailed Description

Widgets used to display and examine scenegraphs. This widget is used in all viewers that want to explore scenegraphs. For WalkMode use "QtWalkViewer"

Definition at line 97 of file QtExaminerViewer.hh.

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