ACG::QtWidgets::QtBaseViewer Class Reference

#include <ACG/QtWidgets/QtBaseViewer.hh>

Inheritance diagram for ACG::QtWidgets::QtBaseViewer:
Inheritance graph
[legend]
Collaboration diagram for ACG::QtWidgets::QtBaseViewer:
Collaboration graph
[legend]

List of all members.

Classes

struct  PickMode

Public Types

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)
}
enum  NavigationMode { NORMAL_NAVIGATION, FIRSTPERSON_NAVIGATION }
 

Navigation mode.

More...
enum  ProjectionMode { ORTHOGRAPHIC_PROJECTION, PERSPECTIVE_PROJECTION }
 

projection mode

More...
enum  ActionMode { ExamineMode, PickingMode, QuestionMode, LightMode }
 

How to react on mouse events?

More...
enum  FaceOrientation { CCW_ORIENTATION, CW_ORIENTATION }
 

orientation of the faces

More...
enum  NormalsMode { DONT_TOUCH_NORMALS, NORMALIZE_NORMALS }
 

Automatically normalize normals?

More...

Public Slots

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

Signals

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 &)
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.

Public Member Functions

 QtBaseViewer (QWidget *_parent=0, const char *_name=0, QStatusBar *_statusBar=0, const QGLFormat *_format=0, const QtBaseViewer *_share=0, Options _options=DefaultOptions)
virtual ~QtBaseViewer ()
 Destructor.
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::Vec3d & scene_center () const
double scene_radius () const
void viewingDirection (const ACG::Vec3d &_dir, const ACG::Vec3d &_up)
 set the viewing direction
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.

Protected Slots

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)

Protected Member Functions

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
virtual void viewMouseEvent (QMouseEvent *_event)=0
 specialized viewer: hande mouse events
virtual void viewWheelEvent (QWheelEvent *_event)=0
 specialized viewer: handle wheel events
virtual void lightMouseEvent (QMouseEvent *)
 optional: hande mouse events to rotate light
void updateProjectionMatrix ()
 updates projection matrix
void updatePickMenu ()
 update pick mode menu

Protected Attributes

Vec3d scene_center_
Vec3d trackball_center_
double scene_radius_
double trackball_radius_
GLdouble orthoWidth_
GLdouble near_
GLdouble far_
GLdouble fovy_
GLStateglstate_
bool isRotating_
QStatusBar * statusbar_

Private Types

enum  FuncMenuID {
  M_CopyView = 0x100, M_PasteView, M_PasteDropSize, M_Animation,
  M_BackfaceCulling, M_TwoSidedLighting, M_Background, M_Snapshot,
  M_SnapshotName, M_SnapshotSavesView, M_Synchronize
}

Private Slots

void hidePopupMenus ()

Private Member Functions

 QtBaseViewer (const QtBaseViewer &)
 Copy constructor. Never used!
QtBaseVieweroperator= (const QtBaseViewer &)
 Assignment operator. Never used!
void createWidgets (const QGLFormat *_format, QStatusBar *_sb, const QtBaseViewer *_share)
void drawScene ()
void drawScene_mono ()
void drawScene_stereo ()
void updatePopupMenu ()

Private Attributes

Vec3d home_center_
double home_radius_
GLMatrixd home_modelview_
GLMatrixd home_inverse_modelview_
double homeOrthoWidth_
GLMatrixd light_matrix_
NormalsMode normalsMode_
FaceOrientation faceOrientation_
ProjectionMode projectionMode_
NavigationMode navigationMode_
ActionMode actionMode_
ActionMode lastActionMode_
bool backFaceCulling_
bool twoSidedLighting_
bool animation_
bool trackMouse_
bool popupEnabled_
bool glareaGrabbed_
double frame_time_
QMenu * pickMenu_
QMenu * funcMenu_
QMenu * drawMenu_
SceneGraph::BaseNodesceneGraphRoot_
ACG::SceneGraph::DrawModes::DrawMode curDrawMode_
ACG::SceneGraph::DrawModes::DrawMode availDrawModes_
bool updateLocked_
bool projectionUpdateLocked_
bool blending_
QtSceneGraphDialogsceneGraphDialog_
Options options_
QGLWidget * glWidget_
QtGLGraphicsSceneglScene_
QtGLGraphicsViewglView_
QGraphicsWidget * glBase_
QGraphicsGridLayout * glBaseLayout_
QStatusBar * privateStatusBar_
QGridLayout * glLayout_
QToolBar * buttonBar_
QToolButton * pickButton_
QToolButton * moveButton_
QToolButton * lightButton_
QToolButton * questionButton_
QToolButton * projectionButton_
QToolButton * homeButton_
QToolButton * setHomeButton_
QToolButton * viewAllButton_
QToolButton * sceneGraphButton_
QToolButton * stereoButton_
QtWheelwheelX_
QtWheelwheelY_
QtWheelwheelZ_
QMap< QString, QAction * > action_
std::vector< QAction * > drawMenuActions_
QTime redrawTime_

Friends

class QtGLGraphicsScene
class QtGLGraphicsView

Stereo



bool stereo_
double eyeDist_
double focalDist_
void setEyeDistance (double _distance)
 Set eye distance for stereo.
double eyeDistance ()
 Get the current eye Distance.
void setFocalDistance (double _distance)
 Set focal distance for stereo.
double focalDistance ()
 Get the current focal Distance.
virtual void toggleStereoMode ()
 toggle stereo mode
virtual void setStereoMode (bool _b)
 enable/disable stereo mode

Key handling



bool disableKeyHandling_
void disableKeyHandling (bool _state)
 Enable or disable internal Key handling.
bool keyHandlingState ()
 get the current key handling state.
void signalKeyPressEvent (QKeyEvent *)
 Key Event received.
virtual void glKeyPressEvent (QKeyEvent *)
 Get keyPress events from the glArea.
virtual void glKeyReleaseEvent (QKeyEvent *_event)
 Get keyRelease events from the glArea.
virtual bool viewKeyPressEvent (QKeyEvent *_event)=0
 Handle key events in view mode.

Drag and Drop



bool externalDrag_
void setExternalDrag (bool _external)
 Enable or disable external dragging controls.
void startDragEvent (QMouseEvent *_event)
void dragEnterEvent (QDragEnterEvent *_event)
void dropEvent (QDropEvent *_event)
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

Synchronize different viewers



bool synchronized_
 synchronized with different viewer?
bool skipNextSync_
 Skips the next synch event.
QUdpSocket * socket_
 socket used for synchronization
std::vector< QHostAddress > sync_hosts_
 List of hosts which should receive sync information.
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 ()
void sync_receive ()
void sync_send (const GLMatrixd &_modelview, const GLMatrixd &_inverse_modelview)

Snapshots



QString snapshotName_
int snapshotCounter_
QImage * snapshot_
virtual void snapshotBaseFileName (const QString &_fname)
virtual void snapshot ()
void actionSnapshot ()
void actionSnapshotName ()
void actionSnapshotSavesView ()

Picking



std::vector< PickModepick_modes_
std::string pick_mode_name_
int pick_mode_idx_
bool renderPicking_
ACG::SceneGraph::PickTarget pickRendererMode_
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
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)
virtual void pickingMode ()
void setPickModeCursor (const std::string &_name, QCursor _cursor)
 set a new cursor for the pick mode
void setPickModeMouseTracking (const std::string &_name, bool _mouseTracking)
 set mouseTracking for the pick mode
void signalPickModeChanged (const std::string &)

Detailed Description

Base Viewer Widget: All viewers are derived from this one. Implement Mouse & Keyboard Events. Redefine Signals and Slots. See for example "QtExaminerViewer"

Definition at line 123 of file QtBaseViewer.hh.


Member Enumeration Documentation

How to react on mouse events?

Enumerator:
PickingMode 

Picking mode. Actually no pick()ing is performed (!) but events are forwarded to the application via signalMouseEvent().

Definition at line 347 of file QtBaseViewer.hh.

orientation of the faces

Enumerator:
CCW_ORIENTATION 

counter clockwise (default)

CW_ORIENTATION 

clockwise

Definition at line 376 of file QtBaseViewer.hh.

Navigation mode.

Enumerator:
NORMAL_NAVIGATION 

Normal mode.

FIRSTPERSON_NAVIGATION 

First person mode.

Definition at line 302 of file QtBaseViewer.hh.

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 397 of file QtBaseViewer.hh.

Options for creating a QtBaseViewer. (cf. QtBaseViewer::QtBaseViewer(), applyOptions())

Enumerator:
Nothing 

all options disabled

ShowPrivateStatusBar 

Show private status bar?
If the widget is constructed (cf. QtBaseViewer::QtBaseViewer()) with no status bar (_statusBar==0) then a private QStatusBar will be created. Use this option to show or hide it. It has no effect if the QStatusBar is provided externally.

ShowToolBar 

Show tool bar?
The tool bar consists of several buttons that can be used to control this view, etc. It will be placed vertically on the right side.

Note: This toolbar inlcudes the wheels for translation along the z-axis (right, cf. ShowWheelZ)!

The default setting is to show all buttons (see below).

ShowPickButton 

Show pick button? Effect only if ShowToolBar!

ShowLassoButton 

Show lasso button? Effect only if ShowToolBar!

ShowQuestionButton 

Show question button? Effect only if ShowToolBar!

ShowWheelX 

Show wheel for rotation around x-axis (left)?

ShowWheelY 

Show wheel for rotation around y-axis (bottom)?

ShowWheelZ 

Show wheel for translation along z-axis (right)? Effect only if ShowToolBar!

ShowWheels 

Show all three wheels (default)!

DefaultOptions 

default: all options (but not private statusbar) enabled

Definition at line 133 of file QtBaseViewer.hh.

projection mode

Enumerator:
ORTHOGRAPHIC_PROJECTION 

orthographic

PERSPECTIVE_PROJECTION 

perspective

Definition at line 308 of file QtBaseViewer.hh.


Constructor & Destructor Documentation

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 
)

Create a QtBaseViewer.

Parameters:
_parent parent widget
_name name (qt internal, qt debugging)
_statusBar pointer to an existing status bar for this widget, if statusBar==0 then a private status bar will be created
_format OpenGL context settings, will be passed to glarea()
_options QtBaseViewer::Options

Definition at line 152 of file QtBaseViewer.cc.

References actionSnapshot(), actionSnapshotName(), actionSnapshotSavesView(), add_sync_host(), CCW_ORIENTATION, DONT_TOUCH_NORMALS, examineMode(), ACG::Matrix4x4T< Scalar >::identity(), ACG::SceneGraph::DrawModes::NONE, NORMAL_NAVIGATION, PERSPECTIVE_PROJECTION, PickingMode, skipNextSync_, socket_, and synchronized_.


Member Function Documentation

void ACG::QtWidgets::QtBaseViewer::actionMode ( ActionMode  _am  ) 

Set action mode. The ActionMode determines the type of reaction on mouse events. Note: You may also use the slots examineMode(), etc. to set this mode.

Definition at line 638 of file QtBaseViewer.cc.

References pick_mode_idx_, pick_mode_name_, pick_modes_, PickingMode, signalActionModeChanged(), signalPickModeChanged(), and trackMouse().

void ACG::QtWidgets::QtBaseViewer::actionSnapshot (  )  [slot]

This action triggers a snapshot

Definition at line 129 of file QtBaseViewerSnapshot.cc.

References snapshot().

Referenced by QtBaseViewer().

void ACG::QtWidgets::QtBaseViewer::actionSnapshotName (  )  [slot]

This action creates a widget for entering the snapshots name.

Definition at line 138 of file QtBaseViewerSnapshot.cc.

References snapshotBaseFileName().

Referenced by QtBaseViewer().

void ACG::QtWidgets::QtBaseViewer::actionSnapshotSavesView (  )  [slot]

Doesn't do anything at the moment. Widget shows a checkbox for that.

Definition at line 159 of file QtBaseViewerSnapshot.cc.

Referenced by QtBaseViewer().

void ACG::QtWidgets::QtBaseViewer::addPickMode ( const std::string &  _name,
bool  _mouse_tracking = false,
int  _pos = -1,
bool  _visible = true,
QCursor  _cursor = Qt::ArrowCursor 
)

add pick mode

Parameters:
_name Name of the Pick Mode or "Separator" to insert a separator
_mouse_tracking true: every mouse movement will emit mouse events not only when mousebutton is pressed
_pos position to insert the mode in the popup menu.

Definition at line 231 of file QtBaseViewerPicking.cc.

References pick_modes_, and updatePickMenu().

void ACG::QtWidgets::QtBaseViewer::backgroundColor ( const Vec4f &  _color  )  [inline]

Set background color. Sets the OpenGL clear color to (_c.red(), _c.green(), _c.blue(), 0).

Definition at line 241 of file QtBaseViewer.hh.

void ACG::QtWidgets::QtBaseViewer::clearPickModes (  ) 

clear all pick modes

Definition at line 282 of file QtBaseViewerPicking.cc.

References pick_mode_idx_, pick_mode_name_, pick_modes_, and updatePickMenu().

bool ACG::QtWidgets::QtBaseViewer::decodeView ( const QString &  _view  ) 

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.

Definition at line 1378 of file QtBaseViewer.cc.

References makeCurrent(), projectionMode(), ACG::GLState::set_modelview(), ACG::GLState::set_projection(), and updateGL().

Referenced by glDropEvent().

void ACG::QtWidgets::QtBaseViewer::disableKeyHandling ( bool  _state  ) 

Enable or disable internal Key handling.

With this function you can enable or disable viewers internal key handling. If disabled, all key events are passed to the widgets parent.

Definition at line 65 of file QtBaseViewerKeyHandling.cc.

void ACG::QtWidgets::QtBaseViewer::dragEnterEvent ( QDragEnterEvent *  _event  )  [signal]

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

Referenced by glDragEnterEvent().

void ACG::QtWidgets::QtBaseViewer::drawNow (  )  [virtual, slot]

Draws the scene immediately. This method does not trigger a paint event (like updateGL()) but redraws the scene immediately. It does not swap buffers! This has to be done manually.

Definition at line 807 of file QtBaseViewer.cc.

References makeCurrent(), paintGL(), and swapBuffers().

Referenced by flyTo().

void ACG::QtWidgets::QtBaseViewer::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.

Referenced by glDropEvent().

bool ACG::QtWidgets::QtBaseViewer::fast_pick ( const QPoint &  _mousePos,
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:
Successfull?

Definition at line 182 of file QtBaseViewerPicking.cc.

References glHeight(), makeCurrent(), and ACG::GLState::unproject().

void ACG::QtWidgets::QtBaseViewer::flyTo ( const Vec3d &  _position,
const Vec3d &  _center,
double  _time = 1000.0 
) [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 1051 of file QtBaseViewer.cc.

References drawNow(), makeCurrent(), ACG::GLState::modelview(), rotate(), ACG::Matrix4x4T< Scalar >::transform_point(), translate(), and updateGL().

void ACG::QtWidgets::QtBaseViewer::flyTo ( const QPoint &  _pos,
bool  _move_back 
) [virtual, slot]

Fly to. Get closer if _move_back=false, get more distant else.

Todo:
: Translate view such that hitpoint is in center of viewport

Definition at line 1009 of file QtBaseViewer.cc.

References glState(), ACG::GLState::inverse_modelview(), makeCurrent(), ACG::GLState::modelview(), PERSPECTIVE_PROJECTION, pick(), ACG::SceneGraph::PICK_ANYTHING, signalSetView(), updateGL(), updateProjectionMatrix(), and viewChanged().

void ACG::QtWidgets::QtBaseViewer::glContextMenuEvent ( QContextMenuEvent *  _event  )  [protected, virtual]

handle mouse press events

Todo:
: if (funcMenu_ && funcMenu_->count()>0)
Todo:
: if (pickMenu_ && pickMenu_->count()>0)
Todo:
: && drawMenu_->count()>0)
Todo:
: && funcMenu_->count()>0)
Todo:
: && pickMenu_->count()>0)

Definition at line 2192 of file QtBaseViewer.cc.

void ACG::QtWidgets::QtBaseViewer::glKeyPressEvent ( QKeyEvent *  _event  )  [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 83 of file QtBaseViewerKeyHandling.cc.

References actionMode(), lockUpdate(), signalKeyPressEvent(), unlockAndUpdate(), updateGL(), and viewKeyPressEvent().

void ACG::QtWidgets::QtBaseViewer::glKeyReleaseEvent ( QKeyEvent *  _event  )  [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 77 of file QtBaseViewerKeyHandling.cc.

bool ACG::QtWidgets::QtBaseViewer::isUpdateLocked (  )  const [inline]

Are updateDisplayList() and updateGL() locked? (c.f. lockUpdate())

Definition at line 263 of file QtBaseViewer.hh.

Referenced by paintGL(), and updateGL().

bool ACG::QtWidgets::QtBaseViewer::keyHandlingState (  ) 

get the current key handling state.

Definition at line 71 of file QtBaseViewerKeyHandling.cc.

void ACG::QtWidgets::QtBaseViewer::lockUpdate (  )  [virtual]

Lock update of display. If locked (isUpdateLocked()) then all calls to updateDisplayList() and updateGL() will have no effect! This is true until the display is unlockUpdate()'ed.

Definition at line 442 of file QtBaseViewer.cc.

Referenced by glKeyPressEvent(), initializeGL(), and paintGL().

bool ACG::QtWidgets::QtBaseViewer::pick ( SceneGraph::PickTarget  _pickTarget,
const QPoint &  _mousePos,
unsigned int &  _nodeIdx,
unsigned int &  _targetIdx,
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 successfull 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:
Successfull?

Definition at line 79 of file QtBaseViewerPicking.cc.

References ACG::Matrix4x4T< Scalar >::get_raw_data(), glHeight(), glWidth(), makeCurrent(), ACG::GLState::modelview(), ACG::GLState::pick_init(), ACG::GLState::projection(), ACG::SceneGraph::traverse(), and ACG::GLState::unproject().

Referenced by flyTo().

void ACG::QtWidgets::QtBaseViewer::pickingMode (  )  [virtual, slot]

calls actionMode() with PickingMode (cf. ActionMode) Switches to pickingMode

Definition at line 318 of file QtBaseViewerPicking.cc.

References actionMode(), and PickingMode.

void ACG::QtWidgets::QtBaseViewer::pickMode ( int  _id  ) 

Switch to given picking mode

Parameters:
_id Id of the picking Mode

Definition at line 207 of file QtBaseViewerPicking.cc.

References pick_mode_idx_, pick_mode_name_, pick_modes_, PickingMode, signalPickModeChanged(), and trackMouse().

void ACG::QtWidgets::QtBaseViewer::pickMode ( const std::string &  _name  ) 

Switch to given picking mode

Parameters:
_name Name of the picking mode

Definition at line 303 of file QtBaseViewerPicking.cc.

References pick_modes_, pickMode(), and updatePickMenu().

const std::string & ACG::QtWidgets::QtBaseViewer::pickMode (  )  const

return the currently active pick mode

Definition at line 294 of file QtBaseViewerPicking.cc.

References pick_mode_name_.

Referenced by pickMode().

void ACG::QtWidgets::QtBaseViewer::renderPicking ( bool  _renderPicking,
ACG::SceneGraph::PickTarget  _mode 
)

Use this function to switch the viewer to visualize picking. When you set this function to true the renderer will render the picking elements rather then the scene

Definition at line 71 of file QtBaseViewerPicking.cc.

References pickRendererMode_, and renderPicking_.

const ACG::Vec3d& ACG::QtWidgets::QtBaseViewer::scene_center (  )  const [inline]

Get scene's center

See also:
setScenePos()

Definition at line 337 of file QtBaseViewer.hh.

double ACG::QtWidgets::QtBaseViewer::scene_radius (  )  const [inline]

Get scene's radius

See also:
setScenePos()

Definition at line 341 of file QtBaseViewer.hh.

void ACG::QtWidgets::QtBaseViewer::sceneGraph ( SceneGraph::BaseNode _root  ) 

Set scene graph. Sets the scene graph to the the graph rooted at _root. The available draw modes in the scene graph will be collected and the popup menu will be updated.
The sceneGraphToched() signal will be emitted (even if _root does not actually change).

Definition at line 405 of file QtBaseViewer.cc.

References ACG::SceneGraph::BoundingBoxAction::bbMax(), ACG::SceneGraph::BoundingBoxAction::bbMin(), ACG::SceneGraph::CollectDrawModesAction::drawModes(), setScenePos(), signalSceneGraphChanged(), ACG::SceneGraph::traverse(), and updateGL().

void ACG::QtWidgets::QtBaseViewer::setEyeDistance ( double  _distance  ) 

Set eye distance for stereo.

Set the eye distance used for stereo projection. The function will enforce a redraw.

Definition at line 72 of file QtBaseViewerStereo.cc.

References updateGL().

void ACG::QtWidgets::QtBaseViewer::setFocalDistance ( double  _distance  ) 

Set focal distance for stereo.

Set the focal distance used for stereo projection. The function will enforce a redraw.

Definition at line 81 of file QtBaseViewerStereo.cc.

References updateGL().

void ACG::QtWidgets::QtBaseViewer::setPickModeCursor ( const std::string &  _name,
QCursor  _cursor 
) [slot]

set a new cursor for the pick mode

Parameters:
_name Name of the Pick Mode
_cursor the new cursor

Definition at line 251 of file QtBaseViewerPicking.cc.

References pick_mode_name_, pick_modes_, and PickingMode.

void ACG::QtWidgets::QtBaseViewer::setPickModeMouseTracking ( const std::string &  _name,
bool  _mouseTracking 
) [slot]

set mouseTracking for the pick mode

Parameters:
_name Name of the Pick Mode
_mouseTracking true: every mouse movement will emit mouse events not only when mousebutton is pressed

Definition at line 266 of file QtBaseViewerPicking.cc.

References pick_mode_name_, pick_modes_, PickingMode, and trackMouse().

void ACG::QtWidgets::QtBaseViewer::setSceneCenter ( const ACG::Vec3d &  _center  ) 

Set new center point of scene

Definition at line 615 of file QtBaseViewer.cc.

void ACG::QtWidgets::QtBaseViewer::setScenePos ( const ACG::Vec3d &  _center,
double  _radius,
const bool  _setCenter = true 
)

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 590 of file QtBaseViewer.cc.

References ACG::GLState::modelview(), ACG::Matrix4x4T< Scalar >::transform_point(), updateGL(), and updateProjectionMatrix().

Referenced by sceneGraph().

void ACG::QtWidgets::QtBaseViewer::setStatusBar ( QStatusBar *  _sb  ) 

Set status bar. Sets the QStatusBar widget that is used for informational output, e.g. the frame rate of the rotation animation. If sb==0 a private QStatusBar will be used, cf. Options. This private status bar may be invisible, but statusBar() will never return 0 even if setStatusBar(0) has been called!

Definition at line 347 of file QtBaseViewer.cc.

References ShowPrivateStatusBar.

Referenced by applyOptions().

void ACG::QtWidgets::QtBaseViewer::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.

void ACG::QtWidgets::QtBaseViewer::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.

Referenced by glKeyPressEvent().

void ACG::QtWidgets::QtBaseViewer::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:

Referenced by glMouseDoubleClickEvent(), glMouseMoveEvent(), glMousePressEvent(), and glMouseReleaseEvent().

void ACG::QtWidgets::QtBaseViewer::signalMouseEventIdentify ( QMouseEvent *   )  [signal]

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

Referenced by glMouseDoubleClickEvent(), glMouseMoveEvent(), glMousePressEvent(), and glMouseReleaseEvent().

void ACG::QtWidgets::QtBaseViewer::signalPickModeChanged ( const std::string &   )  [signal]

This signal is emitted when the pickMode is changed and contains the new PickMode

Referenced by actionMode(), and pickMode().

void ACG::QtWidgets::QtBaseViewer::snapshot (  )  [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 82 of file QtBaseViewerSnapshot.cc.

References copyToImage(), encodeView(), glHeight(), glWidth(), makeCurrent(), and paintGL().

Referenced by actionSnapshot().

void ACG::QtWidgets::QtBaseViewer::snapshotBaseFileName ( const QString &  _fname  )  [virtual, slot]

Set the base file name and reset the counter for snapshots.

The image file format is determined from the file name extension, the QImageIO formats are supported (e.g. ".ppm" [raw], ".png").

The current snapshot counter will be added in front of the last "." in the filename.

Note: Calling snapshotBaseFileName() will always reset the snapshot counter to 0.

Definition at line 72 of file QtBaseViewerSnapshot.cc.

Referenced by actionSnapshotName().

void ACG::QtWidgets::QtBaseViewer::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 )

Referenced by glMousePressEvent().

void ACG::QtWidgets::QtBaseViewer::sync_connect ( const QtBaseViewer _other  ) 

Synchronize with other QtBaseViewer. A QtBaseViewer can be synchronized with other instances. The viewing position is copied from the other widget after each transformation.

Definition at line 68 of file QtBaseViewerSynchronization.cc.

References setView(), and signalSetView().

void ACG::QtWidgets::QtBaseViewer::unlockAndUpdate (  )  [virtual]

Convenient unlock and update. Calls unlockUpdate() and then updateDisplayList() and updateGL() (Note that this has only an effect if !isUpdateLocked().)

Definition at line 456 of file QtBaseViewer.cc.

References unlockUpdate(), and updateGL().

Referenced by glKeyPressEvent().

virtual bool ACG::QtWidgets::QtBaseViewer::viewKeyPressEvent ( QKeyEvent *  _event  )  [protected, pure virtual]

Handle key events in view mode.

This funtion 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

Implemented in ACG::QtWidgets::QtExaminerViewer.

Referenced by glKeyPressEvent().


Member Data Documentation

flag defining, if dragging will be handled internal by the viewer or passed via signals to the application

Definition at line 1047 of file QtBaseViewer.hh.

Referenced by glDragEnterEvent(), glDropEvent(), and glMousePressEvent().

Index of current pickMode

Definition at line 1274 of file QtBaseViewer.hh.

Referenced by actionMode(), clearPickModes(), pickMode(), and updatePickMenu().

Vector of all Picking modes

Definition at line 1266 of file QtBaseViewer.hh.

Referenced by actionMode(), addPickMode(), clearPickModes(), pickMode(), setPickModeCursor(), setPickModeMouseTracking(), and updatePickMenu().

If rendering is in picking mode, this variable controls which picking targets will be rendered. ( see renderPicking_ , renderPicking(bool _renderPicking, PickRendererMode _mode) , and ACG::SceneGraph::PickTarget

Definition at line 1284 of file QtBaseViewer.hh.

Referenced by renderPicking().

This variable controls if the scene is rendered in normal or in picking mode

Definition at line 1278 of file QtBaseViewer.hh.

Referenced by renderPicking().


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

acg pic Project OpenFlipper, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .