Developer Documentation
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, QGLWidget *_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)
 

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!
 
glVieweroperator= (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
 
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::BaseNodesceneGraphRoot_
 
bool projectionUpdateLocked_
 
QGraphicsScene * glScene_
 
QGLWidget * glWidget_
 
QtGLViewerLayoutglBaseLayout_
 
std::vector< QAction * > drawMenuActions_
 
QTime redrawTime_
 
Post Processing
PostProcessingpostproc_
 Post-Processing executor.
 

Friends

class QtGLGraphicsScene
 
class SimpleGLGraphicsScene
 
class QtGLGraphicsView
 

Wheels

ACG::QtWidgets::QtWheelwheelX_
 
ACG::QtWidgets::QtWheelwheelY_
 
ACG::QtWidgets::QtWheelwheelZ_
 
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 QGLFramebufferObjectFormat QFramebufferObjectFormat
 Framebuffer object that holds the pick cache.
 
typedef QGLFramebufferObject QFramebufferObject
 Framebuffer object that holds the pick cache.
 
QFramebufferObjectpickCache_
 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, unsigned int &_nodeIdx, unsigned int &_targetIdx, ACG::Vec3d *_hitPointPtr=0)
 
bool pick_region (ACG::SceneGraph::PickTarget _pickTarget, const QRegion &_region, QList< QPair< unsigned int, unsigned int > > &_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, unsigned int &_nodeIdx, unsigned int &_targetIdx, ACG::Vec3d *_hitPointPtr=0)
 pick using colors
 
int pickFromCache (ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, unsigned int &_nodeIdx, unsigned int &_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::Vec3dgetConstrainedRotationAxis ()
 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::ViewerPropertiesproperties_
 All properties for this viewer.
 
ACG::GLStateglstate_
 Gl State.
 
bool initialized_
 Have the viewer gl properties been initalized.
 
Viewer::ViewerPropertiesproperties ()
 Returns a pointer to the Viewer Status.
 
const Viewer::ViewerPropertiesproperties () 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 130 of file QtBaseViewer.hh.

Member Enumeration Documentation

Navigation mode.

Enumerator
NORMAL_NAVIGATION 

Normal mode.

FIRSTPERSON_NAVIGATION 

First person mode.

Definition at line 206 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 234 of file QtBaseViewer.hh.

projection mode

Enumerator
ORTHOGRAPHIC_PROJECTION 

orthographic

PERSPECTIVE_PROJECTION 

perspective

Definition at line 200 of file QtBaseViewer.hh.

Constructor & Destructor Documentation

glViewer::glViewer ( QGraphicsScene *  _scene,
QGLWidget *  _glWidget,
Viewer::ViewerProperties _properties,
QGraphicsWidget *  _parent = 0 
)

Create a glViewer.

Parameters
_sceneThe graphics scene that will be the parent of this widget
_glWidgetA pointer to the underlying gl widget
_propertiesviewerOptions controlled by PluginFunctions
_parentThe parent graphicswidget

Definition at line 128 of file QtBaseViewer.cc.

Member Function Documentation

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

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

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

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 885 of file QtBaseViewer.hh.

bool glViewer::allowConstrainedRotation ( )
inline

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 888 of file QtBaseViewer.hh.

bool glViewer::allowRotation ( )
inline

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 883 of file QtBaseViewer.hh.

void glViewer::applyProperties ( )
private

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

Definition at line 2167 of file QtBaseViewer.cc.

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
_widthviewport width
_heightviewport height
_propertiesviewer props
_outLeft[out] projection matrix for left eye
_outRight[out] projection matrix for right eye

Definition at line 2539 of file QtBaseViewer.cc.

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

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

void glViewer::disallowConstrainedRotation ( )
inline

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 894 of file QtBaseViewer.hh.

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.

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.

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

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

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

Parameters
_mousePosThe position to pick
_hitPointThe point returned by the reprojection
Returns
Successful?

Definition at line 613 of file QtBaseViewerPicking.cc.

virtual void glViewer::flyFrom ( const QPoint &  _pos)
inlinevirtualslot

Animated flight.

Animated flight away from the given point.

Definition at line 1013 of file QtBaseViewer.hh.

void glViewer::flyTo ( const QPoint &  _pos,
bool  _moveBack 
)
virtualslot

Animated flight to or away from a given point.

Animated flight to or away from a given point.

Parameters
_posPoint defining direction of flight (eye-point)
_moveBackTo or away from point?

Definition at line 71 of file QtBaseViewerFlyAnimation.cc.

virtual void glViewer::flyTo ( const QPoint &  _pos)
inlinevirtualslot

Animated flight.

Animated flight into the direction of the given point.

Definition at line 1005 of file QtBaseViewer.hh.

void glViewer::flyTo ( const ACG::Vec3d _position,
const ACG::Vec3d _center,
int  _time = 1000 
)
virtualslot

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

Parameters
_positionNew viewer position ( the new eye point of the viewer )
_centerThe new scene center ( the point we are looking at )
_timeAnimation time in ms

Definition at line 227 of file QtBaseViewerFlyAnimation.cc.

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

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 891 of file QtBaseViewer.hh.

void glViewer::initializeGL ( )
protectedvirtual

Return a resonable size hint.

initialize OpenGL states

Definition at line 973 of file QtBaseViewer.cc.

void glViewer::invalidatePickCache ( )
inline

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 897 of file QtBaseViewer.hh.

virtual void glViewer::keyPressEvent ( QKeyEvent *  _event)
inlineprotectedvirtual

Get keyPress events from the glArea.

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

Definition at line 706 of file QtBaseViewer.hh.

virtual void glViewer::keyReleaseEvent ( QKeyEvent *  _event)
inlineprotectedvirtual

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

bool glViewer::pick ( ACG::SceneGraph::PickTarget  _pickTarget,
const QPoint &  _mousePos,
unsigned int &  _nodeIdx,
unsigned int &  _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
_pickTargetSelect what should be picked: Faces/Vertices/...
_mousePosThe position to be used for picking
_nodeIdxIf picking is successful this will contain the id of the scenegraph node picked.
_targetIdxSpecial index defined by the picked Node. E.g. Facehandle/VertexHandle/.. for MeshNodes
_hitPointPtrPointer to 3D point from picking
Returns
Successful?

Definition at line 77 of file QtBaseViewerPicking.cc.

bool glViewer::pick_region ( ACG::SceneGraph::PickTarget  _pickTarget,
const QRegion &  _region,
QList< QPair< unsigned int, unsigned int > > &  _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
_pickTargetSelect what should be picked: Faces/Vertices/...
_regionArea for picking
_listList of found scenegraph objects (node/target pairs)
_depthsdepths [0,1] (Only provided, if requested)
_pointsback projected 3d points (Only provided, if requested)
Returns
Successful?

Definition at line 417 of file QtBaseViewerPicking.cc.

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

Get scene's center

See also
setScenePos()

Definition at line 676 of file QtBaseViewer.hh.

double glViewer::scene_radius ( ) const
inline

Get scene's radius

Definition at line 679 of file QtBaseViewer.hh.

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
_rootThe root node of the scene graph
_maxPassesThe maximal number of passes required to render the scenegraph
_bbminLower left of the scenegraph bounding box
_bbmaxUpper right of the scenegraph bounding box
_resetTrackBallReset the trackball center?

Definition at line 240 of file QtBaseViewer.cc.

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

Set new center point of scene

Definition at line 659 of file QtBaseViewer.hh.

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

void glViewer::setSceneRadius ( double  _radius)
inline

Set new center point of scene

Definition at line 681 of file QtBaseViewer.hh.

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

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.

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.

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.
void glViewer::signalMouseEventClick ( QMouseEvent *  ,
bool  _double 
)
signal

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

void glViewer::signalMouseEventIdentify ( QMouseEvent *  )
signal

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

void glViewer::signalMouseEventLight ( QMouseEvent *  )
signal

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

void glViewer::slotAnimation ( )
privateslot

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 2145 of file QtBaseViewer.cc.

void glViewer::slotPropertiesUpdated ( )
privateslot

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

Definition at line 2193 of file QtBaseViewer.cc.

void glViewer::snapshot ( int  _width = 0,
int  _height = 0,
bool  _alpha = false,
bool  _hideCoordsys = false,
int  samples = 1 
)
virtualslot

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

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 )

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

virtual bool glViewer::viewKeyPressEvent ( QKeyEvent *  )
inlineprotectedvirtual

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

Member Data Documentation

bool glViewer::allowRotation_
private

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 934 of file QtBaseViewer.hh.

QMouseEvent glViewer::clickEvent_
private

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 946 of file QtBaseViewer.hh.

QTime glViewer::clickTime_
private

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 945 of file QtBaseViewer.hh.

QTimer glViewer::clickTimer_
private

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 944 of file QtBaseViewer.hh.

ACG::Vec3d glViewer::constrainedRotationAxis_
private

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 938 of file QtBaseViewer.hh.

double glViewer::fovyModifier_
private

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 942 of file QtBaseViewer.hh.

QTime glViewer::lastMoveTime_
private

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 940 of file QtBaseViewer.hh.

QPoint glViewer::lastPoint2D_
protected

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 911 of file QtBaseViewer.hh.

ACG::Vec3d glViewer::lastPoint3D_
private

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 932 of file QtBaseViewer.hh.

bool glViewer::lastPoint_hitSphere_
private

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 933 of file QtBaseViewer.hh.

double glViewer::lastRotationAngle_
private

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 939 of file QtBaseViewer.hh.

ACG::Vec3d glViewer::lastRotationAxis_
private

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 937 of file QtBaseViewer.hh.

float glViewer::startDepth_
protected

mouse interaction depth

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

Definition at line 917 of file QtBaseViewer.hh.

QTimer* glViewer::timer_
private

mouse interaction position

This variable stores the last mouse position during mouse interaction.

Definition at line 941 of file QtBaseViewer.hh.


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