Developer Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
ACG::QtWidgets::QtBaseViewer Class Referenceabstract

#include <ACG/QtWidgets/QtBaseViewer.hh>

Inheritance diagram for ACG::QtWidgets::QtBaseViewer:
ACG::QtWidgets::QtExaminerViewer

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

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

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 More...
 
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_
 Set eye distance for stereo. More...
 
double eyeDist_
 Set eye distance for stereo. More...
 
double focalDist_
 Set eye distance for stereo. More...
 
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.
 
virtual void toggleStereoMode ()
 toggle stereo mode
 
virtual void setStereoMode (bool _b)
 enable/disable stereo mode
 

Key handling

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

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 ()
 synchronized with different viewer?
 
void sync_receive ()
 synchronized with different viewer?
 
void sync_send (const GLMatrixd &_modelview, const GLMatrixd &_inverse_modelview)
 synchronized with different viewer?
 

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 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)
 
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...
 
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 130 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 362 of file QtBaseViewer.hh.

orientation of the faces

Enumerator
CCW_ORIENTATION 

counter clockwise (default)

CW_ORIENTATION 

clockwise

Definition at line 391 of file QtBaseViewer.hh.

Navigation mode.

Enumerator
NORMAL_NAVIGATION 

Normal mode.

FIRSTPERSON_NAVIGATION 

First person mode.

Definition at line 312 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 412 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 140 of file QtBaseViewer.hh.

projection mode

Enumerator
ORTHOGRAPHIC_PROJECTION 

orthographic

PERSPECTIVE_PROJECTION 

perspective

Definition at line 318 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
_parentparent widget
_namename (qt internal, qt debugging)
_statusBarpointer to an existing status bar for this widget, if statusBar==0 then a private status bar will be created
_formatOpenGL context settings, will be passed to glarea()
_shareSecond base viewer for shared context
_optionsQtBaseViewer::Options

Definition at line 136 of file QtBaseViewer.cc.

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

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

This action triggers a snapshot

Definition at line 135 of file QtBaseViewerSnapshot.cc.

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

This action creates a widget for entering the snapshots name.

Definition at line 144 of file QtBaseViewerSnapshot.cc.

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

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

Definition at line 165 of file QtBaseViewerSnapshot.cc.

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
_nameName of the Pick Mode or "Separator" to insert a separator
_mouse_trackingtrue: every mouse movement will emit mouse events not only when mousebutton is pressed
_posposition to insert the mode in the popup menu.
_visibleVisible or hidden pick mode
_cursorActive cursor for that pick mode

Definition at line 251 of file QtBaseViewerPicking.cc.

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

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

clear all pick modes

Definition at line 302 of file QtBaseViewerPicking.cc.

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

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

void ACG::QtWidgets::QtBaseViewer::drawNow ( )
virtualslot

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

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.

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

Definition at line 202 of file QtBaseViewerPicking.cc.

void ACG::QtWidgets::QtBaseViewer::flyTo ( const QPoint &  _pos,
bool  _move_back 
)
virtualslot

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

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

void ACG::QtWidgets::QtBaseViewer::glContextMenuEvent ( QContextMenuEvent *  _event)
protectedvirtual

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

void ACG::QtWidgets::QtBaseViewer::glKeyPressEvent ( QKeyEvent *  _event)
protectedvirtual

Get keyPress events from the glArea.

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

Definition at line 90 of file QtBaseViewerKeyHandling.cc.

void ACG::QtWidgets::QtBaseViewer::glKeyReleaseEvent ( QKeyEvent *  _event)
protectedvirtual

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 84 of file QtBaseViewerKeyHandling.cc.

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

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

Definition at line 271 of file QtBaseViewer.hh.

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

get the current key handling state.

Definition at line 78 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 426 of file QtBaseViewer.cc.

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
_pickTargetSelect what should be picked: Faces/Vertices/...
_mousePosThe position to be used for picking
_nodeIdxIf picking is successfull 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
Successfull?

Definition at line 86 of file QtBaseViewerPicking.cc.

void ACG::QtWidgets::QtBaseViewer::pickingMode ( )
virtualslot

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

Definition at line 338 of file QtBaseViewerPicking.cc.

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

return the currently active pick mode

Definition at line 314 of file QtBaseViewerPicking.cc.

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

Switch to given picking mode

Parameters
_nameName of the picking mode

Definition at line 323 of file QtBaseViewerPicking.cc.

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

Switch to given picking mode

Parameters
_idId of the picking Mode

Definition at line 227 of file QtBaseViewerPicking.cc.

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 78 of file QtBaseViewerPicking.cc.

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

Get scene's center

See also
setScenePos()

Definition at line 347 of file QtBaseViewer.hh.

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

Get scene's radius

See also
setScenePos()

Definition at line 351 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).

Parameters
_rootThe root node of the scene graph

Definition at line 389 of file QtBaseViewer.cc.

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 79 of file QtBaseViewerStereo.cc.

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 88 of file QtBaseViewerStereo.cc.

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

set a new cursor for the pick mode

Parameters
_nameName of the Pick Mode
_cursorthe new cursor

Definition at line 271 of file QtBaseViewerPicking.cc.

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

set mouseTracking for the pick mode

Parameters
_nameName of the Pick Mode
_mouseTrackingtrue: every mouse movement will emit mouse events not only when mousebutton is pressed

Definition at line 286 of file QtBaseViewerPicking.cc.

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

Set new center point of scene

Definition at line 599 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 574 of file QtBaseViewer.cc.

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

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.

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:

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

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

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

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

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

void ACG::QtWidgets::QtBaseViewer::snapshotBaseFileName ( const QString &  _fname)
virtualslot

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 78 of file QtBaseViewerSnapshot.cc.

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 )

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 75 of file QtBaseViewerSynchronization.cc.

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

virtual bool ACG::QtWidgets::QtBaseViewer::viewKeyPressEvent ( QKeyEvent *  _event)
protectedpure 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.

Member Data Documentation

bool ACG::QtWidgets::QtBaseViewer::disableKeyHandling_
private

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

bool ACG::QtWidgets::QtBaseViewer::externalDrag_
private

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

Definition at line 1062 of file QtBaseViewer.hh.

double ACG::QtWidgets::QtBaseViewer::eyeDist_
private

Set eye distance for stereo.

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

Definition at line 960 of file QtBaseViewer.hh.

double ACG::QtWidgets::QtBaseViewer::focalDist_
private

Set eye distance for stereo.

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

Definition at line 960 of file QtBaseViewer.hh.

int ACG::QtWidgets::QtBaseViewer::pick_mode_idx_
private

Index of current pickMode

Definition at line 1291 of file QtBaseViewer.hh.

std::string ACG::QtWidgets::QtBaseViewer::pick_mode_name_
private

Name of current pickMode

Definition at line 1287 of file QtBaseViewer.hh.

std::vector<PickMode> ACG::QtWidgets::QtBaseViewer::pick_modes_
private

Vector of all Picking modes

Definition at line 1283 of file QtBaseViewer.hh.

ACG::SceneGraph::PickTarget ACG::QtWidgets::QtBaseViewer::pickRendererMode_
private

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

bool ACG::QtWidgets::QtBaseViewer::renderPicking_
private

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

Definition at line 1295 of file QtBaseViewer.hh.

QImage* ACG::QtWidgets::QtBaseViewer::snapshot_
private

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

int ACG::QtWidgets::QtBaseViewer::snapshotCounter_
private

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

QString ACG::QtWidgets::QtBaseViewer::snapshotName_
private

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

bool ACG::QtWidgets::QtBaseViewer::stereo_
private

Set eye distance for stereo.

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

Definition at line 959 of file QtBaseViewer.hh.


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